@codyswann/lisa 5.1.5 → 5.1.7

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 (84) hide show
  1. package/README.md +4 -2
  2. package/cdk/package-lisa/package.lisa.json +4 -4
  3. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  4. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  5. package/dist/core/upstream-evidence-manifest.js +11 -8
  6. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  7. package/harper-fabric/package-lisa/package.lisa.json +2 -2
  8. package/nestjs/package-lisa/package.lisa.json +4 -4
  9. package/npm-package/package-lisa/package.lisa.json +2 -2
  10. package/package.json +9 -9
  11. package/phaser/package-lisa/package.lisa.json +2 -2
  12. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  13. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  14. package/plugins/lisa/.codex-plugin/skills/lisa-learnings-audit/SKILL.md +63 -1
  15. package/plugins/lisa/skills/lisa-learnings-audit/SKILL.md +63 -1
  16. package/plugins/lisa-agy/plugin.json +1 -1
  17. package/plugins/lisa-agy/skills/lisa-learnings-audit/SKILL.md +63 -1
  18. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  19. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  21. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  23. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  25. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-copilot/skills/lisa-learnings-audit/SKILL.md +63 -1
  27. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-cursor/skills/lisa-learnings-audit/SKILL.md +63 -1
  29. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  31. package/plugins/lisa-devin/skills/lisa-learnings-audit/SKILL.md +63 -1
  32. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  34. package/plugins/lisa-expo-agy/plugin.json +1 -1
  35. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  48. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  49. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  53. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  55. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  56. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  62. package/plugins/lisa-rails-agy/plugin.json +1 -1
  63. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  69. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  70. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  74. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  76. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  77. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  81. package/plugins/src/base/skills/lisa-learnings-audit/SKILL.md +63 -1
  82. package/scripts/check-npm-install-compat.mjs +316 -0
  83. package/scripts/two-channel-couplings.json +30 -6
  84. package/typescript/package-lisa/package.lisa.json +4 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -179,6 +179,10 @@ one exists) must show:
179
179
  alone.
180
180
  - Per skipped candidate: which dedupe hit suppressed it (open ticket URL,
181
181
  done ticket, or rejection date).
182
+ - Per PROMOTE/DEMOTE ticket, the destination-validation record (Ticket
183
+ emission): destinations checked, missing, and created as new; line pointers
184
+ pinned (with the SHA) or dropped; and counts reconciled — or, for a refused
185
+ ticket, the refusal and the mismatch that caused it.
182
186
  - For `nothing-needed`: the thresholds nothing met, in one line.
183
187
 
184
188
  The tickets themselves are the durable artifacts; the report is how a human
@@ -221,6 +225,8 @@ audits the auditor without re-running it.
221
225
  is **advisory**: it returns `rung`, `scope`, `rationale`, and
222
226
  `drafted_artifact`; the gardener decides whether the evidence clears the
223
227
  filing bar and attaches the router's draft to the ticket.
228
+ Before step 4, run the destination-validation check (Ticket emission) on
229
+ every PROMOTE/DEMOTE draft; a draft that fails it is refused, not filed.
224
230
  4. **Emit** (see Ticket emission).
225
231
  5. **Report and record** the run outcome and one-line summary — post the
