@codyswann/lisa 4.38.2 → 4.38.4

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 (83) hide show
  1. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  2. package/dist/core/lisa-owned-hash-ledger.js +2 -0
  3. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  4. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  5. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  6. package/dist/core/upstream-evidence-manifest.js +17 -5
  7. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  8. package/dist/opencode/hooks-installer.d.ts.map +1 -1
  9. package/dist/opencode/hooks-installer.js +1 -0
  10. package/dist/opencode/hooks-installer.js.map +1 -1
  11. package/dist/opencode/plugin-catalog.d.ts.map +1 -1
  12. package/dist/opencode/plugin-catalog.js +5 -0
  13. package/dist/opencode/plugin-catalog.js.map +1 -1
  14. package/dist/opencode/plugin-templates/block-managed-file-edits.sh +937 -0
  15. package/dist/opencode/plugin-templates/lisa-block-managed-file-edits.ts +83 -0
  16. package/package.json +6 -5
  17. package/plugins/lisa/.claude-plugin/plugin.json +9 -1
  18. package/plugins/lisa/.codex-plugin/hooks.json +8 -0
  19. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  20. package/plugins/lisa/hooks/block-managed-file-edits.agy.sh +63 -0
  21. package/plugins/lisa/hooks/threshold-ratchet-families.mjs +8 -0
  22. package/plugins/lisa-agy/hooks/block-managed-file-edits.agy.sh +63 -0
  23. package/plugins/lisa-agy/hooks/block-managed-file-edits.sh +937 -0
  24. package/plugins/lisa-agy/hooks.json +13 -0
  25. package/plugins/lisa-agy/plugin.json +1 -1
  26. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  27. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  28. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  29. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-copilot/.claude-plugin/plugin.json +9 -1
  32. package/plugins/lisa-copilot/hooks/threshold-ratchet-families.mjs +8 -0
  33. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-cursor/hooks/hooks.json +8 -0
  35. package/plugins/lisa-cursor/hooks/threshold-ratchet-families.mjs +8 -0
  36. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  38. package/plugins/lisa-expo-agy/plugin.json +1 -1
  39. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  44. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-harper-fabric-cursor/.claude-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-openclaw/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  53. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  54. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  59. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  63. package/plugins/lisa-rails-agy/plugin.json +1 -1
  64. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  69. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  73. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  74. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  76. package/plugins/src/base/.claude-plugin/plugin.json +9 -1
  77. package/plugins/src/base/hooks/block-managed-file-edits.agy.sh +63 -0
  78. package/plugins/src/base/hooks/threshold-ratchet-families.mjs +8 -0
  79. package/rails/copy-overwrite/scripts/threshold-ratchet-families.mjs +8 -0
  80. package/scripts/check-typecheck-tests.mjs +147 -0
  81. package/scripts/copy-opencode-plugin-templates.mjs +1 -0
  82. package/scripts/generate-agy-plugin-artifacts.mjs +12 -0
  83. package/typescript/copy-overwrite/scripts/threshold-ratchet-families.mjs +8 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Lisa-managed OpenCode plugin (tool.execute.before).
