@codyswann/lisa 5.2.0 → 5.2.2

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/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +31 -60
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/package.json +4 -5
  6. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa/.codex-plugin/skills/lisa-learnings-audit/SKILL.md +53 -10
  9. package/plugins/lisa/skills/lisa-learnings-audit/SKILL.md +53 -10
  10. package/plugins/lisa-agy/plugin.json +1 -1
  11. package/plugins/lisa-agy/skills/lisa-learnings-audit/SKILL.md +53 -10
  12. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  13. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  14. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  15. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  16. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  19. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-copilot/skills/lisa-learnings-audit/SKILL.md +53 -10
  21. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cursor/skills/lisa-learnings-audit/SKILL.md +53 -10
  23. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  25. package/plugins/lisa-devin/skills/lisa-learnings-audit/SKILL.md +53 -10
  26. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  27. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  28. package/plugins/lisa-expo-agy/plugin.json +1 -1
  29. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  33. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  35. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  36. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  40. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  42. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  43. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  47. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  49. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  50. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  54. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  56. package/plugins/lisa-rails-agy/plugin.json +1 -1
  57. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  61. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  63. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  64. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  68. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  71. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  75. package/plugins/src/base/skills/lisa-learnings-audit/SKILL.md +53 -10
  76. package/scripts/check-phrase-manifest-parity.mjs +6 -3
  77. package/scripts/classify-phrase-tests.mjs +109 -20
  78. package/scripts/fix-namespace-test-assertions.mjs +3 -20
  79. package/scripts/lib/phrase-tests/doc-taint.mjs +708 -0
  80. package/scripts/lib/phrase-tests/inventory.mjs +381 -0
  81. package/scripts/lib/phrase-tests/manifest.mjs +14 -2
  82. package/scripts/lib/phrase-tests/marker-classes.mjs +323 -0
  83. package/scripts/lib/phrase-tests/redact.mjs +88 -0
@@ -96,11 +96,49 @@ results stays green whatever the code does. For every RETIRE whose proof is
96
96
  "owned by a test" (or any other mechanical owner that runs as a check), run
97
97
  the mutation proof before filing the row: break the rule the named test
98
98
  supposedly guards, run that named test and observe it **fail**, then revert
99
- the mutation and see it pass again. Record the result in the row — the
100
- mutation applied, the failing test name and its failure line, and the
101
- revert. A named owner that stays green under the mutation is not the owner:
102
- find the test that does fail, or drop the RETIRE. No failing observation ⇒
103
- no valid retire proof.
99
+ the mutation. Record the result in the row — the mutation applied, the
100
+ failing test name and its failure line, and the revert. A named owner that
101
+ stays green under the mutation is not the owner: find the test that does
102
+ fail, or drop the RETIRE. No failing observation ⇒ no valid retire proof.
103
+
104
+ Run that break on a scratch copy,
105
+ never in a worktree another agent is editing — not in the working folder
106
+ this run is using either. The `falsifiable-checks` rule's section
107
+ "Break on a scratch copy, never in a shared worktree" is the full recipe.
108
+ This skill carries the minimum itself, because some agents (Codex,
109
+ Antigravity) receive this skill without the rules tree:
110
+
111
+ ```sh
112
+ tmp=$(mktemp -d) # record this path first (step 1)
113
+ git worktree add --detach "$tmp" HEAD
114
+ git diff --binary HEAD | git -C "$tmp" apply --allow-empty
115
+ # copy untracked new files; install dependencies in "$tmp" (a linked
116
+ # node_modules in a workspace monorepo resolves back to the shared tree)
117
+ # baseline: run the named test in "$tmp" BEFORE breaking anything; it must be green
118
+ # break the rule in "$tmp", run the named test there, read the failure
119
+ git worktree remove --force "$tmp" # discarding the copy is the revert
120
+ ```
121
+
122
+ Address the copy by absolute path; never switch the session into it with a
123
+ harness tool such as `EnterWorktree`. A red baseline means the copy is
124
+ incomplete, not that the test bites. Discarding the copy is the revert, and
125
+ the green baseline taken in the copy before the break is the pass-again
126
+ evidence, so the shared tree is never written to.
127
+
128
+ 1. **Record where before you break.** Before applying the mutation, write
129
+ the row's `mutation_location` — the mutated file, the line or section,
130
+ and the absolute path of the scratch copy — into the run's working notes
131
+ for that candidate. It goes in the RETIRE row with the rest of the proof,
132
+ and it exists before the mutation does, so an interrupted run still says
133
+ what was changed and where.
134
+ 2. **A failed restore blocks the row.** If discarding the copy fails (the
135
+ `git worktree remove` errors, or the copy path still exists afterwards),
136
+ or anything suggests the mutation reached a tree other than the copy,
137
+ file **no** RETIRE row for that candidate and run no further mutation
138
+ proofs. Report `mutation-restore-failed` with the recorded
139
+ `mutation_location`, escalated per Escalation, so a person can find and
140
+ repair the change. The run outcome is `recovery-required` (see Run
141
+ outcomes).
104
142
 
