daftari 3.16.0 → 3.18.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 (249) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +3 -3
  3. package/dist/access/rbac.d.ts.map +1 -1
  4. package/dist/access/rbac.js +3 -1
  5. package/dist/access/rbac.js.map +1 -1
  6. package/dist/asof/git-read.d.ts.map +1 -1
  7. package/dist/asof/git-read.js +11 -9
  8. package/dist/asof/git-read.js.map +1 -1
  9. package/dist/asof/snapshot.d.ts.map +1 -1
  10. package/dist/asof/snapshot.js +2 -1
  11. package/dist/asof/snapshot.js.map +1 -1
  12. package/dist/board/sources/lint.d.ts.map +1 -1
  13. package/dist/board/sources/lint.js +3 -1
  14. package/dist/board/sources/lint.js.map +1 -1
  15. package/dist/board/sources/staleness.d.ts.map +1 -1
  16. package/dist/board/sources/staleness.js +8 -8
  17. package/dist/board/sources/staleness.js.map +1 -1
  18. package/dist/board/sources/staleness.test.js +27 -0
  19. package/dist/board/sources/staleness.test.js.map +1 -1
  20. package/dist/cli.d.ts +4 -1
  21. package/dist/cli.d.ts.map +1 -1
  22. package/dist/cli.js +39 -8
  23. package/dist/cli.js.map +1 -1
  24. package/dist/consolidate/constants.d.ts.map +1 -1
  25. package/dist/consolidate/constants.js +6 -1
  26. package/dist/consolidate/constants.js.map +1 -1
  27. package/dist/consolidate/index.d.ts.map +1 -1
  28. package/dist/consolidate/index.js +1 -1
  29. package/dist/consolidate/index.js.map +1 -1
  30. package/dist/curation/chains.d.ts +21 -0
  31. package/dist/curation/chains.d.ts.map +1 -0
  32. package/dist/curation/chains.js +151 -0
  33. package/dist/curation/chains.js.map +1 -0
  34. package/dist/curation/lint-page.d.ts +22 -0
  35. package/dist/curation/lint-page.d.ts.map +1 -0
  36. package/dist/curation/lint-page.js +97 -0
  37. package/dist/curation/lint-page.js.map +1 -0
  38. package/dist/curation/lint-voice.d.ts.map +1 -1
  39. package/dist/curation/lint-voice.js +16 -11
  40. package/dist/curation/lint-voice.js.map +1 -1
  41. package/dist/curation/lint.d.ts +6 -1
  42. package/dist/curation/lint.d.ts.map +1 -1
  43. package/dist/curation/lint.js +84 -24
  44. package/dist/curation/lint.js.map +1 -1
  45. package/dist/curation/provenance.d.ts.map +1 -1
  46. package/dist/curation/provenance.js.map +1 -1
  47. package/dist/curation/question-candidates.d.ts +27 -0
  48. package/dist/curation/question-candidates.d.ts.map +1 -0
  49. package/dist/curation/question-candidates.js +151 -0
  50. package/dist/curation/question-candidates.js.map +1 -0
  51. package/dist/curation/questions.d.ts +9 -0
  52. package/dist/curation/questions.d.ts.map +1 -0
  53. package/dist/curation/questions.js +44 -0
  54. package/dist/curation/questions.js.map +1 -0
  55. package/dist/curation/shadow.d.ts.map +1 -1
  56. package/dist/curation/shadow.js +2 -0
  57. package/dist/curation/shadow.js.map +1 -1
  58. package/dist/curation/source-refs.d.ts +7 -0
  59. package/dist/curation/source-refs.d.ts.map +1 -1
  60. package/dist/curation/source-refs.js +46 -1
  61. package/dist/curation/source-refs.js.map +1 -1
  62. package/dist/curation/staged-actions.d.ts +9 -3
  63. package/dist/curation/staged-actions.d.ts.map +1 -1
  64. package/dist/curation/staged-actions.js +165 -46
  65. package/dist/curation/staged-actions.js.map +1 -1
  66. package/dist/curation/staleness.d.ts +6 -0
  67. package/dist/curation/staleness.d.ts.map +1 -1
  68. package/dist/curation/staleness.js +41 -0
  69. package/dist/curation/staleness.js.map +1 -1
  70. package/dist/curation/structural.d.ts.map +1 -1
  71. package/dist/curation/structural.js +6 -4
  72. package/dist/curation/structural.js.map +1 -1
  73. package/dist/curation/supersede-chains.d.ts +10 -0
  74. package/dist/curation/supersede-chains.d.ts.map +1 -0
  75. package/dist/curation/supersede-chains.js +95 -0
  76. package/dist/curation/supersede-chains.js.map +1 -0
  77. package/dist/curation/tension.d.ts.map +1 -1
  78. package/dist/curation/tension.js +24 -17
  79. package/dist/curation/tension.js.map +1 -1
  80. package/dist/curation/vault-docs.js +4 -4
  81. package/dist/curation/vault-docs.js.map +1 -1
  82. package/dist/distill/citation-check.d.ts +29 -0
  83. package/dist/distill/citation-check.d.ts.map +1 -0
  84. package/dist/distill/citation-check.js +109 -0
  85. package/dist/distill/citation-check.js.map +1 -0
  86. package/dist/distill/cli.d.ts +1 -1
  87. package/dist/distill/cli.d.ts.map +1 -1
  88. package/dist/distill/cli.js +127 -16
  89. package/dist/distill/cli.js.map +1 -1
  90. package/dist/distill/cost.d.ts +7 -3
  91. package/dist/distill/cost.d.ts.map +1 -1
  92. package/dist/distill/cost.js.map +1 -1
  93. package/dist/distill/extract.d.ts +38 -1
  94. package/dist/distill/extract.d.ts.map +1 -1
  95. package/dist/distill/extract.js +48 -6
  96. package/dist/distill/extract.js.map +1 -1
  97. package/dist/distill/index.d.ts +1 -1
  98. package/dist/distill/index.d.ts.map +1 -1
  99. package/dist/distill/index.js +1 -1
  100. package/dist/distill/index.js.map +1 -1
  101. package/dist/distill/propose.d.ts.map +1 -1
  102. package/dist/distill/propose.js +23 -0
  103. package/dist/distill/propose.js.map +1 -1
  104. package/dist/distill/state.d.ts +39 -0
  105. package/dist/distill/state.d.ts.map +1 -1
  106. package/dist/distill/state.js +84 -7
  107. package/dist/distill/state.js.map +1 -1
  108. package/dist/eval/index.js.map +1 -1
  109. package/dist/eval/llm-openrouter.d.ts.map +1 -1
  110. package/dist/eval/llm-openrouter.js +6 -4
  111. package/dist/eval/llm-openrouter.js.map +1 -1
  112. package/dist/eval/llm.d.ts +2 -0
  113. package/dist/eval/llm.d.ts.map +1 -1
  114. package/dist/eval/llm.js +29 -4
  115. package/dist/eval/llm.js.map +1 -1
  116. package/dist/eval/tool-surface.d.ts.map +1 -1
  117. package/dist/eval/tool-surface.js +4 -1
  118. package/dist/eval/tool-surface.js.map +1 -1
  119. package/dist/federation/classification.d.ts.map +1 -1
  120. package/dist/federation/classification.js +4 -0
  121. package/dist/federation/classification.js.map +1 -1
  122. package/dist/federation/mounts.d.ts.map +1 -1
  123. package/dist/federation/mounts.js +3 -2
  124. package/dist/federation/mounts.js.map +1 -1
  125. package/dist/fence/detect.js +1 -1
  126. package/dist/fence/detect.js.map +1 -1
  127. package/dist/frontmatter/schema.d.ts.map +1 -1
  128. package/dist/frontmatter/schema.js +20 -0
  129. package/dist/frontmatter/schema.js.map +1 -1
  130. package/dist/frontmatter/types.d.ts +4 -1
  131. package/dist/frontmatter/types.d.ts.map +1 -1
  132. package/dist/frontmatter/types.js +3 -0
  133. package/dist/frontmatter/types.js.map +1 -1
  134. package/dist/import/langgraph-store.d.ts +2 -1
  135. package/dist/import/langgraph-store.d.ts.map +1 -1
  136. package/dist/import/langgraph-store.js +23 -4
  137. package/dist/import/langgraph-store.js.map +1 -1
  138. package/dist/index.d.ts +1 -1
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +27 -10
  141. package/dist/index.js.map +1 -1
  142. package/dist/integrations/distill.d.ts.map +1 -1
  143. package/dist/integrations/distill.js +5 -3
  144. package/dist/integrations/distill.js.map +1 -1
  145. package/dist/interview/index.d.ts.map +1 -1
  146. package/dist/interview/index.js +7 -1
  147. package/dist/interview/index.js.map +1 -1
  148. package/dist/interview/questions.d.ts +1 -1
  149. package/dist/interview/questions.d.ts.map +1 -1
  150. package/dist/interview/questions.js +6 -39
  151. package/dist/interview/questions.js.map +1 -1
  152. package/dist/interview/transcript.d.ts +2 -0
  153. package/dist/interview/transcript.d.ts.map +1 -1
  154. package/dist/interview/transcript.js +19 -5
  155. package/dist/interview/transcript.js.map +1 -1
  156. package/dist/lifecycle/lock.d.ts +19 -4
  157. package/dist/lifecycle/lock.d.ts.map +1 -1
  158. package/dist/lifecycle/lock.js +760 -171
  159. package/dist/lifecycle/lock.js.map +1 -1
  160. package/dist/okf/import.d.ts.map +1 -1
  161. package/dist/okf/import.js +15 -3
  162. package/dist/okf/import.js.map +1 -1
  163. package/dist/search/amended-by.d.ts +45 -0
  164. package/dist/search/amended-by.d.ts.map +1 -0
  165. package/dist/search/amended-by.js +62 -0
  166. package/dist/search/amended-by.js.map +1 -0
  167. package/dist/search/hybrid.d.ts +3 -0
  168. package/dist/search/hybrid.d.ts.map +1 -1
  169. package/dist/search/hybrid.js.map +1 -1
  170. package/dist/search/reindex.d.ts +1 -0
  171. package/dist/search/reindex.d.ts.map +1 -1
  172. package/dist/search/reindex.js +39 -12
  173. package/dist/search/reindex.js.map +1 -1
  174. package/dist/search/watcher.d.ts +2 -1
  175. package/dist/search/watcher.d.ts.map +1 -1
  176. package/dist/search/watcher.js +11 -19
  177. package/dist/search/watcher.js.map +1 -1
  178. package/dist/serve/index.d.ts.map +1 -1
  179. package/dist/serve/index.js +18 -9
  180. package/dist/serve/index.js.map +1 -1
  181. package/dist/serve/session.d.ts +3 -1
  182. package/dist/serve/session.d.ts.map +1 -1
  183. package/dist/serve/session.js +32 -4
  184. package/dist/serve/session.js.map +1 -1
  185. package/dist/server.d.ts.map +1 -1
  186. package/dist/server.js +10 -1
  187. package/dist/server.js.map +1 -1
  188. package/dist/sleep/cycle.d.ts.map +1 -1
  189. package/dist/sleep/cycle.js +8 -3
  190. package/dist/sleep/cycle.js.map +1 -1
  191. package/dist/sleep/index.d.ts.map +1 -1
  192. package/dist/sleep/index.js +1 -1
  193. package/dist/sleep/index.js.map +1 -1
  194. package/dist/storage/index-db.d.ts +16 -1
  195. package/dist/storage/index-db.d.ts.map +1 -1
  196. package/dist/storage/index-db.js +71 -23
  197. package/dist/storage/index-db.js.map +1 -1
  198. package/dist/storage/local.d.ts +6 -2
  199. package/dist/storage/local.d.ts.map +1 -1
  200. package/dist/storage/local.js +45 -7
  201. package/dist/storage/local.js.map +1 -1
  202. package/dist/storage/sync.d.ts.map +1 -1
  203. package/dist/storage/sync.js +6 -0
  204. package/dist/storage/sync.js.map +1 -1
  205. package/dist/tools/board.test.js +4 -2
  206. package/dist/tools/board.test.js.map +1 -1
  207. package/dist/tools/chains.d.ts +11 -0
  208. package/dist/tools/chains.d.ts.map +1 -0
  209. package/dist/tools/chains.js +133 -0
  210. package/dist/tools/chains.js.map +1 -0
  211. package/dist/tools/curation.d.ts +6 -1
  212. package/dist/tools/curation.d.ts.map +1 -1
  213. package/dist/tools/curation.js +102 -38
  214. package/dist/tools/curation.js.map +1 -1
  215. package/dist/tools/question-candidates.d.ts +11 -0
  216. package/dist/tools/question-candidates.d.ts.map +1 -0
  217. package/dist/tools/question-candidates.js +205 -0
  218. package/dist/tools/question-candidates.js.map +1 -0
  219. package/dist/tools/read.d.ts +3 -0
  220. package/dist/tools/read.d.ts.map +1 -1
  221. package/dist/tools/read.js +29 -11
  222. package/dist/tools/read.js.map +1 -1
  223. package/dist/tools/receipt.d.ts +2 -0
  224. package/dist/tools/receipt.d.ts.map +1 -1
  225. package/dist/tools/receipt.js +242 -22
  226. package/dist/tools/receipt.js.map +1 -1
  227. package/dist/tools/search.d.ts.map +1 -1
  228. package/dist/tools/search.js +42 -4
  229. package/dist/tools/search.js.map +1 -1
  230. package/dist/tools/staged-actions.d.ts +2 -1
  231. package/dist/tools/staged-actions.d.ts.map +1 -1
  232. package/dist/tools/staged-actions.js +152 -46
  233. package/dist/tools/staged-actions.js.map +1 -1
  234. package/dist/tools/write.d.ts +15 -2
  235. package/dist/tools/write.d.ts.map +1 -1
  236. package/dist/tools/write.js +716 -62
  237. package/dist/tools/write.js.map +1 -1
  238. package/dist/utils/config.d.ts +9 -2
  239. package/dist/utils/config.d.ts.map +1 -1
  240. package/dist/utils/config.js +46 -1
  241. package/dist/utils/config.js.map +1 -1
  242. package/dist/utils/vault-gitignore.d.ts +1 -1
  243. package/dist/utils/vault-gitignore.d.ts.map +1 -1
  244. package/dist/utils/vault-gitignore.js +17 -3
  245. package/dist/utils/vault-gitignore.js.map +1 -1
  246. package/dist/view/board-page.test.js +1 -1
  247. package/dist/view/board-page.test.js.map +1 -1
  248. package/package.json +3 -1
  249. package/templates/config.yaml +18 -3