3
+ *
4
+ * Refuses agent writes to files Lisa overwrites on every apply. Lisa ships
5
+ * templates in three modes and only `copy-overwrite` is unsafe to edit:
6
+ * `copy-contents` appends, so host content survives, and `create-only` is
7
+ * skipped when the file exists, so the host owns it outright.
8
+ *
9
+ * The harm is not deletion, which is what makes it invisible. Measured by
10
+ * mutating four files in a scratch project and running a real `lisa apply`:
11
+ * every edit SURVIVED, and apply reported `Overwritten: 0 files` /
12
+ * `Out of date: 3 files`. So the file silently FORKS — it keeps looking current
13
+ * while every upstream fix stops reaching it, and the only trace is a warning
14
+ * line the next person learns to scroll past.
15
+ *
16
+ * ## Why it shells out
17
+ *
18
+ * Policy stays single-sourced in `block-managed-file-edits.sh`, the canonical
19
+ * guard Claude, Codex, Cursor and Copilot already run, copied beside this module
20
+ * by the installer exactly as `block-no-verify.sh` is. That guard resolves a
21
+ * candidate path against the installed package's `copy-overwrite` trees, the
22
+ * generated-paths module, and the Lisa-owned hash ledger, and it follows a
23
+ * command into the contents of any script it executes. Reimplementing that in
24
+ * TypeScript would be a second thing to harden, and the two would diverge at the
25
+ * first vector closed in only one of them. This adapter converts OpenCode's
26
+ * `bash` tool input into Lisa's canonical Claude Bash-hook envelope, runs the
27
+ * script, and surfaces its refusal.
28
+ *
29
+ * Bash arm only, and deliberately so: OpenCode exposes the shell as the `bash`
30
+ * tool, which is the surface this intercepts. That is the same scope the agy
31
+ * adapter has.
32
+ *
33
+ * NOTE: Lisa copies this template verbatim into `.opencode/plugin/`. It runs
34
+ * under OpenCode's Bun runtime and is excluded from this repository's tsconfig.
35
+ */
36
+ export const LisaBlockManagedFileEdits = async () => ({
37
+ "tool.execute.before": async (
38
+ input: { tool: string },
39
+ output: { args?: { command?: string } }
40
+ ) => {
41
+ if (input.tool !== "bash") return;
42
+ const command = String(output.args?.command ?? "");
43
+ if (!command) return;
44
+
45
+ const hookPath = `${import.meta.dir}/block-managed-file-edits.sh`;
46
+ const processHandle = Bun.spawn(["/bin/bash", hookPath], {
47
+ env: { ...process.env, CLAUDE_PROJECT_DIR: process.cwd() },
48
+ stdin: "pipe",
49
+ stdout: "ignore",
50
+ stderr: "pipe",
51
+ timeout: 2_000,
52
+ killSignal: "SIGKILL",
53
+ });
54
+ processHandle.stdin.write(
55
+ JSON.stringify({ tool_name: "Bash", tool_input: { command } })
56
+ );
57
+ processHandle.stdin.end();
58
+
59
+ const [status, reason] = await Promise.all([
60
+ processHandle.exited,
61
+ new Response(processHandle.stderr).text(),
62
+ ]);
63
+ // Exit 0 is ALLOW, including the canonical script's degraded path when jq
64
+ // or python3 is missing — it says so on stderr and permits the command,
65
+ // which is why stderr alone must never be read as a refusal. Any non-zero
66
+ // status fails closed. Exit 2 is the guard's own policy refusal; any other
67
+ // non-zero status is an adapter/environment failure and must say so rather
68
+ // than falsely accusing the requested command of editing a managed file.
69
+ if (status === 0) return;
70
+ if (status !== 2) {
71
+ throw new Error(
72
+ `block-managed-file-edits: guard environment failure (status ${status}) at ${hookPath}` +
73
+ (reason.trim() ? `: ${reason.trim()}` : "")
74
+ );
75
+ }
76
+ throw new Error(
77
+ reason.trim() ||
78
+ "block-managed-file-edits: this file is Lisa-managed and is replaced by " +
79
+ "`lisa apply`. Edit the template upstream in Lisa, or use the local " +
80
+ "escape hatch beside the file."
81
+ );
82
+ },
83
+ });
package/package.json CHANGED
@@ -18,7 +18,8 @@
18
18
  "lint": "oxlint --disable-nested-config && eslint . --quiet",
19
19
  "lint:fix": "oxlint --fix --disable-nested-config && eslint . --fix",
20
20
  "lint:slow": "eslint . --config eslint.slow.config.ts --quiet",
21
- "typecheck": "tsc --noEmit",
21
+ "typecheck": "tsc --noEmit && bun run typecheck:tests",
22
+ "typecheck:tests": "node scripts/check-typecheck-tests.mjs",
22
23
  "format:check": "prettier --check .",
23
24
  "format": "prettier --check . --write",
24
25
  "knip:check": "knip",
@@ -169,7 +170,7 @@
169
170
  "zod-validation-error": "^4.0.0"
170
171
  },
171
172
  "name": "@codyswann/lisa",
172
- "version": "4.38.2",
173
+ "version": "4.38.4",
173
174
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
174
175
  "main": "dist/index.js",
175
176
  "exports": {
@@ -317,7 +318,7 @@
317
318
  "test": "tests"
318
319
  },
319
320
  "types": "./dist/index.d.ts",
320
- "lisaReleaseCommit": "62b7f7f6571fa343cf1c31c9e460461f597ee9ac",
321
- "gitHead": "62b7f7f6571fa343cf1c31c9e460461f597ee9ac",
322
- "lisaReleaseTag": "v4.38.2"
321
+ "lisaReleaseCommit": "d20fbe65ac04ceb68f58176b43575c9c6c8977a4",
322
+ "gitHead": "d20fbe65ac04ceb68f58176b43575c9c6c8977a4",
323
+ "lisaReleaseTag": "v4.38.4"
323
324
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.38.2",
3
+ "version": "4.38.4",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -145,6 +145,10 @@
145
145
  {
146
146
  "type": "command",
147
147
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-host-name-leak.sh"
148
+ },
149
+ {
150
+ "type": "command",
151
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-managed-file-edits.sh"
148
152
  }
