@codyswann/lisa 4.97.5 → 4.98.1

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 (96) hide show
  1. package/dist/cli/doctor-coderabbit.d.ts +3 -3
  2. package/dist/cli/doctor-coderabbit.d.ts.map +1 -1
  3. package/dist/cli/doctor-coderabbit.js +107 -34
  4. package/dist/cli/doctor-coderabbit.js.map +1 -1
  5. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  6. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  7. package/dist/core/upstream-evidence-manifest.js +31 -68
  8. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  9. package/package.json +5 -4
  10. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  11. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  12. package/plugins/lisa/rules/reference/derived-branch-plan.md +1 -1
  13. package/plugins/lisa-agy/plugin.json +1 -1
  14. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  15. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  16. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  17. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  19. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  21. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-copilot/rules/reference/derived-branch-plan.md +1 -1
  23. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-cursor/rules/derived-branch-plan-reference.mdc +1 -1
  25. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  27. package/plugins/lisa-devin/rules/reference/derived-branch-plan.md +1 -1
  28. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  29. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  30. package/plugins/lisa-expo-agy/plugin.json +1 -1
  31. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  35. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  37. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  38. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  42. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  44. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  45. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  49. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  51. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  52. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  56. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  59. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  63. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  65. package/plugins/lisa-rails-agy/plugin.json +1 -1
  66. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  70. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  72. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  73. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  77. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  80. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  84. package/plugins/src/base/rules/reference/derived-branch-plan.md +1 -1
  85. package/scripts/check-phrase-manifest-parity.mjs +105 -0
  86. package/scripts/classify-phrase-tests.mjs +54 -0
  87. package/scripts/fix-namespace-test-assertions.mjs +3 -19
  88. package/scripts/generate-phrase-manifest.mjs +98 -0
  89. package/scripts/lib/phrase-tests/ast.mjs +147 -0
  90. package/scripts/lib/phrase-tests/classify.mjs +293 -0
  91. package/scripts/lib/phrase-tests/fold.mjs +55 -0
  92. package/scripts/lib/phrase-tests/manifest.mjs +183 -0
  93. package/scripts/lib/phrase-tests/parity.mjs +87 -0
  94. package/scripts/lib/phrase-tests/record.mjs +568 -0
  95. package/scripts/lib/phrase-tests/repo.mjs +99 -0
  96. package/scripts/lib/phrase-tests/runner.mjs +256 -0
