Guide the agent through iterative PR/MR refinement to ensure all CI checks, tests, linting, and validation passes before considering the work complete. Never declare success until all automated checks pass.
I ensure that all Pull Requests (PRs) or Merge Requests (MRs) pass every automated check before being declared complete. I guide the agent through iterative refinement until CI is green.
# 1. Install dependencies
bun install
# 2. Run linting
bun run lint
# 3. Run type checking
bun run typecheck
# 4. Run tests
bun run test
# 5. Run build
bun run build
If any check fails → FIX IT before proceeding
After creating PR/MR:
# 1. Verify all checks pass locally
bun run lint && bun run typecheck && bun run test && bun run build
# 2. Push and wait for CI
# 3. Monitor CI results
While any check is failing:
CHECK → FAIL → FIX → COMMIT → PUSH → RE-CHECK → (REPEAT UNTIL PASS)
Priority order for fixing failures:
# Run full check suite one more time
bun run lint
bun run typecheck
bun run test
bun run build
Only declare PR ready when ALL checks pass.
Symptom: CI fails on bun run lint or biome/eslint errors
Fix Process:
# Run auto-fix first
bun run lint --fix
# or
biome check --write .
# If manual fixes needed, address each error
# Re-run lint to verify
bun run lint
Iterate until: bun run lint exits 0
Symptom: bun run typecheck or tsc fails
Fix Process:
# Run type check
bun run typecheck
# Fix each error:
# - Add missing types
# - Fix interface mismatches
# - Update imports
# Re-run typecheck
bun run typecheck
Iterate until: bun run typecheck exits 0
Symptom: Tests fail locally or in CI
Fix Process:
# Run failing test
bun test path/to/failing-test.ts
# Debug and fix
# - Check test expectations
# - Verify mock setup
# - Review logic changes
# Re-run test
bun test path/to/failing-test.ts
# Run full test suite
bun run test
Iterate until: All tests pass
Symptom: bun run build or nx build fails
Fix Process:
# Run build with verbose output
bunx nx run-many --target=build --all --verbose
# Identify failing package
# Check error message
# Common causes:
# - Missing dependencies in package.json
# - Import errors
# - TypeScript compilation errors
# Fix issue
# Re-run build
bun run build
Iterate until: Build succeeds
Symptom: Changes in one package break another
Fix Process:
# Identify affected packages
bunx nx affected:graph
# Build dependency graph first
bunx nx run-many --target=build --projects=dependency-package
# Then build dependent
bunx nx run-many --target=build --projects=dependent-package
# Run tests on affected packages
bunx nx affected:test
Iterate until: All affected packages build and test successfully