@hawkeyexl/manni 4.4.0 → 4.5.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 (169) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-DFRCLY77.js → batch-GOE3UXOD.js} +11 -11
  3. package/dist/{build-Q5C6SX5J.js → build-M7BMEHL2.js} +13 -11
  4. package/dist/{calibrate-XQILKXS3.js → calibrate-6RRAILUY.js} +12 -12
  5. package/dist/{capture-JQMOC3BW.js → capture-RJPQ6B4N.js} +12 -12
  6. package/dist/{check-NFZQLJKN.js → check-BQD64X3N.js} +11 -11
  7. package/dist/{check-HYNGXYJV.js → check-ESNS7ZBC.js} +4 -4
  8. package/dist/{check-U54XV6BP.js → check-RQIIIURI.js} +12 -12
  9. package/dist/{chunk-7QMCHA4N.js → chunk-3R5Y3XOL.js} +3 -3
  10. package/dist/{chunk-K3D6FPV6.js → chunk-3YHAYXBC.js} +2 -2
  11. package/dist/{chunk-JVTNMVYU.js → chunk-527HHQPS.js} +4 -4
  12. package/dist/{chunk-JVTNMVYU.js.map → chunk-527HHQPS.js.map} +1 -1
  13. package/dist/{chunk-6OYEI2VV.js → chunk-52PDIZKV.js} +3 -3
  14. package/dist/{chunk-UZC7LDAQ.js → chunk-6XTQDFGP.js} +2 -2
  15. package/dist/{chunk-UZC7LDAQ.js.map → chunk-6XTQDFGP.js.map} +1 -1
  16. package/dist/{chunk-NWZ2SLYL.js → chunk-7OQAU4EA.js} +5 -5
  17. package/dist/{chunk-5YXBLLAC.js → chunk-7ZUCEMCY.js} +8 -8
  18. package/dist/{chunk-M2JCK5F6.js → chunk-B7XUEQF3.js} +13 -2
  19. package/dist/chunk-B7XUEQF3.js.map +1 -0
  20. package/dist/{chunk-MYMBCTDE.js → chunk-BOIF2XGG.js} +2 -2
  21. package/dist/{chunk-H6FZ66XR.js → chunk-C3KI45RF.js} +8 -6
  22. package/dist/{chunk-H6FZ66XR.js.map → chunk-C3KI45RF.js.map} +1 -1
  23. package/dist/{chunk-3AFUD75K.js → chunk-C6HZ6C5T.js} +2 -2
  24. package/dist/{chunk-XYLUCIKQ.js → chunk-CP4ZM43V.js} +2 -2
  25. package/dist/chunk-DE7JSWXV.js +2462 -0
  26. package/dist/chunk-DE7JSWXV.js.map +1 -0
  27. package/dist/{chunk-YTCZRLTU.js → chunk-DX32P2DT.js} +2 -2
  28. package/dist/{chunk-644JVKJ4.js → chunk-EL2BZTDL.js} +137 -50
  29. package/dist/chunk-EL2BZTDL.js.map +1 -0
  30. package/dist/{chunk-JOHKIAVH.js → chunk-ELZ2IIOF.js} +332 -2522
  31. package/dist/chunk-ELZ2IIOF.js.map +1 -0
  32. package/dist/{chunk-OBFENF3U.js → chunk-F2OVHJNC.js} +10 -10
  33. package/dist/{chunk-5KHIFVD2.js → chunk-FLF6AECQ.js} +7 -7
  34. package/dist/{chunk-77HX34KD.js → chunk-GAZFKZHM.js} +4 -4
  35. package/dist/{chunk-KCGV52AM.js → chunk-HQFVJDEN.js} +7 -7
  36. package/dist/{chunk-RLR4TKUZ.js → chunk-HVFR66GQ.js} +2 -2
  37. package/dist/{chunk-2U3ORT6D.js → chunk-IA7BMIPE.js} +2 -2
  38. package/dist/{chunk-LAKAWRV5.js → chunk-JQU7FHYH.js} +6 -6
  39. package/dist/{chunk-YIL4XLLJ.js → chunk-K3U5F2QT.js} +183 -31
  40. package/dist/chunk-K3U5F2QT.js.map +1 -0
  41. package/dist/{chunk-X3BPBDGQ.js → chunk-MZC62HPZ.js} +2 -2
  42. package/dist/{chunk-V46OILVC.js → chunk-NAZRLJAK.js} +3 -3
  43. package/dist/{chunk-BUXDLRDT.js → chunk-NGK3N6F2.js} +3 -3
  44. package/dist/{chunk-WQE54PNH.js → chunk-NN4ASVTY.js} +3 -3
  45. package/dist/{chunk-PCHZY2I7.js → chunk-OIZ3XMKB.js} +13 -11
  46. package/dist/chunk-OIZ3XMKB.js.map +1 -0
  47. package/dist/{chunk-CYWHFSRT.js → chunk-QCBICNKC.js} +6 -6
  48. package/dist/chunk-QCBICNKC.js.map +1 -0
  49. package/dist/{chunk-YFQBFNQS.js → chunk-QLUMKWQQ.js} +3 -3
  50. package/dist/{chunk-YYBFZLAJ.js → chunk-QY3DOZMS.js} +4 -4
  51. package/dist/{chunk-IEQHSCZG.js → chunk-SJO2FTPG.js} +6 -6
  52. package/dist/{chunk-ERMSO34F.js → chunk-SNEHX4VE.js} +2 -2
  53. package/dist/{chunk-252LNOEG.js → chunk-TA42STP7.js} +4 -4
  54. package/dist/{chunk-CK7SKVHR.js → chunk-TBAMBLF3.js} +3 -12
  55. package/dist/chunk-TBAMBLF3.js.map +1 -0
  56. package/dist/{chunk-C6OH6CNF.js → chunk-TCC737IS.js} +3 -3
  57. package/dist/{chunk-H2DLH2JI.js → chunk-TVIX653Q.js} +3 -3
  58. package/dist/{chunk-G7NJSREW.js → chunk-UK2I3ACY.js} +3 -3
  59. package/dist/{chunk-XSLV76YK.js → chunk-XWFNO5PO.js} +3 -3
  60. package/dist/{chunk-PHF3D7ER.js → chunk-YA63PVWI.js} +5 -5
  61. package/dist/chunk-YGFIQ6Y5.js +17 -0
  62. package/dist/chunk-YGFIQ6Y5.js.map +1 -0
  63. package/dist/{chunk-MYC3O5EJ.js → chunk-ZX43SRZR.js} +3 -3
  64. package/dist/{cli-URZQXL4K.js → cli-6PGVHP7Y.js} +15 -15
  65. package/dist/{cli-2QPR2OZG.js → cli-AAG3N4NB.js} +16 -16
  66. package/dist/{cli-4IOPGZHR.js → cli-E3H6ZP4I.js} +2 -2
  67. package/dist/{cli-OFPZ5MAS.js → cli-HUIMNJT6.js} +20 -15
  68. package/dist/cli-HUIMNJT6.js.map +1 -0
  69. package/dist/{cli-LJLLIQB2.js → cli-MHTYPVOD.js} +16 -16
  70. package/dist/{cli-5FL73WHA.js → cli-PRZHQ3QB.js} +15 -13
  71. package/dist/{cli-5FL73WHA.js.map → cli-PRZHQ3QB.js.map} +1 -1
  72. package/dist/{cli-SRHFUZHA.js → cli-QKIJOXGW.js} +13 -13
  73. package/dist/{cli-C262QOWM.js → cli-TYGOHJOJ.js} +25 -25
  74. package/dist/{cli-SHSMSRQY.js → cli-YW6VWBHX.js} +9 -9
  75. package/dist/cli.js +11 -11
  76. package/dist/docmeta.js +8 -8
  77. package/dist/{github-QXL3VMK2.js → github-3WMSTNTK.js} +13 -13
  78. package/dist/{github-FE6KCNYJ.js → github-OXSJQ4PS.js} +11 -11
  79. package/dist/index.d.ts +30 -8
  80. package/dist/index.js +42 -38
  81. package/dist/index.js.map +1 -1
  82. package/dist/{json-SGZ6ZRFD.js → json-4DCKDGUV.js} +11 -11
  83. package/dist/lint-YDHVVZHT.js +30 -0
  84. package/dist/{list-7BKNYPSB.js → list-3ZO2NIYO.js} +11 -11
  85. package/dist/{list-6BAXTZUM.js → list-EJH6VAOW.js} +11 -11
  86. package/dist/{page-3U2GCFNE.js → page-QEDB7EVU.js} +10 -10
  87. package/dist/{pretty-N6DO4OOL.js → pretty-5DGEBZSV.js} +11 -11
  88. package/dist/{pretty-2H57QVTY.js → pretty-SQX33UM2.js} +12 -12
  89. package/dist/{reporters-N6GHXSS7.js → reporters-OHSI3RMV.js} +12 -11
  90. package/dist/{reporters-UCNEV7PH.js → reporters-YELDDYJD.js} +4 -4
  91. package/dist/{run-XZDAREJE.js → run-IP6NZHAG.js} +11 -11
  92. package/dist/{term-5ICGKPC3.js → term-2WMDZ4PY.js} +15 -15
  93. package/dist/{validate-GQRM77YN.js → validate-G6HH3YXL.js} +5 -5
  94. package/package.json +1 -1
  95. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  96. package/plugin/manni/hooks/hooks.json +21 -4
  97. package/plugin/manni/hooks/manni.mjs +157 -0
  98. package/plugin/manni/skills/check/SKILL.md +3 -3
  99. package/plugin/manni/skills/evals/SKILL.md +2 -2
  100. package/plugin/manni/skills/fix/SKILL.md +3 -3
  101. package/plugin/manni/skills/setup/SKILL.md +3 -3
  102. package/dist/chunk-644JVKJ4.js.map +0 -1
  103. package/dist/chunk-CK7SKVHR.js.map +0 -1
  104. package/dist/chunk-CYWHFSRT.js.map +0 -1
  105. package/dist/chunk-JOHKIAVH.js.map +0 -1
  106. package/dist/chunk-M2JCK5F6.js.map +0 -1
  107. package/dist/chunk-PCHZY2I7.js.map +0 -1
  108. package/dist/chunk-YIL4XLLJ.js.map +0 -1
  109. package/dist/cli-OFPZ5MAS.js.map +0 -1
  110. package/dist/lint-DL4LJRAY.js +0 -28
  111. /package/dist/{batch-DFRCLY77.js.map → batch-GOE3UXOD.js.map} +0 -0
  112. /package/dist/{build-Q5C6SX5J.js.map → build-M7BMEHL2.js.map} +0 -0
  113. /package/dist/{calibrate-XQILKXS3.js.map → calibrate-6RRAILUY.js.map} +0 -0
  114. /package/dist/{capture-JQMOC3BW.js.map → capture-RJPQ6B4N.js.map} +0 -0
  115. /package/dist/{check-HYNGXYJV.js.map → check-BQD64X3N.js.map} +0 -0
  116. /package/dist/{check-NFZQLJKN.js.map → check-ESNS7ZBC.js.map} +0 -0
  117. /package/dist/{check-U54XV6BP.js.map → check-RQIIIURI.js.map} +0 -0
  118. /package/dist/{chunk-7QMCHA4N.js.map → chunk-3R5Y3XOL.js.map} +0 -0
  119. /package/dist/{chunk-K3D6FPV6.js.map → chunk-3YHAYXBC.js.map} +0 -0
  120. /package/dist/{chunk-6OYEI2VV.js.map → chunk-52PDIZKV.js.map} +0 -0
  121. /package/dist/{chunk-NWZ2SLYL.js.map → chunk-7OQAU4EA.js.map} +0 -0
  122. /package/dist/{chunk-5YXBLLAC.js.map → chunk-7ZUCEMCY.js.map} +0 -0
  123. /package/dist/{chunk-MYMBCTDE.js.map → chunk-BOIF2XGG.js.map} +0 -0
  124. /package/dist/{chunk-3AFUD75K.js.map → chunk-C6HZ6C5T.js.map} +0 -0
  125. /package/dist/{chunk-XYLUCIKQ.js.map → chunk-CP4ZM43V.js.map} +0 -0
  126. /package/dist/{chunk-YTCZRLTU.js.map → chunk-DX32P2DT.js.map} +0 -0
  127. /package/dist/{chunk-OBFENF3U.js.map → chunk-F2OVHJNC.js.map} +0 -0
  128. /package/dist/{chunk-5KHIFVD2.js.map → chunk-FLF6AECQ.js.map} +0 -0
  129. /package/dist/{chunk-77HX34KD.js.map → chunk-GAZFKZHM.js.map} +0 -0
  130. /package/dist/{chunk-KCGV52AM.js.map → chunk-HQFVJDEN.js.map} +0 -0
  131. /package/dist/{chunk-RLR4TKUZ.js.map → chunk-HVFR66GQ.js.map} +0 -0
  132. /package/dist/{chunk-2U3ORT6D.js.map → chunk-IA7BMIPE.js.map} +0 -0
  133. /package/dist/{chunk-LAKAWRV5.js.map → chunk-JQU7FHYH.js.map} +0 -0
  134. /package/dist/{chunk-X3BPBDGQ.js.map → chunk-MZC62HPZ.js.map} +0 -0
  135. /package/dist/{chunk-V46OILVC.js.map → chunk-NAZRLJAK.js.map} +0 -0
  136. /package/dist/{chunk-BUXDLRDT.js.map → chunk-NGK3N6F2.js.map} +0 -0
  137. /package/dist/{chunk-WQE54PNH.js.map → chunk-NN4ASVTY.js.map} +0 -0
  138. /package/dist/{chunk-YFQBFNQS.js.map → chunk-QLUMKWQQ.js.map} +0 -0
  139. /package/dist/{chunk-YYBFZLAJ.js.map → chunk-QY3DOZMS.js.map} +0 -0
  140. /package/dist/{chunk-IEQHSCZG.js.map → chunk-SJO2FTPG.js.map} +0 -0
  141. /package/dist/{chunk-ERMSO34F.js.map → chunk-SNEHX4VE.js.map} +0 -0
  142. /package/dist/{chunk-252LNOEG.js.map → chunk-TA42STP7.js.map} +0 -0
  143. /package/dist/{chunk-C6OH6CNF.js.map → chunk-TCC737IS.js.map} +0 -0
  144. /package/dist/{chunk-H2DLH2JI.js.map → chunk-TVIX653Q.js.map} +0 -0
  145. /package/dist/{chunk-G7NJSREW.js.map → chunk-UK2I3ACY.js.map} +0 -0
  146. /package/dist/{chunk-XSLV76YK.js.map → chunk-XWFNO5PO.js.map} +0 -0
  147. /package/dist/{chunk-PHF3D7ER.js.map → chunk-YA63PVWI.js.map} +0 -0
  148. /package/dist/{chunk-MYC3O5EJ.js.map → chunk-ZX43SRZR.js.map} +0 -0
  149. /package/dist/{cli-URZQXL4K.js.map → cli-6PGVHP7Y.js.map} +0 -0
  150. /package/dist/{cli-2QPR2OZG.js.map → cli-AAG3N4NB.js.map} +0 -0
  151. /package/dist/{cli-4IOPGZHR.js.map → cli-E3H6ZP4I.js.map} +0 -0
  152. /package/dist/{cli-LJLLIQB2.js.map → cli-MHTYPVOD.js.map} +0 -0
  153. /package/dist/{cli-SRHFUZHA.js.map → cli-QKIJOXGW.js.map} +0 -0
  154. /package/dist/{cli-C262QOWM.js.map → cli-TYGOHJOJ.js.map} +0 -0
  155. /package/dist/{cli-SHSMSRQY.js.map → cli-YW6VWBHX.js.map} +0 -0
  156. /package/dist/{github-FE6KCNYJ.js.map → github-3WMSTNTK.js.map} +0 -0
  157. /package/dist/{github-QXL3VMK2.js.map → github-OXSJQ4PS.js.map} +0 -0
  158. /package/dist/{json-SGZ6ZRFD.js.map → json-4DCKDGUV.js.map} +0 -0
  159. /package/dist/{lint-DL4LJRAY.js.map → lint-YDHVVZHT.js.map} +0 -0
  160. /package/dist/{list-6BAXTZUM.js.map → list-3ZO2NIYO.js.map} +0 -0
  161. /package/dist/{list-7BKNYPSB.js.map → list-EJH6VAOW.js.map} +0 -0
  162. /package/dist/{page-3U2GCFNE.js.map → page-QEDB7EVU.js.map} +0 -0
  163. /package/dist/{pretty-2H57QVTY.js.map → pretty-5DGEBZSV.js.map} +0 -0
  164. /package/dist/{pretty-N6DO4OOL.js.map → pretty-SQX33UM2.js.map} +0 -0
  165. /package/dist/{reporters-N6GHXSS7.js.map → reporters-OHSI3RMV.js.map} +0 -0
  166. /package/dist/{reporters-UCNEV7PH.js.map → reporters-YELDDYJD.js.map} +0 -0
  167. /package/dist/{run-XZDAREJE.js.map → run-IP6NZHAG.js.map} +0 -0
  168. /package/dist/{term-5ICGKPC3.js.map → term-2WMDZ4PY.js.map} +0 -0
  169. /package/dist/{validate-GQRM77YN.js.map → validate-G6HH3YXL.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  resolvePages,
9
9
  runConfigOptions,
10
10
  withExternalMetadata
11
- } from "./chunk-NWZ2SLYL.js";
11
+ } from "./chunk-7OQAU4EA.js";
12
12
  import {
13
13
  SUMMARY_FORMATS,
14
14
  parseFormat
@@ -93,4 +93,4 @@ export {
93
93
  runList,
94
94
  renderList
95
95
  };
96
- //# sourceMappingURL=chunk-YTCZRLTU.js.map
96
+ //# sourceMappingURL=chunk-DX32P2DT.js.map
@@ -10,18 +10,21 @@ import {
10
10
  documentBase,
11
11
  documentSetPatterns,
12
12
  emitLocalizations,
13
+ extractorFor,
13
14
  formatOf,
14
15
  isLanguageTag,
15
16
  isSafeRelativePath,
16
17
  mergePage,
18
+ metadataOf,
19
+ mintTreeSections,
17
20
  openMetaView,
18
- ownMetadata,
19
21
  parseLocalizations,
22
+ parseTree,
20
23
  resolveDocumentSet,
21
24
  routesFrom,
22
25
  searchIndexFilename,
23
26
  vectorIndexFilename
24
- } from "./chunk-YIL4XLLJ.js";
27
+ } from "./chunk-K3U5F2QT.js";
25
28
  import {
26
29
  bundledShapesPath,
27
30
  compactIri,
@@ -29,7 +32,7 @@ import {
29
32
  loadGraph,
30
33
  storeToQuads,
31
34
  validateGraph
32
- } from "./chunk-MYMBCTDE.js";
35
+ } from "./chunk-BOIF2XGG.js";
33
36
  import {
34
37
  COVERAGE_FIELDS,
35
38
  DEFAULT_MODEL,
@@ -69,18 +72,19 @@ import {
69
72
  loadRunConfig,
70
73
  profileFor,
71
74
  withPrefix
72
- } from "./chunk-M2JCK5F6.js";
75
+ } from "./chunk-B7XUEQF3.js";
73
76
  import {
74
77
  mergeMetaProvenance
75
- } from "./chunk-K3D6FPV6.js";
78
+ } from "./chunk-3YHAYXBC.js";
76
79
  import {
77
80
  isMissing,
78
81
  spliceManifestValue
79
- } from "./chunk-RLR4TKUZ.js";
82
+ } from "./chunk-HVFR66GQ.js";
80
83
  import {
84
+ DocmetaError,
81
85
  urlManifestMessage,
82
86
  writeFileAtomic
83
- } from "./chunk-JVTNMVYU.js";
87
+ } from "./chunk-527HHQPS.js";
84
88
  import {
85
89
  assertKnownProvider,
86
90
  assertLocalFlag,
@@ -253,7 +257,7 @@ function emitRdfXml(quads, prefixes) {
253
257
 
254
258
  // src/graph/core/iirds-package.ts
255
259
  import { existsSync } from "node:fs";
256
- import { resolve } from "node:path";
260
+ import { extname, resolve } from "node:path";
257
261
  import { DataFactory } from "n3";
258
262
 
259
263
  // src/graph/core/zip.ts
@@ -330,6 +334,19 @@ function writeZip(entries) {
330
334
  // src/graph/core/iirds-package.ts
331
335
  var GRAPH_DOCUMENT = `${NS.graph}Document`;
332
336
  var XSD_STRING3 = `${NS.xsd}string`;
337
+ var MEDIA_TYPES = {
338
+ ".html": "text/html",
339
+ ".htm": "text/html",
340
+ ".adoc": "text/asciidoc",
341
+ ".asciidoc": "text/asciidoc",
342
+ ".rst": "text/x-rst",
343
+ ".dita": "application/dita+xml",
344
+ ".ditamap": "application/dita+xml",
345
+ ".xml": "application/xml"
346
+ };
347
+ function mediaTypeOf(path2) {
348
+ return MEDIA_TYPES[extname(path2).toLowerCase()] ?? "text/markdown";
349
+ }
333
350
  var CARRIED = [
334
351
  IIRDS_HAS_TOPIC_TYPE,
335
352
  IIRDS_HAS_SUBJECT,
@@ -390,7 +407,7 @@ function projectPackage(store, opts, cwd) {
390
407
  add(doc, IIRDS_HAS_RENDITION, iri(rendition));
391
408
  add(rendition, RDF_TYPE, iri(IIRDS_RENDITION));
392
409
  add(rendition, IIRDS_SOURCE, lit(zipPath));
393
- add(rendition, IIRDS_FORMAT, lit("text/markdown"));
410
+ add(rendition, IIRDS_FORMAT, lit(mediaTypeOf(path2)));
394
411
  contentFiles.push({ zipPath, absPath });
395
412
  } else {
396
413
  warnings.push(
@@ -720,6 +737,21 @@ var FRONTMATTER = /^---[ \t]*\r?\n(?:[\s\S]*?\r?\n)?(?:---|\.\.\.)[ \t]*(?:\r?\n
720
737
  function stripFrontmatter(markdown) {
721
738
  return markdown.replace(FRONTMATTER, "");
722
739
  }
740
+ function plainText(nodes) {
741
+ return nodes.map((n) => n.text.replace(/\r\n/g, "\n").trim()).filter((t) => t !== "");
742
+ }
743
+ function treeText(source, path2) {
744
+ const format = formatOf(path2);
745
+ if (format === "markdown" || format === "mdx") return void 0;
746
+ const minted = mintTreeSections(parseTree(source, path2, format).sections);
747
+ const sections = /* @__PURE__ */ new Map();
748
+ for (const [n, section] of minted.sections.entries()) {
749
+ const own = plainText(minted.owned[n] ?? []);
750
+ sections.set(section.slug, [section.title, ...own].join("\n\n"));
751
+ }
752
+ const lead = plainText(minted.unowned);
753
+ return { doc: lead.length > 0 ? lead.join("\n\n") : void 0, sections };
754
+ }
723
755
  function entry(id, type, fields) {
724
756
  const out = { id, type };
725
757
  if (fields.title !== void 0) out.title = fields.title;
@@ -736,6 +768,7 @@ function buildSearchIndex(graph, cwd, options = {}) {
736
768
  });
737
769
  const entries = [];
738
770
  const sourceOf = /* @__PURE__ */ new Map();
771
+ const treeTextOf = /* @__PURE__ */ new Map();
739
772
  const allSections = graph.instancesOf(GRAPH_SECTION);
740
773
  const sectionsOf = /* @__PURE__ */ new Map();
741
774
  for (const section of allSections) {
@@ -755,8 +788,10 @@ function buildSearchIndex(graph, cwd, options = {}) {
755
788
  `Source not found for ${path2} \u2014 indexed without body text.`
756
789
  );
757
790
  }
791
+ const tree = source === void 0 || path2 === void 0 ? void 0 : treeText(source, path2);
792
+ if (tree) treeTextOf.set(doc, tree);
758
793
  const body = source === void 0 ? void 0 : stripFrontmatter(source).replace(/\r\n/g, "\n");
759
- const text = body === void 0 ? void 0 : (sectionsOf.get(doc)?.length ?? 0) > 0 ? documentPreamble(body) : body;
794
+ const text = tree ? tree.doc : body === void 0 ? void 0 : (sectionsOf.get(doc)?.length ?? 0) > 0 ? documentPreamble(body) : body;
760
795
  entries.push(
761
796
  entry(doc, compactIri(GRAPH_DOCUMENT2), {
762
797
  title: graph.literal(doc, DCTERMS_TITLE2),
@@ -779,7 +814,8 @@ function buildSearchIndex(graph, cwd, options = {}) {
779
814
  occurrences = sectionOccurrences(graph, doc);
780
815
  occurrencesOf.set(doc, occurrences);
781
816
  }
782
- const text = source !== void 0 && title !== void 0 ? sectionOwnText(source, title, level, occurrences.get(section) ?? 0) : void 0;
817
+ const tree = treeTextOf.get(doc);
818
+ const text = tree ? tree.sections.get(section.slice(hash + 1)) : source !== void 0 && title !== void 0 ? sectionOwnText(source, title, level, occurrences.get(section) ?? 0) : void 0;
783
819
  entries.push(entry(section, compactIri(GRAPH_SECTION), { title, text }));
784
820
  }
785
821
  for (const concept of graph.instancesOf(SKOS_CONCEPT)) {
@@ -1243,6 +1279,7 @@ import { resolve as resolve6 } from "node:path";
1243
1279
 
1244
1280
  // src/graph/core/frontmatter-edit.ts
1245
1281
  import { Document, YAMLMap, YAMLSeq, isMap, parseDocument } from "yaml";
1282
+ var GRAPH_KEY = "graph";
1246
1283
  function frontmatterKind(content) {
1247
1284
  const body = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
1248
1285
  if (/^---(\r?\n)/.test(body)) return "yaml";
@@ -1286,9 +1323,7 @@ function setField(doc, map, field, value) {
1286
1323
  map.set(field, node);
1287
1324
  }
1288
1325
  function applyGraphFields(content, path2, values, options = {}) {
1289
- const entries = Object.entries(values).filter(
1290
- ([, v]) => v !== void 0 && v !== null && !(Array.isArray(v) && v.length === 0)
1291
- );
1326
+ const entries = writable(values);
1292
1327
  const pageEntries = Object.entries(options.page ?? {});
1293
1328
  if (entries.length === 0 && pageEntries.length === 0) {
1294
1329
  return { content, applied: [], skipped: [] };
@@ -1340,6 +1375,23 @@ function applyGraphFields(content, path2, values, options = {}) {
1340
1375
  doc.set("graph", graph);
1341
1376
  }
1342
1377
  const graphMap = graph ?? doc.createNode({});
1378
+ const { applied, skipped } = mergeFields(doc, graphMap, entries, options.force);
1379
+ for (const [key, value] of pageEntries) {
1380
+ doc.set(key, doc.createNode(value));
1381
+ }
1382
+ if (applied.length === 0 && pageEntries.length === 0) {
1383
+ return { content, applied, skipped };
1384
+ }
1385
+ let newBlock = doc.toString();
1386
+ if (split.eol === "\r\n") newBlock = newBlock.replace(/(?<!\r)\n/g, "\r\n");
1387
+ return { content: split.open + newBlock + split.suffix, applied, skipped };
1388
+ }
1389
+ function writable(values) {
1390
+ return Object.entries(values).filter(
1391
+ ([, v]) => v !== void 0 && v !== null && !(Array.isArray(v) && v.length === 0)
1392
+ );
1393
+ }
1394
+ function mergeFields(doc, graphMap, entries, force) {
1343
1395
  const applied = [];
1344
1396
  const skipped = [];
1345
1397
  for (const [field, value] of entries) {
@@ -1364,22 +1416,45 @@ function applyGraphFields(content, path2, values, options = {}) {
1364
1416
  skipped.push(field);
1365
1417
  continue;
1366
1418
  }
1367
- if (target.has(leaf) && !options.force) {
1419
+ if (target.has(leaf) && !force) {
1368
1420
  skipped.push(field);
1369
1421
  continue;
1370
1422
  }
1371
1423
  setField(doc, target, leaf, value);
1372
1424
  applied.push(field);
1373
1425
  }
1374
- for (const [key, value] of pageEntries) {
1375
- doc.set(key, doc.createNode(value));
1426
+ return { applied, skipped };
1427
+ }
1428
+ function writeGraphFields(content, path2, format, values, options = {}) {
1429
+ if (format === "markdown" || format === "mdx") {
1430
+ return applyGraphFields(content, path2, values, options);
1376
1431
  }
1377
- if (applied.length === 0 && pageEntries.length === 0) {
1378
- return { content, applied, skipped };
1432
+ const entries = writable(values);
1433
+ const patch = {};
1434
+ let applied = [];
1435
+ let skipped = [];
1436
+ if (entries.length > 0) {
1437
+ const doc = new Document(
1438
+ metadataOf(content, path2, format).data[GRAPH_KEY] ?? {}
1439
+ );
1440
+ if (!isMap(doc.contents)) {
1441
+ throw new GraphError(`${path2}: metadata key "graph" is not a map`);
1442
+ }
1443
+ ({ applied, skipped } = mergeFields(
1444
+ doc,
1445
+ doc.contents,
1446
+ entries,
1447
+ options.force
1448
+ ));
1449
+ if (applied.length > 0) patch[GRAPH_KEY] = doc.toJS();
1379
1450
  }
1380
- let newBlock = doc.toString();
1381
- if (split.eol === "\r\n") newBlock = newBlock.replace(/(?<!\r)\n/g, "\r\n");
1382
- return { content: split.open + newBlock + split.suffix, applied, skipped };
1451
+ Object.assign(patch, options.page);
1452
+ if (Object.keys(patch).length === 0) return { content, applied, skipped };
1453
+ const apply = extractorFor(format)?.apply;
1454
+ if (apply === void 0) {
1455
+ throw new GraphError(`${path2}: manni cannot write ${format} metadata`);
1456
+ }
1457
+ return { content: apply(content, patch, { filePath: path2 }), applied, skipped };
1383
1458
  }
1384
1459
  function frontmatterData(content) {
1385
1460
  const split = splitYamlFrontmatter(content, "");
@@ -1579,9 +1654,13 @@ var FillGuard = class _FillGuard {
1579
1654
  if (guarded().length === 0) return { values: current, rejected };
1580
1655
  const baseline = await this.baseline();
1581
1656
  while (guarded().length > 0) {
1582
- const applied = applyGraphFields(content, path2, current, {
1583
- force: this.force
1584
- });
1657
+ const applied = writeGraphFields(
1658
+ content,
1659
+ path2,
1660
+ formatOf(path2, this.analyzeOptions.format),
1661
+ current,
1662
+ { force: this.force }
1663
+ );
1585
1664
  const model = analyzeDoc(
1586
1665
  applied.content,
1587
1666
  path2,
@@ -2153,7 +2232,8 @@ async function runFill(opts = {}) {
2153
2232
  ...stdinDocument === void 0 ? {} : { stdinDocument }
2154
2233
  };
2155
2234
  async function fillOne(path2, absPath, content) {
2156
- if (frontmatterKind(content) === "unsupported") {
2235
+ const pageFormat = formatOf(path2, format);
2236
+ if ((pageFormat === "markdown" || pageFormat === "mdx") && frontmatterKind(content) === "unsupported") {
2157
2237
  throw new GraphError(
2158
2238
  "only YAML frontmatter can be edited (found a TOML/JSON fence) \u2014 exclude this file or convert its frontmatter"
2159
2239
  );
@@ -2164,17 +2244,21 @@ async function runFill(opts = {}) {
2164
2244
  throw failure instanceof Error ? failure : new GraphError(errorMessage(failure));
2165
2245
  }
2166
2246
  if (absPath !== void 0) {
2167
- const own2 = ownMetadata(content).data;
2168
- if (GRAPH_KEY in own2) {
2169
- const home = await view.home(path2, own2, GRAPH_KEY);
2247
+ const own2 = metadataOf(content, path2, pageFormat).data;
2248
+ if (GRAPH_KEY2 in own2) {
2249
+ const home = await view.home(path2, own2, GRAPH_KEY2);
2170
2250
  if (home.kind !== "unowned") {
2171
2251
  throw new GraphError(
2172
- `"${GRAPH_KEY}" is owned by manifest ${home.file} (collection ${home.collection}); remove it from the document`
2252
+ `"${GRAPH_KEY2}" is owned by manifest ${home.file} (collection ${home.collection}); remove it from the document`
2173
2253
  );
2174
2254
  }
2175
2255
  }
2176
2256
  }
2177
- const present = new Set(existingGraphFields(effective));
2257
+ const held = metadataOf(effective, path2, pageFormat).data;
2258
+ const heldGraph = held[GRAPH_KEY2];
2259
+ const present = new Set(
2260
+ heldGraph !== null && typeof heldGraph === "object" && !Array.isArray(heldGraph) ? Object.keys(heldGraph) : []
2261
+ );
2178
2262
  const missing = opts.force ? fields : fields.filter((f) => !present.has(f));
2179
2263
  if (missing.length === 0 && !withSections) {
2180
2264
  return {
@@ -2305,8 +2389,8 @@ async function runFill(opts = {}) {
2305
2389
  if (config.fill.writeProvenance) {
2306
2390
  const recordable = realFields.filter((f) => !f.includes(".")).sort();
2307
2391
  if (recordable.length < realFields.length) sectionsUnrecorded.push(path2);
2308
- const held = existingMetaProvenance(effective);
2309
- const priorEntry = Array.isArray(held) ? held.find(
2392
+ const heldProvenance = held[META_PROVENANCE_KEY];
2393
+ const priorEntry = Array.isArray(heldProvenance) ? heldProvenance.find(
2310
2394
  (e) => !!e && typeof e === "object" && !Array.isArray(e) && e["generated-by"] === identity.model
2311
2395
  ) : void 0;
2312
2396
  const priorConfidence = numberMap(priorEntry?.["confidence"]);
@@ -2322,7 +2406,7 @@ async function runFill(opts = {}) {
2322
2406
  ([f, name]) => confidence[f] === void 0 && priorConfidence[name] === void 0
2323
2407
  ).map(([, name]) => name);
2324
2408
  const merged = mergeMetaProvenance(
2325
- held,
2409
+ heldProvenance,
2326
2410
  identity.model,
2327
2411
  "fields",
2328
2412
  proposed
@@ -2333,7 +2417,7 @@ async function runFill(opts = {}) {
2333
2417
  provenanceList = merged.list;
2334
2418
  }
2335
2419
  }
2336
- const applied = applyGraphFields(effective, path2, narrowed, {
2420
+ const applied = writeGraphFields(effective, path2, pageFormat, narrowed, {
2337
2421
  force: opts.force
2338
2422
  });
2339
2423
  const reportedFields = applied.applied;
@@ -2349,10 +2433,10 @@ async function runFill(opts = {}) {
2349
2433
  cached
2350
2434
  };
2351
2435
  }
2352
- const own = ownMetadata(content).data;
2353
- const graphHome = absPath === void 0 ? void 0 : await view.home(path2, own, GRAPH_KEY);
2436
+ const own = metadataOf(content, path2, pageFormat).data;
2437
+ const graphHome = absPath === void 0 ? void 0 : await view.home(path2, own, GRAPH_KEY2);
2354
2438
  const provenanceHome = absPath === void 0 || provenanceList === void 0 ? void 0 : await view.home(path2, own, META_PROVENANCE_KEY);
2355
- const graphTarget = writeTarget(path2, graphHome, GRAPH_KEY);
2439
+ const graphTarget = writeTarget(path2, graphHome, GRAPH_KEY2);
2356
2440
  if (typeof graphTarget === "string") throw new GraphError(graphTarget);
2357
2441
  let provenanceTarget = writeTarget(path2, provenanceHome, META_PROVENANCE_KEY);
2358
2442
  if (typeof provenanceTarget === "string") {
@@ -2364,9 +2448,10 @@ async function runFill(opts = {}) {
2364
2448
  if (provenanceList !== void 0 && provenanceTarget === null) {
2365
2449
  pageKeys[META_PROVENANCE_KEY] = provenanceList;
2366
2450
  }
2367
- const pageContent = applyGraphFields(
2451
+ const pageContent = writeGraphFields(
2368
2452
  content,
2369
2453
  path2,
2454
+ pageFormat,
2370
2455
  graphTarget === null ? narrowed : {},
2371
2456
  { force: opts.force, page: pageKeys }
2372
2457
  ).content;
@@ -2374,8 +2459,8 @@ async function runFill(opts = {}) {
2374
2459
  if (graphTarget !== null) {
2375
2460
  manifestWrites.push({
2376
2461
  home: graphTarget,
2377
- key: GRAPH_KEY,
2378
- value: ownMetadata(applied.content).data[GRAPH_KEY]
2462
+ key: GRAPH_KEY2,
2463
+ value: metadataOf(applied.content, path2, pageFormat).data[GRAPH_KEY2]
2379
2464
  });
2380
2465
  }
2381
2466
  if (provenanceList !== void 0 && provenanceTarget !== null) {
@@ -2408,7 +2493,7 @@ async function runFill(opts = {}) {
2408
2493
  };
2409
2494
  }
2410
2495
  }
2411
- var GRAPH_KEY = "graph";
2496
+ var GRAPH_KEY2 = "graph";
2412
2497
  function writeTarget(path2, home, key) {
2413
2498
  if (home === void 0 || home.kind === "unowned") return null;
2414
2499
  if (home.kind === "url") return urlManifestMessage(key, home.file);
@@ -2455,16 +2540,18 @@ async function spliceAll(writes) {
2455
2540
  return [...out.values()];
2456
2541
  }
2457
2542
  async function mergedText(view, path2, content, format) {
2458
- if (frontmatterKind(content) === "unsupported") return content;
2459
- let own;
2543
+ const markdown = format === "markdown" || format === "mdx";
2544
+ if (markdown && frontmatterKind(content) === "unsupported") return content;
2545
+ const own = metadataOf(content, path2, format);
2546
+ const { supplied } = await mergePage(view, path2, own.data, own.present, format);
2547
+ if (Object.keys(supplied).length === 0) return content;
2460
2548
  try {
2461
- own = ownMetadata(content);
2549
+ return writeGraphFields(content, path2, format, {}, { page: supplied }).content;
2462
2550
  } catch (e) {
2463
- throw new GraphError(`${path2}: ${errorMessage(e)}`);
2551
+ const noFence = (format === "asciidoc" || format === "rst") && e instanceof DocmetaError;
2552
+ if (!noFence) throw e;
2553
+ return applyGraphFields(content, path2, {}, { page: supplied }).content;
2464
2554
  }
2465
- const { supplied } = await mergePage(view, path2, own.data, own.present, format);
2466
- if (Object.keys(supplied).length === 0) return content;
2467
- return applyGraphFields(content, path2, {}, { page: supplied }).content;
2468
2555
  }
2469
2556
  async function openMetaViewPerPage(source, cwd, paths, base2, failures) {
2470
2557
  try {
@@ -3869,4 +3956,4 @@ export {
3869
3956
  runTraverse,
3870
3957
  renderTraverse
3871
3958
  };
3872
- //# sourceMappingURL=chunk-644JVKJ4.js.map
3959
+ //# sourceMappingURL=chunk-EL2BZTDL.js.map