Skip to content

Fix Windows hook failures: replace bash-only hooks with cross-platform command hooks#88

Draft
calebwilson706 wants to merge 1 commit into
mainfrom
fix/windows-hooks-cross-platform
Draft

Fix Windows hook failures: replace bash-only hooks with cross-platform command hooks#88
calebwilson706 wants to merge 1 commit into
mainfrom
fix/windows-hooks-cross-platform

Conversation

@calebwilson706

Copy link
Copy Markdown
Contributor

Summary

  • Command-type hook entries in .github/hooks/hooks.json only ran bash, which is never consulted on Windows — Copilot CLI had no command to run there at all, independent of Git Bash/WSL.
  • Replaced the three bash hook scripts with plain CommonJS Node scripts and pointed every hooks.json entry at the cross-platform command key instead of bash, so there's one implementation instead of parallel bash/powershell forks.
  • Removed the now-inaccurate "Windows only: Git for Windows" prerequisite from the README, dropped the *.sh .gitattributes rule (no .sh files remain), and repointed the Lesson 23 reference from pre-tool-use.sh to pre-tool-use.js.

Test plan

  • Ran the full pre-tool-use.js payload matrix (JSON-string/inline toolArgs, edit/create/read, unrelated path, path traversal, Windows backslash path, malformed/empty stdin) — all matched expected allow/no-output + exit code.
  • Verified session-start.js bootstraps tutorial/state.json byte-exact, is a no-op on second run, and normalises CRLF lesson files to LF, in a scratch copy of the repo.
  • Verified prompt-context.js selects the right lesson file for various currentLesson values, falls back correctly when none match, and defaults to lesson 0 on malformed state.
  • Confirmed no .sh files remain anywhere in the repo.
  • Real end-to-end copilot CLI run blocked by an org Copilot policy (403 unauthorized) unrelated to this change — hooks.json parsed with no schema errors, but couldn't observe a live hook invocation through the CLI. Recommend a manual spot-check (ideally on Windows) before merging.

🤖 Generated with Claude Code

Command-type hooks only support bash (Unix) or powershell (Windows) as
platform-specific keys, plus a cross-platform command fallback. hooks.json
set only bash on all three hooks, so Copilot CLI had no command to run on
Windows regardless of Git Bash/WSL. Rewriting the hooks as plain Node
scripts and pointing hooks.json at the command key fixes this without
maintaining parallel bash/powershell implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant