You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lefthook pre-commit hooks fail on Windows/Git Bash with "node: -c: line 3: syntax error: unexpected end of file" for every hook that uses the {files} placeholder. This is a known Windows incompatibility with lefthook's file-passing mechanism.
Expected behaviour
Pre-commit hooks should run successfully on Windows/Git Bash, validating staged files (JSON, YAML, markdown links, skill frontmatter, architecture rules, etc.) without syntax errors.
Observed behaviour
All pre-commit hooks that use {files} placeholder fail with:
node: -c: line 3: syntax error: unexpected end of file
This happens because lefthook's file-passing mechanism on Windows/Git Bash generates invalid node -c command syntax.
Affected file(s)
lefthook.yml
scripts/pre-commit-all.sh
Steps to reproduce
Clone the repository on Windows 10/11 with Git Bash
Run make setup to install lefthook hooks
Stage any file: git add .
Attempt to commit: git commit -m "test"
Observe the node syntax error for each hook
Environment
OS: Windows 10/11
Shell: Git Bash (mingw64)
Node.js: v22.12+ (as required by project)
lefthook: latest (installed via make setup)
Workarounds attempted
Converted hooks to use "$@" instead of {files} — still fails with same syntax error
Converted to stdin: true with $(cat) — still fails
Created wrapper shell scripts — lefthook still invokes node -c with broken syntax
Consolidated all checks into single all-checks command (current pre-commit-all.sh) — still times out/fails on Windows
Proposed solution direction
Option A: Document WSL2 as required environment for Windows contributors (simplest, aligns with Node.js tooling expectations)
Option B: Create Windows-compatible lefthook config using run: cmd //c ... or PowerShell wrappers
Option C: Move all pre-commit validation to CI-only (GitHub Actions) and rely on make check locally
Option D: Use a Node.js-based pre-commit runner (e.g., husky + lint-staged) that handles cross-platform file passing correctly
Additional context
The current pre-commit-all.sh script works correctly on Linux/WSL and validates:
JSON files (validate-json.mjs)
YAML files (validate-yaml.mjs)
Skill frontmatter (name:, description:)
Architecture rules (check-architecture-rules.js)
Skill argument hints
Context imports and reference form
Referenced paths
Doc duplication
Markdown links
Script tests
This is a blocker for Windows contributors who cannot use WSL2.
Validated as a Windows bug, but it is not limited to the {files} placeholder. Lefthook’s upstream issue #1167 reproduces the same Git Bash syntax error with multiline run blocks.
This repository uses Lefthook 2.1.14, and releases through 2.1.17 do not list a fix. Also, scripts/pre-commit-all.sh is not present in the repository.
The implementation should first reproduce the failure in the existing Windows CI job, then replace multiline shell blocks with single-line calls to a cross-platform Node runner while preserving the current checks. WSL-only and CI-only validation are not acceptable substitutes.
The cause was double quotes, not multiline blocks. Lefthook on Windows runs each job as "sh.exe" -c "<script>" and escapes nothing, so a double quote followed by a space cut the script in two. A probe confirmed that a multiline run with no quote passes.
No run in lefthook.yml holds a double quote any more, and a test enforces it. Two checks that also broke on Windows are fixed: CRLF line endings in check-skill-argument-hints, and the D:\D:\ path in sync-readme-counts. The cli / Windows job now runs a commit's hooks and fails if any hook fails.
Validated on the Windows CI runner. No commit on a physical Windows machine yet; please reopen if one still fails.
The same defect in the lefthook job that aidd telemetry on prints for users is tracked in #999.
Activity
blafourcade commentedon Oct 6, 2026
Validated as a Windows bug, but it is not limited to the
{files}placeholder. Lefthook’s upstream issue #1167 reproduces the same Git Bash syntax error with multilinerunblocks.This repository uses Lefthook 2.1.14, and releases through 2.1.17 do not list a fix. Also,
scripts/pre-commit-all.shis not present in the repository.The implementation should first reproduce the failure in the existing Windows CI job, then replace multiline shell blocks with single-line calls to a cross-platform Node runner while preserving the current checks. WSL-only and CI-only validation are not acceptable substitutes.
fix(lefthook): keep double quotes out of every hook run
fix(lefthook): keep double quotes out of every hook run
fix(lefthook): make the two checks that fail on Windows pass there
refactor(lefthook): keep only the comments the code cannot say
fix(lefthook): run the pre-commit on Windows (#998)
blafourcade commentedon Oct 12, 2026
Fixed by #998.
The cause was double quotes, not multiline blocks. Lefthook on Windows runs each job as
"sh.exe" -c "<script>"and escapes nothing, so a double quote followed by a space cut the script in two. A probe confirmed that a multiline run with no quote passes.No
runinlefthook.ymlholds a double quote any more, and a test enforces it. Two checks that also broke on Windows are fixed: CRLF line endings incheck-skill-argument-hints, and theD:\D:\path insync-readme-counts. Thecli / Windowsjob now runs a commit's hooks and fails if any hook fails.Validated on the Windows CI runner. No commit on a physical Windows machine yet; please reopen if one still fails.
The same defect in the lefthook job that
aidd telemetry onprints for users is tracked in #999.