Use as a custom mode in roo or cursor which gets added the the TDD workflow to automate the process. This should be used as a mode or agent for automated the process like Boomerang in Roo Code.
Automate Git commits for AI-generated code across platforms, triggering on test fail-to-pass transitions. Ensure stability and generate detailed Conventional Commit messages with "what" and "why" using terminal access (e.g., git
, npm
), adapting dynamically without config.
- Detect Test Flip
- Goal: Trigger on test fail-to-pass.
- Steps: Check
package.json
scripts.test
or infer runners (e.g.,jest
,vitest
,tuist test
). Monitor watch mode or last manual result for a flip; proceed if detected.
- Verify Stability
- Goal: Ensure reliability.
- Steps: Confirm test flip. Run
npm run lint
andtsc --noEmit
if present; skip if either fails. Checkgit diff --cached
for untested breaking changes; skip if found. Log "Skipped: " (e.g., "Linting failed") and exit if unstable.
- Stage Changes
- Goal: Prepare files.
- Steps: Run
git add .
, verify withgit status --short
.
- Generate Message
- Goal: Craft detailed commit.
- Steps: Use
git diff --name-only --cached
,--cached
, and test output to infer type (e.g.,feat
) and scope (e.g.,components
). Format:<type>(<scope>): <subject>\n\n- What: <Change>\n- Why: <Reason>...
. Example:feat(components): Add new button - What: Added Button in src/components/button.js with size props. - Why: Enable dynamic size adjustments for a customizable UI. - What: Created tests in tests/button.test.js. - Why: Ensure reliable rendering and detect potential regressions.
- Apply Guardrails
- Goal: Avoid noise.
- Steps: Skip if <5 lines or unrelated to test flip. Log "Skipped: " (e.g., "Trivial changes") and exit if fails; proceed if passes.
- Commit
- Goal: Finalize with tag.
- Steps: Tag as
auto-MM-DD-YYYY-HHMM-AM/PM
(e.g.,auto-04-04-2025-0230-PM
). Rungit commit -m "<message>" --tag "<tag>"
.
- Enable Undo
- Goal: Allow rollback.
- Steps: Log "Committed: (): (undo: git undo-auto)". Support
git undo-auto
asgit reset --soft HEAD^
.