Skip to content

Pre commit hook suite - #152

Merged
elizabetheonoja-art merged 3 commits into
Utility-Protocol:mainfrom
gloskull:Pre-Commit-Hook-Suite
Jul 18, 2026
Merged

Pre commit hook suite#152
elizabetheonoja-art merged 3 commits into
Utility-Protocol:mainfrom
gloskull:Pre-Commit-Hook-Suite

Conversation

@gloskull

Copy link
Copy Markdown
Contributor

Motivation
Provide a repository-managed pre-commit layer to catch common issues earlier and keep fast, staged-file-scoped checks local to developers.
Prevent trivial mistakes (merge markers, leaked secrets, lint regressions, lockfile drift) from reaching CI while avoiding expensive full-suite runs on every local commit.
Description
Add a Git entrypoint at .githooks/pre-commit that delegates to an npm-runable checker via npm run precommit:check.
Add a staged-file-aware runner scripts/pre-commit.mjs that discovers staged files, scans text files for merge markers and secret-like values, runs targeted eslint for staged source files, runs targeted vitest only for staged test files, and triggers lockfile sync when package.json or package-lock.json changes.
Wire up package.json with prepare and precommit:check npm scripts to install the hook path and run the checker locally via npm.
Add documentation docs/pre-commit-hooks.md describing architecture and rollout guidance and add unit tests tests/unit/preCommit.test.ts for planning and text-scan behaviors.
Testing
Ran npm run precommit:check and the staged-file-scoped checks completed successfully after adjustments to test targeting.
Ran targeted lint with npm run lint -- scripts/pre-commit.mjs tests/unit/preCommit.test.ts and fixed minor warnings so lint passes on the new files.
Ran the new unit tests with npm test -- tests/unit/preCommit.test.ts and they passed.
An initial attempt to run the full test suite (npm test -- --passWithNoTests) exposed unrelated pre-existing failures in tests/components/AssetHeatmapLayer.test.tsx and tests/unit/keyCache.test.ts, so the hook was scoped to staged test files to avoid blocking unrelated work; the scoped pre-commit checks pass.
Closes #126

@elizabetheonoja-art
elizabetheonoja-art merged commit 604b8fc into Utility-Protocol:main Jul 18, 2026
0 of 2 checks passed
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.

Pre-Commit Hook Suite for Code Quality Enforcement

2 participants