@codyswann/lisa 4.73.1 → 4.73.3
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/README.md +20 -0
- package/all/copy-overwrite/scripts/lib/history-secret-git.mjs +158 -5
- package/all/copy-overwrite/scripts/lib/npm-update-contract.mjs +25 -1
- package/all/copy-overwrite/scripts/lisa-enforcement-fallback.sh +137 -163
- package/all/copy-overwrite/scripts/lisa-enforcement-freshness.mjs +180 -0
- package/all/copy-overwrite/scripts/lisa-history-secrets.mjs +17 -3
- package/all/copy-overwrite/scripts/lisa-hooks/block-blind-automerge.sh +86 -7
- package/all/copy-overwrite/scripts/lisa-hooks/block-managed-file-edits.sh +7 -1
- package/all/copy-overwrite/scripts/lisa-hooks/block-no-verify.sh +62 -7
- package/all/copy-overwrite/scripts/lisa-rails-prepush.mjs +4 -1
- package/all/copy-overwrite/scripts/lisa-work-item.mjs +191 -5
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +5 -5
- package/all/deletions.json +19 -2
- package/dist/codex/scripts/block-no-verify.sh +62 -7
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +88 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/lisa.d.ts +31 -0
- package/dist/core/lisa.d.ts.map +1 -1
- package/dist/core/lisa.js +69 -4
- package/dist/core/lisa.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/retire-unmodified.d.ts +66 -0
- package/dist/core/retire-unmodified.d.ts.map +1 -0
- package/dist/core/retire-unmodified.js +244 -0
- package/dist/core/retire-unmodified.js.map +1 -0
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +39 -21
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/plugin-templates/block-managed-file-edits.sh +7 -1
- package/dist/opencode/plugin-templates/block-no-verify.sh +62 -7
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/auto-update.mjs +69 -1
- package/plugins/lisa/hooks/block-blind-automerge.sh +86 -7
- package/plugins/lisa/hooks/block-managed-file-edits.sh +7 -1
- package/plugins/lisa/hooks/block-no-verify.agy.sh +62 -7
- package/plugins/lisa/hooks/block-no-verify.sh +62 -7
- package/plugins/lisa-agy/hooks/block-blind-automerge.sh +86 -7
- package/plugins/lisa-agy/hooks/block-managed-file-edits.sh +7 -1
- package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +62 -7
- 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/auto-update.mjs +69 -1
- package/plugins/lisa-copilot/hooks/block-blind-automerge.sh +86 -7
- package/plugins/lisa-copilot/hooks/block-managed-file-edits.sh +7 -1
- package/plugins/lisa-copilot/hooks/block-no-verify.sh +62 -7
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/auto-update.mjs +69 -1
- package/plugins/lisa-cursor/hooks/block-blind-automerge.sh +86 -7
- package/plugins/lisa-cursor/hooks/block-managed-file-edits.sh +7 -1
- package/plugins/lisa-cursor/hooks/block-no-verify.sh +62 -7
- 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/materialized-artifacts.json +1 -0
- package/plugins/src/base/hooks/auto-update.mjs +69 -1
- package/plugins/src/base/hooks/block-blind-automerge.sh +86 -7
- package/plugins/src/base/hooks/block-managed-file-edits.sh +7 -1
- package/plugins/src/base/hooks/block-no-verify.agy.sh +62 -7
- package/plugins/src/base/hooks/block-no-verify.sh +62 -7
- package/scripts/build-plugins.sh +7 -0
- package/scripts/check-shipped-surface-removals.mjs +22 -2
- package/scripts/lisa-enforcement-fallback.sh +137 -163
- package/scripts/lisa-enforcement-freshness.mjs +177 -0
- package/scripts/two-channel-couplings.json +1 -1
- package/typescript/copy-overwrite/.prettierignore +1 -0
|
@@ -211,6 +211,7 @@ if [ -z "$command_str" ]; then
|
|
|
211
211
|
fi
|
|
212
212
|
|
|
213
213
|
if ! BLOCK_BLIND_AUTOMERGE_COMMAND="$command_str" python3 - <<'PY'
|
|
214
|
+
import io
|
|
214
215
|
import json
|
|
215
216
|
import os
|
|
216
217
|
import re
|
|
@@ -244,7 +245,41 @@ MERGE_SEPARATE_VALUE = {
|
|
|
244
245
|
|
|
245
246
|
COMMAND_SEPARATORS = {
|
|
246
247
|
";", "|", "||", "&", "&&", "(", ")", "<", ">", ">>", "<<", "&|",
|
|
248
|
+
# `|&` pipes stdout AND stderr into the next command, so it ends a command
|
|
249
|
+
# exactly as `|` does. shlex emits it as one token, and before it was listed
|
|
250
|
+
# here `echo hi |& git commit --no-verify` read as a single `echo` command
|
|
251
|
+
# whose arguments happened to include git. The case terminators end a
|
|
252
|
+
# command the same way.
|
|
253
|
+
"|&", ";;", ";&", ";;&",
|
|
247
254
|
}
|
|
255
|
+
# shlex also GLUES adjacent punctuation into one token across distinct
|
|
256
|
+
# operators: `(echo hi)|&git ...` arrives as `)|&`, which no set membership
|
|
257
|
+
# test can recognise. An operator-only token is therefore re-split into the
|
|
258
|
+
# operators it is made of, longest first. Redirections are kept whole and are
|
|
259
|
+
# deliberately NOT separators, so `git commit 2>&1 -n` keeps its `-n` inside the
|
|
260
|
+
# commit's argv scope.
|
|
261
|
+
OPERATOR_ONLY = re.compile(r"^[();<>|&]+$")
|
|
262
|
+
SHELL_OPERATOR = re.compile("|".join(
|
|
263
|
+
re.escape(operator) for operator in sorted(
|
|
264
|
+
COMMAND_SEPARATORS | {">|", "&>", "&>>", ">&", "<&", "<>", "<<<"},
|
|
265
|
+
key=lambda operator: (-len(operator), operator),
|
|
266
|
+
)
|
|
267
|
+
))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def split_operators(token):
|
|
271
|
+
"""Split a glued operator-only token into the shell operators it holds.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
token: One shlex token that was not read inside a quote or escape.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
The operators, longest first, or the token itself when it is not
|
|
278
|
+
made only of shell punctuation.
|
|
279
|
+
"""
|
|
280
|
+
if OPERATOR_ONLY.match(token):
|
|
281
|
+
return SHELL_OPERATOR.findall(token)
|
|
282
|
+
return [token]
|
|
248
283
|
|
|
249
284
|
# Shell wrappers whose `-c` argument is a command in a string rather than argv.
|
|
250
285
|
# The outer argv names bash, so the arming is invisible without recursing once.
|
|
@@ -422,12 +457,40 @@ def shell_tokens(text):
|
|
|
422
457
|
Returns:
|
|
423
458
|
The token list, with `;`, `|`, `&&`, `(` and friends standing alone.
|
|
424
459
|
"""
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
)
|
|
460
|
+
stream = OperatorStream(line_boundaries_as_separators(text))
|
|
461
|
+
lexer = shlex.shlex(stream, posix=True, punctuation_chars=True)
|
|
428
462
|
lexer.whitespace_split = True
|
|
429
463
|
lexer.commenters = ""
|
|
430
|
-
|
|
464
|
+
stream.lexer = lexer
|
|
465
|
+
tokens = []
|
|
466
|
+
while True:
|
|
467
|
+
stream.literal_operator = False
|
|
468
|
+
token = lexer.get_token()
|
|
469
|
+
if token is None:
|
|
470
|
+
return tokens
|
|
471
|
+
# Quoted punctuation is an argument, never a boundary: a branch can be
|
|
472
|
+
# named `|&`, and `gh pr merge '|&' --auto` must keep `--auto` in the
|
|
473
|
+
# merge's own argv. Only real operator runs are split.
|
|
474
|
+
if stream.literal_operator:
|
|
475
|
+
tokens.append(
|
|
476
|
+
chr(0) + token if token in COMMAND_SEPARATORS else token
|
|
477
|
+
)
|
|
478
|
+
else:
|
|
479
|
+
tokens.extend(split_operators(token))
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
class OperatorStream(io.StringIO):
|
|
483
|
+
"""Remember punctuation read while shlex is inside a quote or escape."""
|
|
484
|
+
|
|
485
|
+
lexer = None
|
|
486
|
+
literal_operator = False
|
|
487
|
+
|
|
488
|
+
def read(self, size=-1):
|
|
489
|
+
value = super().read(size)
|
|
490
|
+
if (self.lexer is not None and self.lexer.state in {"'", '"', chr(92)}
|
|
491
|
+
and any(char in "();|&<>" for char in value)):
|
|
492
|
+
self.literal_operator = True
|
|
493
|
+
return value
|
|
431
494
|
|
|
432
495
|
|
|
433
496
|
def is_gh(token):
|
|
@@ -493,6 +556,22 @@ def arms_auto_merge(argv):
|
|
|
493
556
|
return False
|
|
494
557
|
|
|
495
558
|
|
|
559
|
+
def literal_value(token):
|
|
560
|
+
"""The argument a token stands for, without the quoted-separator marker.
|
|
561
|
+
|
|
562
|
+
`shell_tokens` prefixes a QUOTED separator with NUL so no scan stops at it.
|
|
563
|
+
That marker is for boundary checks only: a value handed to a gh probe
|
|
564
|
+
(a selector, a base ref, a repo) must be the argument the shell passes.
|
|
565
|
+
|
|
566
|
+
Args:
|
|
567
|
+
token: One token from `shell_tokens`.
|
|
568
|
+
|
|
569
|
+
Returns:
|
|
570
|
+
The token as the shell would pass it.
|
|
571
|
+
"""
|
|
572
|
+
return token[1:] if token.startswith(chr(0)) else token
|
|
573
|
+
|
|
574
|
+
|
|
496
575
|
def pr_selector(argv, separate_value=MERGE_SEPARATE_VALUE):
|
|
497
576
|
"""The PR the command names, as gh itself would read it.
|
|
498
577
|
|
|
@@ -518,7 +597,7 @@ def pr_selector(argv, separate_value=MERGE_SEPARATE_VALUE):
|
|
|
518
597
|
index += 1
|
|
519
598
|
continue
|
|
520
599
|
if not token.startswith("-"):
|
|
521
|
-
return token
|
|
600
|
+
return literal_value(token)
|
|
522
601
|
return None
|
|
523
602
|
|
|
524
603
|
|
|
@@ -538,7 +617,7 @@ def retarget_target(argv):
|
|
|
538
617
|
if token in COMMAND_SEPARATORS:
|
|
539
618
|
return None
|
|
540
619
|
if token in BASE_FLAGS and index < len(argv):
|
|
541
|
-
return argv[index]
|
|
620
|
+
return literal_value(argv[index])
|
|
542
621
|
if token.startswith("--base="):
|
|
543
622
|
return token.split("=", 1)[1]
|
|
544
623
|
if token in EDIT_SEPARATE_VALUE:
|
|
@@ -562,7 +641,7 @@ def repo_flag(tokens, start):
|
|
|
562
641
|
if token in COMMAND_SEPARATORS:
|
|
563
642
|
break
|
|
564
643
|
if token in {"-R", "--repo"} and index + 1 < len(tokens):
|
|
565
|
-
return ["--repo", tokens[index + 1]]
|
|
644
|
+
return ["--repo", literal_value(tokens[index + 1])]
|
|
566
645
|
if token.startswith("--repo="):
|
|
567
646
|
return ["--repo", token.split("=", 1)[1]]
|
|
568
647
|
index += 1
|
|
@@ -597,7 +597,13 @@ ENV_SPLIT_UNRESOLVED = 42
|
|
|
597
597
|
BACKSLASH = chr(92)
|
|
598
598
|
NEWLINE = chr(10)
|
|
599
599
|
|
|
600
|
-
|
|
600
|
+
# `|&` pipes stdout and stderr into the next command, and the case terminators
|
|
601
|
+
# end a statement as `;` does. Without them `printf x |& tee <managed>` stayed
|
|
602
|
+
# one statement whose command word was `printf`, so the `tee` write target was
|
|
603
|
+
# never examined.
|
|
604
|
+
STATEMENT_SEPARATORS = {
|
|
605
|
+
";", "|", "||", "&", "&&", "(", ")", "&|", "|&", ";;", ";&", ";;&",
|
|
606
|
+
}
|
|
601
607
|
# Ordinary output, noclobber override, and combined stdout/stderr output.
|
|
602
608
|
# shlex separates fd prefixes (e.g. 10>>) from the operator automatically.
|
|
603
609
|
REDIRECT_OUT = {">", ">>", ">|", "&>", "&>>", ">&"}
|
|
@@ -271,7 +271,41 @@ def disables_verification(token):
|
|
|
271
271
|
# tokens, so the invocation's boundary is a token the scan can stop at.
|
|
272
272
|
COMMAND_SEPARATORS = {
|
|
273
273
|
";", "|", "||", "&", "&&", "(", ")", "<", ">", ">>", "<<", "&|",
|
|
274
|
+
# `|&` pipes stdout AND stderr into the next command, so it ends a command
|
|
275
|
+
# exactly as `|` does. shlex emits it as one token, and before it was listed
|
|
276
|
+
# here `echo hi |& git commit --no-verify` read as a single `echo` command
|
|
277
|
+
# whose arguments happened to include git. The case terminators end a
|
|
278
|
+
# command the same way.
|
|
279
|
+
"|&", ";;", ";&", ";;&",
|
|
274
280
|
}
|
|
281
|
+
# shlex also GLUES adjacent punctuation into one token across distinct
|
|
282
|
+
# operators: `(echo hi)|&git ...` arrives as `)|&`, which no set membership
|
|
283
|
+
# test can recognise. An operator-only token is therefore re-split into the
|
|
284
|
+
# operators it is made of, longest first. Redirections are kept whole and are
|
|
285
|
+
# deliberately NOT separators, so `git commit 2>&1 -n` keeps its `-n` inside the
|
|
286
|
+
# commit's argv scope.
|
|
287
|
+
OPERATOR_ONLY = re.compile(r"^[();<>|&]+$")
|
|
288
|
+
SHELL_OPERATOR = re.compile("|".join(
|
|
289
|
+
re.escape(operator) for operator in sorted(
|
|
290
|
+
COMMAND_SEPARATORS | {">|", "&>", "&>>", ">&", "<&", "<>", "<<<"},
|
|
291
|
+
key=lambda operator: (-len(operator), operator),
|
|
292
|
+
)
|
|
293
|
+
))
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def split_operators(token):
|
|
297
|
+
"""Split a glued operator-only token into the shell operators it holds.
|
|
298
|
+
|
|
299
|
+
Args:
|
|
300
|
+
token: One shlex token that was not read inside a quote or escape.
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
The operators, longest first, or the token itself when it is not
|
|
304
|
+
made only of shell punctuation.
|
|
305
|
+
"""
|
|
306
|
+
if OPERATOR_ONLY.match(token):
|
|
307
|
+
return SHELL_OPERATOR.findall(token)
|
|
308
|
+
return [token]
|
|
275
309
|
|
|
276
310
|
SHELL_PROGRAMS = {"bash", "dash", "ksh", "sh", "zsh"}
|
|
277
311
|
MAX_SHELL_NESTING = 8
|
|
@@ -425,14 +459,28 @@ def shell_tokens(text):
|
|
|
425
459
|
Returns:
|
|
426
460
|
The token list, with `;`, `|`, `&&`, `(` and friends standing alone.
|
|
427
461
|
"""
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
)
|
|
462
|
+
stream = OperatorStream(line_boundaries_as_separators(text))
|
|
463
|
+
lexer = shlex.shlex(stream, posix=True, punctuation_chars=True)
|
|
431
464
|
lexer.whitespace_split = True
|
|
432
465
|
# shlex treats `#` as a comment introducer by default and would silently
|
|
433
466
|
# truncate the rest of the line; `shlex.split` disables it, and so must this.
|
|
434
467
|
lexer.commenters = ""
|
|
435
|
-
|
|
468
|
+
stream.lexer = lexer
|
|
469
|
+
tokens = []
|
|
470
|
+
while True:
|
|
471
|
+
stream.literal_operator = False
|
|
472
|
+
token = lexer.get_token()
|
|
473
|
+
if token is None:
|
|
474
|
+
return tokens
|
|
475
|
+
# Quoted punctuation is an argument, never a boundary: it stays whole,
|
|
476
|
+
# and a quoted separator is marked so no scan stops at it (a path or
|
|
477
|
+
# branch can be named `|&`). Only real operator runs are split.
|
|
478
|
+
if stream.literal_operator:
|
|
479
|
+
tokens.append(
|
|
480
|
+
chr(0) + token if token in COMMAND_SEPARATORS else token
|
|
481
|
+
)
|
|
482
|
+
else:
|
|
483
|
+
tokens.extend(split_operators(token))
|
|
436
484
|
|
|
437
485
|
|
|
438
486
|
def cluster_skips_verification(cluster):
|
|
@@ -1048,6 +1096,10 @@ def resolve_script(token):
|
|
|
1048
1096
|
"""
|
|
1049
1097
|
if COMPUTED_VALUE.search(token):
|
|
1050
1098
|
return (None, "a computed path the guard cannot resolve before the shell does")
|
|
1099
|
+
# A quoted separator carries a NUL marker from shell_tokens; the path the
|
|
1100
|
+
# shell passes is the argument without it.
|
|
1101
|
+
if token.startswith(chr(0)):
|
|
1102
|
+
token = token[1:]
|
|
1051
1103
|
text = os.path.expanduser(token.strip().strip("'\""))
|
|
1052
1104
|
# `bash -` and a bare `-` read the script from stdin; there is no file.
|
|
1053
1105
|
if not text or text == "-":
|
|
@@ -1998,9 +2050,12 @@ def flat_tokens(text):
|
|
|
1998
2050
|
# shlex otherwise makes quoted ";" indistinguishable from a real
|
|
1999
2051
|
# command boundary. Keep literal destinations as data, so a setter
|
|
2000
2052
|
# cannot masquerade as a one-operand configuration read.
|
|
2001
|
-
if
|
|
2002
|
-
token
|
|
2003
|
-
|
|
2053
|
+
if stream.literal_operator:
|
|
2054
|
+
if token in COMMAND_SEPARATORS:
|
|
2055
|
+
token = "\x00" + token
|
|
2056
|
+
tokens.append(token)
|
|
2057
|
+
else:
|
|
2058
|
+
tokens.extend(split_operators(token))
|
|
2004
2059
|
return [
|
|
2005
2060
|
token
|
|
2006
2061
|
for index, token in enumerate(tokens)
|
|
@@ -68,7 +68,10 @@ export const main = async (remoteArgs = process.argv.slice(2)) => {
|
|
|
68
68
|
// Import/call inside this boundary instead of forwarding raw Node bootstrap
|
|
69
69
|
// stderr. The scanner receives exactly the buffered Git stream.
|
|
70
70
|
const { main: scan } = await import("./lisa-history-secrets.mjs");
|
|
71
|
-
|
|
71
|
+
// Git's remote arguments bound a new ref's range by what that remote
|
|
72
|
+
// already holds; without them a new branch rescans the whole history.
|
|
73
|
+
if ((await scan(["pre-push", ...remoteArgs], process.cwd(), input)) !== 0)
|
|
74
|
+
failed = true;
|
|
72
75
|
} catch {
|
|
73
76
|
console.error(
|
|
74
77
|
"Managed history scanner is unavailable or damaged. Run full Lisa apply and retry; raw bootstrap errors are withheld."
|
|
@@ -12,6 +12,8 @@ import { createHash } from "node:crypto";
|
|
|
12
12
|
import {
|
|
13
13
|
chmodSync,
|
|
14
14
|
existsSync,
|
|
15
|
+
lstatSync,
|
|
16
|
+
readlinkSync,
|
|
15
17
|
mkdirSync,
|
|
16
18
|
readFileSync,
|
|
17
19
|
renameSync,
|
|
@@ -4515,7 +4517,28 @@ export function commitPendingLisaUpdate(ref, contract, cwd = process.cwd()) {
|
|
|
4515
4517
|
rmSync(marker, { force: true });
|
|
4516
4518
|
return;
|
|
4517
4519
|
}
|
|
4520
|
+
// The marker names paths, and a path is not the update: an edit made to one
|
|
4521
|
+
// of these files after the session-start update would otherwise be swept
|
|
4522
|
+
// into the update commit under its message (CodySwannGT/lisa#4393). Commit
|
|
4523
|
+
// only when every file still holds the bytes the update recorded; a legacy
|
|
4524
|
+
// marker with no digests cannot prove that, so it is left for a human too.
|
|
4525
|
+
const changed = changedSinceUpdate(pending, files, cwd);
|
|
4526
|
+
if (changed.length > 0) {
|
|
4527
|
+
console.error(
|
|
4528
|
+
`The pending Lisa ${pending.to} update was NOT committed automatically: ${pending.digests ? "these files changed after the update wrote them" : "its record predates content checks, so these files cannot be proved unchanged"}: ${changed.join(", ")}. Review them and commit the Lisa update as its own commit before feature work.`
|
|
4529
|
+
);
|
|
4530
|
+
return;
|
|
4531
|
+
}
|
|
4532
|
+
// Snapshot the index entries for these paths so a failed commit puts back
|
|
4533
|
+
// exactly what the user had staged, rather than unstaging it.
|
|
4534
|
+
const snapshot = run("git", ["ls-files", "-s", "-z", "--", ...files], {
|
|
4535
|
+
cwd,
|
|
4536
|
+
}).stdout;
|
|
4537
|
+
// Set once the commit has landed, so a later failure (reading its tree,
|
|
4538
|
+
// undoing it) is never reported as "not committed".
|
|
4539
|
+
let landed = false;
|
|
4518
4540
|
try {
|
|
4541
|
+
const previous = git(["rev-parse", "--verify", "HEAD"], { cwd });
|
|
4519
4542
|
git(["add", "--", ...files], { cwd });
|
|
4520
4543
|
// `--only` commits exactly these paths, so a feature edit the user had
|
|
4521
4544
|
// already staged stays staged and out of the update commit. The project's
|
|
@@ -4532,19 +4555,182 @@ export function commitPendingLisaUpdate(ref, contract, cwd = process.cwd()) {
|
|
|
4532
4555
|
],
|
|
4533
4556
|
{ cwd, timeout: 10 * 60 * 1000 }
|
|
4534
4557
|
);
|
|
4558
|
+
landed = true;
|
|
4559
|
+
// `--only` reads the paths again at commit time, and the project's hooks
|
|
4560
|
+
// run in between, so the comparison above does not by itself bind what
|
|
4561
|
+
// was committed. Check the commit's own tree against the recorded
|
|
4562
|
+
// identities; if anything differs, the commit is undone and the update
|
|
4563
|
+
// left for a human, exactly as if the check above had failed.
|
|
4564
|
+
const drifted = committedDrift(pending.digests, files, cwd);
|
|
4565
|
+
if (drifted.length > 0) {
|
|
4566
|
+
git(["reset", "--soft", previous], { cwd });
|
|
4567
|
+
landed = false;
|
|
4568
|
+
const restored = restoreIndexEntries(snapshot, files, cwd);
|
|
4569
|
+
console.error(
|
|
4570
|
+
`The pending Lisa ${pending.to} update was NOT committed automatically: these files changed while it was being committed: ${drifted.join(", ")}. The commit was undone${restored ? "" : ", but restoring what was staged for them failed; check `git status`"}. Review them and commit the Lisa update as its own commit before feature work.`
|
|
4571
|
+
);
|
|
4572
|
+
return;
|
|
4573
|
+
}
|
|
4535
4574
|
rmSync(marker, { force: true });
|
|
4536
4575
|
console.log(
|
|
4537
4576
|
`Committed the pending Lisa ${pending.to} update first, as its own commit, under ${ref}.`
|
|
4538
4577
|
);
|
|
4539
4578
|
} catch (error) {
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4579
|
+
if (landed) {
|
|
4580
|
+
console.error(
|
|
4581
|
+
`The pending Lisa ${pending.to} update was committed as HEAD, but it could not be verified or undone (${String(error?.message ?? error).split("\n")[0]}). Inspect HEAD before feature work; if it holds anything besides the Lisa update, undo it with git reset --soft HEAD~1.`
|
|
4582
|
+
);
|
|
4583
|
+
return;
|
|
4584
|
+
}
|
|
4585
|
+
const restored = restoreIndexEntries(snapshot, files, cwd);
|
|
4544
4586
|
console.error(
|
|
4545
|
-
`The pending Lisa ${pending.to} update could not be committed (${String(error?.message ?? error).split("\n")[0]}). Its files are still in the working tree; commit them as their own commit before feature work
|
|
4587
|
+
`The pending Lisa ${pending.to} update could not be committed (${String(error?.message ?? error).split("\n")[0]}). Its files are still in the working tree; commit them as their own commit before feature work.${restored ? "" : " Restoring what was staged for them beforehand also failed; check `git status` before committing."}`
|
|
4588
|
+
);
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
/**
|
|
4593
|
+
* Pending files whose current bytes differ from what the update recorded.
|
|
4594
|
+
*
|
|
4595
|
+
* Recomputed exactly as the auto-update's `workingTreeDigests` records them:
|
|
4596
|
+
* `<100644|100755> <blob id>` for a regular file, `120000 link:<target>` for a
|
|
4597
|
+
* symlink (never hash-object, which follows the link), null for an absent
|
|
4598
|
+
* path. A path the record does not carry, or one that is neither, counts as
|
|
4599
|
+
* changed.
|
|
4600
|
+
* @param {{digests?: Record<string, string | null>}} pending The marker.
|
|
4601
|
+
* @param {string[]} files Pending paths still dirty.
|
|
4602
|
+
* @param {string} cwd Repository directory.
|
|
4603
|
+
* @returns {string[]} The paths that cannot be proved unchanged.
|
|
4604
|
+
*/
|
|
4605
|
+
function changedSinceUpdate(pending, files, cwd) {
|
|
4606
|
+
const recorded = pending.digests;
|
|
4607
|
+
if (!recorded || typeof recorded !== "object") return [...files];
|
|
4608
|
+
const current = new Map();
|
|
4609
|
+
const present = [];
|
|
4610
|
+
for (const file of files) {
|
|
4611
|
+
let stat;
|
|
4612
|
+
try {
|
|
4613
|
+
stat = lstatSync(resolve(cwd, file));
|
|
4614
|
+
} catch {
|
|
4615
|
+
current.set(file, null);
|
|
4616
|
+
continue;
|
|
4617
|
+
}
|
|
4618
|
+
// Same identity the auto-update recorded: git mode plus blob id for a
|
|
4619
|
+
// file (so an executable-bit change alone counts), the link target for a
|
|
4620
|
+
// symlink (hash-object would follow it to whatever it now reaches).
|
|
4621
|
+
if (stat.isSymbolicLink()) {
|
|
4622
|
+
// A link that vanishes before it can be read stays unrecorded, which
|
|
4623
|
+
// counts as changed.
|
|
4624
|
+
try {
|
|
4625
|
+
current.set(file, `120000 link:${readlinkSync(resolve(cwd, file))}`);
|
|
4626
|
+
} catch {
|
|
4627
|
+
continue;
|
|
4628
|
+
}
|
|
4629
|
+
} else if (stat.isFile())
|
|
4630
|
+
present.push([file, stat.mode & 0o111 ? "100755" : "100644"]);
|
|
4631
|
+
}
|
|
4632
|
+
if (present.length > 0) {
|
|
4633
|
+
const ids = run(
|
|
4634
|
+
"git",
|
|
4635
|
+
["hash-object", "--", ...present.map(([file]) => file)],
|
|
4636
|
+
{
|
|
4637
|
+
cwd,
|
|
4638
|
+
allowFailure: true,
|
|
4639
|
+
}
|
|
4640
|
+
)
|
|
4641
|
+
.stdout.split("\n")
|
|
4642
|
+
.map(line => line.trim())
|
|
4643
|
+
.filter(Boolean);
|
|
4644
|
+
if (ids.length !== present.length) return [...files];
|
|
4645
|
+
present.forEach(([file, mode], index) =>
|
|
4646
|
+
current.set(file, `${mode} ${ids[index]}`)
|
|
4546
4647
|
);
|
|
4547
4648
|
}
|
|
4649
|
+
return files.filter(
|
|
4650
|
+
file =>
|
|
4651
|
+
!Object.hasOwn(recorded, file) ||
|
|
4652
|
+
!current.has(file) ||
|
|
4653
|
+
current.get(file) !== recorded[file]
|
|
4654
|
+
);
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
/**
|
|
4658
|
+
* Pending files whose entry in the new HEAD commit is not the recorded identity.
|
|
4659
|
+
*
|
|
4660
|
+
* Reads the commit's tree, not the working tree: a file absent from the record
|
|
4661
|
+
* as null must be absent from HEAD, a `<mode> <blob>` record must match the
|
|
4662
|
+
* tree entry exactly, and a `120000 link:<target>` record must be a symlink
|
|
4663
|
+
* entry whose blob is that target.
|
|
4664
|
+
* @param {Record<string, string | null>} recorded The marker's digests.
|
|
4665
|
+
* @param {string[]} files Paths the commit carried.
|
|
4666
|
+
* @param {string} cwd Repository directory.
|
|
4667
|
+
* @returns {string[]} The paths the commit does not hold as recorded.
|
|
4668
|
+
*/
|
|
4669
|
+
function committedDrift(recorded, files, cwd) {
|
|
4670
|
+
const listing = run("git", ["ls-tree", "-z", "HEAD", "--", ...files], {
|
|
4671
|
+
cwd,
|
|
4672
|
+
allowFailure: true,
|
|
4673
|
+
});
|
|
4674
|
+
// probe-direction: fail-closed — an unreadable tree counts every path as
|
|
4675
|
+
// drifted, which undoes the commit rather than trusting it.
|
|
4676
|
+
if (listing.status !== 0) return [...files];
|
|
4677
|
+
const entries = new Map();
|
|
4678
|
+
for (const record of listing.stdout.split("\0").filter(Boolean)) {
|
|
4679
|
+
const tab = record.indexOf("\t");
|
|
4680
|
+
const [mode, , blob] = record.slice(0, tab).split(" ");
|
|
4681
|
+
entries.set(record.slice(tab + 1), { mode, blob });
|
|
4682
|
+
}
|
|
4683
|
+
return files.filter(file => {
|
|
4684
|
+
const expected = recorded[file];
|
|
4685
|
+
const entry = entries.get(file);
|
|
4686
|
+
if (expected === null) return entry !== undefined;
|
|
4687
|
+
if (entry === undefined) return true;
|
|
4688
|
+
if (expected.startsWith("120000 link:")) {
|
|
4689
|
+
if (entry.mode !== "120000") return true;
|
|
4690
|
+
const target = run("git", ["cat-file", "blob", entry.blob], {
|
|
4691
|
+
cwd,
|
|
4692
|
+
allowFailure: true,
|
|
4693
|
+
});
|
|
4694
|
+
return (
|
|
4695
|
+
target.status !== 0 ||
|
|
4696
|
+
target.stdout !== expected.slice("120000 link:".length)
|
|
4697
|
+
);
|
|
4698
|
+
}
|
|
4699
|
+
return `${entry.mode} ${entry.blob}` !== expected;
|
|
4700
|
+
});
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
/**
|
|
4704
|
+
* Put the index entries for `files` back to a `git ls-files -s -z` snapshot.
|
|
4705
|
+
*
|
|
4706
|
+
* A path absent from the snapshot was not in the index before, so it stays
|
|
4707
|
+
* removed; every other path gets its recorded mode, blob and stage back.
|
|
4708
|
+
*
|
|
4709
|
+
* probe-direction: fail-closed — a failed git call returns false, which the
|
|
4710
|
+
* caller reports to the user as an index it could not restore; it never reads
|
|
4711
|
+
* as a successful restore.
|
|
4712
|
+
* @param {string} snapshot NUL-delimited `ls-files -s` output taken beforehand.
|
|
4713
|
+
* @param {string[]} files Paths the failed commit staged.
|
|
4714
|
+
* @param {string} cwd Repository directory.
|
|
4715
|
+
* @returns {boolean} Whether the restore succeeded.
|
|
4716
|
+
*/
|
|
4717
|
+
function restoreIndexEntries(snapshot, files, cwd) {
|
|
4718
|
+
const entries = snapshot.split("\0").filter(Boolean);
|
|
4719
|
+
// Drop every entry for these paths first, so a restored stage-0 entry does
|
|
4720
|
+
// not sit beside anything `git add` wrote; then lay the snapshot back.
|
|
4721
|
+
const removal = run(
|
|
4722
|
+
"git",
|
|
4723
|
+
["update-index", "--force-remove", "--", ...files],
|
|
4724
|
+
{ cwd, allowFailure: true }
|
|
4725
|
+
);
|
|
4726
|
+
if (removal.status !== 0) return false;
|
|
4727
|
+
if (entries.length === 0) return true;
|
|
4728
|
+
const restore = run("git", ["update-index", "-z", "--index-info"], {
|
|
4729
|
+
cwd,
|
|
4730
|
+
input: entries.map(entry => `${entry}\0`).join(""),
|
|
4731
|
+
allowFailure: true,
|
|
4732
|
+
});
|
|
4733
|
+
return restore.status === 0;
|
|
4548
4734
|
}
|
|
4549
4735
|
|
|
4550
4736
|
/**
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"children": []
|
|
133
133
|
},
|
|
134
134
|
"lib/history-secret-git.mjs": {
|
|
135
|
-
"sha256": "
|
|
135
|
+
"sha256": "7e0939373625ef741f9a455a1959abfaef6c69961ed4a30044d4dab0fa2d9916",
|
|
136
136
|
"staticImports": [
|
|
137
137
|
"node:child_process",
|
|
138
138
|
"node:fs",
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
"children": []
|
|
316
316
|
},
|
|
317
317
|
"lib/npm-update-contract.mjs": {
|
|
318
|
-
"sha256": "
|
|
318
|
+
"sha256": "d5c4bf65603bb212e1e8f99a39c38d9c5eff103b1f1b28966e20557bb7f3e85d",
|
|
319
319
|
"staticImports": [
|
|
320
320
|
"lib/automation-provenance-contract.mjs",
|
|
321
321
|
"lib/github-attestation-verifier.mjs",
|
|
@@ -1165,7 +1165,7 @@
|
|
|
1165
1165
|
"children": []
|
|
1166
1166
|
},
|
|
1167
1167
|
"lisa-history-secrets.mjs": {
|
|
1168
|
-
"sha256": "
|
|
1168
|
+
"sha256": "815fd6403aed6194d30939b59dc5ce894f7122a9da598acee4cd529a1b520de3",
|
|
1169
1169
|
"staticImports": [
|
|
1170
1170
|
"node:fs"
|
|
1171
1171
|
],
|
|
@@ -1204,7 +1204,7 @@
|
|
|
1204
1204
|
"children": []
|
|
1205
1205
|
},
|
|
1206
1206
|
"lisa-rails-prepush.mjs": {
|
|
1207
|
-
"sha256": "
|
|
1207
|
+
"sha256": "31a61d5c53db977fb1d6ff8f125ec785db98e79290a4ea5225e4322d9915038d",
|
|
1208
1208
|
"staticImports": [
|
|
1209
1209
|
"node:child_process",
|
|
1210
1210
|
"node:fs",
|
|
@@ -1258,7 +1258,7 @@
|
|
|
1258
1258
|
"children": []
|
|
1259
1259
|
},
|
|
1260
1260
|
"lisa-work-item.mjs": {
|
|
1261
|
-
"sha256": "
|
|
1261
|
+
"sha256": "203f110fd4752ff89d906276a5115500a2f42289d00cb5435345c90c433edf46",
|
|
1262
1262
|
"staticImports": [
|
|
1263
1263
|
"lib/invoked-as-script.mjs",
|
|
1264
1264
|
"node:child_process",
|
package/all/deletions.json
CHANGED
|
@@ -136,7 +136,8 @@
|
|
|
136
136
|
".claude/rules/security-audit-handling.md",
|
|
137
137
|
".claude/rules/verification.md",
|
|
138
138
|
".lisa-manifest",
|
|
139
|
-
".github/workflows/lisa-update.yml"
|
|
139
|
+
".github/workflows/lisa-update.yml",
|
|
140
|
+
"scripts/lisa-self-update.mjs"
|
|
140
141
|
],
|
|
141
142
|
"keep": [
|
|
142
143
|
"scripts/setup-deploy-key.sh",
|
|
@@ -277,6 +278,22 @@
|
|
|
277
278
|
".claude/rules/security-audit-handling.md": "needs-review",
|
|
278
279
|
".claude/rules/verification.md": "needs-review",
|
|
279
280
|
".lisa-manifest": "needs-review",
|
|
280
|
-
".github/workflows/lisa-update.yml": "legacy: the scheduled Lisa Update workflow (4.67.0-4.68.x) opened update pull requests as a bot and so needed a PAT secret in every repository; replaced by the local session-start auto-update (CodySwannGT/lisa#4337), which needs no token"
|
|
281
|
+
".github/workflows/lisa-update.yml": "legacy: the scheduled Lisa Update workflow (4.67.0-4.68.x) opened update pull requests as a bot and so needed a PAT secret in every repository; replaced by the local session-start auto-update (CodySwannGT/lisa#4337), which needs no token",
|
|
282
|
+
"scripts/lisa-self-update.mjs": "legacy: the self-update script (4.67.0-4.68.x) only ever ran from the scheduled Lisa Update workflow, retired with it in CodySwannGT/lisa#4337; removed only while unedited and unreferenced (CodySwannGT/lisa#4393)"
|
|
283
|
+
},
|
|
284
|
+
"retireUnmodified": {
|
|
285
|
+
".github/workflows/lisa-update.yml": [
|
|
286
|
+
"5fb8822126277d0e4c89d3086857653f313f74a13d96f3aeeae97a0f4ccd81b6",
|
|
287
|
+
"7fd71e48b7b84460eeef86e2f8e00b59001bd23071a54a9406d8e7e604e7fc4d",
|
|
288
|
+
"9c1c05ffe39a6d5e41a3e82afbbc227097e071b26d2bbc56281ef1373c5a035d"
|
|
289
|
+
],
|
|
290
|
+
"scripts/lisa-self-update.mjs": [
|
|
291
|
+
"1a455b97fc2e978a3bd039e327067b4c7ced7395808eed8eb4baa25c2b9c05e7",
|
|
292
|
+
"37f02f512e8d347885c302612895873087e0a62bb81f22436862764ff26c8a06",
|
|
293
|
+
"80d07132cffc8532e79f75acb1d1053c034800bec9b81b354131d4248934b02e",
|
|
294
|
+
"80dc15053af22133cfe50e48484b24b098eb9f2095999b649694ad11ce64175a",
|
|
295
|
+
"a123e9cdc7b090cec1ebaad1061487ed3fe7ae41ff29114182decb739c58ca7e",
|
|
296
|
+
"afbc340a6512e495b80ddfd327202812fc4ae333be8b6bfad74fb6d46df6fdca"
|
|
297
|
+
]
|
|
281
298
|
}
|
|
282
299
|
}
|