149
153
  ]
150
154
  },
@@ -154,6 +158,10 @@
154
158
  {
155
159
  "type": "command",
156
160
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-instruction-file-edits.sh"
161
+ },
162
+ {
163
+ "type": "command",
164
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-managed-file-edits.sh"
157
165
  }
158
166
  ]
159
167
  },
@@ -85,6 +85,10 @@
85
85
  {
86
86
  "type": "command",
87
87
  "command": "${PLUGIN_ROOT}/hooks/block-host-name-leak.sh"
88
+ },
89
+ {
90
+ "type": "command",
91
+ "command": "${PLUGIN_ROOT}/hooks/block-managed-file-edits.sh"
88
92
  }
89
93
  ]
90
94
  },
@@ -94,6 +98,10 @@
94
98
  {
95
99
  "type": "command",
96
100
  "command": "${PLUGIN_ROOT}/hooks/block-instruction-file-edits.sh"
101
+ },
102
+ {
103
+ "type": "command",
104
+ "command": "${PLUGIN_ROOT}/hooks/block-managed-file-edits.sh"
97
105
  }
98
106
  ]
99
107
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.38.2",
3
+ "version": "4.38.4",
4
4
  "description": "Universal governance: agents, skills, commands, hooks, and rules for all projects.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ # Antigravity (agy) PreToolUse adapter for Lisa's managed-file guard.
3
+ #
4
+ # agy sends `{toolCall:{name:"run_command",args:{CommandLine:"..."}}}` and
5
+ # expects an allow/deny JSON object on stdout. The canonical hook consumes the
6
+ # Claude Bash-hook envelope and communicates denial with exit status 2. This
7
+ # adapter only translates protocols; all classification stays in the canonical
8
+ # block-managed-file-edits.sh beside it (same delegation pattern as
9
+ # block-instruction-file-edits.agy.sh).
10
+ #
11
+ # Scope note: agy plugin hooks match `run_command`, so only the Bash arm of the
12
+ # guard reaches agy — an agy file-edit tool call writing a copy-overwrite
13
+ # template cannot be intercepted. That gap is accepted and recorded here, and in
14
+ # the pull request that added this adapter, rather than papered over. The
15
+ # redirection / append / tee signatures the canonical guard follows into
16
+ # executed scripts still hold on agy, which is the majority of the surface.
17
+ #
18
+ # Fail-open on missing runtimes, matching every sibling adapter. A missed
19
+ # refusal here costs a silently forked template — recoverable, and `lisa apply`
20
+ # reports it as out of date on every subsequent run — where failing closed would
21
+ # block every command on a machine without jq.
22
+ set -uo pipefail
23
+
24
+ allow() {
25
+ printf '%s\n' '{"decision":"allow"}'
26
+ exit 0
27
+ }
28
+
29
+ deny() {
30
+ local reason="$1"
31
+ if command -v jq >/dev/null 2>&1; then
32
+ jq -cn --arg reason "$reason" '{decision:"deny",reason:$reason}'
33
+ else
34
+ printf '%s\n' '{"decision":"allow"}'
35
+ fi
36
+ exit 0
37
+ }
38
+
39
+ input="$(cat 2>/dev/null || true)"
40
+ [ -z "$input" ] && allow
41
+ command -v jq >/dev/null 2>&1 || allow
42
+
43
+ tool_name="$(printf '%s' "$input" | jq -r '.toolCall.name // empty' 2>/dev/null || true)"
44
+ [ "$tool_name" != "run_command" ] && allow
45
+ command_str="$(printf '%s' "$input" | jq -r '.toolCall.args.CommandLine // empty' 2>/dev/null || true)"
46
+ [ -z "$command_str" ] && allow
47
+
48
+ hook_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
49
+ canonical_hook="$hook_dir/block-managed-file-edits.sh"
50
+ [ -r "$canonical_hook" ] || allow
51
+
52
+ canonical_input="$(jq -cn --arg command "$command_str" '{tool_name:"Bash",tool_input:{command:$command}}')"
53
+ canonical_output=""
54
+ canonical_status=0
55
+ if canonical_output="$(printf '%s' "$canonical_input" | /bin/bash "$canonical_hook" 2>&1)"; then
56
+ canonical_status=0
57
+ else
58
+ canonical_status=$?
59
+ fi
60
+
61
+ [ "$canonical_status" -eq 0 ] && allow
62
+ [ -n "$canonical_output" ] || canonical_output="Blocked: this file is Lisa-managed and is replaced by \`lisa apply\`. Edit the template upstream in Lisa, or use the local escape hatch beside the file."
63
+ deny "$canonical_output"
@@ -77,6 +77,14 @@ export const FAMILIES = [
77
77
  match: /(^|\/)\.lisa\.config\.json$/,
78
78
  kind: "allow-list",
79
79
  },
