@wemuda/launchrail 1.17.0 → 1.19.0

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/dist/lib/adr.js CHANGED
@@ -33,6 +33,35 @@ function adrStatus(source) {
33
33
  const paragraph = (match[1] ?? "").trim().split(/\n\s*\n/)[0] ?? "";
34
34
  return paragraph.replace(/\s+/g, " ").trim();
35
35
  }
36
+ /** Whether a filename in docs/adr/ is a decision record (not the template, not the registry). */
37
+ export function isAdrRecordFilename(file) {
38
+ return file !== ADR_TEMPLATE_FILENAME && parseFilename(file) !== null;
39
+ }
40
+ /** Parse one record's file and source into an entry; null when the filename is not a record. */
41
+ export function parseAdrEntry(file, source) {
42
+ if (file === ADR_TEMPLATE_FILENAME)
43
+ return null;
44
+ const parsed = parseFilename(file);
45
+ if (!parsed)
46
+ return null;
47
+ return { ...parsed, file, title: adrTitle(source, file), status: adrStatus(source) };
48
+ }
49
+ /**
50
+ * The record list built from an explicit set of file→source pairs, sorted by
51
+ * filename exactly as scanAdrs sorts the directory — numbered records first,
52
+ * dated records after them in date order. The merge driver uses this to
53
+ * assemble the corpus from the working tree plus the records only the incoming
54
+ * side carries, which are not yet on disk when git invokes the driver.
55
+ */
56
+ export function entriesFromSources(sources) {
57
+ const entries = [];
58
+ for (const [file, source] of [...sources].sort(([a], [b]) => a.localeCompare(b))) {
59
+ const entry = parseAdrEntry(file, source);
60
+ if (entry)
61
+ entries.push(entry);
62
+ }
63
+ return entries;
64
+ }
36
65
  /**
37
66
  * The decision records already in a repository's docs/adr/ (template and
38
67
  * registry excluded), sorted by filename — numbered records first, dated
@@ -43,12 +72,9 @@ export function scanAdrs(cwd) {
43
72
  const dir = join(cwd, ADR_DIR);
44
73
  if (!existsSync(dir))
45
74
  return [];
46
- const entries = [];
47
- for (const file of readdirSync(dir).sort()) {
48
- if (file === ADR_TEMPLATE_FILENAME)
49
- continue;
50
- const parsed = parseFilename(file);
51
- if (!parsed)
75
+ const sources = [];
76
+ for (const file of readdirSync(dir)) {
77
+ if (!isAdrRecordFilename(file))
52
78
  continue;
53
79
  let source = "";
54
80
  try {
@@ -57,16 +83,19 @@ export function scanAdrs(cwd) {
57
83
  catch {
58
84
  // Unreadable file — title falls back to the filename, status to empty.
59
85
  }
60
- entries.push({ ...parsed, file, title: adrTitle(source, file), status: adrStatus(source) });
86
+ sources.push([file, source]);
61
87
  }
62
- return entries;
88
+ return entriesFromSources(sources);
63
89
  }
64
- /** Ids (numbers or slugs) claimed by more than one record — every reference by id is ambiguous. */
65
- export function duplicateAdrIds(entries) {
66
- const counts = new Map();
90
+ /**
91
+ * Ids (numbers or slugs) claimed by more than one record, each with the files
92
+ * that claim it — every reference by such an id is ambiguous.
93
+ */
94
+ export function adrDuplicates(entries) {
95
+ const byId = new Map();
67
96
  for (const entry of entries)
68
- counts.set(entry.id, (counts.get(entry.id) ?? 0) + 1);
69
- return [...counts.entries()].filter(([, n]) => n > 1).map(([id]) => id);
97
+ byId.set(entry.id, [...(byId.get(entry.id) ?? []), entry.file]);
98
+ return [...byId.entries()].filter(([, files]) => files.length > 1).map(([id, files]) => ({ id, files }));
70
99
  }
71
100
  /** Records whose filename never appears in the registry — rows the index is missing. */
72
101
  export function unindexedAdrs(registrySource, entries) {
@@ -194,17 +223,23 @@ export function adrIndexTable(entries) {
194
223
  return [ADR_INDEX_START, header, ...rows, ADR_INDEX_END].join("\n");
195
224
  }
196
225
  /**
197
- * The registry with its index table regenerated in place. Between the markers
198
- * when they exist; otherwise the first table under `## Index` is replaced and
199
- * the markers introduced around it (a registry written before the generator
200
- * migrates on its first run). Null when the registry has neither.
226
+ * A single-line placeholder the merge driver substitutes for the index region
227
+ * while it 3-way merges the registry's prose, then swaps back out for the freshly
228
+ * regenerated table. Comment-shaped so it is inert if it ever leaks into a file,
229
+ * and identical across all three sides so the prose merge sees no index diff.
201
230
  */
202
- export function withRegeneratedIndex(registrySource, entries) {
203
- const table = adrIndexTable(entries);
231
+ export const ADR_INDEX_SENTINEL = "<!-- launchrail:adr-index-merge-placeholder -->";
232
+ /**
233
+ * Replace the registry's index region with `replacement`: everything between the
234
+ * markers when they exist; otherwise the first table under `## Index`, with the
235
+ * region newline-padded (a registry written before the generator migrates on its
236
+ * first run). Null when the registry has neither — there is nothing to replace.
237
+ */
238
+ export function replaceIndexRegion(registrySource, replacement) {
204
239
  const start = registrySource.indexOf("<!-- adr-index:start");
205
240
  const end = registrySource.indexOf(ADR_INDEX_END);
206
241
  if (start !== -1 && end !== -1 && end > start) {
207
- return registrySource.slice(0, start) + table + registrySource.slice(end + ADR_INDEX_END.length);
242
+ return registrySource.slice(0, start) + replacement + registrySource.slice(end + ADR_INDEX_END.length);
208
243
  }
209
244
  const heading = /^##\s+Index\s*$/m.exec(registrySource);
210
245
  if (!heading)
@@ -216,7 +251,121 @@ export function withRegeneratedIndex(registrySource, entries) {
216
251
  return null;
217
252
  const before = registrySource.slice(0, afterHeading + tableMatch.index);
218
253
  const after = rest.slice(tableMatch.index + tableMatch[0].length);
219
- return `${before}\n${table}\n${after}`;
254
+ return `${before}\n${replacement}\n${after}`;
255
+ }
256
+ /**
257
+ * The registry with its index table regenerated in place. Between the markers
258
+ * when they exist; otherwise the first table under `## Index` is replaced and
259
+ * the markers introduced around it. Null when the registry has neither.
260
+ */
261
+ export function withRegeneratedIndex(registrySource, entries) {
262
+ return replaceIndexRegion(registrySource, adrIndexTable(entries));
263
+ }
264
+ // --- Minting guidance: a managed contract, a seeded summary, a one-time heal ----
265
+ //
266
+ // How a record is minted is an *operational instruction* the toolchain must be
267
+ // able to keep current. The authoritative copy therefore lives in the managed
268
+ // workflow instructions (`.launchrail/CLAUDE.generated.md`), which sync rewrites
269
+ // every version. The seeded registry and template carry only a project-owned
270
+ // summary and defer to it. The strings below are shared by the seed and by the
271
+ // heal migration so both write the same bytes, and the pre-date-slug versions
272
+ // are pinned exactly so the migration corrects a repo Launchrail seeded before
273
+ // the dated-identifier scheme without ever touching one a project has edited.
274
+ /** The seeded ADR template: date-and-slug titled, teaching the forward-declared relation model. */
275
+ export const ADR_TEMPLATE = `# Short decision title
276
+
277
+ ## Status
278
+ Proposed | Accepted | Superseded by [slug](YYYY-MM-DD-slug.md)
279
+
280
+ Name here what this record supersedes, amends, or extends, linking the earlier record by file (\`Accepted — amends [slug](YYYY-MM-DD-slug.md): what changed\`). The registry index ([README.md](README.md)) derives the reverse links, so an earlier record need not be edited when this one amends it; when this record is superseded later, this line is rewritten to name the successor. Re-run \`launchrail adr index\` after any change here.
281
+
282
+ ## Context
283
+ What requirement or constraint requires a decision?
284
+
285
+ ## Decision
286
+ What was selected?
287
+
288
+ ## Alternatives considered
289
+ What realistic alternatives were rejected?
290
+
291
+ ## Consequences
292
+ What becomes easier, harder, or constrained?
293
+
294
+ ## Revisit when
295
+ What change would justify reconsidering this decision?
296
+ `;
297
+ /** The `# ADR-NNNN:`-titled template seeded before the dated-identifier ADR (byte-stable until then). */
298
+ export const PRE_DATE_SLUG_ADR_TEMPLATE = `# ADR-NNNN: Short decision title
299
+
300
+ ## Status
301
+ Proposed | Accepted | Accepted — amended by ADR-NNNN | Superseded by ADR-NNNN
302
+
303
+ When a later ADR amends or supersedes this one, update this line and the registry index ([README.md](README.md)) in the same commit.
304
+
305
+ ## Context
306
+ What requirement or constraint requires a decision?
307
+
308
+ ## Decision
309
+ What was selected?
310
+
311
+ ## Alternatives considered
312
+ What realistic alternatives were rejected?
313
+
314
+ ## Consequences
315
+ What becomes easier, harder, or constrained?
316
+
317
+ ## Revisit when
318
+ What change would justify reconsidering this decision?
319
+ `;
320
+ /** The registry's project-owned summary of how records are minted; defers to the managed contract. */
321
+ export const ADR_MAINTAINING_SECTION = `## Maintaining this registry
322
+
323
+ - New ADRs copy [0000-template.md](0000-template.md) to \`YYYY-MM-DD-short-slug.md\` — the date the decision was made, then a slug unique in this directory. There is no sequence number to claim, so parallel branches never collide, and nothing is renumbered.
324
+ - The index table between the markers is **generated**: run \`launchrail adr index\` after adding or re-statusing a record, and commit the result. Never hand-edit the rows; the rest of this file is yours. Parallel branches do not collide on it — Launchrail installs a git merge driver (\`launchrail doctor\` registers it in each clone) that rebuilds the table from the records on merge or rebase, so both branches' new rows land in date order with no conflict. If you ever do see a conflict here — a fresh clone before \`launchrail doctor\` ran, say — never resolve it by editing rows: run \`launchrail adr index && git add docs/adr/README.md\` and continue the merge or rebase.
325
+ - A new ADR declares what it supersedes, amends, or extends in its own \`## Status\` line, linking the earlier record by file. The index derives the reverse links, so amending an ADR does not require editing it. A superseded ADR's \`## Status\` line is still rewritten to name its successor — that is the one fact a reader of the record alone must not miss.
326
+ - Never delete or rename an ADR once it is referenced; superseded ADRs are historical records other documents link to.
327
+ - The naming and relation mechanics above summarize a contract Launchrail keeps current in the managed workflow instructions (\`.launchrail/CLAUDE.generated.md\`); if this seeded summary ever drifts from that managed contract, the managed contract is what holds.`;
328
+ /**
329
+ * The "Maintaining this registry" section seeded before the dated-identifier ADR —
330
+ * the one that told agents to "take the next free number". Byte-stable from
331
+ * ADR-0031 until that ADR, so `healRegistryMinting` matches it exactly.
332
+ */
333
+ export const PRE_DATE_SLUG_MAINTAINING_SECTION = `## Maintaining this registry
334
+
335
+ - New ADRs copy [0000-template.md](0000-template.md), take the next free number (\`NNNN-short-slug.md\` — check both this index and the files on disk), and add their row here **in the same commit**. The shared row turns two branches minting the same number into a visible merge conflict instead of a silent collision.
336
+ - When a new ADR supersedes or amends an earlier one — including reversing part of the earlier one's context — update the earlier ADR's \`## Status\` line and its row here in the same commit.
337
+ - Never delete or renumber an ADR once it is referenced; superseded ADRs are historical records other documents link to.`;
338
+ const MAINTAINING_HEADING = "## Maintaining this registry";
339
+ /** Slice a registry into the text before/at/after its "Maintaining this registry" section (to the next `## ` heading or EOF). */
340
+ function maintainingSlice(source) {
341
+ const start = source.indexOf(MAINTAINING_HEADING);
342
+ if (start === -1)
343
+ return null;
344
+ const bodyStart = start + MAINTAINING_HEADING.length;
345
+ const nextRel = source.slice(bodyStart).search(/\n## /);
346
+ const end = nextRel === -1 ? source.length : bodyStart + nextRel;
347
+ return { before: source.slice(0, start), section: source.slice(start, end), after: source.slice(end) };
348
+ }
349
+ /**
350
+ * Correct a registry's minting guidance in place. Returns `healed` (with the
351
+ * rewritten source) only when the section is exactly the pre-date-slug text
352
+ * Launchrail seeded; `current` when it already matches the canonical section;
353
+ * `modified` when a project has edited it (left untouched — it is theirs);
354
+ * `absent` when there is no such section. The heal migration acts only on
355
+ * `healed`; the others are no-ops, which keeps a re-run empty.
356
+ */
357
+ export function healRegistryMinting(source) {
358
+ const slice = maintainingSlice(source);
359
+ if (!slice)
360
+ return { state: "absent", next: source };
361
+ const found = slice.section.trim();
362
+ if (found === ADR_MAINTAINING_SECTION.trim())
363
+ return { state: "current", next: source };
364
+ if (found === PRE_DATE_SLUG_MAINTAINING_SECTION.trim()) {
365
+ const tail = slice.after === "" ? "\n" : slice.after;
366
+ return { state: "healed", next: slice.before + ADR_MAINTAINING_SECTION.trim() + tail };
367
+ }
368
+ return { state: "modified", next: source };
220
369
  }
221
370
  /**
222
371
  * The seeded ADR registry. When init/sync adopts a repository that already has
@@ -248,12 +397,7 @@ How the accepted decisions compose into the current system. This section describ
248
397
 
249
398
  ${livePicture}
250
399
 
251
- ## Maintaining this registry
252
-
253
- - New ADRs copy [0000-template.md](0000-template.md) to \`YYYY-MM-DD-short-slug.md\` — the date the decision was made, then a slug unique in this directory. There is no sequence number to claim, so parallel branches never collide.
254
- - The index table between the markers is **generated**: run \`launchrail adr index\` after adding or re-statusing a record (and after merging), and commit the result. Never hand-edit the rows; the rest of this file is yours.
255
- - A new ADR declares what it supersedes, amends, or extends in its own \`## Status\` line, linking the earlier record by file. The index derives the reverse links, so amending an ADR does not require editing it. A superseded ADR's \`## Status\` line is still rewritten to name its successor — that is the one fact a reader of the record alone must not miss.
256
- - Never delete or rename an ADR once it is referenced; superseded ADRs are historical records other documents link to.
400
+ ${ADR_MAINTAINING_SECTION}
257
401
  `;
258
402
  }
259
403
  //# sourceMapp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O,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC;QAClC,CAAC,CAAC,2NAA2N;QAC7N,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,WAAW,GACf,OAAO,CAAC,MAAM,KAAK,CAAC;QAClB,CAAC,CAAC,sJAAsJ;QACxJ,CAAC,CAAC,8IAA8I,CAAC;IAErJ,OAAO;;;;;;;;EAQP,aAAa,CAAC,OAAO,CAAC,GAAG,gBAAgB;;;;;;EAMzC,WAAW;;EAEX,uBAAuB;CACxB,CAAC;AACF,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The generated ADR index (`docs/adr/README.md`, the rows between the markers)
3
+ * is a pure derived artifact: two branches that each add a record and run
4
+ * `launchrail adr index` insert different rows at the same anchor, which git's
5
+ * line merge cannot order and reports as a textual conflict — even though the
6
+ * records themselves (dated `YYYY-MM-DD-slug.md` names never collide) merge
7
+ * cleanly. The conflict carries no real disagreement, so Launchrail resolves it
8
+ * by regeneration rather than line-merge, via a named git merge driver.
9
+ *
10
+ * A merge driver is named in committed `.gitattributes` but *defined* in
11
+ * per-clone git config, so it takes two installs: this module manages the
12
+ * `.gitattributes` line (committed, additive) and registers the driver in the
13
+ * repo's local git config (per clone, from init / sync / doctor). The driver
14
+ * itself is `launchrail adr merge-driver` (see commands/adr.ts).
15
+ */
16
+ export declare const ADR_MERGE_DRIVER_NAME = "launchrail-adr-index";
17
+ /** The committed `.gitattributes` file and the single line Launchrail manages in it. */
18
+ export declare const GITATTRIBUTES_FILENAME = ".gitattributes";
19
+ export declare const ADR_MERGE_ATTRIBUTE_LINE = "docs/adr/README.md merge=launchrail-adr-index";
20
+ /** Human-readable driver name git shows in diagnostics. */
21
+ export declare const ADR_MERGE_DRIVER_DESCRIPTION = "Launchrail ADR registry index (regenerated on merge)";
22
+ /**
23
+ * The command git stores in per-clone config and runs to resolve the file. It
24
+ * invokes the same published package that generates the index, so the driver
25
+ * can never drift from the generator's format (a hand-rolled driver in each
26
+ * consumer repo would). `%O %A %B` are the base/ours/theirs temp files and `%P`
27
+ * the path in the work tree; git reads the resolved result back from `%A`. The
28
+ * placeholders are quoted so a temp path with a space cannot split an argument.
29
+ */
30
+ export declare const ADR_MERGE_DRIVER_COMMAND = "npx --yes @wemuda/launchrail adr merge-driver \"%O\" \"%A\" \"%B\" \"%P\"";
31
+ /**
32
+ * Every ADR record in the merged corpus, file→source. Feed to
33
+ * `entriesFromSources` to regenerate the index exactly as `launchrail adr index`
34
+ * would over the finished merge — the property that keeps `adr index --check`
35
+ * clean on the result.
36
+ *
37
+ * Only the three README temp files are guaranteed complete when git invokes the
38
+ * driver: with merge-ort the incoming side's record files are not on disk yet,
39
+ * nor in the index. So the records are read from git. Preferred path is a real
40
+ * 3-way merged tree, which resolves records the incoming side *modifies* (a new
41
+ * ADR that supersedes and re-statuses an older one) exactly as the finished merge
42
+ * will. The fallback — this side's working tree plus the records only the
43
+ * incoming side adds — covers older git and is correct for the additive case
44
+ * (two branches each add a record).
45
+ */
46
+ export declare function gatherMergedAdrSources(cwd: string): Map<string, string>;
47
+ export type AttributePlanKind = "create" | "append" | "present";
48
+ export interface AttributePlan {
49
+ kind: AttributePlanKind;
50
+ detail: string;
51
+ /** Full file content to write; null when the line is already present. */
52
+ content: string | null;
53
+ }
54
+ /**
55
+ * Plan the `.gitattributes` line additively: create the file with just the line,
56
+ * append the line (on its own newline) to an existing file, or do nothing when
57
+ * the binding is already present. The file is shared and project-owned — never
58
+ * lockfile-tracked, never rewritten wholesale, only this one line added.
59
+ */
60
+ export declare function planAdrMergeAttribute(cwd: string): AttributePlan;
61
+ /** Execute the `.gitattributes` plan. Returns true when the file was written. */
62
+ export declare function applyAdrMergeAttribute(cwd: string): boolean;
63
+ export type MergeDriverConfigState = "registered" | "mismatch" | "unregistered" | "not-git";
64
+ /** Whether the driver is defined in this clone's local git config. */
65
+ export declare function adrMergeDriverConfigState(cwd: string): MergeDriverConfigState;
66
+ /**
67
+ * Register (or correct) the driver in the repo's local git config. Idempotent,
68
+ * and a no-op outside a git repo. Because the definition is per-clone and never
69
+ * committed, this must run from whatever a fresh clone runs (init / sync /
70
+ * doctor) rather than once behind a lockfile-recorded migration. Returns whether
71
+ * it changed anything.
72
+ */
73
+ export declare function registerAdrMergeDriver(cwd: string): boolean;
@@ -0,0 +1,223 @@
1
+ import { execFileSync, spawnSync } from "node:child_process";
2
+ import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { isAbsolute, join } from "node:path";
4
+ import { ADR_DIR, ADR_REGISTRY_PATH, isAdrRecordFilename } from "./adr.js";
5
+ /**
6
+ * The generated ADR index (`docs/adr/README.md`, the rows between the markers)
7
+ * is a pure derived artifact: two branches that each add a record and run
8
+ * `launchrail adr index` insert different rows at the same anchor, which git's
9
+ * line merge cannot order and reports as a textual conflict — even though the
10
+ * records themselves (dated `YYYY-MM-DD-slug.md` names never collide) merge
11
+ * cleanly. The conflict carries no real disagreement, so Launchrail resolves it
12
+ * by regeneration rather than line-merge, via a named git merge driver.
13
+ *
14
+ * A merge driver is named in committed `.gitattributes` but *defined* in
15
+ * per-clone git config, so it takes two installs: this module manages the
16
+ * `.gitattributes` line (committed, additive) and registers the driver in the
17
+ * repo's local git config (per clone, from init / sync / doctor). The driver
18
+ * itself is `launchrail adr merge-driver` (see commands/adr.ts).
19
+ */
20
+ export const ADR_MERGE_DRIVER_NAME = "launchrail-adr-index";
21
+ /** The committed `.gitattributes` file and the single line Launchrail manages in it. */
22
+ export const GITATTRIBUTES_FILENAME = ".gitattributes";
23
+ export const ADR_MERGE_ATTRIBUTE_LINE = `${ADR_REGISTRY_PATH} merge=${ADR_MERGE_DRIVER_NAME}`;
24
+ /** Human-readable driver name git shows in diagnostics. */
25
+ export const ADR_MERGE_DRIVER_DESCRIPTION = "Launchrail ADR registry index (regenerated on merge)";
26
+ /**
27
+ * The command git stores in per-clone config and runs to resolve the file. It
28
+ * invokes the same published package that generates the index, so the driver
29
+ * can never drift from the generator's format (a hand-rolled driver in each
30
+ * consumer repo would). `%O %A %B` are the base/ours/theirs temp files and `%P`
31
+ * the path in the work tree; git reads the resolved result back from `%A`. The
32
+ * placeholders are quoted so a temp path with a space cannot split an argument.
33
+ */
34
+ export const ADR_MERGE_DRIVER_COMMAND = 'npx --yes @wemuda/launchrail adr merge-driver "%O" "%A" "%B" "%P"';
35
+ function git(cwd, args) {
36
+ try {
37
+ return execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
43
+ function isGitRepo(cwd) {
44
+ return (git(cwd, ["rev-parse", "--is-inside-work-tree"]) ?? "").trim() === "true";
45
+ }
46
+ function gitDir(cwd) {
47
+ const dir = (git(cwd, ["rev-parse", "--git-dir"]) ?? ".git").trim() || ".git";
48
+ return isAbsolute(dir) ? dir : join(cwd, dir);
49
+ }
50
+ /**
51
+ * The commits carrying the "other side" of the operation git is resolving. Only
52
+ * the three README temp files are guaranteed complete when the driver runs (with
53
+ * merge-ort the incoming side's new record files are not yet on disk, nor in the
54
+ * index), so the driver must read those records straight from git. Covers the
55
+ * standard operations: merge exports `GITHEAD_<sha>` per merged head; cherry-pick
56
+ * / revert / (stopped) rebase write their own head refs; rebase keeps the branch
57
+ * being replayed under `.git/rebase-merge/orig-head` (or `rebase-apply/`).
58
+ */
59
+ function incomingCommits(cwd) {
60
+ const shas = new Set();
61
+ for (const key of Object.keys(process.env)) {
62
+ const match = /^GITHEAD_([0-9a-f]{7,64})$/.exec(key);
63
+ if (match?.[1])
64
+ shas.add(match[1]);
65
+ }
66
+ for (const ref of ["MERGE_HEAD", "CHERRY_PICK_HEAD", "REVERT_HEAD", "REBASE_HEAD"]) {
67
+ const sha = (git(cwd, ["rev-parse", "--verify", "--quiet", ref]) ?? "").trim();
68
+ if (sha)
69
+ shas.add(sha);
70
+ }
71
+ const dir = gitDir(cwd);
72
+ for (const rel of ["rebase-merge/orig-head", "rebase-apply/original-commit"]) {
73
+ const path = join(dir, rel);
74
+ if (!existsSync(path))
75
+ continue;
76
+ const sha = readFileSync(path, "utf8").trim();
77
+ if (sha)
78
+ shas.add(sha);
79
+ }
80
+ return [...shas];
81
+ }
82
+ /** Read every ADR record blob under docs/adr/ from a tree-ish into `sources`. */
83
+ function recordsFromTree(cwd, treeish, sources, skipExisting) {
84
+ const listing = git(cwd, ["ls-tree", "-r", "-z", treeish, "--", `${ADR_DIR}/`]);
85
+ if (!listing)
86
+ return;
87
+ for (const entry of listing.split("\0")) {
88
+ if (!entry)
89
+ continue;
90
+ const match = /^\d+ blob ([0-9a-f]+)\t(.+)$/.exec(entry);
91
+ if (!match?.[1] || !match[2])
92
+ continue;
93
+ const file = match[2].split("/").pop() ?? "";
94
+ if (!isAdrRecordFilename(file) || (skipExisting && sources.has(file)))
95
+ continue;
96
+ const content = git(cwd, ["cat-file", "blob", match[1]]);
97
+ if (content !== null)
98
+ sources.set(file, content);
99
+ }
100
+ }
101
+ /**
102
+ * The tree of the real 3-way merge of two commit-ish, via `git merge-tree
103
+ * --write-tree` (git >= 2.38). Null on older git (no `--write-tree`), a usage
104
+ * error, or unparsable output. Exit 1 means "merged, with conflicts in some
105
+ * files"; the tree is still written and returned — a genuinely conflicted record
106
+ * would be surfaced by git separately, so the ADR index resolved off it is moot.
107
+ */
108
+ function mergedTree(cwd, ours, theirs) {
109
+ const result = spawnSync("git", ["merge-tree", "--write-tree", ours, theirs], { cwd, encoding: "utf8" });
110
+ if (result.error || (typeof result.status === "number" && result.status > 1))
111
+ return null;
112
+ const first = (result.stdout ?? "").split("\n")[0]?.trim() ?? "";
113
+ return /^[0-9a-f]{7,64}$/.test(first) ? first : null;
114
+ }
115
+ /**
116
+ * Every ADR record in the merged corpus, file→source. Feed to
117
+ * `entriesFromSources` to regenerate the index exactly as `launchrail adr index`
118
+ * would over the finished merge — the property that keeps `adr index --check`
119
+ * clean on the result.
120
+ *
121
+ * Only the three README temp files are guaranteed complete when git invokes the
122
+ * driver: with merge-ort the incoming side's record files are not on disk yet,
123
+ * nor in the index. So the records are read from git. Preferred path is a real
124
+ * 3-way merged tree, which resolves records the incoming side *modifies* (a new
125
+ * ADR that supersedes and re-statuses an older one) exactly as the finished merge
126
+ * will. The fallback — this side's working tree plus the records only the
127
+ * incoming side adds — covers older git and is correct for the additive case
128
+ * (two branches each add a record).
129
+ */
130
+ export function gatherMergedAdrSources(cwd) {
131
+ const head = (git(cwd, ["rev-parse", "--verify", "--quiet", "HEAD"]) ?? "").trim();
132
+ const incoming = incomingCommits(cwd);
133
+ if (head && incoming.length === 1 && incoming[0]) {
134
+ const tree = mergedTree(cwd, head, incoming[0]);
135
+ if (tree) {
136
+ const merged = new Map();
137
+ recordsFromTree(cwd, tree, merged, false);
138
+ return merged;
139
+ }
140
+ }
141
+ const sources = new Map();
142
+ const dir = join(cwd, ADR_DIR);
143
+ if (existsSync(dir)) {
144
+ for (const file of readdirSync(dir)) {
145
+ if (!isAdrRecordFilename(file))
146
+ continue;
147
+ try {
148
+ sources.set(file, readFileSync(join(dir, file), "utf8"));
149
+ }
150
+ catch {
151
+ sources.set(file, "");
152
+ }
153
+ }
154
+ }
155
+ for (const commit of incoming)
156
+ recordsFromTree(cwd, commit, sources, true);
157
+ return sources;
158
+ }
159
+ /** Whether `.gitattributes` already binds the registry path to the driver. */
160
+ function hasMergeAttribute(source) {
161
+ return source.split(/\r?\n/).some((line) => {
162
+ const trimmed = line.trim();
163
+ if (trimmed === "" || trimmed.startsWith("#"))
164
+ return false;
165
+ const [pattern, ...attrs] = trimmed.split(/\s+/);
166
+ return pattern === ADR_REGISTRY_PATH && attrs.includes(`merge=${ADR_MERGE_DRIVER_NAME}`);
167
+ });
168
+ }
169
+ /**
170
+ * Plan the `.gitattributes` line additively: create the file with just the line,
171
+ * append the line (on its own newline) to an existing file, or do nothing when
172
+ * the binding is already present. The file is shared and project-owned — never
173
+ * lockfile-tracked, never rewritten wholesale, only this one line added.
174
+ */
175
+ export function planAdrMergeAttribute(cwd) {
176
+ const path = join(cwd, GITATTRIBUTES_FILENAME);
177
+ if (!existsSync(path)) {
178
+ return { kind: "create", detail: `add \`${ADR_MERGE_ATTRIBUTE_LINE}\``, content: `${ADR_MERGE_ATTRIBUTE_LINE}\n` };
179
+ }
180
+ const current = readFileSync(path, "utf8");
181
+ if (hasMergeAttribute(current)) {
182
+ return { kind: "present", detail: "already binds the ADR index to the merge driver", content: null };
183
+ }
184
+ const separator = current.length === 0 || current.endsWith("\n") ? "" : "\n";
185
+ return {
186
+ kind: "append",
187
+ detail: `append \`${ADR_MERGE_ATTRIBUTE_LINE}\``,
188
+ content: `${current}${separator}${ADR_MERGE_ATTRIBUTE_LINE}\n`,
189
+ };
190
+ }
191
+ /** Execute the `.gitattributes` plan. Returns true when the file was written. */
192
+ export function applyAdrMergeAttribute(cwd) {
193
+ const plan = planAdrMergeAttribute(cwd);
194
+ if (plan.content === null)
195
+ return false;
196
+ writeFileSync(join(cwd, GITATTRIBUTES_FILENAME), plan.content, "utf8");
197
+ return true;
198
+ }
199
+ /** Whether the driver is defined in this clone's local git config. */
200
+ export function adrMergeDriverConfigState(cwd) {
201
+ if (!isGitRepo(cwd))
202
+ return "not-git";
203
+ const current = git(cwd, ["config", "--local", "--get", `merge.${ADR_MERGE_DRIVER_NAME}.driver`]);
204
+ if (current === null)
205
+ return "unregistered";
206
+ return current.trim() === ADR_MERGE_DRIVER_COMMAND ? "registered" : "mismatch";
207
+ }
208
+ /**
209
+ * Register (or correct) the driver in the repo's local git config. Idempotent,
210
+ * and a no-op outside a git repo. Because the definition is per-clone and never
211
+ * committed, this must run from whatever a fresh clone runs (init / sync /
212
+ * doctor) rather than once behind a lockfile-recorded migration. Returns whether
213
+ * it changed anything.
214
+ */
215
+ export function registerAdrMergeDriver(cwd) {
216
+ const state = adrMergeDriverConfigState(cwd);
217
+ if (state === "not-git" || state === "registered")
218
+ return false;
219
+ git(cwd, ["config", "--local", `merge.${ADR_MERGE_DRIVER_NAME}.name`, ADR_MERGE_DRIVER_DESCRIPTION]);
220
+ git(cwd, ["config", "--local", `merge.${ADR_MERGE_DRIVER_NAME}.driver`, ADR_MERGE_DRIVER_COMMAND]);
221
+ return true;
222
+ }
223
+ //# sourceMappingURL=adrMergeDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adrMergeDriver.js","sourceRoot":"","sources":["../../src/lib/adrMergeDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAE5D,wFAAwF;AACxF,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,iBAAiB,UAAU,qBAAqB,EAAE,CAAC;AAE9F,2DAA2D;AAC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,sDAAsD,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mEAAmE,CAAC;AAE5G,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;A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