@soleur/opencode 3.388.4 → 3.389.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.388.4",
3
+ "version": "3.389.0",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,7 @@ Use `merge-pr` for a single named PR. Use `drain-labeled-backlog` for labeled *i
39
39
 
40
40
  Optional flags (any subset):
41
41
 
42
- - `--tiers <list>` — comma-separated tiers to drain (e.g., `ready-green,needs-lockfile-fix`). Default: prompt for tier scope at the decision gate. Tiers: `ready-green`, `needs-lockfile-fix`, `needs-conflict-resolution`, `needs-review`, `broken`, plus `ready-unarmed` (recover-only, never armed). Drafts are always excluded.
42
+ - `--tiers <list>` — comma-separated tiers to drain (e.g., `ready-green,needs-lockfile-fix`). Default: prompt for tier scope at the decision gate. Tiers: `ready-green`, `needs-lockfile-fix`, `needs-conflict-resolution`, `needs-review`, `broken`, plus `ready-unarmed` (recover-only, never armed). `parked` PRs are always excluded; drafts are excluded unless the operator names one (see Rules).
43
43
  - `--pr <N,…>` — restrict the whole run to an explicit set of PR numbers (still triaged + still gated).
44
44
  - `--dry-run` — print the full tier table and exit with zero merges and zero delegation. More valuable here than in the sibling because this skill *merges*.
45
45
 
@@ -57,7 +57,7 @@ Delegate to the helper [triage-prs.sh](./scripts/triage-prs.sh):
57
57
  bash "${CLAUDE_PLUGIN_ROOT}/skills/drain-prs/scripts/triage-prs.sh"
58
58
  ```
59
59
 
60
- The helper runs `gh pr list --state open --json number,title,headRefName,isDraft,mergeable,reviewDecision,labels,author,createdAt,statusCheckRollup` (two-stage `gh --json … | jq`, never `gh --jq` with `--arg` — learning `2026-04-15-gh-jq-does-not-forward-arg-to-jq`) and classifies each PR into **seven tiers**:
60
+ The helper runs `gh pr list --state open --json number,title,headRefName,isDraft,mergeable,reviewDecision,labels,author,createdAt,statusCheckRollup` (two-stage `gh --json … | jq`, never `gh --jq` with `--arg` — learning `2026-04-15-gh-jq-does-not-forward-arg-to-jq`) and classifies each PR into **eight tiers**:
61
61
 
62
62
  | Tier | Signal | Default handling |
63
63
  |------|--------|------------------|
@@ -66,7 +66,8 @@ The helper runs `gh pr list --state open --json number,title,headRefName,isDraft
66
66
  | `needs-conflict-resolution` | `mergeable=CONFLICTING`, few/no other failures | fix-recipe (b) → merge |
67
67
  | `needs-review` | `bot-fix/review-required` label, or a feature PR with no review | review (delegate or inline) → merge |
68
68
  | `ready-unarmed` | ready PR whose head verdict (`ci-head-verdict.sh`) is `no-run` or `stalled`: no full CI run exists, the red `test` row is the draft run's. `awaiting-approval` is not here: it lands in `needs-review` (the line shows `ci=awaiting-approval`; a maintainer must approve the fork run) | **recover, never arm**, unless another session is still inside `wait-ready-run` for it: `gh pr ready --undo <N>`, then the whole ready block ([ready-run-wait.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ready-run-wait.md)), then re-triage |
69
- | `drafts` | `isDraft=true` | **skip** — author-owned WIP, never merged |
69
+ | `drafts` | `isDraft=true` | **skip** — author-owned WIP, never merged. A draft that also carries `parked` stays here, flagged `parked: true` in the JSON and `PARKED label (held for the operator)` on its text line, and is never readied even when the operator names it |
70
+ | `parked` | has the `parked` label ("Reviewed draft held until an approved window; do not merge or arm auto-merge") | **skip** — reviewed and held for the operator; never merged, never armed, never fixed here. The operator removes the label. A parked **draft** is classified under `drafts` (drafts are classified first). `.claude/hooks/ship-operator-step-gate.sh` is a best-effort guardrail on a branch that carries it, not an access control: a draft PR is the real hold. The tier prints a `recovery:` line saying to do nothing (no other tier carries one except `ready-unarmed`). The label match is case-insensitive, like the hook's |
70
71
  | `broken` | `CONFLICTING` **and** many failing checks | surface; fix only if in explicit scope |