226
232
  outcome, then record **exactly one** run-record line through the CLI (see
@@ -256,6 +262,54 @@ into the always-loaded rules"`, which stamps the auditable `[lisa-human-gate]`
256
262
  marker. Every other build-ready ticket passes `build_ready: true`. The hold is
257
263
  declared, never implied by an omitted flag.
258
264
 
265
+ <!-- destination-validation:start -->
266
+ **Destination and count validation (before filing any PROMOTE / DEMOTE).**
267
+ The router's draft says *where* the builder should make the change and *how
268
+ much* evidence backs it. Neither is trusted until checked, because a ticket
269
+ pointing at a section that does not exist, or quoting a figure its own
270
+ evidence contradicts, sends the builder to re-derive everything by hand.
271
+ Validate against the default branch of the repository the ticket targets,
272
+ and resolve its head `<sha>` once per run:
273
+
274
+ - **This repository** (`project` scope) — run `git fetch origin <default>`
275
+ first, then `git rev-parse origin/<default>` once for the SHA. Read every
276
+ file at that SHA, never at the moving `origin/<default>`:
277
+ `git cat-file -t <sha>:<path>` must print `blob` (a `tree` is a directory,
278
+ not a file), then `git show <sha>:<path>` for its text.
279
+ - **Upstream** (`upstream` scope) — the paths live in `<upstreamRepo>`, not
280
+ this checkout: `gh api repos/<upstreamRepo>/commits/<default> --jq .sha`
281
+ for the SHA, then for each file
282
+ `gh api -H "Accept: application/vnd.github.raw" repos/<upstreamRepo>/contents/<path>?ref=<sha>`,
283
+ which returns the raw text so headings are searchable (the default JSON
284
+ response is base64-encoded). A response that lists entries means the path
285
+ is a directory, not a file.
286
+
287
+ 1. **Destinations** — fetch every file the ticket names as above; for every
288
+ heading or section, search that file for it. A destination that exists is
289
+ cited as existing. A section the builder must *create* is labelled **new**
290
+ in the ticket, never cited as existing. A file that does not exist is
291
+ always listed in `destinations_missing`; it is then either relabelled as a
292
+ **new file** the builder creates (and also listed in `destinations_new`),
293
+ or, if the draft depends on it already existing, the ticket is **refused**.
294
+ 2. **Line pointers** — drop them, or recompute each one against `<sha>` and
295
+ write that SHA beside it ("line 42 at `<sha>`") so anyone can re-check it
296
+ later. Never copy a pointer from the draft unchecked.
297
+ 3. **Counts** — every count the ticket attributes to its cited evidence
298
+ ("12 of 12 entries", "17 occurrences") is recounted from that evidence.
299
+ Template wording such as "all four legs" and pinned line numbers are not
300
+ counts. On any mismatch the ticket is **refused**: it is not filed, and
301
+ neither side is quietly corrected. The mismatch (both figures and where
302
+ each came from) goes in the run report (Proof) so a person can see what
303
+ disagreed.
304
+
305
+ A refused ticket is not a run failure: the run continues with the other
306
+ candidates and reports the refusal in the run report (Proof). Record per
307
+ ticket in the run report (Proof): `destinations_checked`,
308
+ `destinations_missing`, `destinations_new`, `pointers` (`pinned` with
309
+ `pointer_sha`, or `dropped`), and `counts_reconciled: yes`, or
310
+ `refused: <reason>`.
311
+ <!-- destination-validation:end -->
312
+
259
313
  **Per-item tickets — PROMOTE / DEMOTE** (`issue_type: Task`; GitHub trackers
260
314
  carry the `type:Task` label) — one ticket per recommendation, capped by
261
315
  `max_candidates`:
@@ -267,7 +321,10 @@ carry the `type:Task` label) — one ticket per recommendation, capped by
267
321
  owner).
268
322
  - The router's **`drafted_artifact`** verbatim (the lint/hook sketch +
269
323
  diagnostic text, proposed rule text, skill outline, page outline, or
270
- redundancy proof).
324
+ redundancy proof), embedded only after the destination-validation edits
325
+ above are applied to it: a section that does not exist is relabelled
326
+ **new**, each line pointer is dropped or pinned to `<sha>`, and a draft
327
+ whose counts disagree with its evidence is refused rather than embedded.
271
328
  - For **EXECUTABLE-CONTROL** promotions, embed the promotion-contract AC
