@codyswann/lisa 4.60.2 → 4.60.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.
- package/all/copy-overwrite/scripts/lib/worktree-dependencies.d.mts +5 -0
- package/all/copy-overwrite/scripts/lib/worktree-dependencies.mjs +65 -0
- package/all/copy-overwrite/scripts/lisa-hooks/block-instruction-file-edits.sh +11 -1
- package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net-heredoc.py +43 -0
- package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net.sh +16 -1
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +10 -2
- package/cdk/package-lisa/package.lisa.json +12 -12
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +4 -0
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +28 -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 +27 -16
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/plugin-templates/parity-safety-net-heredoc.py +43 -0
- package/dist/opencode/plugin-templates/parity-safety-net.sh +16 -1
- package/expo/package-lisa/package.lisa.json +16 -16
- package/harper-fabric/package-lisa/package.lisa.json +19 -19
- package/nestjs/package-lisa/package.lisa.json +10 -10
- package/npm-package/package-lisa/package.lisa.json +8 -8
- package/package.json +28 -28
- package/phaser/package-lisa/package.lisa.json +23 -23
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/block-instruction-file-edits.sh +11 -1
- package/plugins/lisa/hooks/parity-safety-net-heredoc.py +43 -0
- package/plugins/lisa/hooks/parity-safety-net.sh +16 -1
- package/plugins/lisa-agy/hooks/block-instruction-file-edits.sh +11 -1
- package/plugins/lisa-agy/hooks/parity-safety-net-heredoc.py +43 -0
- package/plugins/lisa-agy/hooks/parity-safety-net.sh +16 -1
- 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 +1 -1
- package/plugins/lisa-copilot/hooks/block-instruction-file-edits.sh +11 -1
- package/plugins/lisa-copilot/hooks/parity-safety-net-heredoc.py +43 -0
- package/plugins/lisa-copilot/hooks/parity-safety-net.sh +16 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-instruction-file-edits.sh +11 -1
- package/plugins/lisa-cursor/hooks/parity-safety-net-heredoc.py +43 -0
- package/plugins/lisa-cursor/hooks/parity-safety-net.sh +16 -1
- 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/hooks/block-instruction-file-edits.sh +11 -1
- package/plugins/src/base/hooks/parity-safety-net-heredoc.py +43 -0
- package/plugins/src/base/hooks/parity-safety-net.sh +16 -1
- package/scripts/lib/worktree-dependencies.d.mts +5 -0
- package/scripts/lib/worktree-dependencies.mjs +65 -0
- package/scripts/two-channel-couplings.json +1 -1
- package/typescript/copy-contents/.husky/pre-push +1 -1
- package/typescript/package-lisa/package.lisa.json +19 -19
|
@@ -52,7 +52,8 @@ if [ -r "$lisa_guard_dedupe_lib" ]; then
|
|
|
52
52
|
# shellcheck source=guard-dedupe.bash
|
|
53
53
|
. "$lisa_guard_dedupe_lib"
|
|
54
54
|
trap 'lisa_guard_dedupe_record $?' EXIT
|
|
55
|
-
lisa_guard_dedupe block-instruction-file-edits "$input"
|
|
55
|
+
lisa_guard_dedupe block-instruction-file-edits "$input" \
|
|
56
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py"
|
|
56
57
|
fi
|
|
57
58
|
|
|
58
59
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
@@ -187,6 +188,15 @@ EOF
|
|
|
187
188
|
grep -Eqi '(agents|claude|copilot-instructions)\.md'; then
|
|
188
189
|
exit 0
|
|
189
190
|
fi
|
|
191
|
+
# Literal printf/echo arguments are content. The shared projection keeps
|
|
192
|
+
# the real redirect target, and leaves executable/ambiguous syntax intact.
|
|
193
|
+
if [[ "$command_str" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
194
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
195
|
+
if display_projection="$(printf '%s' "$command_str" | python3 \
|
|
196
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
197
|
+
command_str="$display_projection"
|
|
198
|
+
fi
|
|
199
|
+
fi
|
|
190
200
|
# Write signatures only. A bare mention (`cat AGENTS.md`, `rg x AGENTS.md`)
|
|
191
201
|
# is a read and must stay allowed — the filename has to appear as the target
|
|
192
202
|
# of a redirection, a tee, or an in-place sed.
|
|
@@ -229,6 +229,46 @@ def shell_tokens(prefix: str) -> list[str] | None:
|
|
|
229
229
|
return None
|
|
230
230
|
|
|
231
231
|
|
|
232
|
+
def literal_display_projection(command: str) -> str:
|
|
233
|
+
"""Remove data from one literal printer, retaining its real output target.
|
|
234
|
+
|
|
235
|
+
Reuse the literal simple-command grammar: pipes, chains, substitutions,
|
|
236
|
+
comments and ambiguous syntax keep the original scan. This is not a shell
|
|
237
|
+
parser or an execution exemption. ANSI-C quoting and computed targets also
|
|
238
|
+
keep their original scan rather than guessing their expanded spelling.
|
|
239
|
+
"""
|
|
240
|
+
if "$'" in command:
|
|
241
|
+
return command
|
|
242
|
+
|
|
243
|
+
def printer(text: str) -> bool:
|
|
244
|
+
tokens = shell_tokens(text)
|
|
245
|
+
if not tokens or len(tokens) < 2:
|
|
246
|
+
return False
|
|
247
|
+
if tokens[0] == "echo":
|
|
248
|
+
return True
|
|
249
|
+
if tokens[0] != "printf":
|
|
250
|
+
return False
|
|
251
|
+
arguments = tokens[2:] if tokens[1] == "--" else tokens[1:]
|
|
252
|
+
if not arguments or arguments[0].startswith("-"):
|
|
253
|
+
return False
|
|
254
|
+
# %n writes a variable (including an evaluated array subscript), and a
|
|
255
|
+
# dynamic format could select it. Only known display conversions qualify.
|
|
256
|
+
remaining = re.sub(r"%%|%[sbqQ]", "", arguments[0])
|
|
257
|
+
return not any(char in remaining for char in "%$`*?[]~")
|
|
258
|
+
|
|
259
|
+
if printer(command):
|
|
260
|
+
return "printf '%s' literal-display-content"
|
|
261
|
+
for redirect in re.finditer(r">>|>\||>", command):
|
|
262
|
+
if not printer(command[:redirect.start()]):
|
|
263
|
+
continue
|
|
264
|
+
target = shell_tokens(command[redirect.end():])
|
|
265
|
+
if target and len(target) == 1 and not any(
|
|
266
|
+
char in target[0] for char in "$`\\\n\r*?[]~"
|
|
267
|
+
):
|
|
268
|
+
return "printf '%s' literal-display-content " + redirect[0] + " " + shlex.quote(target[0])
|
|
269
|
+
return command
|
|
270
|
+
|
|
271
|
+
|
|
232
272
|
def is_allowed_gh(tokens: list[str]) -> bool:
|
|
233
273
|
return (
|
|
234
274
|
len(tokens) >= 3
|
|
@@ -905,6 +945,9 @@ def marker_is_closed(command: str, marker: Marker) -> bool:
|
|
|
905
945
|
|
|
906
946
|
def main() -> int:
|
|
907
947
|
command = sys.stdin.read()
|
|
948
|
+
if sys.argv[1:] == ["--literal-display"]:
|
|
949
|
+
print(literal_display_projection(command), end="")
|
|
950
|
+
return SAFE
|
|
908
951
|
if "<<" not in command:
|
|
909
952
|
print(command, end="")
|
|
910
953
|
return SAFE
|
|
@@ -431,6 +431,18 @@ case "$command_str" in
|
|
|
431
431
|
;;
|
|
432
432
|
esac
|
|
433
433
|
|
|
434
|
+
custom_command_for_guards="$command_for_guards"
|
|
435
|
+
# A single literal printer writes data, not shell commands. Keep its actual
|
|
436
|
+
# redirection in the scan; unsupported syntax and unavailable parsing retain
|
|
437
|
+
# the original text. Chained commands and shell substitutions never qualify.
|
|
438
|
+
if [[ "$command_for_guards" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
439
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
440
|
+
if display_projection="$(printf '%s' "$command_for_guards" | python3 \
|
|
441
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
442
|
+
command_for_guards="$display_projection"
|
|
443
|
+
fi
|
|
444
|
+
fi
|
|
445
|
+
|
|
434
446
|
# ─── Follow execution into the file a command RUNS (issue #3612) ─────────────
|
|
435
447
|
#
|
|
436
448
|
# Every guard below classifies SHELL COMMAND TEXT, and until this block existed
|
|
@@ -2380,6 +2392,9 @@ fi
|
|
|
2380
2392
|
# 16. Project-local custom rules. Each non-comment line is an ERE; a match blocks.
|
|
2381
2393
|
rules_file="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
2382
2394
|
if [ -f "$rules_file" ]; then
|
|
2395
|
+
# Custom rules can intentionally govern text itself, so preserve their input.
|
|
2396
|
+
custom_command_str="$(printf '%s\n%s' "$custom_command_for_guards" "$followed_text" \
|
|
2397
|
+
| awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }')"
|
|
2383
2398
|
while IFS= read -r rule || [ -n "$rule" ]; do
|
|
2384
2399
|
case "$rule" in
|
|
2385
2400
|
'' | '#'*) continue ;;
|
|
@@ -2393,7 +2408,7 @@ if [ -f "$rules_file" ]; then
|
|
|
2393
2408
|
# not a refusal. The `||` puts the pipeline in a condition context, where
|
|
2394
2409
|
# a non-zero status is expected rather than fatal.
|
|
2395
2410
|
rule_status=0
|
|
2396
|
-
printf '%s' "$
|
|
2411
|
+
printf '%s' "$custom_command_str" | grep -Eiq -- "$rule" || rule_status=$?
|
|
2397
2412
|
case "$rule_status" in
|
|
2398
2413
|
0) block "matched a project custom safety rule (${rules_file##*/}): $rule" ;;
|
|
2399
2414
|
1) ;; # no match
|
|
@@ -52,7 +52,8 @@ if [ -r "$lisa_guard_dedupe_lib" ]; then
|
|
|
52
52
|
# shellcheck source=guard-dedupe.bash
|
|
53
53
|
. "$lisa_guard_dedupe_lib"
|
|
54
54
|
trap 'lisa_guard_dedupe_record $?' EXIT
|
|
55
|
-
lisa_guard_dedupe block-instruction-file-edits "$input"
|
|
55
|
+
lisa_guard_dedupe block-instruction-file-edits "$input" \
|
|
56
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py"
|
|
56
57
|
fi
|
|
57
58
|
|
|
58
59
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
@@ -187,6 +188,15 @@ EOF
|
|
|
187
188
|
grep -Eqi '(agents|claude|copilot-instructions)\.md'; then
|
|
188
189
|
exit 0
|
|
189
190
|
fi
|
|
191
|
+
# Literal printf/echo arguments are content. The shared projection keeps
|
|
192
|
+
# the real redirect target, and leaves executable/ambiguous syntax intact.
|
|
193
|
+
if [[ "$command_str" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
194
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
195
|
+
if display_projection="$(printf '%s' "$command_str" | python3 \
|
|
196
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
197
|
+
command_str="$display_projection"
|
|
198
|
+
fi
|
|
199
|
+
fi
|
|
190
200
|
# Write signatures only. A bare mention (`cat AGENTS.md`, `rg x AGENTS.md`)
|
|
191
201
|
# is a read and must stay allowed — the filename has to appear as the target
|
|
192
202
|
# of a redirection, a tee, or an in-place sed.
|
|
@@ -229,6 +229,46 @@ def shell_tokens(prefix: str) -> list[str] | None:
|
|
|
229
229
|
return None
|
|
230
230
|
|
|
231
231
|
|
|
232
|
+
def literal_display_projection(command: str) -> str:
|
|
233
|
+
"""Remove data from one literal printer, retaining its real output target.
|
|
234
|
+
|
|
235
|
+
Reuse the literal simple-command grammar: pipes, chains, substitutions,
|
|
236
|
+
comments and ambiguous syntax keep the original scan. This is not a shell
|
|
237
|
+
parser or an execution exemption. ANSI-C quoting and computed targets also
|
|
238
|
+
keep their original scan rather than guessing their expanded spelling.
|
|
239
|
+
"""
|
|
240
|
+
if "$'" in command:
|
|
241
|
+
return command
|
|
242
|
+
|
|
243
|
+
def printer(text: str) -> bool:
|
|
244
|
+
tokens = shell_tokens(text)
|
|
245
|
+
if not tokens or len(tokens) < 2:
|
|
246
|
+
return False
|
|
247
|
+
if tokens[0] == "echo":
|
|
248
|
+
return True
|
|
249
|
+
if tokens[0] != "printf":
|
|
250
|
+
return False
|
|
251
|
+
arguments = tokens[2:] if tokens[1] == "--" else tokens[1:]
|
|
252
|
+
if not arguments or arguments[0].startswith("-"):
|
|
253
|
+
return False
|
|
254
|
+
# %n writes a variable (including an evaluated array subscript), and a
|
|
255
|
+
# dynamic format could select it. Only known display conversions qualify.
|
|
256
|
+
remaining = re.sub(r"%%|%[sbqQ]", "", arguments[0])
|
|
257
|
+
return not any(char in remaining for char in "%$`*?[]~")
|
|
258
|
+
|
|
259
|
+
if printer(command):
|
|
260
|
+
return "printf '%s' literal-display-content"
|
|
261
|
+
for redirect in re.finditer(r">>|>\||>", command):
|
|
262
|
+
if not printer(command[:redirect.start()]):
|
|
263
|
+
continue
|
|
264
|
+
target = shell_tokens(command[redirect.end():])
|
|
265
|
+
if target and len(target) == 1 and not any(
|
|
266
|
+
char in target[0] for char in "$`\\\n\r*?[]~"
|
|
267
|
+
):
|
|
268
|
+
return "printf '%s' literal-display-content " + redirect[0] + " " + shlex.quote(target[0])
|
|
269
|
+
return command
|
|
270
|
+
|
|
271
|
+
|
|
232
272
|
def is_allowed_gh(tokens: list[str]) -> bool:
|
|
233
273
|
return (
|
|
234
274
|
len(tokens) >= 3
|
|
@@ -905,6 +945,9 @@ def marker_is_closed(command: str, marker: Marker) -> bool:
|
|
|
905
945
|
|
|
906
946
|
def main() -> int:
|
|
907
947
|
command = sys.stdin.read()
|
|
948
|
+
if sys.argv[1:] == ["--literal-display"]:
|
|
949
|
+
print(literal_display_projection(command), end="")
|
|
950
|
+
return SAFE
|
|
908
951
|
if "<<" not in command:
|
|
909
952
|
print(command, end="")
|
|
910
953
|
return SAFE
|
|
@@ -431,6 +431,18 @@ case "$command_str" in
|
|
|
431
431
|
;;
|
|
432
432
|
esac
|
|
433
433
|
|
|
434
|
+
custom_command_for_guards="$command_for_guards"
|
|
435
|
+
# A single literal printer writes data, not shell commands. Keep its actual
|
|
436
|
+
# redirection in the scan; unsupported syntax and unavailable parsing retain
|
|
437
|
+
# the original text. Chained commands and shell substitutions never qualify.
|
|
438
|
+
if [[ "$command_for_guards" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
439
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
440
|
+
if display_projection="$(printf '%s' "$command_for_guards" | python3 \
|
|
441
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
442
|
+
command_for_guards="$display_projection"
|
|
443
|
+
fi
|
|
444
|
+
fi
|
|
445
|
+
|
|
434
446
|
# ─── Follow execution into the file a command RUNS (issue #3612) ─────────────
|
|
435
447
|
#
|
|
436
448
|
# Every guard below classifies SHELL COMMAND TEXT, and until this block existed
|
|
@@ -2380,6 +2392,9 @@ fi
|
|
|
2380
2392
|
# 16. Project-local custom rules. Each non-comment line is an ERE; a match blocks.
|
|
2381
2393
|
rules_file="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
2382
2394
|
if [ -f "$rules_file" ]; then
|
|
2395
|
+
# Custom rules can intentionally govern text itself, so preserve their input.
|
|
2396
|
+
custom_command_str="$(printf '%s\n%s' "$custom_command_for_guards" "$followed_text" \
|
|
2397
|
+
| awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }')"
|
|
2383
2398
|
while IFS= read -r rule || [ -n "$rule" ]; do
|
|
2384
2399
|
case "$rule" in
|
|
2385
2400
|
'' | '#'*) continue ;;
|
|
@@ -2393,7 +2408,7 @@ if [ -f "$rules_file" ]; then
|
|
|
2393
2408
|
# not a refusal. The `||` puts the pipeline in a condition context, where
|
|
2394
2409
|
# a non-zero status is expected rather than fatal.
|
|
2395
2410
|
rule_status=0
|
|
2396
|
-
printf '%s' "$
|
|
2411
|
+
printf '%s' "$custom_command_str" | grep -Eiq -- "$rule" || rule_status=$?
|
|
2397
2412
|
case "$rule_status" in
|
|
2398
2413
|
0) block "matched a project custom safety rule (${rules_file##*/}): $rule" ;;
|
|
2399
2414
|
1) ;; # no match
|
|
@@ -52,7 +52,8 @@ if [ -r "$lisa_guard_dedupe_lib" ]; then
|
|
|
52
52
|
# shellcheck source=guard-dedupe.bash
|
|
53
53
|
. "$lisa_guard_dedupe_lib"
|
|
54
54
|
trap 'lisa_guard_dedupe_record $?' EXIT
|
|
55
|
-
lisa_guard_dedupe block-instruction-file-edits "$input"
|
|
55
|
+
lisa_guard_dedupe block-instruction-file-edits "$input" \
|
|
56
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py"
|
|
56
57
|
fi
|
|
57
58
|
|
|
58
59
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
@@ -187,6 +188,15 @@ EOF
|
|
|
187
188
|
grep -Eqi '(agents|claude|copilot-instructions)\.md'; then
|
|
188
189
|
exit 0
|
|
189
190
|
fi
|
|
191
|
+
# Literal printf/echo arguments are content. The shared projection keeps
|
|
192
|
+
# the real redirect target, and leaves executable/ambiguous syntax intact.
|
|
193
|
+
if [[ "$command_str" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
194
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
195
|
+
if display_projection="$(printf '%s' "$command_str" | python3 \
|
|
196
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
197
|
+
command_str="$display_projection"
|
|
198
|
+
fi
|
|
199
|
+
fi
|
|
190
200
|
# Write signatures only. A bare mention (`cat AGENTS.md`, `rg x AGENTS.md`)
|
|
191
201
|
# is a read and must stay allowed — the filename has to appear as the target
|
|
192
202
|
# of a redirection, a tee, or an in-place sed.
|
|
@@ -229,6 +229,46 @@ def shell_tokens(prefix: str) -> list[str] | None:
|
|
|
229
229
|
return None
|
|
230
230
|
|
|
231
231
|
|
|
232
|
+
def literal_display_projection(command: str) -> str:
|
|
233
|
+
"""Remove data from one literal printer, retaining its real output target.
|
|
234
|
+
|
|
235
|
+
Reuse the literal simple-command grammar: pipes, chains, substitutions,
|
|
236
|
+
comments and ambiguous syntax keep the original scan. This is not a shell
|
|
237
|
+
parser or an execution exemption. ANSI-C quoting and computed targets also
|
|
238
|
+
keep their original scan rather than guessing their expanded spelling.
|
|
239
|
+
"""
|
|
240
|
+
if "$'" in command:
|
|
241
|
+
return command
|
|
242
|
+
|
|
243
|
+
def printer(text: str) -> bool:
|
|
244
|
+
tokens = shell_tokens(text)
|
|
245
|
+
if not tokens or len(tokens) < 2:
|
|
246
|
+
return False
|
|
247
|
+
if tokens[0] == "echo":
|
|
248
|
+
return True
|
|
249
|
+
if tokens[0] != "printf":
|
|
250
|
+
return False
|
|
251
|
+
arguments = tokens[2:] if tokens[1] == "--" else tokens[1:]
|
|
252
|
+
if not arguments or arguments[0].startswith("-"):
|
|
253
|
+
return False
|
|
254
|
+
# %n writes a variable (including an evaluated array subscript), and a
|
|
255
|
+
# dynamic format could select it. Only known display conversions qualify.
|
|
256
|
+
remaining = re.sub(r"%%|%[sbqQ]", "", arguments[0])
|
|
257
|
+
return not any(char in remaining for char in "%$`*?[]~")
|
|
258
|
+
|
|
259
|
+
if printer(command):
|
|
260
|
+
return "printf '%s' literal-display-content"
|
|
261
|
+
for redirect in re.finditer(r">>|>\||>", command):
|
|
262
|
+
if not printer(command[:redirect.start()]):
|
|
263
|
+
continue
|
|
264
|
+
target = shell_tokens(command[redirect.end():])
|
|
265
|
+
if target and len(target) == 1 and not any(
|
|
266
|
+
char in target[0] for char in "$`\\\n\r*?[]~"
|
|
267
|
+
):
|
|
268
|
+
return "printf '%s' literal-display-content " + redirect[0] + " " + shlex.quote(target[0])
|
|
269
|
+
return command
|
|
270
|
+
|
|
271
|
+
|
|
232
272
|
def is_allowed_gh(tokens: list[str]) -> bool:
|
|
233
273
|
return (
|
|
234
274
|
len(tokens) >= 3
|
|
@@ -905,6 +945,9 @@ def marker_is_closed(command: str, marker: Marker) -> bool:
|
|
|
905
945
|
|
|
906
946
|
def main() -> int:
|
|
907
947
|
command = sys.stdin.read()
|
|
948
|
+
if sys.argv[1:] == ["--literal-display"]:
|
|
949
|
+
print(literal_display_projection(command), end="")
|
|
950
|
+
return SAFE
|
|
908
951
|
if "<<" not in command:
|
|
909
952
|
print(command, end="")
|
|
910
953
|
return SAFE
|
|
@@ -431,6 +431,18 @@ case "$command_str" in
|
|
|
431
431
|
;;
|
|
432
432
|
esac
|
|
433
433
|
|
|
434
|
+
custom_command_for_guards="$command_for_guards"
|
|
435
|
+
# A single literal printer writes data, not shell commands. Keep its actual
|
|
436
|
+
# redirection in the scan; unsupported syntax and unavailable parsing retain
|
|
437
|
+
# the original text. Chained commands and shell substitutions never qualify.
|
|
438
|
+
if [[ "$command_for_guards" =~ ^[[:blank:]]*(printf|echo)[[:blank:]] ]] \
|
|
439
|
+
&& command -v python3 >/dev/null 2>&1; then
|
|
440
|
+
if display_projection="$(printf '%s' "$command_for_guards" | python3 \
|
|
441
|
+
"$lisa_guard_hook_dir/parity-safety-net-heredoc.py" --literal-display 2>/dev/null)"; then
|
|
442
|
+
command_for_guards="$display_projection"
|
|
443
|
+
fi
|
|
444
|
+
fi
|
|
445
|
+
|
|
434
446
|
# ─── Follow execution into the file a command RUNS (issue #3612) ─────────────
|
|
435
447
|
#
|
|
436
448
|
# Every guard below classifies SHELL COMMAND TEXT, and until this block existed
|
|
@@ -2380,6 +2392,9 @@ fi
|
|
|
2380
2392
|
# 16. Project-local custom rules. Each non-comment line is an ERE; a match blocks.
|
|
2381
2393
|
rules_file="${SAFETY_NET_RULES_FILE:-${CLAUDE_PROJECT_DIR:-$PWD}/.claude/safety-net-rules.txt}"
|
|
2382
2394
|
if [ -f "$rules_file" ]; then
|
|
2395
|
+
# Custom rules can intentionally govern text itself, so preserve their input.
|
|
2396
|
+
custom_command_str="$(printf '%s\n%s' "$custom_command_for_guards" "$followed_text" \
|
|
2397
|
+
| awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }')"
|
|
2383
2398
|
while IFS= read -r rule || [ -n "$rule" ]; do
|
|
2384
2399
|
case "$rule" in
|
|
2385
2400
|
'' | '#'*) continue ;;
|
|
@@ -2393,7 +2408,7 @@ if [ -f "$rules_file" ]; then
|
|
|
2393
2408
|
# not a refusal. The `||` puts the pipeline in a condition context, where
|
|
2394
2409
|
# a non-zero status is expected rather than fatal.
|
|
2395
2410
|
rule_status=0
|
|
2396
|
-
printf '%s' "$
|
|
2411
|
+
printf '%s' "$custom_command_str" | grep -Eiq -- "$rule" || rule_status=$?
|
|
2397
2412
|
case "$rule_status" in
|
|
2398
2413
|
0) block "matched a project custom safety rule (${rules_file##*/}): $rule" ;;
|
|
2399
2414
|
1) ;; # no match
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.4",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.4",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, across Claude and Codex.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.4",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.4",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.4",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|