71
72
 
72
73
  Pass `--dry-run` to stop here and print the table.
@@ -125,7 +126,8 @@ If `$ARGUMENTS` contains a `RETURN CONTRACT` section (i.e., this skill is being
125
126
 
126
127
  ## Sharp edges
127
128
 
128
- - **Drafts are skipped unless the operator names one.** A draft PR is author-owned WIP; merging it would ship incomplete work. The only exception is a draft the operator explicitly authorizes in the request (readied and armed through the block above); no flag selects drafts.
129
+ - **A `parked` PR is never readied, armed or merged, even when the operator names it.** The operator removes the label first, in the GitHub UI or their own terminal.
130
+ - **Drafts are skipped unless the operator names one.** A draft PR is author-owned WIP; merging it would ship incomplete work. The only exception is a draft the operator explicitly authorizes in the request (readied and armed through the block above); no flag selects drafts. A draft that carries the `parked` label is the one exception to the exception: it is never readied, even when named (the `parked` rule below).
129
131
  - **`gh pr merge --squash --auto` cannot bypass server-side required checks.** Branch protection enforces `CI Required` and the merge queue re-runs the checks on its own candidate, so a mis-triaged red PR never lands — but under the queue it does not fail at merge time: a red candidate is a SILENT dequeue (the PR stays OPEN, auto-merge disarmed). See it with the dequeue arm in step 4 (`gh run list --event merge_group`, or `gh pr view <N> --json state,autoMergeRequest`); the triage is an optimization, not the safety boundary.
130
132
  - **An operator-authorized admin merge removes the server-side check the bullet above relies on.** It goes through [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) step 2 (`"${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh"`, which must exit 0) and that file's merge block, never through a `gh pr checks --required` watch (#8458, #8500). For a PR that is BEHIND with the new head's checks unsettled, "CI was green" is encoded as `--green-sha <prior-green-sha>`: it certifies the current head only when that head is GitHub's own verified merge of the green sha and the base — see the reference's "was-green carryover" section.
131
133
  - **The two `2026-06-30-*` learnings and ADR-033 §Registration checklist** referenced in the fix-recipes landed in PR #5808 — they are on `main`. If a future reorg moves them, update the paths here.
@@ -140,4 +142,4 @@ Unit tests live at [drain-prs.test.sh](../../test/drain-prs.test.sh). Run them w
140
142
  bash plugins/soleur/test/drain-prs.test.sh
141
143
  ```
142
144
 
143
- Covers: one synthetic PR per tier (ready-green, lockfile-fail, conflicting, review-required, draft, broken), the head-verdict rows (`ready-unarmed`, pending-full / decided / awaiting-approval, resolver error), an empty-list case, and the tier-grouped JSON output shape.
145
+ Covers: one synthetic PR per tier (ready-green, lockfile-fail, conflicting, review-required, draft, broken, parked, including a parked conflicting PR with failing checks, a parked `dependencies` PR with a failing check, a parked PR whose head verdict is `no-run`, a `Parked` capitalised label, a parked draft carrying `parked: true`, and a `parked-old` decoy label), the head-verdict rows (`ready-unarmed`, pending-full / decided / awaiting-approval, resolver error), an empty-list case, and the tier-grouped JSON output shape.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
- # Enumerates open remote GitHub PRs and classifies each into one of seven drain
2
+ # Enumerates open remote GitHub PRs and classifies each into one of eight drain
3
3
  # tiers (ready-green, ready-unarmed, needs-lockfile-fix, needs-conflict-resolution,
4
- # needs-review, drafts, broken), emitting a tier-grouped report.
4
+ # needs-review, parked, drafts, broken), emitting a tier-grouped report.
5
5
  #
6
6
  # Usage:
7
7
  # triage-prs.sh [--format text|json] [--fixture <path>]
@@ -12,6 +12,8 @@
12
12
  #
13
13
  # Classification is first-match-wins in this priority order:
14
14
  # 1. drafts isDraft == true (author-owned WIP)
15
+ # 1b. parked has the `parked` label (reviewed and held for the operator: never merged,
16
+ # never armed, never "fixed" by a drain; #12197). Only a draft is classified before it.
15
17
  # 2. broken CONFLICTING AND >=3 failing checks
16
18
  # 3. needs-conflict-resolution CONFLICTING
17
19
  # 4. needs-lockfile-fix has `dependencies` label AND >0 failing checks
@@ -139,7 +141,7 @@ CLASSIFIED="$(jq --argjson verdicts "$VERDICTS" '
139
141
  | select(. == "FAILURE" or . == "ERROR" or . == "CANCELLED" or . == "TIMED_OUT") ] | length;
140
142
  def pending($v): [ counted($v)[] | (.status // .state)
141
143
  | select(. == "IN_PROGRESS" or . == "QUEUED" or . == "PENDING" or . == "WAITING") ] | length;
142
- def haslabel($n): any(.labels[]?; .name == $n);
144
+ def haslabel($n): any(.labels[]?; ((.name // "") | ascii_downcase) == ($n | ascii_downcase));
143
145
  [ .[] | . as $pr | ($verdicts[(.number | tostring)] // "") as $v
144
146
  | ($pr | fails($v)) as $f | ($pr | pending($v)) as $p |
145
147
  {
@@ -150,8 +152,10 @@ CLASSIFIED="$(jq --argjson verdicts "$VERDICTS" '
150
152
  failing: $f,
151
153
  pending: $p,
152
154
  ci: $v,
155
+ parked: ($pr | haslabel("parked")),
153
156
  tier: (
154
157
  if .isDraft == true then "drafts"
158
+ elif ($pr | haslabel("parked")) then "parked"
155
159
  elif .mergeable == "CONFLICTING" and $f >= 3 then "broken"
156
160
  elif .mergeable == "CONFLICTING" then "needs-conflict-resolution"
157
161
  elif ($pr | haslabel("dependencies")) and $f > 0 then "needs-lockfile-fix"
@@ -162,12 +166,13 @@ CLASSIFIED="$(jq --argjson verdicts "$VERDICTS" '
162
166
  end
163
167
  )
164
168
  }
169
+ | if .tier == "parked" then . + { recovery: "held for the operator, do nothing here: the operator removes the parked label in the GitHub UI or their own terminal; a draft PR is the real hold (GitHub refuses to merge a draft)" } else . end
165
170
  | if .tier == "ready-unarmed" then . + { recovery: "if no session is still inside wait-ready-run for it: gh pr ready --undo \(.number) && gh pr ready \(.number) (user token, never GITHUB_TOKEN), then re-run the whole ship step 6 block (read ready-count first, arm only after wait-ready-run exits 0)" } else . end
166
171
  ]' <<<"$PR_JSON")"
167
172
 
168
173
  # --- Emit -------------------------------------------------------------------
169
174
  # Stable tier order for the grouped output.
170
- TIER_ORDER='["ready-green","ready-unarmed","needs-lockfile-fix","needs-conflict-resolution","needs-review","broken","drafts"]'
175
+ TIER_ORDER='["ready-green","ready-unarmed","needs-lockfile-fix","needs-conflict-resolution","needs-review","broken","parked","drafts"]'
171
176
 
172
177
  if [[ "$FORMAT" == "json" ]]; then
173
178
  jq -n --argjson prs "$CLASSIFIED" --argjson order "$TIER_ORDER" '
@@ -186,7 +191,7 @@ jq -r --argjson order "$TIER_ORDER" '
186
191
  | $order[] as $t
187
192
  | ([ $prs[] | select(.tier == $t) ]) as $g
188
193
  | "## \($t) (\($g | length))",
189
- ( $g[] | " #\(.number) \(.title) [@\(.author), mergeable=\(.mergeable), fail=\(.failing), pending=\(.pending)\(if .ci != "" then ", ci=\(.ci)" else "" end)]",
194
+ ( $g[] | " #\(.number) \(.title) [@\(.author), mergeable=\(.mergeable), fail=\(.failing), pending=\(.pending)\(if .ci != "" then ", ci=\(.ci)" else "" end)\(if .parked and .tier != "parked" then ", PARKED label (held for the operator)" else "" end)]",
190
195
  (if .recovery then " recovery: \(.recovery)" else empty end) ),
191
196
  ""
192
197
  ' <<<"$CLASSIFIED"
@@ -102,6 +102,7 @@ What each reason means (the evaluator prints these words, and only these):
102
102
  | `this wait does not name the legal text it is about; ask the plan's author to put the text name <key> in the hold's words` | the `Hold:` line does not contain the gate's key as a whole word | 2 |
103
103
  | `The file holds a control character I cannot read safely…` (no per-hold line) | a NUL or other control byte in the plan or envelope file | 2 |
104
104
  | `a recorded decision on a legal text cannot back a production step` | a `web-acceptance` gate in an envelope (`--file` mode) | 2 |
105
+ | `this key is an acknowledgement; its decision cannot back a production step` | the gate's key is a registry text whose declared kind is not `terms` (listed in `WA_NON_TERMS_KEYS` in the evaluator; a test cross-checks the list with the registry pins): a Yes on it records only that the founder was shown the text | 2 |
105
106
 
106
107
  **What ship does with each.** Exit 0 for a web-acceptance hold: record the `Done:` line (it carries the decision date) in the PR
107
108
  body. Exit 1 with `no decision recorded`: print the full card link `https://app.soleur.ai/dashboard/approvals/legal/<key>` (not a
@@ -112,7 +113,7 @@ that the operator, not an agent session, reads the note by the path on the line.
112
113
  check was written`: the plan's gate must be rewritten for the committed text (compute the new hash with the one-liner above),
113
114
  by the plan's author. Exit 2: the hold stands, named in one plain sentence from the table, and never retried into a pass.
114
115
 
115
- **What a web-acceptance gate is for, and not for.** It discharges a hold like any other gate: the hold stands until the
116
+ **What a web-acceptance gate is for, and not for.** A `web-acceptance` gate is valid only for a registry key whose kind is `terms`: a Yes on an acknowledgement text records only that the founder was shown it and agrees to nothing, so the evaluator refuses such a key (`Could not check`, exit 2). It discharges a hold like any other gate: the hold stands until the
116
117
  founder's recorded decision on exactly that text is `accepted`, and then the hold is cleared. It grants no authority of its own:
117
118
  a recorded Yes is not a merge approval, a deploy approval or a spend approval, and it does not stand in for an
118
119
  `Operator-reserved:` hold (those always stand). The canonical use is a hold of the form "do not ship until the founder has
@@ -136,6 +136,10 @@ known_kind() { case "$1" in pr-merged|no-inflight-run|web-acceptance) return 0 ;
136
136
  # these two lines and compares them with those sources: change all of them together or none.
137
137
  WA_KEY_RE='^[a-z0-9][a-z0-9-]{0,62}$'
138
138
  WA_HASH_RE='^[0-9a-f]{64}$'
139
+ # Registry keys whose declared kind is NOT "terms" (an acknowledgement text): the founder's Yes on one of them records that they were
140
+ # shown the text and agrees to nothing, so it cannot back a production step. A test cross-checks this list with the registry pins in
141
+ # apps/web-platform/test/legal-acceptance/registry-pins.test.ts (every non-terms key listed, no terms key listed). Space-separated.
142
+ WA_NON_TERMS_KEYS='founder-acceptance-record'
139
143
  WA_TEXTS='apps/web-platform/server/legal-acceptance/texts'
140
144
  WA_BASE='https://app.soleur.ai/api/internal/legal-acceptance' # mut:base-url
141
145
  WA_TOKEN_NAME='LEGAL_ACCEPTANCE_VERIFY_TOKEN'
@@ -208,6 +212,7 @@ gate_web_acceptance() {
208
212
  if [[ "$rest" != *" "* ]] || ! [[ "$key" =~ $WA_KEY_RE ]] || ! [[ "$hash" =~ $WA_HASH_RE ]]; then GRES=UNEVAL; GWHY="the web acceptance is not written as a plain text name and fingerprint"; return; fi # mut:wa-shape
209
213
  # CTO ruling D1: the hold's own words (cleaned of control and bidi characters, but NOT cut at the 160-character display limit, so a key beyond that limit still binds; accepted residual of the lexical rule) must name this text's key as a whole
210
214
  # token, so a decision about one text cannot clear a wait about another thing. A letter, digit, hyphen or underscore beside the key makes it part of a longer word.
215
+ case " $WA_NON_TERMS_KEYS " in *" $key "*) GRES=UNEVAL; GWHY="this key is an acknowledgement; its decision cannot back a production step"; return ;; esac # mut:wa-kind
211
216
  grep -Eq "(^|[^a-z0-9_-])${key}([^a-z0-9_-]|\$)" < <(clean_uncut "$WA_HOLD_TEXT" | tr 'A-Z' 'a-z') || { GRES=UNEVAL; GWHY="this wait does not name the legal text it is about; ask the plan's author to put the text name $key in the hold's words"; return; } # mut:wa-bind
212
217
  WA_HASH="$hash"
213
218
  path="$WA_TEXTS/$key.md"