272
329
  template below **verbatim** (markers included — do not paraphrase, reorder,
273
330
  or partially quote it; it is the single source of truth from the
@@ -472,6 +529,11 @@ exact so nothing regresses:
472
529
  escalated per Escalation with the operator-readable reason; **or**
473
530
  **`approval-requested`** when the run finished and is waiting on a human gate
474
531
  rather than being broken.
532
+ A run that filed nothing because destination-validation (Ticket emission)
533
+ refused every PROMOTE/DEMOTE draft records **`approval-requested`** —
534
+ never `nothing-needed`. Its `--summary` states each mismatch as a question
535
+ for a person ("evidence says 17, draft says 12 — which is right?") and
536
+ says that every run will refuse that draft again until someone answers.
475
537
 
476
538
  The gardener also newly reaches **`policy-obsolete`** — the Retirement
477
539
  condition below tripped and it filed its own teardown proposal. It never
@@ -0,0 +1,316 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Prove the packed `@codyswann/lisa` tarball installs under every npm version
4
+ * a host may run (CodySwannGT/lisa#4871).
5
+ *
6
+ * Measured defect: a plain `npm install @codyswann/lisa` under npm 10.9.9
7
+ * crashed with `Cannot read properties of null (reading 'edgesOut')`. npm 10's
8
+ * arborist resolves peer dependencies in a scratch tree that ignores the
9
+ * installing package's own pins; a Vitest 4 dependency reached Vitest 5 there
10
+ * through vite's optional devtools peer chain, a Vitest 4 browser package then
11
+ * orphaned that node, and arborist dereferenced its null parent. npm 11 handles
12
+ * the same graph, so a check run only under npm 11 would never have seen it.
13
+ *
14
+ * The check installs the real tarball into a fresh empty directory once per
15
+ * npm version and refuses on any signal that the install did not happen as
16
+ * claimed, because each alone has a gap:
17
+ * - the npm that ran is not the npm requested (a silent fallback to the
18
+ * runner's own npm would test the wrong resolver);
19
+ * - a non-zero exit, or a spawn that never produced one;
20
+ * - the `edgesOut` crash text, in case a future npm logs it without failing;
21
+ * - no installed manifest, or one whose version is not the tarball's (an exit
22
+ * 0 that installed nothing, or something else, is not this install).
23
+ *
24
+ * Usage: `node scripts/check-npm-install-compat.mjs [--tarball <tgz>]
25
+ * [--npm 10.9.9,11.6.2]`. With no tarball the repository is packed with
26
+ * `npm pack --ignore-scripts` into a temporary directory.
27
+ * @module scripts/check-npm-install-compat
28
+ */
29
+ import {
30
+ existsSync,
31
+ mkdtempSync,
32
+ readFileSync,
33
+ readdirSync,
34
+ rmSync,
35
+ } from "node:fs";
36
+ import os from "node:os";
37
+ import path from "node:path";
38
+ import process from "node:process";
39
+ import { fileURLToPath } from "node:url";
40
+
41
+ import { boundedSpawnSync } from "./lib/bounded-spawn.mjs";
42
+ import { invokedAsScript } from "./lib/invoked-as-script.mjs";
43
+
44
+ /** npm versions every Lisa release must install under. */
45
+ export const DEFAULT_NPM_VERSIONS = Object.freeze(["10.9.9", "11.6.2"]);
46
+
47
+ /** The crash signature of npm 10's arborist peer-set defect. */
48
+ const CRASH_SIGNATURE = "edgesOut";
49
+
50
+ /** Installed manifest whose presence proves the install placed Lisa. */
51
+ const INSTALLED_MANIFEST = "node_modules/@codyswann/lisa/package.json";
52
+
53
+ /** A cold install of Lisa's dependency tree takes minutes, not seconds. */
54
+ const INSTALL_BUDGET_MS = 15 * 60_000;
55
+
56
+ const REPO_ROOT = path.resolve(
57
+ path.dirname(fileURLToPath(import.meta.url)),
58
+ ".."
59
+ );
60
+
61
+ /**
62
+ * Read one CLI option's value, refusing a flag left without one.
63
+ * @param {readonly string[]} argv - CLI arguments
64
+ * @param {string} name - Flag name
65
+ * @returns {string | undefined} The value, or undefined when absent
66
+ */
67
+ function optionValue(argv, name) {
68
+ const index = argv.indexOf(name);
69
+ if (index === -1) return undefined;
70
+ const value = argv[index + 1];
71
+ if (!value || value.startsWith("--")) {
72
+ throw new Error(`${name} needs a value`);
73
+ }
74
+ return value;
75
+ }
76
+
77
+ /**
78
+ * Parse the CLI arguments.
79
+ * @param {readonly string[]} argv - CLI arguments
80
+ * @returns {{tarball: string | undefined, npmVersions: string[]}} Options
81
+ */
82
+ export function parseArgs(argv) {
83
+ const versions = optionValue(argv, "--npm");
84
+ const npmVersions =
85
+ versions === undefined
86
+ ? [...DEFAULT_NPM_VERSIONS]
87
+ : versions
88
+ .split(",")
89
+ .map(version => version.trim())
90
+ .filter(Boolean);
91
+ if (npmVersions.length === 0) {
92
+ // An empty list would check nothing and report success.
93
+ throw new Error("--npm needs at least one version");
94
+ }
95
+ return { tarball: optionValue(argv, "--tarball"), npmVersions };
96
+ }
97
+
98
+ /**
99
+ * The most useful npm error line in an install transcript.
100
+ * @param {string} output - Combined install stdout and stderr
101
+ * @returns {string} The crash line, else the first `npm error` line, else ""
102
+ */
103
+ function errorLine(output) {
104
+ const lines = output.split("\n").map(line => line.trim());
105
+ return (
106
+ lines.find(line => line.includes(CRASH_SIGNATURE)) ??
107
+ lines.find(line => line.startsWith("npm error")) ??
108
+ ""
109
+ );
110
+ }
111
+
112
+ /**
113
+ * @typedef {object} InstallOutcome
114
+ * @property {string} npmReported - What `npm --version` printed for the npx-run npm
115
+ * @property {number | null} status - Install exit status; null when spawn failed
116
+ * @property {string} output - Combined install stdout and stderr
117
+ * @property {string} [error] - Spawn error message, when the child never ran
118
+ * @property {string | null} installedVersion - Installed Lisa version, or null when absent
119
+ */
120
+
121
+ /**
122
+ * Ordered refusal rules; the first that returns a reason decides.
123
+ * @type {readonly ((expected: {npmVersion: string, packageVersion: string}, outcome: InstallOutcome) => string)[]}
124
+ */
125
+ const RULES = Object.freeze([
126
+ (expected, outcome) =>
127
+ outcome.npmReported === expected.npmVersion
128
+ ? ""
129
+ : `npx ran npm ${outcome.npmReported || "(nothing)"}, not the requested npm ${expected.npmVersion}`,
130
+ (_expected, outcome) => {
131
+ if (outcome.status === 0) return "";
132
+ const quoted = errorLine(outcome.output) || outcome.error;
133
+ const detail = [`npm install exited ${outcome.status}`, quoted];
134
+ return detail.filter(Boolean).join(": ");
135
+ },
136
+ (_expected, outcome) =>
137
+ outcome.output.includes(CRASH_SIGNATURE)
138
+ ? `install output contains "${CRASH_SIGNATURE}": ${errorLine(outcome.output)}`
139
+ : "",
140
+ (_expected, outcome) =>
141
+ outcome.installedVersion === null
142
+ ? `install exited 0 but ${INSTALLED_MANIFEST} is missing`
143
+ : "",
144
+ (expected, outcome) =>
145
+ outcome.installedVersion === expected.packageVersion
146
+ ? ""
147
+ : `installed @codyswann/lisa ${outcome.installedVersion}, but the tarball is ${expected.packageVersion}`,
148
+ ]);
149
+
150
+ /**
151
+ * Decide whether one install proves compatibility.
152
+ * @param {{npmVersion: string, packageVersion: string}} expected - Requested npm and the tarball's version
153
+ * @param {InstallOutcome} outcome - What the install did
154
+ * @returns {{npmVersion: string, ok: boolean, reason: string}} Verdict
155
+ */
156
+ export function evaluateInstall(expected, outcome) {
157
+ const reason = RULES.map(rule => rule(expected, outcome)).find(Boolean) ?? "";
158
+ return { npmVersion: expected.npmVersion, ok: reason === "", reason };
159
+ }
160
+
161
+ /**
162
+ * Install the tarball under each npm version and judge each install.
163
+ * @param {{tarball: string, packageVersion: string}} candidate - Tarball and its version
164
+ * @param {readonly string[]} npmVersions - npm versions to try
165
+ * @param {(tarball: string, npmVersion: string) => InstallOutcome} install - Installer
166
+ * @returns {{npmVersion: string, ok: boolean, reason: string}[]} Verdicts
167
+ */
168
+ export function runChecks(candidate, npmVersions, install) {
169
+ return npmVersions.map(npmVersion =>
170
+ evaluateInstall(
171
+ { npmVersion, packageVersion: candidate.packageVersion },
172
+ install(candidate.tarball, npmVersion)
173
+ )
174
+ );
175
+ }
176
+
177
+ /**
178
+ * Render verdicts for an operator.
179
+ * @param {readonly {npmVersion: string, ok: boolean, reason: string}[]} results - Verdicts
180
+ * @returns {string} One line per npm version, plus a summary
181
+ */
182
+ export function formatReport(results) {
183
+ const lines = results.map(result =>
184
+ result.ok
185
+ ? `PASS npm ${result.npmVersion}: @codyswann/lisa installed\n`
186
+ : `FAIL npm ${result.npmVersion}: ${result.reason}\n`
187
+ );
188
+ const failed = results.filter(result => !result.ok).length;
189
+ const summary =
190
+ failed === 0
191
+ ? "Lisa installs cleanly under every checked npm version.\n"
192
+ : `Lisa does not install under ${failed} of ${results.length} npm version(s). A host on that npm cannot install Lisa; fix the published dependency graph before release.\n`;
193
+ return [...lines, summary].join("");
194
+ }
195
+
196
+ /**
197
+ * Run `npx -y npm@<version>` with arguments in a directory.
198
+ * @param {string} directory - Working directory
199
+ * @param {string} npmVersion - npm version npx should fetch
200
+ * @param {readonly string[]} args - npm arguments
201
+ * @returns {import("node:child_process").SpawnSyncReturns<string>} Result
202
+ */
203
+ function npx(directory, npmVersion, args) {
204
+ return boundedSpawnSync("npx", ["-y", `npm@${npmVersion}`, ...args], {
205
+ cwd: directory,
206
+ encoding: "utf8",
207
+ timeout: INSTALL_BUDGET_MS,
208
+ });
209
+ }
210
+
211
+ /**
212
+ * Read the installed Lisa version, if any.
213
+ * @param {string} directory - Install directory
214
+ * @returns {string | null} Installed version, or null when not installed
215
+ */
216
+ function installedVersionIn(directory) {
217
+ const manifest = path.join(directory, INSTALLED_MANIFEST);
218
+ if (!existsSync(manifest)) return null;
219
+ return JSON.parse(readFileSync(manifest, "utf8")).version ?? "";
220
+ }
221
+
222
+ /**
223
+ * Install a tarball into a fresh empty directory with one npm version.
224
+ * @param {string} tarball - Packed tarball path
225
+ * @param {string} npmVersion - npm version to run through npx
226
+ * @returns {InstallOutcome} Outcome
227
+ */
228
+ function installWithNpm(tarball, npmVersion) {
229
+ const directory = mkdtempSync(path.join(os.tmpdir(), "lisa-npm-compat-"));
230
+ try {
231
+ const reported = npx(directory, npmVersion, ["--version"]);
232
+ const result = npx(directory, npmVersion, [
233
+ "install",
234
+ "--ignore-scripts",
235
+ "--no-audit",
236
+ "--no-fund",
237
+ tarball,
238
+ ]);
239
+ return {
240
+ npmReported: (reported.stdout ?? "").trim(),
241
+ status: result.status,
242
+ output: `${result.stdout ?? ""}${result.stderr ?? ""}`,
243
+ error: result.error?.message,
244
+ installedVersion: installedVersionIn(directory),
245
+ };
246
+ } finally {
247
+ rmSync(directory, { recursive: true, force: true });
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Read the version a packed tarball declares.
253
+ * @param {string} tarball - Packed tarball path
254
+ * @returns {string} The tarball's package.json version
255
+ */
256
+ function tarballVersion(tarball) {
257
+ const result = boundedSpawnSync(
258
+ "tar",
259
+ ["-xOzf", tarball, "package/package.json"],
260
+ { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 }
261
+ );
262
+ if (result.status !== 0) {
263
+ throw new Error(`cannot read package.json from ${tarball}`);
264
+ }
265
+ return JSON.parse(result.stdout).version;
266
+ }
267
+
268
+ /**
269
+ * Pack this repository into a temporary directory.
270
+ * @returns {string} Path of the packed tarball
271
+ */
272
+ function packRepository() {
273
+ const destination = mkdtempSync(path.join(os.tmpdir(), "lisa-npm-pack-"));
274
+ const result = boundedSpawnSync(
275
+ "npm",
276
+ ["pack", "--ignore-scripts", "--pack-destination", destination],
277
+ { cwd: REPO_ROOT, encoding: "utf8", timeout: INSTALL_BUDGET_MS }
278
+ );
279
+ const tarball = readdirSync(destination).find(name => name.endsWith(".tgz"));
280
+ if (result.status !== 0 || !tarball) {
281
+ throw new Error(`npm pack failed: ${result.stderr ?? ""}`.trim());
282
+ }
283
+ return path.join(destination, tarball);
284
+ }
285
+
286
+ /**
287
+ * Run the check.
288
+ * @param {readonly string[]} argv - CLI arguments
289
+ * @param {{install?: typeof installWithNpm, pack?: () => string, readVersion?: (tarball: string) => string, write?: (text: string) => void}} [deps] - Injected effects
290
+ * @returns {number} Process exit code
291
+ */
292
+ export function main(argv, deps = {}) {
293
+ const {
294
+ install = installWithNpm,
295
+ pack = packRepository,
296
+ readVersion = tarballVersion,
297
+ write = text => process.stdout.write(text),
298
+ } = deps;
299
+ const options = parseArgs(argv);
300
+ // Absolute, because the install runs in a temp directory: a relative
301
+ // `--tarball` would resolve against a different cwd there than here.
302
+ const tarball = path.resolve(options.tarball ?? pack());
303
+ const candidate = { tarball, packageVersion: readVersion(tarball) };
304
+ const results = runChecks(candidate, options.npmVersions, install);
305
+ write(formatReport(results));
306
+ return results.every(result => result.ok) ? 0 : 1;
307
+ }
308
+
309
+ if (invokedAsScript(import.meta.url)) {
310
+ try {
311
+ process.exitCode = main(process.argv.slice(2));
312
+ } catch (error) {
313
+ process.stderr.write(`check-npm-install-compat: ${error.message}\n`);
314
+ process.exitCode = 1;
315
+ }
316
+ }
@@ -2,7 +2,8 @@
2
2
  "ratified": {
3
3
  "quality.yml::scripts/check-learnings-budget.ts": "Lisa-source-only branch, and the else arm is the delivery. The step tests for BOTH scripts/check-learnings-budget.ts and src/core/learnings-budget-check.ts, which co-exist only in this repository; every consumer takes the else arm and runs the prover as `bunx @codyswann/lisa@<their own declared version>`, which is the PACKAGE channel and not a caller-tree read at all. A trailing `grep -qE \"learnings budget (passed|saturated)|no learnings file\"` then refuses a run that printed no verdict, so the arm cannot pass vacuously. Ratified because the caller-tree read is unreachable outside this repository, not because the gap is tolerated.",
4
4
  "quality.yml::scripts/generate-nightly-e2e-guard-certificate.mjs": "Lisa-source-only branch. Both reusable jobs require `github.repository == 'CodySwannGT/lisa'` before the step can start, and the run body repeats that exact repository guard before checking this artifact path. Ordinary and private host callers therefore skip the step without reading or fetching from their own tree. The scoped branch fetches only the immutable refs needed to behavior-test Lisa's own retained certificate inputs. Ratified because the caller-tree read is unreachable outside this repository, not because an undelivered host dependency is tolerated.",
5
- "quality.yml::scripts/verify-host-name-target-scope.mjs": "Lisa-source-only regression proof. Two steps execute this driver, each behind `github.repository == 'CodySwannGT/lisa'`: the enforcing `🔒 Enforce host-name target scope` step in `test_unit` (also gated on `steps.gate_run.outcome == 'success'`), and the named host-name target-scope step in the Lisa-only `test_named_regression_specs` job, whose job-level `if:` carries the same repository guard. Every host caller skips both without reading this path. Ratified because the caller-tree read is unreachable outside this repository; no host dependency is introduced."
5
+ "quality.yml::scripts/verify-host-name-target-scope.mjs": "Lisa-source-only regression proof. Two steps execute this driver, each behind `github.repository == 'CodySwannGT/lisa'`: the enforcing `🔒 Enforce host-name target scope` step in `test_unit` (also gated on `steps.gate_run.outcome == 'success'`), and the named host-name target-scope step in the Lisa-only `test_named_regression_specs` job, whose job-level `if:` carries the same repository guard. Every host caller skips both without reading this path. Ratified because the caller-tree read is unreachable outside this repository; no host dependency is introduced.",
6
+ "publish-to-npm.yml::scripts/check-npm-install-compat.mjs": "Lisa-source-only release gate. The step requires `github.repository == 'CodySwannGT/lisa'` before it can start, and the run body repeats that exact repository guard (failing loudly, never passing vacuously) before reading this path. Host callers reaching publish-to-npm.yml at @main skip the step without reading their own tree. The script installs Lisa's own packed release tarball under npm 10.9.9 and 11.6.2 (CodySwannGT/lisa#4871). Ratified because the caller-tree read is unreachable outside this repository, not because an undelivered host dependency is tolerated."
6
7
  },
7
8
  "staleness": {
8
9
  "npm-updater.yml::scripts/lisa-npm-updater.mjs": {
@@ -116,30 +117,34 @@
116
117
  "quality.yml::scripts/verify-host-name-target-scope.mjs": {
117
118
  "decision": "not-needed",
118
119
  "reason": "Unreachable outside this repository under the exact step-level repository guard ratified above. The driver and its cases run from the same Lisa checkout as the hooks under test. No consuming caller reads its installed or caller-tree copy through this workflow step, so no independently versioned consumer copy participates in this coupling."
120
+ },
121
+ "publish-to-npm.yml::scripts/check-npm-install-compat.mjs": {
122
+ "decision": "not-needed",
123
+ "reason": "Lisa-source-only. The script and the workflow that runs it change together in this repository's own release commit, so no superseded copy can sit in front of a newer workflow; host callers never reach the read."
119
124
  }
120
125
  },
121
126
  "inspected": {
122
127
  "workflows": 26,
123
- "steps": 834,
124
- "couplings": 40,
128
+ "steps": 835,
129
+ "couplings": 41,
125
130
  "inventory": 224
126
131
  },
127
132
  "counts": {
128
133
  "package-backed": 11,
129
134
  "apply-lagged": 26,
130
135
  "never-delivered": 0,
131
- "undelivered": 3
136
+ "undelivered": 4
132
137
  },
133
138
  "detectionCounts": {
134
139
  "version-handshake": 4,
135
140
  "capability-probe": 0,
136
141
  "existence-only": 5,
137
142
  "no-probe": 17,
138
- "unchecked": 3
143
+ "unchecked": 4
139
144
  },
140
145
  "decisionCounts": {
141
146
  "handshake": 4,
142
- "not-needed": 14,
147
+ "not-needed": 15,
143
148
  "warranted": 11
144
149
  },
145
150
  "couplings": [
@@ -360,6 +365,25 @@
360
365
  ],
361
366
  "detail": "`npm-updater.yml` is delivered at `@main`, so this step is live in every consumer on their next run. It reads `scripts/lisa-npm-updater.mjs` from the CALLER's tree with no package-relative candidate, and Lisa delivers that path on the `lisa apply` channel (all/copy-overwrite). The two halves land in the wrong order: this step is live everywhere immediately, the file it needs is live only where somebody applied. No existence test guards the read, which is ALL this scan examined of the step's control flow: it did not read anything that could absorb the failure. An absent path most likely fails the job loudly — the better of the two failures, because it is visible — but that is inferred from the missing guard, NOT MEASURED. The step's text does carry `exit-nonzero` — located in the step, deliberately NOT related to this read, and enough to make \"it skips silently\" a claim to check rather than assume. STALENESS (a separate dimension from the delivery verdict above): `no-probe`. Neither an existence test nor a version probe bears on this read, so nothing here distinguishes a current artifact from an absent or a superseded one. None of the staleness tokens this scan can see (`artifact-declares-version`, `artifact-answers-version`, `step-requests-version`, `workflow-requests-version`) were found."
362
367
  },
368
+ {
369
+ "key": "publish-to-npm.yml::scripts/check-npm-install-compat.mjs",
370
+ "workflow": "publish-to-npm.yml",
371
+ "path": "scripts/check-npm-install-compat.mjs",
372
+ "channel": "undelivered",
373
+ "verdict": "undelivered",
374
+ "remedy": "author-the-artifact",
375
+ "guarded": false,
376
+ "handling": [
377
+ "exit-nonzero",
378
+ "error-annotation"
379
+ ],
380
+ "detection": "unchecked",
381
+ "stalenessSignals": [],
382
+ "decision": "not-needed",
383
+ "reason": "Lisa-source-only. The script and the workflow that runs it change together in this repository's own release commit, so no superseded copy can sit in front of a newer workflow; host callers never reach the read.",
384
+ "lanes": [],
385
+ "detail": "`publish-to-npm.yml` is delivered at `@main`, so this step is live in every consumer on their next run. It reads `scripts/check-npm-install-compat.mjs` from the CALLER's tree, and Lisa ships no such path in any delivery lane — no apply and no bump ever produces it. Either the consumer authors it, or whatever the step does where the path is missing runs instead — and that branch is the part this scan does not read. No existence test guards the read, which is ALL this scan examined of the step's control flow: it did not read anything that could absorb the failure. An absent path most likely fails the job loudly — the better of the two failures, because it is visible — but that is inferred from the missing guard, NOT MEASURED. The step's text does carry `exit-nonzero`, `error-annotation` — located in the step, deliberately NOT related to this read, and enough to make \"it skips silently\" a claim to check rather than assume. STALENESS (a separate dimension from the delivery verdict above): `unchecked`. Lisa delivers nothing at this path, so there is no artifact to ask whether it could answer a version. The staleness half is UNKNOWN here — not current, and not probe-less. None of the staleness tokens this scan can see (`artifact-declares-version`, `artifact-answers-version`, `step-requests-version`, `workflow-requests-version`) were found."
386
+ },
363
387
  {
364
388
  "key": "publish-to-npm.yml::scripts/check-npm-publish-landed.mjs",
365
389
  "workflow": "publish-to-npm.yml",
@@ -35,8 +35,8 @@
35
35
  "eslint-plugin-oxlint": ">=1.62.0 <1.86.0",
36
36
  "oxlint": ">=1.62.0 <1.86.0",
37
37
  "oxlint-tsgolint": "^0.24.0",
38
- "@stryker-mutator/core": "^9.0.0",
39
- "@stryker-mutator/vitest-runner": "^9.0.0",
38
+ "@stryker-mutator/core": "^10.1.1",
39
+ "@stryker-mutator/vitest-runner": "^10.1.1",
40
40
  "fast-check": "^4.9.0"
41
41
  },
42
42
  "resolutions": {
@@ -73,12 +73,12 @@
73
73
  "defaults": {
74
74
  "devDependencies": {
75
75
  "@ast-grep/cli": "^0.40.4",
76
- "@vitest/coverage-v8": "^4.1.11",
76
+ "@vitest/coverage-v8": "^5.1.0",
77
77
  "eslint": "^9.39.5",
78
78
  "husky": "^8.0.0",
79
79
  "prettier": "3.8.0",
80
80
  "typescript": "^6.0.3",
81
- "vitest": "^4.1.11"
81
+ "vitest": "^5.1.0"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "node scripts/lib/worktree-dependencies.mjs && tsc",