@codyswann/lisa 4.95.0 → 4.95.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 (107) hide show
  1. package/all/copy-overwrite/scripts/lisa-gates.mjs +2 -2
  2. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +6 -6
  3. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +2 -2
  4. package/dist/cli/doctor-learnings-driver-command.d.ts +12 -0
  5. package/dist/cli/doctor-learnings-driver-command.d.ts.map +1 -0
  6. package/dist/cli/doctor-learnings-driver-command.js +80 -0
  7. package/dist/cli/doctor-learnings-driver-command.js.map +1 -0
  8. package/dist/cli/doctor-merge-drivers.d.ts +7 -3
  9. package/dist/cli/doctor-merge-drivers.d.ts.map +1 -1
  10. package/dist/cli/doctor-merge-drivers.js +43 -5
  11. package/dist/cli/doctor-merge-drivers.js.map +1 -1
  12. package/dist/cli/gate-commands.d.ts.map +1 -1
  13. package/dist/cli/gate-commands.js +1 -0
  14. package/dist/cli/gate-commands.js.map +1 -1
  15. package/dist/cli/merge-learnings-cmd.d.ts +6 -0
  16. package/dist/cli/merge-learnings-cmd.d.ts.map +1 -1
  17. package/dist/cli/merge-learnings-cmd.js +24 -1
  18. package/dist/cli/merge-learnings-cmd.js.map +1 -1
  19. package/dist/core/learnings-merge-driver-command.d.ts +38 -0
  20. package/dist/core/learnings-merge-driver-command.d.ts.map +1 -0
  21. package/dist/core/learnings-merge-driver-command.js +151 -0
  22. package/dist/core/learnings-merge-driver-command.js.map +1 -0
  23. package/dist/core/learnings-merge-driver-install.d.ts +19 -3
  24. package/dist/core/learnings-merge-driver-install.d.ts.map +1 -1
  25. package/dist/core/learnings-merge-driver-install.js +65 -32
  26. package/dist/core/learnings-merge-driver-install.js.map +1 -1
  27. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  28. package/dist/core/lisa-owned-hash-ledger.js +6 -0
  29. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  30. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  31. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  32. package/dist/core/upstream-evidence-manifest.js +10 -6
  33. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  34. package/package.json +6 -5
  35. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  37. package/plugins/lisa-agy/plugin.json +1 -1
  38. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  40. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  41. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  45. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  49. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  51. package/plugins/lisa-expo-agy/plugin.json +1 -1
  52. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  56. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  58. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  59. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  63. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  65. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  66. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  70. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  72. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  73. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  77. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  80. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  84. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  86. package/plugins/lisa-rails-agy/plugin.json +1 -1
  87. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  91. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  93. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  94. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  98. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  100. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  101. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  105. package/scripts/check-engine-floor.mjs +21 -4
  106. package/scripts/check-typecheck-tests.mjs +23 -6
  107. package/scripts/lib/dependency-tree.mjs +1 -1
