@codyswann/lisa 4.90.0 → 4.90.1

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 (139) hide show
  1. package/all/copy-overwrite/scripts/lisa-enforcement-fallback.sh +2 -2
  2. package/all/copy-overwrite/scripts/lisa-enforcement-freshness.mjs +1 -2
  3. package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net.sh +9 -3634
  4. package/all/copy-overwrite/scripts/lisa-postinstall.mjs +16 -5
  5. package/dist/cli/apply.d.ts.map +1 -1
  6. package/dist/cli/apply.js +25 -4
  7. package/dist/cli/apply.js.map +1 -1
  8. package/dist/cli/lisa-test-run-process-group.d.ts.map +1 -1
  9. package/dist/cli/lisa-test-run-process-group.js +19 -2
  10. package/dist/cli/lisa-test-run-process-group.js.map +1 -1
  11. package/dist/core/bootstrap-environment.d.ts +10 -1
  12. package/dist/core/bootstrap-environment.d.ts.map +1 -1
  13. package/dist/core/bootstrap-environment.js +14 -5
  14. package/dist/core/bootstrap-environment.js.map +1 -1
  15. package/dist/core/enforcement-coverage.d.ts +2 -2
  16. package/dist/core/enforcement-coverage.d.ts.map +1 -1
  17. package/dist/core/enforcement-coverage.js +2 -3
  18. package/dist/core/enforcement-coverage.js.map +1 -1
  19. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  20. package/dist/core/lisa-owned-hash-ledger.js +10 -0
  21. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  22. package/dist/core/native-safety-net-retirement.d.ts +13 -0
  23. package/dist/core/native-safety-net-retirement.d.ts.map +1 -0
  24. package/dist/core/native-safety-net-retirement.js +23 -0
  25. package/dist/core/native-safety-net-retirement.js.map +1 -0
  26. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  27. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  28. package/dist/core/upstream-evidence-manifest.js +39 -53
  29. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  30. package/dist/migrations/index.d.ts +1 -0
  31. package/dist/migrations/index.d.ts.map +1 -1
  32. package/dist/migrations/index.js +3 -0
  33. package/dist/migrations/index.js.map +1 -1
  34. package/dist/migrations/retire-native-safety-net.d.ts +18 -0
  35. package/dist/migrations/retire-native-safety-net.d.ts.map +1 -0
  36. package/dist/migrations/retire-native-safety-net.js +36 -0
  37. package/dist/migrations/retire-native-safety-net.js.map +1 -0
  38. package/dist/opencode/plugin-catalog.d.ts.map +1 -1
  39. package/dist/opencode/plugin-catalog.js +1 -0
  40. package/dist/opencode/plugin-catalog.js.map +1 -1
  41. package/dist/opencode/plugin-templates/lisa-parity-safety-net.ts +2 -48
  42. package/dist/opencode/plugin-templates/parity-safety-net.sh +9 -3634
  43. package/package.json +8 -6
  44. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  46. package/plugins/lisa/hooks/parity-safety-net.agy.sh +5 -49
  47. package/plugins/lisa/hooks/parity-safety-net.sh +9 -3634
  48. package/plugins/lisa-agy/hooks/parity-safety-net.agy.sh +5 -49
  49. package/plugins/lisa-agy/hooks/parity-safety-net.sh +9 -3634
  50. package/plugins/lisa-agy/plugin.json +1 -1
  51. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  53. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  54. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  58. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-copilot/hooks/parity-safety-net.sh +9 -3634
  60. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-cursor/hooks/parity-safety-net.sh +9 -3634
  62. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  64. package/plugins/lisa-devin/hooks/parity-safety-net.sh +9 -3634
  65. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  67. package/plugins/lisa-expo-agy/plugin.json +1 -1
  68. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  72. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  74. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  75. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  79. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  81. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  82. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  86. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  88. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  89. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  93. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  95. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  96. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  100. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  102. package/plugins/lisa-rails-agy/plugin.json +1 -1
  103. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  105. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  106. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  107. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  109. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  110. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  113. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  114. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  115. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  116. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  117. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  118. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  119. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  120. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  121. package/plugins/src/base/hooks/parity-safety-net.agy.sh +5 -49
  122. package/plugins/src/base/hooks/parity-safety-net.sh +9 -3634
  123. package/scripts/build-plugins.sh +3 -0
  124. package/scripts/check-generated-artifact-merge-coverage.mjs +7 -0
  125. package/scripts/fixtures/native-safety-net-retirement/Dockerfile +5 -0
  126. package/scripts/fixtures/native-safety-net-retirement/invoke-opencode.mjs +13 -0
  127. package/scripts/fixtures/native-safety-net-retirement/isolated-linker.mjs +101 -0
  128. package/scripts/fixtures/native-safety-net-retirement/journey.mjs +381 -0
  129. package/scripts/fixtures/native-safety-net-retirement/probes.mjs +208 -0
  130. package/scripts/fixtures/native-safety-net-retirement/reduced-core.mjs +93 -0
  131. package/scripts/generate-lisa-owned-hash-ledger.mjs +1 -1
  132. package/scripts/generate-retired-safety-net-manifest.mjs +56 -0
  133. package/scripts/install-claude-plugins.sh +9 -5
  134. package/scripts/lib/retired-safety-net-manifest.json +150 -0
  135. package/scripts/lisa-enforcement-fallback.sh +2 -2
  136. package/scripts/lisa-enforcement-freshness.mjs +1 -2
  137. package/scripts/remedy-conformance.mjs +5 -1
  138. package/scripts/retire-native-safety-net.mjs +237 -0
  139. package/scripts/verify-native-safety-net-retirement.mjs +287 -0