80
+ {
81
+ // The #3811 quarantine. `allow-list` is exactly right here: the list may
82
+ // shrink freely, and ADDING a file — re-authorising type debt that the
83
+ // gate would otherwise refuse — is the change that needs a human to see it.
84
+ id: "typecheck-quarantine",
85
+ match: /(^|\/)typecheck-quarantine\.json$/,
86
+ kind: "allow-list",
87
+ },
80
88
  {
81
89
  id: "lighthouse",
82
90
  match: /(^|\/)(?:lighthouserc-config|lighthouserc|\.lighthouserc)\.json$/,
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ # Antigravity (agy) PreToolUse adapter for Lisa's managed-file guard.
3
+ #
4
+ # agy sends `{toolCall:{name:"run_command",args:{CommandLine:"..."}}}` and
5
+ # expects an allow/deny JSON object on stdout. The canonical hook consumes the
6
+ # Claude Bash-hook envelope and communicates denial with exit status 2. This
7
+ # adapter only translates protocols; all classification stays in the canonical
8
+ # block-managed-file-edits.sh beside it (same delegation pattern as
9
+ # block-instruction-file-edits.agy.sh).
10
+ #
11
+ # Scope note: agy plugin hooks match `run_command`, so only the Bash arm of the
12
+ # guard reaches agy — an agy file-edit tool call writing a copy-overwrite
13
+ # template cannot be intercepted. That gap is accepted and recorded here, and in
14
+ # the pull request that added this adapter, rather than papered over. The
15
+ # redirection / append / tee signatures the canonical guard follows into
16
+ # executed scripts still hold on agy, which is the majority of the surface.
17
+ #
18
+ # Fail-open on missing runtimes, matching every sibling adapter. A missed
19
+ # refusal here costs a silently forked template — recoverable, and `lisa apply`
20
+ # reports it as out of date on every subsequent run — where failing closed would
21
+ # block every command on a machine without jq.
22
+ set -uo pipefail
23
+
24
+ allow() {
25
+ printf '%s\n' '{"decision":"allow"}'
26
+ exit 0
27
+ }
28
+
29
+ deny() {
30
+ local reason="$1"
31
+ if command -v jq >/dev/null 2>&1; then
32
+ jq -cn --arg reason "$reason" '{decision:"deny",reason:$reason}'
33
+ else
34
+ printf '%s\n' '{"decision":"allow"}'
35
+ fi
36
+ exit 0
37
+ }
38
+
39
+ input="$(cat 2>/dev/null || true)"
40
+ [ -z "$input" ] && allow
41
+ command -v jq >/dev/null 2>&1 || allow
42
+
43
+ tool_name="$(printf '%s' "$input" | jq -r '.toolCall.name // empty' 2>/dev/null || true)"
44
+ [ "$tool_name" != "run_command" ] && allow
45
+ command_str="$(printf '%s' "$input" | jq -r '.toolCall.args.CommandLine // empty' 2>/dev/null || true)"
46
+ [ -z "$command_str" ] && allow
47
+
48
+ hook_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
49
+ canonical_hook="$hook_dir/block-managed-file-edits.sh"
50
+ [ -r "$canonical_hook" ] || allow
51
+
52
+ canonical_input="$(jq -cn --arg command "$command_str" '{tool_name:"Bash",tool_input:{command:$command}}')"
53
+ canonical_output=""
54
+ canonical_status=0
55
+ if canonical_output="$(printf '%s' "$canonical_input" | /bin/bash "$canonical_hook" 2>&1)"; then
56
+ canonical_status=0
57
+ else
58
+ canonical_status=$?
59
+ fi
60
+
61
+ [ "$canonical_status" -eq 0 ] && allow
62
+ [ -n "$canonical_output" ] || canonical_output="Blocked: this file is Lisa-managed and is replaced by \`lisa apply\`. Edit the template upstream in Lisa, or use the local escape hatch beside the file."
63
+ deny "$canonical_output"