@@ -5442,13 +5442,13 @@ export function auditConfigKeys(config) {
5442
5442
  * @param {object} options Resolution inputs.
5443
5443
  * @param {object} options.gates The gates block.
5444
5444
  * @param {string} options.moment The moment to resolve.
5445
- * @param {string} [options.runner] Task-runner prefix.
5445
+ * @param {string|undefined} [options.runner] Task-runner prefix.
5446
5446
  * @param {boolean} [options.includeOff] Also report gates declared `off`, as
5447
5447
  * entries with `level: "off"` and no task. Default false, because every
5448
5448
  * consumer that RUNS these entries must not see a gate the project turned
5449
5449
  * off. Callers that need to tell "declared off" from "never declared" — the
5450
5450
  * CI façade does — pass true and branch on the level themselves.
5451
- * @param {Record<string, string>|null} [options.scripts] The project's
5451
+ * @param {Record<string, string>|null|undefined} [options.scripts] The project's
5452
5452
  * `package.json` scripts, from `projectScripts`. Omitted or `null` means
5453
5453
  * UNKNOWN, and an unknown manifest resolves exactly as it did before this
5454
5454
  * option existed — a caller that has not been taught to read the manifest
@@ -352,7 +352,7 @@ function normaliseExec(raw) {
352
352
  * code says so — the transcript it leaves behind is truncated and reads like
353
353
  * an ordinary failure.
354
354
  * @param {GateOutcome} gate The resolved gate.
355
- * @param {function(string, GateOutcome): (number|null|object)} exec Executor.
355
+ * @param {(command: string, gate: GateOutcome) => (number|null|object)} exec Executor.
356
356
  * @returns {{state: string, detail: string, code: number|null,
357
357
  * diagnosis: string|null, evidence: string[]}} The outcome.
358
358
  */
@@ -795,7 +795,7 @@ function verdictFor(gate, { proved, blockedBy, exec, siblings, declarations }) {
795
795
  * @param {object} options.gates The gates block from `.lisa.config.json`.
796
796
  * @param {string} options.moment The moment to run.
797
797
  * @param {string} [options.runner] Task-runner prefix, e.g. `bun run`.
798
- * @param {function(string, GateOutcome): (number|null|undefined|{code: number|null, output: string|null})} options.exec
798
+ * @param {(command: string, gate: GateOutcome) => (number|null|undefined|{code: number|null, output: string|null})} options.exec
799
799
  * Executor. BOTH shapes, because `normaliseExec` accepts both and the shipped
800
800
  * default executor returns the object one. Declaring only `number|null` here
801
801
  * was not merely narrow, it was wrong about the case this runner exists to
@@ -803,7 +803,7 @@ function verdictFor(gate, { proved, blockedBy, exec, siblings, declarations }) {
803
803
  * transcript, and a number-only type can express the null while silently
804
804
  * erasing the transcript that says what the run was doing when it died.
805
805
  * A type that cannot describe `spawnExec` is a type no caller can trust.
806
- * @param {function(string): void} [options.out] Line sink; defaults to stdout.
806
+ * @param {(line: string) => void} [options.out] Line sink; defaults to stdout.
807
807
  * @param {Record<string, string>|null} [options.scripts] The project's package
808
808
  * scripts, from `projectScripts`. `null` means unknown, and an unknown
809
809
  * manifest resolves exactly as it did before `shippedAs` was consulted.
@@ -812,10 +812,10 @@ function verdictFor(gate, { proved, blockedBy, exec, siblings, declarations }) {
812
812
  * history instead of having to terminate a real run an hour ago. Defaults to
813
813
  * reading them, and the default is evaluated HERE — before any gate runs —
814
814
  * so a run cannot read back the mark it is about to write.
815
- * @param {function({kind: string, gateId: string}): boolean} [options.recordKill]
815
+ * @param {(kill: {kind: string, gateId: string}) => boolean} [options.recordKill]
816
816
  * Kill-marker writer, injectable so marker cardinality can be proved without
817
817
  * writing to the host's shared marker directory.
818
- * @param {function(): (string|null)} [options.interrupted] Asks, between gates and before returning,
818
+ * @param {() => (string|null)} [options.interrupted] Asks, between gates and before returning,
819
819
  * whether the run this chain serves is still there. Injectable for the same
820
820
  * reason `exec` is: a test states that the caller went away instead of having
821
821
  * to kill a real hook mid-chain.
@@ -1724,7 +1724,7 @@ function validateCommand() {
1724
1724
  * says when the problem is gone.
1725
1725
  * @param {string} moment The moment that was asked for.
1726
1726
  * @param {string[]} problems Blocking problems, from `configurationProblems`.
1727
- * @param {function(string): void} out Line sink.
1727
+ * @param {(line: string) => void} out Line sink.
1728
1728
  */
1729
1729
  function reportRefusal(moment, problems, out) {
1730
1730
  const many = problems.length !== 1;
@@ -1325,7 +1325,7 @@
1325
1325
  "children": []
1326
1326
  },
1327
1327
  "lisa-gates.mjs": {
1328
- "sha256": "1323a4b7ebad4d4f5978ce41576c63bd55b165ce55192c5188a53d6da87fc0fa",
1328
+ "sha256": "28dd99fa96f43f4f68b5b442e7f24a59c834f0b1a5c4fde777aeb3689592668e",
1329
1329
  "staticImports": [
1330
1330
  "lib/invoked-as-script.mjs",
1331
1331
  "node:crypto",
@@ -1394,7 +1394,7 @@
1394
1394
  ]
1395
1395
  },
1396
1396
  "lisa-run-gates.mjs": {
1397
- "sha256": "f18880e3f1b015de3ef826b3507101603d6dd43ac4a790840d64d34e3bc67f2d",
1397
+ "sha256": "8ee6487fec0177d780101a3a9e4f4ce0bd75f94074baee17966cdb9927c3de41",
1398
1398
  "staticImports": [
1399
1399
  "lib/bounded-spawn.mjs",
1400
1400
  "lib/gate-failure-diagnosis.mjs",
@@ -0,0 +1,12 @@
1
+ /** A finding about the learnings driver's command. */
2
+ export interface LearningsDriverCommandFinding {
3
+ readonly status: "warn" | "fail";
4
+ readonly detail: string;
5
+ }
6
+ /**
7
+ * Inspect the registered learnings driver command in this checkout.
8
+ * @param targetPath - Project path to inspect
9
+ * @returns A finding, or undefined when the command can run (or cannot be judged)
10
+ */
11
+ export declare function inspectLearningsDriverCommand(targetPath: string): Promise<LearningsDriverCommandFinding | undefined>;
12
+ //# sourceMappingURL=doctor-learnings-driver-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-learnings-driver-command.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-learnings-driver-command.ts"],"names":[],"mappings":"AAuBA,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA0CD;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAmBpD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * `lisa doctor`: can the registered learnings merge driver actually RUN here?
3
+ *
4
+ * Being registered is not the same as working (CodySwannGT/lisa#4640). Before
5
+ * that fix, `lisa apply` registered `'<runtime>' '<entry>'` of whichever
6
+ * checkout ran it, into `.git/config` — which every linked worktree shares.
7
+ * When that checkout is removed, git reports a conflict on every learnings
8
+ * merge and leaves the ledger as our side only, with NO conflict markers, so
9
+ * staging it silently drops the other branch's learnings. The key is still
10
+ * set, so a set-or-unset check reports it fine.
11
+ *
12
+ * This is the one merge-driver state doctor reports as `fail`: unlike an
13
+ * unregistered driver, which degrades to a loud text merge, a dangling one
14
+ * loses content without a marker to show for it.
15
+ * @module cli/doctor-learnings-driver-command
16
+ */
17
+ import { access } from "node:fs/promises";
18
+ import * as path from "node:path";
19
+ import { classifyLearningsDriverCommand } from "../core/learnings-merge-driver-command.js";
20
+ import { readLearningsMergeDriverRegistration } from "../core/learnings-merge-driver-install.js";
21
+ import { LEARNINGS_MERGE_DRIVER_NAME } from "../core/learnings-merge-driver.js";
22
+ const KEY = `merge.${LEARNINGS_MERGE_DRIVER_NAME}.driver`;
23
+ const REMEDY = "Re-register it with `lisa install-merge-driver` (or any `lisa apply`) run here, which writes a command that resolves Lisa inside whichever worktree is merging.";
24
+ /**
25
+ * Whether a path exists.
26
+ * @param target - Path to test
27
+ * @returns True when it exists
28
+ */
29
+ async function exists(target) {
30
+ try {
31
+ await access(target);
32
+ return true;
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ /**
39
+ * Judge a pre-#4640 absolute-path command.
40
+ * @param paths - Absolute paths the command names
41
+ * @returns Fail when one is gone, otherwise warn
42
+ */
43
+ async function judgeAbsolute(paths) {
44
+ const present = await Promise.all(paths.map(exists));
45
+ const missing = paths.filter((_, index) => !present[index]);
46
+ if (missing.length > 0) {
47
+ return {
48
+ status: "fail",
49
+ detail: `${KEY} runs ${missing.join(", ")}, which does not exist — every learnings merge in every worktree now reports a conflict and keeps only our side, with no conflict markers, so staging it silently drops the other branch's learnings. ${REMEDY}`,
50
+ };
51
+ }
52
+ return {
53
+ status: "warn",
54
+ detail: `${KEY} names absolute paths into one checkout (${paths.join(", ")}). Every linked worktree shares this setting, so learnings merges everywhere break the day that checkout is removed. ${REMEDY}`,
55
+ };
56
+ }
57
+ /**
58
+ * Inspect the registered learnings driver command in this checkout.
59
+ * @param targetPath - Project path to inspect
60
+ * @returns A finding, or undefined when the command can run (or cannot be judged)
61
+ */
62
+ export async function inspectLearningsDriverCommand(targetPath) {
63
+ const registration = await readLearningsMergeDriverRegistration(targetPath);
64
+ if (registration === undefined) {
65
+ return undefined;
66
+ }
67
+ const shape = classifyLearningsDriverCommand(registration.command);
68
+ if (shape.kind === "absolute") {
69
+ return judgeAbsolute(shape.paths);
70
+ }
71
+ if (shape.kind === "portable" &&
72
+ !(await exists(path.resolve(registration.worktreeTop, shape.entry)))) {
73
+ return {
74
+ status: "warn",
75
+ detail: `${KEY} runs ${shape.entry} relative to this worktree, but it is not installed here — learnings merges in this worktree stop with conflict markers holding both sides instead of unioning. Install dependencies here (or build Lisa, in its own repository).`,
76
+ };
77
+ }
78
+ return undefined;
79
+ }
80
+ //# sourceMappingURL=doctor-learnings-driver-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-learnings-driver-command.js","sourceRoot":"","sources":["../../src/cli/doctor-learnings-driver-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAQhF,MAAM,GAAG,GAAG,SAAS,2BAA2B,SAAS,CAAC;AAC1D,MAAM,MAAM,GACV,iKAAiK,CAAC;AAEpK;;;;GAIG;AACH,KAAK,UAAU,MAAM,CAAC,MAAc;IAClC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,aAAa,CAC1B,KAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAA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ACnB,CAAC"}
@@ -9,9 +9,13 @@ interface MergeDriverCheckResult {
9
9
  /**
10
10
  * Report whether this checkout can actually run the merge drivers it maps.
11
11
  *
12
- * Warn, never fail: an unregistered driver degrades to a merge that conflicts
13
- * loudly instead of one that loses content, so reddening a CI checkout over it
14
- * would trade a real signal for noise. The states that are genuinely fine — a
12
+ * Warn, not fail, for an unregistered driver: it degrades to a merge that
13
+ * conflicts loudly instead of one that loses content, so reddening a CI
14
+ * checkout over it would trade a real signal for noise. The one deliberate
15
+ * exception is a learnings driver whose registered command names a path that
16
+ * no longer exists (CodySwannGT/lisa#4640): git then reports a conflict but
17
+ * leaves the ledger as our side with NO markers, so it does lose content, and
18
+ * that fails. The states that are genuinely fine — a
15
19
  * host that opted out, a directory that is not a git repository, a repository
16
20
  * with nothing mapped — report ok and say which one they are, rather than
17
21
  * sharing one indistinguishable "skipped".
@@ -1 +1 @@
1
- {"version":3,"file":"doctor-merge-drivers.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-merge-drivers.ts"],"names":[],"mappings":"AAyCA,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,6EAA6E;AAC7E,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAkGD;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CA2CjC"}
1
+ {"version":3,"file":"doctor-merge-drivers.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-merge-drivers.ts"],"names":[],"mappings":"AA6CA,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,6EAA6E;AAC7E,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAyID;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAuDjC"}
@@ -32,6 +32,7 @@
32
32
  import { readFile } from "node:fs/promises";
33
33
  import * as path from "node:path";
34
34
  import { mergeDriversInAttributes } from "../core/gitattributes-merge-drivers.js";
35
+ import { inspectLearningsDriverCommand, } from "./doctor-learnings-driver-command.js";
35
36
  import { probeLearningsMergeDriverRegistration } from "../core/learnings-merge-driver-install.js";
36
37
  import { LEARNINGS_MERGE_DRIVER_NAME } from "../core/learnings-merge-driver.js";
37
38
  import { probeMergeDriverRegistration } from "../core/merge-driver-registration.js";
@@ -105,6 +106,31 @@ async function unregisteredAmong(targetPath, drivers) {
105
106
  const states = await Promise.all(drivers.map(driver => probeMergeDriverRegistration(targetPath, driver)));
106
107
  return drivers.filter((_, index) => states[index] !== "registered");
107
108
  }
109
+ /**
110
+ * Whether the REGISTERED learnings command can run, beyond being set.
111
+ *
112
+ * Only asked when the learnings driver is expected here and registered; an
113
+ * unregistered one is already reported, and an opted-out one is not ours to
114
+ * judge.
115
+ * @param targetPath - Project path to inspect
116
+ * @param expected - Drivers this checkout is expected to have registered
117
+ * @param unregistered - The expected drivers that are not registered
118
+ * @returns A finding about the command, when there is one
119
+ */
120
+ async function learningsCommandFinding(targetPath, expected, unregistered) {
121
+ return expected.includes(LEARNINGS_MERGE_DRIVER_NAME) &&
122
+ !unregistered.includes(LEARNINGS_MERGE_DRIVER_NAME)
123
+ ? inspectLearningsDriverCommand(targetPath)
124
+ : undefined;
125
+ }
126
+ /**
127
+ * One check result for several findings: the worst status, every detail.
128
+ * @param findings - Non-empty findings
129
+ * @returns Doctor check result
130
+ */
131
+ function worstOf(findings) {
132
+ return result(findings.some(finding => finding.status === "fail") ? "fail" : "warn", findings.map(finding => finding.detail).join(" "));
133
+ }
108
134
  /**
109
135
  * The "everything is fine" sentence, which says WHICH fine it is.
110
136
  * @param expected - Drivers this checkout is expected to have registered
@@ -122,9 +148,13 @@ function satisfiedDetail(expected, optedOut) {
122
148
  /**
123
149
  * Report whether this checkout can actually run the merge drivers it maps.
124
150
  *
125
- * Warn, never fail: an unregistered driver degrades to a merge that conflicts
126
- * loudly instead of one that loses content, so reddening a CI checkout over it
127
- * would trade a real signal for noise. The states that are genuinely fine — a
151
+ * Warn, not fail, for an unregistered driver: it degrades to a merge that
152
+ * conflicts loudly instead of one that loses content, so reddening a CI
153
+ * checkout over it would trade a real signal for noise. The one deliberate
154
+ * exception is a learnings driver whose registered command names a path that
155
+ * no longer exists (CodySwannGT/lisa#4640): git then reports a conflict but
156
+ * leaves the ledger as our side with NO markers, so it does lose content, and
157
+ * that fails. The states that are genuinely fine — a
128
158
  * host that opted out, a directory that is not a git repository, a repository
129
159
  * with nothing mapped — report ok and say which one they are, rather than
130
160
  * sharing one indistinguishable "skipped".
@@ -154,9 +184,17 @@ export async function checkMergeDrivers(targetPath) {
154
184
  : [LEARNINGS_MERGE_DRIVER_NAME];
155
185
  const expected = drivers.filter(driver => !optedOut.includes(driver));
156
186
  const unregistered = await unregisteredAmong(targetPath, expected);
157
- return unregistered.length === 0
187
+ const command = await learningsCommandFinding(targetPath, expected, unregistered);
188
+ const findings = [
189
+ ...(command === undefined ? [] : [command]),
190
+ ...unregistered.map(driver => ({
191
+ status: "warn",
192
+ detail: unregisteredDetail(driver),
193
+ })),
194
+ ];
195
+ return findings.length === 0
158
196
  ? result("ok", satisfiedDetail(expected, optedOut))
159
- : result("warn", unregistered.map(unregisteredDetail).join(" "));
197
+ : worstOf(findings);
160
198
  }
161
199
  catch (error) {
162
200
  return result("warn", `Could not inspect this checkout's merge drivers: ${error instanceof Error ? error.message : String(error)}`);
@@ -1 +1 @@
1
- {"version":3,"file":"doctor-merge-drivers.js","sourceRoot":"","sources":["../../src/cli/doctor-merge-drivers.ts"],"names":[],"mappings":"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B,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACpE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uHAMrB,CAAC;AAyHX;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,uBAAuB,GACpC,IAAI,CAMN"}
1
+ {"version":3,"file":"gate-commands.d.ts","sourceRoot":"","sources":["../../src/cli/gate-commands.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAWlE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,uBAAuB;IACtC,uBAAuB,EAAE,CACvB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KACtC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACpE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uHAMrB,CAAC;AA6HX;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,uBAAuB,GACpC,IAAI,CAMN"}
@@ -83,6 +83,7 @@ function addMergeLearningsCommand(program) {
83
83
  .option("--ours <file>", "Our version; receives the result (git %A)")
84
84
  .option("--theirs <file>", "Their version (git %B)")
85
85
  .option("--path <path>", "Real pathname for diagnostics (git %P)")
86
+ .option("--conflict-ack <file>", "File to create on a deliberate conflict (set by the driver script)")
86
87
  .action(async (options) => {
87
88
  const code = await runMergeLearnings(options);
88
89
  if (code !== 0)
@@ -1 +1 @@
1
- {"version":3,"file":"gate-commands.js","sourceRoot":"","sources":["../../src/cli/gate-commands.ts"],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AI,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,YAAqC;IAErC,8BAA8B,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACtD,sBAAsB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9C,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACrC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAClC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"gate-commands.js","sourceRoot":"","sources":["../../src/cli/gate-commands.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AA0BlC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,wBAAwB;IACxB,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,sBAAsB;CACd,CAAC;AAEX;;;;GAIG;AACH,SAAS,8BAA8B,CACrC,OAAgB,EAChB,YAAqC;IAErC,OAAO;SACJ,OAAO,CAAC,wBAAwB,CAAC;SACjC,WAAW,CACV,kFAAkF,CACnF;SACA,QAAQ,CACP,QAAQ,EACR,oEAAoE,CACrE;SACA,MAAM,CACL,YAAY,EACZ,+EAA+E,CAChF;SACA,MAAM,CACL,KAAK,EACH,UAA8B,EAC9B,OAAwC,EACxC,EAAE;QACF,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,uBAAuB,CAAC,UAAU,EAAE;YAClE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;SACpC,CAAC,CAAC;QACH,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ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AK,EAAE,OAA8B,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,sBAAsB,CAAC;SAC/B,WAAW,CACV,uEAAuE,CACxE;SACA,QAAQ,CAAC,QAAQ,EAAE,gDAAgD,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,YAAqC;IAErC,8BAA8B,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACtD,sBAAsB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9C,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACrC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAClC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -8,6 +8,12 @@ export interface MergeLearningsOptions {
8
8
  readonly theirs?: string;
9
9
  /** `%P` — the real pathname, used only in diagnostics. */
10
10
  readonly path?: string;
11
+ /**
12
+ * File to create when the merge reaches its deliberate semantic-conflict
13
+ * verdict, so the worktree-portable driver script (#4640) can tell that
14
+ * apart from a crash. Supplied by the script, never by git.
15
+ */
16
+ readonly conflictAck?: string;
11
17
  }
12
18
  /** Injectable collaborators for {@link runMergeLearnings}. */
13
19
  export interface MergeLearningsDependencies {
@@ -1 +1 @@
1
- {"version":3,"file":"merge-learnings-cmd.d.ts","sourceRoot":"","sources":["../../src/cli/merge-learnings-cmd.ts"],"names":[],"mappings":"AAsBA,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,8DAA8D;AAC9D,MAAM,WAAW,0BAA0B;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AA2BD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,qBAAqB,EAC9B,YAAY,GAAE,0BAA+B,GAC5C,OAAO,CAAC,MAAM,CAAC,CA2CjB"}
1
+ {"version":3,"file":"merge-learnings-cmd.d.ts","sourceRoot":"","sources":["../../src/cli/merge-learnings-cmd.ts"],"names":[],"mappings":"AAsBA,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,8DAA8D;AAC9D,MAAM,WAAW,0BAA0B;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAiDD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,qBAAqB,EAC9B,YAAY,GAAE,0BAA+B,GAC5C,OAAO,CAAC,MAAM,CAAC,CA4CjB"}
@@ -16,7 +16,7 @@
16
16
  * ledgers corrupted while this driver was NOT registered.
17
17
  * @module cli/merge-learnings-cmd
18
18
  */
19
- import { readFile } from "node:fs/promises";
19
+ import { readFile, writeFile } from "node:fs/promises";
20
20
  import { mergeLearningsDocuments } from "../core/learnings-merge.js";
21
21
  import { writeFileAtomically } from "../utils/atomic-file-write.js";
22
22
  /**
@@ -39,6 +39,28 @@ async function readSide(file) {
39
39
  return { ok: false };
40
40
  }
41
41
  }
42
+ /**
43
+ * Tell the registered driver script this conflict is Lisa's deliberate verdict.
44
+ *
45
+ * The worktree-portable driver (#4640) writes a both-sides conflict-marker file
46
+ * whenever Lisa exits non-zero without touching "ours", so a crash can never
47
+ * leave a markerless ours-only ledger. A real semantic conflict deliberately
48
+ * leaves "ours" parseable (see the module comment), and this acknowledgement is
49
+ * how the script tells the two apart. Best-effort: failing to write it only
50
+ * means the script falls back to markers, the safe direction.
51
+ * @param ack - Acknowledgement file the script asked for, when it did
52
+ */
53
+ async function acknowledgeConflict(ack) {
54
+ if (ack === undefined || ack === "") {
55
+ return;
56
+ }
57
+ try {
58
+ await writeFile(ack, "");
59
+ }
60
+ catch {
61
+ // Safe direction: the driver writes conflict markers instead.
62
+ }
63
+ }
42
64
  /**
43
65
  * Run the union merge and publish the result.
44
66
  * @param options - Git-supplied merge sides
@@ -74,6 +96,7 @@ export async function runMergeLearnings(options, dependencies = {}) {
74
96
  const result = mergeLearningsDocuments(base.content, ours.content, theirs.content);
75
97
  if (result.kind === "conflict") {
76
98
  error(`merge-learnings: ${label}: ${result.reason}`);
99
+ await acknowledgeConflict(options.conflictAck);
77
100
  return 1;
78
101
  }
79
102
  await writeFileAtomically(oursPath, result.content);
@@ -1 +1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AAC,MAAM,CAAC,EAAE,EAAE,CAAC;QAC3B,KAAK,CAAC,oBAAoB,KAAK,mCAAmC,CAAC,CAAC;QACpE,OAAO,CAAC,CAAC;IACX,CAAC;IACD,4EAA4E;IAC5E,4EAA4E;IAC5E,yEAAyE;IACzE,2EAA2E;IAC3E,oCAAoC;IACpC,MAAM,IAAI,GACR,OAAO,CAAC,IAAI,KAAK,SAAS;QACxB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3B,CAAC,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,KAAK,CACH,oBAAoB,KAAK,+HAA+H,CACzJ,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,MAAM,GAAG,uBAAuB,CACpC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,EACZ,MAAM,CAAC,OAAO,CACf,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,KAAK,CAAC,oBAAoB,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACrD,MAAM,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/C,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,38 @@
1
+ /** Lisa's entry script, relative to a host project's root. */
2
+ export declare const HOST_LISA_ENTRY = "node_modules/@codyswann/lisa/dist/index.js";
3
+ /** Lisa's entry script, relative to the Lisa repository's own root. */
4
+ export declare const SELF_LISA_ENTRY = "dist/index.js";
5
+ /** What a registered command is, as far as doctor can tell. */
6
+ export type LearningsDriverCommandShape = {
7
+ readonly kind: "portable";
8
+ readonly entry: string;
9
+ } | {
10
+ readonly kind: "absolute";
11
+ readonly paths: readonly string[];
12
+ } | {
13
+ readonly kind: "other";
14
+ };
15
+ /**
16
+ * Build the worktree-portable driver command for one entry path.
17
+ *
18
+ * The `%O %A %B %P` placeholders stay bare positional arguments OUTSIDE the
19
+ * quoted script: git substitutes them already shell-quoted, and quoting them
20
+ * again is the RCE documented on `buildLearningsMergeDriverCommand`. A `%` in
21
+ * the entry is doubled, because git expands `%` sequences before the shell
22
+ * ever sees the string.
23
+ * @param entry - Lisa entry script relative to the worktree top, e.g. `./dist/index.js`
24
+ * @returns Driver command for `merge.lisa-learnings.driver`
25
+ */
26
+ export declare function buildPortableLearningsMergeDriverCommand(entry: string): string;
27
+ /**
28
+ * Classify a registered `merge.lisa-learnings.driver` command.
29
+ *
30
+ * `absolute` is the pre-#4640 `'<runtime>' '<entry>' merge-learnings …`
31
+ * form, whose paths belong to one checkout. Anything Lisa did not write — a
32
+ * hand-registered `lisa merge-learnings`, a global wrapper — is `other`, which
33
+ * doctor cannot verify and does not second-guess.
34
+ * @param command - Registered command, as `git config --get` returns it
35
+ * @returns Shape of the command
36
+ */
37
+ export declare function classifyLearningsDriverCommand(command: string): LearningsDriverCommandShape;
38
+ //# sourceMappingURL=learnings-merge-driver-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learnings-merge-driver-command.d.ts","sourceRoot":"","sources":["../../src/core/learnings-merge-driver-command.ts"],"names":[],"mappings":"AA+CA,8DAA8D;AAC9D,eAAO,MAAM,eAAe,+CAA+C,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAwB/C,+DAA+D;AAC/D,MAAM,MAAM,2BAA2B,GACnC;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAgB/B;;;;;;;;;;GAUG;AACH,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR;AA8BD;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,MAAM,GACd,2BAA2B,CAiB7B"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * The shape of the learnings merge driver's registered command, and how to
3
+ * read one back (CodySwannGT/lisa#4640).
4
+ *
5
+ * ## Why the command names no absolute path
6
+ *
7
+ * `git config --local` writes `.git/config`, which every linked worktree of a
8
+ * repository SHARES. The command used to be `'<runtime>' '<entry script>'` of
9
+ * whichever checkout ran `lisa apply` — often a temporary worktree, such as
10
+ * the one each host upgrade runs in. Once that worktree is removed, every
11
+ * worktree's learnings merges run a command that no longer exists, and git
12
+ * leaves the ledger as OUR side only, with no conflict markers. Staging that
13
+ * file silently drops the other branch's learnings: the loss the driver exists
14
+ * to prevent.
15
+ *
16
+ * Git runs a merge driver with its cwd at the top of the worktree being
17
+ * merged, so a repo-relative entry resolves per worktree. That is the rule the
18
+ * sibling `lisa-generated-artifact` driver already follows
19
+ * (`scripts/install-generated-artifact-merge-driver.mjs`).
20
+ *
21
+ * ## Why it is a self-contained `sh -c` script
22
+ *
23
+ * The command has to stay correct in a worktree where Lisa is NOT installed,
24
+ * and where Lisa is installed but cannot run (pruned dependencies, a runtime
25
+ * too old for the build). Exiting non-zero in either case would reproduce the
26
+ * markerless "ours" file, so the script writes a conflict-marked file holding
27
+ * both sides into `%A` and only then exits non-zero. Lisa is therefore not
28
+ * `exec`ed: the script snapshots `%A`, runs Lisa, and falls back when Lisa
29
+ * failed WITHOUT reaching its own deliberate semantic-conflict verdict (which
30
+ * it acknowledges by creating the `--conflict-ack` file) and left `%A`
31
+ * unchanged. A Lisa too old to know that flag rejects it without touching
32
+ * `%A`, so it, too, lands in the safe both-sides fallback.
33
+ * Keeping the script in git config rather than in a tracked wrapper adds no
34
+ * file to every host repository.
35
+ *
36
+ * ## One key per repository
37
+ *
38
+ * `merge.lisa-learnings.driver` is a single repository-wide key, so a
39
+ * repository holding several Lisa projects at different depths registers the
40
+ * entry of whichever project applied last — last writer wins. That was equally
41
+ * true of the absolute form; this module does not make it worse.
42
+ * @module core/learnings-merge-driver-command
43
+ */
44
+ import * as path from "node:path";
45
+ import { LEARNINGS_MERGE_DRIVER_NAME } from "./learnings-merge-driver.js";
46
+ /** Lisa's entry script, relative to a host project's root. */
47
+ export const HOST_LISA_ENTRY = "node_modules/@codyswann/lisa/dist/index.js";
48
+ /** Lisa's entry script, relative to the Lisa repository's own root. */
49
+ export const SELF_LISA_ENTRY = "dist/index.js";
50
+ /** `$0` of the driver script; also how a portable command is recognised. */
51
+ const SCRIPT_NAME = "lisa-learnings-driver";
52
+ /**
53
+ * The POSIX sh body run as `sh -c '<body>' lisa-learnings-driver <entry> %O %A %B %P`.
54
+ *
55
+ * It must contain no single quote (it is single-quoted) and no `%` (git
56
+ * expands `%` sequences in the whole command). `$1` is the repo-relative entry;
57
+ * after `shift`, `$1..$4` are git's base, ours, theirs and pathname.
58
+ */
59
+ const DRIVER_SCRIPT = [
60
+ `e="$1"; shift`,
61
+ `if command -v node >/dev/null 2>&1; then r=node; else r=bun; fi`,
62
+ `t="$2.lisa-conflict.$$"; k="$2.lisa-snapshot.$$"; a="$2.lisa-handled.$$"`,
63
+ `side() { cat "$1"; [ -z "$(tail -c 1 "$1")" ] || echo; }`,
64
+ `conflict() { { echo "<<<<<<< ours"; side "$1"; echo "======="; side "$2"; echo ">>>>>>> theirs"; } > "$t" && mv "$t" "$1"; }`,
65
+ `if [ -f "$e" ] && command -v "$r" >/dev/null 2>&1; then cp "$2" "$k"; "$r" "$e" merge-learnings --base "$1" --ours "$2" --theirs "$3" --path "$4" --conflict-ack "$a"; s=$?; if [ "$s" -ne 0 ] && [ ! -f "$a" ] && cmp -s "$2" "$k"; then conflict "$2" "$3"; echo "${LEARNINGS_MERGE_DRIVER_NAME} merge driver: Lisa ($e) exited $s without merging $4, so it was left with conflict markers holding both sides." >&2; fi; rm -f "$k" "$a"; exit "$s"; fi`,
66
+ `conflict "$2" "$3"`,
67
+ `echo "${LEARNINGS_MERGE_DRIVER_NAME} merge driver: cannot run Lisa here ($e, or a node or bun runtime, is missing in this worktree), so $4 was left with conflict markers holding both sides. Install dependencies here, then run lisa install-merge-driver." >&2`,
68
+ `exit 1`,
69
+ ].join("; ");
70
+ /**
71
+ * Quote one value for the POSIX shell git runs a merge driver through.
72
+ *
73
+ * Single quotes, not double: inside double quotes `$`, a backtick and a
74
+ * backslash stay special, and this repo shipped that bug class in #1982.
75
+ * Inside single quotes every byte is literal, so only an embedded single quote
76
+ * needs handling — closed, escaped, and reopened as `'\''`.
77
+ * @param value - Raw value
78
+ * @returns Shell-safe single-quoted token
79
+ */
80
+ function shellQuote(value) {
81
+ return `'${value.replaceAll("'", "'\\''")}'`;
82
+ }
83
+ /**
84
+ * Build the worktree-portable driver command for one entry path.
85
+ *
86
+ * The `%O %A %B %P` placeholders stay bare positional arguments OUTSIDE the
87
+ * quoted script: git substitutes them already shell-quoted, and quoting them
88
+ * again is the RCE documented on `buildLearningsMergeDriverCommand`. A `%` in
89
+ * the entry is doubled, because git expands `%` sequences before the shell
90
+ * ever sees the string.
91
+ * @param entry - Lisa entry script relative to the worktree top, e.g. `./dist/index.js`
92
+ * @returns Driver command for `merge.lisa-learnings.driver`
93
+ */
94
+ export function buildPortableLearningsMergeDriverCommand(entry) {
95
+ const escapedEntry = shellQuote(entry).replaceAll("%", "%%");
96
+ return `sh -c ${shellQuote(DRIVER_SCRIPT)} ${SCRIPT_NAME} ${escapedEntry} %O %A %B %P`;
97
+ }
98
+ /**
99
+ * Every single-quoted token at the start of a shell fragment, unquoted.
100
+ * @param fragment - Text made only of single-quoted tokens and spaces
101
+ * @returns Unquoted tokens, or undefined when anything else is present
102
+ */
103
+ function singleQuotedTokens(fragment) {
104
+ const token = /'((?:[^']|'\\'')*?)'(?=\s|$)/gu;
105
+ const tokens = [...fragment.matchAll(token)];
106
+ const rest = fragment.replaceAll(token, "").trim();
107
+ if (tokens.length === 0 || rest !== "") {
108
+ return undefined;
109
+ }
110
+ return tokens.map(match => (match[1] ?? "").replaceAll("'\\''", "'"));
111
+ }
112
+ /**
113
+ * Whether a token is an absolute path on POSIX or Windows.
114
+ *
115
+ * Checked explicitly for both, because doctor may run on one platform against
116
+ * a registration written on the other (a Windows drive-letter path is not
117
+ * absolute to `path.isAbsolute` on POSIX).
118
+ * @param token - Unquoted command token
119
+ * @returns True for `/…`, `C:\…` or `C:/…`
120
+ */
121
+ function isAbsolutePath(token) {
122
+ return path.isAbsolute(token) || /^[A-Za-z]:[\\/]/u.test(token);
123
+ }
124
+ /**
125
+ * Classify a registered `merge.lisa-learnings.driver` command.
126
+ *
127
+ * `absolute` is the pre-#4640 `'<runtime>' '<entry>' merge-learnings …`
128
+ * form, whose paths belong to one checkout. Anything Lisa did not write — a
129
+ * hand-registered `lisa merge-learnings`, a global wrapper — is `other`, which
130
+ * doctor cannot verify and does not second-guess.
131
+ * @param command - Registered command, as `git config --get` returns it
132
+ * @returns Shape of the command
133
+ */
134
+ export function classifyLearningsDriverCommand(command) {
135
+ const marker = ` ${SCRIPT_NAME} `;
136
+ const markerAt = command.indexOf(marker);
137
+ if (command.startsWith("sh -c '") && markerAt !== -1) {
138
+ const tail = command.slice(markerAt + marker.length).split(" %O ")[0];
139
+ const entry = singleQuotedTokens(tail ?? "")?.[0];
140
+ return entry === undefined
141
+ ? { kind: "other" }
142
+ : { kind: "portable", entry: entry.replaceAll("%%", "%") };
143
+ }
144
+ const [head] = command.split(" merge-learnings ");
145
+ const tokens = head === undefined || head === command
146
+ ? undefined
147
+ : singleQuotedTokens(head);
148
+ const paths = (tokens ?? []).filter(isAbsolutePath);
149
+ return paths.length === 0 ? { kind: "other" } : { kind: "absolute", paths };
150
+ }
151
+ //# sourceMappingURL=learnings-merge-driver-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learnings-merge-driver-command.js","sourceRoot":"","sources":["../../src/core/learnings-merge-driver-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,4CAA4C,CAAC;AAE5E,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,4EAA4E;AAC5E,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,aAAa,GAAG;IACpB,eAAe;IACf,iEAAiE;IACjE,0EAA0E;IAC1E,0DAA0D;IAC1D,8HAA8H;IAC9H,uQAAuQ,2BAA2B,0JAA0J;IAC5b,oBAAoB;IACpB,SAAS,2BAA2B,+NAA+N;IACnQ,QAAQ;CACT,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAQb;;;;;;;;;GASG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wCAAwC,CACtD,KAAa;IAEb,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO,SAAS,UAAU,CAAC,aAAa,CAAC,IAAI,WAAW,IAAI,YAAY,cAAc,CAAC;AACzF,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,MAAM,KAAK,GAAG,gCAAgC,CAAC;IAC/C,MA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