@olegkoval/agent-skills 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +8 -2
- package/.cursor-plugin/index.json +30 -0
- package/.grok-plugin/index.json +30 -0
- package/.kiro/steering/codexloop.md +254 -0
- package/.kiro/steering/geminiloop.md +230 -0
- package/.kiro/steering/pr-finalize-complete.md +187 -0
- package/.windsurf/rules/codexloop.md +253 -0
- package/.windsurf/rules/geminiloop.md +229 -0
- package/.windsurf/rules/pr-finalize-complete.md +186 -0
- package/README.md +9 -3
- package/catalog/skills.json +146 -0
- package/package.json +1 -1
- package/packages/software-development/codexloop/SKILL.md +261 -0
- package/packages/software-development/codexloop/adapters/claude/plugin.json +5 -0
- package/packages/software-development/codexloop/adapters/claude/skills/codexloop/SKILL.md +262 -0
- package/packages/software-development/codexloop/adapters/codex/README.md +26 -0
- package/packages/software-development/codexloop/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/codexloop/adapters/cursor/skills/codexloop/SKILL.md +263 -0
- package/packages/software-development/codexloop/adapters/grok/plugin.json +6 -0
- package/packages/software-development/codexloop/adapters/grok/skills/codexloop/SKILL.md +262 -0
- package/packages/software-development/codexloop/adapters/kiro/steering/codexloop.md +254 -0
- package/packages/software-development/codexloop/adapters/windsurf/rules/codexloop.md +253 -0
- package/packages/software-development/dependabot-triage/SKILL.md +150 -0
- package/packages/software-development/dependabot-triage/adapters/claude/plugin.json +5 -0
- package/packages/software-development/dependabot-triage/adapters/claude/skills/dependabot-triage/SKILL.md +151 -0
- package/packages/software-development/dependabot-triage/adapters/codex/README.md +19 -0
- package/packages/software-development/dependabot-triage/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/dependabot-triage/adapters/cursor/skills/dependabot-triage/SKILL.md +151 -0
- package/packages/software-development/dependabot-triage/adapters/grok/plugin.json +6 -0
- package/packages/software-development/dependabot-triage/adapters/grok/skills/dependabot-triage/SKILL.md +151 -0
- package/packages/software-development/geminiloop/SKILL.md +237 -0
- package/packages/software-development/geminiloop/adapters/claude/plugin.json +5 -0
- package/packages/software-development/geminiloop/adapters/claude/skills/geminiloop/SKILL.md +238 -0
- package/packages/software-development/geminiloop/adapters/codex/README.md +25 -0
- package/packages/software-development/geminiloop/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/geminiloop/adapters/cursor/skills/geminiloop/SKILL.md +239 -0
- package/packages/software-development/geminiloop/adapters/grok/plugin.json +6 -0
- package/packages/software-development/geminiloop/adapters/grok/skills/geminiloop/SKILL.md +238 -0
- package/packages/software-development/geminiloop/adapters/kiro/steering/geminiloop.md +230 -0
- package/packages/software-development/geminiloop/adapters/windsurf/rules/geminiloop.md +229 -0
- package/packages/software-development/pr-finalize-complete/SKILL.md +195 -0
- package/packages/software-development/pr-finalize-complete/adapters/claude/plugin.json +5 -0
- package/packages/software-development/pr-finalize-complete/adapters/claude/skills/pr-finalize-complete/SKILL.md +196 -0
- package/packages/software-development/pr-finalize-complete/adapters/codex/README.md +24 -0
- package/packages/software-development/pr-finalize-complete/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/pr-finalize-complete/adapters/cursor/skills/pr-finalize-complete/SKILL.md +197 -0
- package/packages/software-development/pr-finalize-complete/adapters/grok/plugin.json +6 -0
- package/packages/software-development/pr-finalize-complete/adapters/grok/skills/pr-finalize-complete/SKILL.md +196 -0
- package/packages/software-development/pr-finalize-complete/adapters/kiro/steering/pr-finalize-complete.md +187 -0
- package/packages/software-development/pr-finalize-complete/adapters/windsurf/rules/pr-finalize-complete.md +186 -0
- package/packages/software-development/pr-to-green/SKILL.md +165 -0
- package/packages/software-development/pr-to-green/adapters/claude/plugin.json +5 -0
- package/packages/software-development/pr-to-green/adapters/claude/skills/pr-to-green/SKILL.md +166 -0
- package/packages/software-development/pr-to-green/adapters/codex/README.md +19 -0
- package/packages/software-development/pr-to-green/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/pr-to-green/adapters/cursor/skills/pr-to-green/SKILL.md +166 -0
- package/packages/software-development/pr-to-green/adapters/grok/plugin.json +6 -0
- package/packages/software-development/pr-to-green/adapters/grok/skills/pr-to-green/SKILL.md +166 -0
- package/packages/software-development/store-listing-copy/SKILL.md +215 -0
- package/packages/software-development/store-listing-copy/adapters/claude/plugin.json +5 -0
- package/packages/software-development/store-listing-copy/adapters/claude/skills/store-listing-copy/SKILL.md +216 -0
- package/packages/software-development/store-listing-copy/adapters/codex/README.md +20 -0
- package/packages/software-development/store-listing-copy/adapters/cursor/plugin.json +6 -0
- package/packages/software-development/store-listing-copy/adapters/cursor/skills/store-listing-copy/SKILL.md +216 -0
- package/packages/software-development/store-listing-copy/adapters/grok/plugin.json +6 -0
- package/packages/software-development/store-listing-copy/adapters/grok/skills/store-listing-copy/SKILL.md +216 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
inclusion: manual
|
|
5
|
+
description: "Confirms a PR is genuinely merge-ready when the work is already believed done: re-checks every review-bot and human finding against the current code, separates stale comments from fixed ones, runs the repo's real lint and test gates, and reports the evidence rather than the assumption."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PR Finalize Complete
|
|
9
|
+
|
|
10
|
+
Confirm a PR is genuinely merge-ready -- even when all issues were already addressed -- by verifying the evidence, not trusting the assumption.
|
|
11
|
+
|
|
12
|
+
## When to use this vs pr-finalize
|
|
13
|
+
|
|
14
|
+
Use pr-finalize-complete when:
|
|
15
|
+
- The branch owner says "it should be fixed already" and you need to confirm
|
|
16
|
+
- Review bot findings may be stale (comments on old file paths, already-changed code)
|
|
17
|
+
- You need to produce a verification report, not just drive fixes
|
|
18
|
+
-- CI was green before but you need to re-confirm after a rebase
|
|
19
|
+
|
|
20
|
+
Use pr-finalize when starting from scratch on an unaddressed PR.
|
|
21
|
+
|
|
22
|
+
## Inputs
|
|
23
|
+
|
|
24
|
+
- **PR number or URL** (optional): detect from the current branch if not given.
|
|
25
|
+
- `--no-push` (optional): run all verification steps but skip the final push.
|
|
26
|
+
|
|
27
|
+
## Non-negotiables
|
|
28
|
+
|
|
29
|
+
- **Never claim a test passed without running it.** Report the actual exit code and test count.
|
|
30
|
+
- **Never resolve a bot comment without checking whether the issue still exists in the current code.** Stale comments are common and silently resolving them is wrong.
|
|
31
|
+
- **Never git add -A.** Start with a clean tree; stage only files your fixes actually touched.
|
|
32
|
+
- **Stale comments are not done -- they are no longer applicable.** Distinguish the two in your report.
|
|
33
|
+
|
|
34
|
+
## Instructions
|
|
35
|
+
|
|
36
|
+
### 1. Establish ground truth
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gh pr view <PR> --json number,title,body,state,isDraft,headRefName,baseRefName,mergeable,mergeStateStatus,reviews,statusCheckRollup,url
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Record before touching anything:
|
|
43
|
+
|
|
44
|
+
- Is the branch **clean** (`git status --porcelain` empty)?
|
|
45
|
+
- Is the branch **behind** `origin/<base>`?
|
|
46
|
+
- What **checks are currently failing**, and which are required?
|
|
47
|
+
- Which bots have actually posted (completed, not just triggered)?
|
|
48
|
+
|
|
49
|
+
### 2. Rebase only if needed
|
|
50
|
+
|
|
51
|
+
If mergeable is CONFLICTING or the branch is behind its base:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git fetch origin <base>
|
|
55
|
+
git rebase origin/<base>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Resolve conflicts by understanding both sides. After resolving, run tests before continuing.
|
|
59
|
+
If there is no conflict, skip this step -- do not rebase speculatively.
|
|
60
|
+
|
|
61
|
+
### 3. Triage existing review comments
|
|
62
|
+
|
|
63
|
+
Collect all findings:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate
|
|
67
|
+
gh api repos/{owner}/{repo}/issues/<PR>/comments --paginate
|
|
68
|
+
gh pr view <PR> --json reviews
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For each unresolved finding, determine its actual current status in the code:
|
|
72
|
+
|
|
73
|
+
| Status | Meaning | Action |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| Already fixed | Code the comment targets has been changed and issue no longer exists | Verify in code, reply confirming fix, resolve |
|
|
76
|
+
| Stale | Comment targets a file/line/symbol that no longer exists | Verify, reply noting it is stale, resolve |
|
|
77
|
+
| Still present | Issue exists in current code | Fix it, commit, reply, resolve |
|
|
78
|
+
| False positive | Bot diagnosis is wrong for this codebase | Reply with specific rebuttal, leave open |
|
|
79
|
+
| Needs human | Product/architecture decision required | Reply, leave open, surface in report |
|
|
80
|
+
|
|
81
|
+
A comment is stale if the file it targets has been deleted or
|
|
82
|
+
renamed, the function or class it names no longer exists, or the
|
|
83
|
+
issue was flagged on an old line that has since been rewritten.
|
|
84
|
+
|
|
85
|
+
Check for staleness before any fix attempt:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/files --paginate
|
|
89
|
+
git diff origin/<base>...HEAD =- <file>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For stale comments: verify in current HEAD, reply explaining what changed, then resolve.
|
|
93
|
+
|
|
94
|
+
### 4. Verify test coverage
|
|
95
|
+
|
|
96
|
+
Find changed files:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
gh pr view <PR> --json files -q '.files[].path'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For each changed module: check for a direct unit test file, confirm
|
|
103
|
+
it exercises the specific code paths changed, and run it to verify
|
|
104
|
+
impasses.
|
|
105
|
+
|
|
106
|
+
If a module has no direct unit tests but is only indirectly covered,
|
|
107
|
+
that is a real gap. Add direct tests unless the coverage gap is
|
|
108
|
+
explicitly justified.
|
|
109
|
+
|
|
110
|
+
### 5. Run the real gates
|
|
111
|
+
|
|
112
|
+
Discover from the repo -- do not guess target names:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
cat package.json | jq '.scripts'
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Run in order: lint, format check, full test suite. Capture the actual
|
|
119
|
+
exit code and output. Do not push if any required gate is red.
|
|
120
|
+
|
|
121
|
+
### 6. Push and report
|
|
122
|
+
|
|
123
|
+
If there were changes to commit:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git add <only files you touched>
|
|
127
|
+
git commit -m "address review feedback and verify tests"
|
|
128
|
+
git push --force-with-lease
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Post one PR comment with a verifiable summary: rebase status, each
|
|
132
|
+
finding and its disposition, test coverage decision, and verbatim
|
|
133
|
+
gate output with real numbers.
|
|
134
|
+
|
|
135
|
+
### 7. Verify final state
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
gh pr view <PR> --json mergeable,mergeStateStatus,statusCheckRollup
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Poll until checks complete. If anything that was green went red,
|
|
142
|
+
diagnose and fix before declaring done.
|
|
143
|
+
|
|
144
|
+
## Common patterns
|
|
145
|
+
|
|
146
|
+
### Pattern: All issues already fixed
|
|
147
|
+
|
|
148
|
+
When a bot shows open findings but the branch owner believes they
|
|
149
|
+
are all resolved:
|
|
150
|
+
1. Do not trust the assertion -- verify each one in the current code.
|
|
151
|
+
2. Stale comments are the most common case: the code was refactored
|
|
152
|
+
and the bot finding path no longer exists.
|
|
153
|
+
3. Distinguish "already fixed before bot ran" from "fixed in a later
|
|
154
|
+
commit the bot has not re-reviewed yet".
|
|
155
|
+
4. Re-trigger the bot if it has not reviewed current HEAD.
|
|
156
|
+
|
|
157
|
+
### Pattern: Direct unit tests missing
|
|
158
|
+
|
|
159
|
+
Bots frequently flag helper functions exercised only through callers.
|
|
160
|
+
Add a direct test for the helper itself -- do not rely on indirect
|
|
161
|
+
coverage through a caller integration test.
|
|
162
|
+
|
|
163
|
+
### Pattern: Branch conflict with rewritten shared file
|
|
164
|
+
|
|
165
|
+
When rebase hits a conflict in a file both branches modified:
|
|
166
|
+
1. Run git log to understand what main changed and why.
|
|
167
|
+
2. Read the purpose of the main-side hunk -- it is usually an invariant
|
|
168
|
+
your branch is unaware of.
|
|
169
|
+
3. Apply main's change to your version of the file, then re-run
|
|
170
|
+
the affected tests.
|
|
171
|
+
4. Document which invariant you preserved in your PR comment.
|
|
172
|
+
|
|
173
|
+
### Pattern: CI flaky on first push
|
|
174
|
+
|
|
175
|
+
Before declaring a gate failure real:
|
|
176
|
+
1. Check if the failure is in a known flaky test.
|
|
177
|
+
2. Check if the failure is in a linter with a stale cache from a
|
|
178
|
+
different worktree.
|
|
179
|
+
3. Re-run the specific failing check once before fixing.
|
|
180
|
+
4. Only fix if the failure reproduces on re-run.
|
|
181
|
+
|
|
182
|
+
## Related skills
|
|
183
|
+
|
|
184
|
+
- pr-finalize -- drive a PR from scratch to merge-ready when comments are unaddressed.
|
|
185
|
+
- qodoloop -- full Qodo thread protocol (per-finding Agent Prompts, resolve mutations).
|
|
186
|
+
- coderabbitloop -- full CodeRabbit thread protocol.
|
|
187
|
+
- ci-fix-loop -- when the blocker is a failing CI pipeline, not review feedback.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
description: "Iteratively drives a GitHub PR to zero unresolved OpenAI Codex review comments — but verifies every finding against the real code first, fixes only the correct ones, and rebuts false positives without changing correct code."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codexloop
|
|
8
|
+
|
|
9
|
+
Drive a GitHub PR until Codex has no unresolved review comments — **but do not cargo-cult its
|
|
10
|
+
suggestions.** Every comment is a *claim to verify*, not an instruction to obey. A wrong
|
|
11
|
+
suggestion applied is worse than the comment itself.
|
|
12
|
+
|
|
13
|
+
## How Codex differs from Greptile / Gemini
|
|
14
|
+
|
|
15
|
+
- **No check-run, no score.** Codex does not publish an `X/5` confidence or a named check. It posts
|
|
16
|
+
a **PR review** (state `COMMENTED`) plus inline review comments. Detection is by polling the
|
|
17
|
+
*reviews* endpoint. "Satisfied" = zero unresolved comments (each either fixed or rebutted).
|
|
18
|
+
- **Trigger phrase is `@codex review`.** Codex reviews automatically when a PR opens or gets new
|
|
19
|
+
commits if auto-review is enabled on the repo; the mention forces a fresh pass. Other useful
|
|
20
|
+
mentions: `@codex review focus on <area>` for a scoped re-review.
|
|
21
|
+
- **Priority, not confidence.** Codex findings usually lead with a severity/priority word (`P1`,
|
|
22
|
+
`P2`, `P3` or `critical`/`major`/`minor`) or a short titled heading. Weight the top tier
|
|
23
|
+
seriously; treat the bottom tier as usually-skippable nits unless clearly correct.
|
|
24
|
+
- **Codex is terse and often reasons from the diff alone.** Its characteristic failure is
|
|
25
|
+
confidently asserting a bug based only on the changed hunk, without the surrounding file or the
|
|
26
|
+
call sites. That makes "read the whole file before believing it" the single highest-value check.
|
|
27
|
+
|
|
28
|
+
## Not for
|
|
29
|
+
|
|
30
|
+
- GitLab / Perforce (Codex code review is a GitHub app). For other review bots this catalog ships
|
|
31
|
+
`geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
|
|
32
|
+
`ci-fix-loop`.
|
|
33
|
+
|
|
34
|
+
## 0. Resolve the Codex bot login (do this first, do not hardcode)
|
|
35
|
+
|
|
36
|
+
The connector's bot login varies by installation, so discover it from the PR rather than
|
|
37
|
+
assuming it:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate --jq '.[].user.login' | sort -u
|
|
41
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate --jq '.[].user.login' | sort -u
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pick the login matching `*codex*` (commonly `chatgpt-codex-connector[bot]`, sometimes
|
|
45
|
+
`codex[bot]`) and export it as `BOT`.
|
|
46
|
+
|
|
47
|
+
**Finding nothing here is NOT a stop condition.** On a PR Codex has never reviewed there is no bot
|
|
48
|
+
login to find yet — that is the normal starting state, not a missing app. When the probe comes back
|
|
49
|
+
empty, fall through to step 2A, post `@codex review`, and re-run this probe once a review lands;
|
|
50
|
+
until then match any login containing `codex` when polling. Only conclude the app is absent after
|
|
51
|
+
step 2A's bounded wait has expired with no review and no codex-like login anywhere on the PR — and
|
|
52
|
+
then say so and stop, rather than looping against nothing.
|
|
53
|
+
|
|
54
|
+
## 1. Identify the PR
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
|
|
61
|
+
|
|
62
|
+
## 2. The loop (max 5 iterations)
|
|
63
|
+
|
|
64
|
+
Keep an explicit iteration counter and stop at 5 — the cap is a real bound to enforce, not a
|
|
65
|
+
figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
|
|
66
|
+
report and list what is still unresolved rather than starting a sixth.
|
|
67
|
+
|
|
68
|
+
### A. Ensure a fresh Codex review on the current head
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
|
|
72
|
+
# Only trigger if no Codex review already exists for this exact SHA:
|
|
73
|
+
HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
|
|
74
|
+
--jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | length")
|
|
75
|
+
if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "@codex review"; fi
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint — and
|
|
79
|
+
poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
|
|
80
|
+
an honest timeout, not hang it.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 10-minute deadline, one retry, then give up. DEADLINE/RETRIES are the
|
|
84
|
+
# enforcement of the bounds this skill claims — do not drop them.
|
|
85
|
+
wait_for_review() { # $1 = attempt label
|
|
86
|
+
local deadline=$(( SECONDS + 600 ))
|
|
87
|
+
while [ "$SECONDS" -lt "$deadline" ]; do
|
|
88
|
+
R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
|
|
89
|
+
--jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | last")
|
|
90
|
+
if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
|
|
91
|
+
echo "waiting for Codex review of $HEAD_SHA ($1)..."; sleep 15
|
|
92
|
+
done
|
|
93
|
+
return 1
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if ! wait_for_review "first wait"; then
|
|
97
|
+
echo "no Codex review after 10m — retrying once" # say the retry out loud
|
|
98
|
+
gh pr comment <PR> --body "@codex review"
|
|
99
|
+
if ! wait_for_review "after retry"; then
|
|
100
|
+
echo "Codex did not review $HEAD_SHA after a retry; stopping and reporting."
|
|
101
|
+
exit 1 # honest timeout, never a success claim
|
|
102
|
+
fi
|
|
103
|
+
fi
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Codex can take several minutes on a large diff, which is why the deadline is generous. Report the
|
|
107
|
+
retry in the final summary; two silent timeouts are the failure mode this guard exists to prevent.
|
|
108
|
+
|
|
109
|
+
### B. Fetch the findings
|
|
110
|
+
|
|
111
|
+
- **Summary**: the review `.body` from the object above — read the overall take and the priority
|
|
112
|
+
spread.
|
|
113
|
+
- **Unresolved inline comments** on the current head:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
|
|
117
|
+
--jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
|
|
121
|
+
unresolved ones.
|
|
122
|
+
|
|
123
|
+
### C. Critically evaluate EACH comment (the core of this skill)
|
|
124
|
+
|
|
125
|
+
For every comment, **verify the claim against the actual code and repo conventions before touching
|
|
126
|
+
anything.** Read the whole file — not just the diff hunk Codex saw — plus the types and the call
|
|
127
|
+
sites. Then classify:
|
|
128
|
+
|
|
129
|
+
1. **CORRECT + actionable** — the finding is real and the fix improves the code. → fix it (step D).
|
|
130
|
+
2. **FALSE POSITIVE / technically wrong** — the claim doesn't hold. → do **NOT** change code; write a
|
|
131
|
+
specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve.
|
|
132
|
+
3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
|
|
133
|
+
→ briefly decline with a reason, then resolve. Do not expand the PR's scope to satisfy a nit.
|
|
134
|
+
|
|
135
|
+
**Hard rules:**
|
|
136
|
+
- **Never modify correct code just to silence Codex.** Prefer a reasoned rebuttal.
|
|
137
|
+
- When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
|
|
138
|
+
rather than assume Codex is right. Default to skepticism.
|
|
139
|
+
- If a suggested change would break other call sites, alter public behavior, or contradict a verified
|
|
140
|
+
repo convention, it is a category-2 rebuttal, not a fix.
|
|
141
|
+
- Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Codex asks for a
|
|
142
|
+
ticket reference and none exists, say so; do not invent one.
|
|
143
|
+
|
|
144
|
+
**Codex's common failure modes to watch for (default these to category 2):**
|
|
145
|
+
- Diff-local reasoning: asserts a bug that the unchanged surrounding code already handles.
|
|
146
|
+
- "This can be null/undefined here" where the type or an earlier guard already rules it out.
|
|
147
|
+
- Invented race conditions or error paths with no actual trigger.
|
|
148
|
+
- Suggestions that compile-break or break other callers.
|
|
149
|
+
- Security/perf warnings with no exploit path or measurable cost.
|
|
150
|
+
- Restating library/framework semantics incorrectly.
|
|
151
|
+
- Style demands that contradict the repo's existing, consistent pattern.
|
|
152
|
+
|
|
153
|
+
### D. Apply fixes — category 1 only
|
|
154
|
+
|
|
155
|
+
Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
|
|
156
|
+
moving on.
|
|
157
|
+
|
|
158
|
+
### E. Commit and push FIRST, before resolving anything
|
|
159
|
+
|
|
160
|
+
Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
|
|
161
|
+
succeed before the claim is made — otherwise a failed commit or push leaves the PR unfixed with the
|
|
162
|
+
finding marked resolved, and nobody looks at it again.
|
|
163
|
+
|
|
164
|
+
If step D changed code:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Stage ONLY the files your fixes touched — never `git add -A`, which sweeps up
|
|
168
|
+
# unrelated work and untracked secrets sitting in the worktree.
|
|
169
|
+
git status --short # look before you stage
|
|
170
|
+
git add <path> [<path>...] # the files named in the findings you fixed
|
|
171
|
+
git commit -m "address codex review feedback (codexloop iteration N)"
|
|
172
|
+
git push
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
|
|
176
|
+
convention). Confirm the push actually landed before continuing:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git rev-parse HEAD
|
|
180
|
+
gh pr view <PR> --json headRefOid -q .headRefOid # must match
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
|
|
184
|
+
|
|
185
|
+
### F. Reply to and resolve every addressed thread
|
|
186
|
+
|
|
187
|
+
Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
|
|
188
|
+
pagination** — a PR with more than 100 threads will otherwise look clean while unresolved findings
|
|
189
|
+
sit on page two:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Loop until hasNextPage is false, passing endCursor back in as $cursor.
|
|
193
|
+
CURSOR=null
|
|
194
|
+
while : ; do
|
|
195
|
+
PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
|
|
196
|
+
query($cursor: String) {
|
|
197
|
+
repository(owner: "OWNER", name: "REPO") {
|
|
198
|
+
pullRequest(number: PR_NUMBER) {
|
|
199
|
+
reviewThreads(first: 100, after: $cursor) {
|
|
200
|
+
pageInfo { hasNextPage endCursor }
|
|
201
|
+
nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}')
|
|
206
|
+
echo "$PAGE" # collect nodes from every page before deciding the PR is clean
|
|
207
|
+
PI='.data.repository.pullRequest.reviewThreads.pageInfo'
|
|
208
|
+
[ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
|
|
209
|
+
CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
|
|
210
|
+
done
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
|
|
214
|
+
then resolve:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted — never
|
|
221
|
+
blanket-resolve, and never resolve a human reviewer's thread.
|
|
222
|
+
|
|
223
|
+
Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
|
|
224
|
+
whether step D changed code.
|
|
225
|
+
|
|
226
|
+
### G. Re-review
|
|
227
|
+
|
|
228
|
+
Pushing re-triggers Codex when auto-review is on; otherwise post `@codex review`. Go back to **A**
|
|
229
|
+
with the new head SHA. If step D changed nothing (all comments were rebutted), skip the push,
|
|
230
|
+
ensure all threads are resolved, and exit.
|
|
231
|
+
|
|
232
|
+
## 3. Exit conditions
|
|
233
|
+
|
|
234
|
+
Stop when **any** is true:
|
|
235
|
+
- Zero unresolved `$BOT` comments remain, and every comment this round was fixed or
|
|
236
|
+
rebutted+resolved. (There is no score to hit — this is "done".)
|
|
237
|
+
- Max iterations (5) reached — report what remains.
|
|
238
|
+
- Codex never responded after one retry — report the timeout honestly; do not claim success.
|
|
239
|
+
|
|
240
|
+
## 4. Report
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
Codexloop complete.
|
|
244
|
+
PR: #<n>
|
|
245
|
+
Bot login: <resolved $BOT>
|
|
246
|
+
Iterations: N
|
|
247
|
+
Comments fixed: N (genuinely-correct findings)
|
|
248
|
+
Comments rebutted: N (false positives / nits, resolved with rationale)
|
|
249
|
+
Remaining: 0
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
If it stopped at max iterations, list the remaining threads with your current assessment
|
|
253
|
+
(fix-pending vs disputed) so a human can arbitrate.
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
description: "Iteratively drives a GitHub PR to zero unresolved Gemini Code Assist comments — treats each one as a claim to verify, fixes only the genuinely-correct findings, and rebuts the rest with evidence instead of editing correct code."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Geminiloop
|
|
8
|
+
|
|
9
|
+
Drive a GitHub PR until Gemini Code Assist has no unresolved comments — **but do not cargo-cult
|
|
10
|
+
its suggestions.** Gemini is often confidently wrong. Every comment is a *claim to verify*, not an
|
|
11
|
+
instruction to obey. A wrong suggestion applied is worse than the comment itself.
|
|
12
|
+
|
|
13
|
+
## How Gemini differs from other review bots
|
|
14
|
+
|
|
15
|
+
- **No check-run, no score.** Gemini does not publish a `X/5` confidence or a `greptile` check. It
|
|
16
|
+
posts a **PR review** (state `COMMENTED`) authored by `gemini-code-assist[bot]` with a
|
|
17
|
+
`## Code Review` summary body plus inline review comments. Detection is by polling the *reviews*
|
|
18
|
+
endpoint, not a check-run. "Satisfied" = zero unresolved comments (each either fixed or rebutted),
|
|
19
|
+
since there is no numeric target.
|
|
20
|
+
- **Auto-reviews on push/open.** It reviews automatically when a PR opens or gets new commits;
|
|
21
|
+
`/gemini review` forces a fresh pass.
|
|
22
|
+
- **Severity, not confidence.** Inline comments carry a priority badge (a `![critical]` /
|
|
23
|
+
`![high]` / `![medium]` / `![low]` shields image) at the top of the body. Weight `critical`/`high`
|
|
24
|
+
seriously; treat `medium`/`low` as usually-skippable nits unless clearly correct.
|
|
25
|
+
- **Higher false-positive rate.** This is the whole point of the skill: bias toward *rebut* over
|
|
26
|
+
*change*.
|
|
27
|
+
|
|
28
|
+
## Not for
|
|
29
|
+
|
|
30
|
+
- GitLab / Perforce (Gemini Code Assist is GitHub-only). For other review bots this catalog ships
|
|
31
|
+
`codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
|
|
32
|
+
`ci-fix-loop`.
|
|
33
|
+
|
|
34
|
+
## 1. Identify the PR
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
|
|
41
|
+
|
|
42
|
+
## 2. The loop (max 5 iterations)
|
|
43
|
+
|
|
44
|
+
Keep an explicit iteration counter and stop at 5 — the cap is a real bound to enforce, not a
|
|
45
|
+
figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
|
|
46
|
+
report and list what is still unresolved rather than starting a sixth.
|
|
47
|
+
|
|
48
|
+
### A. Ensure a fresh Gemini review on the current head
|
|
49
|
+
|
|
50
|
+
Gemini auto-reviews new commits, but force a deterministic pass and record the head SHA:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
|
|
54
|
+
# Only trigger if no gemini review already exists for this exact SHA:
|
|
55
|
+
HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
|
|
56
|
+
--jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | length")
|
|
57
|
+
if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "/gemini review"; fi
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint — and
|
|
61
|
+
poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
|
|
62
|
+
an honest timeout, not hang it.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 10-minute deadline, one retry, then give up.
|
|
66
|
+
wait_for_review() { # $1 = attempt label
|
|
67
|
+
local deadline=$(( SECONDS + 600 ))
|
|
68
|
+
while [ "$SECONDS" -lt "$deadline" ]; do
|
|
69
|
+
R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
|
|
70
|
+
--jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | last")
|
|
71
|
+
if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
|
|
72
|
+
echo "waiting for Gemini review of $HEAD_SHA ($1)..."; sleep 15
|
|
73
|
+
done
|
|
74
|
+
return 1
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ! wait_for_review "first wait"; then
|
|
78
|
+
echo "no Gemini review after 10m — retrying once" # say the retry out loud
|
|
79
|
+
gh pr comment <PR> --body "/gemini review"
|
|
80
|
+
if ! wait_for_review "after retry"; then
|
|
81
|
+
echo "Gemini did not review $HEAD_SHA after a retry; stopping and reporting."
|
|
82
|
+
exit 1 # honest timeout, never a success claim
|
|
83
|
+
fi
|
|
84
|
+
fi
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Report the retry in the final summary; two silent timeouts are the failure mode this guard exists
|
|
88
|
+
to prevent.
|
|
89
|
+
|
|
90
|
+
### B. Fetch the findings
|
|
91
|
+
|
|
92
|
+
- **Summary** (the `## Code Review` body): the review `.body` from the object above — read the
|
|
93
|
+
overall take and the severity spread.
|
|
94
|
+
- **Unresolved inline comments** on the current head:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
|
|
98
|
+
--jq '.[] | select(.user.login=="gemini-code-assist[bot]") | {id, path, line, body}'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
|
|
102
|
+
unresolved ones.
|
|
103
|
+
|
|
104
|
+
### C. Critically evaluate EACH comment (the core of this skill)
|
|
105
|
+
|
|
106
|
+
For every comment, **verify the claim against the actual code and repo conventions before touching
|
|
107
|
+
anything.** Read the file, the surrounding code, the types, and any call sites. Then classify:
|
|
108
|
+
|
|
109
|
+
1. **CORRECT + actionable** — the finding is real and the fix improves the code. → fix it (step D).
|
|
110
|
+
2. **FALSE POSITIVE / technically wrong** — the claim doesn't hold. → do **NOT** change code; write a
|
|
111
|
+
specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve.
|
|
112
|
+
3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
|
|
113
|
+
→ briefly decline with a reason, then resolve. Do not expand the PR's scope to satisfy a nit.
|
|
114
|
+
|
|
115
|
+
**Hard rules:**
|
|
116
|
+
- **Never modify correct code just to silence Gemini.** Prefer a reasoned rebuttal.
|
|
117
|
+
- When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
|
|
118
|
+
rather than assume Gemini is right. Default to skepticism.
|
|
119
|
+
- If a suggested change would break other call sites, alter public behavior, or contradict a verified
|
|
120
|
+
repo convention, it is a category-2 rebuttal, not a fix.
|
|
121
|
+
- Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Gemini asks for a
|
|
122
|
+
ticket reference and none exists, say so; do not invent one.
|
|
123
|
+
|
|
124
|
+
**Gemini's common failure modes to watch for (default these to category 2):**
|
|
125
|
+
- Hallucinated APIs, options, or framework behavior stated as fact.
|
|
126
|
+
- "Add a null/undefined check" where the type already guarantees presence.
|
|
127
|
+
- Suggestions that compile-break or break other callers.
|
|
128
|
+
- Security/perf warnings with no actual exploit path or measurable cost.
|
|
129
|
+
- Restating library/framework semantics incorrectly.
|
|
130
|
+
- Style demands that contradict the repo's existing, consistent pattern.
|
|
131
|
+
|
|
132
|
+
### D. Apply fixes — category 1 only
|
|
133
|
+
|
|
134
|
+
Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
|
|
135
|
+
moving on.
|
|
136
|
+
|
|
137
|
+
### E. Commit and push FIRST, before resolving anything
|
|
138
|
+
|
|
139
|
+
Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
|
|
140
|
+
succeed before the claim is made — otherwise a failed commit or push leaves the PR unfixed with the
|
|
141
|
+
finding marked resolved, and nobody looks at it again.
|
|
142
|
+
|
|
143
|
+
If step D changed code:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Stage ONLY the files your fixes touched — never `git add -A`, which sweeps up
|
|
147
|
+
# unrelated work and untracked secrets sitting in the worktree.
|
|
148
|
+
git status --short # look before you stage
|
|
149
|
+
git add <path> [<path>...] # the files named in the findings you fixed
|
|
150
|
+
git commit -m "address gemini review feedback (geminiloop iteration N)"
|
|
151
|
+
git push
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
|
|
155
|
+
convention). Confirm the push actually landed before continuing:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
git rev-parse HEAD
|
|
159
|
+
gh pr view <PR> --json headRefOid -q .headRefOid # must match
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
|
|
163
|
+
|
|
164
|
+
### F. Reply to and resolve every addressed thread
|
|
165
|
+
|
|
166
|
+
Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
|
|
167
|
+
pagination** — a PR with more than 100 threads will otherwise look clean while unresolved findings
|
|
168
|
+
sit on page two:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Loop until hasNextPage is false, passing endCursor back in as $cursor.
|
|
172
|
+
CURSOR=null
|
|
173
|
+
while : ; do
|
|
174
|
+
PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
|
|
175
|
+
query($cursor: String) {
|
|
176
|
+
repository(owner: "OWNER", name: "REPO") {
|
|
177
|
+
pullRequest(number: PR_NUMBER) {
|
|
178
|
+
reviewThreads(first: 100, after: $cursor) {
|
|
179
|
+
pageInfo { hasNextPage endCursor }
|
|
180
|
+
nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}')
|
|
185
|
+
echo "$PAGE" # collect nodes from every page before deciding the PR is clean
|
|
186
|
+
PI='.data.repository.pullRequest.reviewThreads.pageInfo'
|
|
187
|
+
[ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
|
|
188
|
+
CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
|
|
189
|
+
done
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
|
|
193
|
+
then resolve:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Resolve a thread only for comments authored by `gemini-code-assist[bot]` that you have fixed or
|
|
200
|
+
rebutted — never blanket-resolve, and never resolve a human reviewer's thread.
|
|
201
|
+
|
|
202
|
+
Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
|
|
203
|
+
whether step D changed code.
|
|
204
|
+
|
|
205
|
+
### G. Re-review
|
|
206
|
+
|
|
207
|
+
Pushing re-triggers Gemini automatically; go back to **A** with the new head SHA. If step D changed
|
|
208
|
+
nothing (all comments were rebutted), skip the push, ensure all threads are resolved, and exit.
|
|
209
|
+
|
|
210
|
+
## 3. Exit conditions
|
|
211
|
+
|
|
212
|
+
Stop when **any** is true:
|
|
213
|
+
- Zero unresolved `gemini-code-assist[bot]` comments remain, and every comment this round was fixed
|
|
214
|
+
or rebutted+resolved. (There is no score to hit — this is "done".)
|
|
215
|
+
- Max iterations (5) reached — report what remains.
|
|
216
|
+
|
|
217
|
+
## 4. Report
|
|
218
|
+
|
|
219
|
+
```text
|
|
220
|
+
Geminiloop complete.
|
|
221
|
+
PR: #<n>
|
|
222
|
+
Iterations: N
|
|
223
|
+
Comments fixed: N (genuinely-correct findings)
|
|
224
|
+
Comments rebutted: N (false positives / nits, resolved with rationale)
|
|
225
|
+
Remaining: 0
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If it stopped at max iterations, list the remaining threads with your current assessment
|
|
229
|
+
(fix-pending vs disputed) so a human can arbitrate.
|