@hawkeyexl/manni 4.5.0 → 4.6.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 (215) hide show
  1. package/README.md +1 -1
  2. package/dist/batch-OZOACN4G.js +41 -0
  3. package/dist/build-Z5VOVADH.js +32 -0
  4. package/dist/calibrate-TZYT42DR.js +36 -0
  5. package/dist/capture-SL4MNDDP.js +34 -0
  6. package/dist/check-5OMA42Y6.js +26 -0
  7. package/dist/{check-ESNS7ZBC.js → check-OAJWC3WD.js} +7 -5
  8. package/dist/{check-RQIIIURI.js → check-PKY7KTQE.js} +13 -14
  9. package/dist/check-WB2QDHJQ.js +880 -0
  10. package/dist/check-WB2QDHJQ.js.map +1 -0
  11. package/dist/{chunk-F2OVHJNC.js → chunk-2JFPBZJK.js} +11 -11
  12. package/dist/{chunk-CP4ZM43V.js → chunk-2KRB3EG7.js} +2 -2
  13. package/dist/{chunk-QLUMKWQQ.js → chunk-2M6DVNI5.js} +10 -6
  14. package/dist/{chunk-QLUMKWQQ.js.map → chunk-2M6DVNI5.js.map} +1 -1
  15. package/dist/{chunk-HQFVJDEN.js → chunk-3NWX34ZI.js} +19 -19
  16. package/dist/{chunk-TCC737IS.js → chunk-5G53XATW.js} +4 -4
  17. package/dist/{chunk-B7XUEQF3.js → chunk-6KKZXB2O.js} +7 -5
  18. package/dist/{chunk-B7XUEQF3.js.map → chunk-6KKZXB2O.js.map} +1 -1
  19. package/dist/{chunk-SNEHX4VE.js → chunk-733Y2STG.js} +2 -2
  20. package/dist/{chunk-ELZ2IIOF.js → chunk-73TC4DYH.js} +2 -2
  21. package/dist/{chunk-QY3DOZMS.js → chunk-7WRP5FFP.js} +4 -4
  22. package/dist/{chunk-3R5Y3XOL.js → chunk-APKH2T6E.js} +29 -591
  23. package/dist/chunk-APKH2T6E.js.map +1 -0
  24. package/dist/{chunk-FLF6AECQ.js → chunk-B3TS4WRM.js} +17 -15
  25. package/dist/{chunk-FLF6AECQ.js.map → chunk-B3TS4WRM.js.map} +1 -1
  26. package/dist/chunk-BWCWTHYS.js +146 -0
  27. package/dist/chunk-BWCWTHYS.js.map +1 -0
  28. package/dist/{chunk-C6HZ6C5T.js → chunk-C3B2VJNC.js} +2 -2
  29. package/dist/{chunk-NN4ASVTY.js → chunk-C73RSUIC.js} +4 -4
  30. package/dist/chunk-CU57HT2E.js +116 -0
  31. package/dist/chunk-CU57HT2E.js.map +1 -0
  32. package/dist/chunk-CWXZ2MRT.js +222 -0
  33. package/dist/chunk-CWXZ2MRT.js.map +1 -0
  34. package/dist/{chunk-GAZFKZHM.js → chunk-DC5DDJVE.js} +6 -6
  35. package/dist/{chunk-52PDIZKV.js → chunk-ECVQNGTH.js} +3 -3
  36. package/dist/chunk-FLAO4ZS3.js +502 -0
  37. package/dist/chunk-FLAO4ZS3.js.map +1 -0
  38. package/dist/chunk-FQGLRJGX.js +174 -0
  39. package/dist/chunk-FQGLRJGX.js.map +1 -0
  40. package/dist/{chunk-XWFNO5PO.js → chunk-GAJIJKET.js} +3 -3
  41. package/dist/{chunk-QCBICNKC.js → chunk-GREQKO6M.js} +202 -54
  42. package/dist/chunk-GREQKO6M.js.map +1 -0
  43. package/dist/chunk-HX44GB4Z.js +30 -0
  44. package/dist/chunk-HX44GB4Z.js.map +1 -0
  45. package/dist/{chunk-7ZUCEMCY.js → chunk-IY7NYNPZ.js} +9 -11
  46. package/dist/{chunk-7ZUCEMCY.js.map → chunk-IY7NYNPZ.js.map} +1 -1
  47. package/dist/{chunk-527HHQPS.js → chunk-KCOFEWV5.js} +6 -4
  48. package/dist/{chunk-527HHQPS.js.map → chunk-KCOFEWV5.js.map} +1 -1
  49. package/dist/chunk-M2RLHZ4J.js +849 -0
  50. package/dist/chunk-M2RLHZ4J.js.map +1 -0
  51. package/dist/{chunk-K3U5F2QT.js → chunk-M6GSS72T.js} +12 -12
  52. package/dist/{chunk-UK2I3ACY.js → chunk-MHM4QEBV.js} +4 -4
  53. package/dist/{chunk-EL2BZTDL.js → chunk-MOWMCEOJ.js} +13 -11
  54. package/dist/{chunk-EL2BZTDL.js.map → chunk-MOWMCEOJ.js.map} +1 -1
  55. package/dist/{chunk-OIZ3XMKB.js → chunk-MWBJ3KTF.js} +4 -4
  56. package/dist/chunk-N7JSEDSC.js +233 -0
  57. package/dist/chunk-N7JSEDSC.js.map +1 -0
  58. package/dist/{chunk-MZC62HPZ.js → chunk-NBMPHD4I.js} +2 -2
  59. package/dist/{chunk-YA63PVWI.js → chunk-NHHOPZRA.js} +12 -10
  60. package/dist/{chunk-YA63PVWI.js.map → chunk-NHHOPZRA.js.map} +1 -1
  61. package/dist/{chunk-DX32P2DT.js → chunk-NTWW7J76.js} +2 -2
  62. package/dist/{chunk-6XTQDFGP.js → chunk-PCFG7E6B.js} +3 -3
  63. package/dist/{chunk-6XTQDFGP.js.map → chunk-PCFG7E6B.js.map} +1 -1
  64. package/dist/{chunk-SJO2FTPG.js → chunk-PL4UAF4S.js} +73 -1304
  65. package/dist/chunk-PL4UAF4S.js.map +1 -0
  66. package/dist/chunk-QCHVR4ZM.js +286 -0
  67. package/dist/chunk-QCHVR4ZM.js.map +1 -0
  68. package/dist/{chunk-JQU7FHYH.js → chunk-QW77LCOU.js} +10 -10
  69. package/dist/{chunk-IA7BMIPE.js → chunk-SM6NOMJS.js} +2 -2
  70. package/dist/{chunk-DE7JSWXV.js → chunk-SWSTHZBI.js} +8 -6
  71. package/dist/{chunk-DE7JSWXV.js.map → chunk-SWSTHZBI.js.map} +1 -1
  72. package/dist/{chunk-NGK3N6F2.js → chunk-T6SYGLWR.js} +3 -3
  73. package/dist/chunk-TH4JVQPF.js +133 -0
  74. package/dist/chunk-TH4JVQPF.js.map +1 -0
  75. package/dist/{chunk-TVIX653Q.js → chunk-TLXE7LYK.js} +4 -4
  76. package/dist/{chunk-HVFR66GQ.js → chunk-TUAAR3MM.js} +3280 -283
  77. package/dist/chunk-TUAAR3MM.js.map +1 -0
  78. package/dist/{chunk-TA42STP7.js → chunk-UAKNZVCD.js} +4 -4
  79. package/dist/{chunk-C3KI45RF.js → chunk-UJSGS2Y5.js} +4 -4
  80. package/dist/{chunk-ZX43SRZR.js → chunk-UWQ2UVHE.js} +8 -6
  81. package/dist/{chunk-ZX43SRZR.js.map → chunk-UWQ2UVHE.js.map} +1 -1
  82. package/dist/chunk-WQWKYAAK.js +86 -0
  83. package/dist/chunk-WQWKYAAK.js.map +1 -0
  84. package/dist/{chunk-LJ2RDH3F.js → chunk-XG6PVB5S.js} +1 -23
  85. package/dist/chunk-XG6PVB5S.js.map +1 -0
  86. package/dist/{chunk-Q35YIDBV.js → chunk-XKBEHKWO.js} +29 -264
  87. package/dist/chunk-XKBEHKWO.js.map +1 -0
  88. package/dist/chunk-XPEWUK7J.js +532 -0
  89. package/dist/chunk-XPEWUK7J.js.map +1 -0
  90. package/dist/{chunk-BOIF2XGG.js → chunk-XXDXIIQ4.js} +2 -2
  91. package/dist/chunk-YLK2J5YK.js +610 -0
  92. package/dist/chunk-YLK2J5YK.js.map +1 -0
  93. package/dist/{chunk-7OQAU4EA.js → chunk-Z4IZGEM3.js} +16 -12
  94. package/dist/{chunk-7OQAU4EA.js.map → chunk-Z4IZGEM3.js.map} +1 -1
  95. package/dist/{cli-E3H6ZP4I.js → cli-6EWVMEN6.js} +5 -3
  96. package/dist/{cli-E3H6ZP4I.js.map → cli-6EWVMEN6.js.map} +1 -1
  97. package/dist/{cli-MHTYPVOD.js → cli-6H7HVDMQ.js} +113 -20
  98. package/dist/{cli-MHTYPVOD.js.map → cli-6H7HVDMQ.js.map} +1 -1
  99. package/dist/{cli-HUIMNJT6.js → cli-EPVZHAZS.js} +19 -20
  100. package/dist/{cli-HUIMNJT6.js.map → cli-EPVZHAZS.js.map} +1 -1
  101. package/dist/{cli-6PGVHP7Y.js → cli-LUCSGTVI.js} +17 -19
  102. package/dist/{cli-6PGVHP7Y.js.map → cli-LUCSGTVI.js.map} +1 -1
  103. package/dist/{cli-PRZHQ3QB.js → cli-NIG4N3XM.js} +14 -15
  104. package/dist/{cli-PRZHQ3QB.js.map → cli-NIG4N3XM.js.map} +1 -1
  105. package/dist/{cli-TYGOHJOJ.js → cli-PSKNB66T.js} +225 -58
  106. package/dist/cli-PSKNB66T.js.map +1 -0
  107. package/dist/{cli-QKIJOXGW.js → cli-UO4NHIB3.js} +17 -17
  108. package/dist/{cli-AAG3N4NB.js → cli-UQ7A3YA2.js} +17 -18
  109. package/dist/{cli-AAG3N4NB.js.map → cli-UQ7A3YA2.js.map} +1 -1
  110. package/dist/{cli-YW6VWBHX.js → cli-YHYDLQAF.js} +10 -10
  111. package/dist/cli.js +11 -11
  112. package/dist/config-P4HDNTYD.js +26 -0
  113. package/dist/conformance-ZFCMKM6M.js +18 -0
  114. package/dist/docmeta.js +9 -9
  115. package/dist/github-7ZCH5PSO.js +26 -0
  116. package/dist/github-POT6724K.js +31 -0
  117. package/dist/host-6GURH5HE.js +23 -0
  118. package/dist/index.d.ts +72 -4
  119. package/dist/index.js +176 -166
  120. package/dist/index.js.map +1 -1
  121. package/dist/{json-4DCKDGUV.js → json-KT2K62L5.js} +12 -13
  122. package/dist/lint-5AQ5C2BV.js +29 -0
  123. package/dist/list-5JZKX2NK.js +28 -0
  124. package/dist/list-SWPFXQMU.js +30 -0
  125. package/dist/{page-QEDB7EVU.js → page-UPSXRP75.js} +11 -12
  126. package/dist/prepare-6GNEWCNH.js +155 -0
  127. package/dist/prepare-6GNEWCNH.js.map +1 -0
  128. package/dist/{pretty-SQX33UM2.js → pretty-Q6FQAOK4.js} +13 -14
  129. package/dist/{pretty-5DGEBZSV.js → pretty-SQRPFPSQ.js} +12 -13
  130. package/dist/provider-AMGRDY6V.js +34 -0
  131. package/dist/release-IECYCLTD.js +36 -0
  132. package/dist/release-IECYCLTD.js.map +1 -0
  133. package/dist/{reporters-OHSI3RMV.js → reporters-45MMC2ID.js} +11 -12
  134. package/dist/{reporters-YELDDYJD.js → reporters-XUV4MM64.js} +7 -5
  135. package/dist/reporters-XUV4MM64.js.map +1 -0
  136. package/dist/run-KMWY2IAN.js +32 -0
  137. package/dist/run-KMWY2IAN.js.map +1 -0
  138. package/dist/{term-2WMDZ4PY.js → term-PCJUCWNF.js} +16 -17
  139. package/dist/{term-2WMDZ4PY.js.map → term-PCJUCWNF.js.map} +1 -1
  140. package/dist/validate-IMNCZNWG.js +17 -0
  141. package/dist/validate-IMNCZNWG.js.map +1 -0
  142. package/package.json +2 -2
  143. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  144. package/plugin/manni/hooks/hooks.json +47 -0
  145. package/dist/batch-GOE3UXOD.js +0 -36
  146. package/dist/build-M7BMEHL2.js +0 -33
  147. package/dist/calibrate-6RRAILUY.js +0 -31
  148. package/dist/capture-RJPQ6B4N.js +0 -32
  149. package/dist/check-BQD64X3N.js +0 -27
  150. package/dist/chunk-3R5Y3XOL.js.map +0 -1
  151. package/dist/chunk-3YHAYXBC.js +0 -164
  152. package/dist/chunk-3YHAYXBC.js.map +0 -1
  153. package/dist/chunk-HVFR66GQ.js.map +0 -1
  154. package/dist/chunk-LJ2RDH3F.js.map +0 -1
  155. package/dist/chunk-NAZRLJAK.js +0 -3090
  156. package/dist/chunk-NAZRLJAK.js.map +0 -1
  157. package/dist/chunk-Q35YIDBV.js.map +0 -1
  158. package/dist/chunk-QCBICNKC.js.map +0 -1
  159. package/dist/chunk-SJO2FTPG.js.map +0 -1
  160. package/dist/chunk-TU2WUBVZ.js +0 -2
  161. package/dist/cli-TYGOHJOJ.js.map +0 -1
  162. package/dist/github-3WMSTNTK.js +0 -32
  163. package/dist/github-OXSJQ4PS.js +0 -27
  164. package/dist/lint-YDHVVZHT.js +0 -30
  165. package/dist/list-3ZO2NIYO.js +0 -31
  166. package/dist/list-EJH6VAOW.js +0 -29
  167. package/dist/run-IP6NZHAG.js +0 -33
  168. package/dist/validate-G6HH3YXL.js +0 -16
  169. /package/dist/{batch-GOE3UXOD.js.map → batch-OZOACN4G.js.map} +0 -0
  170. /package/dist/{build-M7BMEHL2.js.map → build-Z5VOVADH.js.map} +0 -0
  171. /package/dist/{calibrate-6RRAILUY.js.map → calibrate-TZYT42DR.js.map} +0 -0
  172. /package/dist/{capture-RJPQ6B4N.js.map → capture-SL4MNDDP.js.map} +0 -0
  173. /package/dist/{check-BQD64X3N.js.map → check-5OMA42Y6.js.map} +0 -0
  174. /package/dist/{check-ESNS7ZBC.js.map → check-OAJWC3WD.js.map} +0 -0
  175. /package/dist/{check-RQIIIURI.js.map → check-PKY7KTQE.js.map} +0 -0
  176. /package/dist/{chunk-F2OVHJNC.js.map → chunk-2JFPBZJK.js.map} +0 -0
  177. /package/dist/{chunk-CP4ZM43V.js.map → chunk-2KRB3EG7.js.map} +0 -0
  178. /package/dist/{chunk-HQFVJDEN.js.map → chunk-3NWX34ZI.js.map} +0 -0
  179. /package/dist/{chunk-TCC737IS.js.map → chunk-5G53XATW.js.map} +0 -0
  180. /package/dist/{chunk-SNEHX4VE.js.map → chunk-733Y2STG.js.map} +0 -0
  181. /package/dist/{chunk-ELZ2IIOF.js.map → chunk-73TC4DYH.js.map} +0 -0
  182. /package/dist/{chunk-QY3DOZMS.js.map → chunk-7WRP5FFP.js.map} +0 -0
  183. /package/dist/{chunk-C6HZ6C5T.js.map → chunk-C3B2VJNC.js.map} +0 -0
  184. /package/dist/{chunk-NN4ASVTY.js.map → chunk-C73RSUIC.js.map} +0 -0
  185. /package/dist/{chunk-GAZFKZHM.js.map → chunk-DC5DDJVE.js.map} +0 -0
  186. /package/dist/{chunk-52PDIZKV.js.map → chunk-ECVQNGTH.js.map} +0 -0
  187. /package/dist/{chunk-XWFNO5PO.js.map → chunk-GAJIJKET.js.map} +0 -0
  188. /package/dist/{chunk-K3U5F2QT.js.map → chunk-M6GSS72T.js.map} +0 -0
  189. /package/dist/{chunk-UK2I3ACY.js.map → chunk-MHM4QEBV.js.map} +0 -0
  190. /package/dist/{chunk-OIZ3XMKB.js.map → chunk-MWBJ3KTF.js.map} +0 -0
  191. /package/dist/{chunk-MZC62HPZ.js.map → chunk-NBMPHD4I.js.map} +0 -0
  192. /package/dist/{chunk-DX32P2DT.js.map → chunk-NTWW7J76.js.map} +0 -0
  193. /package/dist/{chunk-JQU7FHYH.js.map → chunk-QW77LCOU.js.map} +0 -0
  194. /package/dist/{chunk-IA7BMIPE.js.map → chunk-SM6NOMJS.js.map} +0 -0
  195. /package/dist/{chunk-NGK3N6F2.js.map → chunk-T6SYGLWR.js.map} +0 -0
  196. /package/dist/{chunk-TVIX653Q.js.map → chunk-TLXE7LYK.js.map} +0 -0
  197. /package/dist/{chunk-TA42STP7.js.map → chunk-UAKNZVCD.js.map} +0 -0
  198. /package/dist/{chunk-C3KI45RF.js.map → chunk-UJSGS2Y5.js.map} +0 -0
  199. /package/dist/{chunk-BOIF2XGG.js.map → chunk-XXDXIIQ4.js.map} +0 -0
  200. /package/dist/{cli-QKIJOXGW.js.map → cli-UO4NHIB3.js.map} +0 -0
  201. /package/dist/{chunk-TU2WUBVZ.js.map → cli-YHYDLQAF.js.map} +0 -0
  202. /package/dist/{cli-YW6VWBHX.js.map → config-P4HDNTYD.js.map} +0 -0
  203. /package/dist/{github-3WMSTNTK.js.map → conformance-ZFCMKM6M.js.map} +0 -0
  204. /package/dist/{github-OXSJQ4PS.js.map → github-7ZCH5PSO.js.map} +0 -0
  205. /package/dist/{json-4DCKDGUV.js.map → github-POT6724K.js.map} +0 -0
  206. /package/dist/{lint-YDHVVZHT.js.map → host-6GURH5HE.js.map} +0 -0
  207. /package/dist/{list-3ZO2NIYO.js.map → json-KT2K62L5.js.map} +0 -0
  208. /package/dist/{list-EJH6VAOW.js.map → lint-5AQ5C2BV.js.map} +0 -0
  209. /package/dist/{page-QEDB7EVU.js.map → list-5JZKX2NK.js.map} +0 -0
  210. /package/dist/{pretty-5DGEBZSV.js.map → list-SWPFXQMU.js.map} +0 -0
  211. /package/dist/{pretty-SQX33UM2.js.map → page-UPSXRP75.js.map} +0 -0
  212. /package/dist/{reporters-OHSI3RMV.js.map → pretty-Q6FQAOK4.js.map} +0 -0
  213. /package/dist/{reporters-YELDDYJD.js.map → pretty-SQRPFPSQ.js.map} +0 -0
  214. /package/dist/{run-IP6NZHAG.js.map → provider-AMGRDY6V.js.map} +0 -0
  215. /package/dist/{validate-G6HH3YXL.js.map → reporters-45MMC2ID.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/cli.ts","../src/graph/reporters/index.ts","../src/graph/commands/init.ts"],"sourcesContent":["/**\n * The graph program. Named `graph` because that is where it is mounted\n * (`manni graph …`); `src/cli.ts` adds it to the umbrella and runs it.\n *\n * Grammar per proposals 0034 and 0051 §2: the domain owns verbs and has no\n * default subcommand, `-f` means the output format everywhere and is checked\n * against the verb's list, and a list reaches a flag by exactly one\n * separator. The plumbing is the family's: `fail()` from `src/shared/run.ts`,\n * `warn()` from `src/shared/warn.ts`, and `--no-color` from\n * `src/shared/color.ts`.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n readStdin,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { fail } from \"../shared/run.js\";\nimport { warn } from \"../shared/warn.js\";\nimport { GraphError } from \"./types.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport { ALL_FILL_FIELDS, type FillField } from \"./core/config.js\";\nimport {\n assertInputFormat,\n DEFAULT_EXTENSIONS,\n STDIN,\n} from \"./core/discover.js\";\nimport {\n CHECK_FORMATS,\n CHECK_FORMAT_LIST,\n GRAPH_FORMATS,\n GRAPH_FORMAT_LIST,\n type CheckFormat,\n type GraphFormat,\n} from \"./reporters/index.js\";\nimport { runBuild } from \"./commands/build.js\";\nimport { renderCheck, runCheck } from \"./commands/check.js\";\nimport {\n EXPORT_TARGETS,\n runExport,\n type ExportFormat,\n} from \"./commands/export.js\";\nimport { renderQuery, runQuery } from \"./commands/query.js\";\nimport { renderFill, runFill } from \"./commands/fill.js\";\nimport { runInit } from \"./commands/init.js\";\nimport { renderEmbed, runEmbed } from \"./commands/embed.js\";\nimport {\n renderSearch,\n runSearch,\n SEARCH_MODES,\n type SearchMode,\n} from \"./commands/search.js\";\nimport { renderStats, runStats } from \"./commands/stats.js\";\nimport { renderTraverse, runTraverse } from \"./commands/traverse.js\";\n\n/**\n * Whether `command`'s output gets colour: this domain's `--no-color` and\n * `NO_COLOR` turn it off, and otherwise only a TTY turns it on\n * (`shouldColor`). `isTTY` is passed uncoerced: Node leaves it undefined off\n * a terminal, never false, and `shouldColor` reads a missing one as \"not a\n * terminal\".\n *\n * Exported because this is where the decision is testable — a spawned bin is\n * never a TTY. graph's reporters print no colour yet; when one does, it takes\n * the boolean from here rather than consulting the environment itself.\n */\nexport function colorFor(\n command: Command,\n isTTY: boolean | undefined,\n env?: NodeJS.ProcessEnv,\n): boolean {\n // commander maps --no-color to opts.color === false, on the command that\n // declares it.\n const noColor = colorOwner(command).opts().color === false;\n return shouldColor({ noColor, isTTY, env });\n}\n\n/**\n * The nearest command, this one or an ancestor, that declares `--no-color`:\n * the `graph` program, wherever it is mounted. Not the root: under the umbrella\n * that is `manni`, which has no `--no-color` of its own.\n */\nfunction colorOwner(command: Command): Command {\n for (let c: Command | null = command; c !== null; c = c.parent) {\n if (c.options.some((o) => o.long === \"--no-color\")) return c;\n }\n return command;\n}\n\nexport function buildProgram(): Command {\nconst program = new Command();\n\nprogram\n .name(\"graph\")\n .description(\n \"Deterministic knowledge graphs derived from documentation frontmatter and formatting.\",\n )\n .version(pkg.version)\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)` — which reports a usage error as a finding.\n .exitOverride();\n\n/**\n * Parse a numeric CLI option, refusing what the config schema refuses.\n *\n * `Number.parseFloat`/`parseInt` return NaN for `abc` and silently accept\n * out-of-range values, and NaN then disables whatever gate it feeds — a cost\n * cap that never fires, a confidence gate that writes everything, a `--top`\n * that asks for a negative number of rows. The documented precedence is\n * config → Ajv → CLI override, so the override has to be held to the same range.\n */\nfunction numericOption(\n flag: string,\n { min, max, integer }: { min: number; max?: number; integer?: boolean },\n) {\n return (raw: string): number => {\n const value = Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new GraphError(`${flag} expects a number, got \"${raw}\".`);\n }\n if (integer && !Number.isInteger(value)) {\n throw new GraphError(`${flag} expects a whole number, got ${value}.`);\n }\n if (value < min || (max !== undefined && value > max)) {\n const range = max === undefined ? `>= ${min}` : `${min}..${max}`;\n throw new GraphError(`${flag} must be ${range}, got ${value}.`);\n }\n return value;\n };\n}\n\n/** A count: a whole number, at least `min` (1 unless the flag allows zero). */\nfunction countOption(flag: string, min = 1) {\n return numericOption(flag, { min, integer: true });\n}\n\n/**\n * Hold a CLI override to the same list its config key is held to.\n *\n * `fill.provider` is Ajv-validated against the schema enum; the `--provider`\n * override was an arbitrary string cast straight to `ProviderName`, so the\n * documented config → Ajv → CLI precedence had a hole at the last step.\n */\nfunction enumOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(\n `${flag} must be one of ${allowed.join(\" | \")}, got \"${raw}\".`,\n );\n }\n return raw as T;\n };\n}\n\n/**\n * A flag whose value is one of a named set, refused in the family's words:\n * `Unknown --format \"xml\". Use pretty | json.` The check runs while the\n * options are parsed, so a typo costs a message rather than a graph load.\n */\nfunction choiceOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(`Unknown ${flag} \"${raw}\". Use ${allowed.join(\" | \")}.`);\n }\n return raw as T;\n };\n}\n\n/** `-f, --format`: every verb's list is `pretty | json` (0051 §2). */\nconst formatOption = choiceOption(\"--format\", GRAPH_FORMATS);\n\n/** `check`'s own, which adds `github` — the CI gate's annotation format. */\nconst checkFormatOption = choiceOption(\"--format\", CHECK_FORMATS);\n\n/**\n * `--fields <list>`: comma-separated and given once, never repeatable — one\n * separator per list (proposal 0034), and the spelling `meta fill --fields`\n * already uses. Each value is held to the same list `fill.fields` is.\n */\nconst fieldsOption = (raw: string): FillField[] =>\n splitList(raw).map((value) => enumOption(\"--fields\", ALL_FILL_FIELDS)(value));\n\n/**\n * The document-set surface the verbs that read documents share (proposals\n * 0041 and 0051 §1): positional `[paths...]` with `-` for stdin,\n * `--collection` and `--exclude` (each one value per occurrence), `--as`,\n * `--ext` (comma-separated, given once), `--allow-empty`, and\n * `-c`/`--no-config`. Declared once so the verbs cannot drift apart on a name\n * or a description, and worded as `meta` and `lint` word them.\n */\nfunction documentInputs(command: Command, verb: string): Command {\n return command\n .argument(\n \"[paths...]\",\n `files, directories, or globs to ${verb} (use - for stdin)`,\n )\n .option(\n \"--collection <name>\",\n \"Configured collection to read (repeatable)\",\n collect,\n [],\n )\n .option(\"--exclude <glob>\", \"Glob to exclude (repeatable)\", collect, [])\n .option(\n \"--as <format>\",\n \"Parse every input as asciidoc, html, markdown, mdx, rst or xml, whatever its extension. Required with -.\",\n )\n .option(\n \"--ext <list>\",\n \"comma-separated extensions for directory walks\",\n DEFAULT_EXTENSIONS.join(\",\"),\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/** The input flags as commander hands them over. */\ninterface InputFlags {\n as?: string;\n ext: string;\n allowEmpty?: boolean;\n}\n\n/**\n * The input flags for a core, and stdin when `paths` holds `-`. `--as` is\n * checked first, so `-` without it is refused before anything waits on stdin.\n */\nasync function inputOptions(\n paths: string[],\n opts: InputFlags,\n): Promise<{\n as?: string;\n ext: string[];\n allowEmpty?: boolean;\n stdinContent?: string;\n}> {\n assertInputFormat(paths, opts.as);\n return {\n ...(opts.as === undefined ? {} : { as: opts.as }),\n ext: splitList(opts.ext),\n ...(opts.allowEmpty === true ? { allowEmpty: true } : {}),\n ...(paths.includes(STDIN) ? { stdinContent: await readStdin() } : {}),\n };\n}\n\n/**\n * `-c`/`--no-config` for a verb that reads a built graph rather than a\n * document set. They share one commander attribute, which `configOption`\n * splits.\n */\nfunction configInputs(command: Command): Command {\n return command\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/**\n * `opts` minus the one attribute `-c` and `--no-config` share. `documentOptions`\n * restates it as the two fields a core reads, and spreading the raw value over\n * them would put commander's `false` back where a path belongs.\n */\nfunction rest<T extends { config?: string | boolean }>(\n opts: T,\n): Omit<T, \"config\"> {\n const { config, ...others } = opts;\n return others;\n}\n\n/** The shared options as the command cores take them. */\nfunction documentOptions(opts: {\n collection?: string[];\n exclude?: string[];\n config?: string | boolean;\n}): {\n config?: string;\n noConfig?: boolean;\n collection?: string[];\n exclude?: string[];\n} {\n const { configPath, noConfig } = configOption(opts.config);\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n ...(opts.exclude === undefined ? {} : { exclude: opts.exclude }),\n };\n}\n\nprogram\n .command(\"init\")\n .description(\"Add a starter `graph:` section to manni.config.yaml in the current directory\")\n .action(async () => {\n try {\n console.log(`Created ${await runInit()}`);\n } catch (e) {\n fail(e);\n }\n });\n\ndocumentInputs(\n program\n .command(\"build\")\n .description(\"Derive the knowledge graph and write deterministic Turtle\"),\n \"build\",\n)\n .option(\"-o, --out <path>\", \"Output .ttl path (default: config out)\")\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n out?: string;\n }) => {\n try {\n const result = await runBuild({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n out: opts.out,\n });\n // Warnings go to stderr so stdout stays the machine-readable summary;\n // a degraded build is still a successful one, so the exit code is 0.\n for (const warning of result.warnings) warn(warning);\n console.log(\n `Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples)`,\n );\n } catch (e) {\n fail(e);\n }\n });\n\nconfigInputs(\n program\n .command(\"check\")\n .description(\n \"Validate the built graph against the bundled SHACL shapes (errors exit 1)\",\n ),\n)\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n // One path per occurrence, never split on commas: a path may hold one.\n .option(\n \"--shapes <path>\",\n \"Shapes .ttl file; repeatable (default: config check.shapes, then bundled)\",\n collect,\n [],\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${CHECK_FORMAT_LIST}`,\n checkFormatOption,\n \"pretty\",\n )\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n shapes: string[];\n format: CheckFormat;\n }) => {\n try {\n const report = await runCheck({ ...rest(opts), ...documentOptions(opts) });\n console.log(renderCheck(report, opts.format));\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\ndocumentInputs(\n program\n .command(\"fill\")\n .description(\n \"Propose `graph:` frontmatter fields with an LLM, gated by confidence, and write them back\",\n ),\n \"fill\",\n)\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\"--dry-run\", \"Report proposals without writing files\")\n .option(\"--force\", \"Overwrite human-set graph fields\")\n .option(\"--no-cache\", \"Bypass the proposal cache\")\n .option(\"--no-validate-graph\", \"Skip the SHACL graph guardrail on proposals\")\n .option(\"--sections\", \"Also propose per-section metadata\")\n .option(\n \"--max-turns <n>\",\n \"Stop after this many inference calls (a cached page costs none)\",\n countOption(\"--max-turns\"),\n )\n .option(\n \"--confidence <n>\",\n \"Minimum model confidence (0..1) to write a field (default: config, 0.7)\",\n numericOption(\"--confidence\", { min: 0, max: 1 }),\n )\n .option(\n // Comma-separated and given once: one separator per list (proposal 0034).\n \"--fields <list>\",\n `Fields to propose (comma-separated; default: config, then every field)`,\n fieldsOption,\n )\n // The nameable providers, and `auto`. `mock` is the library's test double:\n // accepted when asked for by name, never offered.\n .option(\n \"--provider <name>\",\n \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\",\n )\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n // Typed inline, as every other action in this file is. The option parsers\n // above (`numericOption`, `choiceOption`, `fieldsOption`) have already thrown\n // on anything malformed by the time this runs, so a cast per field would be\n // safe — but it would also be the one command with the most options and the\n // least help from the compiler.\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n dryRun?: boolean;\n force?: boolean;\n cache?: boolean;\n validateGraph?: boolean;\n sections?: boolean;\n maxTurns?: number;\n confidence?: number;\n fields?: FillField[];\n provider?: string;\n model?: string;\n local?: boolean;\n format: GraphFormat;\n }) => {\n try {\n const report = await runFill({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n dryRun: opts.dryRun,\n force: opts.force,\n noCache: opts.cache === false,\n noValidateGraph: opts.validateGraph === false,\n sections: opts.sections,\n maxTurns: opts.maxTurns,\n confidence: opts.confidence,\n fields: opts.fields,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n // Same channel discipline as build: warnings on stderr, so stdout stays\n // the report, and a warning never changes the exit code.\n for (const warning of report.warnings) warn(warning);\n const rendered = renderFill(report, opts.format);\n if (paths.includes(STDIN)) {\n // With `-` the filled document owns stdout, as under `meta fill -`,\n // and the report in either format is a diagnostic on stderr.\n if (report.stdinDocument !== undefined) {\n process.stdout.write(report.stdinDocument);\n }\n if (rendered.length > 0) process.stderr.write(`${rendered}\\n`);\n } else {\n console.log(rendered);\n }\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\nprogram\n .command(\"query\")\n .description(\n \"Match triple patterns against the built graph (omit a term for wildcard)\",\n )\n // Long-only, and named for the triple position each one fills. `-o` is\n // `--out` on every other graph verb and `-s` is meta's schema flag; a\n // one-letter spelling that means two things in one family costs more than\n // the letters it saves.\n .option(\"--subject <term>\", \"Subject IRI or prefixed name\")\n .option(\"--predicate <term>\", \"Predicate IRI or prefixed name\")\n .option(\"--object <term>\", \"Object IRI, prefixed name, or literal value\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n (opts: {\n subject?: string;\n predicate?: string;\n object?: string;\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n }) => {\n try {\n const { subject, predicate, object, ...others } = rest(opts);\n const result = runQuery({\n ...others,\n ...documentOptions(opts),\n ...(subject === undefined ? {} : { s: subject }),\n ...(predicate === undefined ? {} : { p: predicate }),\n ...(object === undefined ? {} : { o: object }),\n });\n console.log(renderQuery(result, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"stats\")\n .description(\n \"Summarize the built graph: counts, orphans, broken links, hubs, metadata coverage\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\n \"--check\",\n \"Exit 1 when broken internal links exist or coverage is below threshold\",\n )\n .option(\n \"--top <n>\",\n \"How many most-connected docs to list\",\n countOption(\"--top\"),\n )\n .option(\n \"--coverage-threshold <pct>\",\n \"Minimum metadata coverage % (all fields); overrides config for this run\",\n // A percentage, so 0..100 rather than the 0..1 of a confidence. NaN here is\n // worse than a wrong number: `pct < NaN` is false for every field, so the\n // gate this flag exists to tighten would silently pass instead.\n numericOption(\"--coverage-threshold\", { min: 0, max: 100 }),\n )\n .action(\n (opts: {\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n check?: boolean;\n top?: number;\n coverageThreshold?: number;\n }) => {\n try {\n const report = runStats({ ...rest(opts), ...documentOptions(opts) });\n console.log(renderStats(report, opts.format));\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"search\")\n .description(\"Rank graph nodes for a text query (needs `export search`)\")\n .argument(\"<query>\", \"Text query\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"--lang <tag>\",\n \"Which localization to search (required when the corpus has more than one)\",\n )\n .option(\"--limit <n>\", \"Maximum results (default 10)\", countOption(\"--limit\"))\n .option(\n \"--vectors <path>\",\n \"Vector sidecar path (default: from the manifest)\",\n )\n .option(\n \"--mode <mode>\",\n `Which legs to run: ${SEARCH_MODES.join(\" | \")} (default: hybrid when vectors exist)`,\n choiceOption(\"--mode\", SEARCH_MODES),\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (\n query: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n lang?: string;\n limit?: number;\n vectors?: string;\n mode?: SearchMode;\n format: GraphFormat;\n },\n ) => {\n try {\n const report = await runSearch({\n ...rest(opts),\n ...documentOptions(opts),\n query,\n });\n console.log(renderSearch(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"traverse\")\n .description(\n \"Walk the graph from a node, honoring scope rules, with the full trace\",\n )\n .argument(\"<node>\", \"Starting node: a full IRI or a prefix:local CURIE\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-d, --depth <n>\",\n \"Maximum hops from the node (default 1; 3 under --impact)\",\n // Zero is allowed: it means the node itself, which is a real answer.\n countOption(\"--depth\", 0),\n )\n // Comma-separated and given once: a CURIE holds no comma, so one separator\n // is enough, and a second spelling would be a second thing to document.\n .option(\n \"--predicates <list>\",\n \"Only follow these predicates (comma-separated)\",\n )\n .option(\"--reverse\", \"Follow inbound edges (who points at this node)\")\n .option(\"--impact\", \"Transitive inbound reach: what a change here affects\")\n .option(\n \"--variant <variant>\",\n \"Scope filter: product variant IRI, title, or slug\",\n )\n // Not `--subject`: on `query` that is a triple's subject, and one flag name\n // means one thing across the domain.\n .option(\"--software-subject <subject>\", \"Scope filter: software subject\")\n .option(\"--lang <tag>\", \"Scope filter: BCP-47 language tag, matched in any case\")\n .option(\"--limit <n>\", \"Stop after this many nodes\", countOption(\"--limit\"))\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n (\n node: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n depth?: number;\n predicates?: string;\n reverse?: boolean;\n impact?: boolean;\n variant?: string;\n softwareSubject?: string;\n lang?: string;\n limit?: number;\n format: GraphFormat;\n },\n ) => {\n try {\n const { softwareSubject, ...others } = rest(opts);\n const report = runTraverse({\n ...others,\n ...documentOptions(opts),\n ...(softwareSubject === undefined ? {} : { subject: softwareSubject }),\n node,\n predicates:\n opts.predicates === undefined\n ? undefined\n : splitList(opts.predicates),\n });\n console.log(renderTraverse(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"embed\")\n .description(\n \"Compute local embeddings for the search index (needs @huggingface/transformers)\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"-o, --out <dir>\",\n \"Directory for the sidecars (default: the index directory)\",\n )\n // Not `--model`: on `fill` that is the inference model, a different thing.\n .option(\n \"--embedding-model <id>\",\n \"Embedding model id (any id; `mock` for offline runs)\",\n )\n .option(\"--dtype <dtype>\", \"Weight quantization (default q8)\")\n .option(\"--no-cache\", \"Ignore the vector cache\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n out?: string;\n embeddingModel?: string;\n dtype?: string;\n cache?: boolean;\n format: GraphFormat;\n }) => {\n try {\n const { embeddingModel, ...others } = rest(opts);\n const report = await runEmbed({\n ...others,\n ...documentOptions(opts),\n ...(embeddingModel === undefined ? {} : { model: embeddingModel }),\n noCache: opts.cache === false,\n });\n console.log(renderEmbed(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"export\")\n .description(\n \"Reserialize the built graph into a consumer format (jsonld file, iirds package, or search index)\",\n )\n // The target is a positional, not `-f`: `-f` is the output format in every\n // other verb of the family (0051 §2), and one flag cannot mean two things.\n .argument(\"<target>\", `What to write: ${EXPORT_TARGETS.join(\" | \")}`)\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-o, --out <path>\",\n \"Output path (default: the graph path with the target's extension)\",\n )\n .action(\n async (\n target: string,\n opts: { config?: string | boolean; graph?: string; out?: string },\n ) => {\n try {\n if (!(EXPORT_TARGETS as readonly string[]).includes(target)) {\n throw new GraphError(\n `Unknown export target \"${target}\". Use ${EXPORT_TARGETS.join(\" | \")}.`,\n );\n }\n const result = await runExport({\n ...documentOptions(opts),\n graph: opts.graph,\n format: target as ExportFormat,\n out: opts.out,\n });\n for (const warning of result.warnings) warn(warning);\n console.log(\n `Wrote ${result.nodes} node${result.nodes === 1 ? \"\" : \"s\"} to ${result.outPath}`,\n );\n } catch (e) {\n fail(e);\n }\n },\n );\n\nreturn program;\n}\n","/**\n * What `-f` accepts, per verb.\n *\n * Each verb's renderer lives beside its command core (`renderCheck`,\n * `renderStats`, …); what belongs here is the *list*, stated once so the\n * union, the guard, the help text and the refusal sentence cannot drift\n * apart. It is the same shape a11y and cite keep (`A11Y_FORMATS`,\n * `REPORT_FORMATS`), which is why the sentence a user reads is the family's.\n *\n * Every verb takes `pretty | json`. `check` also takes `github`, because it is\n * the CI gate: it is the one graph verb whose output changes what a reviewer sees\n * on a pull request (proposal 0051 §2). It names its own list here rather than\n * widening the shared one, so no other verb advertises a format it cannot\n * render.\n */\n\n/** The list every graph verb's `-f` accepts, in the order messages list them. */\nexport const GRAPH_FORMATS = [\"pretty\", \"json\"] as const;\nexport type GraphFormat = (typeof GRAPH_FORMATS)[number];\n\n/** `\"pretty | json\"`, for help text and the refusal sentence. */\nexport const GRAPH_FORMAT_LIST: string = GRAPH_FORMATS.join(\" | \");\n\n/** `check`'s list: the shared two plus the CI annotation format. */\nexport const CHECK_FORMATS = [...GRAPH_FORMATS, \"github\"] as const;\nexport type CheckFormat = (typeof CHECK_FORMATS)[number];\n\n/** `\"pretty | json | github\"`, for help text and the refusal sentence. */\nexport const CHECK_FORMAT_LIST: string = CHECK_FORMATS.join(\" | \");\n","/**\n * `manni graph init` — scaffold a starter `graph:` section in manni.config.yaml.\n *\n * The family file is shared with the other tools, so a file that already\n * exists is not overwritten: the section is appended to it, leaving the\n * siblings' keys and comments exactly as they were. A file that already has a\n * `graph:` key is refused.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { writeTextAtomic } from \"../../shared/write-file.js\";\nimport { GraphError } from \"../types.js\";\nimport { CONFIG_SECTION, DEFAULT_CONFIG_FILENAME } from \"../core/config.js\";\n\nconst HEADER = `# manni.config.yaml — shared configuration for the manni family of tools.\n# Each tool reads its own top-level key; manni graph reads \"graph:\".\n`;\n\nconst STARTER = `# Base IRI for every minted node. Set this to a namespace you control;\n# without it, IRIs fall back to the urn:manni:graph: placeholder.\n# baseIri: https://example.com/graph/\n\n# There is no document set here. \\`manni graph build\\` and \\`manni graph fill\\` read the\n# paths you name, or the collections declared once for every tool at the TOP\n# level of this file, beside \\`graph:\\` rather than inside it:\n#\n# collections:\n# - name: site\n# paths: [\"docs/**/*.md\"]\n#\n# Output of \\`manni graph build\\`.\nout: graph/graph.ttl\n\n# Map published-site routes back to source files so route-style links\n# (/docs/actions/find) become graph edges. A route may also carry the BCP-47\n# \\`language\\` labelling every document under its root; a page's own \\`lang\\`\n# frontmatter wins. Uncomment and adjust:\n# routes:\n# - basePath: /docs\n# root: docs\n# extensions: [.md, .mdx, .markdown]\n# indexFiles: [index, README]\n# - basePath: /docs/de\n# root: docs/de\n# language: de\n\n# What to derive triples from. Remove entries to opt out.\nbuild:\n derive: [frontmatter, sections, links, tags, images, code, provenance]\n\n# PROV-O settings. Git history is detected, not switched: per-file dates and\n# author agents, rename -> prov:wasRevisionOf, and the build activity's HEAD\n# committer date are derived wherever git can run over a repository, and a run\n# that cannot says so once and builds the rest. Deterministic per commit;\n# wall-clock time never enters the graph.\n# qualified: emit prov:qualifiedAttribution/qualifiedAssociation nodes\n# with roles alongside the direct properties.\nprovenance:\n qualified: true\n\n# Which fields a published graph may carry is read from x-manni-graph-output in\n# the schema set \\`manni meta validate\\` resolves for each page. Set that under\n# meta: (schemas, strict, register), not here. The default set keeps the\n# stewardship people fields (owner, stakeholders, reviewed-by) out.\n\n# SHACL shapes \\`manni graph check\\` validates the built graph against. Default:\n# the shapes contract bundled with manni (shapes/graph/shapes-1.0.0.ttl).\n# check:\n# shapes: [\"./my-shapes.ttl\"]\n\n# Metadata coverage gate for \\`manni graph stats --check\\`. A number applies to\n# every measured field; a map gates named fields only. Unset gates nothing.\n# stats:\n# coverageThreshold:\n# title: 100\n# description: 50\n\n# Which provider \\`manni graph fill\\` sends pages to. Unset, the family's\n# top-level providers: map decides, and then \\`auto\\`, which detects one: an\n# Anthropic key, then an OpenAI key, then the Claude CLI, then a local model.\n# Connection settings (apiKeyEnv, baseUrl, command) live in that map, declared\n# once for every manni tool. \\`--provider\\` wins over this, \\`--local\\` over both.\n# provider: anthropic # auto | anthropic | openai | claude-cli | llama-cpp\n# model: claude-sonnet-4-5 # the provider's default when omitted\n\n# LLM settings for \\`manni graph fill\\` (SKOS frontmatter proposals).\nfill:\n temperature: 0\n # Stop after this many inference calls. One page is one turn, and a cached\n # page spends none. Unset is unbounded.\n # maxTurns: 50\n cacheDir: .manni/graph/cache\n # fill proposes every field; confidence (0..1 per field) gates what is\n # written. Fields scored below the threshold are reported, not written.\n confidenceThreshold: 0.7\n # fields: defaults to every fillable field — uncomment to restrict.\n # Record meta-provenance (model + /graph/ pointers + confidence) on filled docs.\n writeProvenance: true\n # Reject proposals that would violate the SHACL shapes contract\n # (broader/narrower cycles, conflicting labels).\n validateGraph: true\n # Also propose per-section metadata. Off by default: it costs more output per\n # call, and section metadata is explicit-only, so review it as carefully.\n sections: false\n\n# Local embeddings for semantic search (\\`manni graph embed\\`). Needs the optional\n# peer: npm install @huggingface/transformers\n# embed:\n# model: onnx-community/granite-embedding-small-english-r2-ONNX\n# dtype: q8 # q8 keeps embedding reproducible across platforms\n# out: graph # directory for the per-language vector sidecars\n# cacheDir: .manni/graph/embed-cache\n\n# Optional enrichment for \\`manni graph export iirds\\` (the iiRDS package).\n# Absent, a minimal valid package is still produced.\n# export:\n# iirds:\n# title: My Docs # package title (default: \"manni graph export\")\n# creator: Acme Corp # Creator iirds:Party + vcard:Organization\n# version: \"1.3\" # iiRDS version literal: \"1.2\" | \"1.3\"\n`;\n\n/** The starter as a `graph:` section: every line nested one level. */\nfunction starterSection(): string {\n const body = STARTER.split(\"\\n\")\n .map((line) => (line === \"\" ? \"\" : ` ${line}`))\n .join(\"\\n\");\n return `${CONFIG_SECTION}:\\n${body}`;\n}\n\nexport async function runInit(cwd = process.cwd()): Promise<string> {\n const path = resolve(cwd, DEFAULT_CONFIG_FILENAME);\n if (!existsSync(path)) {\n await writeTextAtomic(path, `${HEADER}${starterSection()}`);\n return path;\n }\n\n // A family file is already here. Parse it to make sure a `graph:` key can be\n // appended: the document must be a mapping (or empty) without one.\n const text = readFileSync(path, \"utf8\");\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (e) {\n throw new GraphError(\n `Invalid YAML in ${DEFAULT_CONFIG_FILENAME}: ${errorMessage(e)}`,\n );\n }\n if (doc != null && (typeof doc !== \"object\" || Array.isArray(doc))) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME}: top level must be a mapping — not adding a \\`${CONFIG_SECTION}:\\` section to it.`,\n );\n }\n if (doc != null && Object.hasOwn(doc, CONFIG_SECTION)) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME} already has a \\`${CONFIG_SECTION}:\\` section — not overwriting.`,\n );\n }\n // Append as text rather than re-serialising the document, so the siblings'\n // keys and comments come out byte-for-byte as they went in.\n const separator = text === \"\" || text.endsWith(\"\\n\") ? \"\" : \"\\n\";\n const blank = text === \"\" ? \"\" : \"\\n\";\n await writeTextAtomic(\n path,\n `${text}${separator}${blank}${starterSection()}`,\n );\n return path;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACMjB,IAAM,gBAAgB,CAAC,UAAU,MAAM;AAIvC,IAAM,oBAA4B,cAAc,KAAK,KAAK;AAG1D,IAAM,gBAAgB,CAAC,GAAG,eAAe,QAAQ;AAIjD,IAAM,oBAA4B,cAAc,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AC7B,GAAG,gBAAgB,IAAI;AAAA,UACvB,OAAO,KAAK;AAAA,UACZ,QAAQ;AAAA,UACR,KAAK,KAAK;AAAA,QACZ,CAAC;AACD,mBAAW,WAAW,OAAO,SAAU,MAAK,OAAO;AACnD,gBAAQ;AAAA,UACN,SAAS,OAAO,KAAK,QAAQ,OAAO,UAAU,IAAI,KAAK,GAAG,OAAO,OAAO,OAAO;AAAA,QACjF;AAAA,MACF,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACP;","names":[]}
1
+ {"version":3,"sources":["../src/graph/cli.ts","../src/graph/reporters/index.ts","../src/graph/commands/init.ts"],"sourcesContent":["/**\n * The graph program. Named `graph` because that is where it is mounted\n * (`manni graph …`); `src/cli.ts` adds it to the umbrella and runs it.\n *\n * Grammar per proposals 0034 and 0051 §2: the domain owns verbs and has no\n * default subcommand, `-f` means the output format everywhere and is checked\n * against the verb's list, and a list reaches a flag by exactly one\n * separator. The plumbing is the family's: `fail()` from `src/shared/run.ts`,\n * `warn()` from `src/shared/warn.ts`, and `--no-color` from\n * `src/shared/color.ts`.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n readStdin,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { fail } from \"../shared/run.js\";\nimport { warn } from \"../shared/warn.js\";\nimport { GraphError } from \"./types.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport { ALL_FILL_FIELDS, type FillField } from \"./core/config.js\";\nimport {\n assertInputFormat,\n DEFAULT_EXTENSIONS,\n STDIN,\n} from \"./core/discover.js\";\nimport {\n CHECK_FORMATS,\n CHECK_FORMAT_LIST,\n GRAPH_FORMATS,\n GRAPH_FORMAT_LIST,\n type CheckFormat,\n type GraphFormat,\n} from \"./reporters/index.js\";\nimport { runBuild } from \"./commands/build.js\";\nimport { renderCheck, runCheck } from \"./commands/check.js\";\nimport {\n EXPORT_TARGETS,\n runExport,\n type ExportFormat,\n} from \"./commands/export.js\";\nimport { renderQuery, runQuery } from \"./commands/query.js\";\nimport { renderFill, runFill } from \"./commands/fill.js\";\nimport { runInit } from \"./commands/init.js\";\nimport { renderEmbed, runEmbed } from \"./commands/embed.js\";\nimport {\n renderSearch,\n runSearch,\n SEARCH_MODES,\n type SearchMode,\n} from \"./commands/search.js\";\nimport { renderStats, runStats } from \"./commands/stats.js\";\nimport { renderTraverse, runTraverse } from \"./commands/traverse.js\";\n\n/**\n * Whether `command`'s output gets colour: this domain's `--no-color` and\n * `NO_COLOR` turn it off, and otherwise only a TTY turns it on\n * (`shouldColor`). `isTTY` is passed uncoerced: Node leaves it undefined off\n * a terminal, never false, and `shouldColor` reads a missing one as \"not a\n * terminal\".\n *\n * Exported because this is where the decision is testable — a spawned bin is\n * never a TTY. graph's reporters print no colour yet; when one does, it takes\n * the boolean from here rather than consulting the environment itself.\n */\nexport function colorFor(\n command: Command,\n isTTY: boolean | undefined,\n env?: NodeJS.ProcessEnv,\n): boolean {\n // commander maps --no-color to opts.color === false, on the command that\n // declares it.\n const noColor = colorOwner(command).opts().color === false;\n return shouldColor({ noColor, isTTY, env });\n}\n\n/**\n * The nearest command, this one or an ancestor, that declares `--no-color`:\n * the `graph` program, wherever it is mounted. Not the root: under the umbrella\n * that is `manni`, which has no `--no-color` of its own.\n */\nfunction colorOwner(command: Command): Command {\n for (let c: Command | null = command; c !== null; c = c.parent) {\n if (c.options.some((o) => o.long === \"--no-color\")) return c;\n }\n return command;\n}\n\nexport function buildProgram(): Command {\nconst program = new Command();\n\nprogram\n .name(\"graph\")\n .description(\n \"Deterministic knowledge graphs derived from documentation frontmatter and formatting.\",\n )\n .version(pkg.version)\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)` — which reports a usage error as a finding.\n .exitOverride();\n\n/**\n * Parse a numeric CLI option, refusing what the config schema refuses.\n *\n * `Number.parseFloat`/`parseInt` return NaN for `abc` and silently accept\n * out-of-range values, and NaN then disables whatever gate it feeds — a cost\n * cap that never fires, a confidence gate that writes everything, a `--top`\n * that asks for a negative number of rows. The documented precedence is\n * config → Ajv → CLI override, so the override has to be held to the same range.\n */\nfunction numericOption(\n flag: string,\n { min, max, integer }: { min: number; max?: number; integer?: boolean },\n) {\n return (raw: string): number => {\n const value = Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new GraphError(`${flag} expects a number, got \"${raw}\".`);\n }\n if (integer && !Number.isInteger(value)) {\n throw new GraphError(`${flag} expects a whole number, got ${value}.`);\n }\n if (value < min || (max !== undefined && value > max)) {\n const range = max === undefined ? `>= ${min}` : `${min}..${max}`;\n throw new GraphError(`${flag} must be ${range}, got ${value}.`);\n }\n return value;\n };\n}\n\n/** A count: a whole number, at least `min` (1 unless the flag allows zero). */\nfunction countOption(flag: string, min = 1) {\n return numericOption(flag, { min, integer: true });\n}\n\n/**\n * Hold a CLI override to the same list its config key is held to.\n *\n * `fill.provider` is Ajv-validated against the schema enum; the `--provider`\n * override was an arbitrary string cast straight to `ProviderName`, so the\n * documented config → Ajv → CLI precedence had a hole at the last step.\n */\nfunction enumOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(\n `${flag} must be one of ${allowed.join(\" | \")}, got \"${raw}\".`,\n );\n }\n return raw as T;\n };\n}\n\n/**\n * A flag whose value is one of a named set, refused in the family's words:\n * `Unknown --format \"xml\". Use pretty | json.` The check runs while the\n * options are parsed, so a typo costs a message rather than a graph load.\n */\nfunction choiceOption<T extends string>(flag: string, allowed: readonly T[]) {\n return (raw: string): T => {\n if (!(allowed as readonly string[]).includes(raw)) {\n throw new GraphError(`Unknown ${flag} \"${raw}\". Use ${allowed.join(\" | \")}.`);\n }\n return raw as T;\n };\n}\n\n/** `-f, --format`: every verb's list is `pretty | json` (0051 §2). */\nconst formatOption = choiceOption(\"--format\", GRAPH_FORMATS);\n\n/** `check`'s own, which adds `github` — the CI gate's annotation format. */\nconst checkFormatOption = choiceOption(\"--format\", CHECK_FORMATS);\n\n/**\n * `--fields <list>`: comma-separated and given once, never repeatable — one\n * separator per list (proposal 0034), and the spelling `meta fill --fields`\n * already uses. Each value is held to the same list `fill.fields` is.\n */\nconst fieldsOption = (raw: string): FillField[] =>\n splitList(raw).map((value) => enumOption(\"--fields\", ALL_FILL_FIELDS)(value));\n\n/**\n * The document-set surface the verbs that read documents share (proposals\n * 0041 and 0051 §1): positional `[paths...]` with `-` for stdin,\n * `--collection` and `--exclude` (each one value per occurrence), `--as`,\n * `--ext` (comma-separated, given once), `--allow-empty`, and\n * `-c`/`--no-config`. Declared once so the verbs cannot drift apart on a name\n * or a description, and worded as `meta` and `lint` word them.\n */\nfunction documentInputs(command: Command, verb: string): Command {\n return command\n .argument(\n \"[paths...]\",\n `files, directories, or globs to ${verb} (use - for stdin)`,\n )\n .option(\n \"--collection <name>\",\n \"Configured collection to read (repeatable)\",\n collect,\n [],\n )\n .option(\"--exclude <glob>\", \"Glob to exclude (repeatable)\", collect, [])\n .option(\n \"--as <format>\",\n \"Parse every input as asciidoc, html, markdown, mdx, rst or xml, whatever its extension. Required with -.\",\n )\n .option(\n \"--ext <list>\",\n \"comma-separated extensions for directory walks\",\n DEFAULT_EXTENSIONS.join(\",\"),\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/** The input flags as commander hands them over. */\ninterface InputFlags {\n as?: string;\n ext: string;\n allowEmpty?: boolean;\n}\n\n/**\n * The input flags for a core, and stdin when `paths` holds `-`. `--as` is\n * checked first, so `-` without it is refused before anything waits on stdin.\n */\nasync function inputOptions(\n paths: string[],\n opts: InputFlags,\n): Promise<{\n as?: string;\n ext: string[];\n allowEmpty?: boolean;\n stdinContent?: string;\n}> {\n assertInputFormat(paths, opts.as);\n return {\n ...(opts.as === undefined ? {} : { as: opts.as }),\n ext: splitList(opts.ext),\n ...(opts.allowEmpty === true ? { allowEmpty: true } : {}),\n ...(paths.includes(STDIN) ? { stdinContent: await readStdin() } : {}),\n };\n}\n\n/**\n * `-c`/`--no-config` for a verb that reads a built graph rather than a\n * document set. They share one commander attribute, which `configOption`\n * splits.\n */\nfunction configInputs(command: Command): Command {\n return command\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n}\n\n/**\n * `opts` minus the one attribute `-c` and `--no-config` share. `documentOptions`\n * restates it as the two fields a core reads, and spreading the raw value over\n * them would put commander's `false` back where a path belongs.\n */\nfunction rest<T extends { config?: string | boolean }>(\n opts: T,\n): Omit<T, \"config\"> {\n const { config, ...others } = opts;\n return others;\n}\n\n/** The shared options as the command cores take them. */\nfunction documentOptions(opts: {\n collection?: string[];\n exclude?: string[];\n config?: string | boolean;\n}): {\n config?: string;\n noConfig?: boolean;\n collection?: string[];\n exclude?: string[];\n} {\n const { configPath, noConfig } = configOption(opts.config);\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n ...(opts.exclude === undefined ? {} : { exclude: opts.exclude }),\n };\n}\n\nprogram\n .command(\"init\")\n .description(\"Add a starter `graph:` section to manni.config.yaml in the current directory\")\n .action(async () => {\n try {\n console.log(`Created ${await runInit()}`);\n } catch (e) {\n fail(e);\n }\n });\n\ndocumentInputs(\n program\n .command(\"build\")\n .description(\"Derive the knowledge graph and write deterministic Turtle\"),\n \"build\",\n)\n .option(\"-o, --out <path>\", \"Output .ttl path (default: config out)\")\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n out?: string;\n }) => {\n try {\n const result = await runBuild({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n out: opts.out,\n });\n // Warnings go to stderr so stdout stays the machine-readable summary;\n // a degraded build is still a successful one, so the exit code is 0.\n for (const warning of result.warnings) warn(warning);\n console.log(\n `Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples)`,\n );\n } catch (e) {\n fail(e);\n }\n });\n\nconfigInputs(\n program\n .command(\"check\")\n .description(\n \"Validate the built graph against the bundled SHACL shapes (errors exit 1)\",\n ),\n)\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n // One path per occurrence, never split on commas: a path may hold one.\n .option(\n \"--shapes <path>\",\n \"Shapes .ttl file; repeatable (default: config check.shapes, then bundled)\",\n collect,\n [],\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${CHECK_FORMAT_LIST}`,\n checkFormatOption,\n \"pretty\",\n )\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n shapes: string[];\n format: CheckFormat;\n }) => {\n try {\n const report = await runCheck({ ...rest(opts), ...documentOptions(opts) });\n console.log(renderCheck(report, opts.format));\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\ndocumentInputs(\n program\n .command(\"fill\")\n .description(\n \"Propose `graph:` frontmatter fields with an LLM, gated by confidence, and write them back\",\n ),\n \"fill\",\n)\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\"--dry-run\", \"Report proposals without writing files\")\n .option(\"--force\", \"Overwrite human-set graph fields\")\n .option(\"--no-cache\", \"Bypass the proposal cache\")\n .option(\"--no-validate-graph\", \"Skip the SHACL graph guardrail on proposals\")\n .option(\"--sections\", \"Also propose per-section metadata\")\n .option(\n \"--max-turns <n>\",\n \"Stop after this many inference calls (a cached page costs none)\",\n countOption(\"--max-turns\"),\n )\n .option(\n \"--confidence <n>\",\n \"Minimum model confidence (0..1) to write a field (default: config, 0.7)\",\n numericOption(\"--confidence\", { min: 0, max: 1 }),\n )\n .option(\n // Comma-separated and given once: one separator per list (proposal 0034).\n \"--fields <list>\",\n `Fields to propose (comma-separated; default: config, then every field)`,\n fieldsOption,\n )\n // The nameable providers, and `auto`. `mock` is the library's test double:\n // accepted when asked for by name, never offered.\n .option(\n \"--provider <name>\",\n \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\",\n )\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n // Typed inline, as every other action in this file is. The option parsers\n // above (`numericOption`, `choiceOption`, `fieldsOption`) have already thrown\n // on anything malformed by the time this runs, so a cast per field would be\n // safe — but it would also be the one command with the most options and the\n // least help from the compiler.\n .action(async (paths: string[], opts: InputFlags & {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n dryRun?: boolean;\n force?: boolean;\n cache?: boolean;\n validateGraph?: boolean;\n sections?: boolean;\n maxTurns?: number;\n confidence?: number;\n fields?: FillField[];\n provider?: string;\n model?: string;\n local?: boolean;\n format: GraphFormat;\n }) => {\n try {\n const report = await runFill({\n paths,\n ...documentOptions(opts),\n ...(await inputOptions(paths, opts)),\n dryRun: opts.dryRun,\n force: opts.force,\n noCache: opts.cache === false,\n noValidateGraph: opts.validateGraph === false,\n sections: opts.sections,\n maxTurns: opts.maxTurns,\n confidence: opts.confidence,\n fields: opts.fields,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n // Same channel discipline as build: warnings on stderr, so stdout stays\n // the report, and a warning never changes the exit code.\n for (const warning of report.warnings) warn(warning);\n const rendered = renderFill(report, opts.format);\n if (paths.includes(STDIN)) {\n // With `-` the filled document owns stdout, as under `meta fill -`,\n // and the report in either format is a diagnostic on stderr.\n if (report.stdinDocument !== undefined) {\n process.stdout.write(report.stdinDocument);\n }\n if (rendered.length > 0) process.stderr.write(`${rendered}\\n`);\n } else {\n console.log(rendered);\n }\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\nprogram\n .command(\"query\")\n .description(\n \"Match triple patterns against the built graph (omit a term for wildcard)\",\n )\n // Long-only, and named for the triple position each one fills. `-o` is\n // `--out` on every other graph verb and `-s` is meta's schema flag; a\n // one-letter spelling that means two things in one family costs more than\n // the letters it saves.\n .option(\"--subject <term>\", \"Subject IRI or prefixed name\")\n .option(\"--predicate <term>\", \"Predicate IRI or prefixed name\")\n .option(\"--object <term>\", \"Object IRI, prefixed name, or literal value\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n (opts: {\n subject?: string;\n predicate?: string;\n object?: string;\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n }) => {\n try {\n const { subject, predicate, object, ...others } = rest(opts);\n const result = runQuery({\n ...others,\n ...documentOptions(opts),\n ...(subject === undefined ? {} : { s: subject }),\n ...(predicate === undefined ? {} : { p: predicate }),\n ...(object === undefined ? {} : { o: object }),\n });\n console.log(renderQuery(result, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"stats\")\n .description(\n \"Summarize the built graph: counts, orphans, broken links, hubs, metadata coverage\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .option(\n \"--check\",\n \"Exit 1 when broken internal links exist or coverage is below threshold\",\n )\n .option(\n \"--top <n>\",\n \"How many most-connected docs to list\",\n countOption(\"--top\"),\n )\n .option(\n \"--coverage-threshold <pct>\",\n \"Minimum metadata coverage % (all fields); overrides config for this run\",\n // A percentage, so 0..100 rather than the 0..1 of a confidence. NaN here is\n // worse than a wrong number: `pct < NaN` is false for every field, so the\n // gate this flag exists to tighten would silently pass instead.\n numericOption(\"--coverage-threshold\", { min: 0, max: 100 }),\n )\n .action(\n (opts: {\n config?: string | boolean;\n graph?: string;\n format: GraphFormat;\n check?: boolean;\n top?: number;\n coverageThreshold?: number;\n }) => {\n try {\n const report = runStats({ ...rest(opts), ...documentOptions(opts) });\n console.log(renderStats(report, opts.format));\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"search\")\n .description(\"Rank graph nodes for a text query (needs `export search`)\")\n .argument(\"<query>\", \"Text query\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"--lang <tag>\",\n \"Which localization to search (required when the corpus has more than one)\",\n )\n .option(\"--limit <n>\", \"Maximum results (default 10)\", countOption(\"--limit\"))\n .option(\n \"--vectors <path>\",\n \"Vector sidecar path (default: from the manifest)\",\n )\n .option(\n \"--mode <mode>\",\n `Which legs to run: ${SEARCH_MODES.join(\" | \")} (default: hybrid when vectors exist)`,\n choiceOption(\"--mode\", SEARCH_MODES),\n )\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (\n query: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n lang?: string;\n limit?: number;\n vectors?: string;\n mode?: SearchMode;\n format: GraphFormat;\n },\n ) => {\n try {\n const report = await runSearch({\n ...rest(opts),\n ...documentOptions(opts),\n query,\n });\n console.log(renderSearch(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"traverse\")\n .description(\n \"Walk the graph from a node, honoring scope rules, with the full trace\",\n )\n .argument(\"<node>\", \"Starting node: a full IRI or a prefix:local CURIE\")\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-d, --depth <n>\",\n \"Maximum hops from the node (default 1; 3 under --impact)\",\n // Zero is allowed: it means the node itself, which is a real answer.\n countOption(\"--depth\", 0),\n )\n // Comma-separated and given once: a CURIE holds no comma, so one separator\n // is enough, and a second spelling would be a second thing to document.\n .option(\n \"--predicates <list>\",\n \"Only follow these predicates (comma-separated)\",\n )\n .option(\"--reverse\", \"Follow inbound edges (who points at this node)\")\n .option(\"--impact\", \"Transitive inbound reach: what a change here affects\")\n .option(\n \"--variant <variant>\",\n \"Scope filter: product variant IRI, title, or slug\",\n )\n // Not `--subject`: on `query` that is a triple's subject, and one flag name\n // means one thing across the domain.\n .option(\"--software-subject <subject>\", \"Scope filter: software subject\")\n .option(\"--lang <tag>\", \"Scope filter: BCP-47 language tag, matched in any case\")\n .option(\"--limit <n>\", \"Stop after this many nodes\", countOption(\"--limit\"))\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n (\n node: string,\n opts: {\n config?: string | boolean;\n graph?: string;\n depth?: number;\n predicates?: string;\n reverse?: boolean;\n impact?: boolean;\n variant?: string;\n softwareSubject?: string;\n lang?: string;\n limit?: number;\n format: GraphFormat;\n },\n ) => {\n try {\n const { softwareSubject, ...others } = rest(opts);\n const report = runTraverse({\n ...others,\n ...documentOptions(opts),\n ...(softwareSubject === undefined ? {} : { subject: softwareSubject }),\n node,\n predicates:\n opts.predicates === undefined\n ? undefined\n : splitList(opts.predicates),\n });\n console.log(renderTraverse(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"embed\")\n .description(\n \"Compute local embeddings for the search index (needs @huggingface/transformers)\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-i, --index <dir>\",\n \"Directory holding the indexes and manifest (default: beside the graph)\",\n )\n .option(\n \"-o, --out <dir>\",\n \"Directory for the sidecars (default: the index directory)\",\n )\n // Not `--model`: on `fill` that is the inference model, a different thing.\n .option(\n \"--embedding-model <id>\",\n \"Embedding model id (any id; `mock` for offline runs)\",\n )\n .option(\"--dtype <dtype>\", \"Weight quantization (default q8)\")\n .option(\"--no-cache\", \"Ignore the vector cache\")\n .option(\n \"-f, --format <format>\",\n `Output: ${GRAPH_FORMAT_LIST}`,\n formatOption,\n \"pretty\",\n )\n .action(\n async (opts: {\n config?: string | boolean;\n graph?: string;\n index?: string;\n out?: string;\n embeddingModel?: string;\n dtype?: string;\n cache?: boolean;\n format: GraphFormat;\n }) => {\n try {\n const { embeddingModel, ...others } = rest(opts);\n const report = await runEmbed({\n ...others,\n ...documentOptions(opts),\n ...(embeddingModel === undefined ? {} : { model: embeddingModel }),\n noCache: opts.cache === false,\n });\n console.log(renderEmbed(report, opts.format));\n } catch (e) {\n fail(e);\n }\n },\n );\n\nprogram\n .command(\"export\")\n .description(\n \"Reserialize the built graph into a consumer format (jsonld file, iirds package, or search index)\",\n )\n // The target is a positional, not `-f`: `-f` is the output format in every\n // other verb of the family (0051 §2), and one flag cannot mean two things.\n .argument(\"<target>\", `What to write: ${EXPORT_TARGETS.join(\" | \")}`)\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\")\n .option(\"-g, --graph <path>\", \"Graph .ttl path (default: config out)\")\n .option(\n \"-o, --out <path>\",\n \"Output path (default: the graph path with the target's extension)\",\n )\n .action(\n async (\n target: string,\n opts: { config?: string | boolean; graph?: string; out?: string },\n ) => {\n try {\n if (!(EXPORT_TARGETS as readonly string[]).includes(target)) {\n throw new GraphError(\n `Unknown export target \"${target}\". Use ${EXPORT_TARGETS.join(\" | \")}.`,\n );\n }\n const result = await runExport({\n ...documentOptions(opts),\n graph: opts.graph,\n format: target as ExportFormat,\n out: opts.out,\n });\n for (const warning of result.warnings) warn(warning);\n console.log(\n `Wrote ${result.nodes} node${result.nodes === 1 ? \"\" : \"s\"} to ${result.outPath}`,\n );\n } catch (e) {\n fail(e);\n }\n },\n );\n\nreturn program;\n}\n","/**\n * What `-f` accepts, per verb.\n *\n * Each verb's renderer lives beside its command core (`renderCheck`,\n * `renderStats`, …); what belongs here is the *list*, stated once so the\n * union, the guard, the help text and the refusal sentence cannot drift\n * apart. It is the same shape a11y and cite keep (`A11Y_FORMATS`,\n * `REPORT_FORMATS`), which is why the sentence a user reads is the family's.\n *\n * Every verb takes `pretty | json`. `check` also takes `github`, because it is\n * the CI gate: it is the one graph verb whose output changes what a reviewer sees\n * on a pull request (proposal 0051 §2). It names its own list here rather than\n * widening the shared one, so no other verb advertises a format it cannot\n * render.\n */\n\n/** The list every graph verb's `-f` accepts, in the order messages list them. */\nexport const GRAPH_FORMATS = [\"pretty\", \"json\"] as const;\nexport type GraphFormat = (typeof GRAPH_FORMATS)[number];\n\n/** `\"pretty | json\"`, for help text and the refusal sentence. */\nexport const GRAPH_FORMAT_LIST: string = GRAPH_FORMATS.join(\" | \");\n\n/** `check`'s list: the shared two plus the CI annotation format. */\nexport const CHECK_FORMATS = [...GRAPH_FORMATS, \"github\"] as const;\nexport type CheckFormat = (typeof CHECK_FORMATS)[number];\n\n/** `\"pretty | json | github\"`, for help text and the refusal sentence. */\nexport const CHECK_FORMAT_LIST: string = CHECK_FORMATS.join(\" | \");\n","/**\n * `manni graph init` — scaffold a starter `graph:` section in manni.config.yaml.\n *\n * The family file is shared with the other tools, so a file that already\n * exists is not overwritten: the section is appended to it, leaving the\n * siblings' keys and comments exactly as they were. A file that already has a\n * `graph:` key is refused.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { writeTextAtomic } from \"../../shared/write-file.js\";\nimport { GraphError } from \"../types.js\";\nimport { CONFIG_SECTION, DEFAULT_CONFIG_FILENAME } from \"../core/config.js\";\n\nconst HEADER = `# manni.config.yaml — shared configuration for the manni family of tools.\n# Each tool reads its own top-level key; manni graph reads \"graph:\".\n`;\n\nconst STARTER = `# Base IRI for every minted node. Set this to a namespace you control;\n# without it, IRIs fall back to the urn:manni:graph: placeholder.\n# baseIri: https://example.com/graph/\n\n# There is no document set here. \\`manni graph build\\` and \\`manni graph fill\\` read the\n# paths you name, or the collections declared once for every tool at the TOP\n# level of this file, beside \\`graph:\\` rather than inside it:\n#\n# collections:\n# - name: site\n# paths: [\"docs/**/*.md\"]\n#\n# Output of \\`manni graph build\\`.\nout: graph/graph.ttl\n\n# Map published-site routes back to source files so route-style links\n# (/docs/actions/find) become graph edges. A route may also carry the BCP-47\n# \\`language\\` labelling every document under its root; a page's own \\`lang\\`\n# frontmatter wins. Uncomment and adjust:\n# routes:\n# - basePath: /docs\n# root: docs\n# extensions: [.md, .mdx, .markdown]\n# indexFiles: [index, README]\n# - basePath: /docs/de\n# root: docs/de\n# language: de\n\n# What to derive triples from. Remove entries to opt out.\nbuild:\n derive: [frontmatter, sections, links, tags, images, code, provenance]\n\n# PROV-O settings. Git history is detected, not switched: per-file dates and\n# author agents, rename -> prov:wasRevisionOf, and the build activity's HEAD\n# committer date are derived wherever git can run over a repository, and a run\n# that cannot says so once and builds the rest. Deterministic per commit;\n# wall-clock time never enters the graph.\n# qualified: emit prov:qualifiedAttribution/qualifiedAssociation nodes\n# with roles alongside the direct properties.\nprovenance:\n qualified: true\n\n# Which fields a published graph may carry is read from x-manni-graph-output in\n# the schema set \\`manni meta validate\\` resolves for each page. Set that under\n# meta: (schemas, strict, register), not here. The default set keeps the\n# stewardship people fields (owner, stakeholders, reviewed-by) out.\n\n# SHACL shapes \\`manni graph check\\` validates the built graph against. Default:\n# the shapes contract bundled with manni (shapes/graph/shapes-1.0.0.ttl).\n# check:\n# shapes: [\"./my-shapes.ttl\"]\n\n# Metadata coverage gate for \\`manni graph stats --check\\`. A number applies to\n# every measured field; a map gates named fields only. Unset gates nothing.\n# stats:\n# coverageThreshold:\n# title: 100\n# description: 50\n\n# Which provider \\`manni graph fill\\` sends pages to. Unset, the family's\n# top-level providers: map decides, and then \\`auto\\`, which detects one: an\n# Anthropic key, then an OpenAI key, then the Claude CLI, then a local model.\n# Connection settings (apiKeyEnv, baseUrl, command) live in that map, declared\n# once for every manni tool. \\`--provider\\` wins over this, \\`--local\\` over both.\n# provider: anthropic # auto | anthropic | openai | claude-cli | llama-cpp\n# model: claude-sonnet-4-5 # the provider's default when omitted\n\n# LLM settings for \\`manni graph fill\\` (SKOS frontmatter proposals).\nfill:\n temperature: 0\n # Stop after this many inference calls. One page is one turn, and a cached\n # page spends none. Unset is unbounded.\n # maxTurns: 50\n cacheDir: .manni/graph/cache\n # fill proposes every field; confidence (0..1 per field) gates what is\n # written. Fields scored below the threshold are reported, not written.\n confidenceThreshold: 0.7\n # fields: defaults to every fillable field — uncomment to restrict.\n # Record meta-provenance (model + /graph/ pointers + confidence) on filled docs.\n writeProvenance: true\n # Reject proposals that would violate the SHACL shapes contract\n # (broader/narrower cycles, conflicting labels).\n validateGraph: true\n # Also propose per-section metadata. Off by default: it costs more output per\n # call, and section metadata is explicit-only, so review it as carefully.\n sections: false\n\n# Local embeddings for semantic search (\\`manni graph embed\\`). Needs the optional\n# peer: npm install @huggingface/transformers\n# embed:\n# model: onnx-community/granite-embedding-small-english-r2-ONNX\n# dtype: q8 # q8 keeps embedding reproducible across platforms\n# out: graph # directory for the per-language vector sidecars\n# cacheDir: .manni/graph/embed-cache\n\n# Optional enrichment for \\`manni graph export iirds\\` (the iiRDS package).\n# Absent, a minimal valid package is still produced.\n# export:\n# iirds:\n# title: My Docs # package title (default: \"manni graph export\")\n# creator: Acme Corp # Creator iirds:Party + vcard:Organization\n# version: \"1.3\" # iiRDS version literal: \"1.2\" | \"1.3\"\n`;\n\n/** The starter as a `graph:` section: every line nested one level. */\nfunction starterSection(): string {\n const body = STARTER.split(\"\\n\")\n .map((line) => (line === \"\" ? \"\" : ` ${line}`))\n .join(\"\\n\");\n return `${CONFIG_SECTION}:\\n${body}`;\n}\n\nexport async function runInit(cwd = process.cwd()): Promise<string> {\n const path = resolve(cwd, DEFAULT_CONFIG_FILENAME);\n if (!existsSync(path)) {\n await writeTextAtomic(path, `${HEADER}${starterSection()}`);\n return path;\n }\n\n // A family file is already here. Parse it to make sure a `graph:` key can be\n // appended: the document must be a mapping (or empty) without one.\n const text = readFileSync(path, \"utf8\");\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (e) {\n throw new GraphError(\n `Invalid YAML in ${DEFAULT_CONFIG_FILENAME}: ${errorMessage(e)}`,\n );\n }\n if (doc != null && (typeof doc !== \"object\" || Array.isArray(doc))) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME}: top level must be a mapping — not adding a \\`${CONFIG_SECTION}:\\` section to it.`,\n );\n }\n if (doc != null && Object.hasOwn(doc, CONFIG_SECTION)) {\n throw new GraphError(\n `${DEFAULT_CONFIG_FILENAME} already has a \\`${CONFIG_SECTION}:\\` section — not overwriting.`,\n );\n }\n // Append as text rather than re-serialising the document, so the siblings'\n // keys and comments come out byte-for-byte as they went in.\n const separator = text === \"\" || text.endsWith(\"\\n\") ? \"\" : \"\\n\";\n const blank = text === \"\" ? \"\" : \"\\n\";\n await writeTextAtomic(\n path,\n `${text}${separator}${blank}${starterSection()}`,\n );\n return path;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACMjB,IAAM,gBAAg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AAC3D,gBAAM,IAAI;AAAA,YACR,0BAA0B,MAAM,UAAU,eAAe,KAAK,KAAK,CAAC;AAAA,UACtE;AAAA,QACF;AACA,cAAM,SAAS,MAAM,UAAU;AAAA,UAC7B,GAAG,gBAAgB,IAAI;AAAA,UACvB,OAAO,KAAK;AAAA,UACZ,QAAQ;AAAA,UACR,KAAK,KAAK;AAAA,QACZ,CAAC;AACD,mBAAW,WAAW,OAAO,SAAU,MAAK,OAAO;AACnD,gBAAQ;AAAA,UACN,SAAS,OAAO,KAAK,QAAQ,OAAO,UAAU,IAAI,KAAK,GAAG,OAAO,OAAO,OAAO;AAAA,QACjF;AAAA,MACF,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACP;","names":[]}
@@ -3,26 +3,26 @@ import {
3
3
  runAdd,
4
4
  runRemove,
5
5
  runUpdate
6
- } from "./chunk-7ZUCEMCY.js";
6
+ } from "./chunk-IY7NYNPZ.js";
7
7
  import {
8
8
  runCheck
9
- } from "./chunk-JQU7FHYH.js";
9
+ } from "./chunk-QW77LCOU.js";
10
10
  import {
11
11
  findingMessage,
12
12
  renderCheckGithub
13
- } from "./chunk-XWFNO5PO.js";
13
+ } from "./chunk-GAJIJKET.js";
14
14
  import {
15
15
  renderCheckPretty,
16
16
  renderRemovePretty,
17
17
  renderUpdatePretty
18
- } from "./chunk-NGK3N6F2.js";
18
+ } from "./chunk-T6SYGLWR.js";
19
19
  import {
20
20
  errorSite,
21
21
  shortCommit,
22
22
  shortLine,
23
23
  shortPin,
24
24
  shortSrc
25
- } from "./chunk-TA42STP7.js";
25
+ } from "./chunk-UAKNZVCD.js";
26
26
  import {
27
27
  renderCheckJson,
28
28
  renderRemoveJson,
@@ -35,25 +35,21 @@ import {
35
35
  asCiteError,
36
36
  isCiteRule,
37
37
  spellSource
38
- } from "./chunk-UK2I3ACY.js";
38
+ } from "./chunk-MHM4QEBV.js";
39
39
  import "./chunk-IKEWBMCN.js";
