Repository navigation
fix(lefthook): run the pre-commit on Windows - #998
Merged
Merged
Conversation
Lefthook on Windows runs each job through a command line it builds by hand, `"sh" -c "<script>"`, with nothing escaped (internal/run/controller/exec/ exec_windows.go in 2.1.14). Every job that fails in #948 holds both a line break and a double quote, so the report cannot tell which one breaks it. The Windows job now probes the three shapes on their own, a multiline run with no quote, a one-line run with a double quote and one with a single quote, and reports each exit code without failing. It then runs this repository's own pre-commit over every file, leaving out the three jobs that need cli/'s dependencies, and fails only on a shell syntax error, so a Windows bug in a check itself (#881) stays that check's. Refs #948 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VE16AxC1V9wAMGmGgefe4z
The Windows CI job reproduced #948: 17 pre-commit jobs failed with `node: -c: line 3: syntax error: unexpected end of file`. Lefthook 2.1.14 on Windows builds `"sh.exe" -c "<script>"` and escapes nothing, so a double quote in a run closes the argument, and a space after it cuts the script in two: the `node` in that error is the word after `echo "❌`. The probes ruled out line breaks, since a multiline run with no quote passed, as did a single quote. No run in lefthook.yml holds a double quote any more. Messages use single quotes, variables that never hold a space lose theirs, and the two jobs that need nested quotes moved into scripts the run line only names: `scripts/summarize-plugin-catalogs.sh`, verbatim, and `scripts/session-trailer-delegate.sh`. The trailer's run line still names `aidd-session-trailer.sh`, which is how `aidd telemetry` finds the job. A guard fails on any double quote in a run, red on 16 jobs before this change. The Windows job keeps its pre-commit step, drops the probes, and also runs prepare-commit-msg. Refs #948 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VE16AxC1V9wAMGmGgefe4z
blafourcade
force-pushed
the
fix/lefthook-windows
branch
from
October 12, 2026 02:59
39fb5dc to
293be4c
Compare
With the shell fixed, the Windows CI log showed two checks of their own failing on every commit, hidden by a step that only looked for a syntax error. `check-skill-argument-hints` reported 58 skills without an argument-hint: the Windows checkout ends lines with CRLF, so no frontmatter starts with `---\n`. `sync-readme-counts` read `D:\D:\a\...\README.md`, a root taken from a URL's pathname, and the hook dropped its exit code. The hint check normalises CRLF before parsing, and the counts script resolves its root with `fileURLToPath`. A CRLF skill test was red before the change; the counts test runs the script where the suite runs, Windows CI included. The Windows step is now strict, failing on any hook that fails as well as on a syntax error. The no-double-quote guard also fails when it scans no run, and lefthook.yml says why the trailer's run line names its delegate. Refs #948 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VE16AxC1V9wAMGmGgefe4z
Drop the comments that restated their code or their test's name. Three stay, one line each: why a run holds no double quote, which name `aidd telemetry` finds the trailer job by, and what the Windows hooks step runs. Refs #948 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VE16AxC1V9wAMGmGgefe4z
blafourcade
marked this pull request as ready for review
October 12, 2026 03:45
blafourcade
added a commit
that referenced
this pull request
Oct 12, 2026
Conflicts resolved: - lefthook.yml: next's one-line catalog job (#998) kept; the telemetry prompts-doc job and the prepare-commit-msg trailer job stay removed, with the trailer delegate script next added for them. - cli/tests/e2e/helpers.ts: both sides' imports. - README.md and architecture-rules.test.js: counts measured on the merged tree, 51 skills and 48 skills with actions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What & why
On Windows (Git Bash), every pre-commit job containing a double quote failed with
-c: line 3: syntax error: unexpected end of file(#948). Contributors had to commit with lefthook disabled (#987, #988).🛠️ How it works
Cause, reproduced in Windows CI. Lefthook 2.1.14 on Windows runs each job as
"sh.exe" -c "<script>"and escapes nothing (internal/run/controller/exec/exec_windows.go; upstream evilmartians/lefthook#1167, no fix through v2.2.1)."closes the argument, and a space after it cuts the script in two. Thenodeinnode: -c: line 3is the word afterecho "❌.'. Line breaks were not the cause.Fix:
runin lefthook.yml holds a"any more:$found,$f) lose their quotes;aidd-session-trailer.sh, because that is howaidd telemetryfinds the job."in a run. It was red on 16 jobs before the change.Two checks that also failed on Windows, found once the shell worked:
check-skill-argument-hintsflagged 58 skills, because the Windows checkout uses CRLF. It now normalises line endings, and a CRLF test was red first.sync-readme-countsreadD:\D:\…\README.md, and the hook swallowed the error. It now usesfileURLToPath.CI: the
cli / Windowsjob runs a commit's hooks, pre-commit then prepare-commit-msg. The threecli-*jobs are left out because they needcli/'s dependencies; Biome on Windows is tracked in #881. The step fails on any failing hook.🧪 How to verify
cli / Windowson this head: 17 hooks ✔️, nosyntax error, noENOENT. The new tests pass on Windows: 593 pass, 0 fail.node --test scripts/__tests__/lefthook-runs-hold-no-double-quote.test.js: putting a"back into one run makes that test alone fail.git commiton a change underplugins/*/skills/.aidd telemetry onprints for users still holds". That is tracked in fix(cli): the lefthook trailer job aidd telemetry prints fails on Windows #999.🔗 Linked issue
Closes #948
✅ I certify
🤖 Generated with Claude Code
https://claude.ai/code/session_01VE16AxC1V9wAMGmGgefe4z