diff --git a/.claude/skills/open-pr/SKILL.md b/.claude/skills/open-pr/SKILL.md index a44f704..73a28bd 100644 --- a/.claude/skills/open-pr/SKILL.md +++ b/.claude/skills/open-pr/SKILL.md @@ -1,6 +1,6 @@ --- name: open-pr -description: Generates a PR summary from local git changes and opens the pull request on GitHub automatically. Use when the user asks to open, create, or submit a PR. +description: Generates a PR summary from local git changes, opens the pull request on GitHub, monitors CI and Cursor Bugbot, fixes any failure or Bugbot finding, and merges once everything passes. Use when the user asks to open, create, or submit a PR. --- # Open Pull Request @@ -45,6 +45,21 @@ Generates a PR description from local changes and creates the pull request on Gi - Create the PR with `gh pr create` using `--title`, `--head`, `--base main`, and `--body` with the generated description. - Return the PR URL to the user. +7. **Monitor CI and Cursor Bugbot** + - Watch `gh pr checks --json name,bucket` (poll every ~30 s in the background; don't sleep in the foreground) until **all five expected checks are listed** and none is pending: `Build (ubuntu-latest)`, `Build (macos-latest)`, `Build (windows-latest)`, `Audit workflows (zizmor)` and `Cursor Bugbot`. Right after `gh pr create` GitHub may not have registered any runs yet, and an empty or partial list is not "done". + - When all checks are done, read Bugbot's findings: `gh api repos/{owner}/{repo}/pulls//comments` (inline comments) and `gh api repos/{owner}/{repo}/pulls//reviews`. Bugbot can finish as `pass` or `skipping` and still post findings, so always read them. + +8. **Fix problems, then repeat** + - If a check fails, read the log (`gh run view --log-failed`), reproduce locally (`cargo build`, `cargo clippy --all-targets --all-features`, `cargo test`, `cargo fmt --all -- --check`, `mise run zizmor`) and fix the cause. + - If Bugbot reports an issue, verify it against the code. Fix real bugs; for a false positive, reply to the comment explaining why instead of changing code. + - Commit each fix with a conventional-commit message (e.g. `fix: ...`), push to the same branch, and go back to step 7. + - Never bypass a failing check (no `--admin`, no disabling or skipping checks). + +9. **Merge** + - Only when every check passed and no Bugbot finding is left unresolved: `gh pr merge --squash --delete-branch` (the repository only allows squash merges). + - Switch back to `main` and `git pull --ff-only`. `gh pr merge --delete-branch` sometimes deletes the local branch too (not when run with `--repo`), so delete it only if it still exists: `git show-ref --verify --quiet refs/heads/ && git branch -D ` (`-D` because squash merges are not ancestors). Then `git fetch --prune`. + - Tell the user the PR was merged, with the merge commit, and list any fixes made along the way. + ## Output Template (PR body) Use this exact structure. Do NOT include a "Suggested Commit" section. @@ -74,4 +89,5 @@ Use this exact structure. Do NOT include a "Suggested Commit" section. - Never push directly to `main`. If the current branch is `main`, automatically create a feature branch, commit the changes, and continue. - If there are no commits ahead of `main` and no local changes exist, inform the user and stop. - If the branch is already up-to-date on the remote, skip the push step. -- If a PR already exists for the branch, inform the user of the existing PR URL instead of creating a new one. +- If a PR already exists for the branch, inform the user of the existing PR URL instead of creating a new one, then continue from step 7 (monitor, fix, merge). +- If a check keeps failing for a reason outside the PR (e.g. a GitHub or crates.io outage), stop and tell the user instead of merging.