-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.json
More file actions
53 lines (53 loc) · 15.5 KB
/
Copy pathhooks.json
File metadata and controls
53 lines (53 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
"version": 1,
"hooks": {
"SessionStart": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
],
"SessionEnd": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
],
"UserPromptSubmit": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
],
"PreToolUse": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
],
"PostToolUse": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
],
"Stop": [
{
"type": "command",
"bash": "#!/usr/bin/env bash\n# Bootstrap for the copilot-custom-logging plugin hooks (macOS/Linux).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\nexport COPILOT_OTEL_INPUT=\"$(cat)\"\n\nDISPATCH=\"${COPILOT_OTEL_DISPATCH:-}\"\nif [ -z \"$DISPATCH\" ]; then\n ROOT=\"${COPILOT_HOME:-$HOME/.copilot}/installed-plugins\"\n DISPATCH=\"$(find \"$ROOT\" -name otel_dispatch.py -path '*copilot-custom-logging*' 2>/dev/null | head -n1)\"\nfi\n[ -f \"$DISPATCH\" ] || exit 0\n\nif command -v python3 >/dev/null 2>&1; then PY=python3\nelif command -v python >/dev/null 2>&1; then PY=python\nelse exit 0\nfi\n\nexec \"$PY\" \"$DISPATCH\"\n",
"powershell": "# Bootstrap for the copilot-custom-logging plugin hooks (Windows).\n#\n# Copilot runs hook commands with the user's working directory, not the\n# plugin directory, so a plain relative path to the dispatcher won't resolve.\n# This bootstrap reads the event payload, locates otel_dispatch.py inside the\n# installed plugin directory, and runs it. hooks.json embeds a copy of this\n# script (it is the tiny entry point); all real logic lives in\n# otel_dispatch.py.\n#\n# It always exits 0 (fail-open): a PreToolUse command hook is fail-closed on a\n# non-zero exit, so telemetry problems must never block the user's tools.\n$env:COPILOT_OTEL_INPUT = [Console]::In.ReadToEnd()\n\n$dispatch = $env:COPILOT_OTEL_DISPATCH\nif (-not $dispatch) {\n $root = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }\n $dispatch = Get-ChildItem -Path (Join-Path $root 'installed-plugins') -Recurse -Filter otel_dispatch.py -ErrorAction SilentlyContinue |\n Where-Object { $_.FullName -like '*copilot-custom-logging*' } |\n Select-Object -First 1 -ExpandProperty FullName\n}\nif (-not $dispatch -or -not (Test-Path $dispatch)) { exit 0 }\n\n$py = Get-Command python -ErrorAction SilentlyContinue\nif (-not $py) { $py = Get-Command python3 -ErrorAction SilentlyContinue }\nif (-not $py) { exit 0 }\n\n& $py.Source $dispatch\nexit 0\n",
"timeoutSec": 30
}
]
}
}