fix: trace-hook.ps1 - Copilot hooks under PowerShell on Windows no longer open the choose-an-app dialog (#164)
CI / verify (push) Successful in 2m26s
CI / pwsh (push) Successful in 1m53s
Release / release (push) Successful in 35s

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:
torben committed 2026-10-01 16:50:13 +02:00
1 parent d6e973c3ce
commit 9d06050338
8 files changed
+119 -6

No files matched your search

+26 -1
View File
@@ -59,7 +59,7 @@ concern - readable here, never shipped as something to parse.
---
## 8.0.0-beta.17 - 2026-10-01 - preflight.ps1: the asset-mode error helper is Exit-Asset, so PSScriptAnalyzer passes
## 8.0.0-beta.18 - 2026-10-01 - trace-hook.ps1: Copilot hooks no longer open Windows' choose-an-app dialog
**Author:** Torben Nehmer
@@ -91,6 +91,7 @@ concern - readable here, never shipped as something to parse.
- Path budget: a file's path stays at 160 characters or fewer so a Windows checkout works without long paths (#163)
- PowerShell 7 preflight and launcher: tools/preflight.ps1, tools/wikitool.ps1, doctor checks for execution policy and Mark of the Web
- Preflight as a release asset: download, verify and unpack the stack, then run the tree preflight
- trace-hook.ps1: Copilot hooks no longer open Windows' choose-an-app dialog
**Low impact**
- version bump no longer points at version release in its output
@@ -128,6 +129,30 @@ concern - readable here, never shipped as something to parse.
- preflight.ps1: the asset-mode error helper is Exit-Asset, so PSScriptAnalyzer passes
<!-- /wikitool:bumps -->
### trace-hook.ps1: Copilot hooks no longer open Windows' choose-an-app dialog
On the Windows target machine, Copilot opened Windows' "choose an app" dialog for `trace-hook`
on hook events (Gitea #164). Some PowerShell had run `./tools/trace-hook ...`, and an
extensionless sh script has no program associated with it. The `bash` field of
`.github/hooks/wiki-trace.json` was not the path in: both Copilot clients take the `powershell`
field on Windows. Copilot CLI, however, also reads `.claude/settings.json`, whose
`UserPromptSubmit` hook has only a `command`, and it runs that `command` under PowerShell on
Windows.
`tools/trace-hook.ps1` is the PowerShell twin of `tools/trace-hook`, after the
`wikitool`/`wikitool.ps1` pattern: PowerShell on Windows resolves `./tools/trace-hook` to the
`.ps1` first. It does what the sh script does: it runs `trace_ingest.py` with the venv's Python
in either layout, records nothing without a venv, and exits 0 whatever happens. It has no
`#Requires -Version 7`, because VS Code starts hooks under Windows PowerShell 5.1. No hook
command string changed, so Linux, macOS and Claude Code under Git Bash behave exactly as
before. The preflight's and `doctor`'s Mark of the Web check and CI's PSScriptAnalyzer step
already cover every `.ps1` under `tools/`.
New tests: one guards that every extensionless hook target has a `.ps1` twin. The pwsh tests
cover arguments and stdin reaching the venv Python, silence without a venv, and exit 0 when
the Python fails. Whether the dialog is really gone in both clients is checked by hand on the
target machine.
### preflight.ps1: the asset-mode error helper is Exit-Asset, so PSScriptAnalyzer passes
The helper that ends asset mode with exit 1 was called `Stop-Asset`. `Stop` is one of the verbs