@feigi/fleet-ctl 0.0.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.
Files changed (245) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +18 -0
  4. package/agents/fleet-finisher.agent.md +7 -0
  5. package/agents/fleet-implementer-alt.agent.md +210 -0
  6. package/agents/fleet-implementer.agent.md +210 -0
  7. package/agents/fleet-merge-bot.agent.md +7 -0
  8. package/agents/fleet-review-comments.agent.md +40 -0
  9. package/agents/fleet-review-correctness.agent.md +43 -0
  10. package/agents/fleet-review-runner.agent.md +73 -0
  11. package/agents/fleet-review-silent-failure.agent.md +49 -0
  12. package/agents/fleet-review-simplify.agent.md +46 -0
  13. package/agents/fleet-review-snapshot.agent.md +24 -0
  14. package/agents/fleet-review-tests.agent.md +46 -0
  15. package/agents/fleet-review-types.agent.md +41 -0
  16. package/agents/fleet-review-verifier.agent.md +29 -0
  17. package/commands/review-and-fix.md +98 -0
  18. package/commands/run-merge-bot.md +357 -0
  19. package/commands/run-team-help.md +17 -0
  20. package/package.json +23 -0
  21. package/scripts/agent-test-dir-prose.test.mjs +59 -0
  22. package/scripts/agent-test.test.mjs +1636 -0
  23. package/scripts/ambient-git-vars-mjs-prose.test.mjs +354 -0
  24. package/scripts/ambient-git-vars-prose.test.mjs +192 -0
  25. package/scripts/ancestry-check-position-prose.test.mjs +175 -0
  26. package/scripts/apply-ruleset.test.mjs +420 -0
  27. package/scripts/arg-header-probes-prose.test.mjs +393 -0
  28. package/scripts/arg.mjs +600 -0
  29. package/scripts/arg.test.mjs +1354 -0
  30. package/scripts/board-cli.test.mjs +694 -0
  31. package/scripts/board-identity.test.mjs +429 -0
  32. package/scripts/board-liveness-banner.test.mjs +119 -0
  33. package/scripts/board-prev-shape.test.mjs +229 -0
  34. package/scripts/board-tryparse-null.test.mjs +119 -0
  35. package/scripts/board.html +471 -0
  36. package/scripts/board.mjs +2037 -0
  37. package/scripts/board.test.mjs +3086 -0
  38. package/scripts/brief-after-cut-prose.test.mjs +53 -0
  39. package/scripts/candidates-exit3-prose.test.mjs +302 -0
  40. package/scripts/candidates.mjs +674 -0
  41. package/scripts/candidates.test.mjs +2101 -0
  42. package/scripts/caveat-unification-prose.test.mjs +98 -0
  43. package/scripts/ci-comment-rot-prose.test.mjs +2025 -0
  44. package/scripts/ci-completes-premise-prose.test.mjs +257 -0
  45. package/scripts/ci-state-prose.test.mjs +113 -0
  46. package/scripts/ci-state.mjs +761 -0
  47. package/scripts/ci-state.test.mjs +1640 -0
  48. package/scripts/ci-vacuous-green.test.mjs +368 -0
  49. package/scripts/citation-sweep-prose.test.mjs +1572 -0
  50. package/scripts/claim-lifecycle.test.mjs +185 -0
  51. package/scripts/claim-ticket.sh +417 -0
  52. package/scripts/claim-ticket.test.mjs +1121 -0
  53. package/scripts/closing-keyword-prose.test.mjs +193 -0
  54. package/scripts/cockpit-launch-idempotent-prose.test.mjs +165 -0
  55. package/scripts/cockpit-tick-nonblocking.test.mjs +210 -0
  56. package/scripts/compute-board.mjs +579 -0
  57. package/scripts/compute-board.test.mjs +1060 -0
  58. package/scripts/compute-spend.mjs +329 -0
  59. package/scripts/compute-spend.test.mjs +451 -0
  60. package/scripts/cross-repo-citation-prose.test.mjs +156 -0
  61. package/scripts/cwd-isolation-pins.mjs +83 -0
  62. package/scripts/dedupe-guard-prose.test.mjs +243 -0
  63. package/scripts/derive-testcmd.sh +239 -0
  64. package/scripts/derive-testcmd.test.mjs +380 -0
  65. package/scripts/diff-stats.mjs +231 -0
  66. package/scripts/diff-stats.test.mjs +408 -0
  67. package/scripts/dispatch-block-golden-prose.test.mjs +1024 -0
  68. package/scripts/dispatch-block-pins-prose.test.mjs +615 -0
  69. package/scripts/drop-merged-label.sh +173 -0
  70. package/scripts/drop-merged-label.test.mjs +480 -0
  71. package/scripts/expected-jobs-prose.test.mjs +80 -0
  72. package/scripts/filing-bar-seat-prose.test.mjs +242 -0
  73. package/scripts/filing-claim-bar-prose.test.mjs +166 -0
  74. package/scripts/finisher-dispatch-premise-prose.test.mjs +312 -0
  75. package/scripts/finisher-halt-prose.test.mjs +106 -0
  76. package/scripts/finisher-name-prose.test.mjs +134 -0
  77. package/scripts/finisher-own-tree-prose.test.mjs +285 -0
  78. package/scripts/finisher-pin-race-prose.test.mjs +339 -0
  79. package/scripts/fix-applier-correction-rules-prose.test.mjs +201 -0
  80. package/scripts/fix-applier-result-file-prose.test.mjs +100 -0
  81. package/scripts/fleet-bootstrap +155 -0
  82. package/scripts/fleet-heartbeat.mjs +272 -0
  83. package/scripts/fleet-heartbeat.test.mjs +450 -0
  84. package/scripts/fleet-provenance +207 -0
  85. package/scripts/fleet-provenance.test.mjs +64 -0
  86. package/scripts/fleet-run +148 -0
  87. package/scripts/fleet-run.test.mjs +90 -0
  88. package/scripts/fleet-state.mjs +400 -0
  89. package/scripts/fleet-state.test.mjs +373 -0
  90. package/scripts/fleet-tick-prose.test.mjs +299 -0
  91. package/scripts/fleet-tick.mjs +832 -0
  92. package/scripts/fleet-tick.test.mjs +1332 -0
  93. package/scripts/force-with-lease-reason-prose.test.mjs +184 -0
  94. package/scripts/frontmatter-allowlist.json +64 -0
  95. package/scripts/frontmatter-check.mjs +256 -0
  96. package/scripts/frontmatter-check.test.mjs +436 -0
  97. package/scripts/git-env.mjs +124 -0
  98. package/scripts/git-env.test.mjs +149 -0
  99. package/scripts/git-status-untracked-mode-sweep.test.mjs +216 -0
  100. package/scripts/gone-walk.test.mjs +213 -0
  101. package/scripts/gp-sep-invariant-prose.test.mjs +188 -0
  102. package/scripts/head-moved-after-label-prose.test.mjs +233 -0
  103. package/scripts/immutable-body-claim-prose.test.mjs +413 -0
  104. package/scripts/implementer-model-tier.test.mjs +643 -0
  105. package/scripts/inflight-citation-prose.test.mjs +144 -0
  106. package/scripts/inflight-exit2-prose.test.mjs +81 -0
  107. package/scripts/inflight-probe-guard-prose.test.mjs +109 -0
  108. package/scripts/inflight-scan-scope-prose.test.mjs +57 -0
  109. package/scripts/inflight.sh +1106 -0
  110. package/scripts/inflight.test.mjs +2984 -0
  111. package/scripts/injection-control-prose.test.mjs +404 -0
  112. package/scripts/install-root-audit.test.mjs +464 -0
  113. package/scripts/instrument-check-prose.test.mjs +235 -0
  114. package/scripts/instruments.sh +394 -0
  115. package/scripts/instruments.test.mjs +787 -0
  116. package/scripts/issue-tracker-prose.test.mjs +71 -0
  117. package/scripts/json.sh +248 -0
  118. package/scripts/json.test.mjs +364 -0
  119. package/scripts/ledger-dispatch.test.mjs +516 -0
  120. package/scripts/ledger-grammar.mjs +85 -0
  121. package/scripts/ledger-grammar.test.mjs +142 -0
  122. package/scripts/ledger-read-require-file.test.mjs +197 -0
  123. package/scripts/ledger.mjs +1753 -0
  124. package/scripts/ledger.test.mjs +3554 -0
  125. package/scripts/line-distance-prose.test.mjs +245 -0
  126. package/scripts/liveness-rationale-prose.test.mjs +83 -0
  127. package/scripts/locale-pin-prose.test.mjs +189 -0
  128. package/scripts/member-outcome-prose.test.mjs +167 -0
  129. package/scripts/member-outcomes-header.test.mjs +148 -0
  130. package/scripts/member-outcomes-prose.test.mjs +63 -0
  131. package/scripts/member-outcomes.mjs +231 -0
  132. package/scripts/member-outcomes.test.mjs +507 -0
  133. package/scripts/member-prompt-prose.test.mjs +161 -0
  134. package/scripts/member-record.mjs +605 -0
  135. package/scripts/member-record.test.mjs +516 -0
  136. package/scripts/member-write-guard.mjs +279 -0
  137. package/scripts/member-write-guard.test.mjs +211 -0
  138. package/scripts/merge-commit-probe-prose.test.mjs +122 -0
  139. package/scripts/merge-gate.mjs +262 -0
  140. package/scripts/merge-gate.test.mjs +613 -0
  141. package/scripts/muted-git-guard-sweep.test.mjs +493 -0
  142. package/scripts/net-ssh-precedence-prose.test.mjs +91 -0
  143. package/scripts/net-watchdog-prose.test.mjs +79 -0
  144. package/scripts/net.sh +409 -0
  145. package/scripts/net.test.mjs +211 -0
  146. package/scripts/no-ci-gate-prose.test.mjs +108 -0
  147. package/scripts/no-undo-audit.sh +1134 -0
  148. package/scripts/no-undo-audit.test.mjs +3965 -0
  149. package/scripts/no-wave.test.mjs +138 -0
  150. package/scripts/node-floor-sweep.test.mjs +611 -0
  151. package/scripts/pointer-target-prose.test.mjs +186 -0
  152. package/scripts/pr-overlap.mjs +417 -0
  153. package/scripts/pr-overlap.test.mjs +695 -0
  154. package/scripts/printf-die-sweep.test.mjs +384 -0
  155. package/scripts/prompt-renderer.mjs +39 -0
  156. package/scripts/prompt-renderer.test.mjs +68 -0
  157. package/scripts/prose-pin.mjs +808 -0
  158. package/scripts/prose-pin.test.mjs +1034 -0
  159. package/scripts/prove-merge.sh +228 -0
  160. package/scripts/prove-merge.test.mjs +995 -0
  161. package/scripts/pull-table-relabel-prose.test.mjs +60 -0
  162. package/scripts/quiet-payload-prose.test.mjs +222 -0
  163. package/scripts/reap.sh +1768 -0
  164. package/scripts/reap.test.mjs +4395 -0
  165. package/scripts/reaping-prose.test.mjs +159 -0
  166. package/scripts/refuter-scratch-prose.test.mjs +135 -0
  167. package/scripts/release-label-required-prose.test.mjs +71 -0
  168. package/scripts/release-label-split-prose.test.mjs +169 -0
  169. package/scripts/release-ticket.sh +1716 -0
  170. package/scripts/release-ticket.test.mjs +5106 -0
  171. package/scripts/renovate-release-contract.test.mjs +379 -0
  172. package/scripts/repo-root.mjs +544 -0
  173. package/scripts/repo-root.test.mjs +873 -0
  174. package/scripts/reporter-output-rule-prose.test.mjs +208 -0
  175. package/scripts/review-agent-report-only.test.mjs +49 -0
  176. package/scripts/review-core-cwd-isolation.test.mjs +374 -0
  177. package/scripts/review-core-reads.test.mjs +478 -0
  178. package/scripts/review-core-refuter-scratch.test.mjs +148 -0
  179. package/scripts/review-core-snapshot-path.test.mjs +777 -0
  180. package/scripts/review-core-specialist-scratch.test.mjs +189 -0
  181. package/scripts/review-core-testcmd.test.mjs +288 -0
  182. package/scripts/review-core-unrun.test.mjs +530 -0
  183. package/scripts/review-core-unverified-discriminant.test.mjs +208 -0
  184. package/scripts/review-core.mjs +1028 -0
  185. package/scripts/review-eval-resolver-path.test.mjs +55 -0
  186. package/scripts/review-eval.mjs +197 -0
  187. package/scripts/review-host-fixture.mjs +73 -0
  188. package/scripts/review-in-run-retry.test.mjs +187 -0
  189. package/scripts/review-no-vendor-dispatch.test.mjs +45 -0
  190. package/scripts/review-path-default.test.mjs +796 -0
  191. package/scripts/review-runner-spawns.test.mjs +93 -0
  192. package/scripts/review-runner.test.mjs +155 -0
  193. package/scripts/review-tier-audit.test.mjs +140 -0
  194. package/scripts/run-artifact-pr-prose.test.mjs +341 -0
  195. package/scripts/run-merge-bot-prose.test.mjs +1391 -0
  196. package/scripts/scratch-partition-invariant-prose.test.mjs +74 -0
  197. package/scripts/scripts-path-citation-sweep.test.mjs +73 -0
  198. package/scripts/section-between-guard-prose.test.mjs +378 -0
  199. package/scripts/select-dimensions.test.mjs +674 -0
  200. package/scripts/shared-refusal.test.mjs +388 -0
  201. package/scripts/shell-traps-prose.test.mjs +507 -0
  202. package/scripts/shortlist.mjs +355 -0
  203. package/scripts/shortlist.test.mjs +366 -0
  204. package/scripts/slow-transport.mjs +72 -0
  205. package/scripts/snapshot-repo.test.mjs +772 -0
  206. package/scripts/snapshot-runner-audience-prose.test.mjs +129 -0
  207. package/scripts/spend-view.test.mjs +312 -0
  208. package/scripts/staleness-qualifier-prose.test.mjs +251 -0
  209. package/scripts/staleness-verdict-prose.test.mjs +142 -0
  210. package/scripts/staleness.mjs +414 -0
  211. package/scripts/staleness.test.mjs +893 -0
  212. package/scripts/stalled-member-liveness-prose.test.mjs +219 -0
  213. package/scripts/stash-prohibition-prose.test.mjs +313 -0
  214. package/scripts/strip-comments.mjs +44 -0
  215. package/scripts/tier-check.mjs +468 -0
  216. package/scripts/tier-check.test.mjs +726 -0
  217. package/scripts/tier-guard-gate-prose.test.mjs +216 -0
  218. package/scripts/tier-outcomes-header.test.mjs +586 -0
  219. package/scripts/tier-outcomes.mjs +441 -0
  220. package/scripts/tier-outcomes.test.mjs +342 -0
  221. package/scripts/tier-roles.mjs +250 -0
  222. package/scripts/tier-roles.test.mjs +316 -0
  223. package/scripts/tracker-block-copy-prose.test.mjs +288 -0
  224. package/scripts/triage-labels-gloss-prose.test.mjs +97 -0
  225. package/scripts/unattended-git-sweep.test.mjs +142 -0
  226. package/scripts/verify-sha-exit2-prose.test.mjs +269 -0
  227. package/scripts/verify-sha.sh +117 -0
  228. package/scripts/verify-sha.test.mjs +693 -0
  229. package/scripts/watcher-degraded-block.test.mjs +372 -0
  230. package/scripts/watcher-key-prose.test.mjs +106 -0
  231. package/scripts/within-run-pair-prose.test.mjs +208 -0
  232. package/scripts/worktree-audit.sh +482 -0
  233. package/scripts/worktree-audit.test.mjs +1407 -0
  234. package/scripts/worktree-head-prose.test.mjs +276 -0
  235. package/scripts/worktree-listing-sweep.test.mjs +217 -0
  236. package/scripts/worktree-model-prose.test.mjs +216 -0
  237. package/scripts/worktree.sh +470 -0
  238. package/skills/next-ticket/SKILL.md +138 -0
  239. package/skills/run-team/SKILL.md +3603 -0
  240. package/skills/run-team/references/ci-and-staleness.md +75 -0
  241. package/skills/run-team/references/correction-tickets.md +37 -0
  242. package/skills/run-team/references/isolation.md +23 -0
  243. package/skills/run-team/references/member-lifecycle.md +73 -0
  244. package/skills/run-team/references/reaping.md +73 -0
  245. package/skills/sizing-a-ticket/SKILL.md +39 -0
