# `/ba-develop` — Commit checkpoints

> Loaded on demand when a phase passes and the orchestrator emits a commit.

## Commit command

After every phase whose gate passes, create a local commit directly with git
via Bash, run in `projectPath`:

```bash
git add -A && git commit -m "<message>"
```

**No push** — the feature branch stays local until the user runs `/gitflow pr`
or `/gitflow sync`. Before committing, confirm the working branch is a feature
branch (not `main`) — if it is not, **skip commits** and record a
`git.cannot-commit` blocker (the code still lands on disk). If Phase 2 produced
an EF migration, review it for destructive ops (DROP COLUMN/TABLE): commit it
anyway but record a `migration.destructive` blocker (critical) and **never
auto-apply** the migration. None of these stop the run.

- Conventional-commits scope = the module code (e.g. `hr.leave`).
- Never push from this orchestrator.

## When NOT to commit

- Gate failed AND auto-healing exhausted — the item is **deferred** (blocker +
  best-effort). Commit whatever DID pass in the phase; the deferred item is
  recorded in `blockers[]`, never committed as if it were done.
- `nothing to commit` — re-running a phase that produced no diff. Log
  `nothing to commit`, continue.

**Exception — Phase 3 sub-phase 3.5 (audit-apply) MUST always run** even when
3.0-3c reported no file changes. Drift can exist in files no generator touched
this run. Skipping audit-apply is the silent re-run failure mode users report
as "I re-ran and nothing was fixed".

## Per-phase message templates

| After phase | Message |
|-------------|---------|
| Core | `feat({appCode}): add core foundation seed (nav + roles + permissions)` |
| Entities | `feat({moduleCode}): add domain entities + migrations` |
| API (2a) | `feat({moduleCode}): add api controllers + business handlers` |
| API (2b) | `feat({moduleCode}): add screen-driven controllers + screen DTOs` |
| Frontend | `feat({moduleCode}): add frontend pages + routes` |
| Acceptance | `feat({moduleCode}): add acceptance tests from AC (N facts, 0 TODO)` |

## Auto-healed commit body

When the auto-healing loop ran one or more retries before the gate passed,
append a body line summarising what was fixed:

```
feat(hr.leave): add api controllers + business handlers

Auto-healed in 3 iterations:
  attempt 1 → business.todo-br (BR-005 implemented from règles-métier.md L42)
  attempt 2 → audit-dev-api.applicable (DEV-API-008 auto-applied, 4 findings)
  attempt 3 → gate passed
```

The body lines come straight from `_dev/heal.log.json` — no hand-editing.

## Failure handling

Interpret the `git commit` result:

- **success** → record the short hash (`git rev-parse --short HEAD`) in the
  phase summary, continue.
- **not a git repo** OR **branch is `main`** → **skip commits**, record a
  `git.cannot-commit` blocker (medium, `userAction: run /gitflow start
  feature/{moduleCode} then commit`), and keep generating — the code still
  lands on disk. Do NOT halt.
- **`nothing to commit, working tree clean`** → no-op, log, continue.
- **destructive EF migration detected** in Phase 2 review → commit it, record a
  `migration.destructive` blocker (critical), never auto-apply. Continue.
- **any other error** → record a `git.cannot-commit` blocker with the message,
  continue (a commit failure never aborts the run).
