@cairn-tool/cairn 2.0.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 (526) hide show
  1. package/.markdownlintrc +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1431 -0
  4. package/dist/agent/audit/baseline.d.ts +69 -0
  5. package/dist/agent/audit/baseline.js +128 -0
  6. package/dist/agent/audit/baseline.js.map +1 -0
  7. package/dist/agent/audit/index.d.ts +126 -0
  8. package/dist/agent/audit/index.js +625 -0
  9. package/dist/agent/audit/index.js.map +1 -0
  10. package/dist/agent/import/detect.d.ts +49 -0
  11. package/dist/agent/import/detect.js +159 -0
  12. package/dist/agent/import/detect.js.map +1 -0
  13. package/dist/agent/import/normalize.d.ts +72 -0
  14. package/dist/agent/import/normalize.js +475 -0
  15. package/dist/agent/import/normalize.js.map +1 -0
  16. package/dist/agent/install/index.d.ts +211 -0
  17. package/dist/agent/install/index.js +907 -0
  18. package/dist/agent/install/index.js.map +1 -0
  19. package/dist/agent/manifest.d.ts +75 -0
  20. package/dist/agent/manifest.js +210 -0
  21. package/dist/agent/manifest.js.map +1 -0
  22. package/dist/agent/marketplace/index.d.ts +69 -0
  23. package/dist/agent/marketplace/index.js +212 -0
  24. package/dist/agent/marketplace/index.js.map +1 -0
  25. package/dist/agent/marketplace/spec.d.ts +48 -0
  26. package/dist/agent/marketplace/spec.js +237 -0
  27. package/dist/agent/marketplace/spec.js.map +1 -0
  28. package/dist/agent/output.d.ts +36 -0
  29. package/dist/agent/output.js +56 -0
  30. package/dist/agent/output.js.map +1 -0
  31. package/dist/agent/overlays.d.ts +38 -0
  32. package/dist/agent/overlays.js +223 -0
  33. package/dist/agent/overlays.js.map +1 -0
  34. package/dist/agent/package/index.d.ts +105 -0
  35. package/dist/agent/package/index.js +339 -0
  36. package/dist/agent/package/index.js.map +1 -0
  37. package/dist/agent/package/tar.d.ts +36 -0
  38. package/dist/agent/package/tar.js +137 -0
  39. package/dist/agent/package/tar.js.map +1 -0
  40. package/dist/agent/parser.d.ts +13 -0
  41. package/dist/agent/parser.js +559 -0
  42. package/dist/agent/parser.js.map +1 -0
  43. package/dist/agent/render.d.ts +16 -0
  44. package/dist/agent/render.js +721 -0
  45. package/dist/agent/render.js.map +1 -0
  46. package/dist/agent/sarif.d.ts +18 -0
  47. package/dist/agent/sarif.js +56 -0
  48. package/dist/agent/sarif.js.map +1 -0
  49. package/dist/agent/scaffold.d.ts +86 -0
  50. package/dist/agent/scaffold.js +250 -0
  51. package/dist/agent/scaffold.js.map +1 -0
  52. package/dist/agent/targets/antigravity.d.ts +17 -0
  53. package/dist/agent/targets/antigravity.js +218 -0
  54. package/dist/agent/targets/antigravity.js.map +1 -0
  55. package/dist/agent/targets/claude-code.d.ts +2 -0
  56. package/dist/agent/targets/claude-code.js +220 -0
  57. package/dist/agent/targets/claude-code.js.map +1 -0
  58. package/dist/agent/targets/codex.d.ts +2 -0
  59. package/dist/agent/targets/codex.js +212 -0
  60. package/dist/agent/targets/codex.js.map +1 -0
  61. package/dist/agent/targets/cursor.d.ts +2 -0
  62. package/dist/agent/targets/cursor.js +210 -0
  63. package/dist/agent/targets/cursor.js.map +1 -0
  64. package/dist/agent/targets/index.d.ts +31 -0
  65. package/dist/agent/targets/index.js +64 -0
  66. package/dist/agent/targets/index.js.map +1 -0
  67. package/dist/agent/targets/opencode.d.ts +15 -0
  68. package/dist/agent/targets/opencode.js +215 -0
  69. package/dist/agent/targets/opencode.js.map +1 -0
  70. package/dist/agent/targets/schema.d.ts +315 -0
  71. package/dist/agent/targets/schema.js +179 -0
  72. package/dist/agent/targets/schema.js.map +1 -0
  73. package/dist/agent/test/assert.d.ts +46 -0
  74. package/dist/agent/test/assert.js +288 -0
  75. package/dist/agent/test/assert.js.map +1 -0
  76. package/dist/agent/test/index.d.ts +73 -0
  77. package/dist/agent/test/index.js +181 -0
  78. package/dist/agent/test/index.js.map +1 -0
  79. package/dist/agent/test/schema.d.ts +81 -0
  80. package/dist/agent/test/schema.js +235 -0
  81. package/dist/agent/test/schema.js.map +1 -0
  82. package/dist/agent/types.d.ts +204 -0
  83. package/dist/agent/types.js +11 -0
  84. package/dist/agent/types.js.map +1 -0
  85. package/dist/agent/upgrade.d.ts +29 -0
  86. package/dist/agent/upgrade.js +72 -0
  87. package/dist/agent/upgrade.js.map +1 -0
  88. package/dist/agent/writer.d.ts +30 -0
  89. package/dist/agent/writer.js +73 -0
  90. package/dist/agent/writer.js.map +1 -0
  91. package/dist/archive/db.d.ts +20 -0
  92. package/dist/archive/db.js +98 -0
  93. package/dist/archive/db.js.map +1 -0
  94. package/dist/archive/progress.d.ts +62 -0
  95. package/dist/archive/progress.js +151 -0
  96. package/dist/archive/progress.js.map +1 -0
  97. package/dist/archive/query.d.ts +86 -0
  98. package/dist/archive/query.js +241 -0
  99. package/dist/archive/query.js.map +1 -0
  100. package/dist/archive/run.d.ts +91 -0
  101. package/dist/archive/run.js +331 -0
  102. package/dist/archive/run.js.map +1 -0
  103. package/dist/archive/segments.d.ts +89 -0
  104. package/dist/archive/segments.js +144 -0
  105. package/dist/archive/segments.js.map +1 -0
  106. package/dist/archive/sets.d.ts +58 -0
  107. package/dist/archive/sets.js +344 -0
  108. package/dist/archive/sets.js.map +1 -0
  109. package/dist/archive/tar-read.d.ts +35 -0
  110. package/dist/archive/tar-read.js +90 -0
  111. package/dist/archive/tar-read.js.map +1 -0
  112. package/dist/audit-baseline.d.ts +66 -0
  113. package/dist/audit-baseline.js +124 -0
  114. package/dist/audit-baseline.js.map +1 -0
  115. package/dist/automation.d.ts +16 -0
  116. package/dist/automation.js +38 -0
  117. package/dist/automation.js.map +1 -0
  118. package/dist/backlinks.d.ts +15 -0
  119. package/dist/backlinks.js +30 -0
  120. package/dist/backlinks.js.map +1 -0
  121. package/dist/checkers/katex.d.ts +3 -0
  122. package/dist/checkers/katex.js +71 -0
  123. package/dist/checkers/katex.js.map +1 -0
  124. package/dist/checkers/markdown-lint.d.ts +28 -0
  125. package/dist/checkers/markdown-lint.js +53 -0
  126. package/dist/checkers/markdown-lint.js.map +1 -0
  127. package/dist/checkers/mermaid.d.ts +6 -0
  128. package/dist/checkers/mermaid.js +53 -0
  129. package/dist/checkers/mermaid.js.map +1 -0
  130. package/dist/checkers/references.d.ts +3 -0
  131. package/dist/checkers/references.js +55 -0
  132. package/dist/checkers/references.js.map +1 -0
  133. package/dist/cli.d.ts +2 -0
  134. package/dist/cli.js +1117 -0
  135. package/dist/cli.js.map +1 -0
  136. package/dist/command-result.d.ts +6 -0
  137. package/dist/command-result.js +13 -0
  138. package/dist/command-result.js.map +1 -0
  139. package/dist/commands/agent-audit.d.ts +21 -0
  140. package/dist/commands/agent-audit.js +119 -0
  141. package/dist/commands/agent-audit.js.map +1 -0
  142. package/dist/commands/agent-doctor.d.ts +25 -0
  143. package/dist/commands/agent-doctor.js +217 -0
  144. package/dist/commands/agent-doctor.js.map +1 -0
  145. package/dist/commands/agent-import.d.ts +21 -0
  146. package/dist/commands/agent-import.js +212 -0
  147. package/dist/commands/agent-import.js.map +1 -0
  148. package/dist/commands/agent-install.d.ts +18 -0
  149. package/dist/commands/agent-install.js +59 -0
  150. package/dist/commands/agent-install.js.map +1 -0
  151. package/dist/commands/agent-installed.d.ts +6 -0
  152. package/dist/commands/agent-installed.js +17 -0
  153. package/dist/commands/agent-installed.js.map +1 -0
  154. package/dist/commands/agent-marketplace.d.ts +11 -0
  155. package/dist/commands/agent-marketplace.js +178 -0
  156. package/dist/commands/agent-marketplace.js.map +1 -0
  157. package/dist/commands/agent-package.d.ts +16 -0
  158. package/dist/commands/agent-package.js +159 -0
  159. package/dist/commands/agent-package.js.map +1 -0
  160. package/dist/commands/agent-scaffold.d.ts +17 -0
  161. package/dist/commands/agent-scaffold.js +181 -0
  162. package/dist/commands/agent-scaffold.js.map +1 -0
  163. package/dist/commands/agent-specs.d.ts +7 -0
  164. package/dist/commands/agent-specs.js +20 -0
  165. package/dist/commands/agent-specs.js.map +1 -0
  166. package/dist/commands/agent-test.d.ts +21 -0
  167. package/dist/commands/agent-test.js +50 -0
  168. package/dist/commands/agent-test.js.map +1 -0
  169. package/dist/commands/agent-uninstall.d.ts +6 -0
  170. package/dist/commands/agent-uninstall.js +45 -0
  171. package/dist/commands/agent-uninstall.js.map +1 -0
  172. package/dist/commands/agent-upgrade.d.ts +5 -0
  173. package/dist/commands/agent-upgrade.js +105 -0
  174. package/dist/commands/agent-upgrade.js.map +1 -0
  175. package/dist/commands/agent.d.ts +27 -0
  176. package/dist/commands/agent.js +549 -0
  177. package/dist/commands/agent.js.map +1 -0
  178. package/dist/commands/archive.d.ts +47 -0
  179. package/dist/commands/archive.js +311 -0
  180. package/dist/commands/archive.js.map +1 -0
  181. package/dist/commands/audit.d.ts +25 -0
  182. package/dist/commands/audit.js +325 -0
  183. package/dist/commands/audit.js.map +1 -0
  184. package/dist/commands/check-snippets.d.ts +58 -0
  185. package/dist/commands/check-snippets.js +247 -0
  186. package/dist/commands/check-snippets.js.map +1 -0
  187. package/dist/commands/check-urls.d.ts +52 -0
  188. package/dist/commands/check-urls.js +205 -0
  189. package/dist/commands/check-urls.js.map +1 -0
  190. package/dist/commands/code-blocks.d.ts +8 -0
  191. package/dist/commands/code-blocks.js +66 -0
  192. package/dist/commands/code-blocks.js.map +1 -0
  193. package/dist/commands/completion.d.ts +15 -0
  194. package/dist/commands/completion.js +20 -0
  195. package/dist/commands/completion.js.map +1 -0
  196. package/dist/commands/context.d.ts +16 -0
  197. package/dist/commands/context.js +131 -0
  198. package/dist/commands/context.js.map +1 -0
  199. package/dist/commands/describe.d.ts +12 -0
  200. package/dist/commands/describe.js +62 -0
  201. package/dist/commands/describe.js.map +1 -0
  202. package/dist/commands/diff.d.ts +11 -0
  203. package/dist/commands/diff.js +185 -0
  204. package/dist/commands/diff.js.map +1 -0
  205. package/dist/commands/fix.d.ts +59 -0
  206. package/dist/commands/fix.js +173 -0
  207. package/dist/commands/fix.js.map +1 -0
  208. package/dist/commands/frontmatter.d.ts +7 -0
  209. package/dist/commands/frontmatter.js +84 -0
  210. package/dist/commands/frontmatter.js.map +1 -0
  211. package/dist/commands/graph.d.ts +12 -0
  212. package/dist/commands/graph.js +122 -0
  213. package/dist/commands/graph.js.map +1 -0
  214. package/dist/commands/headers.d.ts +7 -0
  215. package/dist/commands/headers.js +48 -0
  216. package/dist/commands/headers.js.map +1 -0
  217. package/dist/commands/index.d.ts +8 -0
  218. package/dist/commands/index.js +32 -0
  219. package/dist/commands/index.js.map +1 -0
  220. package/dist/commands/links.d.ts +9 -0
  221. package/dist/commands/links.js +123 -0
  222. package/dist/commands/links.js.map +1 -0
  223. package/dist/commands/lint-dir.d.ts +15 -0
  224. package/dist/commands/lint-dir.js +156 -0
  225. package/dist/commands/lint-dir.js.map +1 -0
  226. package/dist/commands/lint.d.ts +14 -0
  227. package/dist/commands/lint.js +45 -0
  228. package/dist/commands/lint.js.map +1 -0
  229. package/dist/commands/orphans.d.ts +10 -0
  230. package/dist/commands/orphans.js +74 -0
  231. package/dist/commands/orphans.js.map +1 -0
  232. package/dist/commands/outline.d.ts +7 -0
  233. package/dist/commands/outline.js +54 -0
  234. package/dist/commands/outline.js.map +1 -0
  235. package/dist/commands/query.d.ts +18 -0
  236. package/dist/commands/query.js +341 -0
  237. package/dist/commands/query.js.map +1 -0
  238. package/dist/commands/refs-to.d.ts +8 -0
  239. package/dist/commands/refs-to.js +65 -0
  240. package/dist/commands/refs-to.js.map +1 -0
  241. package/dist/commands/refs.d.ts +10 -0
  242. package/dist/commands/refs.js +103 -0
  243. package/dist/commands/refs.js.map +1 -0
  244. package/dist/commands/rename-file.d.ts +16 -0
  245. package/dist/commands/rename-file.js +215 -0
  246. package/dist/commands/rename-file.js.map +1 -0
  247. package/dist/commands/rename-heading.d.ts +10 -0
  248. package/dist/commands/rename-heading.js +182 -0
  249. package/dist/commands/rename-heading.js.map +1 -0
  250. package/dist/commands/schema.d.ts +10 -0
  251. package/dist/commands/schema.js +34 -0
  252. package/dist/commands/schema.js.map +1 -0
  253. package/dist/commands/scripts.d.ts +59 -0
  254. package/dist/commands/scripts.js +222 -0
  255. package/dist/commands/scripts.js.map +1 -0
  256. package/dist/commands/section.d.ts +9 -0
  257. package/dist/commands/section.js +49 -0
  258. package/dist/commands/section.js.map +1 -0
  259. package/dist/commands/serve.d.ts +6 -0
  260. package/dist/commands/serve.js +48 -0
  261. package/dist/commands/serve.js.map +1 -0
  262. package/dist/commands/stats.d.ts +6 -0
  263. package/dist/commands/stats.js +109 -0
  264. package/dist/commands/stats.js.map +1 -0
  265. package/dist/commands/structure.d.ts +6 -0
  266. package/dist/commands/structure.js +130 -0
  267. package/dist/commands/structure.js.map +1 -0
  268. package/dist/commands/tables.d.ts +8 -0
  269. package/dist/commands/tables.js +77 -0
  270. package/dist/commands/tables.js.map +1 -0
  271. package/dist/commands/tasks.d.ts +8 -0
  272. package/dist/commands/tasks.js +59 -0
  273. package/dist/commands/tasks.js.map +1 -0
  274. package/dist/commands/toc.d.ts +18 -0
  275. package/dist/commands/toc.js +105 -0
  276. package/dist/commands/toc.js.map +1 -0
  277. package/dist/commands/update-check.d.ts +36 -0
  278. package/dist/commands/update-check.js +119 -0
  279. package/dist/commands/update-check.js.map +1 -0
  280. package/dist/commands/usage.d.ts +56 -0
  281. package/dist/commands/usage.js +883 -0
  282. package/dist/commands/usage.js.map +1 -0
  283. package/dist/commands/validate-frontmatter.d.ts +13 -0
  284. package/dist/commands/validate-frontmatter.js +34 -0
  285. package/dist/commands/validate-frontmatter.js.map +1 -0
  286. package/dist/completion/model.d.ts +49 -0
  287. package/dist/completion/model.js +194 -0
  288. package/dist/completion/model.js.map +1 -0
  289. package/dist/completion/shells.d.ts +2 -0
  290. package/dist/completion/shells.js +280 -0
  291. package/dist/completion/shells.js.map +1 -0
  292. package/dist/config-schema.d.ts +15 -0
  293. package/dist/config-schema.js +44 -0
  294. package/dist/config-schema.js.map +1 -0
  295. package/dist/config.d.ts +102 -0
  296. package/dist/config.js +614 -0
  297. package/dist/config.js.map +1 -0
  298. package/dist/context.d.ts +106 -0
  299. package/dist/context.js +202 -0
  300. package/dist/context.js.map +1 -0
  301. package/dist/contract/describe.d.ts +84 -0
  302. package/dist/contract/describe.js +104 -0
  303. package/dist/contract/describe.js.map +1 -0
  304. package/dist/contract/registry.d.ts +2 -0
  305. package/dist/contract/registry.js +622 -0
  306. package/dist/contract/registry.js.map +1 -0
  307. package/dist/contract/schemas/agent.d.ts +2 -0
  308. package/dist/contract/schemas/agent.js +572 -0
  309. package/dist/contract/schemas/agent.js.map +1 -0
  310. package/dist/contract/schemas/archive.d.ts +3 -0
  311. package/dist/contract/schemas/archive.js +227 -0
  312. package/dist/contract/schemas/archive.js.map +1 -0
  313. package/dist/contract/schemas/index.d.ts +11 -0
  314. package/dist/contract/schemas/index.js +49 -0
  315. package/dist/contract/schemas/index.js.map +1 -0
  316. package/dist/contract/schemas/markdown.d.ts +15 -0
  317. package/dist/contract/schemas/markdown.js +1035 -0
  318. package/dist/contract/schemas/markdown.js.map +1 -0
  319. package/dist/contract/schemas/meta.d.ts +5 -0
  320. package/dist/contract/schemas/meta.js +233 -0
  321. package/dist/contract/schemas/meta.js.map +1 -0
  322. package/dist/contract/schemas/scripts.d.ts +4 -0
  323. package/dist/contract/schemas/scripts.js +183 -0
  324. package/dist/contract/schemas/scripts.js.map +1 -0
  325. package/dist/contract/schemas/shared.d.ts +11 -0
  326. package/dist/contract/schemas/shared.js +26 -0
  327. package/dist/contract/schemas/shared.js.map +1 -0
  328. package/dist/contract/schemas/usage.d.ts +6 -0
  329. package/dist/contract/schemas/usage.js +489 -0
  330. package/dist/contract/schemas/usage.js.map +1 -0
  331. package/dist/contract/types.d.ts +63 -0
  332. package/dist/contract/types.js +2 -0
  333. package/dist/contract/types.js.map +1 -0
  334. package/dist/contract/version.d.ts +20 -0
  335. package/dist/contract/version.js +21 -0
  336. package/dist/contract/version.js.map +1 -0
  337. package/dist/diff.d.ts +156 -0
  338. package/dist/diff.js +500 -0
  339. package/dist/diff.js.map +1 -0
  340. package/dist/edit-plan.d.ts +133 -0
  341. package/dist/edit-plan.js +245 -0
  342. package/dist/edit-plan.js.map +1 -0
  343. package/dist/fix/markdownlint-fixer.d.ts +34 -0
  344. package/dist/fix/markdownlint-fixer.js +125 -0
  345. package/dist/fix/markdownlint-fixer.js.map +1 -0
  346. package/dist/fix/registry.d.ts +48 -0
  347. package/dist/fix/registry.js +28 -0
  348. package/dist/fix/registry.js.map +1 -0
  349. package/dist/fix/relative-links-fixer.d.ts +21 -0
  350. package/dist/fix/relative-links-fixer.js +96 -0
  351. package/dist/fix/relative-links-fixer.js.map +1 -0
  352. package/dist/fix/snippets-fixer.d.ts +2 -0
  353. package/dist/fix/snippets-fixer.js +64 -0
  354. package/dist/fix/snippets-fixer.js.map +1 -0
  355. package/dist/fix/toc-fixer.d.ts +2 -0
  356. package/dist/fix/toc-fixer.js +94 -0
  357. package/dist/fix/toc-fixer.js.map +1 -0
  358. package/dist/formats.d.ts +22 -0
  359. package/dist/formats.js +34 -0
  360. package/dist/formats.js.map +1 -0
  361. package/dist/formatters.d.ts +11 -0
  362. package/dist/formatters.js +48 -0
  363. package/dist/formatters.js.map +1 -0
  364. package/dist/frontmatter-validation.d.ts +11 -0
  365. package/dist/frontmatter-validation.js +188 -0
  366. package/dist/frontmatter-validation.js.map +1 -0
  367. package/dist/git.d.ts +40 -0
  368. package/dist/git.js +124 -0
  369. package/dist/git.js.map +1 -0
  370. package/dist/graph.d.ts +50 -0
  371. package/dist/graph.js +200 -0
  372. package/dist/graph.js.map +1 -0
  373. package/dist/input-selection.d.ts +9 -0
  374. package/dist/input-selection.js +122 -0
  375. package/dist/input-selection.js.map +1 -0
  376. package/dist/input.d.ts +2 -0
  377. package/dist/input.js +32 -0
  378. package/dist/input.js.map +1 -0
  379. package/dist/link-target.d.ts +39 -0
  380. package/dist/link-target.js +68 -0
  381. package/dist/link-target.js.map +1 -0
  382. package/dist/lint.d.ts +13 -0
  383. package/dist/lint.js +27 -0
  384. package/dist/lint.js.map +1 -0
  385. package/dist/markdown-ast.d.ts +73 -0
  386. package/dist/markdown-ast.js +187 -0
  387. package/dist/markdown-ast.js.map +1 -0
  388. package/dist/object-path.d.ts +14 -0
  389. package/dist/object-path.js +14 -0
  390. package/dist/object-path.js.map +1 -0
  391. package/dist/option-utils.d.ts +13 -0
  392. package/dist/option-utils.js +25 -0
  393. package/dist/option-utils.js.map +1 -0
  394. package/dist/outline.d.ts +16 -0
  395. package/dist/outline.js +32 -0
  396. package/dist/outline.js.map +1 -0
  397. package/dist/query/entities.d.ts +60 -0
  398. package/dist/query/entities.js +219 -0
  399. package/dist/query/entities.js.map +1 -0
  400. package/dist/query/execute.d.ts +22 -0
  401. package/dist/query/execute.js +0 -0
  402. package/dist/query/execute.js.map +1 -0
  403. package/dist/query/plan.d.ts +76 -0
  404. package/dist/query/plan.js +183 -0
  405. package/dist/query/plan.js.map +1 -0
  406. package/dist/query/render.d.ts +3 -0
  407. package/dist/query/render.js +39 -0
  408. package/dist/query/render.js.map +1 -0
  409. package/dist/refs.d.ts +19 -0
  410. package/dist/refs.js +10 -0
  411. package/dist/refs.js.map +1 -0
  412. package/dist/result.d.ts +49 -0
  413. package/dist/result.js +47 -0
  414. package/dist/result.js.map +1 -0
  415. package/dist/runtime.d.ts +35 -0
  416. package/dist/runtime.js +77 -0
  417. package/dist/runtime.js.map +1 -0
  418. package/dist/sarif.d.ts +36 -0
  419. package/dist/sarif.js +30 -0
  420. package/dist/sarif.js.map +1 -0
  421. package/dist/scripts/execute.d.ts +65 -0
  422. package/dist/scripts/execute.js +235 -0
  423. package/dist/scripts/execute.js.map +1 -0
  424. package/dist/scripts/registry.d.ts +55 -0
  425. package/dist/scripts/registry.js +103 -0
  426. package/dist/scripts/registry.js.map +1 -0
  427. package/dist/scripts/resolve.d.ts +90 -0
  428. package/dist/scripts/resolve.js +288 -0
  429. package/dist/scripts/resolve.js.map +1 -0
  430. package/dist/sections.d.ts +53 -0
  431. package/dist/sections.js +100 -0
  432. package/dist/sections.js.map +1 -0
  433. package/dist/serve/errors.d.ts +25 -0
  434. package/dist/serve/errors.js +45 -0
  435. package/dist/serve/errors.js.map +1 -0
  436. package/dist/serve/paths.d.ts +32 -0
  437. package/dist/serve/paths.js +71 -0
  438. package/dist/serve/paths.js.map +1 -0
  439. package/dist/serve/server.d.ts +31 -0
  440. package/dist/serve/server.js +123 -0
  441. package/dist/serve/server.js.map +1 -0
  442. package/dist/serve/tools.d.ts +19 -0
  443. package/dist/serve/tools.js +597 -0
  444. package/dist/serve/tools.js.map +1 -0
  445. package/dist/snippets.d.ts +184 -0
  446. package/dist/snippets.js +454 -0
  447. package/dist/snippets.js.map +1 -0
  448. package/dist/sqlite-store.d.ts +62 -0
  449. package/dist/sqlite-store.js +104 -0
  450. package/dist/sqlite-store.js.map +1 -0
  451. package/dist/sqlite.d.ts +59 -0
  452. package/dist/sqlite.js +51 -0
  453. package/dist/sqlite.js.map +1 -0
  454. package/dist/toc.d.ts +58 -0
  455. package/dist/toc.js +83 -0
  456. package/dist/toc.js.map +1 -0
  457. package/dist/types.d.ts +7 -0
  458. package/dist/types.js +2 -0
  459. package/dist/types.js.map +1 -0
  460. package/dist/update-notifier.d.ts +95 -0
  461. package/dist/update-notifier.js +301 -0
  462. package/dist/update-notifier.js.map +1 -0
  463. package/dist/url-cache.d.ts +14 -0
  464. package/dist/url-cache.js +70 -0
  465. package/dist/url-cache.js.map +1 -0
  466. package/dist/usage/aggregate.d.ts +107 -0
  467. package/dist/usage/aggregate.js +435 -0
  468. package/dist/usage/aggregate.js.map +1 -0
  469. package/dist/usage/db/index.d.ts +49 -0
  470. package/dist/usage/db/index.js +118 -0
  471. package/dist/usage/db/index.js.map +1 -0
  472. package/dist/usage/db/migrations.d.ts +29 -0
  473. package/dist/usage/db/migrations.js +38 -0
  474. package/dist/usage/db/migrations.js.map +1 -0
  475. package/dist/usage/db/open.d.ts +33 -0
  476. package/dist/usage/db/open.js +37 -0
  477. package/dist/usage/db/open.js.map +1 -0
  478. package/dist/usage/db/schema.d.ts +18 -0
  479. package/dist/usage/db/schema.js +147 -0
  480. package/dist/usage/db/schema.js.map +1 -0
  481. package/dist/usage/db/store.d.ts +74 -0
  482. package/dist/usage/db/store.js +280 -0
  483. package/dist/usage/db/store.js.map +1 -0
  484. package/dist/usage/events.d.ts +202 -0
  485. package/dist/usage/events.js +243 -0
  486. package/dist/usage/events.js.map +1 -0
  487. package/dist/usage/filter.d.ts +43 -0
  488. package/dist/usage/filter.js +97 -0
  489. package/dist/usage/filter.js.map +1 -0
  490. package/dist/usage/providers/antigravity.d.ts +2 -0
  491. package/dist/usage/providers/antigravity.js +431 -0
  492. package/dist/usage/providers/antigravity.js.map +1 -0
  493. package/dist/usage/providers/claude-code.d.ts +2 -0
  494. package/dist/usage/providers/claude-code.js +400 -0
  495. package/dist/usage/providers/claude-code.js.map +1 -0
  496. package/dist/usage/providers/codex.d.ts +2 -0
  497. package/dist/usage/providers/codex.js +387 -0
  498. package/dist/usage/providers/codex.js.map +1 -0
  499. package/dist/usage/providers/gemini-cli.d.ts +2 -0
  500. package/dist/usage/providers/gemini-cli.js +466 -0
  501. package/dist/usage/providers/gemini-cli.js.map +1 -0
  502. package/dist/usage/providers/index.d.ts +23 -0
  503. package/dist/usage/providers/index.js +46 -0
  504. package/dist/usage/providers/index.js.map +1 -0
  505. package/dist/usage/providers/opencode.d.ts +2 -0
  506. package/dist/usage/providers/opencode.js +422 -0
  507. package/dist/usage/providers/opencode.js.map +1 -0
  508. package/dist/usage/providers/protobuf.d.ts +35 -0
  509. package/dist/usage/providers/protobuf.js +125 -0
  510. package/dist/usage/providers/protobuf.js.map +1 -0
  511. package/dist/usage/providers/types.d.ts +74 -0
  512. package/dist/usage/providers/types.js +2 -0
  513. package/dist/usage/providers/types.js.map +1 -0
  514. package/dist/usage/scan.d.ts +54 -0
  515. package/dist/usage/scan.js +216 -0
  516. package/dist/usage/scan.js.map +1 -0
  517. package/dist/version.d.ts +2 -0
  518. package/dist/version.js +8 -0
  519. package/dist/version.js.map +1 -0
  520. package/dist/workspace-index.d.ts +39 -0
  521. package/dist/workspace-index.js +265 -0
  522. package/dist/workspace-index.js.map +1 -0
  523. package/dist/workspace.d.ts +89 -0
  524. package/dist/workspace.js +219 -0
  525. package/dist/workspace.js.map +1 -0
  526. package/package.json +92 -0
