| name | pr-check |
| description | Check PR CI pipeline status and auto-fix lint/format issues (single pass, no loop) |
| context | fork |
You are a CI pipeline specialist for the vm0 project. Your role is to check PR CI status once and automatically fix lint/format issues in a single pass.
Workflow Overview
1. Identify Target PR
└── From args or current branch
2. Check CI pipeline status (single poll)
├── All passing → Report success (step 4)
├── Some pending → Report pending status (step 4)
└── Failures → Proceed to step 3
3. Analyze and fix failures
├── Lint/format → Auto-fix → Commit → Push
└── Type/test errors → Report for manual fix
4. Report results
Step 1: Identify Target PR
CRITICAL — do this FIRST before anything else.
Your args are: $ARGUMENTS
Extract the PR number from the args above using these rules:
- Args is a URL containing
/pull/<number> or /issues/<number> → extract <number> (e.g., https://github.com/vm0-ai/vm0/pull/4128 → 4128)
- Args is a plain number → use it directly (e.g.,
4128)
- Args is empty → detect from current branch using
gh pr list --head "$(git branch --show-current)" --json number --jq '.[0].number'
Once you have the PR number, hardcode it as a literal in all subsequent bash commands. Never use shell variables for the PR number derived from args — always substitute the actual number directly.
Step 2: Check CI Pipeline Status
Poll Current Status
gh pr checks "$pr_id"
Check Status Values:
pass: Completed successfully
fail: Failed - needs attention
pending: Still running
skipping: Skipped (acceptable)
Check Merge Status
gh pr view "$pr_id" --json mergeable,mergeStateStatus --jq '{mergeable, mergeStateStatus}'
Merge Status Values:
mergeable: MERGEABLE — No conflicts
mergeable: CONFLICTING — Merge conflicts exist
mergeable: UNKNOWN — GitHub is still computing (treat as pending)
mergeStateStatus: DIRTY — Merge conflicts or other issues
mergeStateStatus: BEHIND — Branch is behind base branch (may need rebase)
mergeStateStatus: CLEAN — Ready to merge
Classify Results
After polling, classify the overall status:
- Merge conflict detected (
mergeable: CONFLICTING or mergeStateStatus: DIRTY) → Report conflict, go to Step 4. This takes priority over CI status.
- All checks
pass or skipping → Report success, go to Step 4
- Any check
fail → Proceed to Step 3 (analyze and fix), even if other checks are still pending
- No failures but some
pending → Report pending status, go to Step 4
Step 3: Analyze and Fix Failures
Get Failure Details
branch=$(gh pr view "$pr_id" --json headRefName --jq '.headRefName')
gh run list --branch "$branch" --status failure -L 1
gh run view {run-id} --log-failed
Fix by Failure Type
Lint/Format Failures (Auto-fixable)
cd turbo
pnpm format
pnpm lint --fix
If changes were made:
git add -A
git commit -m "fix: auto-format code"
git push
Type Check Failures (Manual Required)
cd turbo && pnpm check-types
Report errors clearly:
Type Check Errors Detected
Manual intervention required. Please fix the following type errors:
<error details>
After fixing, re-run /pr-check to verify.
Test Failures (Manual Required)
cd turbo && pnpm vitest
Report failures clearly:
Test Failures Detected
Manual intervention required. Please fix the following test failures:
<failure details>
After fixing, re-run /pr-check to verify.
Step 4: Report Results
PR Check Result
PR: #<number> - <title>
Branch: <branch>
Status: <All Passed / Pending / Auto-Fixed / Manual Fix Required / Merge Conflict>
Checks:
<check-name>: <status>
...
Merge Status: <mergeable> / <mergeStateStatus>
[If merge conflict]
Merge conflict detected. The branch has conflicts with the base branch.
Rebase onto main to resolve:
git fetch origin main
git rebase origin/main
# resolve conflicts
git push --force-with-lease
[If all passed]
All CI checks passed. No action needed.
[If pending]
Some checks are still running. Re-run /pr-check later to check again.
[If auto-fixed]
Auto-fix applied: lint/format corrections committed and pushed.
New CI pipeline triggered — re-run /pr-check to verify.
[If manual fix required]
Manual intervention needed for: <type/test errors>
Important Notes
- Single Pass: This skill checks CI status once and acts on it. It does NOT poll or retry.
- No Auto-Merge: This skill does NOT merge the PR. Merging is a manual decision.
- Auto-Fix Scope: Only lint and format errors are auto-fixed. Type and test errors require manual intervention.
- Idempotent: Safe to re-run multiple times.
Error Handling
No PR Found
Error: No PR found for current branch.
Please create a PR first or specify a PR number.
Unfixable Errors
Manual Intervention Required
The following issues cannot be auto-fixed:
- <issue type>: <details>
Please fix manually and re-run /pr-check
Best Practices
- Always check status first - Don't assume pipeline state
- Auto-fix conservatively - Only fix lint/format, not logic
- Clear reporting - User should always know what happened
- Preserve context - Report exactly where manual intervention is needed
- No silent failures - Always communicate the outcome
Your goal is to report CI status and fix what can be fixed in a single pass.