@@ -0,0 +1,413 @@
1
+ // #402. Two commits on #399 both closed `Verified: … 86/86 across both test
2
+ // files that read` this file, a file set the tree does not bear out, and a
3
+ // pushed commit body cannot be edited. The rules beside this block all scope to
4
+ // prose the DIFF restates, so none of them reached the body that ships the
5
+ // diff. This file pins the rule that closes that gap.
6
+ //
7
+ // Measured against `origin/main` before this file existed: no test read the
8
+ // words `commit body` in `run-team/SKILL.md` at all, so the whole rule could be
9
+ // deleted with the suite green.
10
+ //
11
+ // SHAPE, and what to preserve when editing these tests. The slice runs from the
12
+ // anti-count rule that precedes this one to the `#### Fallback` heading that
13
+ // follows it — bounded at both ends, because a positive regex over the whole
14
+ // correction-discipline block is vacuous: every word of this rule is somewhere
15
+ // in it, so the assertion passes with the rule deleted. `cross-repo-citation-
16
+ // prose.test.mjs` pins the same block for the citation convention and takes it
17
+ // whole; that slice is large enough that presence checks inside it prove
18
+ // nothing about this rule.
19
+ //
20
+ // Each fragment is bound to the content beside it rather than asserted alone.
21
+ // The failure that matters here is not deletion — it is a narrowing back to
22
+ // what the ticket's TITLE said (measurement counts under a `Verified:` header),
23
+ // which the brief ruled out because it would miss both attribution errors. So
24
+ // the claim types are pinned as one ordered span, and the shipping/motivating
25
+ // pair as one span too: two presence checks on "ships" and "motivated" stay
26
+ // green through the swap that tells a member to settle its claims at the commit
27
+ // that prompted the work.
28
+ //
29
+ // THE CEILING, the same one `dispatch-block-pins-prose.test.mjs` records and
30
+ // #1002 measured: these are pins on text being PRESENT and adjacent. A sentence
31
+ // APPENDED after a pinned one that carves an exception out of it — "a claim
32
+ // already settled earlier in the branch needs no re-run" — touches no pinned
33
+ // fragment and stays green. Measured, not assumed: that mutant was run against
34
+ // this file and passed. Do not read a green run here as "no carve-out was
35
+ // added to this rule".
36
+ //
37
+ // AND IT STAYS OPEN HERE, by ruling rather than by neglect. #1002 closed the
38
+ // same ceiling for the verbatim dispatch BLOCKS, with a whole-block golden
39
+ // fixture (`dispatch-block-golden-prose.test.mjs`); its own out-of-scope is
40
+ // explicit that the golden form is justified by those blocks being
41
+ // change-controlled — they exist to reach a member unchanged — and that the
42
+ // argument does not carry to ordinary prose. The rule this file pins is
43
+ // ordinary prose: not a blockquote, not carried verbatim to anyone, and edited
44
+ // by whoever next touches the correction-discipline block. A golden over it
45
+ // would red on every legitimate rewording, with no change-control convention to
46
+ // make that red a review point rather than an obstacle.
47
+ //
48
+ // That appended-clause half is the KNOWN ceiling, and it is what #1002 records
49
+ // and measures. A second half is not: a MEANING-CHANGING clause inserted
50
+ // MID-GAP — between the two anchors of one ordered span, touching no pinned
51
+ // fragment — is absorbed wherever that span's `.{0,N}?` still has headroom, and
52
+ // the suite stays green. The tolerance exists so a meaning-PRESERVING copy-edit
53
+ // does not red the pin, and an insertion that changes the rule's meaning inside
54
+ // the same gap is a different case no assertion here sees.
55
+ //
56
+ // Measured on this file, not assumed, and the property is per-gap headroom
57
+ // rather than one every span here has. Re-derive by inserting the literal into
58
+ // `run-team/SKILL.md` and running this file: `unless it names a public source, `
59
+ // in the ranking span's gap stayed green, `nobody relies on ` in the
60
+ // `Verified:` span stayed green, and `, for correction tickets only` in the
61
+ // hand-over span stayed green — while `, unless re-running it is impractical`
62
+ // in the endings span pushed past that gap's cap and RED it.
63
+ //
64
+ // Tightening the gaps is not the fix, and NOT for the reason that first comes to
65
+ // mind. Reflow is not what a tight gap costs: `flatten` collapses whitespace
66
+ // before matching, so re-wrapping the source leaves the gap's flattened length
67
+ // identical. Measured — the endings gap narrowed to its exact content (84
68
+ // chars, zero headroom) stayed GREEN through a hard re-wrap of the whole rule
69
+ // at 42 columns. What a tight gap costs is word-level copy-editing: the same
70
+ // zero-headroom gap RED on inserting the single word `it` into "not one to
71
+ // assert bare". That is a meaning-preserving edit, and a pin that reds on one
72
+ // is a pin the next person to touch this prose weakens or deletes.
73
+ // The mechanism has to change, which was #1002's conclusion — and where it
74
+ // changed is the dispatch blocks, not here. See the ruling above.
75
+ import { test } from "node:test";
76
+ import assert from "node:assert/strict";
77
+ import { readFileSync } from "node:fs";
78
+ import { join } from "node:path";
79
+ import { between, paragraph, phrase } from "./prose-pin.mjs";
80
+
81
+ const REPO = join(import.meta.dirname, "..");
82
+ const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
83
+
84
+ // `**` emphasis is stripped and whitespace collapsed before matching, so a
85
+ // pinned span may cross a bold boundary or a hard wrap and neither an emphasis
86
+ // move nor a reflow is a failure. `phrase()` alone cannot do the first: it
87
+ // escapes `*` as a regex metacharacter, which makes the exact position of a
88
+ // `**` seam literal test surface, and a false red on a meaning-preserving
89
+ // copy-edit is how a pin gets deleted by the next person to touch the prose.
90
+ //
91
+ // Only `**` is stripped, deliberately. Single `*` is a live character in this
92
+ // slice — `*instead of*` italicises the word that carries the `Verified:`
93
+ // rationale — so stripping it would corrupt the text rather than normalize it.
94
+ // The `>` gutter strip is inert here (this rule is not a blockquote) and kept
95
+ // so that quoting it into a member prompt does not red every pin below.
96
+ const flatten = (s) =>
97
+ s
98
+ .split("\n")
99
+ .map((l) => l.replace(/^>\s?/, ""))
100
+ .join(" ")
101
+ .replace(/\*\*/g, "")
102
+ .split(/\s+/)
103
+ .join(" ")
104
+ .trim();
105
+
106
+ const FROM = "never write a COUNT or a tally into prose";
107
+ const TO = "#### Fallback: hand-dispatched reviewer member";
108
+ const rule = () => flatten(between(RUN_TEAM, FROM, TO, "the immutable-body claim rule"));
109
+
110
+ // The phase-0 restatement of what phase 2 hands a `class=correction` implementer.
111
+ // A separate slice, far from the rule itself, because that enumeration is a
112
+ // delivery surface in its own right and drifts independently of the block.
113
+ const PHASE0_FROM = "hands the implementer (settle every restated claim";
114
+ const PHASE0_TO = "and it is what any future tier";
115
+
116
+ test("the rule reaches the immutable body the diff does not carry, and says why review-time is too late", () => {
117
+ const r = rule();
118
+ // The artifacts, bound to the reason they need their own rule. "commit body"
119
+ // alone is satisfied by any passing mention; what makes this a rule is that
120
+ // the body is not in the diff every other rule here scopes to.
121
+ assert.match(
122
+ r,
123
+ /a claim written into a commit body or a PR body.{0,400}?a pushed commit body is not in the diff/,
124
+ "the rule no longer covers a commit or PR body as something the diff-scoped rules cannot reach",
125
+ );
126
+ // Immutability bound to the consequence that makes a later fix no exit. With
127
+ // only "cannot be edited" the reader concludes the remedy is a follow-up
128
+ // commit, which is a fresh instance of the same generator.
129
+ assert.match(
130
+ r,
131
+ phrase("only retracted by a later commit, which is itself a fresh unverified historical claim"),
132
+ "the rule no longer says a retraction is itself an unverified claim — read without it, 'fix it later' looks like an exit",
133
+ );
134
+ assert.match(
135
+ r,
136
+ phrase("So the check has to sit at write time, and review-time is already too late"),
137
+ "the rule no longer places the check at write time, so it now reads as something a reviewer could catch instead",
138
+ );
139
+ });
140
+
141
+ test("the settling command is pinned to the shipping commit, against the motivating one", () => {
142
+ // One ordered span, not two presence checks. `ships` and `motivated` both
143
+ // appear either way round, and the reversed reading — settle at the commit
144
+ // that motivated the work — is exactly the generator this rule exists to
145
+ // stop: it is what makes a number correct when it was learned and wrong when
146
+ // it shipped.
147
+ assert.match(
148
+ rule(),
149
+ phrase("re-run at the commit that ships it, not at the commit that motivated it"),
150
+ "re-running the settling command is no longer pinned to the shipping commit against the motivating one, or the two have been swapped",
151
+ );
152
+ });
153
+
154
+ test("the claim types stay at the widened scope, with attribution ranked above a line number", () => {
155
+ const r = rule();
156
+ // The whole list as one span. A separate presence check on each noun is
157
+ // vacuous in this slice: the anti-count rule it opens on already carries
158
+ // "count", so a narrowing back to measurement counts — the ticket's title
159
+ // scope, which the brief ruled out — would leave that check green.
160
+ assert.match(
161
+ r,
162
+ phrase("a line number, a SHA, an attribution of who said what, a positional reference and a count all rot the same way"),
163
+ "the claim types narrowed — the rule no longer covers line numbers, SHAs, attributions and positional references alongside counts",
164
+ );
165
+ // The ranking, bound to the reason for it and to the case it is ranked
166
+ // against. This is the brief's decisive point, and it inverts cleanly: "a
167
+ // wrong line number is the worst of them" reads as sound advice and reds
168
+ // here.
169
+ assert.match(
170
+ r,
171
+ /an attribution is the worst of them, because the argument it carries collapses.{0,120}?while a wrong line number leaves the surrounding reasoning standing/,
172
+ "the rule no longer ranks a false attribution above a wrong line number, or no longer gives the reason — that an attribution's argument collapses with it",
173
+ );
174
+ });
175
+
176
+ test("the inline form is bound to what it buys, and to the claim that has to be dropped instead", () => {
177
+ const r = rule();
178
+ assert.match(
179
+ r,
180
+ phrase("the command goes inline, beside the claim"),
181
+ "the rule no longer requires the settling command inline beside the claim it settles",
182
+ );
183
+ // The endings that make the rule decidable. "Write the command inline" alone
184
+ // leaves a writer with an unsettleable claim no instruction at all, and the
185
+ // reachable move there is to assert it bare. The marker ending is load-bearing
186
+ // and not decorative: the cross-repo citation convention in this block —
187
+ // pinned by `cross-repo-citation-prose.test.mjs` — directs foreign evidence to
188
+ // be asserted as prose saying it cannot be settled from this repo, and a
189
+ // settle-or-drop binary reads as a ban on exactly that, since a foreign
190
+ // claim's settling command cannot be written HERE. Pinned as one ordered span
191
+ // so the binary cannot come back by dropping the marker ending.
192
+ assert.match(
193
+ r,
194
+ /can be re-run instead of trusted.{0,120}?settle it inline, mark it unsettleable from this repo per the citation convention above, or drop it/,
195
+ "the rule no longer offers the unsettleable-from-this-repo marker as an ending — a settle-or-drop binary bans what the citation convention above sanctions",
196
+ );
197
+ });
198
+
199
+ test("the `Verified:` header carries the rationale — a wrong figure under it is worse than none", () => {
200
+ // The ticket's own "why a rule and not just a fix". Before this assert the
201
+ // sentence sat in an unpinned gap: the ranking span stops at "leaves the
202
+ // surrounding reasoning standing" and the worked-instance span starts at
203
+ // "`f961cf2` and `acce6ee`", so deleting it left the whole suite green.
204
+ // One ordered span, because `Verified:` alone recurs in this slice and a bare
205
+ // presence check on it is satisfied by the `f961cf2`/`acce6ee` worked
206
+ // instance. The single `*` in `*instead of*` is live text here — see the
207
+ // `flatten` note — and this is the assertion that makes leaving it unstripped
208
+ // load-bearing.
209
+ assert.match(
210
+ rule(),
211
+ /`Verified:` is the construct a later reader trusts \*instead of\* re-deriving.{0,80}?worse than no figure at all/,
212
+ "the rule no longer says why `Verified:` is the header that makes a wrong figure worse than none",
213
+ );
214
+ });
215
+
216
+ test("the worked instance names both commits and the command that settles what they shipped", () => {
217
+ const r = rule();
218
+ // The example is the rule applied to itself: a claim about two commit bodies,
219
+ // carrying the command that reads them. Pinning the SHAs alone would survive
220
+ // the command being dropped, which is the half a reader needs to re-derive.
221
+ assert.match(
222
+ r,
223
+ /`f961cf2` and `acce6ee` both close `Verified:` with `86\/86 across both test files`/,
224
+ "the worked instance no longer names both commits that shipped the claim",
225
+ );
226
+ assert.match(
227
+ r,
228
+ phrase("`git log -1 --format=%b <sha> | grep -A2 Verified:` shows what each shipped"),
229
+ "the worked instance lost its settling command — the rule now demonstrates the failure it forbids",
230
+ );
231
+ });
232
+
233
+ test("the literal-path grep is forbidden AND the method that replaces it is given", () => {
234
+ const r = rule();
235
+ // Prohibition bound to remedy. Separately, a slice keeping "must never be a
236
+ // literal-path grep" with the mutation method deleted stays green and leaves
237
+ // a member told what not to run and nothing to run instead — the state the
238
+ // issue was written in, where two successive greps returned two wrong
239
+ // answers.
240
+ assert.match(
241
+ r,
242
+ /must never be a literal-path grep.{0,500}?Replace the file with `MUTATED` in a throwaway copy, run the suite/,
243
+ "the literal-path grep prohibition is no longer carried with the mutation method that replaces it",
244
+ );
245
+ // Why the grep fails, in both directions. One direction alone reads as a
246
+ // precision problem a tighter pattern would fix, which is the refinement the
247
+ // issue measured returning a second wrong answer.
248
+ assert.match(
249
+ r,
250
+ /merely \*name\* it — comments included — and misses the files that build it/,
251
+ "the rule no longer says a path grep both over-reports mentions and misses assembled paths — one direction alone reads as a pattern that needs tightening",
252
+ );
253
+ // The question the mutation actually answers, which is narrower than "reads".
254
+ assert.match(
255
+ r,
256
+ phrase("that answers which ones depend on its contents"),
257
+ "the mutation method no longer states what it settles — depending on a file's contents is a different question from naming its path",
258
+ );
259
+ });
260
+
261
+ test("a settling command over literal text takes -F, and its zero counts only after a known match", () => {
262
+ const r = rule();
263
+ // #1087. The `-F` half, bound to the measured case that shows why: a
264
+ // literal line holding `\s+` is read as a pattern and answers 0 against
265
+ // itself. Without the case the rule reads as style, not as a false zero.
266
+ assert.match(
267
+ r,
268
+ phrase("A settling command over literal text uses `grep -F`"),
269
+ "the rule no longer tells a settling command over literal text to use grep -F",
270
+ );
271
+ assert.match(
272
+ r,
273
+ phrase("`grep -c 'settled by:\\s+x'` answers 0 against a file holding that exact line, and `grep -cF` answers 1"),
274
+ "the -F rule lost the measured case it rests on — the bare grep answering 0 against its own literal line",
275
+ );
276
+ // The positive-control half, which the `-F` half does not imply: a command
277
+ // with `-F` can still be one that never finds a match, and its zero then
278
+ // settles nothing while reading as a checked absence.
279
+ assert.match(
280
+ r,
281
+ phrase("A zero or an absence counts only after the same command, with the same flags, finds a line known to match"),
282
+ "the rule no longer requires a settling command to find a known match before its zero is trusted",
283
+ );
284
+ assert.match(
285
+ r,
286
+ phrase("a command that cannot find a match settles nothing"),
287
+ "the rule no longer says a command incapable of finding a match settles nothing",
288
+ );
289
+ // #1087's ruling: the trap is harness-independent, so the rule names no
290
+ // grep implementation or harness. A tool-specific warning goes false on the
291
+ // next harness while reading as the whole of the rule. Substring match, no
292
+ // leading `\b` before `bsd` — `\bbsd\b` cannot match inside "FreeBSD" (no
293
+ // boundary between "ree" and "BSD"), and this repo's own dev grep reports
294
+ // itself as "2.6.0-FreeBSD" (measured), so that miss is not hypothetical.
295
+ assert.doesNotMatch(
296
+ paragraph(RUN_TEAM, "**A settling command over literal text uses `grep -F`", "the literal-text grep rule"),
297
+ /ugrep|ripgrep|claude code|bsd|gnu/i,
298
+ "the literal-text grep rule now names a grep implementation or harness — #1087 ruled it harness-independent",
299
+ );
300
+ });
301
+
302
+ test("both hand-over enumerations name this rule — a relayed list carries only what it names", () => {
303
+ // Delivery here is a controller copying an enumeration, not the block:
304
+ // nothing in this repo renders this block into a member prompt verbatim, so
305
+ // the enumerated sentences ARE the hand-over. Settle with
306
+ // `grep -rn "correction-ticket discipline" skills/ agents/` — every hit
307
+ // selects, annotates or pins the discipline, and none renders it. That a
308
+ // controller in practice relays the enumeration and leaves the block behind
309
+ // is a fleet-run observation and cannot be settled from this repo.
310
+ //
311
+ // The refuters' point stands and is not the defect: the block already carried
312
+ // rules these enumerations omit. The anti-count rule was one, absent from the
313
+ // phase-0 parenthetical before #402 —
314
+ // `git show 38d9d15:skills/run-team/SKILL.md | sed -n '303,310p'
315
+ // | grep -in "count\|tally"` exits 1 — which is why the phase-0 asserts cover
316
+ // it too.
317
+ assert.match(
318
+ rule(),
319
+ /The immutable-body rule earns the same place.{0,80}?every claim a commit body or a PR body asserts needs its settling command re-run at the commit that ships it, and written inline beside it/,
320
+ "the hand-over enumeration no longer names this rule as one to give every implementer — a controller relaying the list drops it",
321
+ );
322
+ const phase0 = flatten(
323
+ between(RUN_TEAM, PHASE0_FROM, PHASE0_TO, "the phase-0 hand-over enumeration"),
324
+ );
325
+ assert.match(
326
+ phase0,
327
+ phrase("a settling command re-run and written inline for every claim that goes into the commit or PR body"),
328
+ "the phase-0 summary of what phase 2 hands the implementer no longer names the commit/PR-body rule",
329
+ );
330
+ assert.match(
331
+ phase0,
332
+ phrase("never a count in prose"),
333
+ "the phase-0 summary lost the anti-count rule — it was absent here before #402 and is the same defect",
334
+ );
335
+ });
336
+
337
+ test("both hand-over enumerations name the literal-text -F rule too — #1087 earns it the list's own criterion", () => {
338
+ // #1087, follow-up (#2109). The rule the paragraph below states in full —
339
+ // "A settling command over literal text uses `grep -F`, and its zero
340
+ // counts only after the same command finds a line known to match" —
341
+ // reached neither enumeration when #2104 shipped it: #2109's own
342
+ // `sed -n '598,608p;2565,2579p' SKILL.md | grep -cF -- '-F'` returned 0
343
+ // against the pre-PR tree, scoped to exactly those two enumerations. The
344
+ // wider rule() slice below is not 0 there — it already carries the
345
+ // rule's own pre-existing paragraph further down the same block, which
346
+ // already said `-F`.
347
+ //
348
+ // The "Two of the rules above" list earns a new member by the SAME
349
+ // criterion it already states for its other members: a measured incident.
350
+ // #1087 is that incident here, and it fired TWICE in one run — two
351
+ // members, two different literal patterns, each read as a regex, each
352
+ // answering the benign zero — the same shape the list's own opening
353
+ // paragraph cites for #756/#768.
354
+ assert.match(
355
+ rule(),
356
+ phrase("a settling command over literal text uses `grep -F`"),
357
+ "the hand-over list no longer tells an implementer that literal text is grepped with -F",
358
+ );
359
+ assert.match(
360
+ rule(),
361
+ phrase("its zero counts only after the same command, with the same flags, finds a line known to match"),
362
+ "the hand-over list no longer requires a zero to be checked against a known match before it is trusted",
363
+ );
364
+ const phase0 = flatten(
365
+ between(RUN_TEAM, PHASE0_FROM, PHASE0_TO, "the phase-0 hand-over enumeration"),
366
+ );
367
+ assert.match(
368
+ phase0,
369
+ phrase("literal text grepped with `-F`"),
370
+ "the phase-0 summary no longer tells the implementer that literal text is grepped with -F",
371
+ );
372
+ assert.match(
373
+ phase0,
374
+ phrase("its zero trusted only after the same command, with the same flags, finds a known match"),
375
+ "the phase-0 summary lost the positive-control half of the -F rule",
376
+ );
377
+ });
378
+
379
+ test("a rewrapped rule still matches — these pins refuse drift, not reflow", () => {
380
+ // The ACCEPT side. Re-wrapping this paragraph is not drift, and a pin that
381
+ // reddened on it would be deleted by the next person who reflowed the file.
382
+ // The fixture is DERIVED from the live text, never a quoted line: a quoted
383
+ // one turns every reword into a red on the fixture guard rather than on the
384
+ // pin, which is an accept control that reddens on the edits it exists to
385
+ // accept.
386
+ const raw = between(RUN_TEAM, FROM, TO, "the immutable-body claim rule");
387
+ const body = raw.replace(/\n*#*\s*$/, "");
388
+ // Re-wrapped narrower than the file's ~80 columns, so every wrap point lands
389
+ // somewhere different from today's. At word boundaries, not one word per
390
+ // line: an unconditional break would split the slice's own opening anchor and
391
+ // red this test on the anchor rather than on the pin.
392
+ const words = body.split(/\s+/).filter(Boolean);
393
+ const lines = words.reduce((acc, w) => {
394
+ const last = acc[acc.length - 1];
395
+ if (last && `${last} ${w}`.length <= 45) acc[acc.length - 1] = `${last} ${w}`;
396
+ else acc.push(w);
397
+ return acc;
398
+ }, []);
399
+ const narrow = lines.join("\n");
400
+ // Load-bearing: it reds if the source is already at this width, which would
401
+ // make the rewrap a no-op and this whole test vacuous.
402
+ assert.notEqual(narrow, body, "the rewrap fixture no longer changes the rule's wrapping — update it");
403
+ // Replacer function, not a replacement string: `$&`, `$'` and `` $` `` are
404
+ // interpreted in the latter, and this slice carries a `$` today in `%b`'s
405
+ // neighbourhood the moment anyone adds a shell variable to the example.
406
+ const flat = flatten(between(RUN_TEAM.replace(raw, () => narrow), FROM, TO, "rewrapped rule"));
407
+ assert.match(flat, phrase("re-run at the commit that ships it, not at the commit that motivated it"));
408
+ assert.match(flat, phrase("the command goes inline, beside the claim"));
409
+ assert.match(flat, phrase("that answers which ones depend on its contents"));
410
+ assert.match(flat, phrase("A zero or an absence counts only after the same command, with the same flags, finds a line known to match"));
411
+ assert.match(flat, phrase("a settling command over literal text uses `grep -F`"));
412
+ assert.match(flat, phrase("its zero counts only after the same command, with the same flags, finds a line known to match"));
413
+ });