@codyswann/lisa 4.38.3 → 4.38.5
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.
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +4 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +12 -3
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/hooks-installer.d.ts.map +1 -1
- package/dist/opencode/hooks-installer.js +1 -0
- package/dist/opencode/hooks-installer.js.map +1 -1
- package/dist/opencode/plugin-catalog.d.ts.map +1 -1
- package/dist/opencode/plugin-catalog.js +5 -0
- package/dist/opencode/plugin-catalog.js.map +1 -1
- package/dist/opencode/plugin-templates/block-managed-file-edits.sh +937 -0
- package/dist/opencode/plugin-templates/lisa-block-managed-file-edits.ts +83 -0
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +9 -1
- package/plugins/lisa/.codex-plugin/hooks.json +8 -0
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/block-managed-file-edits.agy.sh +63 -0
- package/plugins/lisa-agy/hooks/block-managed-file-edits.agy.sh +63 -0
- package/plugins/lisa-agy/hooks/block-managed-file-edits.sh +937 -0
- package/plugins/lisa-agy/hooks.json +13 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +9 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/hooks.json +8 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/.claude-plugin/plugin.json +9 -1
- package/plugins/src/base/hooks/block-managed-file-edits.agy.sh +63 -0
- package/scripts/copy-opencode-plugin-templates.mjs +1 -0
- package/scripts/generate-agy-plugin-artifacts.mjs +12 -0
- package/typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs +60 -6
|
@@ -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
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"zod-validation-error": "^4.0.0"
|
|
171
171
|
},
|
|
172
172
|
"name": "@codyswann/lisa",
|
|
173
|
-
"version": "4.38.
|
|
173
|
+
"version": "4.38.5",
|
|
174
174
|
"description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
|
|
175
175
|
"main": "dist/index.js",
|
|
176
176
|
"exports": {
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
"test": "tests"
|
|
319
319
|
},
|
|
320
320
|
"types": "./dist/index.d.ts",
|
|
321
|
-
"lisaReleaseCommit": "
|
|
322
|
-
"gitHead": "
|
|
323
|
-
"lisaReleaseTag": "v4.38.
|
|
321
|
+
"lisaReleaseCommit": "8df909afd30135ff230a81ccdd3e0d76e6dba8fa",
|
|
322
|
+
"gitHead": "8df909afd30135ff230a81ccdd3e0d76e6dba8fa",
|
|
323
|
+
"lisaReleaseTag": "v4.38.5"
|
|
324
324
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa",
|
|
3
|
-
"version": "4.38.
|
|
3
|
+
"version": "4.38.5",
|
|
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
|
},
|
|
@@ -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"
|
|
@@ -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"
|