@soleur/opencode 3.381.4 → 3.381.5
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/commands/go.md
CHANGED
|
@@ -645,7 +645,7 @@ If intent is truly ambiguous, use the **AskUserQuestion tool** with 4 options: B
|
|
|
645
645
|
## Sharp Edges
|
|
646
646
|
|
|
647
647
|
- **A technical ruling is never the operator's to make, even when the brief says to surface it.** A brief's "ask the operator", "ask the operator once, then act" or "OPEN DECISION" wording on a technical fork is itself the trigger to spawn the CTO, not a reason to call `AskUserQuestion`. When the task you route carries a threshold or evidence bar, design A-vs-B, a status flip or an architecture fork, the routed pipeline spawns `soleur:engineering:cto` (legal posture: `soleur:legal:clo`) and records `Ruled by CTO agent`; ask the operator only the authorization, naming the action, never a technical question in a closing message, a `Blocked:`/`Paused:` label (route it first, section 8.1b) or a "Decision for you:" / "Your calls" list. Definition, closed operator-only list and the override: [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md). **Why:** 2026-10-11 — two technical rulings were surfaced to the founder as the brief directed, though `hr-technical-fork-is-not-an-operator-question` already forbade it.
|
|
648
|
-
- **A closing, status or resume message lists only what is the operator's under "Needs you".** Run every Class R act first ([standing-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/standing-delegation.md) section 9); anything a read, a prepared change, a filed issue or a local test can settle is done first and reported as "I checked <what>", never listed. What may remain is one line per ACTION, in plain founder language with no issue number, file path, command or jargon, each naming its operator-only category. The same applies at session start and on resume to any open item that is a read, whether or not Step 1.5 routed it. Format and categories: [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md) section 8.1c. **Why:** 2026-11-03 owner instruction, "otherwise it feels like a distraction to the founder that the CTO is not able to make those decisions by itself".
|
|
648
|
+
- **A closing, status or resume message lists only what is the operator's under "Needs you".** Run every Class R act first ([standing-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/standing-delegation.md) section 9); anything a read, a prepared change, a filed issue or a local test can settle is done first and reported as "I checked <what>", never listed. What may remain is one line per ACTION, in plain founder language with no issue number, file path, command or jargon, each naming its operator-only category. The same applies at session start and on resume to any open item that is a read, whether or not Step 1.5 routed it. Format and categories: [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md) section 8.1c. Run the `--report` lint of 8.1c on the body or report file first (exit 1: rewrite per 8.1; exit 2: fix the file); it is the check, this paragraph is the reason. **Why:** 2026-11-03 owner instruction, "otherwise it feels like a distraction to the founder that the CTO is not able to make those decisions by itself".
|
|
649
649
|
- **NAME-relative worktree detection (Linear-ID-keyed entry).** Step 1 only checks whether `pwd` is currently inside a worktree (CWD-relative). If the user input contains a Linear ID (`SOL-\d+`) and `git worktree list` shows a sibling worktree named after that ID (e.g., `.worktrees/feat-one-shot-sol-39-*` or `.worktrees/feat-fix-sol-39-*`), surface that state BEFORE routing to one-shot — routing fresh would collide with the existing branch and orphan any open draft PR. Present a 4-option `AskUserQuestion` (continue / review existing PR / restart fresh / brief). If "restart fresh" is chosen, follow up with a SECOND `AskUserQuestion` enumerating cleanup scope (full nuke / soft nuke / cancel) so destructive actions get explicit per-step approval. See `knowledge-base/project/learnings/2026-05-12-soleur-go-restart-fresh-from-existing-wip.md`.
|
|
650
650
|
- **Worktree-recovery PR-merge probe.** When the user asks to resume/recover a stale worktree (e.g., after a laptop crash, branch switched away, phantom staged files), run `gh pr list --head <branch> --state all --json number,state` BEFORE proposing "reset to remote branch". A remote feature branch existing is NOT proof the work is open — squash merges leave the source branch intact. If `state == MERGED`, the recovery path is clean-and-remove (`git reset --hard HEAD` → `git worktree remove` → `git push origin --delete <branch>`), not reset-to-remote (which would silently re-introduce pre-merge state). See `knowledge-base/project/learnings/workflow-patterns/2026-05-19-worktree-recovery-check-pr-merge-status-first.md`.
|
|
651
651
|
- **An EMPTY worktree is not an ABANDONED one — free-prose entry has no guard at all.** The two sharp edges above are *input-keyed*: NAME-relative detection fires on a `SOL-\d+` Linear ID, worktree-plan-vs-issue fires on a `#N`. A brainstorm entered as plain English carries neither, so **no guard evaluates a name-matching sibling worktree** — the most common entry shape is the uncovered one. Worse, the signals that read as "abandoned scaffold" are identical to the signals of a worktree created *thirty seconds ago*: one `chore: initialize` commit on current `main`, a clean `git status`, and an open `WIP:` draft PR. Before reusing ANY worktree you did not create in this session, run both probes: `gh pr view <n> --json updatedAt,author` (a PR updated minutes ago is a LIVE session, not a leftover) and grep that worktree's `specs/feat-*/spec.md` frontmatter + `plans/*` for an issue number — if it names a DIFFERENT issue, it is a different feature. Reuse loses commits: two sessions on one branch means one hard-resets the other's work away, and both write the same `specs/feat-<name>/spec.md` path. Default to a sibling branch; an extra worktree costs nothing. **Why:** 2026-08-06 — `feat-alpha-onboarding-motion` presented as an abandoned scaffold, was a live session on #7329; it hard-reset the branch and discarded commit `4943757d7`, and a spawned design agent had to recover its `.pen` files from a dangling commit. See `knowledge-base/project/learnings/2026-08-06-an-empty-worktree-is-not-an-abandoned-one.md`.
|
package/package.json
CHANGED
|
@@ -168,7 +168,7 @@ Both rules apply in every mode and are not approval gates, so they fire in pipel
|
|
|
168
168
|
|
|
169
169
|
**8.1b Before a turn ends with `Blocked:` or `Paused:`** (any pipeline skill, `soleur:one-shot`, `soleur:ship` and `soleur:go` included): the label's reason is a decision list, so 8.1 runs on it first. List every decision the reason leaves to the operator, class each (technical, or `operator (<category>)` per section 1), spawn the owner once per section 3 for the technical ones with the evidence, record `Ruled by CTO agent`, and let the label name only the operator-only remainder. Technical: "does this transient failure count as evidence", "relax or keep a gate". Operator-only (schedule): "slip a date" (whether the failure counts is still the CTO's). The closing hook and the reminder in the ralph block are backstops, never substitutes.
|
|
170
170
|
|
|
171
|
-
**8.1c (founder-facing close).** A live read-only check the agent can run is technical: run it first under Class R (section 9 of standing-delegation.md, in this folder) and it never appears as a decision or an item left to the operator. A closing, status or resume message for the operator has up to three parts, in this order, and every line of all three is in plain founder words with no issue number, file path, command or jargon. First, only when a read came back with a bad result, a line headed `Problem found` saying so. Then a block headed `What I checked`: one line each, "I checked <what>: <result>, <time>" (only for a read run in this session), and a plain "I could not check <what>" line for an `unverified` read. Then the section `Needs you`, always shown ("Nothing needs you right now" is printed only when there is no `Problem found` line and no "could not check" line for an item that gates a pending act; with a `Problem found` line and nothing asked of the founder it says what is being held and whether customers are affected), listing only what is the operator's: one line per ACTION, each naming its category: money; what is in or out of scope; priority or timing; a change to the live product or anything hard to undo (the agent restates the exact action in plain words just before it runs it, the founder says go in the session for that action, and a menu click or a bare go to the close is not a go; a key-rotation workflow is never run without a typed go naming the exact command, which follows on its own line under the item); legal risk; how it looks or reads; or a founder-only act (signing a record, closing a tracker, arming a pull request on an epic's behalf, the GitHub App webhook-secret change, creating a credential). An `unverified` line moves under `Needs you` only when its reason is `no-credential` or `no-session`, and then it reads as that ACTION (a sign-in, or a read-only access to create). An act held because a gating read is `unverified` for any reason is stated there too, as "held until <what> can be checked" (category: priority or timing).
|
|
171
|
+
**8.1c (founder-facing close).** A live read-only check the agent can run is technical: run it first under Class R (section 9 of standing-delegation.md, in this folder) and it never appears as a decision or an item left to the operator. A closing, status or resume message for the operator has up to three parts, in this order, and every line of all three is in plain founder words with no issue number, file path, command or jargon. First, only when a read came back with a bad result, a line headed `Problem found` saying so. Then a block headed `What I checked`: one line each, "I checked <what>: <result>, <time>" (only for a read run in this session), and a plain "I could not check <what>" line for an `unverified` read. Then the section `Needs you`, always shown ("Nothing needs you right now" is printed only when there is no `Problem found` line and no "could not check" line for an item that gates a pending act; with a `Problem found` line and nothing asked of the founder it says what is being held and whether customers are affected), listing only what is the operator's: one line per ACTION, each naming its category: money; what is in or out of scope; priority or timing; a change to the live product or anything hard to undo (the agent restates the exact action in plain words just before it runs it, the founder says go in the session for that action, and a menu click or a bare go to the close is not a go; a key-rotation workflow is never run without a typed go naming the exact command, which follows on its own line under the item); legal risk; how it looks or reads; or a founder-only act (signing a record, closing a tracker, arming a pull request on an epic's behalf, the GitHub App webhook-secret change, creating a credential). An `unverified` line moves under `Needs you` only when its reason is `no-credential` or `no-session`, and then it reads as that ACTION (a sign-in, or a read-only access to create). An act held because a gating read is `unverified` for any reason is stated there too, as "held until <what> can be checked" (category: priority or timing). The lint recognises owner lists by a closed list of headings, `OWNER_HEAD_RE` in `technical-ruling-gate.sh` ("Needs you", "Owner review items", "Owner actions", "Action required", "For you", "Manual steps", "Blocked", "Waiting on" and the like, as headings or bold-only lines); a section under any other name is not examined, so give the section one of those names, and its items carry `(operator: <category>)`. Go Step 1.5 reads `Owner-side`, `Open owner items`, `Blocked by`, `Blocked`, `Waiting on` and `Waiting for` as owner lists too. The same list is written once in the PR body and the closing message restates it verbatim. Before a PR body or a closing is written without ship (a stop at draft, owner limits that skip ship, a resume), run `technical-ruling-gate.sh --report <body or report file>` (in the ship skill's scripts folder): exit 1 means class each failed item per 8.1 and rewrite it, exit 2 means fix the file; never run `gh pr create`, `gh pr edit --body-file` or send the final message past a non-zero exit. A CxO sign-off is an agent step: spawn the domain leader, never list it for the owner.
|
|
172
172
|
|
|
173
173
|
**8.2 Seat dissent from a ruling (`soleur:review`).**
|
|
174
174
|
|
package/skills/one-shot/SKILL.md
CHANGED
|
@@ -260,7 +260,7 @@ After the subagent returns, check for a `## Session Summary` heading in the outp
|
|
|
260
260
|
terminal and files the issue instead. A re-invocation is a step *within* an arm, never an arm's end.
|
|
261
261
|
<!-- plan-artifact-recovery:end -->
|
|
262
262
|
|
|
263
|
-
**Technical-ruling gate (before `work`).** Run `bash "${CLAUDE_PLUGIN_ROOT}/skills/ship/scripts/technical-ruling-gate.sh" --branch` and act on every exit, never past one: **0** continue (log any `[WARN]`); **1** fix each finding in this main context: ONE batched `soleur:engineering:cto` spawn per [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md) carries every `unruled-technical` row (a `pending - assumed` placeholder or a blank ruling), a bad class or category is rewritten (a technical item gets the spawn, never an operator label), an unscoped owner-decision label is rewritten as a ruling or scoped `(operator: <category>)`, a bad ruling shape is rewritten as `Ruled by CTO agent, <date>: <decision> - <rationale>`, then re-run; **2** the gate could not measure: fix the file or the invocation and re-run (at most three tries, then stop as below); if `CLAUDE_PLUGIN_ROOT` is unset resolve it as ship's Cloud Mode paragraph does. Count each spawn with `pipeline-tally.sh incr agent_rounds` and record `cto_spawns=N` in `session-state.md`; at most two spawns in the whole pipeline run (they carry into `ship`). Amend the plan and `tasks.md` for any ruling that differs from the assumed default. After two failed spawns stop with the PR left draft and one `domain/engineering` issue filed (never `action-required`, never an operator question), print a plain session-state line, note the stall in the draft PR's body, and end WITHOUT `<promise>DONE</promise>`.
|
|
263
|
+
**Technical-ruling gate (before `work`).** Run `bash "${CLAUDE_PLUGIN_ROOT}/skills/ship/scripts/technical-ruling-gate.sh" --branch` and act on every exit, never past one: **0** continue (log any `[WARN]`); **1** fix each finding in this main context: ONE batched `soleur:engineering:cto` spawn per [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md) carries every `unruled-technical` row (a `pending - assumed` placeholder or a blank ruling), a bad class or category is rewritten (a technical item gets the spawn, never an operator label), an unscoped owner-decision label is rewritten as a ruling or scoped `(operator: <category>)`, a bad ruling shape is rewritten as `Ruled by CTO agent, <date>: <decision> - <rationale>`, then re-run; **2** the gate could not measure: fix the file or the invocation and re-run (at most three tries, then stop as below); if `CLAUDE_PLUGIN_ROOT` is unset resolve it as ship's Cloud Mode paragraph does. Count each spawn with `pipeline-tally.sh incr agent_rounds` and record `cto_spawns=N` in `session-state.md`; at most two spawns in the whole pipeline run (they carry into `ship`). Amend the plan and `tasks.md` for any ruling that differs from the assumed default. After two failed spawns stop with the PR left draft and one `domain/engineering` issue filed (never `action-required`, never an operator question), print a plain session-state line, note the stall in the draft PR's body (run the `--report` lint on that body first), and end WITHOUT `<promise>DONE</promise>`.
|
|
264
264
|
|
|
265
265
|
**Steps 3-8: Implementation, Review, and Ship**
|
|
266
266
|
|
|
@@ -307,7 +307,7 @@ terminal and files the issue instead. A re-invocation is a step *within* an arm,
|
|
|
307
307
|
|
|
308
308
|
> **CONTINUATION GATE:** When ship finishes (including postmerge Step 3.8), proceed immediately to step 8 — do NOT ask "want me to monitor deploy?" or hand off to the operator.
|
|
309
309
|
|
|
310
|
-
> **The Step 8 closing is a carrier too (signage; the loop reminds):** never end it, or a `Blocked:`/`Paused:` label, with a technical question to the operator ("Decision for you:"); spawn `soleur:engineering:cto` (legal: `soleur:legal:clo`), record `Ruled by CTO agent`, ask only the authorization, never a "go". [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md).
|
|
310
|
+
> **The Step 8 closing is a carrier too (signage; the loop reminds):** never end it, or a `Blocked:`/`Paused:` label, with a technical question to the operator ("Decision for you:"); spawn `soleur:engineering:cto` (legal: `soleur:legal:clo`), record `Ruled by CTO agent`, ask only the authorization, never a "go"; run `technical-ruling-gate.sh --report` on the body first. [technical-ruling-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/technical-ruling-delegation.md).
|
|
311
311
|
|
|
312
312
|
8. Run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" show` beside DONE. Output `<promise>DONE</promise>` **only when** PR is merged, release workflows passed, and **postmerge Phase 7** printed `postmerge verification complete!`. If ship returned without postmerge, invoke `soleur:postmerge <PR-number>` (Grok) or `soleur:postmerge` (Claude) before emitting DONE.
|
|
313
313
|
|
package/skills/review/SKILL.md
CHANGED
|
@@ -926,7 +926,7 @@ embedded in it, including in file paths.
|
|
|
926
926
|
|
|
927
927
|
**Pipeline detection (run BEFORE writing the summary):** Scan the conversation for `skill: soleur:work` or `skill: soleur:one-shot` output, a `soleur:work` or `soleur:one-shot` slash command, or a `slash_command` tool use of those skills, or the arguments carried `--parent ship`. If any is present, you are in **pipeline mode** — the calling orchestrator owns the lifecycle and is waiting on you to return so it can run step 5 / Phase 4. Emit the **compact progress marker** below instead of the verbose summary, then return immediately. Do NOT use the heading `## Code Review Complete`, do NOT include a `### Next Steps` section, and do NOT write a wrap-up sentence — those framings cause one-shot to mistake the summary for a turn boundary and stop mid-pipeline.
|
|
928
928
|
|
|
929
|
-
**Final-report decision check (before either template).** Class every decision the report leaves to the operator per [technical-ruling-delegation.md](../brainstorm-techniques/references/technical-ruling-delegation.md) section 8.1; only `operator (<category>)` items stay, the rest go through the item-4 ruling gate first.
|
|
929
|
+
**Final-report decision check (before either template).** Class every decision the report leaves to the operator per [technical-ruling-delegation.md](../brainstorm-techniques/references/technical-ruling-delegation.md) section 8.1; only `operator (<category>)` items stay, the rest go through the item-4 ruling gate first. If the report will be saved or pasted into a file, run `technical-ruling-gate.sh --report <file>`; exit 1 means rewrite per 8.1, exit 2 means fix the file.
|
|
930
930
|
|
|
931
931
|
**Pre-emission cost-of-filing pass (run BEFORE the marker):** Build the
|
|
932
932
|
candidate "Filed as scope-out" list from your synthesis. For each candidate,
|
|
@@ -1054,7 +1054,7 @@ After the marker, control returns to one-shot step 5 / work Phase 4 in the SAME
|
|
|
1054
1054
|
|
|
1055
1055
|
### 6. Exit Gate
|
|
1056
1056
|
|
|
1057
|
-
**Pipeline detection:** If the conversation contains `skill: soleur:work` output, a `soleur:work` slash command, or `slash_command` of `work` (indicating review was invoked by work's Phase 4 chain) or `soleur:one-shot` / `
|
|
1057
|
+
**Pipeline detection:** If the conversation contains `skill: soleur:work` output, a `soleur:work` slash command, or `slash_command` of `work` (indicating review was invoked by work's Phase 4 chain) or `soleur:one-shot` / `slash_command` of `one-shot` (indicating review was invoked by one-shot step 4), skip the exit gate. The calling pipeline handles compound, commit, and lifecycle progression. When review is invoked by work or one-shot, do not duplicate these steps **and do not output the verbose `## Code Review Complete` block from Step 3** — the compact `## Review Phase Complete` marker (Step 3, pipeline mode) is the only output and the orchestrator's continuation gate handles progression. **If the arguments carried `--parent ship`,** run only step 3 below (the review-evidence trailer, which ship re-reads) and return to ship: ship's own Phase 2 runs compound and ship is already running, so invoking either here nests a second ship run. This clause wins over the conversation scan above: under a one-shot or work pipeline that reaches ship, the trailer must still be emitted, or ship's evidence re-read finds none.
|
|
1058
1058
|
|
|
1059
1059
|
**If invoked directly by the user** (no work or one-shot orchestrator in the conversation):
|
|
1060
1060
|
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
# knowledge-base/project/specs/<branch>/, or under
|
|
16
16
|
# specs/archive/<date>-<slug>/ when archived early;
|
|
17
17
|
# an absent artifact is `[PASS] no decision-challenges artifact`
|
|
18
|
-
# technical-ruling-gate.sh --pr-body <file> check a PR body for an unscoped owner-decision label
|
|
19
|
-
#
|
|
18
|
+
# technical-ruling-gate.sh --pr-body <file> check a PR body for an unscoped owner-decision label,
|
|
19
|
+
# a surviving `pending - assumed` placeholder, or an
|
|
20
|
+
# unscoped owner list (below)
|
|
21
|
+
# technical-ruling-gate.sh --report <file> the same check on any closing report, status or resume
|
|
22
|
+
# message written to a file (an alias of --pr-body; run it
|
|
23
|
+
# before a body or closing is written without /ship)
|
|
20
24
|
#
|
|
21
25
|
# Exit codes:
|
|
22
26
|
# 0 every examined row passes (`[PASS]` on stdout). An artifact with NO table is `[WARN]` + exit 0
|
|
@@ -37,9 +41,24 @@
|
|
|
37
41
|
# a leading pipe, inside a blockquote or inside a list item are not recognised (residual: the stray-row
|
|
38
42
|
# check above catches a `technical` row there).
|
|
39
43
|
#
|
|
44
|
+
# Owner lists (--pr-body and --report only): a section whose heading is on the CLOSED list OWNER_HEAD_RE ("Needs you",
|
|
45
|
+
# "Owner review items", "Owner actions", "Action required", "For you", "Manual steps", "Blocked", "Waiting on ...", a
|
|
46
|
+
# bold-only line of the same words, `-`/`_` variants, `##Needs you` without a space; a heading NOT on the list is not
|
|
47
|
+
# examined) lasts until the next heading of the same or a higher level (deeper headings stay inside), a thematic break
|
|
48
|
+
# (`---`), or any bold-only line (`**Test plan**`). Every list item in it (`-`, `*`, `+`, `1.`, `1)`, at any indent) must
|
|
49
|
+
# carry `(operator: <category>)` on its first line, EVERY tag valid (`owner-list-untagged`; an item that starts with
|
|
50
|
+
# nothing or none is a statement of no item and is skipped), must not hand the owner an agent's step: a CPO/CTO/CLO/CMO/COO/CFO
|
|
51
|
+
# sign-off, approval or review within about 40 characters of the role, in either order (`agent-owned-step`,
|
|
52
|
+
# AGENT_STEP_RE), and must not carry a `Ruled by CTO|CLO agent` cell (`owner-list-ruled`: a ruling is the agent's).
|
|
53
|
+
# Fenced lines (fence indented at most 3 spaces, as in CommonMark; a deeper one is plain text and fails closed) and
|
|
54
|
+
# inline `code spans` are ignored; an unclosed fence is exit 2, and so is an awk that fails or is missing (a lint that
|
|
55
|
+
# could not run is never a pass). Residual: a list inside a table or a blockquote, and a setext heading, are not
|
|
56
|
+
# recognised; a bold-only line, a `---` or a heading off the list ends a section, which is the author's to use honestly.
|
|
57
|
+
# The check is of FORM, as everything here is.
|
|
58
|
+
#
|
|
40
59
|
# Reasons (the suite asserts each): bad-class, bad-category, unruled-technical, bad-ruling-shape,
|
|
41
|
-
# owner-label-unscoped,
|
|
42
|
-
# receipt-unreadable.
|
|
60
|
+
# owner-label-unscoped, owner-list-untagged, agent-owned-step, owner-list-ruled, delegation-invalid,
|
|
61
|
+
# delegation-unverifiable, receipt-missing, receipt-mismatch, receipt-unreadable.
|
|
43
62
|
#
|
|
44
63
|
# Delegation arm (ADR-289, hr-menu-option-ack-not-prod-write-auth): a row whose Class is exactly
|
|
45
64
|
# `operator (production-mutating)` and whose Ruling is
|
|
@@ -83,6 +102,12 @@ shopt -s nocasematch
|
|
|
83
102
|
|
|
84
103
|
CATEGORIES="money scope priority schedule irreversible production-mutating legal-risk brand"
|
|
85
104
|
CATS_RE="${CATEGORIES// /|}"
|
|
105
|
+
# OWNER_HEAD_RE is matched against the NORMALISED heading text (lowercased; markdown, colons, `-` and `_` turned into
|
|
106
|
+
# single spaces; a leading number or symbol dropped). It is a CLOSED list: a heading outside it is not examined.
|
|
107
|
+
OWNER_HEAD_RE='^(needs? (you|your|owner|operator|founder|human|input|decision)|owner (review|decision|item|side|question|action|step|todo|to do|task|input)s?|(open|pending) owner|decisions? (for you|needed|required)|your (calls?|decisions?|input|go|approval|review|turn|action)|questions? (for|to) (you|the owner|the operator|the founder|owner|operator|founder)|waiting (on|for)|awaiting (you|your|owner|the owner|operator|the operator|founder|human|approval)|for (you|your (review|decision|decisions|attention|approval|action|input|go)|the (owner|operator|founder)|owner|operator)|what i need from you|what you need to (do|decide)|actions? (required|needed|items?)|manual (steps?|actions?|tasks?)|operator (steps?|actions?|items?|tasks?|questions?|decisions?|review)|human (actions?|steps?|review|input|tasks?)|founder (to do|todo|actions?|steps?|items?|tasks?|decisions?|questions?)|blocked)([^a-z0-9]|$)'
|
|
108
|
+
# AGENT_STEP_RE is tried at every word start on a window of 50 characters (a gap of about 40 between role and verb;
|
|
109
|
+
# no {m,n} interval, which mawk lacks): a role then a verb, or a verb then a role.
|
|
110
|
+
AGENT_STEP_RE='(cpo|cto|clo|cmo|coo|cfo)[^a-z][^.;]*(sign[ -]?off|approv|review)|(sign[ -]?off|approv|review)[^.;]*[^a-z](cpo|cto|clo|cmo|coo|cfo)([^a-z]|$)'
|
|
86
111
|
LABEL_RE='owner[ \t-]+(decision|ruling)s?[ \t]+((is|are)[ \t]+)?(needed|required)|decision[ \t]+needed[ \t]+from[ \t]+the[ \t]+owner|needs?[ \t]+(the[ \t]+)?owner[ \t]+(decision|ruling)'
|
|
87
112
|
RULING_RE='^Ruled by (CTO|CLO) agent, [0-9]{4}-[0-9]{2}-[0-9]{2}: .+'
|
|
88
113
|
PENDING_RE='pending[ \t]*[^a-z0-9 \t]+[ \t]*assumed'
|
|
@@ -143,7 +168,7 @@ unfenced_match() {
|
|
|
143
168
|
f { next }
|
|
144
169
|
{ line = $0; gsub(/`[^`]*`/, "", line); if (tolower(line) ~ re) printf "%d\t%s\n", NR, $0 }
|
|
145
170
|
END { if (f) print "@UNCLOSED" }
|
|
146
|
-
' "$1"
|
|
171
|
+
' < "$1"
|
|
147
172
|
}
|
|
148
173
|
|
|
149
174
|
# table_rows <file>: per unfenced `| Item | Class | Ruling |` header `@TABLE`, then `<line>\t<row>` per data
|
|
@@ -175,7 +200,7 @@ table_rows() {
|
|
|
175
200
|
}
|
|
176
201
|
{ end_table() }
|
|
177
202
|
END { end_table(); if (f) print "@UNCLOSED" }
|
|
178
|
-
' "$1"
|
|
203
|
+
' < "$1"
|
|
179
204
|
}
|
|
180
205
|
|
|
181
206
|
check_labels() { # <file> <display-path>; prints [FAIL] lines, returns the count (capped: a status wraps at 256)
|
|
@@ -192,6 +217,76 @@ check_labels() { # <file> <display-path>; prints [FAIL] lines, returns the count
|
|
|
192
217
|
return "$n"
|
|
193
218
|
}
|
|
194
219
|
|
|
220
|
+
# owner_list_scan <file>: `<line>\t<reason>` per finding in an owner-list section (see the header), `@UNCLOSED`
|
|
221
|
+
# when a fence is still open at end of file. mawk-safe: no {m,n} intervals. Fence handling is the same CommonMark
|
|
222
|
+
# rule as unfenced_match, under its own names so the fence mutants of that scanner stay scoped to it.
|
|
223
|
+
owner_list_scan() {
|
|
224
|
+
awk -v headre="$OWNER_HEAD_RE" -v agentre="$AGENT_STEP_RE" -v cats="$CATS_RE" '
|
|
225
|
+
function fence_toggle( tok, ch, len) {
|
|
226
|
+
tok = $0; sub(/^ +/, "", tok)
|
|
227
|
+
match(tok, /^(`+|~+)/); ch = substr(tok, 1, 1); len = RLENGTH
|
|
228
|
+
if (!f) { if (ch == "`" && substr(tok, len + 1) ~ /`/) return; f = 1; fch = ch; flen = len; return }
|
|
229
|
+
if (ch == fch && len >= flen && tok ~ /^(`+|~+)[ \t]*$/) f = 0 # mut:owner-list-fence-close
|
|
230
|
+
}
|
|
231
|
+
function agent_step(s, i, n) {
|
|
232
|
+
n = length(s)
|
|
233
|
+
for (i = 1; i <= n; i++) {
|
|
234
|
+
if (i > 1 && substr(s, i - 1, 1) ~ /[a-z0-9]/) continue
|
|
235
|
+
if (substr(s, i, 50) ~ ("^(" agentre ")")) return 1
|
|
236
|
+
}
|
|
237
|
+
return 0
|
|
238
|
+
}
|
|
239
|
+
BEGIN { valid = "\\(operator: (" cats ")\\)" }
|
|
240
|
+
{ sub(/\r$/, "") } # mut:owner-list-cr
|
|
241
|
+
NR == 1 { sub(/^\357\273\277/, "") } # mut:owner-list-bom
|
|
242
|
+
/^ ? ? ?(```+|~~~+)/ { fence_toggle(); next } # mut:owner-list-fence
|
|
243
|
+
f { next }
|
|
244
|
+
{ raw = tolower($0); t = raw; gsub(/`[^`]*`/, "", t) } # mut:owner-list-code
|
|
245
|
+
t ~ /^ ? ? ?-[ \t]*-[ \t]*-[- \t]*$/ || t ~ /^ ? ? ?\*[ \t]*\*[ \t]*\*[* \t]*$/ || t ~ /^ ? ? ?_[ \t]*_[ \t]*_[_ \t]*$/ { insec = 0; next } # mut:owner-list-hr
|
|
246
|
+
raw ~ /^ ? ? ?#+/ || raw ~ /^ ? ? ?\*\*[^*]+\*\*[ \t]*:?[ \t]*$/ || raw ~ /^ ? ? ?__[^_]+__[ \t]*:?[ \t]*$/ || raw ~ /^ ? ? ?\*[^* \t][^*]*\*[ \t]*:?[ \t]*$/ || raw ~ /^ ? ? ?_[^_ \t][^_]*_[ \t]*:?[ \t]*$/ { # mut:owner-list-bold
|
|
247
|
+
h = raw; lvl = 9; weak = 0
|
|
248
|
+
if (h ~ /^ ? ? ?#/) {
|
|
249
|
+
sub(/^ +/, "", h); lvl = match(h, /[^#]/) - 1; if (lvl < 1) lvl = 6
|
|
250
|
+
weak = (h ~ /^#+[^# \t]/); sub(/^#+/, "", h)
|
|
251
|
+
}
|
|
252
|
+
sub(/[ \t]+#+[ \t]*$/, "", h); gsub(/[*`:_-]/, " ", h); gsub(/[ \t]+/, " ", h); sub(/^ /, "", h)
|
|
253
|
+
sub(/^[0-9]+[.)] /, "", h); sub(/^[^a-z0-9]+/, "", h)
|
|
254
|
+
if (weak) { if (h ~ headre) { insec = 1; slvl = lvl }; next } # mut:owner-list-weak
|
|
255
|
+
if (insec && lvl > slvl && lvl != 9) next # mut:owner-list-sub
|
|
256
|
+
insec = 0 # mut:owner-list-close
|
|
257
|
+
if (h ~ headre) { insec = 1; slvl = lvl }
|
|
258
|
+
next
|
|
259
|
+
}
|
|
260
|
+
insec && t ~ /^[ \t]*([-*+]|[0-9]+[.)])[ \t]+/ { # mut:owner-list-plus
|
|
261
|
+
s = t; sub(/^[ \t]*([-*+]|[0-9]+[.)])[ \t]+/, "", s); gsub(/[*_]/, "", s); sub(/^[ \t]+/, "", s)
|
|
262
|
+
if (length(s) <= 60 && s ~ /^(nothing|none)([^a-z]|$)/) next # mut:owner-list-none
|
|
263
|
+
u = t; na = gsub(/\(operator:[^)]*\)/, "", u)
|
|
264
|
+
v = t; nv = gsub(valid, "", v)
|
|
265
|
+
tagged = (nv > 0 && nv == na) # mut:owner-list-alltags
|
|
266
|
+
if (!tagged) print NR "\towner-list-untagged" # mut:owner-list
|
|
267
|
+
if (tagged && agent_step(t)) print NR "\tagent-owned-step" # mut:owner-list-agent
|
|
268
|
+
if (t ~ /ruled by (cto|clo) agent/) print NR "\towner-list-ruled" # mut:owner-list-ruled
|
|
269
|
+
}
|
|
270
|
+
END { if (f) print "@UNCLOSED" }
|
|
271
|
+
' < "$1" # mut:owner-list-operand
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
check_owner_lists() { # <file> <display-path>; prints [FAIL] lines, returns the count (capped: a status wraps at 256)
|
|
275
|
+
local file="$1" shown="$2" n=0 ln reason scan_rc
|
|
276
|
+
[[ -n "$work_dir" ]] || work_dir="$(mktemp -d -t trg.XXXXXXXX)" || die2 "mktemp failed"
|
|
277
|
+
owner_list_scan "$file" > "$work_dir/owner.scan"
|
|
278
|
+
scan_rc=$?
|
|
279
|
+
(( scan_rc == 0 )) || die2 "$shown: the owner-list scan failed (awk exit $scan_rc, or no awk), so the lists were not examined" # mut:owner-list-awk-status
|
|
280
|
+
while IFS=$'\t' read -r ln reason; do
|
|
281
|
+
[[ -n "$ln" ]] || continue
|
|
282
|
+
if [[ "$ln" == "@UNCLOSED" ]]; then UNCLOSED_SEEN=1; continue; fi
|
|
283
|
+
printf '[FAIL] %s:%s: %s - tag it (operator: <category>), or route it to the CTO/CPO (technical-ruling-delegation.md), or move it under Model Dissents\n' "$shown" "$ln" "$reason" >&2
|
|
284
|
+
n=$((n + 1))
|
|
285
|
+
done < "$work_dir/owner.scan"
|
|
286
|
+
(( n > 255 )) && n=255 # mut:owner-list-cap
|
|
287
|
+
return "$n"
|
|
288
|
+
}
|
|
289
|
+
|
|
195
290
|
check_pending() { # <file> <display-path>; an unresolved placeholder anywhere in the file, returns the count (capped)
|
|
196
291
|
local file="$1" shown="$2" n=0 ln text
|
|
197
292
|
while IFS=$'\t' read -r ln text; do
|
|
@@ -391,8 +486,8 @@ fi
|
|
|
391
486
|
|
|
392
487
|
mode="${1:-}"
|
|
393
488
|
case "$mode" in
|
|
394
|
-
--pr-body)
|
|
395
|
-
f="${2:-}"; [[ -n "$f" ]] || die2 "usage:
|
|
489
|
+
--pr-body|--report) # mut:owner-list-alias
|
|
490
|
+
f="${2:-}"; [[ -n "$f" ]] || die2 "usage: $mode <file>"
|
|
396
491
|
[[ -f "$f" && -r "$f" ]] || die2 "$f: not a readable regular file"
|
|
397
492
|
if ! { [[ -s "$f" ]] && grep -q '[^[:space:]]' "$f"; }; then
|
|
398
493
|
die2 "$f: the PR body is EMPTY (the fetch that wrote it most likely failed); nothing was examined"
|
|
@@ -400,9 +495,10 @@ case "$mode" in
|
|
|
400
495
|
fails=0
|
|
401
496
|
check_pending "$f" "$f"; fails=$((fails + $?))
|
|
402
497
|
check_labels "$f" "$f"; fails=$((fails + $?))
|
|
498
|
+
check_owner_lists "$f" "$f"; fails=$((fails + $?)) # mut:owner-list-call
|
|
403
499
|
(( UNCLOSED_SEEN )) && die2 "$f: a code fence in the PR body is never closed, so the rest of it was not examined (close it)"
|
|
404
500
|
if (( fails > 0 )); then exit 1; fi
|
|
405
|
-
printf '[PASS] %s: no unscoped owner-decision label and no pending placeholder\n' "$f"
|
|
501
|
+
printf '[PASS] %s: no unscoped owner-decision label, no unscoped owner list and no pending placeholder\n' "$f"
|
|
406
502
|
exit 0 ;;
|
|
407
503
|
--branch)
|
|
408
504
|
branch="${TRG_BRANCH:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null)}"
|
|
@@ -437,7 +533,7 @@ case "$mode" in
|
|
|
437
533
|
case "${matches[0]}" in */archive/*) SHAPE_ONLY=1; printf '[NOTE] archived artifact: delegation rows are checked for shape only and are NOT verified (no network)\n' >&2 ;; esac
|
|
438
534
|
check_artifact "${matches[0]}" "${matches[0]}"; exit $? ;;
|
|
439
535
|
""|-h|--help)
|
|
440
|
-
die2 "usage: $(basename "$0") <path> | --branch | --pr-body <file>" ;;
|
|
536
|
+
die2 "usage: $(basename "$0") <path> | --branch | --pr-body <file> | --report <file>" ;;
|
|
441
537
|
-*) die2 "unknown option: $mode" ;;
|
|
442
538
|
*)
|
|
443
539
|
check_artifact "$mode" "$mode"; exit $? ;;
|