Skip to content

chore: add git hooks and commit conventions - #7

Merged
RedStar071 merged 8 commits into
mainfrom
agent/git-hooks
Aug 9, 2026
Merged

chore: add git hooks and commit conventions#7
RedStar071 merged 8 commits into
mainfrom
agent/git-hooks

Conversation

@RedStar071

@RedStar071RedStar071 commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

Add lightweight local commit quality gates for contributors.

  • add Husky 9 and install hooks through the prepare lifecycle via .husky/install.mjs, which skips installation in CI and production (Husky how-to)
  • run nano-staged from pre-commit so only staged files are formatted with Oxfmt
  • run commitlint from commit-msg
  • use @commitlint/config-conventional to enforce Conventional Commit messages
  • raise engines.node to >=22.18, matching the documented toolchain (nano-staged 1.x needs util.styleText, unavailable on Node 20.11)
  • document the hook workflow and how to resolve hook failures in CONTRIBUTING.md

Hooks

  • pre-commitpnpm exec nano-staged
  • commit-msgpnpm exec commitlint --edit "$1"

Dependency note

The dependency declarations use current Husky 9.1.7, nano-staged 1.0.2 and commitlint 21.x. pnpm-lock.yaml has been regenerated with pnpm 10.15.0 (pnpm install --lockfile-only), so pnpm install --frozen-lockfile passes again in CI.


View with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is enabled.

Confidence Score: 5/5

No blocking failure remains.

The Node.js compatibility, hook installation behavior, staged-file formatting, and commit-message enforcement paths were exercised successfully against the current configuration.

T-Rex T-Rex Logs

What T-Rex did

  • Validated Node compatibility by running the pre-commit formatter across disposable worktrees with Node.js 20.11.1 and 22.18.0; 20.11.1 failed before formatting while 22.18.0 succeeded and re-staged the formatted fixture.
  • Compared Node runtimes, showing that Node 20.11.1 exits with an error before tasks run, while Node 22.18.0 exits successfully and updates the staged formatting.
  • Validated the prepared hook runs by executing the prepare-installed-hooks-01-before and 02-after captures, which show the invalid and valid message sequences and confirm the hook-workflow script used.
  • Executed the hook workflow validation script for invalid and valid messages; the invalid Conventional Commit was rejected by commitlint, the valid Conventional Commit was accepted, and both runs formatted and re-staged the fixture.
  • Validated Husky installer behavior in production, CI, and local environments; production and CI left core.hooksPath unset with no Husky marker, while local installation created .husky/_/h and set core.hooksPath, confirming local hook installation does not affect production.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (3): Last reviewed commit: "chore: skip husky install in CI and prod..." | Re-trigger Greptile

@socket-security

socket-securityBot commented Aug 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addedhusky@​9.1.71001006180100
Added@​commitlint/​cli@​21.2.11001007395100
Addednano-staged@​1.0.210010010083100
Added@​commitlint/​config-conventional@​21.2.010010010092100

View full report

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment threadpackage.json Outdated
Comment threadpackage.json Outdated
"format:check": "oxfmt --check .",
"lint": "TMPDIR=/tmp turbo run lint",
"lint:ci": "pnpm format:check && pnpm lint",
"prepare": "husky",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2Commit workflow remains undocumented

The new prepare lifecycle installs hooks that format staged files and enforce Conventional Commit messages, but the contributor documentation does not explain this changed workflow or how to resolve hook failures.

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 17
Comment:
**Commit workflow remains undocumented**
The new `prepare` lifecycle installs hooks that format staged files and enforce Conventional Commit messages, but the contributor documentation does not explain this changed workflow or how to resolve hook failures.
**Context Used:** CLAUDE.md ([source](https://github.com/wolfstar-project/agent-zero/blob/main/CLAUDE.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude CodeFix in CursorFix in Cursor Cloud Agents

RedStar071and others added 3 commits August 9, 2026 13:08
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@RedStar071
RedStar071 marked this pull request as ready for review August 9, 2026 13:59
@RedStar071
RedStar071 merged commit 8f9115f into mainAug 9, 2026
13 checks passed
@RedStar071
RedStar071 deleted the agent/git-hooks branch August 9, 2026 13:59
Sign up for freeto 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.

1 participant

@RedStar071