Repository navigation
feat: add Lefthook local git-hooks module - #26
Conversation
Re-derived, strict, decoupled local git hooks that run the same tools the overlays/scanners already standardize as fast, staged-only pre-commit checks (CI stays the authoritative gate). - modules/lefthook/base.yml: cross-cutting hygiene lanes (typos, gitleaks, editorconfig, shellcheck, markdownlint); opt-in per-language overlay fragments (powershell, python, typescript, dotnet) composed via extends. - Decoupled by copy + extends (the open/closed pattern the overlays use), never remotes: (which would runtime-couple every consumer to this repo). Lanes are check-only and path-free, invoking tools that auto-discover their standards config from the repo root — no forking or re-configuring. - Type-checkers (pyright, tsc) and the .NET analyzer build stay CI-only. - No ci-workflows action: lefthook is local-dev tooling; the only CI use is a validate + behavioral-test lane run inline against a pinned lefthook npm dep. - Dogfood: root lefthook.yml extends every fragment; the CI lefthook lane runs `lefthook validate` + modules/lefthook/lefthook.test.sh; wired into ci-status. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48d3734a9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - modules/lefthook/base.yml | ||
| - modules/lefthook/lefthook-powershell.yml | ||
| - modules/lefthook/lefthook-python.yml | ||
| - modules/lefthook/lefthook-typescript.yml | ||
| - modules/lefthook/lefthook-dotnet.yml |
There was a problem hiding this comment.
Exclude bad fixtures from dogfood hooks
By composing the base and every overlay here without any root-level exclude overrides, this repo's Lefthook config also runs on staged files under fixtures/*/bad/** (for example the intentionally invalid Markdown, Python, PowerShell, shell, and .NET fixtures). Those files are deliberately non-conforming and the CI self-lint lanes exclude them, so any legitimate update to a bad fixture will be blocked locally by the dogfood hook; add matching bad-fixture excludes/skip overrides in the root config or avoid extending overlays for fixture-only languages.
Useful? React with 👍 / 👎.
Migrates medley's Lefthook setup into the platform as a strict, decoupled module — the remaining Phase 3 hooks item in
docs/migration-plan.md. Re-derived from the official Lefthook v2 docs (not ported), verified empirically against the locallefthook2.1.9 binary.What's here
modules/lefthook/base.yml— cross-cutting hygiene lanes (typos, gitleaks, editorconfig, shellcheck, markdownlint), each backed by an existingmodules/*ruleset.lefthook-{powershell,python,typescript,dotnet}.yml, one per language overlay.modules/lefthook/README.md— rationale, the decoupling/extensibility model, adoption manifest, engine/version notes.modules/lefthook/lefthook.test.sh— behavioral test (temp git repo): a consumer thatextendsthe base gets its lanes, a lane fires on a non-conforming staged file and passes a clean one, andskip: trueopts a lane out without editing the base.lefthook.yml— dogfood instance thatextendsevery fragment.Decoupling (the key decision)
standardsforbids runtime coupling to itself, so distribution is copy +extends— a consumer's own rootlefthook.ymlextends the vendored fragments (the open/closed pattern the overlays already use).remotes:was rejected: it's a livegit clonecached in.git/info/lefthook-remoteswith a mandatory first-fetch — i.e. exactly the runtime coupling the platform forbids. Lanes are check-only (nostage_fixed) and path-free — each invokes a tool and lets it auto-discover its standards config from the repo root, so the hooks reference the existing rulesets rather than forking or re-configuring them.Type-checkers (Pyright,
tsc) and the .NET analyzer build stay CI-only (whole-project context; would double-report). Noci-workflowsaction is warranted — Lefthook is local-dev tooling; the only CI use is the dogfood lane below, run inline against a pinnedlefthooknpm devDependency (Dependabot-tracked).CI
New
lefthooklane:lefthook validate(parses + merges root + all fragments) plus the behavioral test; wired into theci-statusgateway.🤖 Generated with Claude Code