@codedrifters/configulator 0.0.199 → 0.0.200
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/lib/index.d.mts +10 -1
- package/lib/index.d.ts +10 -1
- package/lib/index.js +403 -73
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +402 -73
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -440,55 +440,11 @@ var createRuleSkill = {
|
|
|
440
440
|
"- Use `ruleExtensions` to add project-specific content to existing bundle rules instead of replacing them"
|
|
441
441
|
].join("\n")
|
|
442
442
|
};
|
|
443
|
-
var reviewPrSkill = {
|
|
444
|
-
name: "review-pr",
|
|
445
|
-
description: "Review a pull request for code quality, conventions, and correctness",
|
|
446
|
-
instructions: [
|
|
447
|
-
"# Review Pull Request",
|
|
448
|
-
"",
|
|
449
|
-
"Review the current pull request in **{{repository.owner}}/{{repository.name}}**.",
|
|
450
|
-
"",
|
|
451
|
-
"## Review Checklist",
|
|
452
|
-
"",
|
|
453
|
-
"1. **Read the PR description** \u2014 understand the intent and linked issue",
|
|
454
|
-
"2. **Review the diff** \u2014 check all changed files for:",
|
|
455
|
-
" - Correctness and logic errors",
|
|
456
|
-
" - Adherence to project conventions",
|
|
457
|
-
" - Test coverage for new/changed behavior",
|
|
458
|
-
" - No unintended side effects",
|
|
459
|
-
"3. **Check PR conventions:**",
|
|
460
|
-
" - Title uses conventional commit prefix (`feat:`, `fix:`, `docs:`, etc.)",
|
|
461
|
-
" - Body includes a closing keyword (`Closes #<issue>`)",
|
|
462
|
-
" - Summary of changes is present",
|
|
463
|
-
"4. **Verify build and tests pass**",
|
|
464
|
-
"",
|
|
465
|
-
"## Commands",
|
|
466
|
-
"",
|
|
467
|
-
"```bash",
|
|
468
|
-
"# View the PR details",
|
|
469
|
-
"gh pr view",
|
|
470
|
-
"",
|
|
471
|
-
"# View the diff",
|
|
472
|
-
"gh pr diff",
|
|
473
|
-
"",
|
|
474
|
-
"# Check CI status",
|
|
475
|
-
"gh pr checks",
|
|
476
|
-
"```",
|
|
477
|
-
"",
|
|
478
|
-
"## Output Format",
|
|
479
|
-
"",
|
|
480
|
-
"Provide a structured review with:",
|
|
481
|
-
"- **Summary**: One-line verdict (approve, request changes, or comment)",
|
|
482
|
-
"- **Findings**: Bulleted list of issues or suggestions, grouped by severity",
|
|
483
|
-
"- **Positive notes**: What was done well"
|
|
484
|
-
].join("\n"),
|
|
485
|
-
allowedTools: ["Read", "Glob", "Grep", "Bash(gh *)"]
|
|
486
|
-
};
|
|
487
443
|
var baseBundle = {
|
|
488
444
|
name: "base",
|
|
489
445
|
description: "Core rules: project overview, interaction style, and general coding conventions",
|
|
490
446
|
appliesWhen: () => true,
|
|
491
|
-
skills: [createRuleSkill
|
|
447
|
+
skills: [createRuleSkill],
|
|
492
448
|
rules: [
|
|
493
449
|
{
|
|
494
450
|
name: "project-overview",
|
|
@@ -980,21 +936,7 @@ var githubWorkflowBundle = {
|
|
|
980
936
|
"6. **Create the PR** using `gh pr create`:",
|
|
981
937
|
" - **Title**: use a conventional commit style title (e.g., `feat(scope): short description`)",
|
|
982
938
|
" - **Body**: include `Closes #<issue-number>` (derived from the branch name) and a brief summary of changes",
|
|
983
|
-
"7. **
|
|
984
|
-
"",
|
|
985
|
-
"```",
|
|
986
|
-
"gh pr merge --auto --squash --subject '<conventional-commit-title>' --body '<extended-description>'",
|
|
987
|
-
"```",
|
|
988
|
-
"",
|
|
989
|
-
"The merge commit message should follow this format:",
|
|
990
|
-
"",
|
|
991
|
-
"```",
|
|
992
|
-
"Subject: <conventional-commit-title>",
|
|
993
|
-
"",
|
|
994
|
-
"Body:",
|
|
995
|
-
"- Bullet points summarizing the changes",
|
|
996
|
-
"- Closes #<issue-number>",
|
|
997
|
-
"```",
|
|
939
|
+
"7. **Delegate review and merge to the `pr-reviewer` sub-agent.** After the PR is created, invoke the `/review-pr <pr-number>` skill (or otherwise hand the new PR number to the `pr-reviewer` sub-agent). The reviewer verifies the diff against the linked issue's acceptance criteria and enables squash auto-merge when all checks pass. Do **not** run `gh pr merge --auto` yourself \u2014 review/merge policy lives solely in the `pr-reviewer` agent.",
|
|
998
940
|
"",
|
|
999
941
|
"### PR Body Template",
|
|
1000
942
|
"",
|
|
@@ -1015,7 +957,7 @@ var githubWorkflowBundle = {
|
|
|
1015
957
|
"",
|
|
1016
958
|
"- Always derive the issue number from the branch name (e.g., `feat/42-add-login` \u2192 `#42`)",
|
|
1017
959
|
"- Use conventional commit format for the PR title",
|
|
1018
|
-
"-
|
|
960
|
+
"- Delegate merge to the `pr-reviewer` sub-agent \u2014 do not merge manually and do not enable auto-merge directly"
|
|
1019
961
|
].join("\n"),
|
|
1020
962
|
tags: ["workflow"]
|
|
1021
963
|
}
|
|
@@ -1797,8 +1739,7 @@ var orchestratorSubAgent = {
|
|
|
1797
1739
|
" - Verify PR conventions: conventional commit title, closing keyword, summary present",
|
|
1798
1740
|
" - Check CI status: `gh pr checks N`",
|
|
1799
1741
|
"3. If the PR passes review:",
|
|
1800
|
-
" -
|
|
1801
|
-
" - Enable auto-merge: `gh pr merge N --auto --squash`",
|
|
1742
|
+
" - Enable squash auto-merge: `gh pr merge N --auto --squash --subject '<conventional-commit-title>' --body '<extended-description>'`",
|
|
1802
1743
|
"4. If the PR fails review:",
|
|
1803
1744
|
" - Request changes: `gh pr review N --request-changes --body '<findings>'`",
|
|
1804
1745
|
"5. After each PR (whether merged or not):",
|
|
@@ -2058,10 +1999,10 @@ var issueWorkerSubAgent = {
|
|
|
2058
1999
|
'Closes #<issue-number>"',
|
|
2059
2000
|
"```",
|
|
2060
2001
|
"",
|
|
2061
|
-
"
|
|
2062
|
-
"
|
|
2063
|
-
"
|
|
2064
|
-
"
|
|
2002
|
+
"Do **not** enable auto-merge yourself. The `pr-reviewer` sub-agent owns",
|
|
2003
|
+
"review and merge for every PR \u2014 it verifies the diff against the issue's",
|
|
2004
|
+
"acceptance criteria and enables squash auto-merge only when all checks",
|
|
2005
|
+
"pass. Record the new PR number so a reviewer can be invoked next.",
|
|
2065
2006
|
"",
|
|
2066
2007
|
"## Phase 8: Update Status",
|
|
2067
2008
|
"",
|
|
@@ -2072,9 +2013,9 @@ var issueWorkerSubAgent = {
|
|
|
2072
2013
|
"",
|
|
2073
2014
|
"## Phase 9: Branch Cleanup",
|
|
2074
2015
|
"",
|
|
2075
|
-
"
|
|
2076
|
-
"up to 10 times, waiting 30 seconds between polls, until it either
|
|
2077
|
-
"closes, or the timeout is reached:",
|
|
2016
|
+
"The PR will not auto-merge until the `pr-reviewer` enables it. Poll the PR",
|
|
2017
|
+
"state up to 10 times, waiting 30 seconds between polls, until it either",
|
|
2018
|
+
"merges, closes, or the timeout is reached:",
|
|
2078
2019
|
"",
|
|
2079
2020
|
"```bash",
|
|
2080
2021
|
"gh pr view <pr-number> --json state --jq '.state'",
|
|
@@ -2088,8 +2029,8 @@ var issueWorkerSubAgent = {
|
|
|
2088
2029
|
" ```",
|
|
2089
2030
|
"- **If the state becomes `CLOSED` (not merged):** leave the branch in place",
|
|
2090
2031
|
" and report that the PR was closed without merging. Do not delete the branch.",
|
|
2091
|
-
"- **If still `OPEN` after the polling window:** report that
|
|
2092
|
-
"
|
|
2032
|
+
"- **If still `OPEN` after the polling window:** report that the PR is",
|
|
2033
|
+
" awaiting review/merge and stop. Do not delete the branch.",
|
|
2093
2034
|
"",
|
|
2094
2035
|
"---",
|
|
2095
2036
|
"",
|
|
@@ -2270,6 +2211,392 @@ var pnpmBundle = {
|
|
|
2270
2211
|
]
|
|
2271
2212
|
};
|
|
2272
2213
|
|
|
2214
|
+
// src/agent/bundles/pr-review.ts
|
|
2215
|
+
var prReviewerSubAgent = {
|
|
2216
|
+
name: "pr-reviewer",
|
|
2217
|
+
description: "Reviews a pull request against its linked issue's acceptance criteria, then enables squash auto-merge or comments with findings",
|
|
2218
|
+
model: AGENT_MODEL.POWERFUL,
|
|
2219
|
+
maxTurns: 40,
|
|
2220
|
+
platforms: { cursor: { exclude: true } },
|
|
2221
|
+
prompt: [
|
|
2222
|
+
"# PR Reviewer Agent",
|
|
2223
|
+
"",
|
|
2224
|
+
"You review a single pull request in **{{repository.owner}}/{{repository.name}}**",
|
|
2225
|
+
"against its linked issue's acceptance criteria, verify code quality and",
|
|
2226
|
+
"convention compliance, and then either enable squash auto-merge or leave",
|
|
2227
|
+
"a review comment with findings. You handle exactly **one PR per session**",
|
|
2228
|
+
"unless invoked from the multi-PR loop skill (`/review-prs`), in which case",
|
|
2229
|
+
"you process each eligible PR in turn.",
|
|
2230
|
+
"",
|
|
2231
|
+
"---",
|
|
2232
|
+
"",
|
|
2233
|
+
"## Phase 1: Identify the PR",
|
|
2234
|
+
"",
|
|
2235
|
+
"If a PR number was provided in your instructions, use that. Otherwise stop",
|
|
2236
|
+
"and report that you need a PR number \u2014 do not pick one yourself.",
|
|
2237
|
+
"",
|
|
2238
|
+
"## Phase 1.5: Pre-flight Eligibility Filter",
|
|
2239
|
+
"",
|
|
2240
|
+
"Before spending turns on a full review, run a cheap eligibility check:",
|
|
2241
|
+
"",
|
|
2242
|
+
"```bash",
|
|
2243
|
+
"gh pr view <pr-number> --json number,title,body,headRefName,mergeable,mergeStateStatus,statusCheckRollup",
|
|
2244
|
+
"```",
|
|
2245
|
+
"",
|
|
2246
|
+
"The PR is **eligible** only when **all** of the following hold:",
|
|
2247
|
+
"",
|
|
2248
|
+
'1. `mergeable == "MERGEABLE"` (no merge conflicts).',
|
|
2249
|
+
"2. No **failing** required checks in `statusCheckRollup` \u2014 CI must be",
|
|
2250
|
+
" green or still pending. Any `FAILURE`, `TIMED_OUT`, `CANCELLED`, or",
|
|
2251
|
+
" `ERROR` conclusion on a required check disqualifies the PR.",
|
|
2252
|
+
"3. The PR body contains a linked issue via one of the closing keywords:",
|
|
2253
|
+
" `Closes #N`, `Fixes #N`, or `Resolves #N` (case-insensitive).",
|
|
2254
|
+
"",
|
|
2255
|
+
"If **any** check fails, post a short comment explaining the reason and",
|
|
2256
|
+
"stop. Do not proceed to full review.",
|
|
2257
|
+
"",
|
|
2258
|
+
"```bash",
|
|
2259
|
+
"gh pr comment <pr-number> --body '<reason>'",
|
|
2260
|
+
"```",
|
|
2261
|
+
"",
|
|
2262
|
+
"Typical reasons:",
|
|
2263
|
+
"",
|
|
2264
|
+
"- `Not reviewable: merge conflicts \u2014 please rebase onto the default branch.`",
|
|
2265
|
+
"- `Not reviewable: required CI check <name> is failing.`",
|
|
2266
|
+
"- `Not reviewable: PR body is missing a linked issue (Closes #N / Fixes #N / Resolves #N).`",
|
|
2267
|
+
"",
|
|
2268
|
+
"## Phase 2: Gather Context",
|
|
2269
|
+
"",
|
|
2270
|
+
"```bash",
|
|
2271
|
+
"gh pr view <pr-number> --json number,title,body,headRefName,baseRefName,isDraft,state,labels,reviews",
|
|
2272
|
+
"gh pr diff <pr-number>",
|
|
2273
|
+
"gh pr checks <pr-number>",
|
|
2274
|
+
"```",
|
|
2275
|
+
"",
|
|
2276
|
+
"Extract the linked issue number from the PR body using the closing keywords",
|
|
2277
|
+
"(`Closes #N`, `Fixes #N`, or `Resolves #N`) identified in Phase 1.5.",
|
|
2278
|
+
"",
|
|
2279
|
+
"Then fetch the linked issue:",
|
|
2280
|
+
"",
|
|
2281
|
+
"```bash",
|
|
2282
|
+
"gh issue view <issue-number>",
|
|
2283
|
+
"```",
|
|
2284
|
+
"",
|
|
2285
|
+
"## Phase 3: Compare Diff to Acceptance Criteria",
|
|
2286
|
+
"",
|
|
2287
|
+
"Read the issue body for an **Acceptance Criteria** (or equivalent) section.",
|
|
2288
|
+
"Build a checklist from it. For each item:",
|
|
2289
|
+
"",
|
|
2290
|
+
"1. Locate the changes in the diff that satisfy it.",
|
|
2291
|
+
"2. Mark it as `met`, `partial`, or `missing`.",
|
|
2292
|
+
"3. Record the specific files / functions / tests that provide evidence.",
|
|
2293
|
+
"",
|
|
2294
|
+
"Also evaluate:",
|
|
2295
|
+
"",
|
|
2296
|
+
"- **Convention compliance** \u2014 PR title uses a conventional commit prefix,",
|
|
2297
|
+
" body includes a closing keyword, branch name follows project conventions",
|
|
2298
|
+
"- **Test coverage** \u2014 new or changed behavior has tests",
|
|
2299
|
+
"- **CI status** \u2014 `gh pr checks` reports all required checks passing",
|
|
2300
|
+
"- **Scope creep** \u2014 diff stays within the issue's stated scope",
|
|
2301
|
+
"",
|
|
2302
|
+
"## Phase 4: Decide and Act",
|
|
2303
|
+
"",
|
|
2304
|
+
"### If all acceptance criteria are met and CI is green",
|
|
2305
|
+
"",
|
|
2306
|
+
"Enable squash auto-merge with branch deletion. This queues the merge to",
|
|
2307
|
+
"happen once required checks pass; no separate approval review is needed.",
|
|
2308
|
+
"",
|
|
2309
|
+
"```bash",
|
|
2310
|
+
"gh pr merge <pr-number> --auto --squash --delete-branch \\",
|
|
2311
|
+
" --subject '<conventional-commit-title>' \\",
|
|
2312
|
+
" --body '<extended-description>'",
|
|
2313
|
+
"```",
|
|
2314
|
+
"",
|
|
2315
|
+
"The squash-merge subject should follow conventional commit format (e.g.",
|
|
2316
|
+
"`feat(scope): description`). The body should bullet the changes and end",
|
|
2317
|
+
"with `Closes #<issue-number>`.",
|
|
2318
|
+
"",
|
|
2319
|
+
"### If any criterion is missing, partial, or CI is failing",
|
|
2320
|
+
"",
|
|
2321
|
+
"Post a plain comment (not a formal review block) with grouped findings:",
|
|
2322
|
+
"",
|
|
2323
|
+
"```bash",
|
|
2324
|
+
"gh pr comment <pr-number> --body '<grouped findings>'",
|
|
2325
|
+
"```",
|
|
2326
|
+
"",
|
|
2327
|
+
"Group findings by severity (**Blocking** / **Suggested** / **Nitpick**).",
|
|
2328
|
+
"For each blocking finding, cite the unmet acceptance criterion and the",
|
|
2329
|
+
"file or function the gap lives in. Do **not** merge, and do **not** push",
|
|
2330
|
+
"any commits to the PR's branch.",
|
|
2331
|
+
"",
|
|
2332
|
+
"Rationale for using a plain comment rather than `gh pr review",
|
|
2333
|
+
"--request-changes`: it is lighter-weight, doesn't require the author to",
|
|
2334
|
+
"dismiss a formal review, and composes cleanly with the multi-PR loop.",
|
|
2335
|
+
"",
|
|
2336
|
+
"## Phase 5: Branch Cleanup and Issue Closure Verification",
|
|
2337
|
+
"",
|
|
2338
|
+
"Auto-merge may not be immediate. Poll the PR state up to 10 times, waiting",
|
|
2339
|
+
"30 seconds between polls:",
|
|
2340
|
+
"",
|
|
2341
|
+
"```bash",
|
|
2342
|
+
"gh pr view <pr-number> --json state --jq '.state'",
|
|
2343
|
+
"```",
|
|
2344
|
+
"",
|
|
2345
|
+
"- **`MERGED`** \u2014 clean up locally **and** verify the linked issue closed:",
|
|
2346
|
+
" ```bash",
|
|
2347
|
+
" git checkout {{repository.defaultBranch}}",
|
|
2348
|
+
" git pull origin {{repository.defaultBranch}}",
|
|
2349
|
+
" git fetch --prune origin",
|
|
2350
|
+
" git branch -d <branch-name> 2>/dev/null || git branch -D <branch-name> 2>/dev/null || true",
|
|
2351
|
+
" ```",
|
|
2352
|
+
" Then check the linked issue state:",
|
|
2353
|
+
" ```bash",
|
|
2354
|
+
" gh issue view <issue-number> --json state --jq '.state'",
|
|
2355
|
+
" ```",
|
|
2356
|
+
" If the issue is **not** `CLOSED`, close it explicitly (this covers",
|
|
2357
|
+
" malformed or missing closing keywords on the merge commit):",
|
|
2358
|
+
" ```bash",
|
|
2359
|
+
" gh issue close <issue-number> --reason completed",
|
|
2360
|
+
" gh issue comment <issue-number> --body 'PR #<pr-number> merged. Closing issue.'",
|
|
2361
|
+
" ```",
|
|
2362
|
+
"- **`CLOSED` (not merged)** \u2014 leave the branch in place; report the closure.",
|
|
2363
|
+
"- **Still `OPEN`** \u2014 auto-merge is pending; report and stop without deleting.",
|
|
2364
|
+
"",
|
|
2365
|
+
"---",
|
|
2366
|
+
"",
|
|
2367
|
+
"## Output Format",
|
|
2368
|
+
"",
|
|
2369
|
+
"Return a structured report:",
|
|
2370
|
+
"",
|
|
2371
|
+
"```",
|
|
2372
|
+
"PR #<number> \u2014 <title>",
|
|
2373
|
+
"Linked issue: #<issue-number>",
|
|
2374
|
+
"Verdict: AUTO_MERGE_ENABLED | NEEDS_CHANGES | INELIGIBLE | BLOCKED",
|
|
2375
|
+
"",
|
|
2376
|
+
"Acceptance criteria:",
|
|
2377
|
+
" [x] <criterion> \u2014 <evidence>",
|
|
2378
|
+
" [~] <criterion> \u2014 partial: <gap>",
|
|
2379
|
+
" [ ] <criterion> \u2014 missing",
|
|
2380
|
+
"",
|
|
2381
|
+
"Findings:",
|
|
2382
|
+
" - Blocking: <items>",
|
|
2383
|
+
" - Suggested: <items>",
|
|
2384
|
+
" - Nitpick: <items>",
|
|
2385
|
+
"",
|
|
2386
|
+
"Action taken: <enable-auto-merge | commented-on-the-pr | none>",
|
|
2387
|
+
"Branch state: <merged | open | closed>",
|
|
2388
|
+
"Issue state: <closed | open>",
|
|
2389
|
+
"```",
|
|
2390
|
+
"",
|
|
2391
|
+
"---",
|
|
2392
|
+
"",
|
|
2393
|
+
"## Rules",
|
|
2394
|
+
"",
|
|
2395
|
+
"1. **One PR per session** when invoked directly (`/review-pr`). When",
|
|
2396
|
+
" invoked from the multi-PR loop (`/review-prs`), process every eligible",
|
|
2397
|
+
" PR in turn.",
|
|
2398
|
+
"2. **Never merge without a linked issue.** If the PR body has no",
|
|
2399
|
+
" `Closes #N` / `Fixes #N` / `Resolves #N`, comment and stop.",
|
|
2400
|
+
"3. **Never merge with failing CI.** Even if every criterion is met,",
|
|
2401
|
+
" block on red checks.",
|
|
2402
|
+
"4. **Never bypass review conventions.** Always use `--squash`, `--auto`,",
|
|
2403
|
+
" and `--delete-branch` for merges. Do not force-merge.",
|
|
2404
|
+
"5. **Do not implement code.** You review, decide, and orchestrate. If",
|
|
2405
|
+
" the PR needs changes, comment and stop.",
|
|
2406
|
+
"6. **Never push commits to the PR's branch.** If the PR needs changes,",
|
|
2407
|
+
" comment and stop \u2014 do not attempt to fix it yourself. The PR author",
|
|
2408
|
+
" owns the branch; pushing to someone else's branch is out of scope.",
|
|
2409
|
+
"7. **In loop mode (`/review-prs`), never stop early.** If any review",
|
|
2410
|
+
" fails, comment and move to the next PR. Only abort the loop on a",
|
|
2411
|
+
" fatal error (e.g. `gh` auth failure, network outage).",
|
|
2412
|
+
"8. **Follow CLAUDE.md conventions** for all `git` and `gh` operations."
|
|
2413
|
+
].join("\n")
|
|
2414
|
+
};
|
|
2415
|
+
var reviewPrSkill = {
|
|
2416
|
+
name: "review-pr",
|
|
2417
|
+
description: "Review a single pull request against its linked issue's acceptance criteria, then enable squash auto-merge or comment with findings",
|
|
2418
|
+
disableModelInvocation: true,
|
|
2419
|
+
userInvocable: true,
|
|
2420
|
+
context: "fork",
|
|
2421
|
+
agent: "pr-reviewer",
|
|
2422
|
+
platforms: { cursor: { exclude: true } },
|
|
2423
|
+
instructions: [
|
|
2424
|
+
"# Review Pull Request",
|
|
2425
|
+
"",
|
|
2426
|
+
"Run a full PR review against the linked issue's acceptance criteria,",
|
|
2427
|
+
"then either enable squash auto-merge or post a findings comment.",
|
|
2428
|
+
"",
|
|
2429
|
+
"## Usage",
|
|
2430
|
+
"",
|
|
2431
|
+
"/review-pr <pr-number>",
|
|
2432
|
+
"",
|
|
2433
|
+
"## What This Skill Does",
|
|
2434
|
+
"",
|
|
2435
|
+
"1. Runs a pre-flight eligibility filter (mergeable, CI not failing, has linked issue)",
|
|
2436
|
+
"2. Fetches the PR, its diff, CI status, and the linked issue",
|
|
2437
|
+
"3. Builds a checklist from the issue's acceptance criteria",
|
|
2438
|
+
"4. Compares the diff against each criterion",
|
|
2439
|
+
"5. Verifies PR conventions (title, closing keyword, branch name)",
|
|
2440
|
+
"6. Verifies CI is green",
|
|
2441
|
+
"7. **If all checks pass:** enables squash auto-merge (with `--delete-branch`)",
|
|
2442
|
+
"8. **If any check fails:** posts a findings comment via `gh pr comment`",
|
|
2443
|
+
"9. After merge, verifies the linked issue is closed and closes it if not",
|
|
2444
|
+
"10. Cleans up the local branch after merge",
|
|
2445
|
+
"",
|
|
2446
|
+
"## Input",
|
|
2447
|
+
"",
|
|
2448
|
+
"Provide the PR number to review. The skill resolves the linked issue from",
|
|
2449
|
+
"the PR body (`Closes #N` / `Fixes #N` / `Resolves #N`).",
|
|
2450
|
+
"",
|
|
2451
|
+
"## Output",
|
|
2452
|
+
"",
|
|
2453
|
+
"A structured report covering verdict, per-criterion status, findings",
|
|
2454
|
+
"grouped by severity, the action taken, and the final branch / issue state.",
|
|
2455
|
+
"",
|
|
2456
|
+
"## Composability",
|
|
2457
|
+
"",
|
|
2458
|
+
"This skill is generic and can be composed with the `github-workflow`",
|
|
2459
|
+
"bundle. The reviewer never implements code and never pushes to the PR",
|
|
2460
|
+
"branch \u2014 it only reviews, decides, and orchestrates merge or comment."
|
|
2461
|
+
].join("\n")
|
|
2462
|
+
};
|
|
2463
|
+
var reviewPrsSkill = {
|
|
2464
|
+
name: "review-prs",
|
|
2465
|
+
description: "Loop over every eligible open pull request in the repository and review each one through the full pipeline",
|
|
2466
|
+
disableModelInvocation: true,
|
|
2467
|
+
userInvocable: true,
|
|
2468
|
+
context: "fork",
|
|
2469
|
+
agent: "pr-reviewer",
|
|
2470
|
+
platforms: { cursor: { exclude: true } },
|
|
2471
|
+
instructions: [
|
|
2472
|
+
"# Review All Eligible Pull Requests",
|
|
2473
|
+
"",
|
|
2474
|
+
"Run the pr-reviewer pipeline over every eligible open PR in",
|
|
2475
|
+
"**{{repository.owner}}/{{repository.name}}**, one after another, until",
|
|
2476
|
+
"the eligible queue is empty.",
|
|
2477
|
+
"",
|
|
2478
|
+
"## Usage",
|
|
2479
|
+
"",
|
|
2480
|
+
"/review-prs",
|
|
2481
|
+
"",
|
|
2482
|
+
"## What This Skill Does",
|
|
2483
|
+
"",
|
|
2484
|
+
"### Step 1: Enumerate open PRs",
|
|
2485
|
+
"",
|
|
2486
|
+
"```bash",
|
|
2487
|
+
"gh pr list --json number,title,body,headRefName,mergeable,mergeStateStatus,statusCheckRollup --limit 50",
|
|
2488
|
+
"```",
|
|
2489
|
+
"",
|
|
2490
|
+
"### Step 2: Filter to eligible PRs",
|
|
2491
|
+
"",
|
|
2492
|
+
"A PR is **eligible** when all of the following hold:",
|
|
2493
|
+
"",
|
|
2494
|
+
'1. `state == "OPEN"` (implicit from `gh pr list`).',
|
|
2495
|
+
'2. `mergeable == "MERGEABLE"` (no conflicts).',
|
|
2496
|
+
"3. No required check in `statusCheckRollup` has a failing conclusion",
|
|
2497
|
+
" (`FAILURE`, `TIMED_OUT`, `CANCELLED`, `ERROR`). CI green or still",
|
|
2498
|
+
" pending is fine.",
|
|
2499
|
+
"4. The PR body contains a linked issue (`Closes #N` / `Fixes #N` /",
|
|
2500
|
+
" `Resolves #N`, case-insensitive).",
|
|
2501
|
+
"",
|
|
2502
|
+
"Drop any PR that fails the filter from the queue. Do not comment on",
|
|
2503
|
+
"them from this skill \u2014 the individual `/review-pr` invocation handles",
|
|
2504
|
+
"the inline rejection comment when run on a specific PR.",
|
|
2505
|
+
"",
|
|
2506
|
+
"### Step 3: Process each eligible PR",
|
|
2507
|
+
"",
|
|
2508
|
+
"For every eligible PR, invoke the full pr-reviewer pipeline",
|
|
2509
|
+
"(Phases 1 through 5) as if `/review-pr <number>` had been called",
|
|
2510
|
+
"directly:",
|
|
2511
|
+
"",
|
|
2512
|
+
"- Gather context (diff, checks, linked issue)",
|
|
2513
|
+
"- Compare diff to acceptance criteria",
|
|
2514
|
+
"- Decide and act (enable auto-merge **or** post findings comment)",
|
|
2515
|
+
"- Verify branch / issue cleanup after merge",
|
|
2516
|
+
"",
|
|
2517
|
+
"Continue to the next PR after each one completes. Never stop the loop",
|
|
2518
|
+
"early because a single PR's review failed \u2014 comment and move on.",
|
|
2519
|
+
"",
|
|
2520
|
+
"### Step 4: Stop when the queue is empty",
|
|
2521
|
+
"",
|
|
2522
|
+
"When no eligible PRs remain, emit a final summary listing every PR",
|
|
2523
|
+
"processed and the verdict for each, then stop.",
|
|
2524
|
+
"",
|
|
2525
|
+
"## Output",
|
|
2526
|
+
"",
|
|
2527
|
+
"Per-PR structured report (same shape as `/review-pr`), followed by a",
|
|
2528
|
+
"one-line-per-PR summary at the end:",
|
|
2529
|
+
"",
|
|
2530
|
+
"```",
|
|
2531
|
+
"Summary:",
|
|
2532
|
+
" PR #<n>: <verdict>",
|
|
2533
|
+
" PR #<n>: <verdict>",
|
|
2534
|
+
" ...",
|
|
2535
|
+
"Total processed: <count>",
|
|
2536
|
+
"```",
|
|
2537
|
+
"",
|
|
2538
|
+
"## Failure Handling",
|
|
2539
|
+
"",
|
|
2540
|
+
"Only abort the loop on a fatal error (e.g. `gh` authentication failure,",
|
|
2541
|
+
"network outage). A failed review for an individual PR is not fatal \u2014",
|
|
2542
|
+
"comment on that PR and continue with the next."
|
|
2543
|
+
].join("\n")
|
|
2544
|
+
};
|
|
2545
|
+
var prReviewBundle = {
|
|
2546
|
+
name: "pr-review",
|
|
2547
|
+
description: "Pull request review workflow: verifies PRs against their linked issues' acceptance criteria and orchestrates squash-merge, single or looped over all eligible PRs",
|
|
2548
|
+
// Default-apply: the PR review workflow is safe to include everywhere,
|
|
2549
|
+
// and keeping review/merge policy centralised in the pr-reviewer agent
|
|
2550
|
+
// means consumers get consistent behaviour out of the box. Consumers can
|
|
2551
|
+
// still exclude it explicitly via `excludeBundles` if desired.
|
|
2552
|
+
appliesWhen: () => true,
|
|
2553
|
+
rules: [
|
|
2554
|
+
{
|
|
2555
|
+
name: "pr-review-workflow",
|
|
2556
|
+
description: "Describes the /review-pr and /review-prs skills and their delegation to the pr-reviewer sub-agent",
|
|
2557
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
2558
|
+
content: [
|
|
2559
|
+
"# PR Review Workflow",
|
|
2560
|
+
"",
|
|
2561
|
+
"Two skills are available, both backed by the same `pr-reviewer`",
|
|
2562
|
+
"sub-agent:",
|
|
2563
|
+
"",
|
|
2564
|
+
"- **`/review-pr <pr-number>`** \u2014 review a single targeted PR.",
|
|
2565
|
+
"- **`/review-prs`** \u2014 loop over every eligible open PR in the",
|
|
2566
|
+
" repository and review each one in turn.",
|
|
2567
|
+
"",
|
|
2568
|
+
"The `pr-reviewer` sub-agent:",
|
|
2569
|
+
"",
|
|
2570
|
+
"1. Runs a pre-flight eligibility filter (mergeable, CI not failing,",
|
|
2571
|
+
" has a linked issue). Ineligible PRs get a short comment and are",
|
|
2572
|
+
" skipped.",
|
|
2573
|
+
"2. Fetches the PR, its diff, CI status, and the linked issue",
|
|
2574
|
+
"3. Builds a checklist from the issue's acceptance criteria",
|
|
2575
|
+
"4. Verifies the diff satisfies each criterion and that CI is green",
|
|
2576
|
+
"5. **Enables squash auto-merge** (with `--delete-branch`) when all",
|
|
2577
|
+
" checks pass \u2014 no explicit approval review",
|
|
2578
|
+
"6. **Comments with grouped findings** when any check fails (plain",
|
|
2579
|
+
" `gh pr comment`, not a formal `--request-changes` review)",
|
|
2580
|
+
"7. After a successful merge, verifies the linked issue is closed",
|
|
2581
|
+
" and closes it explicitly if the merge commit did not",
|
|
2582
|
+
"8. Cleans up the local branch after merge",
|
|
2583
|
+
"",
|
|
2584
|
+
"The reviewer **never** implements code and **never** pushes commits",
|
|
2585
|
+
"to a PR's branch \u2014 it only reviews, decides, and orchestrates merge",
|
|
2586
|
+
"or comment. In loop mode, a failed review for one PR never stops",
|
|
2587
|
+
"the loop; the reviewer comments and moves on. See the `pr-reviewer`",
|
|
2588
|
+
"agent definition for the full phase-by-phase contract."
|
|
2589
|
+
].join("\n"),
|
|
2590
|
+
platforms: {
|
|
2591
|
+
cursor: { exclude: true }
|
|
2592
|
+
},
|
|
2593
|
+
tags: ["workflow"]
|
|
2594
|
+
}
|
|
2595
|
+
],
|
|
2596
|
+
skills: [reviewPrSkill, reviewPrsSkill],
|
|
2597
|
+
subAgents: [prReviewerSubAgent]
|
|
2598
|
+
};
|
|
2599
|
+
|
|
2273
2600
|
// src/agent/bundles/projen.ts
|
|
2274
2601
|
var projenBundle = {
|
|
2275
2602
|
name: "projen",
|
|
@@ -3187,7 +3514,8 @@ var BUILT_IN_BUNDLES = [
|
|
|
3187
3514
|
githubWorkflowBundle,
|
|
3188
3515
|
slackBundle,
|
|
3189
3516
|
meetingAnalysisBundle,
|
|
3190
|
-
orchestratorBundle
|
|
3517
|
+
orchestratorBundle,
|
|
3518
|
+
prReviewBundle
|
|
3191
3519
|
];
|
|
3192
3520
|
|
|
3193
3521
|
// src/agent/bundles/scope.ts
|
|
@@ -6725,6 +7053,7 @@ export {
|
|
|
6725
7053
|
meetingAnalysisBundle,
|
|
6726
7054
|
orchestratorBundle,
|
|
6727
7055
|
pnpmBundle,
|
|
7056
|
+
prReviewBundle,
|
|
6728
7057
|
projenBundle,
|
|
6729
7058
|
resolveModelAlias,
|
|
6730
7059
|
resolveTemplateVariables,
|