105
143
  **Learned planning checks.** A ledger entry whose rule begins
106
144
  `Planning (prd|decomposition|ready-gate|filing):` is a `planning-miss` learning:
@@ -351,8 +389,8 @@ rejected by rule (see the `promotion-contract` rule):
351
389
  **One batch ticket per run — CONFIRM + RETIRE** (`issue_type: Task`): a single
352
390
  ticket listing every CONFIRM row (`last_confirmed` bump, with the evidence the
353
391
  entry demonstrably applied) and every **provably-redundant** RETIRE row (with
354
- the mechanical owner / staleness proof per row, and the mutation proof when the
355
- owner is a test). Every RETIRE row also carries the entry's full
392
+ the mechanical owner / staleness proof per row, and the mutation proof with its
393
+ `mutation_location` when the owner is a test). Every RETIRE row also carries the entry's full
356
394
  `expectedFingerprint`: the live `entry.fingerprint` read from the parsed ledger
357
395
  at audit time (`learning-` plus 20 hex digits, or a legacy token). It is not the
358
396
  12-hex `<invariant-hash>` in the row's `[lisa-gardener]` marker — the two are
@@ -496,7 +534,10 @@ non-technical operator standing at the gate can act on.
496
534
  ## Recovery
497
535
 
498
536
  Every external write is marker-deduped, so a crashed or interrupted run
499
- leaves no cleanup debt: re-running is the recovery procedure. A partial run's
537
+ leaves no cleanup debt: re-running is the recovery procedure. The one
538
+ exception is a RETIRE mutation proof's scratch copy: a run interrupted
539
+ mid-proof can leave it on disk, and its recorded `mutation_location` names
540
+ the path to remove before re-running. A partial run's
500
541
  already-filed tickets are found by their markers and not duplicated; a batch
501
542
  ticket from an interrupted run is reused (append missing rows as a comment)
502
543
  rather than reissued. **Filing order**: file the per-item PROMOTE/DEMOTE
@@ -525,8 +566,10 @@ exact so nothing regresses:
525
566
  recommendation threshold. Report one line: surfaces scanned, entries seen,
526
567
  "nothing to propose".
527
568
  - `blocked` → **`recovery-required`** when the loop itself could not complete
