com.github.copilot/hooks/hooks.json

{
    "hooks": {
        "PreToolUse": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Block-RemoteMutation.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 2 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Block-RemoteMutation.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 2 }\""
            }
        ],
        "SessionStart": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Add-SessionContext.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Add-SessionContext.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\""
            }
        ],
        "Stop": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Write-SessionClose.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Write-SessionClose.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\""
            }
        ],
        "PreCompact": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Write-CompactionCheckpoint.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { Set-Variable -Name CopilotAtelierHook -Value (Get-Item -ErrorAction SilentlyContinue -LiteralPath ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('PLUGIN_ROOT')).PadLeft(1, [char]42), 'com.github.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('HOME')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetEnvironmentVariable('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')), ([IO.Path]::Combine('/', ([string][Environment]::GetFolderPath('UserProfile')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')) | Select-Object -First 1 -ExpandProperty FullName); if (-not (Get-Variable -Name CopilotAtelierHook -ValueOnly)) { throw 'could not resolve the script under PLUGIN_ROOT, HOME, USERPROFILE or the user profile folder' }; & (Get-Variable -Name CopilotAtelierHook -ValueOnly); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook Write-CompactionCheckpoint.ps1 failed: ' + (Get-Variable -Name _ -ValueOnly)); exit 1 }\""
            }
        ]
    }
}