Please create a new /task epic:
Pre-commit Quality Gates for AI Agents
Add pre-commit validators catching agent mistakes in seconds. All validators output markdown, exit with codes 0/1/2/3/4 (pass/TDD/epic/protected/review), reference ai/rules/tdd.mdc and ai/rules/precommit.mdc for workflows. Use ignore package for pattern matching. Validation completes in <2 seconds.
Protected Files Validator (ai/scripts/validate-protected-files.js)
- Given staged files match patterns in
ai/protected-files (gitignore syntax), should scan commit message body for PROTECTED: reason
- Given
PROTECTED: missing from message body, should fail with exit 3 and example showing where to add approval
- Given
ai/protected-files empty, should create with usage comments (no default patterns—project decides)
- Given config has
exempt paths, should skip those patterns
TDD Validator (ai/scripts/validate-tdd.js)
- Given
src/**/*.{js,ts} files staged, should verify corresponding **/*.{test,spec}.{js,ts} exists in commit
- Given test file exists, should check git diff timestamps show test modified before implementation
- Given violation found, should fail with exit 1 listing files and remedy steps from
ai/rules/tdd.mdc
- Given config has
exempt paths, should skip those files
Epic Sync Validator (ai/scripts/validate-epic-sync.js)
- Given branch name matches pattern (default
^(feature|bug|task)/), should parse for task refs like TASK-123
- Given task ref found and implementation files staged, should verify
tasks/TASK-123.md also staged
- Given epic file missing, should fail with exit 2 and amend instructions
- Given config has custom
branchPattern, should use that for parsing
Review Check Validator (ai/scripts/validate-review.js)
- Given commit message does NOT contain
REVIEWED, should fail with exit 4 and message: "please remember to /review before you /commit"
- Given commit message contains
REVIEWED, should pass
- Given config has
hooks.review.enabled: false, should skip check
Installer (npx aidd)
- Given no husky configuration exists in project, should automatically install pre-commit hooks
- Given husky already configured, should inform user: "Pre-commit hooks already configured at .husky/pre-commit"
- Given installation, should copy validators to
ai/scripts/
- Given installation, should create
ai/protected-files empty with usage comments
- Given installation, should setup husky pre-commit calling
node ai/scripts/validate-commit.js "$(cat .git/COMMIT_EDITMSG)"
- Given installation, should create
.aiddrc.yml with default config (tdd/epic/protected/review enabled)
- Given documentation request, should include manual configuration example showing all hook setup steps
Validation Command (aidd validate-commit)
- Given command called, should orchestrate all four validators
- Given message argument provided, should validate with that message
- Given no argument, should read
.git/COMMIT_EDITMSG
- Given failures, should output combined markdown with exit code for first failure type
Agent Guidance (ai/rules/precommit.mdc)
- Given hook fails, should document response pattern for each failure type
- Given missing tests, should specify: create test, write failing tests, implement, commit both
- Given test after implementation, should specify: revert, follow missing tests pattern
- Given epic not updated, should specify: update epic, stage, amend
- Given protected files, should specify: seek approval, add
PROTECTED: to message body or revert
- Given review not done, should specify: run
/review to check for duplication and quality issues, add REVIEWED to message body
Update /commit Command (ai/commands/commit.md)
- Given agent preparing to commit, should run
/review first if not already done
- Given review complete, should add
REVIEWED to commit message body (not subject line)
- Given commit message template, should include example showing
REVIEWED placement
- Given constraints section, should add: "Run /review before committing. Add 'REVIEWED' to message body to signal review completion."
Example commit message format:
feat(game): Add procedural level generation
REVIEWED
- Implemented wave function collapse algorithm
- Added configurable difficulty scaling
- Created unit tests for generation logic
Please create a new /task epic:
Pre-commit Quality Gates for AI Agents
Add pre-commit validators catching agent mistakes in seconds. All validators output markdown, exit with codes 0/1/2/3/4 (pass/TDD/epic/protected/review), reference
ai/rules/tdd.mdcandai/rules/precommit.mdcfor workflows. Useignorepackage for pattern matching. Validation completes in <2 seconds.Protected Files Validator (
ai/scripts/validate-protected-files.js)ai/protected-files(gitignore syntax), should scan commit message body forPROTECTED: reasonPROTECTED:missing from message body, should fail with exit 3 and example showing where to add approvalai/protected-filesempty, should create with usage comments (no default patterns—project decides)exemptpaths, should skip those patternsTDD Validator (
ai/scripts/validate-tdd.js)src/**/*.{js,ts}files staged, should verify corresponding**/*.{test,spec}.{js,ts}exists in commitai/rules/tdd.mdcexemptpaths, should skip those filesEpic Sync Validator (
ai/scripts/validate-epic-sync.js)^(feature|bug|task)/), should parse for task refs likeTASK-123tasks/TASK-123.mdalso stagedbranchPattern, should use that for parsingReview Check Validator (
ai/scripts/validate-review.js)REVIEWED, should fail with exit 4 and message: "please remember to /review before you /commit"REVIEWED, should passhooks.review.enabled: false, should skip checkInstaller (
npx aidd)ai/scripts/ai/protected-filesempty with usage commentsnode ai/scripts/validate-commit.js "$(cat .git/COMMIT_EDITMSG)".aiddrc.ymlwith default config (tdd/epic/protected/review enabled)Validation Command (
aidd validate-commit).git/COMMIT_EDITMSGAgent Guidance (
ai/rules/precommit.mdc)PROTECTED:to message body or revert/reviewto check for duplication and quality issues, addREVIEWEDto message bodyUpdate /commit Command (
ai/commands/commit.md)/reviewfirst if not already doneREVIEWEDto commit message body (not subject line)REVIEWEDplacementExample commit message format: