@feigi/fleet-ctl 3.23.35 → 3.23.37

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 (204) hide show
  1. package/package.json +1 -1
  2. package/scripts/main-checkout.mjs +1 -1
  3. package/scripts/member-write-guard.mjs +1 -1
  4. package/scripts/repo-root.mjs +1 -1
  5. package/skills/run-team/references/reaping.md +1 -1
  6. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  7. package/scripts/agent-test.test.mjs +0 -1640
  8. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  9. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  10. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  11. package/scripts/apply-ruleset.test.mjs +0 -421
  12. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  13. package/scripts/arg.test.mjs +0 -1354
  14. package/scripts/board-cli.test.mjs +0 -710
  15. package/scripts/board-identity.test.mjs +0 -429
  16. package/scripts/board-liveness-banner.test.mjs +0 -119
  17. package/scripts/board-prev-shape.test.mjs +0 -228
  18. package/scripts/board-tryparse-null.test.mjs +0 -119
  19. package/scripts/board.test.mjs +0 -3121
  20. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  21. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  22. package/scripts/candidates.test.mjs +0 -2312
  23. package/scripts/caveat-unification-prose.test.mjs +0 -98
  24. package/scripts/cell-readout.test.mjs +0 -615
  25. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  26. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  27. package/scripts/ci-state-prose.test.mjs +0 -113
  28. package/scripts/ci-state.test.mjs +0 -1933
  29. package/scripts/ci-vacuous-green.test.mjs +0 -368
  30. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  31. package/scripts/claim-lifecycle.test.mjs +0 -187
  32. package/scripts/claim-ticket.test.mjs +0 -1122
  33. package/scripts/closing-keyword-prose.test.mjs +0 -193
  34. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  35. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  36. package/scripts/compute-board.test.mjs +0 -1214
  37. package/scripts/compute-spend.test.mjs +0 -517
  38. package/scripts/consumer-technology-prose.test.mjs +0 -126
  39. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  40. package/scripts/cwd-isolation-pins.mjs +0 -83
  41. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  42. package/scripts/delete-merged-branch.test.mjs +0 -576
  43. package/scripts/derive-testcmd.test.mjs +0 -595
  44. package/scripts/diff-stats.test.mjs +0 -404
  45. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  46. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  47. package/scripts/dispositions-check.test.mjs +0 -936
  48. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  49. package/scripts/drop-merged-label.test.mjs +0 -479
  50. package/scripts/exec-stub.mjs +0 -93
  51. package/scripts/exec-stub.test.mjs +0 -69
  52. package/scripts/expected-jobs-prose.test.mjs +0 -80
  53. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  54. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  55. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  56. package/scripts/finisher-died-prose.test.mjs +0 -31
  57. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  58. package/scripts/finisher-halt-prose.test.mjs +0 -106
  59. package/scripts/finisher-name-prose.test.mjs +0 -134
  60. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  61. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  62. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  63. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  64. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  65. package/scripts/fleet-bootstrap.test.mjs +0 -75
  66. package/scripts/fleet-heartbeat.test.mjs +0 -450
  67. package/scripts/fleet-provenance.test.mjs +0 -138
  68. package/scripts/fleet-run.test.mjs +0 -90
  69. package/scripts/fleet-state.test.mjs +0 -460
  70. package/scripts/fleet-tick-prose.test.mjs +0 -300
  71. package/scripts/fleet-tick.test.mjs +0 -2444
  72. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  73. package/scripts/frontmatter-check.test.mjs +0 -436
  74. package/scripts/git-env.test.mjs +0 -149
  75. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  76. package/scripts/gone-walk.test.mjs +0 -213
  77. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  78. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  79. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  80. package/scripts/implementer-model-tier.test.mjs +0 -235
  81. package/scripts/inflight-citation-prose.test.mjs +0 -144
  82. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  83. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  84. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  85. package/scripts/inflight.test.mjs +0 -2882
  86. package/scripts/injection-control-prose.test.mjs +0 -404
  87. package/scripts/install-root-audit.test.mjs +0 -464
  88. package/scripts/instrument-check-prose.test.mjs +0 -235
  89. package/scripts/instruments.test.mjs +0 -787
  90. package/scripts/is-cli.test.mjs +0 -99
  91. package/scripts/issue-tracker-prose.test.mjs +0 -71
  92. package/scripts/json.test.mjs +0 -364
  93. package/scripts/ledger-dispatch.test.mjs +0 -927
  94. package/scripts/ledger-grammar.test.mjs +0 -227
  95. package/scripts/ledger-read-require-file.test.mjs +0 -197
  96. package/scripts/ledger-rotate.test.mjs +0 -142
  97. package/scripts/ledger.test.mjs +0 -3436
  98. package/scripts/line-distance-prose.test.mjs +0 -245
  99. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  100. package/scripts/locale-pin-prose.test.mjs +0 -189
  101. package/scripts/main-checkout.test.mjs +0 -332
  102. package/scripts/member-outcome-prose.test.mjs +0 -167
  103. package/scripts/member-outcomes-header.test.mjs +0 -129
  104. package/scripts/member-outcomes-prose.test.mjs +0 -63
  105. package/scripts/member-outcomes.test.mjs +0 -638
  106. package/scripts/member-prompt-prose.test.mjs +0 -165
  107. package/scripts/member-record.test.mjs +0 -541
  108. package/scripts/member-write-guard.test.mjs +0 -214
  109. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  110. package/scripts/merge-gate.test.mjs +0 -613
  111. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  112. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  113. package/scripts/net-watchdog-prose.test.mjs +0 -79
  114. package/scripts/net.test.mjs +0 -211
  115. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  116. package/scripts/no-undo-audit.test.mjs +0 -3961
  117. package/scripts/no-wave.test.mjs +0 -138
  118. package/scripts/node-floor-sweep.test.mjs +0 -611
  119. package/scripts/pointer-target-prose.test.mjs +0 -186
  120. package/scripts/pr-cost.test.mjs +0 -521
  121. package/scripts/pr-overlap.test.mjs +0 -692
  122. package/scripts/printf-die-sweep.test.mjs +0 -384
  123. package/scripts/prompt-renderer.mjs +0 -40
  124. package/scripts/prompt-renderer.test.mjs +0 -68
  125. package/scripts/prose-pin.mjs +0 -807
  126. package/scripts/prose-pin.test.mjs +0 -1034
  127. package/scripts/prove-merge.test.mjs +0 -995
  128. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  129. package/scripts/quiet-payload-prose.test.mjs +0 -222
  130. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  131. package/scripts/reap.test.mjs +0 -4432
  132. package/scripts/reaping-prose.test.mjs +0 -239
  133. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  134. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  135. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  136. package/scripts/recipe-prove.test.mjs +0 -1042
  137. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  138. package/scripts/release-label-required-prose.test.mjs +0 -71
  139. package/scripts/release-label-split-prose.test.mjs +0 -184
  140. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  141. package/scripts/release-ticket.test.mjs +0 -5099
  142. package/scripts/renovate-release-contract.test.mjs +0 -379
  143. package/scripts/repo-root.test.mjs +0 -873
  144. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  145. package/scripts/review-agent-report-only.test.mjs +0 -49
  146. package/scripts/review-core-booking.test.mjs +0 -35
  147. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  148. package/scripts/review-core-reads.test.mjs +0 -478
  149. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  150. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  151. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  152. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  153. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  154. package/scripts/review-core-testcmd.test.mjs +0 -335
  155. package/scripts/review-core-unrun.test.mjs +0 -566
  156. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  157. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  158. package/scripts/review-host-fixture.mjs +0 -89
  159. package/scripts/review-in-run-retry.test.mjs +0 -211
  160. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  161. package/scripts/review-path-default.test.mjs +0 -796
  162. package/scripts/review-runner-spawns.test.mjs +0 -95
  163. package/scripts/review-runner.test.mjs +0 -166
  164. package/scripts/review-tier-audit.test.mjs +0 -140
  165. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  166. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  167. package/scripts/run-team-local-hook.test.mjs +0 -442
  168. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  169. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  170. package/scripts/section-between-guard-prose.test.mjs +0 -379
  171. package/scripts/select-dimensions.test.mjs +0 -674
  172. package/scripts/shared-refusal.test.mjs +0 -388
  173. package/scripts/shell-traps-prose.test.mjs +0 -504
  174. package/scripts/shortlist.test.mjs +0 -380
  175. package/scripts/slow-transport.mjs +0 -72
  176. package/scripts/snapshot-repo.test.mjs +0 -1006
  177. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  178. package/scripts/spend-view.test.mjs +0 -312
  179. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  180. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  181. package/scripts/staleness.test.mjs +0 -893
  182. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  183. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  184. package/scripts/strip-comments.mjs +0 -44
  185. package/scripts/temp-dir.mjs +0 -47
  186. package/scripts/ticket-router.test.mjs +0 -981
  187. package/scripts/tier-check.test.mjs +0 -828
  188. package/scripts/tier-outcomes-header.test.mjs +0 -518
  189. package/scripts/tier-outcomes.test.mjs +0 -572
  190. package/scripts/tier-roles.test.mjs +0 -535
  191. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  192. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  193. package/scripts/unattended-git-sweep.test.mjs +0 -142
  194. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  195. package/scripts/verify-sha.test.mjs +0 -692
  196. package/scripts/watcher-degraded-block.test.mjs +0 -369
  197. package/scripts/watcher-key-prose.test.mjs +0 -106
  198. package/scripts/within-run-pair-prose.test.mjs +0 -212
  199. package/scripts/worktree-audit.test.mjs +0 -1408
  200. package/scripts/worktree-head-prose.test.mjs +0 -276
  201. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  202. package/scripts/worktree-model-prose.test.mjs +0 -216
  203. package/scripts/worktree-porcelain.mjs +0 -35
  204. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,149 +0,0 @@
