|
| 1 | +--- |
| 2 | +name: ci-prep |
| 3 | +description: Prepare the codebase for CI. Runs formatting, linting, spell check, build, unit tests, e2e tests, and coverage checks iteratively until everything passes. Use before submitting a PR or when the user wants to ensure CI will pass. |
| 4 | +argument-hint: "[optional focus area]" |
| 5 | +allowed-tools: Read, Grep, Glob, Edit, Write, Bash |
| 6 | +--- |
| 7 | + |
| 8 | +# CI Prep — Get the Codebase PR-Ready |
| 9 | + |
| 10 | +You MUST NOT STOP until every check passes and coverage threshold is met. This is a loop, not a checklist you run once. |
| 11 | + |
| 12 | +## Step 0: Read the CI Pipeline |
| 13 | + |
| 14 | +Read the CI workflow file to understand exactly what CI will run: |
| 15 | + |
| 16 | +```bash |
| 17 | +cat .github/workflows/ci.yml |
| 18 | +``` |
| 19 | + |
| 20 | +Parse every step. The CI pipeline is the source of truth for what must pass. Do NOT assume you know the steps — read them fresh every time. |
| 21 | + |
| 22 | +## Step 1: Coordinate with Other Agents |
| 23 | + |
| 24 | +You are likely working alongside other agents who are editing files concurrently. Before making changes: |
| 25 | + |
| 26 | +1. Check TMC status and messages for active agents and locked files |
| 27 | +2. Do NOT edit files that are locked by other agents |
| 28 | +3. Lock files before editing them yourself |
| 29 | +4. Communicate what you are doing via TMC broadcasts |
| 30 | +5. After each fix cycle, check TMC again — another agent may have broken something |
| 31 | + |
| 32 | +## Step 2: Run the Full CI Check Sequence |
| 33 | + |
| 34 | +Run each CI step in order. Fix failures before moving to the next step. The sequence is derived from Step 0 but typically includes: |
| 35 | + |
| 36 | +### 2a. Format Check |
| 37 | + |
| 38 | +Run the format checker. If it fails, run the formatter to fix, then re-check. |
| 39 | + |
| 40 | +### 2b. Lint |
| 41 | + |
| 42 | +Run the linter. If it fails, fix every lint error. Do NOT suppress or ignore warnings. Re-run until clean. |
| 43 | + |
| 44 | +### 2c. Spell Check |
| 45 | + |
| 46 | +Run the spell checker if CI includes one. Fix any misspellings in source files. |
| 47 | + |
| 48 | +### 2d. Build / Compile |
| 49 | + |
| 50 | +Run the build step. Fix any compilation errors. Re-run until clean. |
| 51 | + |
| 52 | +### 2e. Unit Tests |
| 53 | + |
| 54 | +Run unit tests. If any fail, investigate and fix the root cause. Do NOT delete or weaken assertions. Re-run until all pass. |
| 55 | + |
| 56 | +### 2f. E2E Tests with Coverage |
| 57 | + |
| 58 | +Run e2e tests with coverage collection. If tests fail, fix them. If coverage is below the threshold, identify uncovered code and add tests or fix existing ones. |
| 59 | + |
| 60 | +Note: E2E tests require no other VS Code instance running. If they cannot run in your environment, flag this to the user but still ensure everything else passes. |
| 61 | + |
| 62 | +### 2g. Coverage Threshold |
| 63 | + |
| 64 | +Run the coverage check. If it fails, you need more test coverage. Add assertions to existing tests or write new tests for uncovered paths. |
| 65 | + |
| 66 | +## Step 3: Full Re-run |
| 67 | + |
| 68 | +After fixing everything, run the ENTIRE sequence again from 2a to 2g. Other agents may have made changes while you were fixing things. You MUST verify the final state is clean. |
| 69 | + |
| 70 | +If ANY step fails on re-run, go back to Step 2 and fix it. Repeat until a full clean run completes. |
| 71 | + |
| 72 | +## Step 4: Final Coordination |
| 73 | + |
| 74 | +1. Broadcast on TMC that CI prep is complete |
| 75 | +2. Release any locks you hold |
| 76 | +3. Report the final status to the user |
| 77 | + |
| 78 | +## Rules |
| 79 | + |
| 80 | +- NEVER stop with failing checks. Loop until everything is green. |
| 81 | +- NEVER suppress lint warnings, skip tests, or lower coverage thresholds. |
| 82 | +- NEVER remove assertions to make tests pass. |
| 83 | +- NEVER ignore spell check failures. |
| 84 | +- Fix the CODE, not the checks. |
| 85 | +- If you are stuck on a failure after 3 attempts, ask the user for help. Do NOT silently give up. |
| 86 | +- Always coordinate with other agents via TMC. Check for messages regularly. |
| 87 | +- Leave the codebase in a state that will pass CI on the first try. |
0 commit comments