prbuddy%3Aci by 2389-research/claude-plugins
npx skills add https://github.com/2389-research/claude-plugins --skill prbuddy:ci监控 CI/工作流状态,诊断故障,修复问题,并实施系统性预防。
在以下时刻检查 CI(非持续监控):
gh pr checks --json name,state,bucket,link,workflow
状态解读:
bucket: "pass" → 检查通过bucket: "fail" → 检查失败bucket: "pending" → 仍在运行bucket: "skipping" → 已跳过bucket: "cancel" → 已取消广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果全部通过:
✓ 所有 CI 检查均已通过 (N/N)
准备进入下一步。
如果正在运行:
CI 检查正在进行中 (N/M 已完成)
✓ lint (已通过)
✓ typecheck (已通过)
⏳ test (运行中)
⏳ build (排队中)
在以下时间再次检查:
- 请求评审前
- 宣布完成前
如果失败: 继续诊断
# 获取分支名称(为分离的 HEAD 提供回退方案)
BRANCH=$(git branch --show-current)
if [ -z "$BRANCH" ]; then
BRANCH=$(gh pr view --json headRefName -q .headRefName)
fi
gh run list --branch "$BRANCH" --json databaseId,name,status,conclusion --limit 10
筛选出 conclusion: "failure" 的记录。
对于每个失败的运行:
gh run view <run-id> --log-failed
此命令仅获取失败步骤的日志。
分析日志以确定:
在修复之前,确定这是不稳定测试还是真实故障:
不稳定测试的迹象(考虑重新运行):
真实故障的迹象(需要修复):
如果不稳定: 首先尝试 gh run rerun <id> --failed。如果再次失败,则进一步调查。
对于复杂的故障,使用 PAL 获取专家意见:
mcp__pal__chat: "CI 故障诊断:
错误:[错误信息]
上下文:[相关代码/配置]
根本原因和推荐的修复方案是什么?"
进行代码更改以修复当前的故障。
提问:"怎样才能更早地发现这个问题?"
预防措施层级(优先选择更高层级):
.pre-commit-config.yaml 中添加检查git add [更改的文件]
git commit -m "fix: [描述]
- 修复:[紧急问题]
- 预防:[系统性变更]"
git push
报告:
已推送修复。CI 将自动重新运行。
检查状态:/prbuddy:ci
或在浏览器中查看:gh pr checks --web
正在检查 PR #42 的 CI 状态...
❌ 4 项检查中有 1 项失败
失败:test (运行 987654321)
正在获取日志...
tests/auth.test.ts 中的错误:
TypeError: Cannot read property 'email' of undefined
at validateUser (src/auth.ts:45)
根本原因:当用户对象为 undefined 时缺少空值检查。
正在修复:
1. 在 src/auth.ts:45 添加了空值检查
2. 为 undefined 用户添加了测试用例
3. 预防措施:在 tsconfig.json 中启用了 strictNullChecks
正在提交...
正在推送...
✓ 修复已推送。使用以下命令监控:/prbuddy:ci
| 任务 | 命令 |
|---|---|
| 检查状态 | gh pr checks --json name,state,bucket |
| 列出运行 | gh run list --branch <branch> --json databaseId,name,conclusion |
| 查看运行 | gh run view <id> |
| 失败日志 | gh run view <id> --log-failed |
| 完整日志 | gh run view <id> --log |
| 监控运行 | gh run watch <id> |
| 重新运行失败项 | gh run rerun <id> --failed |
| 全部重新运行 | gh run rerun <id> |
每周安装量
1
代码仓库
GitHub 星标数
25
首次出现
1 天前
安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
Monitors CI/workflow status, diagnoses failures, fixes issues, and implements systematic prevention.
Check CI at these moments (not continuously):
gh pr checks --json name,state,bucket,link,workflow
Status interpretation:
bucket: "pass" → Check passedbucket: "fail" → Check failedbucket: "pending" → Still runningbucket: "skipping" → Skippedbucket: "cancel" → CancelledIf all passing:
✓ All CI checks passing (N/N)
Ready for next step.
If pending:
CI checks in progress (N/M complete)
✓ lint (passed)
✓ typecheck (passed)
⏳ test (running)
⏳ build (queued)
Check again:
- Before requesting review
- Before declaring done
If failed: Continue to diagnosis
# Get branch name (with fallback for detached HEAD)
BRANCH=$(git branch --show-current)
if [ -z "$BRANCH" ]; then
BRANCH=$(gh pr view --json headRefName -q .headRefName)
fi
gh run list --branch "$BRANCH" --json databaseId,name,status,conclusion --limit 10
Filter for conclusion: "failure".
For each failed run:
gh run view <run-id> --log-failed
This fetches only the logs for failed steps.
Analyze the logs to identify:
Before fixing, determine if this is a flaky test or real failure:
Signs of flaky test (consider rerun):
Signs of real failure (fix required):
If flaky: Try gh run rerun <id> --failed first. If it fails again, investigate further.
For complex failures, use PAL for expert opinion:
mcp__pal__chat: "CI failure diagnosis:
Error: [error message]
Context: [relevant code/config]
What's the root cause and recommended fix?"
Make the code changes to fix the immediate failure.
Ask: "What would have caught this earlier?"
Prevention hierarchy (prefer higher):
.pre-commit-config.yamlgit add [changed files]
git commit -m "fix: [description]
- Fixed: [acute issue]
- Prevention: [systematic change]"
git push
Report:
Pushed fix. CI will re-run automatically.
Check status: /prbuddy:ci
Or watch in browser: gh pr checks --web
Checking CI status for PR #42...
❌ 1 of 4 checks failed
Failed: test (run 987654321)
Fetching logs...
Error in tests/auth.test.ts:
TypeError: Cannot read property 'email' of undefined
at validateUser (src/auth.ts:45)
Root cause: Missing null check when user object is undefined.
Fixing:
1. Added null check in src/auth.ts:45
2. Added test case for undefined user
3. Prevention: Enabled strictNullChecks in tsconfig.json
Committing...
Pushing...
✓ Fix pushed. Monitor with: /prbuddy:ci
| Task | Command |
|---|---|
| Check status | gh pr checks --json name,state,bucket |
| List runs | gh run list --branch <branch> --json databaseId,name,conclusion |
| View run | gh run view <id> |
| Failed logs | gh run view <id> --log-failed |
| Full logs | gh run view <id> --log |
| Watch run | gh run watch <id> |
Weekly Installs
1
Repository
GitHub Stars
25
First Seen
1 day ago
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
| Rerun failed | gh run rerun <id> --failed |
| Rerun all | gh run rerun <id> |