40
- import "./chunk-TU2WUBVZ.js";
41
- import "./chunk-TVIX653Q.js";
40
+ import "./chunk-TLXE7LYK.js";
42
41
  import {
43
42
  terminalConfirm
44
- } from "./chunk-QCBICNKC.js";
45
- import "./chunk-3YHAYXBC.js";
43
+ } from "./chunk-GREQKO6M.js";
46
44
  import {
47
45
  collect,
48
46
  configOption,
49
47
  explicitFalse,
50
48
  readStdin,
51
49
  reportConfig,
52
- splitList
53
- } from "./chunk-NAZRLJAK.js";
54
- import {
50
+ splitList,
55
51
  splitPageArgument
56
- } from "./chunk-HVFR66GQ.js";
52
+ } from "./chunk-TUAAR3MM.js";
57
53
  import {
58
54
  COMMON_FORMAT_LIST,
59
55
  OMITTED_WHEN_CLEAN,
@@ -63,10 +59,10 @@ import {
63
59
  isReportFormat,
64
60
  renderJunit,
65
61
  renderSarif
66
- } from "./chunk-TCC737IS.js";
62
+ } from "./chunk-5G53XATW.js";
67
63
  import {
68
64
  STDIN_TOKEN
69
- } from "./chunk-527HHQPS.js";
65
+ } from "./chunk-KCOFEWV5.js";
70
66
  import {
71
67
  fail
72
68
  } from "./chunk-YEUYKR62.js";
