@sledorze/cairn 0.1.0 → 0.3.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.
Files changed (117) hide show
  1. package/README.md +69 -18
  2. package/dist/cli.js +69378 -70958
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +10 -10
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/Config.d.ts +22 -22
  8. package/dist/core/Config.d.ts.map +1 -1
  9. package/dist/core/Config.js +33 -33
  10. package/dist/core/Config.js.map +1 -1
  11. package/dist/core/glob.bench.js +1 -1
  12. package/dist/core/glob.d.ts.map +1 -1
  13. package/dist/core/hashing.d.ts +3 -0
  14. package/dist/core/hashing.d.ts.map +1 -0
  15. package/dist/core/hashing.js +16 -0
  16. package/dist/core/hashing.js.map +1 -0
  17. package/dist/core/links/Anchors.d.ts +30 -0
  18. package/dist/core/links/Anchors.d.ts.map +1 -0
  19. package/dist/core/links/Anchors.js +119 -0
  20. package/dist/core/links/Anchors.js.map +1 -0
  21. package/dist/core/links/MarkdownLinks.bench.d.ts.map +1 -0
  22. package/dist/core/{MarkdownLinks.bench.js → links/MarkdownLinks.bench.js} +1 -1
  23. package/dist/core/links/MarkdownLinks.bench.js.map +1 -0
  24. package/dist/core/links/MarkdownLinks.d.ts +121 -0
  25. package/dist/core/links/MarkdownLinks.d.ts.map +1 -0
  26. package/dist/core/links/MarkdownLinks.js +228 -0
  27. package/dist/core/links/MarkdownLinks.js.map +1 -0
  28. package/dist/core/links/RefStore.d.ts +32 -0
  29. package/dist/core/links/RefStore.d.ts.map +1 -0
  30. package/dist/core/links/RefStore.js +60 -0
  31. package/dist/core/links/RefStore.js.map +1 -0
  32. package/dist/core/links/markdownFences.d.ts +10 -0
  33. package/dist/core/links/markdownFences.d.ts.map +1 -0
  34. package/dist/core/links/markdownFences.js +51 -0
  35. package/dist/core/links/markdownFences.js.map +1 -0
  36. package/dist/core/paths.d.ts +8 -0
  37. package/dist/core/paths.d.ts.map +1 -1
  38. package/dist/core/paths.js +13 -0
  39. package/dist/core/paths.js.map +1 -1
  40. package/dist/core/sidecar.d.ts +45 -0
  41. package/dist/core/sidecar.d.ts.map +1 -0
  42. package/dist/core/sidecar.js +83 -0
  43. package/dist/core/sidecar.js.map +1 -0
  44. package/dist/core/{DocSummaries.d.ts → summaries/DocSummaries.d.ts} +13 -3
  45. package/dist/core/summaries/DocSummaries.d.ts.map +1 -0
  46. package/dist/core/{DocSummaries.js → summaries/DocSummaries.js} +31 -11
  47. package/dist/core/summaries/DocSummaries.js.map +1 -0
  48. package/dist/core/summaries/StampStore.d.ts +19 -0
  49. package/dist/core/summaries/StampStore.d.ts.map +1 -0
  50. package/dist/core/summaries/StampStore.js +34 -0
  51. package/dist/core/summaries/StampStore.js.map +1 -0
  52. package/dist/core/summaries/SummaryTree.bench.d.ts.map +1 -0
  53. package/dist/core/{SummaryTree.bench.js → summaries/SummaryTree.bench.js} +24 -14
  54. package/dist/core/summaries/SummaryTree.bench.js.map +1 -0
  55. package/dist/core/{SummaryTree.d.ts → summaries/SummaryTree.d.ts} +10 -1
  56. package/dist/core/summaries/SummaryTree.d.ts.map +1 -0
  57. package/dist/core/{SummaryTree.js → summaries/SummaryTree.js} +35 -9
  58. package/dist/core/summaries/SummaryTree.js.map +1 -0
  59. package/dist/index.d.ts +5 -5
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +10 -10
  62. package/dist/index.js.map +1 -1
  63. package/dist/init/content.d.ts +2 -2
  64. package/dist/init/content.d.ts.map +1 -1
  65. package/dist/init/content.js +45 -15
  66. package/dist/init/content.js.map +1 -1
  67. package/dist/init/generate.d.ts +1 -1
  68. package/dist/init/generate.d.ts.map +1 -1
  69. package/dist/init/generate.js +1 -1
  70. package/dist/io/DocsFs.d.ts +2 -3
  71. package/dist/io/DocsFs.d.ts.map +1 -1
  72. package/dist/io/DocsFs.js +15 -5
  73. package/dist/io/DocsFs.js.map +1 -1
  74. package/dist/program/JsonReport.d.ts +2 -2
  75. package/dist/program/JsonReport.d.ts.map +1 -1
  76. package/dist/program/JsonReport.js +2 -2
  77. package/dist/program/JsonReport.js.map +1 -1
  78. package/dist/program/{CheckLinks.d.ts → links/CheckLinks.d.ts} +9 -4
  79. package/dist/program/links/CheckLinks.d.ts.map +1 -0
  80. package/dist/program/links/CheckLinks.js +243 -0
  81. package/dist/program/links/CheckLinks.js.map +1 -0
  82. package/dist/program/links/CheckRefs.d.ts +47 -0
  83. package/dist/program/links/CheckRefs.d.ts.map +1 -0
  84. package/dist/program/links/CheckRefs.js +151 -0
  85. package/dist/program/links/CheckRefs.js.map +1 -0
  86. package/dist/program/locale.d.ts.map +1 -1
  87. package/dist/program/summaries/CheckSummaries.bench.d.ts +2 -0
  88. package/dist/program/summaries/CheckSummaries.bench.d.ts.map +1 -0
  89. package/dist/program/summaries/CheckSummaries.bench.js +94 -0
  90. package/dist/program/summaries/CheckSummaries.bench.js.map +1 -0
  91. package/dist/program/summaries/CheckSummaries.d.ts +58 -0
  92. package/dist/program/summaries/CheckSummaries.d.ts.map +1 -0
  93. package/dist/program/summaries/CheckSummaries.js +302 -0
  94. package/dist/program/summaries/CheckSummaries.js.map +1 -0
  95. package/package.json +7 -8
  96. package/schema/cairn.schema.json +35 -38
  97. package/dist/core/DocSummaries.d.ts.map +0 -1
  98. package/dist/core/DocSummaries.js.map +0 -1
  99. package/dist/core/MarkdownLinks.bench.d.ts.map +0 -1
  100. package/dist/core/MarkdownLinks.bench.js.map +0 -1
  101. package/dist/core/MarkdownLinks.d.ts +0 -51
  102. package/dist/core/MarkdownLinks.d.ts.map +0 -1
  103. package/dist/core/MarkdownLinks.js +0 -115
  104. package/dist/core/MarkdownLinks.js.map +0 -1
  105. package/dist/core/SummaryTree.bench.d.ts.map +0 -1
  106. package/dist/core/SummaryTree.bench.js.map +0 -1
  107. package/dist/core/SummaryTree.d.ts.map +0 -1
  108. package/dist/core/SummaryTree.js.map +0 -1
  109. package/dist/program/CheckLinks.d.ts.map +0 -1
  110. package/dist/program/CheckLinks.js +0 -122
  111. package/dist/program/CheckLinks.js.map +0 -1
  112. package/dist/program/CheckSummaries.d.ts +0 -38
  113. package/dist/program/CheckSummaries.d.ts.map +0 -1
  114. package/dist/program/CheckSummaries.js +0 -198
  115. package/dist/program/CheckSummaries.js.map +0 -1
  116. /package/dist/core/{MarkdownLinks.bench.d.ts → links/MarkdownLinks.bench.d.ts} +0 -0
  117. /package/dist/core/{SummaryTree.bench.d.ts → summaries/SummaryTree.bench.d.ts} +0 -0
