Ci Auto Fix
Automatically fixes all CI failures for a given PR using intelligent analysis and iterative fixes.
Claude CodeGeneric
# CI Auto-Fix Command
Automatically fixes all CI failures for a given PR using intelligent analysis and iterative fixes.
## Usage
```bash
claude --command xats-dev:ci-auto-fix --pr <PR_NUMBER>
Description
This command performs a comprehensive CI fix workflow:
- Checkout PR Branch - Fetches and checks out the PR branch
- Analyzes CI Failures - Uses
gh pr checks <PR> --watchto wait for CI completion - Diagnoses Root Causes - Parses error messages to understand the issues
- Applies Fixes - Makes code changes to resolve identified problems
- Tests Locally - Runs build, lint, and test commands to verify fixes
- Commits and Pushes - Creates clear commits describing the fixes
- Waits for CI Results - Uses
gh pr checks <PR> --watchto monitor new CI run - Iterates - Repeats steps 2-7 until all CI checks pass (max 10 attempts)
Features
- Intelligent Error Analysis - Understands TypeScript, ESLint, test failures, and build errors
- Automated Fix Application - Applies appropriate fixes based on error types
- Local Verification - Tests changes locally before pushing
- Progress Tracking - Provides real-time updates on fix progress
- Retry Logic - Automatically retries if initial fixes don't resolve all issues
- Comprehensive Logging - Maintains detailed logs of all actions taken
Parameters
--pr <number>- The PR number to fix (required)--max-retries <number>- Maximum fix attempts (default: 10)--wait-time <seconds>- Time to wait for CI to complete (default: 600)
Examples
# Fix CI for PR #135
claude --command xats-dev:ci-auto-fix --pr 135
# Fix with custom retry limit
claude --command xats-dev:ci-auto-fix --pr 135 --max-retries 5
# Fix with extended wait time
claude --command xats-dev:ci-auto-fix --pr 135 --wait-time 900
Error Types Handled
- TypeScript compilation errors
- ESLint violations
- Prettier formatting issues
- Module resolution failures
- Test failures
- Build configuration issues
- Missing dependencies
- Import order problems
- Type mismatches
Implementation
The command uses:
- debugger agent for error analysis
- test-engineer agent for test fixes
- code-auditor agent for code quality
- GitHub CLI for CI interaction
- Local test runners for verification
IMPORTANT EXECUTION INSTRUCTIONS
When executing this command, you MUST:
- ALWAYS use
gh pr checks <PR> --watchto wait for CI to complete before analyzing results - NEVER declare success without verifying all CI checks have passed
- ITERATE until all checks pass or max retries reached:
- After pushing fixes, use
gh pr checks <PR> --watchagain - Analyze any remaining failures
- Apply additional fixes if needed
- Repeat until all checks are green
- After pushing fixes, use
- Track iteration count and stop after max retries (default: 10)
- Report final status with:
- Number of iterations performed
- Final CI status (all passing or list of remaining failures)
- Summary of all fixes applied
Workflow Loop
for iteration in 1..max_retries:
1. Run: gh pr checks <PR> --watch
2. If all checks pass: SUCCESS - exit loop
3. If checks fail: analyze failures
4. Apply fixes based on error types
5. Test locally (pnpm lint, pnpm test, pnpm build)
6. Commit and push fixes
7. Continue to next iteration
If max_retries reached without success, report remaining failures. ```
Maintain Ci Auto Fix?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Ci Auto Fix on getagentictools](https://getagentictools.com/loops/xats-org-ci-auto-fix-command?ref=badge)