@@ -0,0 +1,151 @@
1
+ // computeChains — the end of every `superseded_by` chain in the vault (#642).
2
+ //
3
+ // `superseded_by` is functional forward and a relation in reverse (vault_merge
4
+ // fans in), so a chain is an in-tree rooted at one head, or a component
5
+ // wrapped around one loop. Walking uses exact paths, the same semantics as
6
+ // resolveCurrentSource, so a chain's end matches what search forwards a reader
7
+ // to. Pure; advisory like the rest of curation — it flags, it never repairs.
8
+ //
9
+ // Visibility (2026-07-14 edge-graph spec): an unreadable document is omitted,
10
+ // and the chain is never stitched across it. Readable documents behind an
11
+ // unreadable hop get their own headless `restricted` chain, which withholds
12
+ // the hop's status and every flag derived from it. Those documents' own
13
+ // `superseded_by` already discloses the link, and search's `currentSource`
14
+ // already separates restricted from dangling, so neither is a new oracle.
15
+ // Hidden predecessors are reported coarsened (B′), never counted.
16
+ import { bucketHiddenDownstream } from "./tension-blast.js";
17
+ export const CHAIN_FLAGS = [
18
+ "draft", // the current entry is not certified yet
19
+ "retired", // the current entry is deprecated or archived: forwards to nothing live
20
+ "unforwarded", // status says superseded, but no pointer says by what
21
+ "dangling", // the head's superseded_by names a document that does not exist
22
+ "loop", // no current entry exists: the chain never terminates
23
+ "restricted", // the chain continues into a document the caller cannot read
24
+ ];
25
+ function walkForward(start, byPath, readable) {
26
+ const trail = [start];
27
+ const positions = new Map([[start.path, 0]]);
28
+ let current = start;
29
+ while (current.supersededBy !== null) {
30
+ const depth = trail.length;
31
+ const next = byPath.get(current.supersededBy);
32
+ if (!next)
33
+ return { kind: "head", doc: current, depth: depth - 1, dangling: true };
34
+ if (!readable(next))
35
+ return { kind: "restricted", hop: next, depth };
36
+ const seenAt = positions.get(next.path);
37
+ if (seenAt !== undefined) {
38
+ return { kind: "loop", cycle: trail.slice(seenAt), depth: seenAt };
39
+ }
40
+ positions.set(next.path, depth);
41
+ trail.push(next);
42
+ current = next;
43
+ }
44
+ return { kind: "head", doc: current, depth: trail.length - 1, dangling: false };
45
+ }
46
+ function statusFlags(doc, dangling) {
47
+ const flags = [];
48
+ if (doc.status === "draft")
49
+ flags.push("draft");
50
+ if (doc.status === "deprecated" || doc.status === "archived")
51
+ flags.push("retired");
52
+ if (doc.status === "superseded" && !dangling)
53
+ flags.push("unforwarded");
54
+ if (dangling)
55
+ flags.push("dangling");
56
+ return flags;
57
+ }
58
+ function toMember(doc) {
59
+ return { path: doc.path, status: doc.status, updated: doc.updated };
60
+ }
61
+ function comparePaths(a, b) {
62
+ return a < b ? -1 : a > b ? 1 : 0;
63
+ }
64
+ function smallestPath(replaced) {
65
+ return replaced.map((r) => r.path).sort(comparePaths)[0] ?? "";
66
+ }
67
+ // Headed chains first by head path; headless ones after, by a path the caller
68
+ // can read — sorting on the hidden hop would leak its position.
69
+ function compareChains(a, b) {
70
+ if (a.head && b.head)
71
+ return comparePaths(a.head.path, b.head.path);
72
+ if (a.head)
73
+ return -1;
74
+ if (b.head)
75
+ return 1;
76
+ return comparePaths(smallestPath(a.replaced), smallestPath(b.replaced));
77
+ }
78
+ export function computeChains(docs, readable) {
79
+ const byPath = new Map(docs.map((d) => [d.path, d]));
80
+ const replacedSomething = new Set();
81
+ for (const doc of docs) {
82
+ if (doc.supersededBy !== null && byPath.has(doc.supersededBy)) {
83
+ replacedSomething.add(doc.supersededBy);
84
+ }
85
+ }
86
+ // Keyed by path so a hidden document's walk can credit the chain it feeds;
87
+ // every member of a loop maps to the same draft.
88
+ const drafts = new Map();
89
+ const draftAt = (path, head, flags) => {
90
+ const existing = drafts.get(path);
91
+ if (existing)
92
+ return existing;
93
+ const draft = { head, replaced: [], hidden: 0, flags };
94
+ drafts.set(path, draft);
95
+ return draft;
96
+ };
97
+ for (const doc of docs) {
98
+ if (!readable(doc))
99
+ continue;
100
+ const end = walkForward(doc, byPath, readable);
101
+ let draft;
102
+ if (end.kind === "head") {
103
+ // Draft or retired alone is no chain: nothing was replaced. A superseded
104
+ // status with no pointer is one, even with nothing behind it.
105
+ const isChain = end.depth > 0 ||
106
+ replacedSomething.has(end.doc.path) ||
107
+ end.dangling ||
108
+ end.doc.status === "superseded";
109
+ if (!isChain)
110
+ continue;
111
+ draft = draftAt(end.doc.path, toMember(end.doc), statusFlags(end.doc, end.dangling));
112
+ }
113
+ else if (end.kind === "restricted") {
114
+ draft = draftAt(end.hop.path, null, ["restricted"]);
115
+ }
116
+ else {
117
+ draft = draftAt(end.cycle[0]?.path ?? doc.path, null, ["loop"]);
118
+ for (const member of end.cycle)
119
+ drafts.set(member.path, draft);
120
+ }
121
+ if (end.kind !== "head" || end.depth > 0) {
122
+ draft.replaced.push({ ...toMember(doc), depth: end.depth });
123
+ }
124
+ }
125
+ for (const doc of docs) {
126
+ if (readable(doc))
127
+ continue;
128
+ // A Set, not a counter: a walk around a loop passes one draft many times.
129
+ const fed = new Set();
130
+ const seen = new Set([doc.path]);
131
+ let next = doc.supersededBy === null ? undefined : byPath.get(doc.supersededBy);
132
+ while (next && !seen.has(next.path)) {
133
+ seen.add(next.path);
134
+ const draft = drafts.get(next.path);
135
+ if (draft)
136
+ fed.add(draft);
137
+ next = next.supersededBy === null ? undefined : byPath.get(next.supersededBy);
138
+ }
139
+ for (const draft of fed)
140
+ draft.hidden += 1;
141
+ }
142
+ return [...new Set(drafts.values())]
143
+ .map((draft) => ({
144
+ head: draft.head,
145
+ replaced: draft.replaced.sort((a, b) => a.depth - b.depth || comparePaths(a.path, b.path)),
146
+ hidden_replaced: bucketHiddenDownstream(draft.hidden),
147
+ flags: draft.flags,
148
+ }))
149
+ .sort(compareChains);
150
+ }
151
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/curation/chains.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,wEAAwE;AACxE,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,0EAA0E;AAC1E,kEAAkE;AAGlE,OAAO,EAAE,sBAAsB,EA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KAAK;gBAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,GAAG,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAChF,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,GAAG;YAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;SACjC,GAAG,CACF,CAAC,KAAK,EAAS,EAAE,CAAC,CAAC;QACjB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1F,eAAe,EAAE,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC;QACrD,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CACH;SACA,IAAI,CAAC,aAAa,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type Result } from "../frontmatter/types.js";
2
+ import { type LintCheckName, type LintFinding, type StagedActionLintItem } from "./lint.js";
3
+ import type { ShadowLintSummary } from "./shadow.js";
4
+ export declare const LINT_PREVIEW_PER_CHECK = 3;
5
+ export declare const LINT_PREVIEW_CHARS = 3500;
6
+ export declare const LINT_PREVIEW_LIST_ITEMS = 2;
7
+ export declare const LINT_PAGE_DEFAULT_LIMIT = 50;
8
+ export interface LintPaging {
9
+ limit: number;
10
+ offset: number;
11
+ }
12
+ export interface LintChecksView {
13
+ checks: Partial<Record<LintCheckName, LintFinding[]>>;
14
+ counts: Partial<Record<LintCheckName, number>>;
15
+ nextOffset: Partial<Record<LintCheckName, number>>;
16
+ }
17
+ export declare function parseLintPaging(args: Record<string, unknown>): Result<LintPaging | null, Error>;
18
+ export declare function pageChecks(reported: Partial<Record<LintCheckName, LintFinding[]>>, { limit, offset }: LintPaging): LintChecksView;
19
+ export declare function previewChecks(reported: Record<LintCheckName, LintFinding[]>): LintChecksView;
20
+ export declare function previewStagedActions(items: StagedActionLintItem[]): StagedActionLintItem[];
21
+ export declare function previewShadowActions(summary: ShadowLintSummary): ShadowLintSummary;
22
+ //# sourceMappingURL=lint-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint-page.d.ts","sourceRoot":"","sources":["../../src/curation/lint-page.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EAE1B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMrD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AAExC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IAEtD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/C,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAWD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,EAAE,KAAK,CAAC,CAO/F;AAGD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,CAAC,CAAC,EACvD,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,GAC5B,cAAc,CAUhB;AAKD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,CAAC,GAAG,cAAc,CA4B5F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CAI1F;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,CAMlF"}
@@ -0,0 +1,97 @@
1
+ // How much of a lint report reaches the caller (#644). runLint stays complete —
2
+ // the board and every other internal consumer need all of it — so paging lives
3
+ // here, applied to a finished report. It runs after pathVisible has already
4
+ // shaped that report, which is why it cannot change what a caller may see: a
5
+ // count is the length of the list the caller could already receive, and no
6
+ // offset reaches past it.
7
+ import { err, ok } from "../frontmatter/types.js";
8
+ import { clip, LINT_CHECKS, LINT_SUMMARY_DETAIL_CHARS, TIER0_LINT_CHECKS, } from "./lint.js";
9
+ // A default vault_lint must fit an MCP client's result limit on a real vault
10
+ // (88K observed at 295 documents). Previews are spent against a character
11
+ // budget, not only a per-check cap: details and paths have no length limit, so
12
+ // a count alone could not hold the bound.
13
+ export const LINT_PREVIEW_PER_CHECK = 3;
14
+ export const LINT_PREVIEW_CHARS = 3_500;
15
+ // The staged and shadow lists preview the same way, at the same detail width.
16
+ export const LINT_PREVIEW_LIST_ITEMS = 2;
17
+ export const LINT_PAGE_DEFAULT_LIMIT = 50;
18
+ function parseCount(raw, name) {
19
+ if (raw === undefined || raw === null)
20
+ return ok(null);
21
+ if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0) {
22
+ return err(new Error(`vault_lint '${name}' must be a non-negative integer`));
23
+ }
24
+ return ok(raw);
25
+ }
26
+ // Null when the caller asked for neither, leaving the mode to the caller.
27
+ export function parseLintPaging(args) {
28
+ const limit = parseCount(args.limit, "limit");
29
+ if (!limit.ok)
30
+ return limit;
31
+ const offset = parseCount(args.offset, "offset");
32
+ if (!offset.ok)
33
+ return offset;
34
+ if (limit.value === null && offset.value === null)
35
+ return ok(null);
36
+ return ok({ limit: limit.value ?? LINT_PAGE_DEFAULT_LIMIT, offset: offset.value ?? 0 });
37
+ }
38
+ // One page of every reported check, findings verbatim.
39
+ export function pageChecks(reported, { limit, offset }) {
40
+ const view = { checks: {}, counts: {}, nextOffset: {} };
41
+ for (const check of LINT_CHECKS) {
42
+ const findings = reported[check];
43
+ if (!findings)
44
+ continue;
45
+ view.checks[check] = findings.slice(offset, offset + limit);
46
+ view.counts[check] = findings.length;
47
+ if (offset + limit < findings.length)
48
+ view.nextOffset[check] = offset + limit;
49
+ }
50
+ return view;
51
+ }
52
+ // The first few findings of every check, details clipped. Filled round-robin,
53
+ // tier-0 first, so a tight budget thins every check rather than starving the
54
+ // last ones, and certain failures are the last to go.
55
+ export function previewChecks(reported) {
56
+ const view = pageChecks(reported, { limit: 0, offset: 0 });
57
+ const order = [
58
+ ...TIER0_LINT_CHECKS,
59
+ ...LINT_CHECKS.filter((check) => !TIER0_LINT_CHECKS.includes(check)),
60
+ ];
61
+ let budget = LINT_PREVIEW_CHARS;
62
+ for (let round = 0; round < LINT_PREVIEW_PER_CHECK && budget > 0; round++) {
63
+ for (const check of order) {
64
+ const finding = reported[check][round];
65
+ if (!finding)
66
+ continue;
67
+ const clipped = {
68
+ path: finding.path,
69
+ detail: clip(finding.detail, LINT_SUMMARY_DETAIL_CHARS),
70
+ };
71
+ budget -= JSON.stringify(clipped).length + 1;
72
+ if (budget < 0)
73
+ break;
74
+ view.checks[check]?.push(clipped);
75
+ }
76
+ }
77
+ view.nextOffset = {};
78
+ for (const check of LINT_CHECKS) {
79
+ const shown = view.checks[check]?.length ?? 0;
80
+ if (shown < reported[check].length)
81
+ view.nextOffset[check] = shown;
82
+ }
83
+ return view;
84
+ }
85
+ export function previewStagedActions(items) {
86
+ return items
87
+ .slice(0, LINT_PREVIEW_LIST_ITEMS)
88
+ .map((item) => ({ ...item, rationale: clip(item.rationale, LINT_SUMMARY_DETAIL_CHARS) }));
89
+ }
90
+ export function previewShadowActions(summary) {
91
+ return {
92
+ ...summary,
93
+ recentGated: summary.recentGated.slice(0, LINT_PREVIEW_LIST_ITEMS),
94
+ gatedSurfaced: summary.gatedSurfaced.slice(0, LINT_PREVIEW_LIST_ITEMS),
95
+ };
96
+ }
97
+ //# sourceMappingURL=lint-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint-page.js","sourceRoot":"","sources":["../../src/curation/lint-page.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,0BAA0B;AAE1B,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,IAAI,EACJ,WAAW,EACX,yBAAyB,EAIzB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAGnB,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAe1C,SAAS,UAAU,CAAC,GAAY,EAAE,IAAY;IAC5C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IACvD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MAAM,EAAE,eAAe,GAAG,MAAM,CAwDlE"}
1
+ {"version":3,"file":"lint-voice.d.ts","sourceRoot":"","sources":["../../src/curation/lint-voice.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA2C5D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA6DlE"}
@@ -6,8 +6,8 @@
6
6
  // orders findings with the SAME shared constants the plain summary uses
7
7
  // (TIER0_LINT_CHECKS, LINT_SUMMARY_TOP_FINDINGS), so the two voices surface the
8
8
  // same documents — the voice changes wording, never what is flagged. It is a
9
- // pure function of its input: no I/O, no LLM, no randomness, no clock. The full
10
- // structured report still rides the tool's structured channel untouched.
9
+ // pure function of its input: no I/O, no LLM, no randomness, no clock. The
10
+ // structured channel is untouched by the choice of voice.
11
11
  import { clip, LINT_CHECKS, LINT_SUMMARY_DETAIL_CHARS, LINT_SUMMARY_TOP_FINDINGS, TIER0_LINT_CHECKS, } from "./lint.js";
12
12
  // One clause per check, in the ledger-keeper's register. Exhaustive by type: a
13
13
  // new entry in LINT_CHECKS will not compile until it is given a clause here, so
@@ -29,6 +29,8 @@ const LEDGER_CLAUSE = {
29
29
  malformedPins: "carries a code-anchor pin the ledger cannot read",
30
30
  verbatimQuoteOverrun: "quotes its source verbatim past the compiler's budget",
31
31
  unverifiableSourceRefs: "cites evidence the ledger cannot presently verify",
32
+ supersedeChains: "follows a line of succession that never reaches a current entry",
33
+ danglingAmends: "claims to amend what cannot be found",
32
34
  };
33
35
  // "1 matter" / "3 matters" — a small deterministic pluralizer for the copy.
34
36
  function count(n, one, many) {
@@ -43,15 +45,15 @@ export function renderLedgerKeeper(report) {
43
45
  let advisory = 0;
44
46
  const flat = [];
45
47
  for (const check of LINT_CHECKS) {
46
- const findings = report.checks[check] ?? [];
47
- if (findings.length === 0)
48
+ const total = report.counts[check] ?? 0;
49
+ if (total === 0)
48
50
  continue;
49
- perCheck.push(`${check} ${findings.length}`);
51
+ perCheck.push(`${check} ${total}`);
50
52
  if (TIER0_LINT_CHECKS.includes(check))
51
- certain += findings.length;
53
+ certain += total;
52
54
  else
53
- advisory += findings.length;
54
- for (const finding of findings)
55
+ advisory += total;
56
+ for (const finding of report.checks[check] ?? [])
55
57
  flat.push({ check, finding });
56
58
  }
57
59
  // Certain (tier-0) findings first; stable sort preserves LINT_CHECKS order
@@ -69,7 +71,7 @@ export function renderLedgerKeeper(report) {
69
71
  `${h.aging.fresh} fresh, ${h.aging.aging} aging, ${h.aging.stale} past patience; ` +
70
72
  `${count(h.clusters.count, "knot", "knots")} (${h.clusters.large} large, ${h.clusters.aged} aged); ` +
71
73
  `${count(h.blastRadiusOfStaleTensions, "entry", "entries")} shadowed by a stale dispute.`,
72
- `Awaiting your ruling: ${report.stagedActions.length} staged, ` +
74
+ `Awaiting your ruling: ${report.stagedActionsTotal} staged, ` +
73
75
  `${report.reviewThroughput.lifetime.expired} lapsed unread; ` +
74
76
  `${report.shadowActions.total} write(s) watched in shadow, ` +
75
77
  `${report.shadowActions.gated} the budget would have stayed; ` +
@@ -78,15 +80,18 @@ export function renderLedgerKeeper(report) {
78
80
  ];
79
81
  const top = flat.slice(0, LINT_SUMMARY_TOP_FINDINGS);
80
82
  if (top.length > 0) {
81
- lines.push(`The ${count(top.length, "entry", "entries")} most wanting your eye, of ${flat.length}:`);
83
+ lines.push(`The ${count(top.length, "entry", "entries")} most wanting your eye, of ${report.totalFindings}:`);
82
84
  for (const { check, finding } of top) {
83
85
  lines.push(` Entry ${finding.path} ${LEDGER_CLAUSE[check]}. ` +
84
86
  `(${clip(finding.detail, LINT_SUMMARY_DETAIL_CHARS)})`);
85
87
  }
86
88
  }
87
- else {
89
+ else if (report.totalFindings === 0) {
88
90
  lines.push("Nothing demands correction today. I have recorded as much. — the daftari");
89
91
  }
92
+ if (Object.keys(report.nextOffset).length > 0) {
93
+ lines.push("The ledger runs on: turn its pages with filter, limit and offset, as nextOffset marks.");
94
+ }
90
95
  return lines.join("\n");
91
96
  }
92
97
  //# sourceMappingURL=lint-voice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lint-voice.js","sourceRoot":"","sources":["../../src/curation/lint-voice.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,8EAA8E;AAC9E,wEAAwE;AACxE,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,yEAAyE;AAKzE,OAAO,EACL,IAAI,EACJ,WAAW,EACX,yBAAyB,EACzB,yBAAyB,EAGzB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,+EAA+E;AAC/E,gFAAgF;AAChF,mDAAmD;AACnD,MAAM,aAAa,GAAkC;IACnD,UAAU,EAAE,6CAA6C;IACzD,WAAW,EAAE,oCAAoC;IACjD,SAAS,EAAE,uCAAuC;IAClD,qBAAqB,EAAE,8BAA8B;IACrD,kBAAkB,EAAE,+CAA+C;IACnE,mBAAmB,EAAE,6CAA6C;IAClE,aAAa,EAAE,iCAAiC;IAChD,gBAAgB,EAAE,qCAAqC;IACvD,kBAAkB,EAAE,+BAA+B;IACnD,aAAa,EAAE,sCAAsC;IACrD,WAAW,EAAE,oCAAoC;IACjD,iBAAiB,EAAE,+CAA+C;IAClE,iBAAiB,EAAE,qDAAqD;IACxE,aAAa,EAAE,kDAAkD;IACjE,oBAAoB,EAAE,uDAAuD;IAC7E,sBAAsB,EAAE,mDAAmD;CAC5E,CAAC;AAEF,4EAA4E;AAC5E,SAAS,KAAK,CAAC,CAAS,EAAE,GAAW,EAAE,IAAY;IACjD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC;AAED,4EAA4E;AAC5E,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAAC,MAAuB;IACxD,MAAM,QAAQ,GAAa,EA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D,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CACR,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,8BAA8B,MAAM,CAAC,aAAa,GAAG,CAClG,CAAC;QACF,KAAK,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CACR,WAAW,OAAO,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI;gBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CACzD,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,MAAM,CAAC,aAAa,KAAK,CAAC,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CACR,wFAAwF,CACzF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -6,7 +6,7 @@ import { type ShadowLintSummary } from "./shadow.js";
6
6
  import { type StagedActionLintItem } from "./staged-actions.js";
7
7
  export type { StagedActionLintItem } from "./staged-actions.js";
8
8
  import { type ResolutionKind, type TensionKind } from "./tension.js";
9
- export declare const LINT_CHECKS: readonly ["staleFiles", "orphanFiles", "oldDrafts", "stagnantLowConfidence", "retiredStillLinked", "unansweredQuestions", "tierDemotions", "brokenSourceRefs", "lifecycleConflicts", "schemaInvalid", "domainLeaks", "validityConflicts", "positionIntegrity", "malformedPins", "verbatimQuoteOverrun", "unverifiableSourceRefs"];
9
+ export declare const LINT_CHECKS: readonly ["staleFiles", "orphanFiles", "oldDrafts", "stagnantLowConfidence", "retiredStillLinked", "unansweredQuestions", "tierDemotions", "brokenSourceRefs", "lifecycleConflicts", "schemaInvalid", "domainLeaks", "validityConflicts", "positionIntegrity", "malformedPins", "verbatimQuoteOverrun", "unverifiableSourceRefs", "supersedeChains", "danglingAmends"];
10
10
  export type LintCheckName = (typeof LINT_CHECKS)[number];
11
11
  export interface LintFinding {
12
12
  path: string;
@@ -42,6 +42,10 @@ export interface TensionHealth {
42
42
  clusters: TensionClustersHealth;
43
43
  blastRadiusOfStaleTensions: number;
44
44
  }
45
+ export interface OrphanSummary {
46
+ noInboundLink: number;
47
+ nothingRefers: number;
48
+ }
45
49
  export interface LintReport {
46
50
  generatedAt: string;
47
51
  checks: Record<LintCheckName, LintFinding[]>;
@@ -51,6 +55,7 @@ export interface LintReport {
51
55
  shadowActions: ShadowLintSummary;
52
56
  coverageEquity: CoverageEquitySummary;
53
57
  compiledEdgeCoverage: CompiledEdgeCoverageSummary;
58
+ orphanSummary: OrphanSummary;
54
59
  reviewThroughput: ReviewThroughputSummary;
55
60
  }
56
61
  export interface LintOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/curation/lint.ts"],"names":[],"mappings":"AASA,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,qBAAqB,EAAyB,MAAM,eAAe,CAAC;AAWlF,OAAO,EAAE,KAAK,uBAAuB,EAA2B,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAqB,KAAK,iBAAiB,EAAuB,MAAM,aAAa,CAAC;AAE7F,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,OAAO,EAIL,KAAK,cAAc,EAGnB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;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-8,6 +8,7 @@
8
8
  // advisory judgments, but the posture is the same: report only.
9
9
  import { ok } from "../frontmatter/types.js";
10
10
  import { DISTILL_NUMERIC_DEFAULTS, loadConfig } from "../utils/config.js";
11
+ import { canonicalRel } from "../utils/paths.js";
11
12
  import { compiledEdgeCoverageSummary, listConsumesEdges, } from "./consumes.js";
12
13
  import { coverageEquitySummary } from "./coverage.js";
13
14
  import { DRAFT_MAX_DAYS, LOW_CONFIDENCE_MAX_DAYS } from "./decay.js";
@@ -16,16 +17,17 @@ import { chainEnd, isContested, uncoveredConflictPairs, unsuperseded, } from "./
16
17
  import { readProvenanceLog } from "./provenance.js";
17
18
  import { reviewThroughputSummary } from "./review-throughput.js";
18
19
  import { listShadowActions, shadowLintSummaryOf } from "./shadow.js";
19
- import { unverifiableSourceFindings } from "./source-refs.js";
20
+ import { backtickedVaultPaths, outgoingEdges, unverifiableSourceFindings } from "./source-refs.js";
20
21
  import { listStagedActions, pendingLintItems, } from "./staged-actions.js";
22
+ import { supersedeChainFindings } from "./supersede-chains.js";
21
23
  import { parseDescribesEntry } from "../audit/describes.js";
22
- import { ageInDays, computeStaleness } from "./staleness.js";
24
+ import { ageInDays, computeStaleness, olderSeriesMembers } from "./staleness.js";
23
25
  import { agingTier, listTensions, RESOLUTION_KINDS, STALE_TIER_LINT_COPY, TENSION_KINDS, } from "./tension.js";
24
26
  import { buildReverseLinkMap, buildReverseSourceMap, computeBlast } from "./tension-blast.js";
25
27
  import { computeTensionClusters } from "./tension-clusters.js";
26
28
  import { tier0Findings } from "./tier0.js";
27
29
  import { validityConflicts } from "./validity.js";
28
- import { buildPathIndexes, extractLinks, loadDocuments, resolveLink, } from "./vault-docs.js";
30
+ import { buildPathIndexes, loadDocuments } from "./vault-docs.js";
29
31
  export const LINT_CHECKS = [
30
32
  "staleFiles",
31
33
  "orphanFiles",
@@ -45,6 +47,8 @@ export const LINT_CHECKS = [
45
47
  "malformedPins",
46
48
  "verbatimQuoteOverrun",
47
49
  "unverifiableSourceRefs",
50
+ "supersedeChains",
51
+ "danglingAmends",
48
52
  ];
49
53
  // The tier-0 checks (#232) are certain structural failures rather than advisory
50
54
  // judgments — they lead the content-channel summary and its top-findings list.
@@ -57,8 +61,8 @@ export const TIER0_LINT_CHECKS = [
57
61
  "domainLeaks",
58
62
  ];
59
63
  // Content-channel budget (Decision 3): the compact `content` summary shows counts
60
- // plus a capped handful of findings, one line each; the full report still rides
61
- // the structured channel. Both the plain and ledger-keeper renderers honor these.
64
+ // plus a capped handful of findings, one line each. Both the plain and
65
+ // ledger-keeper renderers honor these; lint-page.ts bounds the structured channel.
62
66
  export const LINT_SUMMARY_TOP_FINDINGS = 6;
63
67
  export const LINT_SUMMARY_DETAIL_CHARS = 110;
64
68
  // Collapses whitespace and truncates to `max` chars with an ellipsis. Shared by
@@ -99,21 +103,62 @@ function normalizeQuestion(q) {
99
103
  return q.trim().toLowerCase().replace(/\s+/g, " ");
100
104
  }
101
105
  // --- check orchestration --------------------------------------------------
102
- // Maps each document to the set of documents that link to it.
103
- function buildInboundMap(docs) {
104
- const { byPath, byBasename } = buildPathIndexes(docs);
105
- const inbound = new Map();
106
+ // Maps each document to the documents that refer to it: `cited` through any
107
+ // edge kind, `linked` through body links only (see outgoingEdges). `mentioned`
108
+ // holds backticked paths, which are never edges.
109
+ function buildInboundMaps(docs) {
110
+ const indexes = buildPathIndexes(docs);
111
+ const linked = new Map();
112
+ const cited = new Map();
113
+ const mentioned = new Map();
114
+ const add = (map, target, from) => {
115
+ if (!map.has(target))
116
+ map.set(target, new Set());
117
+ map.get(target).add(from);
118
+ };
106
119
  for (const d of docs) {
107
- for (const raw of extractLinks(d.content)) {
108
- const target = resolveLink(raw, d.path, byPath, byBasename);
109
- if (!target || target === d.path)
110
- continue;
111
- if (!inbound.has(target))
112
- inbound.set(target, new Set());
113
- inbound.get(target).add(d.path);
120
+ for (const { target, kind } of outgoingEdges(d.content, d.frontmatter.sources, d.path, indexes)) {
121
+ add(cited, target, d.path);
122
+ if (kind === "link")
123
+ add(linked, target, d.path);
124
+ }
125
+ for (const target of backtickedVaultPaths(d.content, indexes.byPath)) {
126
+ if (target !== d.path)
127
+ add(mentioned, target, d.path);
128
+ }
129
+ }
130
+ return { linked, cited, mentioned };
131
+ }
132
+ // How many backticked mentions an orphan finding names before summarizing.
133
+ const ORPHAN_MENTIONS_SHOWN = 3;
134
+ // #641: a backticked path is not an edge, but an orphan that other documents
135
+ // name that way is probably missing a reference, so the finding says so. Lint
136
+ // reports; converting the mention stays the curator's call.
137
+ function orphanDetail(mentionedBy) {
138
+ const base = "no inbound links or sources citations from any vault document";
139
+ if (!mentionedBy)
140
+ return base;
141
+ const sorted = [...mentionedBy].sort();
142
+ const shown = sorted.slice(0, ORPHAN_MENTIONS_SHOWN).join(", ");
143
+ const rest = sorted.length - ORPHAN_MENTIONS_SHOWN;
144
+ return (`${base}; named by backticked path in ${shown}${rest > 0 ? ` (+${rest} more)` : ""}, ` +
145
+ "which is not an edge: add a wikilink or a sources entry there");
146
+ }
147
+ // #643: `amends` entries that surface on nothing. Declared on the later doc, so
148
+ // a mistyped target never shows up on the document it meant to reach.
149
+ function danglingAmends(docs) {
150
+ const paths = new Set(docs.map((d) => d.path));
151
+ const findings = [];
152
+ for (const doc of docs) {
153
+ const broken = (doc.frontmatter.amends ?? []).filter((raw) => {
154
+ const target = canonicalRel(raw);
155
+ return target === doc.path || !paths.has(target);
156
+ });
157
+ if (broken.length > 0) {
158
+ findings.push({ path: doc.path, detail: `unresolvable amends: ${broken.join(", ")}` });
114
159
  }
115
160
  }
116
- return inbound;
161
+ return findings;
117
162
  }
118
163
  // Runs every lint check across the vault and returns a grouped report.
119
164
  export async function runLint(vaultRoot, opts = {}) {
@@ -128,7 +173,7 @@ export async function runLint(vaultRoot, opts = {}) {
128
173
  const draftMaxDays = opts.draftMaxDays ?? DRAFT_MAX_DAYS;
129
174
  const lowConfidenceMaxDays = opts.lowConfidenceMaxDays ?? LOW_CONFIDENCE_MAX_DAYS;
130
175
  const maxVerbatimChars = opts.maxVerbatimChars ?? DISTILL_NUMERIC_DEFAULTS.maxVerbatimChars;
131
- const inbound = buildInboundMap(docs);
176
+ const { linked, cited, mentioned } = buildInboundMaps(docs);
132
177
  const byPath = new Map(docs.map((d) => [d.path, d]));
133
178
  // The set of every question answered anywhere in the vault, normalized. A
134
179
  // question raised in one document counts as answered if any document — that
@@ -158,6 +203,8 @@ export async function runLint(vaultRoot, opts = {}) {
158
203
  malformedPins: [],
159
204
  verbatimQuoteOverrun: [],
160
205
  unverifiableSourceRefs: [],
206
+ supersedeChains: [],
207
+ danglingAmends: [],
161
208
  };
162
209
  // 12. Valid-time conflicts. The ONLY surface that reports a malformed or
163
210
  // contradictory interval: the schema layer deliberately declines to, because
@@ -181,6 +228,13 @@ export async function runLint(vaultRoot, opts = {}) {
181
228
  checks.lifecycleConflicts = t0.lifecycleConflicts;
182
229
  checks.schemaInvalid = t0.schemaInvalid;
183
230
  checks.domainLeaks = t0.domainLeaks;
231
+ // 15. superseded_by chains that loop, or end on a non-canonical document
232
+ // (#639). Over the caller-visible doc set, like the rest of lint.
233
+ checks.supersedeChains = supersedeChainFindings(docs);
234
+ // Over the caller-visible set too, so a hidden target reads as absent.
235
+ // Deliberately not a tier-0 check: amends is advisory, and tier-0 findings
236
+ // gate ratification.
237
+ checks.danglingAmends = danglingAmends(docs);
184
238
  // runLint historically remains useful against partially configured vaults;
185
239
  // server startup is the surface that rejects malformed config. Authorized
186
240
  // repo verification treats an unavailable root as unconfigured. Distill
@@ -211,10 +265,12 @@ export async function runLint(vaultRoot, opts = {}) {
211
265
  });
212
266
  positionalByDoc.set(t.sourceA, refs);
213
267
  }
268
+ const olderMembers = olderSeriesMembers(docs);
214
269
  for (const doc of docs) {
215
270
  const fm = doc.frontmatter;
216
- // 1. Stale: a document at or past its TTL.
217
- const staleness = computeStaleness({ updated: fm.updated, ttl_days: fm.ttl_days }, now);
271
+ // 1. Stale: a document at or past its TTL. An older series member's TTL
272
+ // has passed to the newest member (#645).
273
+ const staleness = computeStaleness({ updated: fm.updated, ttl_days: olderMembers.has(doc.path) ? null : fm.ttl_days }, now);
218
274
  if (staleness.expired) {
219
275
  checks.staleFiles.push({
220
276
  path: doc.path,
@@ -222,11 +278,11 @@ export async function runLint(vaultRoot, opts = {}) {
222
278
  `(decay score ${staleness.score.toFixed(2)})`,
223
279
  });
224
280
  }
225
- // 2. Orphan: no other document links to it.
226
- if (!inbound.has(doc.path)) {
281
+ // 2. Orphan: no other document links to it or cites it in `sources`.
282
+ if (!cited.has(doc.path)) {
227
283
  checks.orphanFiles.push({
228
284
  path: doc.path,
229
- detail: "no inbound links from any vault document",
285
+ detail: orphanDetail(mentioned.get(doc.path)),
230
286
  });
231
287
  }
232
288
  // 3. Old draft: still a draft well past the draft age limit.
@@ -252,7 +308,7 @@ export async function runLint(vaultRoot, opts = {}) {
252
308
  }
253
309
  // 5. Retired (deprecated or superseded) but still linked from a canonical document.
254
310
  if (fm.status === "deprecated" || fm.status === "superseded") {
255
- const linkers = [...(inbound.get(doc.path) ?? [])].filter((from) => byPath.get(from)?.frontmatter.status === "canonical");
311
+ const linkers = [...(linked.get(doc.path) ?? [])].filter((from) => byPath.get(from)?.frontmatter.status === "canonical");
256
312
  if (linkers.length > 0) {
257
313
  checks.retiredStillLinked.push({
258
314
  path: doc.path,
@@ -496,6 +552,10 @@ export async function runLint(vaultRoot, opts = {}) {
496
552
  shadowActions,
497
553
  coverageEquity: coverageEquityRes.value,
498
554
  compiledEdgeCoverage: compiledEdgeCoverageSummary(docs.map((doc) => doc.path), consumesRes.value),
555
+ orphanSummary: {
556
+ noInboundLink: docs.filter((d) => !linked.has(d.path)).length,
557
+ nothingRefers: checks.orphanFiles.filter((f) => !mentioned.has(f.path)).length,
558
+ },
499
559
  reviewThroughput: reviewThroughputSummary(stagedRes.value, now),
500
560
  });
501
561
  }