ci-whisperer

TotalClaw 作者 totalclaw

分析 GitHub Actions 故障并提出修复建议。当用户共享失败的 GitHub Actions 运行 URL/id、说“CI 失败”、询问“为什么此工作流程失败”、想要汇总日志、想要最小程度的修复或想要自动 PR 来解决故障时使用。使用 GitHub CLI (`gh`) 和 GitHub API 安全地获取运行元数据/日志,并生成简明的根本原因 + 后续步骤报告。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~martok9803-martok9803-ci-whisperer
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~martok9803-martok9803-ci-whisperer/file -o martok9803-martok9803-ci-whisperer.md
## 概述(中文)

分析 GitHub Actions 故障并提出修复建议。当用户共享失败的 GitHub Actions 运行 URL/id、说“CI 失败”、询问“为什么此工作流程失败”、想要汇总日志、想要最小程度的修复或想要自动 PR 来解决故障时使用。使用 GitHub CLI (`gh`) 和 GitHub API 安全地获取运行元数据/日志,并生成简明的根本原因 + 后续步骤报告。

## 原文

# CI Whisperer

Fetch GitHub Actions run details, pinpoint the failure, and propose a minimal fix.

This skill is meant to feel like a senior engineer doing a fast “CI autopsy”.

## Modes

### Read-only mode (default)
- Collect evidence, explain root cause, propose fixes.
- **No pushes, no PRs, no branch creation.**

### PR fix mode (opt-in)
PR fix mode is allowed only when **both** are true:
1) The user explicitly asks to open a PR.
2) A local toggle is enabled (the “on/off button”):
   - env var: `CI_WHISPERER_WRITE=1`

If the toggle is not enabled, refuse politely and explain how to enable it.

## Workflow

### 1) Identify target run
Accept any of:
- workflow run URL
- run id
- PR number (then locate latest run)

Always determine:
- `owner/repo`
- run id

If the user didn’t specify the repo, ask for it (or infer from context).

### 2) Gather evidence (tool-backed)
Prefer deterministic tooling. Use `/usr/bin/gh` when the system has multiple `gh` binaries.

Suggested commands:
- `gh run view <run-id> --repo owner/repo --json status,conclusion,createdAt,updatedAt,event,headBranch,headSha,url,name`
- `gh run view <run-id> --repo owner/repo --log-failed`
- `gh run view <run-id> --repo owner/repo --log` (only if needed; can be noisy)

If `gh` is not authenticated, stop and ask the user to run:
- `/usr/bin/gh auth login`

### 3) Produce a "CI Autopsy" report
Return:
- failing job(s) and step(s)
- the exact error excerpt (short; redact secrets)
- likely root cause(s) ranked
- minimal fix options
- confidence level

### 4) (Optional) Open a PR (only with explicit approval + write toggle)
If the user asks to fix it and `CI_WHISPERER_WRITE=1`:
- create a branch
- apply minimal changes
- run local lint/tests if available
- open PR with a clear description and link to the failing run

If the user asks but write mode is OFF:
- provide the patch/diff instructions, but do not push.

## Safety
- Never print tokens.
- Don’t open PRs or push changes unless explicitly requested.
- If logs contain secrets, redact before quoting.

## Bundled scripts
Use scripts for repeatable fetching and parsing:
- `scripts/ci_autopsy.py` (fetch run metadata + failed logs)