@@ -0,0 +1,302 @@
1
+ // Effect programs for the hierarchical summary system.
2
+ // - `checkSummaries` -> the plan (what is missing/stale, bottom-up order).
3
+ // - `stampSummaries` -> (re)writes the freshness stamp of EXISTING summaries,
4
+ // bottom-up, into their `.cairn/**` sidecar (never into the summary's own
5
+ // content — see StampStore.ts).
6
+ // - `migrateStamps` -> one-off: strips the legacy in-content stamp from
7
+ // every summary, then runs the sidecar stamp pass over the stripped tree.
8
+ // Pure planning lives in ../../core/summaries/SummaryTree.ts; freshness
9
+ // primitives in ../../core/summaries/DocSummaries.ts; sidecar path mapping +
10
+ // (de)serialisation in ../../core/summaries/StampStore.ts.
11
+ import { Effect } from 'effect';
12
+ import { DEFAULT_STAMP_COMMAND } from '../../core/Config.js';
13
+ import { countLines, isSummaryFile, stripSourceHash } from '../../core/summaries/DocSummaries.js';
14
+ import { parseStamp, serializeStamp, STAMP_VERSION } from '../../core/summaries/StampStore.js';
15
+ import { isDirSummary, nodeExpectedHash, planSummaries } from '../../core/summaries/SummaryTree.js';
16
+ import { metaRootFor, nodePathForSidecar, sidecarPathFor } from '../../core/sidecar.js';
17
+ import { DocsFs } from '../../io/DocsFs.js';
18
+ import { enOnly, pick } from '../locale.js';
19
+ export { DEFAULT_STAMP_COMMAND } from '../../core/Config.js';
20
+ const EMPTY_STAMPS = new Map();
21
+ const layoutFor = (base) => ({ base, metaRoot: metaRootFor(base) });
22
+ /** Assemble the pure planner's arguments from the program args + file map.
23
+ * `stamps` defaults to empty — callers that don't need freshness status (the
24
+ * stamp-writing pass itself) can omit it entirely and skip loading it. */
25
+ const toPlanArgs = (files, args, stamps = EMPTY_STAMPS) => ({
26
+ files,
27
+ ...(args.ignore === undefined ? {} : { ignore: args.ignore }),
28
+ ...(args.naming === undefined ? {} : { naming: args.naming }),
29
+ ...(args.requireDirSummaries === undefined ? {} : { requireDirSummaries: args.requireDirSummaries }),
30
+ roots: args.roots,
31
+ stamps,
32
+ ...(args.thresholdLines === undefined ? {} : { thresholdLines: args.thresholdLines }),
33
+ });
34
+ const readMarkdown = (roots) => Effect.gen(function* () {
35
+ const dfs = yield* DocsFs;
36
+ const all = yield* dfs.listFiles(roots);
37
+ const files = new Map();
38
+ for (const file of all) {
39
+ if (file.endsWith('.md')) {
40
+ files.set(file, yield* dfs.readFile(file));
41
+ }
42
+ }
43
+ return files;
44
+ });
45
+ /**
46
+ * Load every stamp recorded under `.cairn/**` into a `node path -> sha256` map.
47
+ * A sidecar that can't be mapped back to a node path, or whose content is
48
+ * corrupt/merge-conflicted/hand-edited (`parseStamp` returns `null`), is simply
49
+ * skipped — its node then reads as `stale`/`missing`, never a crash (see
50
+ * StampStore.ts's own contract). Absent `.cairn/` (first run) yields an empty
51
+ * map via `dfs.listFiles`, also without error.
52
+ */
53
+ const readStamps = (layout) => Effect.gen(function* () {
54
+ const dfs = yield* DocsFs;
55
+ const sidecarPaths = yield* dfs.listFiles([layout.metaRoot]);
56
+ const stamps = new Map();
57
+ for (const sidecarPath of sidecarPaths) {
58
+ const nodeAtPath = nodePathForSidecar(sidecarPath, layout);
59
+ if (nodeAtPath === null) {
60
+ continue;
61
+ }
62
+ const record = parseStamp(yield* dfs.readFile(sidecarPath));
63
+ if (record !== null) {
64
+ stamps.set(nodeAtPath, record.sha256);
65
+ }
66
+ }
67
+ return stamps;
68
+ });
69
+ /** 0 when nothing is missing/stale, no orphan summaries, and no deleted-source
70
+ * stamps remain, 1 otherwise. */
71
+ export const summaryExitCode = (plan) => plan.todo.length > 0 || plan.orphans.length > 0 || plan.orphanStamps.length > 0 ? 1 : 0;
72
+ /** Report lines: methodology + the bottom-up update order, for a one-pass fix. */
73
+ export const formatSummaryReport = (plan, options = {}) => {
74
+ const locale = options.locale ?? 'en';
75
+ const stampCommand = options.stampCommand ?? DEFAULT_STAMP_COMMAND;
76
+ const totalOrphans = plan.orphans.length + plan.orphanStamps.length;
77
+ if (plan.todo.length === 0 && totalOrphans === 0) {
78
+ return [
79
+ pick(locale, {
80
+ en: `✅ Hierarchical summaries OK (${plan.nodes.length} summary/ies checked).`,
81
+ fr: `✅ Résumés hiérarchiques OK (${plan.nodes.length} résumé(s) vérifié(s)).`,
82
+ }),
83
+ ];
84
+ }
85
+ const orphanLines = plan.orphans.map((p) => pick(locale, {
86
+ en: ` ✗ orphan summary (source gone): ${p}`,
87
+ fr: ` ✗ résumé orphelin (source disparue) : ${p}`,
88
+ }));
89
+ // A `.cairn/**` sidecar with no corresponding node — its source (and possibly
90
+ // its summary file too) was deleted; the sidecar, never touched by hand, is
91
+ // what caught it (see StampStore.ts / SummaryTree.ts's `findDeletedStamps`).
92
+ const orphanStampLines = plan.orphanStamps.map((p) => pick(locale, {
93
+ en: ` ✗ deleted-source stamp (sidecar left behind): ${p}`,
94
+ fr: ` ✗ tampon d'une source supprimée (fichier annexe orphelin) : ${p}`,
95
+ }));
96
+ if (plan.todo.length === 0) {
97
+ return [
98
+ pick(locale, {
99
+ en: `❌ ${totalOrphans} orphan summary/ies or stamp(s) (source doc deleted, renamed, or below threshold):`,
100
+ fr: `❌ ${totalOrphans} résumé(s) ou tampon(s) orphelin(s) (source supprimée, renommée, ou sous le seuil) :`,
101
+ }),
102
+ ...orphanLines,
103
+ ...orphanStampLines,
104
+ ];
105
+ }
106
+ const lines = pick(locale, {
107
+ en: [
108
+ `❌ ${plan.todo.length} summary/ies to (re)generate.`,
109
+ '',
110
+ 'Methodology (a single, bottom-up pass):',
111
+ ' 1. File summaries: one per doc over the line threshold, a fast-to-read version of the source.',
112
+ ' 2. Directory summaries (_SUMMARY.md): aggregate the summaries of direct docs (or the doc itself when short) + the _SUMMARY.md of direct sub-directories.',
113
+ ` 3. Process in THIS order (files, then deepest directories), then run \`${stampCommand}\` to stamp the hashes.`,
114
+ '',
115
+ 'Update order:',
116
+ ],
117
+ fr: [
118
+ `❌ ${plan.todo.length} résumé(s) à (re)générer.`,
119
+ '',
120
+ 'Méthodologie (une seule passe, de bas en haut) :',
121
+ ' 1. Résumés de fichier : 1 par doc au-dessus du seuil de lignes, version rapide à lire de la source.',
122
+ " 2. Résumés de répertoire (_SUMMARY.md) : agrègent les résumés des docs directs (ou le doc s'il est court) + les _SUMMARY.md des sous-répertoires directs.",
123
+ ` 3. Traiter dans CET ordre (fichiers puis répertoires les plus profonds), puis lancer \`${stampCommand}\` pour tamponner les hash.`,
124
+ '',
125
+ 'Ordre de mise à jour :',
126
+ ],
127
+ });
128
+ for (const node of plan.todo) {
129
+ const tag = node.kind === 'dir'
130
+ ? pick(locale, { en: 'directory', fr: 'répertoire' })
131
+ : pick(locale, { en: 'file', fr: 'fichier' });
132
+ let reason = node.status === 'missing'
133
+ ? pick(locale, { en: 'missing', fr: 'manquant' })
134
+ : pick(locale, { en: 'stale (source changed)', fr: 'périmé (source modifiée)' });
135
+ if (node.missingLinks.length > 0) {
136
+ reason = pick(locale, {
137
+ en: `missing child links (${node.missingLinks.length})`,
138
+ fr: `liens enfants manquants (${node.missingLinks.length})`,
139
+ });
140
+ }
141
+ lines.push(` - [${tag}] ${node.path} : ${reason}`);
142
+ }
143
+ if (totalOrphans > 0) {
144
+ lines.push('', pick(locale, {
145
+ en: `${totalOrphans} orphan summary/ies or stamp(s) (source doc deleted, renamed, or below threshold):`,
146
+ fr: `${totalOrphans} résumé(s) ou tampon(s) orphelin(s) (source supprimée, renommée, ou sous le seuil) :`,
147
+ }), ...orphanLines, ...orphanStampLines);
148
+ }
149
+ return lines;
150
+ };
151
+ const shortHash = (h) => (h === null ? 'none' : `${h.slice(0, 8)}…`);
152
+ /** Markdown headings in `content`, in order, for a quick outline of what changed. */
153
+ const headings = (content) => content
154
+ .split('\n')
155
+ .filter((line) => /^#{1,6}\s/.test(line))
156
+ .map((line) => line.trim());
157
+ /**
158
+ * Explain why each `todo` node is not ok. cairn stores only a content hash, not
159
+ * prior source text, so this cannot diff against the previously-summarized
160
+ * version — it surfaces what IS derivable: the expected/recorded hash pair, the
161
+ * changed source's current outline (file summaries), or which stale/missing
162
+ * child is driving a directory summary stale (dir summaries).
163
+ */
164
+ const explainPlan = (plan, files, options) => {
165
+ const locale = options.locale ?? 'en';
166
+ if (plan.todo.length === 0) {
167
+ return [pick(locale, enOnly('Nothing to explain — all summaries are fresh.'))];
168
+ }
169
+ const byPath = new Map(plan.nodes.map((n) => [n.path, n]));
170
+ const lines = [];
171
+ for (const node of plan.todo) {
172
+ lines.push(`${node.kind} ${node.path} (${node.status}):`, ` expected ${shortHash(node.expectedHash)} recorded ${shortHash(node.recordedHash)}`);
173
+ if (node.kind === 'file') {
174
+ const source = node.inputs[0];
175
+ const content = source === undefined ? '' : (files.get(source) ?? '');
176
+ lines.push(` source: ${source} (${countLines(content)} lines)`, ...headings(content).map((h) => ` ${h}`));
177
+ }
178
+ else {
179
+ const staleInputs = node.inputs.filter((input) => byPath.get(input)?.status !== 'ok');
180
+ if (staleInputs.length > 0) {
181
+ lines.push(` driven by stale/missing child: ${staleInputs.join(', ')}`);
182
+ }
183
+ if (node.missingLinks.length > 0) {
184
+ lines.push(` missing links to: ${node.missingLinks.join(', ')}`);
185
+ }
186
+ }
187
+ lines.push('');
188
+ }
189
+ return lines;
190
+ };
191
+ export const checkSummaries = (args) => Effect.gen(function* () {
192
+ const files = yield* readMarkdown(args.roots);
193
+ const stamps = yield* readStamps(layoutFor(args.base));
194
+ return planSummaries(toPlanArgs(files, args, stamps));
195
+ });
196
+ /** `--explain`: why each todo node is not ok (see `explainPlan` for what this can and cannot show). */
197
+ export const explainSummaries = (args, options = {}) => Effect.gen(function* () {
198
+ const files = yield* readMarkdown(args.roots);
199
+ const stamps = yield* readStamps(layoutFor(args.base));
200
+ const plan = planSummaries(toPlanArgs(files, args, stamps));
201
+ return explainPlan(plan, files, options);
202
+ });
203
+ /**
204
+ * Stamp every EXISTING summary with its current source/manifest hash, bottom-up,
205
+ * into its `.cairn/**` sidecar — never into the summary's own content. Summaries
206
+ * whose content has not been authored yet are returned as `missing`.
207
+ *
208
+ * ALWAYS strips a legacy in-content `<!-- source-sha256 -->` stamp first, if one
209
+ * is still there, before computing any hash — not just when explicitly asked to
210
+ * migrate. This is the actual fix for the discoverability gap a one-off
211
+ * `--migrate-stamps` command alone would leave: an upgrading repo's EXISTING
212
+ * `stampCommand` (already `cairn check --summaries-only --stamp` in every
213
+ * `.cairnrc.json` this tool ever scaffolded) is what a user or CI already runs
214
+ * — making that command self-heal means there is no new command to discover,
215
+ * search for, or forget to run. `--migrate-stamps` (`migrateStamps`, below)
216
+ * still exists as an explicit, nameable entry point for anyone who wants to run
217
+ * the cleanup as its own reported step, but it is no longer load-bearing.
218
+ *
219
+ * Doesn't need to load `stamps` first: this loop writes every node's hash
220
+ * unconditionally (not just the stale ones), so `planSummaries`' ordering is all
221
+ * it needs from the planner — freshness status plays no role in stamping itself.
222
+ */
223
+ const stampFiles = (files, args) => Effect.gen(function* () {
224
+ const dfs = yield* DocsFs;
225
+ const layout = layoutFor(args.base);
226
+ // Only ever strips a SUMMARY file's own legacy stamp — never a plain source
227
+ // doc. A source doc's prose can legitimately contain the literal
228
+ // `<!-- source-sha256: <64hex> -->` text (e.g. a doc that documents cairn's
229
+ // OWN former stamp format, with a real-looking example) — that text is the
230
+ // user's content, not tool metadata, and `stampFiles` must never touch it.
231
+ // Restricting to `isSummaryFile`/`isDirSummary` is what keeps "the tool
232
+ // never writes into content" true for every file it doesn't own.
233
+ let migrated = 0;
234
+ for (const [p, content] of files) {
235
+ if (!isSummaryFile(p, args.naming) && !isDirSummary(p, args.naming)) {
236
+ continue;
237
+ }
238
+ const stripped = stripSourceHash(content);
239
+ if (stripped !== content) {
240
+ files.set(p, stripped);
241
+ yield* dfs.writeFile(p, stripped);
242
+ migrated += 1;
243
+ }
244
+ }
245
+ const order = planSummaries(toPlanArgs(files, args)).nodes;
246
+ const missing = [];
247
+ let stamped = 0;
248
+ for (const node of order) {
249
+ if (!files.has(node.path)) {
250
+ missing.push(node);
251
+ continue;
252
+ }
253
+ // A node's `inputs` are structurally stable (only summary CONTENT changes
254
+ // during stamping, never which paths feed a node) — so its hash can be
255
+ // recomputed directly from `inputs` + their current content. Content no
256
+ // longer carries a stamp (that's the whole point of the sidecar), so —
257
+ // unlike the old in-content scheme — a child's just-written sidecar never
258
+ // changes ITS OWN content, and therefore never perturbs a parent's
259
+ // manifest hash; bottom-up order is preserved for a single-pass write, but
260
+ // no longer required for correctness of the hash itself.
261
+ const expectedHash = nodeExpectedHash({ files, inputs: node.inputs, kind: node.kind, path: node.path });
262
+ const sidecarContent = serializeStamp({ sha256: expectedHash, version: STAMP_VERSION });
263
+ yield* dfs.writeFile(sidecarPathFor(node.path, layout), sidecarContent);
264
+ stamped += 1;
265
+ }
266
+ return { migrated, missing, stamped };
267
+ });
268
+ export const stampSummaries = (args) => Effect.gen(function* () {
269
+ const files = yield* readMarkdown(args.roots);
270
+ return yield* stampFiles(files, args);
271
+ });
272
+ /**
273
+ * Explicit, nameable one-shot entry point (`--migrate-stamps`) for the SAME
274
+ * self-healing `stampFiles` already does unconditionally on every `--stamp` —
275
+ * kept for anyone who wants to run/report the cleanup as its own step, not
276
+ * because plain `--stamp` needs it to be correct.
277
+ */
278
+ export const migrateStamps = (args) => Effect.gen(function* () {
279
+ const files = yield* readMarkdown(args.roots);
280
+ return yield* stampFiles(files, args);
281
+ });
282
+ /** Delete every orphan summary file (source doc gone) AND every orphan
283
+ * `.cairn/**` sidecar (deleted-source stamp — see `SummaryPlan.orphanStamps`),
284
+ * reporting the total count removed. */
285
+ export const pruneOrphans = (args) => Effect.gen(function* () {
286
+ const dfs = yield* DocsFs;
287
+ const layout = layoutFor(args.base);
288
+ const files = yield* readMarkdown(args.roots);
289
+ const stamps = yield* readStamps(layout);
290
+ const plan = planSummaries(toPlanArgs(files, args, stamps));
291
+ for (const orphan of plan.orphans) {
292
+ yield* dfs.deleteFile(orphan);
293
+ }
294
+ for (const orphanStamp of plan.orphanStamps) {
295
+ yield* dfs.deleteFile(sidecarPathFor(orphanStamp, layout));
296
+ }
297
+ return plan.orphans.length + plan.orphanStamps.length;
298
+ });
299
+ // Re-exported so callers can recognise summary files without importing two modules.
300
+ export { isSummaryFile } from '../../core/summaries/DocSummaries.js';
301
+ export { isDirSummary } from '../../core/summaries/SummaryTree.js';
302
+ //# sourceMappingURL=CheckSummaries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckSummaries.js","sourceRoot":"","sources":["../../../src/program/summaries/CheckSummaries.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,oCAAoC;AACpC,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,2DAA2D;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAE9F,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAEnG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE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AC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAA;AACvD,CAAC,CAAC,CAAA;AAEJ,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sledorze/cairn",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Hierarchical documentation summary consolidation with content-hash freshness (clone/CI-proof) and dead-link checking. Agent-agnostic CLI; scaffolds guidance for Claude Code and GitHub Copilot.",
5
5
  "keywords": [
6
6
  "documentation",
@@ -38,20 +38,19 @@
38
38
  "schema"
39
39
  ],
40
40
  "dependencies": {
41
- "@effect/cli": "^0.76.0",
42
- "@effect/platform": "^0.97.0",
43
- "@effect/platform-node": "^0.108.0",
44
- "effect": "^3.22.0"
41
+ "@effect/platform-node": "4.0.0-beta.100",
42
+ "effect": "4.0.0-beta.100",
43
+ "github-slugger": "^2.0.0"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@changesets/cli": "^2.27.0",
48
- "@types/node": "^25.3.3",
47
+ "@types/node": "^26.1.1",
49
48
  "esbuild": "^0.28.1",
50
49
  "lefthook": "^2.1.0",
51
- "oxlint": "1.73.0",
50
+ "oxlint": "1.74.0",
52
51
  "prettier": "^3.8.1",
53
52
  "tsx": "^4.21.0",
54
- "typescript": "^5.9.3",
53
+ "typescript": "^7.0.2",
55
54
  "vitest": "^4.0.18"
56
55
  },
57
56
  "publishConfig": {
@@ -1,23 +1,39 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
2
  "$defs": {
3
+ "CairnChecksConfig": {
4
+ "type": "object",
5
+ "properties": {
6
+ "links": { "type": "boolean", "description": "Enable Markdown dead-link checking. Default true." },
7
+ "summaries": {
8
+ "type": "boolean",
9
+ "description": "Enable summary freshness checking (content-hash based). Default true."
10
+ }
11
+ },
12
+ "additionalProperties": false,
13
+ "description": "Which checks `cairn check` runs."
14
+ },
15
+ "CairnNamingConfig": {
16
+ "type": "object",
17
+ "properties": {
18
+ "dirSummary": { "type": "string", "description": "Directory summary filename. Default \"_SUMMARY.md\"." },
19
+ "fileSummarySuffix": { "type": "string", "description": "Suffix for file summaries. Default \".summary.md\"." }
20
+ },
21
+ "additionalProperties": false,
22
+ "description": "Configurable filenames for the summary system."
23
+ },
4
24
  "CairnConfig": {
5
25
  "type": "object",
6
- "required": [],
7
26
  "properties": {
8
27
  "$schema": {
9
28
  "type": "string",
10
29
  "description": "JSON Schema URL for editor autocomplete/validation. Ignored by cairn."
11
30
  },
12
31
  "checks": { "$ref": "#/$defs/CairnChecksConfig" },
13
- "extends": {
14
- "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
15
- "description": "One or more config files (paths, relative to this file) to inherit from. Local fields win over inherited ones."
16
- },
32
+ "extends": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
17
33
  "ignore": {
18
34
  "type": "array",
19
- "items": { "type": "string" },
20
- "description": "Globs to exclude from scanning. Default [\"**/node_modules/**\"]."
35
+ "description": "Globs to exclude from scanning. Default [\"**/node_modules/**\"].",
36
+ "items": { "type": "string" }
21
37
  },
22
38
  "locale": {
23
39
  "type": "string",
@@ -31,8 +47,8 @@
31
47
  },
32
48
  "roots": {
33
49
  "type": "array",
34
- "items": { "type": "string" },
35
- "description": "Documentation roots to scan (globs allowed). Default [\"docs\"]."
50
+ "description": "Documentation roots to scan (globs allowed). Default [\"docs\"].",
51
+ "items": { "type": "string" }
36
52
  },
37
53
  "stampCommand": {
38
54
  "type": "string",
@@ -40,38 +56,19 @@
40
56
  },
41
57
  "thresholdLines": {
42
58
  "type": "integer",
43
- "description": "Line count above which a file needs a summary. Non-negative integer. Default 30.",
44
- "title": "nonNegative",
45
- "minimum": 0
59
+ "allOf": [
60
+ {
61
+ "minimum": 0,
62
+ "description": "Line count above which a file needs a summary. Non-negative integer. Default 30."
63
+ }
64
+ ]
46
65
  }
47
66
  },
48
67
  "additionalProperties": false,
49
- "description": "Configuration for the cairn CLI (.cairnrc.json, .cairnrc, or the \"cairn\" key of package.json).",
50
- "title": "cairn configuration"
51
- },
52
- "CairnChecksConfig": {
53
- "type": "object",
54
- "required": [],
55
- "properties": {
56
- "links": { "type": "boolean", "description": "Enable Markdown dead-link checking. Default true." },
57
- "summaries": {
58
- "type": "boolean",
59
- "description": "Enable summary freshness checking (content-hash based). Default true."
60
- }
61
- },
62
- "additionalProperties": false,
63
- "description": "Which checks `cairn check` runs."
64
- },
65
- "CairnNamingConfig": {
66
- "type": "object",
67
- "required": [],
68
- "properties": {
69
- "dirSummary": { "type": "string", "description": "Directory summary filename. Default \"_SUMMARY.md\"." },
70
- "fileSummarySuffix": { "type": "string", "description": "Suffix for file summaries. Default \".summary.md\"." }
71
- },
72
- "additionalProperties": false,
73
- "description": "Configurable filenames for the summary system."
68
+ "title": "cairn configuration",
69
+ "description": "Configuration for the cairn CLI (.cairnrc.json, .cairnrc, or the \"cairn\" key of package.json)."
74
70
  }
75
71
  },
72
+ "$schema": "http://json-schema.org/draft-07/schema#",
76
73
  "$ref": "#/$defs/CairnConfig"
77
74
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DocSummaries.d.ts","sourceRoot":"","sources":["../../src/core/DocSummaries.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAA;AAEtD,qDAAqD;AACrD,MAAM,WAAW,MAAM;IACrB,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;CACnC;AAED,4DAA4D;AAC5D,eAAO,MAAM,cAAc,EAAE,MAG5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,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAgB,EAAiB,EAAE;IAC1G,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,YAAY,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownLinks.bench.d.ts","sourceRoot":"","sources":["../../src/core/MarkdownLinks.bench.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownLinks.bench.js","sourceRoot":"","sources":["../../src/core/MarkdownLinks.bench.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEtH,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;QAClB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;QAC9D,CAAC;aAAM,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,8BAA8B,CAAC,aAAa,CAAC,CAAA;QACjF,CAAC;aAAM,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,SAA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ACrF,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAChC,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC,CAAA;IACrF,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC5C,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAA;IAC5G,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,51 +0,0 @@
1
- export interface MarkdownLink {
2
- readonly target: string;
3
- readonly text: string;
4
- }
5
- export interface MarkdownLinkDef {
6
- readonly label: string;
7
- readonly target: string;
8
- }
9
- export interface BrokenLink {
10
- readonly suggestion?: string;
11
- readonly target: string;
12
- readonly text: string;
13
- }
14
- export interface SuggestFixArgs {
15
- readonly fromDir: string;
16
- readonly index: ReadonlyMap<string, readonly string[]>;
17
- readonly target: string;
18
- }
19
- export interface CheckContentArgs {
20
- readonly content: string;
21
- readonly existsAbs: (absPath: string) => boolean;
22
- readonly fileAbs: string;
23
- readonly index?: ReadonlyMap<string, readonly string[]>;
24
- }
25
- /**
26
- * Blank out fenced (``` / ~~~) and inline (`code`) spans so links that only
27
- * appear inside code examples are NOT treated as real links. Newlines are kept
28
- * so line-based reasoning is unaffected; other characters become spaces.
29
- */
30
- export declare const stripCode: (content: string) => string;
31
- /** Extract inline Markdown links/images as `{ target, text }`. */
32
- export declare const extractLinks: (content: string) => MarkdownLink[];
33
- /** Extract reference-style link definitions (`[label]: ./path "title"`). */
34
- export declare const extractLinkDefinitions: (content: string) => MarkdownLinkDef[];
35
- /** True only for relative paths we can resolve on disk. */
36
- export declare const isCheckableTarget: (target: string) => boolean;
37
- /** Drop `#anchor` and `?query` from a target. */
38
- export declare const stripAnchor: (target: string) => string;
39
- /** Map basename -> list of absolute paths, for ambiguity-aware fixing. */
40
- export declare const buildBasenameIndex: (absPaths: readonly string[]) => Map<string, string[]>;
41
- /**
42
- * Suggest a repaired relative path for a broken target. Returns a path only
43
- * when exactly one indexed file matches the basename (no ambiguity); else null.
44
- */
45
- export declare const suggestFix: ({ fromDir, index, target }: SuggestFixArgs) => string | null;
46
- /**
47
- * Check one file's content for broken relative links. Returns the broken ones,
48
- * each with an optional `suggestion` when an `index` is supplied.
49
- */
50
- export declare const checkContent: ({ content, existsAbs, fileAbs, index }: CheckContentArgs) => BrokenLink[];
51
- //# sourceMappingURL=MarkdownLinks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownLinks.d.ts","sourceRoot":"","sources":["../../src/core/MarkdownLinks.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,K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