| 1 | --- |
| 2 | name: compiler-commit |
| 3 | description: Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits with the [compiler] or [rust-compiler] prefix. |
| 4 | --- |
| 5 | |
| 6 | # Compiler Commit |
| 7 | |
| 8 | Verify and commit compiler changes with the correct convention. |
| 9 | |
| 10 | Arguments: |
| 11 | - $ARGUMENTS: Commit title (required). Optionally a test pattern after `--` (e.g., `Fix aliasing bug -- aliasing`) |
| 12 | |
| 13 | ## Instructions |
| 14 | |
| 15 | 1. **Run `/compiler-verify`** first (with test pattern if provided after `--`). Stop on any failure. |
| 16 | |
| 17 | 2. **Run `/compiler-review`** on the uncommitted changes. Report the findings to the user. If any issues are found, stop and do NOT commit — let the user decide how to proceed. |
| 18 | |
| 19 | 3. **Detect commit prefix** from changed files: |
| 20 | - If any files in `compiler/crates/` changed: use `[rust-compiler]` |
| 21 | - Otherwise: use `[compiler]` |
| 22 | |
| 23 | 4. **Update orchestrator log**: If `compiler/docs/rust-port/rust-port-orchestrator-log.md` exists and the commit includes Rust changes (`compiler/crates/`): |
| 24 | |
| 25 | Run `test-rust-port` with `--json` to get machine-readable results: |
| 26 | ```bash |
| 27 | bash compiler/scripts/test-rust-port.sh --json 2>/dev/null |
| 28 | ``` |
| 29 | This outputs a JSON object with fields: `pass`, `autoDetected`, `total`, `passed`, `failed`, `frontier`, `perPass`, `failures`. |
| 30 | |
| 31 | Then update the orchestrator log: |
| 32 | - Update the `# Status` section with the results (use the frontier, per-pass counts, and pass/fail totals) |
| 33 | - Add a `## YYYYMMDD-HHMMSS` log entry noting the commit and what changed |
| 34 | |
| 35 | 5. **Stage files** — stage only the relevant changed files by name (including the orchestrator log if updated in step 4). Do NOT use `git add -A` or `git add .`. |
| 36 | |
| 37 | 6. **Compose commit message**: |
| 38 | ``` |
| 39 | [prefix] <title> |
| 40 | |
| 41 | <summary of what changed and why, 1-3 sentences> |
| 42 | ``` |
| 43 | The title comes from $ARGUMENTS. Write the summary yourself based on the actual changes. |
| 44 | |
| 45 | 7. **Commit** using a heredoc for the message: |
| 46 | ```bash |
| 47 | git commit -m "$(cat <<'EOF' |
| 48 | [rust-compiler] Title here |
| 49 | |
| 50 | Summary here. |
| 51 | EOF |
| 52 | )" |
| 53 | ``` |
| 54 | |
| 55 | 8. **Do NOT push** unless the user explicitly asks. |
| 56 | |
| 57 | ## Examples |
| 58 | |
| 59 | - `/compiler-commit Fix aliasing bug in optional chains` — runs full verify, commits as `[compiler] Fix aliasing bug in optional chains` |
| 60 | - `/compiler-commit Implement scope tree types -- round_trip` — runs verify with `-p round_trip`, commits as `[rust-compiler] Implement scope tree types` |