@codedrifters/configulator 0.0.224 → 0.0.226

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.js CHANGED
@@ -4299,7 +4299,7 @@ var issueWorkerSubAgent = {
4299
4299
  name: "issue-worker",
4300
4300
  description: "Selects the next ready issue from the queue, claims it, and implements the change end-to-end following repository conventions",
4301
4301
  model: AGENT_MODEL.POWERFUL,
4302
- maxTurns: 50,
4302
+ maxTurns: 100,
4303
4303
  canDelegateToAgents: [],
4304
4304
  platforms: { cursor: { exclude: true } },
4305
4305
  prompt: [
@@ -5566,10 +5566,11 @@ var prReviewerSubAgent = {
5566
5566
  " PRs are also eligible for this invocation only. The flag does **not**",
5567
5567
  " persist across invocations.",
5568
5568
  "",
5569
- "Note: the behaviour wiring for `--allow-human-author` (the bot-only",
5570
- "guard that the flag opts out of) lands in a follow-up issue. This",
5571
- "agent currently acknowledges the flag so consumers can start passing",
5572
- "it through; full gating on author identity arrives later.",
5569
+ "Phase 4's invocation guard enforces the bot-only default and the",
5570
+ "`--allow-human-author` opt-out. PRs without the `origin:issue-worker`",
5571
+ "label are still classified, commented on, reacted to, and (in",
5572
+ "`auto-merge` mode) auto-merged when the AC/CI checks pass \u2014 only the",
5573
+ "delegation hand-off to `issue-worker` is gated.",
5573
5574
  "",
5574
5575
  "---",
5575
5576
  "",
@@ -5807,14 +5808,18 @@ var prReviewerSubAgent = {
5807
5808
  "Action on this pass:",
5808
5809
  "",
5809
5810
  "- React `eyes` on the comment to mark it seen.",
5810
- "- Queue the comment for later delegation. **Delegation wiring is out",
5811
- " of scope for this phase** \u2014 the fix-list comment and the",
5812
- " issue-worker hand-off land in a follow-up issue. For now, record",
5813
- " the queued items in memory so Phase 4.5 can list them as",
5814
- " outstanding.",
5811
+ "- Queue the comment for delegation in the Phase 4 delegation flow.",
5812
+ " When the invocation guard permits delegation, Phase 4 builds a",
5813
+ " fix-list comment from the queued items and hands the work off to",
5814
+ " `issue-worker` in feedback mode. When delegation is denied",
5815
+ " (human-authored PR with no `--allow-human-author` opt-in), the",
5816
+ " queued items remain `eyes`-only and Phase 4.5 lists them as",
5817
+ " outstanding for the human to resolve.",
5815
5818
  "- Do **not** apply `+1` or `rocket` yet. Those are terminal",
5816
5819
  " reactions reserved for later passes once the fix has been accepted",
5817
- " into the PR (`+1`) and actually landed on the branch (`rocket`).",
5820
+ " into the PR (`+1`) and actually landed on the branch (`rocket` \u2014",
5821
+ " applied by Phase 4 step (f) once the worker reports the item",
5822
+ " handled).",
5818
5823
  "",
5819
5824
  "```bash",
5820
5825
  "# React eyes on a PR-level issue comment",
@@ -5931,6 +5936,28 @@ var prReviewerSubAgent = {
5931
5936
  "",
5932
5937
  "## Phase 4: Decide and Act",
5933
5938
  "",
5939
+ "### Invocation guard (runs before any delegation in this phase)",
5940
+ "",
5941
+ "Before delegating any in-scope fix to `issue-worker`, verify the",
5942
+ "delegation is permitted by author identity:",
5943
+ "",
5944
+ "- If the PR carries the `origin:issue-worker` label, delegation is",
5945
+ " permitted.",
5946
+ "- If the invocation prompt contains the literal flag",
5947
+ " `--allow-human-author`, delegation is permitted for this invocation",
5948
+ " only.",
5949
+ "- Otherwise (human-authored PR with no opt-in flag) the reviewer",
5950
+ " **must not delegate**. It still classifies comments (Phase 3.5),",
5951
+ " posts replies, applies reactions, updates the sticky summary, and",
5952
+ " (when in `auto-merge` mode and the AC/CI checks pass) enables",
5953
+ " auto-merge. Fix-list production and the issue-worker invocation are",
5954
+ " left to the human PR author. Record the reason in the Phase 4.5",
5955
+ " sticky summary as `delegation skipped: human-authored PR`.",
5956
+ "",
5957
+ "Skip the entire delegation flow below when the invocation guard",
5958
+ "denies delegation. The pushback gate, the AC/CI evaluation, and the",
5959
+ "Phase 4.5 sticky update still run.",
5960
+ "",
5934
5961
  "### Pushback gate (runs before every merge decision)",
5935
5962
  "",
5936
5963
  "Before taking any merge-enabling action in this phase, verify that no",
@@ -5958,6 +5985,212 @@ var prReviewerSubAgent = {
5958
5985
  "If no unresolved `thinking_face` reactions exist, proceed with the",
5959
5986
  "branches below based on the review mode decided in Phase 2.75.",
5960
5987
  "",
5988
+ "### Delegation flow (in-scope fixes)",
5989
+ "",
5990
+ "When the invocation guard above permits delegation **and** Phase 3.5",
5991
+ "queued one or more `in-scope` items, the reviewer hands the fix work",
5992
+ "off to `issue-worker` in feedback mode. The reviewer never edits the",
5993
+ "PR's branch itself.",
5994
+ "",
5995
+ "Run the steps below in order. Steps (a) through (g) apply in **both**",
5996
+ "`auto-merge` and `human-required` review modes. Step (h) is",
5997
+ "auto-merge-only \u2014 in `human-required` mode the reviewer skips it,",
5998
+ "leaves `review:awaiting-human` applied, and lets the human own the",
5999
+ "final merge.",
6000
+ "",
6001
+ "#### a. Handle AC drift first",
6002
+ "",
6003
+ "For every queued `in-scope` item, re-check whether the comment is",
6004
+ "actually a request to **change the linked issue's acceptance",
6005
+ "criteria** rather than to change code that already meets the AC. If",
6006
+ "it is AC drift, do **not** delegate the item:",
6007
+ "",
6008
+ "1. Reply on the PR thread the comment came from with the exact text:",
6009
+ " `This belongs in #<issue> \u2014 please update the issue's acceptance criteria first.`",
6010
+ "2. Post a second comment on the **linked issue** with a concrete",
6011
+ " suggested edit to its Acceptance Criteria section that captures",
6012
+ " what the PR comment is asking for.",
6013
+ "3. React `thinking_face` (`content=confused`) on the original PR",
6014
+ " comment. AC-drift items count as pushbacks and the standing",
6015
+ " pushback gate above will block any later auto-merge re-enable.",
6016
+ "4. Drop the item from the delegation fix-list \u2014 only non-AC-drift",
6017
+ " in-scope items proceed to step (b) onwards.",
6018
+ "",
6019
+ "```bash",
6020
+ "# Reply on the PR thread",
6021
+ `gh pr comment <pr-number> --body "This belongs in #<issue> \u2014 please update the issue's acceptance criteria first."`,
6022
+ "",
6023
+ "# Suggest the AC edit on the linked issue",
6024
+ "gh issue comment <issue-number> --body '<concrete suggested AC edit>'",
6025
+ "",
6026
+ "# React thinking_face on the PR comment (treats as pushback)",
6027
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
6028
+ " -X POST -f content=confused",
6029
+ "```",
6030
+ "",
6031
+ "If **every** queued in-scope item is AC drift, the delegation",
6032
+ "fix-list is empty \u2014 skip to Phase 4.5 to record the state and stop.",
6033
+ "Do not invoke issue-worker with an empty list.",
6034
+ "",
6035
+ "#### b. Disable auto-merge",
6036
+ "",
6037
+ "Before mutating the PR, disable any pending auto-merge so a fast CI",
6038
+ "pass cannot land the PR mid-delegation. The command is idempotent \u2014",
6039
+ "running it when auto-merge was never enabled is a safe no-op.",
6040
+ "",
6041
+ "```bash",
6042
+ "gh pr merge <pr-number> --disable-auto",
6043
+ "```",
6044
+ "",
6045
+ "#### c. Acquire the `review:fixing` lease",
6046
+ "",
6047
+ "Add the `review:fixing` label to the PR. The label is a mutual",
6048
+ "exclusion lease \u2014 only one delegation may be in flight against a",
6049
+ "given PR at a time:",
6050
+ "",
6051
+ "```bash",
6052
+ "gh pr edit <pr-number> --add-label 'review:fixing'",
6053
+ "```",
6054
+ "",
6055
+ "Before adding the label, list the PR's existing labels. If",
6056
+ "`review:fixing` is **already present**, another delegation is",
6057
+ "in-flight (or a previous delegation crashed without releasing the",
6058
+ "lease). Stop immediately, log the contention to the sticky summary,",
6059
+ "and exit. Do not invoke issue-worker, do not write a fix-list, and do",
6060
+ "not remove the existing label \u2014 a human must investigate and clear",
6061
+ "the lease manually.",
6062
+ "",
6063
+ "#### d. Write the fix-list comment",
6064
+ "",
6065
+ "Post a single PR-level comment whose body matches the format the",
6066
+ "issue-worker feedback mode parses. The comment must contain a human",
6067
+ "checkbox summary followed by a fenced ```json fix-list``` block. The",
6068
+ "JSON block is the **authoritative** list of work \u2014 the checkbox",
6069
+ "summary is for humans only.",
6070
+ "",
6071
+ "```markdown",
6072
+ "## Reviewer: fix list for @issue-worker",
6073
+ "",
6074
+ "- [ ] @<author> \u2014 <instruction summary> (<file>:<line>)",
6075
+ "",
6076
+ "```json fix-list",
6077
+ "{",
6078
+ ' "pr": <pr-number>,',
6079
+ ' "branch": "<head-ref-name>",',
6080
+ ' "generated_at": "<ISO-8601 timestamp>",',
6081
+ ' "items": [',
6082
+ ' {"comment_id": "<id>", "author": "<login>", "file": "<path>", "line": <n>, "instruction": "<imperative instruction>"}',
6083
+ " ]",
6084
+ "}",
6085
+ "```",
6086
+ "```",
6087
+ "",
6088
+ "Each `items[]` entry corresponds to one queued in-scope comment that",
6089
+ "survived AC-drift handling. Preserve `comment_id` exactly as returned",
6090
+ "by the GitHub API in Phase 2.5 \u2014 issue-worker reports back using the",
6091
+ "same id so the reviewer can react on the correct source comment in",
6092
+ "step (f).",
6093
+ "",
6094
+ "Post the comment via `gh pr comment <pr-number> --body-file <path>`",
6095
+ "(or `--body` if the body is short). Capture the resulting comment id",
6096
+ "in memory so Phase 4.5 can cite the fix-list URL in the sticky.",
6097
+ "",
6098
+ "#### e. Invoke `issue-worker` in feedback mode",
6099
+ "",
6100
+ "Hand the fix work off to the `issue-worker` sub-agent. The invocation",
6101
+ "prompt **must** contain the literal phrase `feedback mode: PR #<n>`",
6102
+ "(with the actual PR number substituted) so the worker enters its",
6103
+ "feedback-mode branch instead of selecting a new issue. The prompt",
6104
+ "must also include the repository (`{{repository.owner}}/{{repository.name}}`)",
6105
+ "and the PR number explicitly \u2014 do not rely on the worker inferring",
6106
+ "either from context.",
6107
+ "",
6108
+ "Wait for the worker to return its structured report. The report",
6109
+ "lists, per item, the `comment_id` and a status of `handled` or",
6110
+ "`failed` (with a short failure reason for the latter). If the worker",
6111
+ "errors out without returning a report, treat **every** item as failed",
6112
+ "and proceed to step (f) so source comments still get a reaction.",
6113
+ "",
6114
+ "#### f. Process the worker's report",
6115
+ "",
6116
+ "For every item the worker reports:",
6117
+ "",
6118
+ "- **`handled`** \u2014 react `rocket` on the original source comment to",
6119
+ " signal the accepted change has landed. Use the same comment",
6120
+ " endpoint the comment originated from (`issues/comments/...` for",
6121
+ " PR-level, `pulls/comments/...` for inline).",
6122
+ "- **`failed`** \u2014 react `thinking_face` (`content=confused`) on the",
6123
+ " original source comment **and** post a reply on the same thread",
6124
+ " explaining why the fix could not be applied (cite the failure",
6125
+ " reason returned by the worker).",
6126
+ "",
6127
+ "```bash",
6128
+ "# Rocket reaction on a successfully handled PR-level comment",
6129
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
6130
+ " -X POST -f content=rocket",
6131
+ "",
6132
+ "# thinking_face + reply on a failed item",
6133
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
6134
+ " -X POST -f content=confused",
6135
+ "gh pr comment <pr-number> --body '<failure explanation citing the worker report>'",
6136
+ "```",
6137
+ "",
6138
+ "#### g. Release the `review:fixing` lease",
6139
+ "",
6140
+ "Remove the lease label so the PR is open for the next delegation",
6141
+ "pass. Always run this step \u2014 even when the worker reported every",
6142
+ "item as failed:",
6143
+ "",
6144
+ "```bash",
6145
+ "gh pr edit <pr-number> --remove-label 'review:fixing'",
6146
+ "```",
6147
+ "",
6148
+ "#### h. Conditionally re-enable auto-merge (auto-merge mode only)",
6149
+ "",
6150
+ "Re-enable squash auto-merge **only if all four** of the following",
6151
+ "conditions hold. If any condition fails, leave auto-merge disabled",
6152
+ "and let the next reviewer pass re-evaluate:",
6153
+ "",
6154
+ "1. The review mode decided in Phase 2.75 is still `auto-merge`",
6155
+ " (re-evaluate against the current PR labels in case a maintainer",
6156
+ " added `review:human-required` between passes).",
6157
+ "2. **All** acceptance criteria are met against the **updated** diff",
6158
+ " produced by the worker \u2014 re-run the Phase 3 comparison; do not",
6159
+ " reuse the pre-delegation result.",
6160
+ "3. **No** unresolved `thinking_face` reactions authored by the",
6161
+ " reviewer remain on any PR comment \u2014 including the AC-drift",
6162
+ " pushbacks added in step (a) and the failure pushbacks added in",
6163
+ " step (f).",
6164
+ "4. CI is green or still pending (any failing required check",
6165
+ " disqualifies re-enablement).",
6166
+ "",
6167
+ "When all four hold, re-enable auto-merge with the same command used",
6168
+ "in the auto-merge branch below:",
6169
+ "",
6170
+ "```bash",
6171
+ "gh pr merge <pr-number> --auto --squash --delete-branch \\",
6172
+ " --subject '<conventional-commit-title>' \\",
6173
+ " --body '<extended-description>'",
6174
+ "```",
6175
+ "",
6176
+ "In `human-required` mode, **skip step (h) entirely**. The",
6177
+ "`review:awaiting-human` label stays applied (re-add it if a previous",
6178
+ "step removed it), and the human reviewer owns the final merge",
6179
+ "decision.",
6180
+ "",
6181
+ "#### i. Update the sticky summary",
6182
+ "",
6183
+ "After step (g) (and step (h) when applicable) completes, fall through",
6184
+ "to Phase 4.5 to update the sticky `## Reviewer notes` comment with",
6185
+ "the new state. Cite at minimum:",
6186
+ "",
6187
+ "- The fix-list comment URL produced in step (d).",
6188
+ "- The commit SHAs the worker pushed (from its structured report).",
6189
+ "- Per-item outcome (`handled` / `failed`) with the source comment URL.",
6190
+ "- The auto-merge re-enablement decision and reason (which of the",
6191
+ " four conditions, if any, blocked it).",
6192
+ "- The next-step the human or the next reviewer pass should take.",
6193
+ "",
5961
6194
  "### If all acceptance criteria are met and CI is green",
5962
6195
  "",
5963
6196
  "Branch on the **review mode** decided in Phase 2.75:",
@@ -6177,11 +6410,10 @@ var prReviewerSubAgent = {
6177
6410
  " to `human-required`, Phase 4 applies `review:awaiting-human` and",
6178
6411
  " exits. Even if every acceptance criterion is met and CI is green,",
6179
6412
  " `gh pr merge --auto` is forbidden in that mode.",
6180
- "6. **Do not implement code.** You review, decide, and orchestrate. If",
6181
- " the PR needs changes, comment and stop.",
6182
- "7. **Never push commits to the PR's branch.** If the PR needs changes,",
6183
- " comment and stop \u2014 do not attempt to fix it yourself. The PR author",
6184
- " owns the branch; pushing to someone else's branch is out of scope.",
6413
+ "6. **Never push commits to the PR's branch yourself.** The reviewer is a decision-maker and orchestrator, not an implementer. When in-scope review comments require code changes **and** the PR carries the `origin:issue-worker` label (or the invocation prompt explicitly allows human-authored PRs via `--allow-human-author`), delegate the fix by posting a fix-list comment on the PR and invoking `issue-worker` in feedback mode. You must never call `git commit`, `git push`, `git rebase`, or `gh pr edit` against the head branch from this agent \u2014 all branch mutations belong to `issue-worker`.",
6414
+ "7. **Do not implement code.** You review, decide, and orchestrate. If",
6415
+ " the PR needs code changes and delegation is not permitted by Rule",
6416
+ " #6, comment and stop \u2014 do not attempt to fix it yourself.",
6185
6417
  "8. **In loop mode (`/review-prs`), never stop early.** If any review",
6186
6418
  " fails, comment and move to the next PR. Only abort the loop on a",
6187
6419
  " fatal error (e.g. `gh` auth failure, network outage).",
@@ -6213,7 +6445,16 @@ var prReviewerSubAgent = {
6213
6445
  " resolved the dispute \u2014 by withdrawing the comment, by replying",
6214
6446
  " in a way that satisfies the reviewer (who then replaces the",
6215
6447
  " `thinking_face` with `+1`), or by applying the `review:auto-ok`",
6216
- " label as an explicit override."
6448
+ " label as an explicit override.",
6449
+ "14. **Never re-enable auto-merge while disputes or human-required",
6450
+ " hand-offs are still in flight.** After delegating fixes via the",
6451
+ " Phase 4 flow, the reviewer may only run `gh pr merge --auto`",
6452
+ " again when **no** unresolved `thinking_face` reactions authored",
6453
+ " by the reviewer remain on any PR comment **and** the",
6454
+ " `review:awaiting-human` label is **not** present on the PR. Any",
6455
+ " AC-drift pushback, any failed-fix pushback, and any human-required",
6456
+ " hand-off all keep auto-merge disabled until the human resolves",
6457
+ " the underlying state."
6217
6458
  ].join("\n")
6218
6459
  };
6219
6460
  var reviewPrSkill = {