1
- // #1802 (spec docs/specs/2026-09-24-slot-based-fleet-loop-design.md § 3 §4,
2
- // §8). The fix-applier now reads the review off `<scratch>/review-<pr>.json`
3
- // and owns every per-PR ruling the controller used to make before dispatch —
4
- // both mutual-exclusion scans, the suggested-fix re-derivation, `refuted=false`
5
- // ≠ apply, per-site measurement for a sibling-site extension, and reading
6
- // `testEnvironment`/`cwdAudit` before acting on a result of the shared test
7
- // run. Their new home is review-and-fix.md's `## The review result file`, which
8
- // is the copy the fix-applier reads. The controller-side copies in
9
- // run-team/SKILL.md are due to be retired once the controller stops making
10
- // these rulings (§ 8), and a retirement that loses the destination copy too
11
- // would leave the rulings made by nobody, with every pin that read SKILL.md
12
- // simply deleted alongside it.
13
- //
14
- // Two halves. The recipes half is not prose: a `jq` path naming a field the
15
- // result does not carry prints `null` at exit 0, which reads exactly like an
16
- // empty bucket — so every top-level field the recipes read is checked against
17
- // the keys the review really returns (DIGEST_KEYS + the bulk arrays, the order
18
- // review-in-run-retry.test.mjs holds both review bodies to by running them).
19
- import { test } from "node:test";
20
- import assert from "node:assert/strict";
21
- import { readFileSync } from "node:fs";
22
- import { join } from "node:path";
23
- import { between, paragraph, phrase } from "./prose-pin.mjs";
24
- import { DIGEST_KEYS } from "./review-core.mjs";
25
-
26
- const REPO = join(import.meta.dirname, "..");
27
- const DOC = readFileSync(join(REPO, "commands", "review-and-fix.md"), "utf8");
28
- const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
29
- const RESULT_KEYS = new Set([...DIGEST_KEYS, "snapshot", "survived", "refuted", "unverified"]);
30
-
31
- const section = () => between(DOC, "\n## The review result file\n", "\n## Specialists\n", "review-and-fix.md's result-file section");
32
- const ruling = (lead) => {
33
- // One paragraph per ruling: the document writes one line per paragraph, so
34
- // the paragraph is the line the bold lead-in opens.
35
- const line = section().split("\n").find((l) => l.startsWith(lead));
36
- assert.ok(line, `review-and-fix.md's result-file section no longer opens a paragraph with ${JSON.stringify(lead)}`);
37
- return line;
38
- };
39
-
40
- test("the fix-applier reads the review off the result file, at the path the runner and the controller write", () => {
41
- assert.match(section(), phrase("`<scratch>/review-<pr>.json`"));
42
- // Step 1's fix-applier branch is what sends a fix-applier here at all.
43
- const step1 = between(DOC, "1. Run the review yourself.", "\n2. Plan the actions.", "review-and-fix.md step 1");
44
- assert.match(step1, phrase("see **The review result file**"), "step 1 no longer points a fix-applier at the result file");
45
- });
46
-
47
- test("every top-level field the jq recipes read is a field the review returns", () => {
48
- const recipes = section().match(/^jq .*$/gm) ?? [];
49
- assert.ok(recipes.length >= 5, `found ${recipes.length} jq recipes — the section lost its reading recipes`);
50
- const read = new Set();
51
- for (const line of recipes) {
52
- const program = line.match(/'([^']*)'/)?.[1];
53
- assert.ok(program, `a jq recipe has no single-quoted program: ${line}`);
54
- // A projection `{a, b}` reads each name; otherwise the program's first
55
- // path segment is the field it reads (`.survived`, `[.unverified[] | ...`).
56
- const projection = program.match(/^\{([^}]*)\}$/);
57
- if (projection) for (const k of projection[1].split(",")) read.add(k.trim());
58
- else read.add(program.match(/\.(\w+)/)[1]);
59
- }
60
- for (const field of read) {
61
- assert.ok(RESULT_KEYS.has(field), `a jq recipe reads .${field}, which the review result does not carry — it would print null at exit 0`);
62
- }
63
- // Both inputs every other ruling depends on must actually be read.
64
- for (const field of ["survived", "unverified", "refuted", "counts", "testEnvironment", "cwdAudit", "dimensionsUnrun", "resume"]) {
65
- assert.ok(read.has(field), `no jq recipe reads .${field}`);
66
- }
67
- });
68
-
69
- test("the crash populations are told apart off refutersDispatched in the recipes, never off severity", () => {
70
- const recipes = (section().match(/^jq .*$/gm) ?? []).join("\n");
71
- assert.match(recipes, /select\(\.refutersDispatched > 0\)/);
72
- assert.match(recipes, /select\(\.refutersDispatched == 0\)/);
73
- });
74
-
75
- // The recipes' comments are prose no ruling paragraph's pin reads. The one on
76
- // the testEnvironment recipe says what that field is evidence about: the
77
- // review's one shared test run, which no specialist returns a copy of, so no
78
- // recipe comment names a specialist `test_run` field that no longer exists.
79
- test("the testEnvironment recipe calls it evidence about the shared test run, and no recipe comment names a test_run field", () => {
80
- const recipes = section().match(/^jq .*$/gm) ?? [];
81
- const line = recipes.find((l) => l.startsWith("jq -r '.testEnvironment' "));
82
- assert.ok(line, "the result-file section no longer has a `jq -r '.testEnvironment'` recipe");
83
- assert.match(line, phrase("# what the shared test run is evidence about"), "the testEnvironment recipe's comment no longer names the shared test run");
84
- // Every line of every fenced recipe block, not only the `jq ` ones: the `R=`
85
- // line and any other line the block grows carry comments too.
86
- const fenced = [...section().matchAll(/^```bash\n([\s\S]*?)^```$/gm)].flatMap((m) => m[1].split("\n"));
87
- assert.ok(fenced.length > 0, "the result-file section lost its fenced recipe block");
88
- for (const l of fenced) assert.doesNotMatch(l, /test_run/i, `a recipe line names the retired test_run field: ${l}`);
89
- });
90
-
91
- test("the fix-applier owns the mutual-exclusion scan, run twice, with a single refuter for a conflicting pair", () => {
92
- const p = ruling("**Scan the findings against each other for MUTUAL EXCLUSION");
93
- assert.match(p, phrase("run it twice"));
94
- assert.match(p, phrase("**Before you apply anything**"));
95
- assert.match(p, phrase("**Then as each refuter you dispatch reports**"));
96
- assert.match(p, phrase("**A conflicting pair goes to a SINGLE refuter, briefed with both claims**"));
97
- });
98
-
99
- test("the fix-applier owns the suggested-fix re-derivation, ordered so the tree to derive from exists", () => {
100
- const p = ruling("**A finding whose suggested fix quotes text another applied finding deletes");
101
- assert.match(p, phrase("**Re-derive, never copy:**"));
102
- assert.match(p, phrase("apply the finding that changes the text first"));
103
- });
104
-
105
- test("the fix-applier owns refuted=false ≠ apply, and per-site measurement for a sibling-site extension", () => {
106
- assert.match(ruling("**A `refuted=false` verdict is not an instruction to apply.**"), phrase("is a defer"));
107
- assert.match(
108
- ruling("**Extending a finding to sibling sites is a new claim at every added site"),
109
- phrase("never on a copied one"),
110
- );
111
- });
112
-
113
- test("the fix-applier reads testEnvironment and cwdAudit before acting on any result of the shared test run, and re-runs nothing", () => {
114
- const p = ruling("**Read `testEnvironment` and `cwdAudit` before you act on any result of the shared test run.**");
115
- assert.match(p, phrase("status --porcelain -uall"), "the cwdAudit check lost its explicit untracked mode");
116
- assert.match(p, phrase("never revert content you did not write"));
117
- assert.match(p, phrase("re-run nothing"), "a dimensionsUnrun entry now reads as an instruction to re-run the review");
118
- });
119
-
120
- // The two run-team/SKILL.md sentences that hand the fix-applier the same ruling
121
- // were reworded off the specialists' retired `test_run` field (#2374), and
122
- // nothing read either one. They go with the rest of the SKILL.md copies (§ 8).
123
- test("run-team's digest paragraph tells the controller the fix-applier reads testEnvironment before acting on any count from the shared test run", () => {
124
- const p = paragraph(
125
- RUN_TEAM,
126
- "`testEnvironment` says what the review's shared test run is evidence about",
127
- "run-team/SKILL.md's testEnvironment digest paragraph",
128
- { emphasisTolerant: true },
129
- );
130
- assert.match(
131
- p,
132
- phrase("fix-applier reads it before acting on any count from the shared test run"),
133
- "the digest paragraph no longer says the fix-applier reads testEnvironment before acting on a count from the shared test run",
134
- );
135
- });
136
-
137
- test("run-team's fix-applier dispatch hands it testEnvironment and cwdAudit before any result of the shared test run", () => {
138
- const p = between(
139
- RUN_TEAM,
140
- "\n**Then dispatch a fix-applier** — on `DISPATCH fix-pr PR#<M>`",
141
- "\n**A `DISPATCH fix-pr PR#<M>` on a conflict hold**",
142
- "run-team/SKILL.md's fix-applier dispatch paragraph",
143
- );
144
- assert.match(
145
- p,
146
- phrase("`testEnvironment`/`cwdAudit` before any result of the shared test run."),
147
- "the fix-applier dispatch paragraph no longer says to read testEnvironment/cwdAudit before a result of the shared test run",
148
- );
149
- });
@@ -1,75 +0,0 @@
1
- // fleet-bootstrap's checkout-vs-install decision (ADR 0003 point 4, ADR
2
- // 0021): it places `~/.fleet/bin/fleet-run` from its own sibling copy, and
3
- // only without `--from-checkout` when its own directory's parent IS the
4
- // realpath of `~/.omp/plugins/node_modules/@feigi/fleet-ctl`. Driven through
5
- // the real CLI — the script reads `__dirname` and `os.homedir()` and
6
- // `process.exit()`s — so the installed shape runs a copy placed inside a fake
7
- // install's scripts/.
8
- //
9
- // Every fixture's env is built from scratch (never `...process.env`), so
10
- // these tests are deterministic regardless of the box they run on.
11
- import { test } from "node:test";
12
- import assert from "node:assert/strict";
13
- import { spawnSync } from "node:child_process";
14
- import { copyFileSync, existsSync, mkdtempSync, mkdirSync, readFileSync, writeFileSync, symlinkSync } from "node:fs";
15
- import { tmpdir } from "node:os";
16
- import { join } from "node:path";
17
- import { fileURLToPath } from "node:url";
18
-
19
- const BOOTSTRAP = fileURLToPath(new URL("./fleet-bootstrap", import.meta.url));
20
- const CHECKOUT_RESOLVER = fileURLToPath(new URL("./fleet-run", import.meta.url));
21
-
22
- function runBootstrap(script, home, args = []) {
23
- return spawnSync(process.execPath, [script, ...args], {
24
- encoding: "utf8",
25
- env: { HOME: home, PATH: process.env.PATH },
26
- });
27
- }
28
-
29
- // A linked install (the dev-loop shape, and a marketplace install's): a
30
- // payload dir carrying fleet-bootstrap and a resolver in scripts/,
31
- // symlinked into node_modules/@feigi/fleet-ctl.
32
- function fakeInstall() {
33
- const home = mkdtempSync(join(tmpdir(), "fleet-bootstrap-home-"));
34
- const payload = join(home, "checkout", "plugin");
35
- mkdirSync(join(payload, "scripts"), { recursive: true });
36
- copyFileSync(BOOTSTRAP, join(payload, "scripts", "fleet-bootstrap"));
37
- writeFileSync(join(payload, "scripts", "fleet-run"), "installed resolver\n");
38
- const nm = join(home, ".omp", "plugins", "node_modules");
39
- mkdirSync(join(nm, "@feigi"), { recursive: true });
40
- symlinkSync(payload, join(nm, "@feigi", "fleet-ctl"));
41
- return { home, installedBootstrap: join(payload, "scripts", "fleet-bootstrap") };
42
- }
43
-
44
- const placed = (home) => join(home, ".fleet", "bin", "fleet-run");
45
-
46
- test("run from the install root it places the installed resolver with no flag and no exception notice", () => {
47
- const { home, installedBootstrap } = fakeInstall();
48
- const r = runBootstrap(installedBootstrap, home);
49
- assert.equal(r.status, 0, `expected the install run to proceed, got status ${r.status}: ${r.stderr}`);
50
- assert.doesNotMatch(r.stderr, /BOOTSTRAP EXCEPTION/);
51
- assert.equal(readFileSync(placed(home), "utf8"), "installed resolver\n");
52
- });
53
-
54
- test("run from a checkout that is not the install root without --from-checkout: exit 2, nothing placed", () => {
55
- const { home } = fakeInstall();
56
- const r = runBootstrap(BOOTSTRAP, home);
57
- assert.equal(r.status, 2, `expected a refusal, got status ${r.status}: ${r.stdout}${r.stderr}`);
58
- assert.match(r.stderr, /refusing to place .* which is not omp's resolved install root/);
59
- assert.equal(existsSync(placed(home)), false);
60
- });
61
-
62
- test("run from a checkout with no install at all: the refusal says omp is not installed", () => {
63
- const home = mkdtempSync(join(tmpdir(), "fleet-bootstrap-home-"));
64
- const r = runBootstrap(BOOTSTRAP, home);
65
- assert.equal(r.status, 2, `expected a refusal, got status ${r.status}: ${r.stdout}${r.stderr}`);
66
- assert.match(r.stderr, /omp: not installed/);
67
- });
68
-
69
- test("run from a checkout with --from-checkout: places the checkout's resolver and announces the exception", () => {
70
- const { home } = fakeInstall();
71
- const r = runBootstrap(BOOTSTRAP, home, ["--from-checkout"]);
72
- assert.equal(r.status, 0, `expected the licensed exception to proceed, got status ${r.status}: ${r.stderr}`);
73
- assert.match(r.stderr, /BOOTSTRAP EXCEPTION/);
74
- assert.deepEqual(readFileSync(placed(home)), readFileSync(CHECKOUT_RESOLVER));
75
- });