-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
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 forPROTECTED: reason - Given
PROTECTED:missing from message body, should fail with exit 3 and example showing where to add approval - Given
ai/protected-filesempty, should create with usage comments (no default patterns—project decides) - Given config has
exemptpaths, 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
exemptpaths, 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 likeTASK-123 - Given task ref found and implementation files staged, should verify
tasks/TASK-123.mdalso 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-filesempty 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.ymlwith 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
/reviewto check for duplication and quality issues, addREVIEWEDto message body
Update /commit Command (ai/commands/commit.md)
- Given agent preparing to commit, should run
/reviewfirst if not already done - Given review complete, should add
REVIEWEDto commit message body (not subject line) - Given commit message template, should include example showing
REVIEWEDplacement - 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers