Files
torben 9d06050338
CI / verify (push) Successful in 2m26s
CI / pwsh (push) Successful in 1m53s
Release / release (push) Successful in 35s
fix: trace-hook.ps1 - Copilot hooks under PowerShell on Windows no longer open the choose-an-app dialog (#164)
Files changed:
- CHANGES.md
- EVALS.md
- VERSION
- tools/README.md
- tools/chemenu/tests/test_preflight.py
- tools/chemenu/tests/test_preflight_pwsh.py
- tools/trace-hook
- tools/trace-hook.ps1
2026-10-01 16:50:13 +02:00

29 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# What the harness hooks call: tools/trace_ingest.py, run by the venv's Python.
#
# tools/trace-hook --source claude-code --event prompt.submitted
#
# A hook command is a fixed string in a harness's config file (.claude/settings.json,
# .github/hooks/wiki-trace.json, .vibe/hooks.toml) and cannot read
# .wikitool-tools.json. The venv's Python can stand in for the recorded one: the
# preflight creates it from exactly that interpreter, and it sits at a fixed
# place - only its layout differs (bin/ everywhere but Windows, Scripts\ there,
# which is also what Git Bash sees). trace_ingest.py uses the standard library
# only, so the venv adds nothing it needs; it just makes the interpreter findable.
#
# Relying on the script's own shebang (`python3`) is what this replaces: in
# Git Bash on Windows, `python3` is the Microsoft Store alias.
#
# No venv yet - before the preflight has run - means no trace, silently. A hook
# must never fail the call it observes.
#
# PowerShell on Windows never reaches this file: it resolves the same string to
# trace-hook.ps1 next to it, which does the same.
DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P) || exit 0
if [ -x "$DIR/.venv/bin/python" ]; then
exec "$DIR/.venv/bin/python" "$DIR/trace_ingest.py" "$@"
elif [ -f "$DIR/.venv/Scripts/python.exe" ]; then
exec "$DIR/.venv/Scripts/python.exe" "$DIR/trace_ingest.py" "$@"
fi
exit 0