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
This commit is contained in:
1 parent
d6e973c3ce
commit
9d06050338
8 files changed
+119
-6
No files matched your search
@@ -158,7 +158,7 @@ own decision-document schema verified against a live CLI first (this repo has no
|
||||
unverified, per the same rule that governed the Vibe adapter: an adapter that cannot be verified
|
||||
is not written.
|
||||
|
||||
Three details in that file are load-bearing, and the first holds for all three hook
|
||||
Four details in that file are load-bearing, and the first two hold for all three hook
|
||||
configurations:
|
||||
|
||||
- **The interpreter is the venv's, never the script's shebang.** Each `bash` command is
|
||||
@@ -169,6 +169,14 @@ configurations:
|
||||
(`python3`) was the Microsoft Store alias in Git Bash on Windows, which made every hook there
|
||||
a silent no-op. Before the preflight has created the venv, `trace-hook` records nothing and
|
||||
exits 0.
|
||||
- **`./tools/trace-hook` has a PowerShell twin, `tools/trace-hook.ps1`.** PowerShell on
|
||||
Windows resolves the string to the `.ps1` first; without one, it hands the sh script to a
|
||||
file association and Windows asks which app should open it - on every hook event. A `bash`
|
||||
field alone does not keep the string out of PowerShell: Copilot CLI also reads
|
||||
`.claude/settings.json` and runs its single `command` under PowerShell on Windows. The twin
|
||||
keeps the sh script's rules - venv Python, silent without a venv, exit 0 whatever happens -
|
||||
and avoids `#Requires -Version 7`, because VS Code starts hooks under Windows PowerShell 5.1.
|
||||
Each `powershell` command here is written so 5.1 can parse it, too.
|
||||
- **Every command ends in `|| true`.** `preToolUse` hooks are *fail-closed*: a non-zero exit
|
||||
denies the tool call. Without the guard, a missing interpreter would turn the observer into
|
||||
a blocker that refuses every tool call in the session. (Timeouts are fail-open, so the
|
||||
|
||||
Reference in new issue
Block a user