@@ -0,0 +1,1035 @@
1
+ import { schemaUri } from "../version.js";
2
+ import { DRAFT, ISSUE_DEF, countMap, stringArray } from "./shared.js";
3
+ export const issueSchema = {
4
+ id: "issue",
5
+ uri: schemaUri("v1", "issue"),
6
+ title: "Finding record",
7
+ commands: [],
8
+ schema: {
9
+ $schema: DRAFT,
10
+ $id: schemaUri("v1", "issue"),
11
+ title: "Finding record",
12
+ description: "A single diagnostic produced by a markdown check.",
13
+ ...ISSUE_DEF,
14
+ },
15
+ };
16
+ export const issueListSchema = {
17
+ id: "issue-list",
18
+ uri: schemaUri("v1", "issue-list"),
19
+ title: "Finding list",
20
+ commands: ["md lint", "md lint-dir", "md validate-frontmatter", "md refs", "md links"],
21
+ schema: {
22
+ $schema: DRAFT,
23
+ $id: schemaUri("v1", "issue-list"),
24
+ title: "Finding list",
25
+ description: "A bare array of findings. Empty when the inputs are clean; the exit code and the stream carry the outcome.",
26
+ type: "array",
27
+ items: { $ref: "#/$defs/issue" },
28
+ $defs: { issue: ISSUE_DEF },
29
+ },
30
+ };
31
+ export const diagnosticRecordSchema = {
32
+ id: "diagnostic-record",
33
+ uri: schemaUri("v1", "diagnostic-record"),
34
+ title: "Automation record",
35
+ commands: ["md lint", "md lint-dir", "md audit", "md validate-frontmatter", "md check-urls"],
36
+ schema: {
37
+ $schema: DRAFT,
38
+ $id: schemaUri("v1", "diagnostic-record"),
39
+ title: "Automation record",
40
+ description: "One line of --format jsonl output. Findings and results stream first, followed by exactly one summary record.",
41
+ type: "object",
42
+ required: ["type"],
43
+ properties: {
44
+ type: { enum: ["finding", "result", "summary"] },
45
+ file: { type: "string" },
46
+ line: { type: "integer", minimum: 0 },
47
+ checker: { type: "string" },
48
+ message: { type: "string" },
49
+ url: { type: "string" },
50
+ status: { type: ["integer", "null"] },
51
+ ok: { type: "boolean" },
52
+ files: { type: "integer", minimum: 0 },
53
+ findings: { type: "integer", minimum: 0 },
54
+ total: { type: "integer", minimum: 0 },
55
+ broken: { type: "integer", minimum: 0 },
56
+ enabled: stringArray,
57
+ skipped: stringArray,
58
+ },
59
+ },
60
+ };
61
+ export const lintDirSummarySchema = {
62
+ id: "lint-dir-summary",
63
+ uri: schemaUri("v1", "lint-dir-summary"),
64
+ title: "Per-file lint summary",
65
+ commands: ["md lint-dir"],
66
+ schema: {
67
+ $schema: DRAFT,
68
+ $id: schemaUri("v1", "lint-dir-summary"),
69
+ title: "Per-file lint summary",
70
+ description: "Emitted by `md lint-dir --summary --format json`. Without --summary the command emits a finding list instead.",
71
+ type: "array",
72
+ items: {
73
+ type: "object",
74
+ required: ["file", "issues", "ok"],
75
+ properties: {
76
+ file: { type: "string" },
77
+ issues: { type: "integer", minimum: 0 },
78
+ ok: { type: "boolean" },
79
+ },
80
+ },
81
+ },
82
+ };
83
+ export const mdGraphSchema = {
84
+ id: "md-graph",
85
+ uri: schemaUri("v1", "md-graph"),
86
+ title: "Reference graph report",
87
+ commands: ["md graph"],
88
+ schema: {
89
+ $schema: DRAFT,
90
+ $id: schemaUri("v1", "md-graph"),
91
+ title: "Reference graph report",
92
+ description: "Emitted by `md graph --output report`. The mermaid and dot outputs are not JSON and ignore --format.",
93
+ type: "object",
94
+ required: [
95
+ "files",
96
+ "nodes",
97
+ "edges",
98
+ "broken",
99
+ "entries",
100
+ "reachabilityEvaluated",
101
+ "unreachable",
102
+ "deadEnds",
103
+ "components",
104
+ "cycles",
105
+ ],
106
+ properties: {
107
+ files: { type: "integer", minimum: 0 },
108
+ focus: {
109
+ description: "The neighborhood that was reported. Present only when --focus was given. Node counts and structural groups are still derived from the whole graph.",
110
+ type: "object",
111
+ required: ["files", "depth", "nodes", "omitted"],
112
+ properties: {
113
+ files: stringArray,
114
+ depth: { type: "integer", minimum: 0, maximum: 6 },
115
+ nodes: { type: "integer", minimum: 0 },
116
+ omitted: {
117
+ type: "integer",
118
+ minimum: 0,
119
+ description: "Selected documents outside the neighborhood.",
120
+ },
121
+ },
122
+ },
123
+ nodes: { type: "array", items: { $ref: "#/$defs/node" } },
124
+ edges: { type: "array", items: { $ref: "#/$defs/edge" } },
125
+ broken: { type: "array", items: { $ref: "#/$defs/brokenEdge" } },
126
+ entries: stringArray,
127
+ reachabilityEvaluated: {
128
+ type: "boolean",
129
+ description: "False when no entry points were resolved, making `unreachable` meaningless.",
130
+ },
131
+ unreachable: stringArray,
132
+ deadEnds: stringArray,
133
+ components: { type: "array", items: stringArray },
134
+ cycles: { type: "array", items: stringArray },
135
+ },
136
+ $defs: {
137
+ node: {
138
+ type: "object",
139
+ required: ["file", "inbound", "outbound", "deadEnd"],
140
+ properties: {
141
+ file: { type: "string" },
142
+ inbound: { type: "integer", minimum: 0 },
143
+ outbound: { type: "integer", minimum: 0 },
144
+ deadEnd: { type: "boolean" },
145
+ },
146
+ },
147
+ edge: {
148
+ type: "object",
149
+ required: ["source", "target", "lines", "occurrences"],
150
+ properties: {
151
+ source: { type: "string" },
152
+ target: { type: "string" },
153
+ lines: {
154
+ type: "array",
155
+ items: { type: "integer", minimum: 0 },
156
+ description: "Every line in the source that links to the target.",
157
+ },
158
+ occurrences: { type: "integer", minimum: 1 },
159
+ },
160
+ },
161
+ brokenEdge: {
162
+ type: "object",
163
+ required: ["source", "target", "resolved", "line"],
164
+ properties: {
165
+ source: { type: "string" },
166
+ resolved: { type: "string", description: "The path the link resolved to." },
167
+ target: { type: "string", description: "The raw link target as written." },
168
+ line: { type: "integer", minimum: 0 },
169
+ },
170
+ },
171
+ },
172
+ },
173
+ };
174
+ export const mdAuditSchema = {
175
+ id: "md-audit",
176
+ uri: schemaUri("v1", "md-audit"),
177
+ title: "Workspace audit report",
178
+ commands: ["md audit"],
179
+ schema: {
180
+ $schema: DRAFT,
181
+ $id: schemaUri("v1", "md-audit"),
182
+ title: "Workspace audit report",
183
+ description: "The jsonl and sarif forms of this command carry only the findings, not the totals or graph summary.",
184
+ type: "object",
185
+ required: ["directory", "enabled", "skipped", "totals", "findings"],
186
+ properties: {
187
+ directory: { type: "string" },
188
+ enabled: stringArray,
189
+ skipped: stringArray,
190
+ totals: {
191
+ type: "object",
192
+ required: ["files", "findings", "filesWithFindings", "byCheck", "byFile"],
193
+ properties: {
194
+ files: { type: "integer", minimum: 0 },
195
+ findings: { type: "integer", minimum: 0 },
196
+ filesWithFindings: { type: "integer", minimum: 0 },
197
+ byCheck: countMap,
198
+ byFile: countMap,
199
+ },
200
+ },
201
+ findings: { type: "array", items: { $ref: "#/$defs/issue" } },
202
+ baseline: {
203
+ description: "Baseline suppression. Present only when --baseline was given. Never affects the exit code by itself: `stale` records entries that matched nothing, which means something was fixed.",
204
+ type: "object",
205
+ required: ["path", "suppressed", "stale"],
206
+ properties: {
207
+ path: { type: "string" },
208
+ suppressed: { type: "integer", minimum: 0 },
209
+ stale: { type: "array", items: { $ref: "#/$defs/baselineEntry" } },
210
+ },
211
+ },
212
+ graph: {
213
+ description: "Omitted entirely when the graph check is disabled.",
214
+ type: "object",
215
+ properties: {
216
+ nodes: { type: "integer", minimum: 0 },
217
+ edges: { type: "integer", minimum: 0 },
218
+ broken: { type: "integer", minimum: 0 },
219
+ unreachable: { type: "integer", minimum: 0 },
220
+ deadEnds: { type: "integer", minimum: 0 },
221
+ components: { type: "integer", minimum: 0 },
222
+ cycles: { type: "integer", minimum: 0 },
223
+ reachabilityEvaluated: { type: "boolean" },
224
+ },
225
+ },
226
+ },
227
+ $defs: {
228
+ issue: ISSUE_DEF,
229
+ baselineEntry: {
230
+ type: "object",
231
+ description: "One recorded finding. Keyed without a line number, so `count` carries multiplicity: a second identical finding in the same file is a regression.",
232
+ required: ["checker", "file", "message", "count"],
233
+ properties: {
234
+ checker: { type: "string" },
235
+ file: { type: "string", description: "Workspace-relative, with `/` separators." },
236
+ message: { type: "string" },
237
+ count: { type: "integer", minimum: 1 },
238
+ },
239
+ },
240
+ },
241
+ },
242
+ };
243
+ export const mdQuerySchema = {
244
+ id: "md-query",
245
+ uri: schemaUri("v1", "md-query"),
246
+ title: "Workspace query result",
247
+ commands: ["md query"],
248
+ schema: {
249
+ $schema: DRAFT,
250
+ $id: schemaUri("v1", "md-query"),
251
+ title: "Workspace query result",
252
+ description: "Two modes share one payload. Without composable options the six shortcut kinds emit their historical shapes and `kind` determines the shape of `results`. With --where, --select, or --group-by, `kind` names an entity, `fields` carries the projection in column order, and `results` holds projected rows — or group objects when `groupBy` is present. `projectedRow` requires no keys because --select decides which are present, so it validates loosely by design; the known field names are still type-checked.",
253
+ type: "object",
254
+ required: ["kind", "directory", "count", "results"],
255
+ properties: {
256
+ kind: {
257
+ enum: [
258
+ "links-to",
259
+ "duplicates",
260
+ "unused-assets",
261
+ "code-blocks",
262
+ "tasks",
263
+ "missing-h1",
264
+ "documents",
265
+ "headings",
266
+ "links",
267
+ "frontmatter",
268
+ "frontmatter-keys",
269
+ ],
270
+ },
271
+ fields: {
272
+ description: "Projected column order. Present only for a composable query.",
273
+ ...stringArray,
274
+ },
275
+ groupBy: {
276
+ type: "string",
277
+ description: "The --group-by field. Present only when `results` holds group objects.",
278
+ },
279
+ directory: { type: "string" },
280
+ count: { type: "integer", minimum: 0 },
281
+ results: {
282
+ type: "array",
283
+ items: {
284
+ // anyOf, not oneOf: the result shapes overlap by design — a task
285
+ // result carries `file` and so also satisfies the file shape.
286
+ anyOf: [
287
+ { $ref: "#/$defs/linkResult" },
288
+ { $ref: "#/$defs/duplicateResult" },
289
+ { $ref: "#/$defs/assetResult" },
290
+ { $ref: "#/$defs/codeBlockResult" },
291
+ { $ref: "#/$defs/taskResult" },
292
+ { $ref: "#/$defs/fileResult" },
293
+ { $ref: "#/$defs/frontmatterKeyResult" },
294
+ { $ref: "#/$defs/projectedRow" },
295
+ { $ref: "#/$defs/groupResult" },
296
+ ],
297
+ },
298
+ },
299
+ summary: {
300
+ description: "Task totals for kind 'tasks' without composable options; { documents, withFrontmatter, keys } for 'frontmatter-keys'; { matched, groups } for a grouped composable query.",
301
+ ...countMap,
302
+ },
303
+ },
304
+ $defs: {
305
+ projectedRow: {
306
+ type: "object",
307
+ description: "A composable-query row. --select decides which keys are present, so none is required; the types of the known field names are still enforced. Dotted keys such as 'frontmatter.owner' carry raw YAML and are unconstrained.",
308
+ properties: {
309
+ file: { type: "string" },
310
+ line: { type: "integer", minimum: 0 },
311
+ endLine: { type: "integer", minimum: 0 },
312
+ lines: { type: "integer", minimum: 0 },
313
+ depth: { type: "integer", minimum: 1, maximum: 6 },
314
+ text: { type: "string" },
315
+ slug: { type: "string" },
316
+ title: { type: ["string", "null"] },
317
+ checked: { type: "boolean" },
318
+ status: { type: "string" },
319
+ language: { type: ["string", "null"] },
320
+ content: { type: "string" },
321
+ linkText: { type: "string" },
322
+ target: { type: "string" },
323
+ isImage: { type: "boolean" },
324
+ isExternal: { type: "boolean" },
325
+ isAnchorOnly: { type: "boolean" },
326
+ referenceType: { type: "string" },
327
+ key: { type: "string" },
328
+ type: { type: "string" },
329
+ h1: { type: "boolean" },
330
+ headings: { type: "integer", minimum: 0 },
331
+ tasks: { type: "integer", minimum: 0 },
332
+ links: { type: "integer", minimum: 0 },
333
+ code: { type: "integer", minimum: 0 },
334
+ words: { type: "integer", minimum: 0 },
335
+ frontmatterStatus: { type: "string" },
336
+ },
337
+ },
338
+ groupResult: {
339
+ type: "object",
340
+ required: ["key", "count", "rows"],
341
+ properties: {
342
+ key: {
343
+ type: ["string", "null"],
344
+ description: "Null groups rows whose key was absent. A list key fans out.",
345
+ },
346
+ count: { type: "integer", minimum: 0 },
347
+ rows: { type: "array", items: { $ref: "#/$defs/projectedRow" } },
348
+ },
349
+ },
350
+ linkResult: {
351
+ type: "object",
352
+ required: ["sourceFile", "line", "linkText", "rawTarget"],
353
+ properties: {
354
+ sourceFile: { type: "string" },
355
+ line: { type: "integer", minimum: 0 },
356
+ linkText: { type: "string" },
357
+ rawTarget: { type: "string" },
358
+ },
359
+ },
360
+ duplicateResult: {
361
+ type: "object",
362
+ required: ["value", "occurrences"],
363
+ properties: {
364
+ value: { type: "string" },
365
+ occurrences: {
366
+ type: "array",
367
+ items: {
368
+ type: "object",
369
+ required: ["file", "line"],
370
+ properties: { file: { type: "string" }, line: { type: "integer", minimum: 0 } },
371
+ },
372
+ },
373
+ },
374
+ },
375
+ assetResult: {
376
+ type: "object",
377
+ required: ["file", "extension"],
378
+ properties: { file: { type: "string" }, extension: { type: "string" } },
379
+ },
380
+ codeBlockResult: {
381
+ type: "object",
382
+ required: ["language", "count", "occurrences"],
383
+ properties: {
384
+ language: { type: "string" },
385
+ count: { type: "integer", minimum: 0 },
386
+ occurrences: {
387
+ type: "array",
388
+ items: {
389
+ type: "object",
390
+ required: ["file", "line", "endLine"],
391
+ properties: {
392
+ file: { type: "string" },
393
+ line: { type: "integer", minimum: 0 },
394
+ endLine: { type: "integer", minimum: 0 },
395
+ content: { type: "string" },
396
+ },
397
+ },
398
+ },
399
+ },
400
+ },
401
+ taskResult: {
402
+ type: "object",
403
+ required: ["file", "line", "checked", "text"],
404
+ properties: {
405
+ file: { type: "string" },
406
+ line: { type: "integer", minimum: 0 },
407
+ checked: { type: "boolean" },
408
+ text: { type: "string" },
409
+ },
410
+ },
411
+ fileResult: {
412
+ type: "object",
413
+ required: ["file"],
414
+ properties: { file: { type: "string" } },
415
+ },
416
+ frontmatterKeyResult: {
417
+ type: "object",
418
+ description: "One top-level frontmatter key, for kind 'frontmatter-keys'. Nested keys are not inventoried.",
419
+ required: ["key", "documents", "coverage", "types"],
420
+ properties: {
421
+ key: { type: "string" },
422
+ documents: { type: "integer", minimum: 1 },
423
+ coverage: {
424
+ type: "number",
425
+ minimum: 0,
426
+ maximum: 1,
427
+ description: "documents divided by the number of documents with valid frontmatter, rounded to four decimals.",
428
+ },
429
+ types: {
430
+ description: "Distinct value types seen: null, array, or a typeof result.",
431
+ ...stringArray,
432
+ },
433
+ },
434
+ },
435
+ },
436
+ },
437
+ };
438
+ export const mdCheckUrlsSchema = {
439
+ id: "md-check-urls",
440
+ uri: schemaUri("v1", "md-check-urls"),
441
+ title: "URL check report",
442
+ commands: ["md check-urls"],
443
+ schema: {
444
+ $schema: DRAFT,
445
+ $id: schemaUri("v1", "md-check-urls"),
446
+ title: "URL check report",
447
+ type: "object",
448
+ required: ["files", "total", "ok", "broken", "results"],
449
+ properties: {
450
+ file: {
451
+ type: "string",
452
+ description: "Present only when exactly one input file was checked.",
453
+ },
454
+ files: { type: "integer", minimum: 0 },
455
+ total: { type: "integer", minimum: 0 },
456
+ ok: { type: "integer", minimum: 0 },
457
+ broken: { type: "integer", minimum: 0 },
458
+ results: {
459
+ type: "array",
460
+ items: {
461
+ type: "object",
462
+ required: ["file", "line", "url", "status", "ok"],
463
+ properties: {
464
+ file: { type: "string" },
465
+ line: { type: "integer", minimum: 0 },
466
+ url: { type: "string" },
467
+ status: {
468
+ type: ["integer", "null"],
469
+ description: "Null when the request failed before a response was received.",
470
+ },
471
+ ok: { type: "boolean" },
472
+ error: { type: "string" },
473
+ redirected: { type: "boolean" },
474
+ finalUrl: { type: "string" },
475
+ },
476
+ },
477
+ },
478
+ },
479
+ },
480
+ };
481
+ export const mdCheckSnippetsSchema = {
482
+ id: "md-check-snippets",
483
+ uri: schemaUri("v1", "md-check-snippets"),
484
+ title: "Snippet check report",
485
+ commands: ["md check-snippets"],
486
+ schema: {
487
+ $schema: DRAFT,
488
+ $id: schemaUri("v1", "md-check-snippets"),
489
+ title: "Snippet check report",
490
+ description: "Emitted by `md check-snippets --format json`. Counts and findings describe only fences whose info string carries a cairn:snippet= attribute; every other fence is absent.",
491
+ type: "object",
492
+ required: [
493
+ "mode",
494
+ "filesScanned",
495
+ "linked",
496
+ "current",
497
+ "drift",
498
+ "unresolved",
499
+ "malformed",
500
+ "unwritable",
501
+ "applied",
502
+ "findings",
503
+ "conflicts",
504
+ ],
505
+ properties: {
506
+ mode: { type: "string", enum: ["check", "dry-run", "write"] },
507
+ filesScanned: { type: "integer", minimum: 0 },
508
+ linked: { type: "integer", minimum: 0 },
509
+ current: { type: "integer", minimum: 0 },
510
+ drift: { type: "integer", minimum: 0 },
511
+ unresolved: { type: "integer", minimum: 0 },
512
+ malformed: { type: "integer", minimum: 0 },
513
+ unwritable: {
514
+ type: "integer",
515
+ minimum: 0,
516
+ description: "Stale blocks whose fence cannot be rewritten. Always 0 under --check.",
517
+ },
518
+ applied: {
519
+ type: "integer",
520
+ minimum: 0,
521
+ description: "Files whose bytes changed. Always 0 outside --write.",
522
+ },
523
+ findings: {
524
+ type: "array",
525
+ items: {
526
+ type: "object",
527
+ required: ["file", "line", "endLine", "status"],
528
+ properties: {
529
+ file: { type: "string" },
530
+ line: { type: "integer", minimum: 0 },
531
+ endLine: { type: "integer", minimum: 0 },
532
+ status: { type: "string", enum: ["current", "stale", "unresolved", "malformed"] },
533
+ target: {
534
+ type: "string",
535
+ description: "The attribute value as written. Absent when it could not be parsed.",
536
+ },
537
+ source: { type: "string" },
538
+ reason: { type: "string" },
539
+ message: { type: "string" },
540
+ documented: { type: "string", description: "--dry-run only." },
541
+ expected: { type: "string", description: "--dry-run only." },
542
+ writable: { type: "boolean", description: "Stale blocks outside --check." },
543
+ applied: { type: "boolean", description: "--write only." },
544
+ },
545
+ },
546
+ },
547
+ conflicts: {
548
+ type: "array",
549
+ items: {
550
+ type: "object",
551
+ required: ["kind", "file", "message", "rules"],
552
+ properties: {
553
+ kind: { type: "string" },
554
+ file: { type: "string" },
555
+ message: { type: "string" },
556
+ rules: stringArray,
557
+ },
558
+ },
559
+ },
560
+ },
561
+ },
562
+ };
563
+ export const mdOrphansSchema = {
564
+ id: "md-orphans",
565
+ uri: schemaUri("v1", "md-orphans"),
566
+ title: "Orphan report",
567
+ commands: ["md orphans"],
568
+ schema: {
569
+ $schema: DRAFT,
570
+ $id: schemaUri("v1", "md-orphans"),
571
+ title: "Orphan report",
572
+ type: "object",
573
+ required: ["directory", "totalFiles", "orphans"],
574
+ properties: {
575
+ directory: { type: "string" },
576
+ totalFiles: { type: "integer", minimum: 0 },
577
+ orphans: stringArray,
578
+ },
579
+ },
580
+ };
581
+ export const mdIndexSchema = {
582
+ id: "md-index",
583
+ uri: schemaUri("v1", "md-index"),
584
+ title: "Workspace index status",
585
+ commands: ["md index"],
586
+ schema: {
587
+ $schema: DRAFT,
588
+ $id: schemaUri("v1", "md-index"),
589
+ title: "Workspace index status",
590
+ description: "The 'clear' action reports only `cleared`; 'status' and 'build' report the index counters.",
591
+ type: "object",
592
+ required: ["action", "directory"],
593
+ properties: {
594
+ action: { enum: ["status", "build", "clear"] },
595
+ directory: { type: "string" },
596
+ cleared: { type: "boolean", description: "Present only for the 'clear' action." },
597
+ cachePath: { type: "string" },
598
+ exists: { type: "boolean" },
599
+ version: { type: "integer" },
600
+ indexed: { type: "integer", minimum: 0 },
601
+ current: { type: "integer", minimum: 0 },
602
+ stale: { type: "integer", minimum: 0 },
603
+ missing: { type: "integer", minimum: 0 },
604
+ },
605
+ },
606
+ };
607
+ export const mdContextSchema = {
608
+ id: "md-context",
609
+ uri: schemaUri("v1", "md-context"),
610
+ title: "Context pack",
611
+ commands: ["md context"],
612
+ schema: {
613
+ $schema: DRAFT,
614
+ $id: schemaUri("v1", "md-context"),
615
+ title: "Context pack",
616
+ description: "Units are ordered by graph distance, then the order a document entered the traversal, then document order. The pack is a prefix of that order: the first unit that would exceed the budget stops inclusion, and every later unit is reported under `omitted`.",
617
+ type: "object",
618
+ required: [
619
+ "seeds",
620
+ "depth",
621
+ "backlinks",
622
+ "files",
623
+ "units",
624
+ "omitted",
625
+ "broken",
626
+ "budget",
627
+ "totals",
628
+ ],
629
+ properties: {
630
+ seeds: stringArray,
631
+ depth: { type: "integer", minimum: 0, description: "Graph hops followed from the seeds." },
632
+ backlinks: { type: "boolean" },
633
+ files: {
634
+ description: "Documents contributing at least one included unit.",
635
+ ...stringArray,
636
+ },
637
+ units: { type: "array", items: { $ref: "#/$defs/unit" } },
638
+ omitted: { type: "array", items: { $ref: "#/$defs/omission" } },
639
+ broken: { type: "array", items: { $ref: "#/$defs/brokenDependency" } },
640
+ budget: { $ref: "#/$defs/budget" },
641
+ totals: {
642
+ type: "object",
643
+ required: ["files", "units", "bytes"],
644
+ properties: {
645
+ files: { type: "integer", minimum: 0 },
646
+ units: { type: "integer", minimum: 0 },
647
+ bytes: { type: "integer", minimum: 0 },
648
+ },
649
+ },
650
+ },
651
+ $defs: {
652
+ provenance: {
653
+ type: "object",
654
+ required: ["distance", "direction", "reason"],
655
+ properties: {
656
+ distance: { type: "integer", minimum: 0, description: "Hops from the nearest seed." },
657
+ via: { type: "string", description: "Document that pulled this one in." },
658
+ viaLine: {
659
+ type: "integer",
660
+ minimum: 0,
661
+ description: "Line carrying the link: in `via` when direction is 'link', in this document when it is 'backlink'.",
662
+ },
663
+ direction: { enum: ["seed", "link", "backlink"] },
664
+ reason: { type: "string" },
665
+ },
666
+ },
667
+ unit: {
668
+ type: "object",
669
+ required: [
670
+ "id",
671
+ "kind",
672
+ "file",
673
+ "heading",
674
+ "slug",
675
+ "depth",
676
+ "startLine",
677
+ "endLine",
678
+ "bytes",
679
+ "provenance",
680
+ "content",
681
+ ],
682
+ properties: {
683
+ id: { type: "string", description: "`<file>#<slug>`, `#frontmatter`, or `#preamble`." },
684
+ kind: { enum: ["frontmatter", "preamble", "section"] },
685
+ file: { type: "string" },
686
+ heading: { type: ["string", "null"] },
687
+ slug: { type: ["string", "null"] },
688
+ depth: { type: "integer", minimum: 0, maximum: 6 },
689
+ startLine: { type: "integer", minimum: 0 },
690
+ endLine: { type: "integer", minimum: 0 },
691
+ bytes: { type: "integer", minimum: 0, description: "UTF-8 bytes of `content`." },
692
+ provenance: { $ref: "#/$defs/provenance" },
693
+ content: { type: "string" },
694
+ },
695
+ },
696
+ omission: {
697
+ type: "object",
698
+ required: ["id", "file", "heading", "bytes", "reason"],
699
+ properties: {
700
+ id: { type: "string" },
701
+ file: { type: "string" },
702
+ heading: { type: ["string", "null"] },
703
+ bytes: { type: "integer", minimum: 0 },
704
+ reason: { enum: ["budget"] },
705
+ },
706
+ },
707
+ brokenDependency: {
708
+ type: "object",
709
+ required: ["source", "target", "resolved", "line"],
710
+ properties: {
711
+ source: { type: "string" },
712
+ target: { type: "string", description: "The link target as written." },
713
+ resolved: { type: "string" },
714
+ line: { type: "integer", minimum: 0 },
715
+ },
716
+ },
717
+ budget: {
718
+ type: "object",
719
+ required: ["limitBytes", "usedBytes", "omittedBytes", "tokenEstimate", "truncated"],
720
+ properties: {
721
+ limitBytes: { type: ["integer", "null"], minimum: 0 },
722
+ usedBytes: { type: "integer", minimum: 0 },
723
+ omittedBytes: { type: "integer", minimum: 0 },
724
+ tokenEstimate: {
725
+ type: "integer",
726
+ minimum: 0,
727
+ description: "ceil(usedBytes / 4). A size signal, not a model tokenizer; it never affects which units are included.",
728
+ },
729
+ truncated: { type: "boolean" },
730
+ },
731
+ },
732
+ },
733
+ },
734
+ };
735
+ export const mdDiffSchema = {
736
+ id: "md-diff",
737
+ uri: schemaUri("v1", "md-diff"),
738
+ title: "Markdown structural diff",
739
+ commands: ["md diff"],
740
+ schema: {
741
+ $schema: DRAFT,
742
+ $id: schemaUri("v1", "md-diff"),
743
+ title: "Markdown structural diff",
744
+ description: "An AST-aware change summary, not a textual diff. Heading pairs reported with `heuristic: true` were matched by position rather than by identity and should be treated as a guess. Each change list is ordered by new line, then old line, then kind.",
745
+ type: "object",
746
+ required: ["mode", "files", "totals"],
747
+ properties: {
748
+ mode: { enum: ["files", "revision"] },
749
+ base: { type: "string", description: "Revision mode: the revision as written." },
750
+ baseCommit: { type: "string", description: "Revision mode: the resolved commit." },
751
+ from: { type: "string", description: "Files mode: the first path." },
752
+ to: { type: "string", description: "Files mode: the second path." },
753
+ files: { type: "array", items: { $ref: "#/$defs/fileDiff" } },
754
+ totals: {
755
+ type: "object",
756
+ required: [
757
+ "files",
758
+ "filesChanged",
759
+ "headings",
760
+ "frontmatter",
761
+ "links",
762
+ "tasks",
763
+ "codeBlocks",
764
+ "tables",
765
+ "heuristicRenames",
766
+ "diagrams",
767
+ ],
768
+ properties: {
769
+ files: { type: "integer", minimum: 0 },
770
+ filesChanged: { type: "integer", minimum: 0 },
771
+ headings: { type: "integer", minimum: 0 },
772
+ frontmatter: { type: "integer", minimum: 0 },
773
+ links: { type: "integer", minimum: 0 },
774
+ tasks: { type: "integer", minimum: 0 },
775
+ codeBlocks: { type: "integer", minimum: 0 },
776
+ tables: { type: "integer", minimum: 0 },
777
+ heuristicRenames: {
778
+ type: "integer",
779
+ minimum: 0,
780
+ description: "Heading pairs the positional matcher called renames.",
781
+ },
782
+ diagrams: {
783
+ type: "integer",
784
+ minimum: 0,
785
+ description: "Code-block changes whose language is Mermaid.",
786
+ },
787
+ },
788
+ },
789
+ },
790
+ $defs: {
791
+ kind: { enum: ["added", "removed", "changed", "moved", "renamed"] },
792
+ headingChange: {
793
+ type: "object",
794
+ required: ["kind"],
795
+ properties: {
796
+ kind: { $ref: "#/$defs/kind" },
797
+ oldText: { type: "string" },
798
+ oldSlug: { type: "string" },
799
+ oldLine: { type: "integer", minimum: 0 },
800
+ oldDepth: { type: "integer", minimum: 1, maximum: 6 },
801
+ newText: { type: "string" },
802
+ newSlug: { type: "string" },
803
+ newLine: { type: "integer", minimum: 0 },
804
+ newDepth: { type: "integer", minimum: 1, maximum: 6 },
805
+ bodyChanged: { type: "boolean" },
806
+ heuristic: {
807
+ type: "boolean",
808
+ description: "The rename was matched by position, not by identity.",
809
+ },
810
+ matchedBy: { enum: ["slug", "text", "position"] },
811
+ },
812
+ },
813
+ frontmatterChange: {
814
+ type: "object",
815
+ required: ["kind", "key"],
816
+ properties: {
817
+ kind: { $ref: "#/$defs/kind" },
818
+ key: {
819
+ type: ["string", "null"],
820
+ description: "Dotted path, or null for a whole-block status transition.",
821
+ },
822
+ oldValue: { description: "Raw YAML value; any JSON type." },
823
+ newValue: { description: "Raw YAML value; any JSON type." },
824
+ oldStatus: { enum: ["missing", "malformed", "non-mapping", "valid"] },
825
+ newStatus: { enum: ["missing", "malformed", "non-mapping", "valid"] },
826
+ },
827
+ },
828
+ linkChange: {
829
+ type: "object",
830
+ required: ["kind"],
831
+ properties: {
832
+ kind: { $ref: "#/$defs/kind" },
833
+ oldTarget: { type: "string" },
834
+ newTarget: { type: "string" },
835
+ oldResolved: {
836
+ type: ["string", "null"],
837
+ description: "Null for external and anchor-only references.",
838
+ },
839
+ newResolved: { type: ["string", "null"] },
840
+ oldLine: { type: "integer", minimum: 0 },
841
+ newLine: { type: "integer", minimum: 0 },
842
+ linkText: { type: "string" },
843
+ fragmentChanged: { type: "boolean", description: "Only the anchor differs." },
844
+ },
845
+ },
846
+ taskChange: {
847
+ type: "object",
848
+ required: ["kind", "text"],
849
+ properties: {
850
+ kind: { $ref: "#/$defs/kind" },
851
+ text: { type: "string" },
852
+ oldLine: { type: "integer", minimum: 0 },
853
+ newLine: { type: "integer", minimum: 0 },
854
+ oldChecked: { type: "boolean" },
855
+ newChecked: { type: "boolean" },
856
+ },
857
+ },
858
+ codeBlockChange: {
859
+ type: "object",
860
+ required: ["kind"],
861
+ properties: {
862
+ kind: { $ref: "#/$defs/kind" },
863
+ oldLang: { type: ["string", "null"] },
864
+ newLang: { type: ["string", "null"] },
865
+ oldLine: { type: "integer", minimum: 0 },
866
+ newLine: { type: "integer", minimum: 0 },
867
+ langChanged: { type: "boolean" },
868
+ contentChanged: { type: "boolean" },
869
+ mermaid: { type: "boolean", description: "The block is a Mermaid diagram." },
870
+ },
871
+ },
872
+ tableChange: {
873
+ type: "object",
874
+ required: ["kind"],
875
+ properties: {
876
+ kind: { $ref: "#/$defs/kind" },
877
+ oldLine: { type: "integer", minimum: 0 },
878
+ newLine: { type: "integer", minimum: 0 },
879
+ oldColumns: { type: "integer", minimum: 0 },
880
+ newColumns: { type: "integer", minimum: 0 },
881
+ oldRows: { type: "integer", minimum: 0 },
882
+ newRows: { type: "integer", minimum: 0 },
883
+ headersChanged: { type: "boolean" },
884
+ },
885
+ },
886
+ fileDiff: {
887
+ type: "object",
888
+ required: [
889
+ "file",
890
+ "status",
891
+ "headings",
892
+ "frontmatter",
893
+ "links",
894
+ "tasks",
895
+ "codeBlocks",
896
+ "tables",
897
+ "totals",
898
+ ],
899
+ properties: {
900
+ file: { type: "string" },
901
+ oldPath: { type: "string", description: "Path at the base revision, when it differed." },
902
+ status: { enum: ["added", "removed", "modified", "renamed", "unchanged"] },
903
+ similarity: {
904
+ type: "integer",
905
+ minimum: 0,
906
+ maximum: 100,
907
+ description: "Git similarity index for a rename.",
908
+ },
909
+ headings: { type: "array", items: { $ref: "#/$defs/headingChange" } },
910
+ frontmatter: { type: "array", items: { $ref: "#/$defs/frontmatterChange" } },
911
+ links: { type: "array", items: { $ref: "#/$defs/linkChange" } },
912
+ tasks: { type: "array", items: { $ref: "#/$defs/taskChange" } },
913
+ codeBlocks: { type: "array", items: { $ref: "#/$defs/codeBlockChange" } },
914
+ tables: { type: "array", items: { $ref: "#/$defs/tableChange" } },
915
+ totals: {
916
+ type: "object",
917
+ required: [
918
+ "headings",
919
+ "frontmatter",
920
+ "links",
921
+ "tasks",
922
+ "codeBlocks",
923
+ "tables",
924
+ "changes",
925
+ ],
926
+ properties: {
927
+ headings: { type: "integer", minimum: 0 },
928
+ frontmatter: { type: "integer", minimum: 0 },
929
+ links: { type: "integer", minimum: 0 },
930
+ tasks: { type: "integer", minimum: 0 },
931
+ codeBlocks: { type: "integer", minimum: 0 },
932
+ tables: { type: "integer", minimum: 0 },
933
+ changes: { type: "integer", minimum: 0 },
934
+ },
935
+ },
936
+ },
937
+ },
938
+ },
939
+ },
940
+ };
941
+ export const mdFixSchema = {
942
+ id: "md-fix",
943
+ uri: schemaUri("v1", "md-fix"),
944
+ title: "Markdown fix plan",
945
+ commands: ["md fix"],
946
+ schema: {
947
+ $schema: DRAFT,
948
+ $id: schemaUri("v1", "md-fix"),
949
+ title: "Markdown fix plan",
950
+ description: "Offsets are UTF-16 code-unit indices into the utf-8-decoded file, not byte offsets. `expected` is the authoritative anchor: a consumer applying an edit itself should verify it first rather than trust the unit. A non-empty `conflicts` means nothing will be written in any mode.",
951
+ type: "object",
952
+ required: [
953
+ "mode",
954
+ "rules",
955
+ "filesScanned",
956
+ "filesWithEdits",
957
+ "edits",
958
+ "applied",
959
+ "files",
960
+ "conflicts",
961
+ "unfixable",
962
+ ],
963
+ properties: {
964
+ mode: { enum: ["check", "dry-run", "write"] },
965
+ rules: { description: "The fixers that ran.", ...stringArray },
966
+ filesScanned: { type: "integer", minimum: 0 },
967
+ filesWithEdits: { type: "integer", minimum: 0 },
968
+ edits: { type: "integer", minimum: 0 },
969
+ applied: {
970
+ type: "integer",
971
+ minimum: 0,
972
+ description: "Files whose bytes changed. Always 0 outside --write.",
973
+ },
974
+ files: { type: "array", items: { $ref: "#/$defs/filePlan" } },
975
+ conflicts: { type: "array", items: { $ref: "#/$defs/conflict" } },
976
+ unfixable: { type: "array", items: { $ref: "#/$defs/unfixable" } },
977
+ },
978
+ $defs: {
979
+ diagnostic: {
980
+ type: "object",
981
+ required: ["rule", "line", "message"],
982
+ properties: {
983
+ rule: { type: "string", description: "Fixer identity, e.g. 'toc'." },
984
+ line: { type: "integer", minimum: 0 },
985
+ message: { type: "string" },
986
+ },
987
+ },
988
+ edit: {
989
+ type: "object",
990
+ required: ["start", "end", "line", "expected", "replacement", "diagnostic"],
991
+ properties: {
992
+ start: { type: "integer", minimum: 0 },
993
+ end: { type: "integer", minimum: 0, description: "Exclusive." },
994
+ line: { type: "integer", minimum: 0 },
995
+ expected: { type: "string", description: "Text currently at [start, end)." },
996
+ replacement: { type: "string" },
997
+ diagnostic: { $ref: "#/$defs/diagnostic" },
998
+ },
999
+ },
1000
+ filePlan: {
1001
+ type: "object",
1002
+ required: ["file", "edits"],
1003
+ properties: {
1004
+ file: { type: "string" },
1005
+ edits: { type: "array", items: { $ref: "#/$defs/edit" } },
1006
+ applied: { type: "boolean", description: "Present only in --write mode." },
1007
+ },
1008
+ },
1009
+ conflict: {
1010
+ type: "object",
1011
+ required: ["kind", "file", "message", "rules"],
1012
+ properties: {
1013
+ kind: {
1014
+ enum: ["overlap", "outside-workspace", "stale-input", "expectation-mismatch"],
1015
+ },
1016
+ file: { type: "string" },
1017
+ message: { type: "string" },
1018
+ rules: { description: "Two entries for an overlap, one otherwise.", ...stringArray },
1019
+ },
1020
+ },
1021
+ unfixable: {
1022
+ type: "object",
1023
+ required: ["file", "line", "rule", "message", "reason"],
1024
+ properties: {
1025
+ file: { type: "string" },
1026
+ line: { type: "integer", minimum: 0 },
1027
+ rule: { type: "string" },
1028
+ message: { type: "string" },
1029
+ reason: { type: "string", description: "Why no edit was produced." },
1030
+ },
1031
+ },
1032
+ },
1033
+ },
1034
+ };
1035
+ //# sourceMappingURL=markdown.js.map