@@ -74,12 +70,14 @@ import {
74
70
  shouldColor
75
71
  } from "./chunk-RNVYGWIC.js";
76
72
  import "./chunk-MNH7QO4Z.js";
73
+ import "./chunk-XKBEHKWO.js";
77
74
  import {
78
75
  notice
79
- } from "./chunk-Q35YIDBV.js";
76
+ } from "./chunk-HX44GB4Z.js";
77
+ import "./chunk-QCHVR4ZM.js";
80
78
  import {
81
79
  package_default
82
- } from "./chunk-6XTQDFGP.js";
80
+ } from "./chunk-PCFG7E6B.js";
83
81
  import "./chunk-OWBRDNRZ.js";
84
82
  import "./chunk-G3T47CFV.js";
85
83
  import "./chunk-2H7UOFLK.js";
@@ -549,4 +547,4 @@ export {
549
547
  colorFor,
550
548
  splitPageArgument2 as splitPageArgument
551
549
  };
552
- //# sourceMappingURL=cli-6PGVHP7Y.js.map
550
+ //# sourceMappingURL=cli-LUCSGTVI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cite/cli.ts","../src/cite/reporters/sarif.ts","../src/cite/reporters/junit.ts"],"sourcesContent":["/**\n * The `cite` domain's commander program. Mounted by `src/cli.ts` under\n * `manni cite`; no entry point of its own. Grammar per proposal 0034: verbs are\n * `check`, `add`, `update`, `remove`; there is no default subcommand.\n *\n * Follows clig.dev as meta's does: primary output to stdout, diagnostics to\n * stderr, colour only on a TTY and never under `NO_COLOR`/`--no-color`, exit\n * `0` clean, `1` an error-severity finding, `2` operational/usage.\n */\nimport { Command, Option } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n explicitFalse,\n readStdin,\n reportConfig,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { splitPageArgument as splitSharedPageArgument } from \"../shared/pin.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport {\n COMMON_FORMAT_LIST,\n OMITTED_WHEN_CLEAN,\n REPORT_FORMAT_LIST,\n STDIN_TOKEN,\n isMachineFormat,\n} from \"../meta/internal.js\";\nimport { REPORT_FORMATS, isReportFormat } from \"../meta/index.js\";\nimport { runAdd } from \"./commands/add.js\";\nimport { runCheck } from \"./commands/check.js\";\nimport { runRemove } from \"./commands/remove.js\";\nimport { runUpdate } from \"./commands/update.js\";\nimport { CiteError, asCiteError } from \"./errors.js\";\nimport { spellSource } from \"./core/range.js\";\nimport { shortCommit, shortLine, shortPin, shortSrc } from \"./core/spell.js\";\nimport { renderCheckGithub } from \"./reporters/github.js\";\nimport { renderCheckJson, renderRemoveJson, renderUpdateJson } from \"./reporters/json.js\";\nimport { renderCheckJunit } from \"./reporters/junit.js\";\nimport { renderCheckPretty, renderRemovePretty, renderUpdatePretty } from \"./reporters/pretty.js\";\nimport { renderCheckSarif } from \"./reporters/sarif.js\";\nimport type { AddResult, PageLines } from \"./types.js\";\n\nconst UPDATE_FORMATS = [\"pretty\", \"json\"] as const;\ntype UpdateFormat = (typeof UPDATE_FORMATS)[number];\n/** The same two `update` has: a removal is a write, and writes report alike. */\nconst REMOVE_FORMATS = UPDATE_FORMATS;\ntype RemoveFormat = UpdateFormat;\n\n/**\n * Whether `command`'s output gets colour: this domain's `--no-color` and\n * `NO_COLOR` turn it off, and otherwise only a TTY turns it on\n * (`shouldColor`). `isTTY` is passed uncoerced: Node leaves it undefined off\n * a terminal, never false, and `shouldColor` reads a missing one as \"not a\n * terminal\".\n */\nexport function colorFor(\n command: Command,\n isTTY: boolean | undefined,\n env?: NodeJS.ProcessEnv,\n): boolean {\n // commander maps --no-color to opts.color === false, on the command that\n // declares it.\n const noColor = colorOwner(command).opts().color === false;\n return shouldColor({ noColor, isTTY, env });\n}\n\n/**\n * The nearest command, this one or an ancestor, that declares `--no-color`:\n * the `cite` program, wherever it is mounted. Not the root: under the\n * umbrella that is `manni`, which has no `--no-color` of its own.\n */\nfunction colorOwner(command: Command): Command {\n for (let c: Command | null = command; c !== null; c = c.parent) {\n if (c.options.some((o) => o.long === \"--no-color\")) return c;\n }\n return command;\n}\n\nfunction isUpdateFormat(value: string): value is UpdateFormat {\n return (UPDATE_FORMATS as readonly string[]).includes(value);\n}\n\nfunction isRemoveFormat(value: string): value is RemoveFormat {\n return (REMOVE_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * Commander hands an `.action()` callback an untyped bag of option values, so\n * each subcommand declares the shape it actually reads. The `--no-<thing>`\n * flags are `boolean` and never `undefined`: commander supplies `true` when\n * the flag is absent, which is its default and not a choice, so only the\n * explicit `false` travels to the core (`explicitFalse`).\n */\ninterface InputCliOptions {\n /** `--collection <name>`, repeatable; commander's default value is `[]`. */\n collection: string[];\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable; commander's default value is `[]`. */\n exclude: string[];\n /** `--as <format>`: force an extractor. */\n as?: string;\n /**\n * `-c, --config <path>` and `--no-config` share one commander attribute:\n * `undefined` with neither flag, the path with `-c`, `false` with\n * `--no-config`. Split by `configOption`.\n */\n config?: string | boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n gitignore: boolean;\n /** `--root <dir>`: where `src:` paths resolve from. */\n root?: string;\n}\n\ninterface CheckCliOptions extends InputCliOptions {\n /** `-f, --format <format>`. Always a string: the declaration has a default. */\n format: string;\n quiet?: boolean;\n /**\n * `--baseline [path]` / `--no-baseline`, the same three-state split as\n * `config`: absent leaves the config in charge, a string names a file, `true`\n * is a bare `--baseline` (the default path), `false` is `--no-baseline`.\n */\n baseline?: string | boolean;\n /** `--write-baseline [path]`; `true` for the bare flag. */\n writeBaseline?: string | boolean;\n /** `--no-check-sources`. */\n checkSources: boolean;\n showDiff?: boolean;\n reveal?: boolean;\n}\n\ninterface AddCliOptions {\n id?: string;\n marker?: boolean;\n quote?: boolean;\n /** `--encrypt`. */\n encrypt?: boolean;\n /** `--no-commit-sha`. */\n commitSha: boolean;\n dryRun?: boolean;\n as?: string;\n root?: string;\n config?: string | boolean;\n}\n\ninterface RemoveCliOptions extends Omit<InputCliOptions, \"root\"> {\n /** `--only <id>`, repeatable; commander's default value is `[]`. */\n only: string[];\n dryRun?: boolean;\n format: string;\n}\n\ninterface UpdateCliOptions extends InputCliOptions {\n /** `--no-check-sources`: declared so the refusal names the flag rather than commander rejecting it. */\n checkSources: boolean;\n accept?: boolean;\n recommit?: boolean;\n /** `--only <id>`, repeatable; commander's default value is `[]`. */\n only: string[];\n dryRun?: boolean;\n format: string;\n}\n\n/**\n * Split `docs/limits.md:9` or `docs/limits.md:14-18` into the page and the\n * claim's lines, under cite's error contract. The parsing is the shared pin\n * engine's (`splitPageArgument` in `src/shared/pin.ts`).\n */\nexport function splitPageArgument(arg: string): { page: string; lines?: PageLines } {\n return asCiteError(() => splitSharedPageArgument(arg));\n}\n\n/** `line 9`, or `lines 14-18` for a range. */\nfunction spellAt(lines: PageLines, noun = \"line\"): string {\n return lines.start === lines.end\n ? `${noun} ${String(lines.start)}`\n : `${noun}s ${String(lines.start)}-${String(lines.end)}`;\n}\n\n/**\n * What `add` says on success. One sentence composed from the result: what was\n * added, where it went, and what each end is pinned to. Lines are the page's\n * own, after the write. The source is spelled as it was written to the page,\n * abbreviated when it is a ciphertext, and quoted with its first pinned line\n * where the result carries one.\n */\nexport function addMessage(result: AddResult): string {\n const { citation, claimLines } = result;\n const claim = citation.claim;\n const name = citation.id ?? (claim === undefined ? \"a bare pin\" : \"an entry\");\n const src = shortSrc(spellSource(citation.source));\n const commit = citation.source[\"commit-sha\"];\n const quoted = result.sourceLine === undefined ? \"\" : shortLine(result.sourceLine);\n const line = quoted === \"\" ? \"\" : ` \"${quoted}\"`;\n const pin = `${src}${line}, ${shortPin(citation.source.integrity)}, ${commit === undefined ? \"no commit\" : shortCommit(commit)}`;\n // Where it went: the page's own frontmatter, or the manifest that owns the\n // page's citations, at the line the entry now sits on.\n const where =\n result.manifest === undefined\n ? \"frontmatter\"\n : `${result.manifest.file}:${String(result.manifest.line)}`;\n const head = `${result.file}: added ${name} to ${where}`;\n\n if (result.markerLine !== undefined) {\n const at =\n claimLines === undefined ? \"\" : `, claim pinned at ${spellAt(claimLines)}`;\n const wrote = result.markerJoined === true ? \"joined the marker at line\" : \"marker at line\";\n const marked = `${head}; ${wrote} ${String(result.markerLine)}${at}`;\n if (claim === undefined) return marked;\n if (citation.quote === true) return `${marked} (a block that reproduces ${src})`;\n return `${marked} (${shortPin(claim.integrity)}; source ${pin})`;\n }\n if (claim === undefined || claimLines === undefined) {\n return `${head} (source ${pin})`;\n }\n if (citation.quote === true) {\n return `${head} (claim ${spellAt(claimLines, \"line\")}, a block that reproduces ${src})`;\n }\n return `${head} (claim at ${spellAt(claimLines)}, ${shortPin(claim.integrity)}; source ${pin})`;\n}\n\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"cite\")\n .description(\n \"Track citations from doc claims to source lines and check them for drift.\",\n )\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)`.\n .exitOverride();\n\n program\n .command(\"check\")\n .description(\"Check every citation in the given pages against its source\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to check (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\n \"-f, --format <format>\",\n `output: ${REPORT_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"-q, --quiet\", \"in pretty output, hide current citations and clean files\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"check files .gitignore covers\")\n // No `defaultValue` and no `.preset()`, for the reasons meta's validate\n // gives: a bare flag must stay distinguishable from a typed path.\n .addOption(\n new Option(\n \"--baseline [path]\",\n \"compare against a baseline; fail only on findings not in it\",\n ),\n )\n .addOption(\n new Option(\n \"--write-baseline [path]\",\n \"record current findings as the baseline, then exit 0\",\n ),\n )\n .option(\"--no-baseline\", \"ignore a baseline configured by `baseline:`\")\n .option(\"--no-check-sources\", \"page-side rules only; every source status is skipped\")\n .option(\n \"--root <dir>\",\n \"directory src: paths resolve from (default: cite.root from config, else the git root, else the current directory)\",\n )\n .option(\"--show-diff\", \"in pretty output, print the diff and commit subjects for changed\")\n .option(\"--reveal\", \"in pretty output, print the decrypted path beside an encrypted source\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite check docs/ # walk a directory\",\n \" manni cite check --collection guides # one configured collection\",\n ' manni cite check \"docs/**/*.md\" -f github # CI annotations',\n \" manni cite check --show-diff docs/limits.md # see what changed\",\n \" manni cite check --baseline # fail only on new findings\",\n \" cat page.md | manni cite check - --as markdown\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: CheckCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isReportFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const stdinContent = paths.includes(STDIN_TOKEN) ? await readStdin() : undefined;\n const cwd = process.cwd();\n\n const run = await runCheck({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(!isMachineFormat(format), cwd),\n stdinContent,\n // `undefined` rather than `false` when absent, so config still wins.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n baseline: options.baseline,\n writeBaseline: options.writeBaseline,\n checkSources: explicitFalse(options.checkSources),\n // Only so the run can say git is not there to give diffs; the diffs\n // themselves are the pretty reporter's.\n showDiff: options.showDiff ? true : undefined,\n root: options.root,\n });\n\n let text: string;\n switch (format) {\n case \"pretty\":\n text = renderCheckPretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n quiet: Boolean(options.quiet),\n showDiff: Boolean(options.showDiff),\n reveal: Boolean(options.reveal),\n });\n break;\n case \"json\":\n text = renderCheckJson(run);\n break;\n case \"github\":\n text = renderCheckGithub(run);\n break;\n case \"sarif\":\n text = renderCheckSarif(run, { onNotice: notice });\n break;\n case \"junit\":\n text = renderCheckJunit(run);\n break;\n }\n // Only `github` may say nothing on a clean run; every other format\n // owes its envelope even when empty.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n // `failed` counts files with an unbaselined error-severity finding;\n // warnings never move it.\n process.exitCode = run.summary.failed > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"add\")\n .description(\"Mint a citation for a source range and write it to a page\")\n .argument(\n \"<page>\",\n \"the page to cite from, with the claim's lines: page:L or page:L1-L2 (use - for stdin, with --as)\",\n )\n .argument(\n \"<src>\",\n \"path, path:L or path:L1-L2 relative to --root, or an encrypted ~source with the same line forms\",\n )\n .option(\"--id <id>\", \"kebab-case id, unique on the page; required with --marker\")\n .option(\"--marker\", \"write a cite <id> marker above the paragraph holding the page lines and pin the text it anchors\")\n .option(\"--quote\", \"the page lines are a fenced block that reproduces the source\")\n .option(\n \"--encrypt\",\n \"write source.file encrypted, with an hmac-sha256- pin; with no key, offer to create one (an available key encrypts without the flag)\",\n )\n .option(\"--no-commit-sha\", \"do not record HEAD\")\n .option(\"--dry-run\", \"print the diff; write nothing\")\n .option(\"--as <format>\", \"force the page format\")\n .option(\"--root <dir>\", \"directory source paths resolve from (as check)\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite add docs/limits.md:9 lib/limits.ts:2 --id fetch-timeout\",\n \" manni cite add docs/limits.md:30 lib/limits.ts:8-12 --id timeouts --marker\",\n \" manni cite add docs/limits.md:14-18 lib/limits.ts:1-3 --quote\",\n \" manni cite add docs/limits.md lib/limits.ts --dry-run\",\n \" cat page.md | manni cite add -:9 lib/limits.ts:2 --as markdown > out.md\",\n ].join(\"\\n\"),\n )\n .action(async (pageArgument: string, src: string, options: AddCliOptions) => {\n try {\n const { page, lines } = splitPageArgument(pageArgument);\n const usingStdin = page === STDIN_TOKEN;\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n const cwd = process.cwd();\n\n const result = await runAdd({\n page,\n pageLines: lines,\n src,\n id: options.id,\n marker: options.marker ? true : undefined,\n quote: options.quote ? true : undefined,\n // `undefined` when absent, so the key decides: an available one\n // encrypts without the flag.\n encrypt: options.encrypt ? true : undefined,\n commitSha: explicitFalse(options.commitSha),\n dryRun,\n as: options.as,\n ...configOption(options.config),\n // With `-` the page owns stdout; so does the diff under --dry-run.\n onConfigLoaded: reportConfig(!usingStdin && !dryRun, cwd),\n stdinContent,\n root: options.root,\n onNotice: notice,\n // Only on a terminal: off one, a missing key is a refusal, not a\n // question nobody can answer. With `-` stdin is the page, so no\n // question is put either.\n confirm: terminalConfirm(),\n });\n\n const message = addMessage(result);\n // A dry run prints every diff the write would make: the page's, and\n // the manifest's when the entry goes there.\n const diffs = [result.diff, result.manifest?.diff ?? \"\"].filter((d) => d.length > 0);\n if (usingStdin) {\n // The rewritten page owns stdout; everything else is a diagnostic.\n process.stdout.write(result.content);\n if (dryRun) for (const diff of diffs) process.stderr.write(`${diff}\\n`);\n process.stderr.write(`${message}\\n`);\n } else if (dryRun) {\n for (const diff of diffs) process.stdout.write(`${diff}\\n`);\n process.stderr.write(`${message}\\n`);\n } else {\n process.stdout.write(`${message}\\n`);\n }\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"update\")\n .description(\"Rewrite moved citations in place; with --accept, re-mint changed ones\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to update (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"update files .gitignore covers\")\n .option(\"--no-check-sources\", \"refused: update needs the sources\")\n .option(\"--root <dir>\", \"directory src: paths resolve from (as check)\")\n .option(\"--accept\", \"re-mint changed and never-true entries at HEAD; prints old and new pins\")\n .option(\n \"--recommit\",\n \"re-record commit-sha where the recorded commit does not contain the pinned lines, or is outside HEAD's history\",\n )\n .option(\"--only <id>\", \"limit to entries with this id; repeatable\", collect, [])\n .option(\"--dry-run\", \"print the diffs; write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${UPDATE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite update docs/ # rewrite moved entries\",\n \" manni cite update --accept --only fetch-timeout docs/limits.md\",\n \" manni cite update --dry-run docs/ # see the diffs first\",\n \" manni cite update --recommit docs/ # repair unsupported commit-sha\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: UpdateCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isUpdateFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n if (!options.checkSources) {\n throw new CiteError(\n \"update needs the sources: drop --no-check-sources (or `checkSources: false`).\",\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const usingStdin = paths.includes(STDIN_TOKEN);\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n // With `-` the rewritten page owns stdout, as it does for `add -`; a\n // dry run prints the diffs instead, so the report keeps stdout.\n const pageToStdout = usingStdin && !dryRun;\n const cwd = process.cwd();\n\n const run = await runUpdate({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\" && !pageToStdout, cwd),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n root: options.root,\n accept: options.accept ? true : undefined,\n recommit: options.recommit ? true : undefined,\n only: options.only.length > 0 ? options.only : undefined,\n dryRun,\n });\n\n const text =\n format === \"json\"\n ? renderUpdateJson(run)\n : renderUpdatePretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n // The diffs are the point of a dry run; a real run prints\n // what it rewrote and leaves the file to say the rest.\n showDiff: dryRun,\n });\n const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== undefined) : undefined;\n if (stdinPage?.content !== undefined) {\n process.stdout.write(stdinPage.content);\n process.stderr.write(`${text}\\n`);\n } else {\n process.stdout.write(`${text}\\n`);\n }\n // Exit 1 when something was skipped with an error-severity finding:\n // work left undone, `fill`'s precedent.\n process.exitCode = run.exitCode;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"remove\")\n .description(\"Remove the named citations from the given pages, markers and all\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to remove from (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"remove from files .gitignore covers\")\n .option(\n \"--only <id>\",\n \"the entry to remove, by id or by pointer (/citations/N); required, and repeatable\",\n collect,\n [],\n )\n .option(\"--dry-run\", \"print the diffs and the report; write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${REMOVE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite remove docs/limits.md --only fetch-timeout\",\n \" manni cite remove docs/ --only fetch-timeout --only retries --dry-run\",\n \" manni cite remove --collection site --only /citations/3 -f json\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RemoveCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isRemoveFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const usingStdin = paths.includes(STDIN_TOKEN);\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n // With `-` the rewritten page owns stdout, exactly as on `update -`.\n const pageToStdout = usingStdin && !dryRun;\n const cwd = process.cwd();\n\n const run = await runRemove({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\" && !pageToStdout, cwd),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n only: options.only,\n dryRun,\n });\n\n const text =\n format === \"json\"\n ? renderRemoveJson(run)\n : renderRemovePretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n // The diffs are the point of a dry run; a real run prints\n // what it removed and leaves the file to say the rest.\n showDiff: dryRun,\n dryRun,\n });\n const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== undefined) : undefined;\n if (stdinPage?.content !== undefined) {\n process.stdout.write(stdinPage.content);\n process.stderr.write(`${text}\\n`);\n } else {\n process.stdout.write(`${text}\\n`);\n }\n // Everything named was removed, or previewed: there is no exit 1.\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n","/**\n * SARIF for `check`. Meta's renderer builds the envelope, the\n * repository-relative uris and the fingerprints the baseline shares, from the\n * adapted results. What it cannot know is what a cite rule is: it describes\n * every rule as a schema keyword, links meta's fix page, and prefixes each\n * message with the JSON Pointer of the entry, `(root)` for a finding about no\n * entry. This renderer replaces those three with the cite rule's own\n * description, a link to its row of the citations reference, and the message\n * the github annotation carries, which names the citation the pointer only\n * numbered. A message is no part of a fingerprint, so the baseline is\n * unaffected.\n */\nimport { renderSarif, type ValidationResult } from \"../../meta/index.js\";\nimport { errorSite } from \"../core/adapt.js\";\nimport { RULE_ID_PREFIX, isCiteRule } from \"../core/severity.js\";\nimport type { CheckRun, CiteRule } from \"../types.js\";\nimport { findingMessage } from \"./github.js\";\n\nconst INFORMATION_URI = \"https://hawkeyexl.github.io/manni/cite/\";\n\n/** The citations reference, whose rule tables anchor each row by rule name. */\nconst RULES_URI = \"https://hawkeyexl.github.io/manni/cite/reference/citations/\";\n\n/** What each rule is, as the citations reference's tables say it. */\nconst RULE_DESCRIPTIONS: Readonly<Record<CiteRule, string>> = {\n \"source-moved\": \"The cited source lines moved to one other place in the file.\",\n \"source-moved-ambiguous\": \"The cited source lines now match at several places in the file.\",\n \"source-changed\": \"The cited source lines changed since the citation pinned them.\",\n \"source-never-true\": \"The pin never matched the source at the recorded commit.\",\n \"source-missing\": \"The cited source file is not tracked under the root, or cannot be decrypted.\",\n \"claim-moved\": \"The cited sentence moved to other lines of the page.\",\n \"claim-moved-ambiguous\": \"The cited sentence now appears at several places on the page.\",\n \"claim-reanchored\": \"The cited sentence's words are unchanged since the claim's baseline, and only its layout moved.\",\n \"claim-changed\": \"The cited sentence was edited since the citation pinned it.\",\n \"marker-orphan\": \"A marker names an id no citation has.\",\n \"marker-invalid\": \"A marker is malformed, or the page has too many markers.\",\n \"marker-repeated\": \"Two markers name the same citation id.\",\n \"marker-misplaced\": \"A marker line sits inside the paragraph it anchors, and splits it.\",\n \"anchor-invalid\": \"A citation's anchor cannot work.\",\n \"entry-invalid\": \"A citation entry is malformed.\",\n \"quote-drift\": \"A quoted block no longer reproduces its source.\",\n};\n\n/**\n * The label meta's reporters put before a message: `(root) ` for a finding\n * about no entry, `/citations/N ` for one about an entry. Nothing else ever\n * opens a cite finding's adapted message.\n */\nexport const ENTRY_LABEL = /^(?:\\(root\\)|\\/citations\\/\\d+) /;\n\nexport interface SarifRule {\n id: string;\n shortDescription: { text: string };\n helpUri?: string;\n}\n\n/** As much of meta's SARIF as this renderer and its tests read back. */\nexport interface SarifLog {\n runs: {\n tool: { driver: { informationUri: string; rules: SarifRule[] } };\n results: { ruleId: string; message: { text: string } }[];\n }[];\n}\n\n/**\n * The adapted results with each message rewritten as the github annotation\n * says it. An error is paired with its finding by rule, entry, line and\n * message, as the baseline split pairs them; the baseline has already\n * dropped the errors it forgives.\n */\nexport function withFindingMessages(run: CheckRun): ValidationResult[] {\n return run.results.map((result) => {\n const page = run.pages.find((p) => p.file === result.file);\n if (page === undefined) return result;\n const errors = result.errors.map((error) => {\n const finding = page.findings.find(\n (f) =>\n f.rule === error.keyword &&\n (f.index === undefined ? \"\" : `/citations/${String(f.index)}`) === error.instancePath &&\n f.message === error.message &&\n (errorSite(f).line ?? null) === (error.line ?? null),\n );\n return finding === undefined ? error : { ...error, message: findingMessage(finding) };\n });\n return { ...result, errors };\n });\n}\n\n/** A rule as the citation tool describes it. */\nfunction describe(rule: SarifRule): SarifRule {\n const name = rule.id.slice(RULE_ID_PREFIX.length + 1);\n if (!isCiteRule(name)) return rule;\n return { id: rule.id, shortDescription: { text: RULE_DESCRIPTIONS[name] }, helpUri: `${RULES_URI}#${name}` };\n}\n\nexport function renderCheckSarif(run: CheckRun, opts: { onNotice?: (message: string) => void } = {}): string {\n const log = JSON.parse(\n renderSarif(withFindingMessages(run), {\n frame: run.frame,\n ...(opts.onNotice === undefined ? {} : { onNotice: opts.onNotice }),\n }),\n ) as SarifLog;\n for (const sarifRun of log.runs) {\n sarifRun.tool.driver.informationUri = INFORMATION_URI;\n sarifRun.tool.driver.rules = sarifRun.tool.driver.rules.map(describe);\n for (const result of sarifRun.results) result.message.text = result.message.text.replace(ENTRY_LABEL, \"\");\n }\n return JSON.stringify(log, null, 2);\n}\n","/**\n * JUnit for `check`: meta's renderer over the adapted results, under the\n * `manni.cite` classname, with each failure's message the one the github\n * annotation carries.\n * Meta's renderer opens every message with the entry's JSON Pointer, `(root)`\n * for a finding about no entry, which says nothing about a citation. The\n * failure's `type` is already the rule id.\n */\nimport { renderJunit } from \"../../meta/index.js\";\nimport type { CheckRun } from \"../types.js\";\nimport { ENTRY_LABEL, withFindingMessages } from \"./sarif.js\";\n\n/** JUnit `classname` for the citation tool's findings. */\nexport const JUNIT_CLASSNAME = \"manni.cite\";\n\n/** A `message=\"` attribute's opening label. The value is escaped, so `message=\"` opens nothing else. */\nconst MESSAGE_LABEL = new RegExp(`message=\"${ENTRY_LABEL.source.replace(/^\\^/, \"\")}`, \"g\");\n\nexport function renderCheckJunit(run: CheckRun): string {\n return renderJunit(withFindingMessages(run), { frame: run.frame, classname: JUNIT_CLASSNAME }).replace(\n MESSAGE_LABEL,\n 'message=\"',\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAS,SAAS,cAAc;;;ACShC,IAAM,kBAAkB;AAGxB,IAAM,YAAY;AAGlB,IAAM,oBAAwD;AAAA,EAC5D,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,eAAe;AACjB;AAOO,IAAM,cAAc;AAsBpB,SAAS,oBAAoB,KAAmC;AACrE,SAAO,IAAI,QAAQ,IAAI,CAAC,WAAW;AACjC,UAAM,OAAO,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,IAAI;AACzD,QAAI,SAAS,OAAW,QAAO;AAC/B,UAAM,SAAS,OAAO,OAAO,IAAI,CAAC,UAAU;AAC1C,YAAM,UAAU,KAAK,SAAS;AAAA,QAC5B,CAAC,MACC,EAAE,SAAS,MAAM,YAChB,EAAE,UAAU,SAAY,KAAK,cAAc,OAAO,EAA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AAI;AAAA,CAAI;AAAA,MAClC;AAEA,cAAQ,WAAW;AAAA,IACrB,SAAS,KAAK;AACZ,WAAK,GAAG;AAAA,IACV;AAAA,EACF,CAAC;AAEH,SAAO;AACT;","names":["splitPageArgument"]}
1
+ {"version":3,"sources":["../src/cite/cli.ts","../src/cite/reporters/sarif.ts","../src/cite/reporters/junit.ts"],"sourcesContent":["/**\n * The `cite` domain's commander program. Mounted by `src/cli.ts` under\n * `manni cite`; no entry point of its own. Grammar per proposal 0034: verbs are\n * `check`, `add`, `update`, `remove`; there is no default subcommand.\n *\n * Follows clig.dev as meta's does: primary output to stdout, diagnostics to\n * stderr, colour only on a TTY and never under `NO_COLOR`/`--no-color`, exit\n * `0` clean, `1` an error-severity finding, `2` operational/usage.\n */\nimport { Command, Option } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n explicitFalse,\n readStdin,\n reportConfig,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { splitPageArgument as splitSharedPageArgument } from \"../shared/pin.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport {\n COMMON_FORMAT_LIST,\n OMITTED_WHEN_CLEAN,\n REPORT_FORMAT_LIST,\n STDIN_TOKEN,\n isMachineFormat,\n} from \"../meta/internal.js\";\nimport { REPORT_FORMATS, isReportFormat } from \"../meta/index.js\";\nimport { runAdd } from \"./commands/add.js\";\nimport { runCheck } from \"./commands/check.js\";\nimport { runRemove } from \"./commands/remove.js\";\nimport { runUpdate } from \"./commands/update.js\";\nimport { CiteError, asCiteError } from \"./errors.js\";\nimport { spellSource } from \"./core/range.js\";\nimport { shortCommit, shortLine, shortPin, shortSrc } from \"./core/spell.js\";\nimport { renderCheckGithub } from \"./reporters/github.js\";\nimport { renderCheckJson, renderRemoveJson, renderUpdateJson } from \"./reporters/json.js\";\nimport { renderCheckJunit } from \"./reporters/junit.js\";\nimport { renderCheckPretty, renderRemovePretty, renderUpdatePretty } from \"./reporters/pretty.js\";\nimport { renderCheckSarif } from \"./reporters/sarif.js\";\nimport type { AddResult, PageLines } from \"./types.js\";\n\nconst UPDATE_FORMATS = [\"pretty\", \"json\"] as const;\ntype UpdateFormat = (typeof UPDATE_FORMATS)[number];\n/** The same two `update` has: a removal is a write, and writes report alike. */\nconst REMOVE_FORMATS = UPDATE_FORMATS;\ntype RemoveFormat = UpdateFormat;\n\n/**\n * Whether `command`'s output gets colour: this domain's `--no-color` and\n * `NO_COLOR` turn it off, and otherwise only a TTY turns it on\n * (`shouldColor`). `isTTY` is passed uncoerced: Node leaves it undefined off\n * a terminal, never false, and `shouldColor` reads a missing one as \"not a\n * terminal\".\n */\nexport function colorFor(\n command: Command,\n isTTY: boolean | undefined,\n env?: NodeJS.ProcessEnv,\n): boolean {\n // commander maps --no-color to opts.color === false, on the command that\n // declares it.\n const noColor = colorOwner(command).opts().color === false;\n return shouldColor({ noColor, isTTY, env });\n}\n\n/**\n * The nearest command, this one or an ancestor, that declares `--no-color`:\n * the `cite` program, wherever it is mounted. Not the root: under the\n * umbrella that is `manni`, which has no `--no-color` of its own.\n */\nfunction colorOwner(command: Command): Command {\n for (let c: Command | null = command; c !== null; c = c.parent) {\n if (c.options.some((o) => o.long === \"--no-color\")) return c;\n }\n return command;\n}\n\nfunction isUpdateFormat(value: string): value is UpdateFormat {\n return (UPDATE_FORMATS as readonly string[]).includes(value);\n}\n\nfunction isRemoveFormat(value: string): value is RemoveFormat {\n return (REMOVE_FORMATS as readonly string[]).includes(value);\n}\n\n/**\n * Commander hands an `.action()` callback an untyped bag of option values, so\n * each subcommand declares the shape it actually reads. The `--no-<thing>`\n * flags are `boolean` and never `undefined`: commander supplies `true` when\n * the flag is absent, which is its default and not a choice, so only the\n * explicit `false` travels to the core (`explicitFalse`).\n */\ninterface InputCliOptions {\n /** `--collection <name>`, repeatable; commander's default value is `[]`. */\n collection: string[];\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable; commander's default value is `[]`. */\n exclude: string[];\n /** `--as <format>`: force an extractor. */\n as?: string;\n /**\n * `-c, --config <path>` and `--no-config` share one commander attribute:\n * `undefined` with neither flag, the path with `-c`, `false` with\n * `--no-config`. Split by `configOption`.\n */\n config?: string | boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n gitignore: boolean;\n /** `--root <dir>`: where `src:` paths resolve from. */\n root?: string;\n}\n\ninterface CheckCliOptions extends InputCliOptions {\n /** `-f, --format <format>`. Always a string: the declaration has a default. */\n format: string;\n quiet?: boolean;\n /**\n * `--baseline [path]` / `--no-baseline`, the same three-state split as\n * `config`: absent leaves the config in charge, a string names a file, `true`\n * is a bare `--baseline` (the default path), `false` is `--no-baseline`.\n */\n baseline?: string | boolean;\n /** `--write-baseline [path]`; `true` for the bare flag. */\n writeBaseline?: string | boolean;\n /** `--no-check-sources`. */\n checkSources: boolean;\n showDiff?: boolean;\n reveal?: boolean;\n}\n\ninterface AddCliOptions {\n id?: string;\n marker?: boolean;\n quote?: boolean;\n /** `--encrypt`. */\n encrypt?: boolean;\n /** `--no-commit-sha`. */\n commitSha: boolean;\n dryRun?: boolean;\n as?: string;\n root?: string;\n config?: string | boolean;\n}\n\ninterface RemoveCliOptions extends Omit<InputCliOptions, \"root\"> {\n /** `--only <id>`, repeatable; commander's default value is `[]`. */\n only: string[];\n dryRun?: boolean;\n format: string;\n}\n\ninterface UpdateCliOptions extends InputCliOptions {\n /** `--no-check-sources`: declared so the refusal names the flag rather than commander rejecting it. */\n checkSources: boolean;\n accept?: boolean;\n recommit?: boolean;\n /** `--only <id>`, repeatable; commander's default value is `[]`. */\n only: string[];\n dryRun?: boolean;\n format: string;\n}\n\n/**\n * Split `docs/limits.md:9` or `docs/limits.md:14-18` into the page and the\n * claim's lines, under cite's error contract. The parsing is the shared pin\n * engine's (`splitPageArgument` in `src/shared/pin.ts`).\n */\nexport function splitPageArgument(arg: string): { page: string; lines?: PageLines } {\n return asCiteError(() => splitSharedPageArgument(arg));\n}\n\n/** `line 9`, or `lines 14-18` for a range. */\nfunction spellAt(lines: PageLines, noun = \"line\"): string {\n return lines.start === lines.end\n ? `${noun} ${String(lines.start)}`\n : `${noun}s ${String(lines.start)}-${String(lines.end)}`;\n}\n\n/**\n * What `add` says on success. One sentence composed from the result: what was\n * added, where it went, and what each end is pinned to. Lines are the page's\n * own, after the write. The source is spelled as it was written to the page,\n * abbreviated when it is a ciphertext, and quoted with its first pinned line\n * where the result carries one.\n */\nexport function addMessage(result: AddResult): string {\n const { citation, claimLines } = result;\n const claim = citation.claim;\n const name = citation.id ?? (claim === undefined ? \"a bare pin\" : \"an entry\");\n const src = shortSrc(spellSource(citation.source));\n const commit = citation.source[\"commit-sha\"];\n const quoted = result.sourceLine === undefined ? \"\" : shortLine(result.sourceLine);\n const line = quoted === \"\" ? \"\" : ` \"${quoted}\"`;\n const pin = `${src}${line}, ${shortPin(citation.source.integrity)}, ${commit === undefined ? \"no commit\" : shortCommit(commit)}`;\n // Where it went: the page's own frontmatter, or the manifest that owns the\n // page's citations, at the line the entry now sits on.\n const where =\n result.manifest === undefined\n ? \"frontmatter\"\n : `${result.manifest.file}:${String(result.manifest.line)}`;\n const head = `${result.file}: added ${name} to ${where}`;\n\n if (result.markerLine !== undefined) {\n const at =\n claimLines === undefined ? \"\" : `, claim pinned at ${spellAt(claimLines)}`;\n const wrote = result.markerJoined === true ? \"joined the marker at line\" : \"marker at line\";\n const marked = `${head}; ${wrote} ${String(result.markerLine)}${at}`;\n if (claim === undefined) return marked;\n if (citation.quote === true) return `${marked} (a block that reproduces ${src})`;\n return `${marked} (${shortPin(claim.integrity)}; source ${pin})`;\n }\n if (claim === undefined || claimLines === undefined) {\n return `${head} (source ${pin})`;\n }\n if (citation.quote === true) {\n return `${head} (claim ${spellAt(claimLines, \"line\")}, a block that reproduces ${src})`;\n }\n return `${head} (claim at ${spellAt(claimLines)}, ${shortPin(claim.integrity)}; source ${pin})`;\n}\n\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"cite\")\n .description(\n \"Track citations from doc claims to source lines and check them for drift.\",\n )\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)`.\n .exitOverride();\n\n program\n .command(\"check\")\n .description(\"Check every citation in the given pages against its source\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to check (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\n \"-f, --format <format>\",\n `output: ${REPORT_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"-q, --quiet\", \"in pretty output, hide current citations and clean files\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"check files .gitignore covers\")\n // No `defaultValue` and no `.preset()`, for the reasons meta's validate\n // gives: a bare flag must stay distinguishable from a typed path.\n .addOption(\n new Option(\n \"--baseline [path]\",\n \"compare against a baseline; fail only on findings not in it\",\n ),\n )\n .addOption(\n new Option(\n \"--write-baseline [path]\",\n \"record current findings as the baseline, then exit 0\",\n ),\n )\n .option(\"--no-baseline\", \"ignore a baseline configured by `baseline:`\")\n .option(\"--no-check-sources\", \"page-side rules only; every source status is skipped\")\n .option(\n \"--root <dir>\",\n \"directory src: paths resolve from (default: cite.root from config, else the git root, else the current directory)\",\n )\n .option(\"--show-diff\", \"in pretty output, print the diff and commit subjects for changed\")\n .option(\"--reveal\", \"in pretty output, print the decrypted path beside an encrypted source\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite check docs/ # walk a directory\",\n \" manni cite check --collection guides # one configured collection\",\n ' manni cite check \"docs/**/*.md\" -f github # CI annotations',\n \" manni cite check --show-diff docs/limits.md # see what changed\",\n \" manni cite check --baseline # fail only on new findings\",\n \" cat page.md | manni cite check - --as markdown\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: CheckCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isReportFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const stdinContent = paths.includes(STDIN_TOKEN) ? await readStdin() : undefined;\n const cwd = process.cwd();\n\n const run = await runCheck({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(!isMachineFormat(format), cwd),\n stdinContent,\n // `undefined` rather than `false` when absent, so config still wins.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n baseline: options.baseline,\n writeBaseline: options.writeBaseline,\n checkSources: explicitFalse(options.checkSources),\n // Only so the run can say git is not there to give diffs; the diffs\n // themselves are the pretty reporter's.\n showDiff: options.showDiff ? true : undefined,\n root: options.root,\n });\n\n let text: string;\n switch (format) {\n case \"pretty\":\n text = renderCheckPretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n quiet: Boolean(options.quiet),\n showDiff: Boolean(options.showDiff),\n reveal: Boolean(options.reveal),\n });\n break;\n case \"json\":\n text = renderCheckJson(run);\n break;\n case \"github\":\n text = renderCheckGithub(run);\n break;\n case \"sarif\":\n text = renderCheckSarif(run, { onNotice: notice });\n break;\n case \"junit\":\n text = renderCheckJunit(run);\n break;\n }\n // Only `github` may say nothing on a clean run; every other format\n // owes its envelope even when empty.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n // `failed` counts files with an unbaselined error-severity finding;\n // warnings never move it.\n process.exitCode = run.summary.failed > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"add\")\n .description(\"Mint a citation for a source range and write it to a page\")\n .argument(\n \"<page>\",\n \"the page to cite from, with the claim's lines: page:L or page:L1-L2 (use - for stdin, with --as)\",\n )\n .argument(\n \"<src>\",\n \"path, path:L or path:L1-L2 relative to --root, or an encrypted ~source with the same line forms\",\n )\n .option(\"--id <id>\", \"kebab-case id, unique on the page; required with --marker\")\n .option(\"--marker\", \"write a cite <id> marker above the paragraph holding the page lines and pin the text it anchors\")\n .option(\"--quote\", \"the page lines are a fenced block that reproduces the source\")\n .option(\n \"--encrypt\",\n \"write source.file encrypted, with an hmac-sha256- pin; with no key, offer to create one (an available key encrypts without the flag)\",\n )\n .option(\"--no-commit-sha\", \"do not record HEAD\")\n .option(\"--dry-run\", \"print the diff; write nothing\")\n .option(\"--as <format>\", \"force the page format\")\n .option(\"--root <dir>\", \"directory source paths resolve from (as check)\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite add docs/limits.md:9 lib/limits.ts:2 --id fetch-timeout\",\n \" manni cite add docs/limits.md:30 lib/limits.ts:8-12 --id timeouts --marker\",\n \" manni cite add docs/limits.md:14-18 lib/limits.ts:1-3 --quote\",\n \" manni cite add docs/limits.md lib/limits.ts --dry-run\",\n \" cat page.md | manni cite add -:9 lib/limits.ts:2 --as markdown > out.md\",\n ].join(\"\\n\"),\n )\n .action(async (pageArgument: string, src: string, options: AddCliOptions) => {\n try {\n const { page, lines } = splitPageArgument(pageArgument);\n const usingStdin = page === STDIN_TOKEN;\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n const cwd = process.cwd();\n\n const result = await runAdd({\n page,\n pageLines: lines,\n src,\n id: options.id,\n marker: options.marker ? true : undefined,\n quote: options.quote ? true : undefined,\n // `undefined` when absent, so the key decides: an available one\n // encrypts without the flag.\n encrypt: options.encrypt ? true : undefined,\n commitSha: explicitFalse(options.commitSha),\n dryRun,\n as: options.as,\n ...configOption(options.config),\n // With `-` the page owns stdout; so does the diff under --dry-run.\n onConfigLoaded: reportConfig(!usingStdin && !dryRun, cwd),\n stdinContent,\n root: options.root,\n onNotice: notice,\n // Only on a terminal: off one, a missing key is a refusal, not a\n // question nobody can answer. With `-` stdin is the page, so no\n // question is put either.\n confirm: terminalConfirm(),\n });\n\n const message = addMessage(result);\n // A dry run prints every diff the write would make: the page's, and\n // the manifest's when the entry goes there.\n const diffs = [result.diff, result.manifest?.diff ?? \"\"].filter((d) => d.length > 0);\n if (usingStdin) {\n // The rewritten page owns stdout; everything else is a diagnostic.\n process.stdout.write(result.content);\n if (dryRun) for (const diff of diffs) process.stderr.write(`${diff}\\n`);\n process.stderr.write(`${message}\\n`);\n } else if (dryRun) {\n for (const diff of diffs) process.stdout.write(`${diff}\\n`);\n process.stderr.write(`${message}\\n`);\n } else {\n process.stdout.write(`${message}\\n`);\n }\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"update\")\n .description(\"Rewrite moved citations in place; with --accept, re-mint changed ones\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to update (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"update files .gitignore covers\")\n .option(\"--no-check-sources\", \"refused: update needs the sources\")\n .option(\"--root <dir>\", \"directory src: paths resolve from (as check)\")\n .option(\"--accept\", \"re-mint changed and never-true entries at HEAD; prints old and new pins\")\n .option(\n \"--recommit\",\n \"re-record commit-sha where the recorded commit does not contain the pinned lines, or is outside HEAD's history\",\n )\n .option(\"--only <id>\", \"limit to entries with this id; repeatable\", collect, [])\n .option(\"--dry-run\", \"print the diffs; write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${UPDATE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite update docs/ # rewrite moved entries\",\n \" manni cite update --accept --only fetch-timeout docs/limits.md\",\n \" manni cite update --dry-run docs/ # see the diffs first\",\n \" manni cite update --recommit docs/ # repair unsupported commit-sha\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: UpdateCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isUpdateFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n if (!options.checkSources) {\n throw new CiteError(\n \"update needs the sources: drop --no-check-sources (or `checkSources: false`).\",\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const usingStdin = paths.includes(STDIN_TOKEN);\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n // With `-` the rewritten page owns stdout, as it does for `add -`; a\n // dry run prints the diffs instead, so the report keeps stdout.\n const pageToStdout = usingStdin && !dryRun;\n const cwd = process.cwd();\n\n const run = await runUpdate({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\" && !pageToStdout, cwd),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n root: options.root,\n accept: options.accept ? true : undefined,\n recommit: options.recommit ? true : undefined,\n only: options.only.length > 0 ? options.only : undefined,\n dryRun,\n });\n\n const text =\n format === \"json\"\n ? renderUpdateJson(run)\n : renderUpdatePretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n // The diffs are the point of a dry run; a real run prints\n // what it rewrote and leaves the file to say the rest.\n showDiff: dryRun,\n });\n const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== undefined) : undefined;\n if (stdinPage?.content !== undefined) {\n process.stdout.write(stdinPage.content);\n process.stderr.write(`${text}\\n`);\n } else {\n process.stdout.write(`${text}\\n`);\n }\n // Exit 1 when something was skipped with an error-severity finding:\n // work left undone, `fill`'s precedent.\n process.exitCode = run.exitCode;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"remove\")\n .description(\"Remove the named citations from the given pages, markers and all\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to remove from (use - for stdin)\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"remove from files .gitignore covers\")\n .option(\n \"--only <id>\",\n \"the entry to remove, by id or by pointer (/citations/N); required, and repeatable\",\n collect,\n [],\n )\n .option(\"--dry-run\", \"print the diffs and the report; write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${REMOVE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni cite remove docs/limits.md --only fetch-timeout\",\n \" manni cite remove docs/ --only fetch-timeout --only retries --dry-run\",\n \" manni cite remove --collection site --only /citations/3 -f json\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RemoveCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isRemoveFormat(format)) {\n throw new CiteError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n const exts = options.ext ? splitList(options.ext) : undefined;\n const usingStdin = paths.includes(STDIN_TOKEN);\n const stdinContent = usingStdin ? await readStdin() : undefined;\n const dryRun = Boolean(options.dryRun);\n // With `-` the rewritten page owns stdout, exactly as on `update -`.\n const pageToStdout = usingStdin && !dryRun;\n const cwd = process.cwd();\n\n const run = await runRemove({\n inputs: paths,\n collection: options.collection,\n exts,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\" && !pageToStdout, cwd),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n only: options.only,\n dryRun,\n });\n\n const text =\n format === \"json\"\n ? renderRemoveJson(run)\n : renderRemovePretty(run, {\n color: colorFor(command, process.stdout.isTTY),\n // The diffs are the point of a dry run; a real run prints\n // what it removed and leaves the file to say the rest.\n showDiff: dryRun,\n dryRun,\n });\n const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== undefined) : undefined;\n if (stdinPage?.content !== undefined) {\n process.stdout.write(stdinPage.content);\n process.stderr.write(`${text}\\n`);\n } else {\n process.stdout.write(`${text}\\n`);\n }\n // Everything named was removed, or previewed: there is no exit 1.\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n","/**\n * SARIF for `check`. Meta's renderer builds the envelope, the\n * repository-relative uris and the fingerprints the baseline shares, from the\n * adapted results. What it cannot know is what a cite rule is: it describes\n * every rule as a schema keyword, links meta's fix page, and prefixes each\n * message with the JSON Pointer of the entry, `(root)` for a finding about no\n * entry. This renderer replaces those three with the cite rule's own\n * description, a link to its row of the citations reference, and the message\n * the github annotation carries, which names the citation the pointer only\n * numbered. A message is no part of a fingerprint, so the baseline is\n * unaffected.\n */\nimport { renderSarif, type ValidationResult } from \"../../meta/index.js\";\nimport { errorSite } from \"../core/adapt.js\";\nimport { RULE_ID_PREFIX, isCiteRule } from \"../core/severity.js\";\nimport type { CheckRun, CiteRule } from \"../types.js\";\nimport { findingMessage } from \"./github.js\";\n\nconst INFORMATION_URI = \"https://hawkeyexl.github.io/manni/cite/\";\n\n/** The citations reference, whose rule tables anchor each row by rule name. */\nconst RULES_URI = \"https://hawkeyexl.github.io/manni/cite/reference/citations/\";\n\n/** What each rule is, as the citations reference's tables say it. */\nconst RULE_DESCRIPTIONS: Readonly<Record<CiteRule, string>> = {\n \"source-moved\": \"The cited source lines moved to one other place in the file.\",\n \"source-moved-ambiguous\": \"The cited source lines now match at several places in the file.\",\n \"source-changed\": \"The cited source lines changed since the citation pinned them.\",\n \"source-never-true\": \"The pin never matched the source at the recorded commit.\",\n \"source-missing\": \"The cited source file is not tracked under the root, or cannot be decrypted.\",\n \"claim-moved\": \"The cited sentence moved to other lines of the page.\",\n \"claim-moved-ambiguous\": \"The cited sentence now appears at several places on the page.\",\n \"claim-reanchored\": \"The cited sentence's words are unchanged since the claim's baseline, and only its layout moved.\",\n \"claim-changed\": \"The cited sentence was edited since the citation pinned it.\",\n \"marker-orphan\": \"A marker names an id no citation has.\",\n \"marker-invalid\": \"A marker is malformed, or the page has too many markers.\",\n \"marker-repeated\": \"Two markers name the same citation id.\",\n \"marker-misplaced\": \"A marker line sits inside the paragraph it anchors, and splits it.\",\n \"anchor-invalid\": \"A citation's anchor cannot work.\",\n \"entry-invalid\": \"A citation entry is malformed.\",\n \"quote-drift\": \"A quoted block no longer reproduces its source.\",\n};\n\n/**\n * The label meta's reporters put before a message: `(root) ` for a finding\n * about no entry, `/citations/N ` for one about an entry. Nothing else ever\n * opens a cite finding's adapted message.\n */\nexport const ENTRY_LABEL = /^(?:\\(root\\)|\\/citations\\/\\d+) /;\n\nexport interface SarifRule {\n id: string;\n shortDescription: { text: string };\n helpUri?: string;\n}\n\n/** As much of meta's SARIF as this renderer and its tests read back. */\nexport interface SarifLog {\n runs: {\n tool: { driver: { informationUri: string; rules: SarifRule[] } };\n results: { ruleId: string; message: { text: string } }[];\n }[];\n}\n\n/**\n * The adapted results with each message rewritten as the github annotation\n * says it. An error is paired with its finding by rule, entry, line and\n * message, as the baseline split pairs them; the baseline has already\n * dropped the errors it forgives.\n */\nexport function withFindingMessages(run: CheckRun): ValidationResult[] {\n return run.results.map((result) => {\n const page = run.pages.find((p) => p.file === result.file);\n if (page === undefined) return result;\n const errors = result.errors.map((error) => {\n const finding = page.findings.find(\n (f) =>\n f.rule === error.keyword &&\n (f.index === undefined ? \"\" : `/citations/${String(f.index)}`) === error.instancePath &&\n f.message === error.message &&\n (errorSite(f).line ?? null) === (error.line ?? null),\n );\n return finding === undefined ? error : { ...error, message: findingMessage(finding) };\n });\n return { ...result, errors };\n });\n}\n\n/** A rule as the citation tool describes it. */\nfunction describe(rule: SarifRule): SarifRule {\n const name = rule.id.slice(RULE_ID_PREFIX.length + 1);\n if (!isCiteRule(name)) return rule;\n return { id: rule.id, shortDescription: { text: RULE_DESCRIPTIONS[name] }, helpUri: `${RULES_URI}#${name}` };\n}\n\nexport function renderCheckSarif(run: CheckRun, opts: { onNotice?: (message: string) => void } = {}): string {\n const log = JSON.parse(\n renderSarif(withFindingMessages(run), {\n frame: run.frame,\n ...(opts.onNotice === undefined ? {} : { onNotice: opts.onNotice }),\n }),\n ) as SarifLog;\n for (const sarifRun of log.runs) {\n sarifRun.tool.driver.informationUri = INFORMATION_URI;\n sarifRun.tool.driver.rules = sarifRun.tool.driver.rules.map(describe);\n for (const result of sarifRun.results) result.message.text = result.message.text.replace(ENTRY_LABEL, \"\");\n }\n return JSON.stringify(log, null, 2);\n}\n","/**\n * JUnit for `check`: meta's renderer over the adapted results, under the\n * `manni.cite` classname, with each failure's message the one the github\n * annotation carries.\n * Meta's renderer opens every message with the entry's JSON Pointer, `(root)`\n * for a finding about no entry, which says nothing about a citation. The\n * failure's `type` is already the rule id.\n */\nimport { renderJunit } from \"../../meta/index.js\";\nimport type { CheckRun } from \"../types.js\";\nimport { ENTRY_LABEL, withFindingMessages } from \"./sarif.js\";\n\n/** JUnit `classname` for the citation tool's findings. */\nexport const JUNIT_CLASSNAME = \"manni.cite\";\n\n/** A `message=\"` attribute's opening label. The value is escaped, so `message=\"` opens nothing else. */\nconst MESSAGE_LABEL = new RegExp(`message=\"${ENTRY_LABEL.source.replace(/^\\^/, \"\")}`, \"g\");\n\nexport function renderCheckJunit(run: CheckRun): string {\n return renderJunit(withFindingMessages(run), { frame: run.frame, classname: JUNIT_CLASSNAME }).replace(\n MESSAGE_LABEL,\n 'message=\"',\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAS,SAAS,cAAc;;;ACShC,IAAM,kBAAkB;AAGxB,IAAM,YAAY;AAGlB,IAAM,oBAAwD;AAAA,EAC5D,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,eAAe;AACjB;AAOO,IAAM,cAAc;AAsBpB,SAAS,oBAAoB,KAAmC;AACrE,SAAO,IAAI,QAAQ,IAAI,CAAC,WAAW;AACjC,UAAM,OAAO,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,IAAI;AACzD,QAAI,SAAS,OAAW,QAAO;AAC/B,UAAM,SAAS,OAAO,OAAO,IAAI,CAAC,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