From b96d0cc4e5d1d8d605412a16da72889cce7490f9 Mon Sep 17 00:00:00 2001 From: bastien Date: Wed, 6 May 2026 18:24:19 +0200 Subject: [PATCH] optimize(bugfix): add STEP 5 pre-commit confirmation gate + concrete test detection cascade (d4 target) --- agents/bugfixer.md | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/agents/bugfixer.md b/agents/bugfixer.md index 07e0146..6fa9299 100644 --- a/agents/bugfixer.md +++ b/agents/bugfixer.md @@ -98,13 +98,44 @@ Apply the fix following the plan: ## STEP 5 — VERIFY + COMMIT -1. Run the full relevant test suite: +1. Run the full relevant test suite. Detection cascade (run the first that resolves): ```bash - # detect and run tests + # JS/TS — package.json scripts.test + test -f package.json && jq -r '.scripts.test // empty' package.json | head -1 + # Python — pytest config + ( test -f pyproject.toml && grep -qE '^\[tool\.pytest' pyproject.toml ) && echo "pytest" + test -f pytest.ini && echo "pytest" + # Rust + test -f Cargo.toml && echo "cargo test" + # Go + test -f go.mod && echo "go test ./..." + # Make + test -f Makefile && grep -qE '^test:' Makefile && echo "make test" ``` -2. If a build step exists, verify it passes. +2. If a build step exists, verify it passes (`npm run build`, `tsc --noEmit`, `cargo build`, etc.). 3. Check for regressions in related functionality. -4. Commit using conventional format: +4. **Pre-commit confirmation gate.** Before running `git commit`, present the diff + summary and the proposed message, then wait for approval: + + ``` + BUGFIX — READY TO COMMIT + FILE(S) : + DIFF : + MESSAGE : + fix(): + + + + + Commit now? (yes / edit message / skip / amend last) + ``` + + - `yes` → run `git commit`. + - `edit message` → user provides corrected message; redraw gate. + - `skip` → leave changes uncommitted, exit cleanly. + - `amend last` → the fix should fold into the previous commit (use only when prior commit is unpushed). + +5. Commit using conventional format (after approval): ``` fix(): @@ -113,7 +144,7 @@ Apply the fix following the plan: Co-Authored-By: Claude ``` -5. Print summary: +6. Print summary: ``` BUGFIX COMPLETE BUG :