528
- (tracker unreachable, contradictory config, a ledger-contract parse error) —
529
- escalated per Escalation with the operator-readable reason; **or**
569
+ (tracker unreachable, contradictory config, a ledger-contract parse error,
570
+ or a RETIRE mutation proof whose scratch copy could not be discarded, so a
571
+ mutation may survive outside the run's control) — escalated per Escalation
572
+ with the operator-readable reason; **or**
530
573
  **`approval-requested`** when the run finished and is waiting on a human gate
531
574
  rather than being broken.
532
575
  A run that filed nothing because destination-validation (Ticket emission)
@@ -24,7 +24,10 @@
24
24
  *
25
25
  * Usage:
26
26
  * node scripts/check-phrase-manifest-parity.mjs --base <ref> [--head <ref>] [--exact]
27
- * `bun run check:phrase-manifest-parity` pins the fold commit as the range.
27
+ * The fold's own range was `--base 02b59a6297 --head 5207036771 --exact`. It
28
+ * is no longer a package script: CodySwannGT/lisa#4867 pruned the manifest to
29
+ * its load-bearing entries, so the fold's wording pins are gone from it by
30
+ * design, and the check is a record of how the fold was proven, not a gate.
28
31
  * @module scripts/check-phrase-manifest-parity
29
32
  */
30
33
  import { readFileSync } from "node:fs";
@@ -48,8 +51,8 @@ import {
48
51
  const argv = process.argv.slice(2);
49
52
 
50
53
  /**
51
- * The value of the last occurrence of a flag, so a flag appended to
52
- * `bun run check:phrase-manifest-parity` overrides the package script's.
54
+ * The value of the last occurrence of a flag, so a flag given later on the
55
+ * command line overrides an earlier one.
53
56
  * @param {string} name - Flag name, e.g. `--base`.
54
57
  * @returns {string | undefined} Its value, or undefined when absent.
55
58
  */
@@ -8,9 +8,33 @@
8
8
  * node scripts/classify-phrase-tests.mjs # one line per file
9
9
  * node scripts/classify-phrase-tests.mjs --json # machine-readable
10
10
  * node scripts/classify-phrase-tests.mjs --all # also rejected files, with reasons
11
+ *
12
+ * Phrase classes (CodySwannGT/lisa#4867; rules in `lib/phrase-tests/marker-classes.mjs`):
13
+ * node scripts/classify-phrase-tests.mjs --classify-manifest # every manifest entry, JSON
14
+ * node scripts/classify-phrase-tests.mjs --classify-assertions # every Markdown phrase assertion in tests, JSON
15
+ * node scripts/classify-phrase-tests.mjs --prune-manifest # drop WORDING; move NOT-MARKDOWN entries to the source-text guards
16
+ * Each entry is MACHINE-TOKEN (with the parser that reads it), STRUCTURAL or
17
+ * WORDING; an assertion whose argument is not a literal is UNRESOLVED.
18
+ * `counts` covers only assertions on Markdown text; `bySource` also counts
19
+ * those on other text (script output) and on text it could not trace.
11
20
  * @module scripts/classify-phrase-tests
12
21
  */
22
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
23
+ import path from "node:path";
24
+
13
25
  import { classifyTestSource } from "./lib/phrase-tests/classify.mjs";
26
+ import {
27
+ classifyAssertions,
28
+ classifyManifest,
29
+ countByClass,
30
+ countBySource,
31
+ pruneManifest,
32
+ } from "./lib/phrase-tests/inventory.mjs";
33
+ import {
34
+ MANIFEST_PATH,
35
+ SOURCE_GUARDS_PATH,
36
+ } from "./lib/phrase-tests/manifest.mjs";
37
+ import { redactDeep, redactText } from "./lib/phrase-tests/redact.mjs";
14
38
  import {
15
39
  REPO_ROOT,
16
40
  workingTreeReader,
@@ -19,36 +43,101 @@ import {
19
43
 
20
44
  const args = new Set(process.argv.slice(2));
21
45
  const readSource = workingTreeReader(REPO_ROOT);
22
- const verdicts = workingTreeTestFiles(REPO_ROOT).map(file =>
23
- classifyTestSource(file, readSource(file) ?? "", readSource)
24
- );
25
- const phraseOnly = verdicts.filter(verdict => verdict.phraseOnly);
26
- const shown = args.has("--all") ? verdicts : phraseOnly;
46
+ const manifestFile = path.join(REPO_ROOT, MANIFEST_PATH);
27
47
 
28
- if (args.has("--json")) {
29
- console.log(
30
- JSON.stringify(
31
- {
32
- testFiles: verdicts.length,
33
- phraseOnly: phraseOnly.length,
34
- assertionSites: phraseOnly.reduce((sum, v) => sum + v.assertions, 0),
35
- files: shown,
36
- },
37
- null,
38
- 2
39
- )
48
+ /**
49
+ * Print a report as JSON, with every credential-shaped string redacted: the
50
+ * reports copy assertion arguments verbatim, and some are fixture secrets.
51
+ * Never follow this with `process.exit`: stdout to a pipe is asynchronous,
52
+ * and exiting early truncates the report at 64 KiB.
53
+ * @param {unknown} report - The report.
54
+ */
55
+ function printJson(report) {
56
+ process.stdout.write(`${JSON.stringify(redactDeep(report), null, 2)}\n`);
57
+ }
58
+
59
+ /**
60
+ * The required-phrases manifest on disk.
61
+ * @returns {import("./lib/phrase-tests/manifest.mjs").Manifest} The manifest.
62
+ */
63
+ function readManifest() {
64
+ return JSON.parse(readFileSync(manifestFile, "utf8"));
65
+ }
66
+
67
+ /** `--classify-assertions`: every Markdown phrase assertion in the tests. */
68
+ function reportAssertions() {
69
+ const sites = workingTreeTestFiles(REPO_ROOT).flatMap(file =>
70
+ classifyAssertions(file, readSource(file) ?? "")
40
71
  );
41
- } else {
72
+ const markdown = sites.filter(site => site.source === "markdown");
73
+ const files = [...new Set(sites.map(site => site.file))].map(file => {
74
+ const own = sites.filter(site => site.file === file);
75
+ return {
76
+ file,
77
+ sites: own.length,
78
+ counts: countByClass(own.filter(site => site.source === "markdown")),
79
+ bySource: countBySource(own),
80
+ };
81
+ });
82
+ printJson({
83
+ testFiles: files.length,
84
+ sites: sites.length,
85
+ markdownSites: markdown.length,
86
+ counts: countByClass(markdown),
87
+ bySource: countBySource(sites),
88
+ files,
89
+ verdicts: sites,
90
+ });
91
+ }
92
+
93
+ /** The original mode: which test files are phrase-only (#4609). */
94
+ function reportPhraseOnlyFiles() {
95
+ const verdicts = workingTreeTestFiles(REPO_ROOT).map(file =>
96
+ classifyTestSource(file, readSource(file) ?? "", readSource)
97
+ );
98
+ const phraseOnly = verdicts.filter(verdict => verdict.phraseOnly);
99
+ const shown = args.has("--all") ? verdicts : phraseOnly;
100
+ const sites = phraseOnly.reduce((sum, v) => sum + v.assertions, 0);
101
+ if (args.has("--json")) {
102
+ printJson({
103
+ testFiles: verdicts.length,
104
+ phraseOnly: phraseOnly.length,
105
+ assertionSites: sites,
106
+ files: shown,
107
+ });
108
+ return;
109
+ }
42
110
  for (const verdict of shown) {
43
111
  const tail = verdict.phraseOnly
44
112
  ? ""
45
113
  : ` REJECTED: ${verdict.reasons.join("; ")}`;
46
114
  console.log(
47
- `${String(verdict.assertions).padStart(5)} ${verdict.file}${tail}`
115
+ redactText(
116
+ `${String(verdict.assertions).padStart(5)} ${verdict.file}${tail}`
117
+ )
48
118
  );
49
119
  }
50
120
  console.log(
51
121
  `${phraseOnly.length} phrase-only of ${verdicts.length} test files; ` +
52
- `${phraseOnly.reduce((sum, v) => sum + v.assertions, 0)} assertion sites`
122
+ `${sites} assertion sites`
53
123
  );
54
124
  }
125
+
126
+ if (args.has("--classify-manifest")) {
127
+ printJson(classifyManifest(readManifest()));
128
+ } else if (args.has("--prune-manifest")) {
129
+ const guardsFile = path.join(REPO_ROOT, SOURCE_GUARDS_PATH);
130
+ const existingGuards = existsSync(guardsFile)
131
+ ? JSON.parse(readFileSync(guardsFile, "utf8"))
132
+ : undefined;
133
+ const { manifest, sourceGuards } = pruneManifest(
134
+ readManifest(),
135
+ existingGuards
136
+ );
137
+ writeFileSync(manifestFile, `${JSON.stringify(manifest, null, 2)}\n`);
138
+ writeFileSync(guardsFile, `${JSON.stringify(sourceGuards, null, 2)}\n`);
139
+ } else if (args.has("--classify-assertions")) {
140
+ reportAssertions();
141
+ } else {
142
+ reportPhraseOnlyFiles();
143
+ }
@@ -25,16 +25,9 @@ function patchFile(file, replacements) {
25
25
  }
26
26
 
27
27
  const testPatches = [
28
- // Skill invocation refs in tests (colon → hyphen for skills). The
29
- // phrase-only suites this also patched were folded into
30
- // tests/phrase-manifest/required-phrases.json (CodySwannGT/lisa#4609).
31
- [
32
- "tests/unit/strategies/prd-intake-s10-hard-gate.test.ts",
33
- [
34
- ["lisa:tracker-validate", "lisa-tracker-validate"],
35
- ["lisa:task-decomposition", "lisa-task-decomposition"],
36
- ],
37
- ],
28
+ // The phrase-only suites this also patched were folded into the phrase
29
+ // manifest (CodySwannGT/lisa#4609), and their wording pins were later
30
+ // culled (CodySwannGT/lisa#4867), so they no longer appear here.
38
31
  // agent-transformer output uses normalized skill names
39
32
  [
40
33
  "tests/unit/codex/agent-transformer.test.ts",
@@ -80,16 +73,6 @@ const testPatches = [
80
73
  ],
81
74
  ],
82
75
  ],
83
- // prd-intake-verify-dispatch: rule cites /lisa:verify-prd command
84
- [
85
- "tests/unit/strategies/prd-intake-verify-dispatch.test.ts",
86
- [
87
- [
88
- 'const VERIFY = "lisa-verify-prd";',
89
- 'const VERIFY = "/lisa:verify-prd";',
90
- ],
91
- ],
92
- ],
93
76
  // harper-fabric template script name unchanged
94
77
  [
95
78
  "tests/unit/strategies/harper-fabric-template-no-advisory-pollution.test.ts",