Repository navigation
fix(hooks): check the whole codebase as staged in pre-commit - #12
Merged
Merged
Conversation
The hook passed staged paths to oxfmt and oxlint, which read the working tree. A file formatted on disk but never re-staged could slip through, and unstaged edits could block a clean commit. It now exports the index to a temporary directory and checks every tracked file there, so it sees exactly what the commit will contain. The header names all four repos sharing the hook, so every copy is byte-identical.
There was a problem hiding this comment.
🟡 Changes recommended
Sparse-checkout entries are omitted from the snapshot, undermining whole-index validation.
1 open finding
What changed in this PR
Updates pre-commit validation to inspect a temporary snapshot of the Git index rather than the working tree.
Changes:
- Exports the index before running formatting and lint checks.
- Documents the snapshot-based hook behavior and shared repositories.
| File | Description |
|---|---|
.githooks/pre-commit |
Checks formatting and linting against an index snapshot. |
AGENTS.md |
Documents the revised hook behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merged
2 tasks done
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.


Summary
commit -aandcommit <path>are covered too, because git pointsGIT_INDEX_FILEat the right index.checkout-indexruns with--ignore-skip-worktree-bits, so files hidden by a sparse checkout orgit update-index --skip-worktreeare checked too. simple-xml gets the same change in fix(hooks): export skip-worktree entries into the pre-commit snapshot simple-xml#20, which keeps all four copies byte-identical.No CHANGELOG entry, since nothing under
src/changed.Test plan
npm run format:checkandnpm run lintsrc/