@@ -352,3 +352,6 @@ for agent in "${PER_AGENT_VARIANTS[@]}"; do
352
352
  build_per_agent_variant "$agent" "$src_name" "$out_name"
353
353
  done
354
354
  done
355
+
356
+ # Historical ownership plus the newly emitted compatibility handlers must agree.
357
+ node "$ROOT_DIR/scripts/generate-retired-safety-net-manifest.mjs"
@@ -80,6 +80,13 @@ export const DISPOSITION = Object.freeze({
80
80
  * fifth artifact cannot join `check:artifacts` without also appearing here.
81
81
  */
82
82
  export const GENERATED_ARTIFACTS = Object.freeze([
83
+ Object.freeze({
84
+ path: "scripts/lib/retired-safety-net-manifest.json",
85
+ check: "check:retired-safety-net-manifest",
86
+ disposition: DISPOSITION.UNSUPPORTED,
87
+ reason:
88
+ "nested: each entry contains source, hashes and current shim bytes; the flat merge parser cannot preserve that ownership contract",
89
+ }),
83
90
  Object.freeze({
84
91
  path: "src/core/upstream-evidence-manifest.ts",
85
92
  check: "check:upstream-evidence-manifest",
@@ -0,0 +1,5 @@
1
+ FROM oven/bun:1.4.4 AS bun
2
+ FROM node:24.21.0-bookworm-slim
3
+ RUN apt-get update && apt-get install -y --no-install-recommends bash git jq python3 ca-certificates && rm -rf /var/lib/apt/lists/*
4
+ COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
5
+ WORKDIR /
@@ -0,0 +1,13 @@
1
+ const mod = await import(process.argv[2]);
2
+ const hook = await mod[process.argv[3]]();
3
+ try {
4
+ await hook["tool.execute.before"](
5
+ { tool: "bash" },
6
+ { args: { command: process.argv[4] } }
7
+ );
8
+ console.log(JSON.stringify({ decision: "allow" }));
9
+ } catch (error) {
10
+ console.log(
11
+ JSON.stringify({ decision: "deny", reason: String(error.message ?? error) })
12
+ );
13
+ }
@@ -0,0 +1,101 @@
1
+ /** Genuine Bun isolated dependency update with an old executable host fallback. */
2
+ import assert from "node:assert/strict";
3
+ import {
4
+ cpSync,
5
+ existsSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ realpathSync,
9
+ writeFileSync,
10
+ } from "node:fs";
11
+ import { homedir } from "node:os";
12
+ import path from "node:path";
13
+ import { ok, repositoryProbe, sha } from "./probes.mjs";
14
+
15
+ assert.equal(process.platform, "linux");
16
+ assert.ok(existsSync("/.dockerenv"));
17
+ assert.equal(homedir(), "/root");
18
+ const [parentRoot, preview] = process.argv.slice(2);
19
+ const root = "/isolated-linker-project";
20
+ const pkg = path.join(root, "node_modules/@codyswann/lisa");
21
+ const hooks = path.join(root, "scripts/lisa-hooks");
22
+ const target = path.join(hooks, "parity-safety-net.sh");
23
+ const settings = path.join(root, ".claude/settings.json");
24
+ const receipt = path.join(root, ".lisa/apply-receipt.json");
25
+ const config = path.join(root, "bunfig.toml");
26
+ const proof = { root, commands: [], started_at: new Date().toISOString() };
27
+ mkdirSync(root);
28
+ writeFileSync(
29
+ path.join(root, "package.json"),
30
+ '{"name":"isolated-retirement-proof","private":true,"trustedDependencies":["@codyswann/lisa","@ast-grep/cli","@sentry/cli","esbuild"]}\n'
31
+ );
32
+ writeFileSync(config, '[install]\nlinker = "isolated"\n');
33
+ ok(proof, "bun", ["add", "/baseline.tgz"]);
34
+ proof.baseline_package_realpath = realpathSync(pkg);
35
+ assert.ok(proof.baseline_package_realpath.includes("/node_modules/.bun/"));
36
+
37
+ // Seed supported old state from genuine released handlers and the actual
38
+ // baseline-emitted configuration/receipt preserved by the parent journey.
39
+ mkdirSync(path.dirname(hooks), { recursive: true });
40
+ cpSync(path.join(pkg, "all/copy-overwrite/scripts/lisa-hooks"), hooks, {
41
+ recursive: true,
42
+ });
43
+ for (const name of [
44
+ "lisa-enforcement-fallback.sh",
45
+ "lisa-enforcement-freshness.mjs",
46
+ ])
47
+ cpSync(
48
+ path.join(pkg, "all/copy-overwrite/scripts", name),
49
+ path.join(root, "scripts", name)
50
+ );
51
+ mkdirSync(path.dirname(settings), { recursive: true });
52
+ mkdirSync(path.dirname(receipt), { recursive: true });
53
+ cpSync(path.join(parentRoot, ".claude/settings.json"), settings);
54
+ cpSync(path.join(parentRoot, ".lisa/apply-receipt.json"), receipt);
55
+ const preserved = [
56
+ config,
57
+ settings,
58
+ receipt,
59
+ path.join(hooks, "block-no-verify.sh"),
60
+ ];
61
+ const snapshot = () => preserved.map(file => sha(readFileSync(file)));
62
+ const before = snapshot();
63
+ proof.target_before_sha256 = sha(readFileSync(target));
64
+ proof.before = repositoryProbe(proof, "claude", settings, false);
65
+ proof.update = ok(proof, "bun", ["add", "/candidate.tgz"]);
66
+ proof.candidate_package_realpath = realpathSync(pkg);
67
+ assert.ok(proof.candidate_package_realpath.includes("/node_modules/.bun/"));
68
+ proof.candidate_bytes = [];
69
+ for (const name of [
70
+ "scripts/retire-native-safety-net.mjs",
71
+ "plugins/lisa/hooks/parity-safety-net.sh",
72
+ "dist/core/native-safety-net-retirement.js",
73
+ ]) {
74
+ const installed = sha(readFileSync(path.join(pkg, name)));
75
+ const archived = sha(readFileSync(path.join(preview, name)));
76
+ assert.equal(installed, archived, name);
77
+ proof.candidate_bytes.push({ file: name, installed, archived });
78
+ }
79
+ proof.target_after_sha256 = sha(readFileSync(target));
80
+ assert.equal(
81
+ proof.target_after_sha256,
82
+ sha(
83
+ readFileSync(
84
+ path.join(
85
+ preview,
86
+ "all/copy-overwrite/scripts/lisa-hooks",
87
+ path.basename(target)
88
+ )
89
+ )
90
+ )
91
+ );
92
+ proof.after = repositoryProbe(proof, "claude", settings, true);
93
+ assert.deepEqual(snapshot(), before);
94
+ proof.preservation = { files: preserved, before, after: snapshot() };
95
+ proof.completed_at = new Date().toISOString();
96
+ proof.outcome = "PASS: isolated Bun update retires the real host target";
97
+ writeFileSync(
98
+ "/evidence/isolated-linker-proof.json",
99
+ `${JSON.stringify(proof, null, 2)}\n`
100
+ );
101
+ console.log(JSON.stringify(proof));
@@ -0,0 +1,381 @@
1
+ /** Genuine released-package → normal candidate update inside a mount-free VM. */
2
+ import assert from "node:assert/strict";
3
+ import {
4
+ cpSync,
5
+ existsSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ readdirSync,
9
+ writeFileSync,
10
+ } from "node:fs";
11
+ import { homedir } from "node:os";
12
+ import path from "node:path";
13
+ import {
14
+ load,
15
+ ok,
16
+ run,
17
+ openCodeProbe,
18
+ pluginProbe,
19
+ repositoryProbe,
20
+ sha,
21
+ } from "./probes.mjs";
22
+
23
+ assert.equal(process.platform, "linux");
24
+ assert.ok(existsSync("/.dockerenv"));
25
+ assert.equal(homedir(), "/root");
26
+ const root = "/retirement-project";
27
+ const PACKAGE_FILE = "package.json";
28
+ const RECEIPT_FILE = ".lisa/apply-receipt.json";
29
+ const RETIREMENT_ENTRY = "scripts/retire-native-safety-net.mjs";
30
+ const HOST_HOOKS = "scripts/lisa-hooks";
31
+ mkdirSync(root);
32
+ mkdirSync("/evidence", { mode: 0o700 });
33
+ const proof = {
34
+ schema: 1,
35
+ root,
36
+ started_at: new Date().toISOString(),
37
+ boundary:
38
+ "actual emitted registrations and executable handlers; copied installed-handler fixtures are not vendor installations or native sessions",
39
+ commands: [],
40
+ phases: [],
41
+ };
42
+ const pkg = path.join(root, "node_modules/@codyswann/lisa");
43
+ const ports = [
44
+ [
45
+ "claude",
46
+ "lisa",
47
+ ".claude-plugin/plugin.json",
48
+ "/root/.claude/plugins/cache/lisa/lisa/4.90.0",
49
+ ],
50
+ [
51
+ "codex",
52
+ "lisa",
53
+ ".codex-plugin/hooks.json",
54
+ "/root/.codex/plugins/cache/lisa/lisa/4.90.0",
55
+ ],
56
+ [
57
+ "cursor",
58
+ "lisa-cursor",
59
+ "hooks/hooks.json",
60
+ "/root/.cursor/plugins/cache/local/lisa/4.90.0",
61
+ ],
62
+ [
63
+ "copilot",
64
+ "lisa-copilot",
65
+ ".claude-plugin/plugin.json",
66
+ "/root/.copilot/installed-plugins/lisa/lisa",
67
+ ],
68
+ ["devin", "lisa-devin", "hooks.json", "/root/.config/devin/plugins/lisa"],
69
+ ["agy", "lisa-agy", "hooks.json", "/root/.gemini/config/plugins/lisa"],
70
+ ];
71
+
72
+ /** Capture literal file bytes without injecting runtime or credential state. */
73
+ function snapshot(files) {
74
+ return Object.fromEntries(files.map(file => [file, sha(readFileSync(file))]));
75
+ }
76
+
77
+ /** Every concrete owned handler copy under a chosen fixture directory. */
78
+ function handlerFiles(dir) {
79
+ return readdirSync(dir, { recursive: true, withFileTypes: true })
80
+ .filter(
81
+ entry =>
82
+ entry.isFile() &&
83
+ [
84
+ "parity-safety-net.sh",
85
+ "parity-safety-net.agy.sh",
86
+ "lisa-parity-safety-net.ts",
87
+ ].includes(entry.name)
88
+ )
89
+ .map(entry => path.join(entry.parentPath, entry.name));
90
+ }
91
+
92
+ /** Observe package, independent copies and old repository registrations. */
93
+ function probe(phase, retired) {
94
+ const channels = [];
95
+ for (const [agent, port, manifest, installed] of ports) {
96
+ // Agy's emitted command resolves its fixed user plugin path. It is
97
+ // instantiated from delivered bytes, with no vendor registry fabricated.
98
+ if (agent !== "agy")
99
+ channels.push(
100
+ pluginProbe(
101
+ proof,
102
+ agent,
103
+ path.join(pkg, "plugins", port, manifest),
104
+ path.join(pkg, "plugins", port),
105
+ retired,
106
+ "actual packaged registration"
107
+ )
108
+ );
109
+ channels.push(
110
+ pluginProbe(
111
+ proof,
112
+ agent,
113
+ path.join(installed, manifest),
114
+ installed,
115
+ retired,
116
+ "independent copied-handler fixture; not vendor installation"
117
+ )
118
+ );
119
+ }
120
+ channels.push(openCodeProbe(proof, retired));
121
+ const repositories = [
122
+ ["claude", ".claude/settings.json"],
123
+ ["codex", ".codex/hooks.json"],
124
+ ["devin", ".devin/hooks.v1.json"],
125
+ ].map(([agent, file]) =>
126
+ repositoryProbe(proof, agent, path.join(root, file), retired)
127
+ );
128
+ const result = { phase, retired, channels, repositories };
129
+ proof.phases.push(result);
130
+ console.log(
131
+ JSON.stringify({
132
+ phase,
133
+ target: retired ? "allowed" : "refused (retirement assertion RED)",
134
+ unrelated: "refused",
135
+ channels: channels.length,
136
+ repositories: repositories.length,
137
+ })
138
+ );
139
+ }
140
+
141
+ /** Explicit real full apply, separately observed from the install lifecycle. */
142
+ function apply() {
143
+ // The update leg above/below is measured before this separate full-apply
144
+ // leg. Commit fixture changes normally so the clean-tree check stays on.
145
+ if (ok(proof, "git", ["status", "--porcelain"]).stdout.trim()) {
146
+ ok(proof, "git", ["add", "--all"]);
147
+ ok(proof, "git", ["commit", "-m", "Record isolated upgrade fixture"]);
148
+ }
149
+ return run(
150
+ proof,
151
+ process.execPath,
152
+ [
153
+ path.join(pkg, "dist/index.js"),
154
+ "apply",
155
+ root,
156
+ "--yes",
157
+ "--full-apply",
158
+ "--no-update-check",
159
+ "--harness",
160
+ "fleet",
161
+ ],
162
+ { env: { ...process.env, LISA_BOOTSTRAP: "1" } }
163
+ );
164
+ }
165
+
166
+ try {
167
+ assert.match(ok(proof, "node", ["--version"]).stdout, /^v24\.21\.0\s*$/);
168
+ assert.match(ok(proof, "bun", ["--version"]).stdout, /^1\.4\.4\s*$/);
169
+ writeFileSync(
170
+ path.join(root, PACKAGE_FILE),
171
+ `${JSON.stringify({ name: "retirement-proof", private: true, version: "1.0.0", type: "module", trustedDependencies: ["@codyswann/lisa", "@ast-grep/cli", "@sentry/cli", "esbuild"] }, null, 2)}\n`
172
+ );
173
+ writeFileSync(path.join(root, ".gitignore"), "node_modules/\n");
174
+ ok(proof, "bun", ["add", "/baseline.tgz"]);
175
+ assert.equal(load(path.join(pkg, PACKAGE_FILE)).version, "4.90.0");
176
+ assert.equal(
177
+ existsSync(path.join(root, "scripts/lisa-hooks/parity-safety-net.sh")),
178
+ false
179
+ );
180
+ assert.equal(existsSync(path.join(root, RECEIPT_FILE)), false);
181
+ for (const args of [
182
+ ["init", "--initial-branch=main"],
183
+ ["config", "user.name", "Lisa verification"],
184
+ ["config", "user.email", "verification@example.invalid"],
185
+ ["add", "--all"],
186
+ ["commit", "-m", "Initialize isolated baseline"],
187
+ ])
188
+ ok(proof, "git", args);
189
+ apply();
190
+ assert.equal(load(path.join(root, RECEIPT_FILE)).apply_mode, "full");
191
+ for (const [, port, , installed] of ports) {
192
+ mkdirSync(path.dirname(installed), { recursive: true });
193
+ cpSync(path.join(pkg, "plugins", port), installed, { recursive: true });
194
+ }
195
+ probe("released-baseline", false);
196
+
197
+ const reduced = "/reduced-core-project";
198
+ mkdirSync(reduced);
199
+ cpSync(path.join(root, HOST_HOOKS), path.join(reduced, HOST_HOOKS), {
200
+ recursive: true,
201
+ });
202
+ cpSync(
203
+ path.join(pkg, "plugins/lisa-agy/hooks/parity-safety-net.agy.sh"),
204
+ path.join(reduced, "scripts/lisa-hooks/parity-safety-net.agy.sh")
205
+ );
206
+ writeFileSync(
207
+ path.join(reduced, PACKAGE_FILE),
208
+ '{"name":"reduced-proof","private":true,"version":"1.0.0"}\n'
209
+ );
210
+
211
+ const settingsFile = path.join(root, ".claude/settings.json");
212
+ const settings = load(settingsFile);
213
+ settings.operatorSentinel = { preserve: true };
214
+ settings.hooks.PreToolUse.push({
215
+ matcher: "Bash",
216
+ operatorField: "keep",
217
+ hooks: [
218
+ {
219
+ type: "command",
220
+ command: "printf operator-sentinel",
221
+ operatorField: "keep",
222
+ },
223
+ ],
224
+ });
225
+ writeFileSync(settingsFile, `${JSON.stringify(settings, null, 2)}\n`);
226
+ const failure = path.join(root, "node_modules/.lisa/apply-failed.json");
227
+ mkdirSync(path.dirname(failure), { recursive: true });
228
+ writeFileSync(failure, '{"previousFailure":"preserve"}\n');
229
+ const custom = path.join(
230
+ root,
231
+ "plugins/operator-copy/hooks/parity-safety-net.sh"
232
+ );
233
+ mkdirSync(path.dirname(custom), { recursive: true });
234
+ writeFileSync(
235
+ custom,
236
+ `${readFileSync(path.join(pkg, "plugins/lisa/hooks/parity-safety-net.sh"), "utf8")}\n# operator customization\n`
237
+ );
238
+ const preservedFiles = [
239
+ settingsFile,
240
+ failure,
241
+ path.join(root, RECEIPT_FILE),
242
+ custom,
243
+ ...ports.map(([, , , installed]) =>
244
+ path.join(
245
+ installed,
246
+ "hooks",
247
+ installed.includes(".gemini/")
248
+ ? "block-no-verify.agy.sh"
249
+ : "block-no-verify.sh"
250
+ )
251
+ ),
252
+ path.join(root, "scripts/lisa-hooks/block-no-verify.sh"),
253
+ ];
254
+ const before = snapshot(preservedFiles);
255
+ const oldHandlers = [
256
+ ...handlerFiles(path.join(root, HOST_HOOKS)),
257
+ ...handlerFiles(path.join(root, ".opencode/plugin")),
258
+ ...ports.flatMap(([, , , installed]) => handlerFiles(installed)),
259
+ ];
260
+ const oldBytes = snapshot(oldHandlers);
261
+
262
+ // Preview the genuine candidate archive at a dependency-shaped fixture path.
263
+ // This is not an update or a substitute for the lifecycle measured below.
264
+ const preview = "/preview/node_modules/@codyswann/lisa";
265
+ mkdirSync(preview, { recursive: true });
266
+ ok(proof, "tar", [
267
+ "-xzf",
268
+ "/candidate.tgz",
269
+ "--strip-components=1",
270
+ "-C",
271
+ preview,
272
+ ]);
273
+ const dry = ok(proof, process.execPath, [
274
+ path.join(preview, RETIREMENT_ENTRY),
275
+ root,
276
+ "--dry-run",
277
+ "--json",
278
+ ]);
279
+ assert.ok(JSON.parse(dry.stdout).some(row => row.status === "would-retire"));
280
+ assert.deepEqual(snapshot(oldHandlers), oldBytes);
281
+ assert.deepEqual(snapshot(preservedFiles), before);
282
+
283
+ proof.update = ok(proof, "bun", ["add", "/candidate.tgz"]);
284
+ proof.candidate_package = load(path.join(pkg, PACKAGE_FILE));
285
+ const expected = load(path.join(preview, PACKAGE_FILE));
286
+ assert.equal(proof.candidate_package.version, expected.version);
287
+ // A local candidate can have the same version as the baseline: prove bytes,
288
+ // so reusing an old package-manager cache can never masquerade as retirement.
289
+ for (const file of [
290
+ "scripts/retire-native-safety-net.mjs",
291
+ "plugins/lisa/hooks/parity-safety-net.sh",
292
+ "dist/core/native-safety-net-retirement.js",
293
+ ])
294
+ assert.equal(
295
+ sha(readFileSync(path.join(pkg, file))),
296
+ sha(readFileSync(path.join(preview, file))),
297
+ file
298
+ );
299
+ assert.deepEqual(snapshot(preservedFiles), before);
300
+ assert.notDeepEqual(snapshot(oldHandlers), oldBytes);
301
+ probe("normal-package-update-without-apply", true);
302
+ const retiredBytes = snapshot(oldHandlers);
303
+ ok(proof, process.execPath, [path.join(pkg, RETIREMENT_ENTRY), root]);
304
+ assert.deepEqual(snapshot(oldHandlers), retiredBytes);
305
+ assert.deepEqual(snapshot(preservedFiles), before);
306
+ proof.preservation = {
307
+ before,
308
+ after_update: snapshot(preservedFiles),
309
+ old_handlers_before: oldBytes,
310
+ retired_handlers: retiredBytes,
311
+ dry_run_unchanged: true,
312
+ reconciliation_idempotent: true,
313
+ };
314
+
315
+ proof.isolated_linker_update = ok(proof, process.execPath, [
316
+ "/proof/isolated-linker.mjs",
317
+ root,
318
+ preview,
319
+ ]);
320
+
321
+ proof.reduced_core_apply = ok(proof, process.execPath, [
322
+ "/proof/reduced-core.mjs",
323
+ pkg,
324
+ reduced,
325
+ ]);
326
+
327
+ // Legacy direct CLI postinstall must still stand down after target cleanup.
328
+ ok(proof, process.execPath, [
329
+ path.join(pkg, "dist/index.js"),
330
+ "apply",
331
+ root,
332
+ "--postinstall-safe",
333
+ "--yes",
334
+ "--no-update-check",
335
+ ]);
336
+ assert.deepEqual(snapshot(preservedFiles), before);
337
+ if (proof.candidate_package.lisaReleaseCommit) {
338
+ assert.equal(apply().status, 0);
339
+ probe("explicit-full-apply", true);
340
+ const afterApply = snapshot([settingsFile, ...oldHandlers]);
341
+ assert.equal(apply().status, 0);
342
+ assert.deepEqual(snapshot([settingsFile, ...oldHandlers]), afterApply);
343
+ proof.published_full_apply = {
344
+ status: "established",
345
+ repeat_unchanged: true,
346
+ };
347
+ } else {
348
+ // Local packs have no release identity. Keep that existing refusal intact;
349
+ // the published archive must repeat this journey before tracker closure.
350
+ const rejected = apply();
351
+ assert.equal(rejected.status, 1);
352
+ assert.match(rejected.stdout + rejected.stderr, /no release-commit stamp/);
353
+ proof.published_full_apply = {
354
+ status: "not-established",
355
+ reason:
356
+ "Local candidate is unstamped; repeat against the exact published archive",
357
+ release_pin_refusal_preserved: true,
358
+ };
359
+ }
360
+ assert.equal(load(settingsFile).operatorSentinel.preserve, true);
361
+ assert.equal(
362
+ load(settingsFile).enabledPlugins["safety-net@cc-marketplace"],
363
+ false
364
+ );
365
+ proof.outcome =
366
+ "PASS: genuine baseline RED; normal update retires seven handler surfaces and old copies; unrelated refusals and operator/evidence preservation; dry-run and repeat reconciliation unchanged; published full-apply status recorded separately";
367
+ proof.completed_at = new Date().toISOString();
368
+ writeFileSync(
369
+ "/evidence/retirement-proof.json",
370
+ `${JSON.stringify(proof, null, 2)}\n`
371
+ );
372
+ console.log(proof.outcome);
373
+ } catch (error) {
374
+ proof.failure = { message: error.message, stack: error.stack };
375
+ writeFileSync(
376
+ "/evidence/retirement-proof.json",
377
+ `${JSON.stringify(proof, null, 2)}\n`
378
+ );
379
+ console.error(error.stack);
380
+ process.exitCode = 1;
381
+ }