com.github.copilot/hooks/hooks.json

{
    "hooks": {
        "PreToolUse": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -Command \"try { & (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')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Block-RemoteMutation.ps1.'); exit 2 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { & (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('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Block-RemoteMutation.ps1')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Block-RemoteMutation.ps1.'); exit 2 }\""
            }
        ],
        "SessionStart": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -Command \"try { & (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')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Add-SessionContext.ps1.'); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { & (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('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Add-SessionContext.ps1')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Add-SessionContext.ps1.'); exit 1 }\""
            }
        ],
        "Stop": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -Command \"try { & (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')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Write-SessionClose.ps1.'); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { & (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('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-SessionClose.ps1')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Write-SessionClose.ps1.'); exit 1 }\""
            }
        ],
        "PreCompact": [
            {
                "type": "command",
                "timeout": 20,
                "command": "pwsh -NoProfile -NonInteractive -Command \"try { & (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')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Write-CompactionCheckpoint.ps1.'); exit 1 }\"",
                "windows": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command \"try { & (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('USERPROFILE')).PadLeft(1, [char]42), '.copilot/hooks/scripts/Write-CompactionCheckpoint.ps1')) | Select-Object -First 1 -ExpandProperty FullName); exit (Get-Variable -Name LASTEXITCODE -ValueOnly -ErrorAction SilentlyContinue) } catch { [Console]::Error.WriteLine('CopilotAtelier hook could not resolve Write-CompactionCheckpoint.ps1.'); exit 1 }\""
            }
        ]
    }
}