@@ -0,0 +1,256 @@
1
+ /**
2
+ * A minimal stand-in for the vitest runner API, used by the phrase recorder
3
+ * (CodySwannGT/lisa#4609) to execute a phrase-only test file for real.
4
+ *
5
+ * It registers `describe` / `it` / `test` (with `.each`, `.skip`, `.skipIf`,
6
+ * `.runIf`, `.only`, `.concurrent`, and placeholder entries that never run)
7
+ * and the four lifecycle hooks,
8
+ * then runs the tree in declaration order the way vitest does: `beforeAll`
9
+ * once per suite, `beforeEach` outer to inner around every test, `afterEach`
10
+ * inner to outer, `afterAll` last. Anything it does not model throws, so a
11
+ * file using it is reported rather than half-recorded.
12
+ * @module scripts/lib/phrase-tests/runner
13
+ */
14
+ import { format } from "node:util";
15
+
16
+ /**
17
+ * @typedef {object} Suite
18
+ * @property {string} name - Suite title.
19
+ * @property {Suite | undefined} parent - Enclosing suite.
20
+ * @property {Record<"beforeAll" | "beforeEach" | "afterEach" | "afterAll", Function[]>} hooks - Lifecycle hooks.
21
+ * @property {({ kind: "suite", suite: Suite } | { kind: "test", name: string, fn: Function | undefined, skip: boolean })[]} children - In declaration order.
22
+ */
23
+
24
+ /**
25
+ * A new empty suite.
26
+ * @param {string} name - Suite title.
27
+ * @param {Suite | undefined} parent - Enclosing suite.
28
+ * @returns {Suite} The suite.
29
+ */
30
+ function newSuite(name, parent) {
31
+ return {
32
+ name,
33
+ parent,
34
+ hooks: { beforeAll: [], beforeEach: [], afterEach: [], afterAll: [] },
35
+ children: [],
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Format an `.each` title the way vitest does for the common printf tokens.
41
+ * @param {string} title - The title template.
42
+ * @param {unknown[]} args - The row's arguments.
43
+ * @param {number} index - The row index, for `%#`.
44
+ * @returns {string} The title.
45
+ */
46
+ function eachTitle(title, args, index) {
47
+ const withIndex = title.replaceAll("%#", String(index));
48
+ const tokens = withIndex.match(/%[sdifjoO]/gu)?.length ?? 0;
49
+ if (tokens > 0) return format(withIndex, ...args.slice(0, tokens));
50
+ const row = args[0];
51
+ if (row !== null && typeof row === "object" && !Array.isArray(row)) {
52
+ return withIndex.replaceAll(/\$(\w+)/gu, (_match, key) =>
53
+ String(/** @type {Record<string, unknown>} */ (row)[key])
54
+ );
55
+ }
56
+ return withIndex;
57
+ }
58
+
59
+ /**
60
+ * The callback among a registration's trailing arguments
61
+ * (`it(name, fn)`, `it(name, fn, timeout)`, `it(name, options, fn)`).
62
+ * @param {unknown[]} rest - Arguments after the title.
63
+ * @returns {Function | undefined} The callback.
64
+ */
65
+ function callbackOf(rest) {
66
+ return /** @type {Function | undefined} */ (
67
+ rest.find(item => typeof item === "function")
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Bind one `.each` row to its callback: an array row is spread into the
73
+ * arguments, any other row is passed as the single argument, as vitest does.
74
+ * @param {Function | undefined} fn - The row callback.
75
+ * @param {unknown} row - One table row.
76
+ * @returns {{ args: unknown[], bound: Function | undefined }} The row's arguments and bound callback.
77
+ */
78
+ function bindRow(fn, row) {
79
+ const args = Array.isArray(row) ? row : [row];
80
+ return { args, bound: fn && (() => fn(...args)) };
81
+ }
82
+
83
+ /**
84
+ * The function `<api>.each(table)` returns: registers one entry per row.
85
+ * @param {unknown} table - The table (only arrays are supported).
86
+ * @param {(name: string, fn: Function | undefined, skip: boolean) => void} register - Records one registration.
87
+ * @param {boolean} skip - Whether the rows are skipped.
88
+ * @returns {(title: unknown, ...rest: unknown[]) => void} The registrar.
89
+ */
90
+ function eachRegistrar(table, register, skip) {
91
+ return (title, ...rest) => {
92
+ if (!Array.isArray(table)) {
93
+ throw new Error("tagged-template .each is not supported");
94
+ }
95
+ const fn = callbackOf(rest);
96
+ table.forEach((row, index) => {
97
+ const { args, bound } = bindRow(fn, row);
98
+ register(eachTitle(String(title), args, index), bound, skip);
99
+ });
100
+ };
101
+ }
102
+
103
+ /**
104
+ * A `describe` / `it` style function with vitest's modifiers.
105
+ * @typedef {((name: unknown, ...rest: unknown[]) => void) & { each: (table: unknown) => (title: unknown, ...rest: unknown[]) => void, skipIf: (condition: unknown) => Registrar, runIf: (condition: unknown) => Registrar, fails: () => never }} Registrar
106
+ */
107
+
108
+ /**
109
+ * Build a `describe` / `it` style function with vitest's modifiers.
110
+ * @param {(name: string, fn: Function | undefined, skip: boolean) => void} register - Records one registration.
111
+ * @param {boolean} skip - Whether registrations through this function are skipped.
112
+ * @returns {Registrar} The API function.
113
+ */
114
+ function registrar(register, skip) {
115
+ /** @type {Registrar} */
116
+ const api = Object.assign(
117
+ /** @type {(name: unknown, ...rest: unknown[]) => void} */ (
118
+ (name, ...rest) => register(String(name), callbackOf(rest), skip)
119
+ ),
120
+ {
121
+ /** @param {unknown} table - The `.each` table. */
122
+ each: table => eachRegistrar(table, register, skip),
123
+ /** @param {unknown} condition - Skip when truthy. */
124
+ skipIf: condition => (condition ? skipped() : api),
125
+ /** @param {unknown} condition - Run only when truthy. */
126
+ runIf: condition => (condition ? api : skipped()),
127
+ fails: () => {
128
+ throw new Error(".fails is not supported");
129
+ },
130
+ }
131
+ );
132
+ const skipped = () => registrar(register, true);
133
+ Object.defineProperties(api, {
134
+ skip: { get: skipped },
135
+ todo: { get: () => () => undefined },
136
+ only: { get: () => api },
137
+ concurrent: { get: () => api },
138
+ sequential: { get: () => api },
139
+ });
140
+ return api;
141
+ }
142
+
143
+ /**
144
+ * Create a fresh runner: the registration API plus `run()`.
145
+ * @param {{ onTest: (name: string | undefined) => void }} options - Told the
146
+ * full title of the test about to run (undefined outside any test), so the
147
+ * recorder can label what each assertion came from.
148
+ * @returns {{ api: Record<string, Function>, run: () => Promise<string[]> }}
149
+ * `run` resolves to the errors thrown by tests and hooks.
150
+ */
151
+ export function createRunner({ onTest }) {
152
+ const root = newSuite("", undefined);
153
+ let current = root;
154
+ const describe = registrar((name, fn, skip) => {
155
+ if (skip || fn === undefined) return;
156
+ const suite = newSuite(name, current);
157
+ current.children.push({ kind: "suite", suite });
158
+ const previous = current;
159
+ current = suite;
160
+ try {
161
+ fn();
162
+ } finally {
163
+ current = previous;
164
+ }
165
+ }, false);
166
+ const it = registrar((name, fn, skip) => {
167
+ current.children.push({ kind: "test", name, fn, skip });
168
+ }, false);
169
+ /** @type {(kind: keyof Suite["hooks"]) => (fn: Function) => void} */
170
+ const hook = kind => fn => {
171
+ current.hooks[kind].push(fn);
172
+ };
173
+ const api = {
174
+ describe,
175
+ suite: describe,
176
+ it,
177
+ test: it,
178
+ beforeAll: hook("beforeAll"),
179
+ beforeEach: hook("beforeEach"),
180
+ afterEach: hook("afterEach"),
181
+ afterAll: hook("afterAll"),
182
+ };
183
+ const run = async () => {
184
+ /** @type {string[]} */
185
+ const errors = [];
186
+ await runSuite(root, [], errors, onTest);
187
+ onTest(undefined);
188
+ return errors;
189
+ };
190
+ return { api, run };
191
+ }
192
+
193
+ /**
194
+ * Await a callback, collecting what it throws.
195
+ * @param {Function} fn - The callback.
196
+ * @param {string} label - What it is, for the error text.
197
+ * @param {string[]} errors - Collects failures.
198
+ * @returns {Promise<boolean>} True when it completed.
199
+ */
200
+ async function attempt(fn, label, errors) {
201
+ try {
202
+ await fn({});
203
+ return true;
204
+ } catch (error) {
205
+ errors.push(
206
+ `${label}: ${error instanceof Error ? error.message : String(error)}`
207
+ );
208
+ return false;
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Every suite from the root down to `suite`.
214
+ * @param {Suite} suite - The innermost suite.
215
+ * @returns {Suite[]} Outer to inner.
216
+ */
217
+ function lineage(suite) {
218
+ return suite.parent ? [...lineage(suite.parent), suite] : [suite];
219
+ }
220
+
221
+ /**
222
+ * Run one suite's hooks and children in declaration order.
223
+ * @param {Suite} suite - The suite.
224
+ * @param {string[]} titles - Enclosing titles.
225
+ * @param {string[]} errors - Collects failures.
226
+ * @param {(name: string | undefined) => void} onTest - Test-start callback.
227
+ * @returns {Promise<void>} Resolves when the suite is done.
228
+ */
229
+ async function runSuite(suite, titles, errors, onTest) {
230
+ const path = suite.name ? [...titles, suite.name] : titles;
231
+ const label = path.join(" > ") || "(file)";
232
+ for (const fn of suite.hooks.beforeAll) {
233
+ if (!(await attempt(fn, `${label} beforeAll`, errors))) return;
234
+ }
235
+ for (const child of suite.children) {
236
+ if (child.kind === "suite") {
237
+ await runSuite(child.suite, path, errors, onTest);
238
+ continue;
239
+ }
240
+ if (child.skip || child.fn === undefined) continue;
241
+ const name = [...path, child.name].join(" > ");
242
+ onTest(name);
243
+ const chain = lineage(suite);
244
+ const before = chain.flatMap(item => item.hooks.beforeEach);
245
+ const after = [...chain].reverse().flatMap(item => item.hooks.afterEach);
246
+ let ok = true;
247
+ for (const fn of before)
248
+ ok = ok && (await attempt(fn, `${name} beforeEach`, errors));
249
+ if (ok) await attempt(child.fn, name, errors);
250
+ for (const fn of after) await attempt(fn, `${name} afterEach`, errors);
251
+ onTest(undefined);
252
+ }
253
+ for (const fn of suite.hooks.afterAll) {
254
+ await attempt(fn, `${label} afterAll`, errors);
255
+ }
256
+ }