fix: honor the planning opt-out on the Cursor route and keep the disabled Copilot hook neutral
The #195 opt-out lives in scripts/inject-plan.sh, and the Cursor hooks read
task_plan.md directly instead of dispatching to it, so PLANNING_DISABLED=1
never reached any of the eight. Each guard reproduces its own hook's
no-plan-file output, so the Cursor protocol shape is unchanged: PreToolUse
still answers {"decision": "allow"} because that is what it emits
unconditionally today, and the other three stay silent.
Three defects found while auditing #222, #223 and #224:
- The Copilot PreToolUse guard answered permissionDecision "allow" on the
disabled path, so setting the variable to make planning inert also handed
every tool call a blanket approval. Both copies now emit {}, matching
their own no-plan-file path, which returns the decision to Copilot.
- .cursor/hooks/stop.ps1 was the last copy the #191 zero-phase guard never
reached. It answered "0/0 phases done" and auto-continued on a plan that
was never phase-structured.
- .github/hooks/scripts/error-occurred.ps1 read stdin into $input, which is
PowerShell's automatic pipeline variable. Under -File the assignment does
not stick, so the JSON parse always saw an empty string and the hook has
never logged an error on Windows. Reproduced under pwsh 7 and Windows
PowerShell 5.1 before the rename.
The opt-out tests now run every hook twice, unset and set, and fail if the
unset run is already inert. The merged versions asserted only the disabled
run, which a fleet gutted to unconditional {} also passed. That baseline is
what caught the $input bug. O
OthmanAdi committed
ee6021bcfb65840e64de6ab6663810599988eb9a
Parent: 5898865