@hawkeyexl/manni 4.3.1 → 4.4.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.
- package/README.md +9 -1
- package/dist/batch-DFRCLY77.js +36 -0
- package/dist/build-Q5C6SX5J.js +31 -0
- package/dist/calibrate-XQILKXS3.js +31 -0
- package/dist/capture-JQMOC3BW.js +32 -0
- package/dist/check-HYNGXYJV.js +18 -0
- package/dist/check-HYNGXYJV.js.map +1 -0
- package/dist/check-NFZQLJKN.js +27 -0
- package/dist/check-NFZQLJKN.js.map +1 -0
- package/dist/check-U54XV6BP.js +40 -0
- package/dist/check-U54XV6BP.js.map +1 -0
- package/dist/chunk-252LNOEG.js +622 -0
- package/dist/chunk-252LNOEG.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-2U3ORT6D.js +230 -0
- package/dist/chunk-2U3ORT6D.js.map +1 -0
- package/dist/chunk-3AFUD75K.js +23 -0
- package/dist/chunk-3AFUD75K.js.map +1 -0
- package/dist/{chunk-3R23C5DT.js → chunk-4TSWU2SU.js} +2 -14
- package/dist/chunk-4TSWU2SU.js.map +1 -0
- package/dist/chunk-5KHIFVD2.js +1192 -0
- package/dist/chunk-5KHIFVD2.js.map +1 -0
- package/dist/chunk-5YXBLLAC.js +2165 -0
- package/dist/chunk-5YXBLLAC.js.map +1 -0
- package/dist/chunk-644JVKJ4.js +3872 -0
- package/dist/chunk-644JVKJ4.js.map +1 -0
- package/dist/chunk-6OYEI2VV.js +88 -0
- package/dist/chunk-6OYEI2VV.js.map +1 -0
- package/dist/chunk-77AINBYM.js +19 -0
- package/dist/chunk-77AINBYM.js.map +1 -0
- package/dist/chunk-77HX34KD.js +1287 -0
- package/dist/chunk-77HX34KD.js.map +1 -0
- package/dist/{chunk-CFDUZRM2.js → chunk-7QMCHA4N.js} +32 -240
- package/dist/chunk-7QMCHA4N.js.map +1 -0
- package/dist/chunk-BUXDLRDT.js +455 -0
- package/dist/chunk-BUXDLRDT.js.map +1 -0
- package/dist/chunk-C6OH6CNF.js +388 -0
- package/dist/chunk-C6OH6CNF.js.map +1 -0
- package/dist/chunk-CK7SKVHR.js +1042 -0
- package/dist/chunk-CK7SKVHR.js.map +1 -0
- package/dist/chunk-CYWHFSRT.js +6737 -0
- package/dist/chunk-CYWHFSRT.js.map +1 -0
- package/dist/chunk-ERMSO34F.js +17 -0
- package/dist/chunk-ERMSO34F.js.map +1 -0
- package/dist/{chunk-IOYXPBCL.js → chunk-G3T47CFV.js} +1 -7
- package/dist/{chunk-IOYXPBCL.js.map → chunk-G3T47CFV.js.map} +1 -1
- package/dist/chunk-G7NJSREW.js +979 -0
- package/dist/chunk-G7NJSREW.js.map +1 -0
- package/dist/chunk-GLP5PSXB.js +72 -0
- package/dist/chunk-GLP5PSXB.js.map +1 -0
- package/dist/chunk-H2DLH2JI.js +198 -0
- package/dist/chunk-H2DLH2JI.js.map +1 -0
- package/dist/chunk-H6FZ66XR.js +634 -0
- package/dist/chunk-H6FZ66XR.js.map +1 -0
- package/dist/{chunk-KJR7OVDX.js → chunk-IEQHSCZG.js} +56 -137
- package/dist/chunk-IEQHSCZG.js.map +1 -0
- package/dist/chunk-IKEWBMCN.js +98 -0
- package/dist/chunk-IKEWBMCN.js.map +1 -0
- package/dist/chunk-JOHKIAVH.js +5440 -0
- package/dist/chunk-JOHKIAVH.js.map +1 -0
- package/dist/chunk-JVTNMVYU.js +10921 -0
- package/dist/chunk-JVTNMVYU.js.map +1 -0
- package/dist/chunk-K3D6FPV6.js +164 -0
- package/dist/chunk-K3D6FPV6.js.map +1 -0
- package/dist/{chunk-UBMMXS2Y.js → chunk-KCGV52AM.js} +69 -48
- package/dist/{chunk-UBMMXS2Y.js.map → chunk-KCGV52AM.js.map} +1 -1
- package/dist/chunk-LAKAWRV5.js +1651 -0
- package/dist/chunk-LAKAWRV5.js.map +1 -0
- package/dist/chunk-LJ2RDH3F.js +49 -0
- package/dist/chunk-LJ2RDH3F.js.map +1 -0
- package/dist/chunk-M2JCK5F6.js +805 -0
- package/dist/chunk-M2JCK5F6.js.map +1 -0
- package/dist/chunk-MNH7QO4Z.js +15 -0
- package/dist/chunk-MNH7QO4Z.js.map +1 -0
- package/dist/{chunk-HAPTXWU2.js → chunk-MYC3O5EJ.js} +4 -4
- package/dist/chunk-MYMBCTDE.js +387 -0
- package/dist/chunk-MYMBCTDE.js.map +1 -0
- package/dist/chunk-NCPWXHDO.js +683 -0
- package/dist/chunk-NCPWXHDO.js.map +1 -0
- package/dist/chunk-NWZ2SLYL.js +2957 -0
- package/dist/chunk-NWZ2SLYL.js.map +1 -0
- package/dist/chunk-OBFENF3U.js +934 -0
- package/dist/chunk-OBFENF3U.js.map +1 -0
- package/dist/chunk-OWBRDNRZ.js +16 -0
- package/dist/chunk-OWBRDNRZ.js.map +1 -0
- package/dist/{chunk-KTSJ2ZHA.js → chunk-PAU352SV.js} +5 -3
- package/dist/{chunk-KTSJ2ZHA.js.map → chunk-PAU352SV.js.map} +1 -1
- package/dist/chunk-PCE7QHXJ.js +68 -0
- package/dist/chunk-PCE7QHXJ.js.map +1 -0
- package/dist/chunk-PCHZY2I7.js +299 -0
- package/dist/chunk-PCHZY2I7.js.map +1 -0
- package/dist/chunk-PHF3D7ER.js +1042 -0
- package/dist/chunk-PHF3D7ER.js.map +1 -0
- package/dist/chunk-Q35YIDBV.js +1202 -0
- package/dist/chunk-Q35YIDBV.js.map +1 -0
- package/dist/chunk-RLR4TKUZ.js +4398 -0
- package/dist/chunk-RLR4TKUZ.js.map +1 -0
- package/dist/chunk-RNVYGWIC.js +30 -0
- package/dist/chunk-RNVYGWIC.js.map +1 -0
- package/dist/chunk-SE4JN5XN.js +19 -0
- package/dist/chunk-SE4JN5XN.js.map +1 -0
- package/dist/chunk-TIUTIOFB.js +25 -0
- package/dist/chunk-TIUTIOFB.js.map +1 -0
- package/dist/chunk-TU2WUBVZ.js +2 -0
- package/dist/chunk-TU2WUBVZ.js.map +1 -0
- package/dist/chunk-TZOYZK2E.js +98 -0
- package/dist/chunk-TZOYZK2E.js.map +1 -0
- package/dist/chunk-UKZNLVJW.js +17 -0
- package/dist/chunk-UKZNLVJW.js.map +1 -0
- package/dist/chunk-UZC7LDAQ.js +178 -0
- package/dist/chunk-UZC7LDAQ.js.map +1 -0
- package/dist/chunk-V46OILVC.js +3090 -0
- package/dist/chunk-V46OILVC.js.map +1 -0
- package/dist/chunk-WQE54PNH.js +1975 -0
- package/dist/chunk-WQE54PNH.js.map +1 -0
- package/dist/chunk-X3BPBDGQ.js +52 -0
- package/dist/chunk-X3BPBDGQ.js.map +1 -0
- package/dist/chunk-XSLV76YK.js +54 -0
- package/dist/chunk-XSLV76YK.js.map +1 -0
- package/dist/{chunk-5HNHEUD5.js → chunk-XYLUCIKQ.js} +3 -3
- package/dist/chunk-YEUYKR62.js +72 -0
- package/dist/chunk-YEUYKR62.js.map +1 -0
- package/dist/{chunk-G5CM2VGQ.js → chunk-YFQBFNQS.js} +8 -94
- package/dist/chunk-YFQBFNQS.js.map +1 -0
- package/dist/chunk-YIL4XLLJ.js +1661 -0
- package/dist/chunk-YIL4XLLJ.js.map +1 -0
- package/dist/chunk-YNHZHSSM.js +41 -0
- package/dist/chunk-YNHZHSSM.js.map +1 -0
- package/dist/chunk-YTCZRLTU.js +96 -0
- package/dist/chunk-YTCZRLTU.js.map +1 -0
- package/dist/chunk-YYBFZLAJ.js +374 -0
- package/dist/chunk-YYBFZLAJ.js.map +1 -0
- package/dist/chunk-ZXRAE55H.js +31 -0
- package/dist/chunk-ZXRAE55H.js.map +1 -0
- package/dist/cli-2QPR2OZG.js +232 -0
- package/dist/cli-2QPR2OZG.js.map +1 -0
- package/dist/cli-4IOPGZHR.js +1203 -0
- package/dist/cli-4IOPGZHR.js.map +1 -0
- package/dist/cli-5FL73WHA.js +346 -0
- package/dist/cli-5FL73WHA.js.map +1 -0
- package/dist/cli-C262QOWM.js +739 -0
- package/dist/cli-C262QOWM.js.map +1 -0
- package/dist/cli-LJLLIQB2.js +423 -0
- package/dist/cli-LJLLIQB2.js.map +1 -0
- package/dist/cli-OFPZ5MAS.js +626 -0
- package/dist/cli-OFPZ5MAS.js.map +1 -0
- package/dist/cli-SHSMSRQY.js +28 -0
- package/dist/cli-SHSMSRQY.js.map +1 -0
- package/dist/cli-SRHFUZHA.js +473 -0
- package/dist/cli-SRHFUZHA.js.map +1 -0
- package/dist/cli-URZQXL4K.js +552 -0
- package/dist/cli-URZQXL4K.js.map +1 -0
- package/dist/cli.d.ts +12 -2
- package/dist/cli.js +109 -7661
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +15 -3
- package/dist/docmeta.js.map +1 -1
- package/dist/github-FE6KCNYJ.js +27 -0
- package/dist/github-FE6KCNYJ.js.map +1 -0
- package/dist/github-QXL3VMK2.js +32 -0
- package/dist/github-QXL3VMK2.js.map +1 -0
- package/dist/index.d.ts +65 -3
- package/dist/index.js +407 -337
- package/dist/index.js.map +1 -1
- package/dist/json-7WV7KL6H.js +17 -0
- package/dist/json-7WV7KL6H.js.map +1 -0
- package/dist/json-SGZ6ZRFD.js +35 -0
- package/dist/json-SGZ6ZRFD.js.map +1 -0
- package/dist/lint-DL4LJRAY.js +28 -0
- package/dist/lint-DL4LJRAY.js.map +1 -0
- package/dist/list-6BAXTZUM.js +29 -0
- package/dist/list-6BAXTZUM.js.map +1 -0
- package/dist/list-7BKNYPSB.js +31 -0
- package/dist/list-7BKNYPSB.js.map +1 -0
- package/dist/page-3U2GCFNE.js +41 -0
- package/dist/page-3U2GCFNE.js.map +1 -0
- package/dist/picker-3XF36MJF.js +14 -0
- package/dist/picker-3XF36MJF.js.map +1 -0
- package/dist/pretty-2H57QVTY.js +43 -0
- package/dist/pretty-2H57QVTY.js.map +1 -0
- package/dist/pretty-N6DO4OOL.js +37 -0
- package/dist/pretty-N6DO4OOL.js.map +1 -0
- package/dist/reporters-M6LJ2IYU.js +21 -0
- package/dist/reporters-M6LJ2IYU.js.map +1 -0
- package/dist/reporters-N6GHXSS7.js +42 -0
- package/dist/reporters-N6GHXSS7.js.map +1 -0
- package/dist/reporters-UCNEV7PH.js +71 -0
- package/dist/reporters-UCNEV7PH.js.map +1 -0
- package/dist/run-XZDAREJE.js +33 -0
- package/dist/run-XZDAREJE.js.map +1 -0
- package/dist/term-5ICGKPC3.js +1592 -0
- package/dist/term-5ICGKPC3.js.map +1 -0
- package/dist/types-Y6TXHM7M.js +10 -0
- package/dist/types-Y6TXHM7M.js.map +1 -0
- package/dist/validate-GQRM77YN.js +16 -0
- package/dist/validate-GQRM77YN.js.map +1 -0
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +9 -0
- package/plugin/manni/hooks/hooks.json +52 -0
- package/plugin/manni/skills/check/SKILL.md +20 -0
- package/plugin/manni/skills/evals/SKILL.md +27 -0
- package/plugin/manni/skills/fix/SKILL.md +56 -0
- package/plugin/manni/skills/setup/SKILL.md +41 -0
- package/dist/batch-A5HZKYIW.js +0 -18
- package/dist/calibrate-S5K6QHUY.js +0 -13
- package/dist/capture-OZEZDABQ.js +0 -15
- package/dist/chunk-3R23C5DT.js.map +0 -1
- package/dist/chunk-CFDUZRM2.js.map +0 -1
- package/dist/chunk-G5CM2VGQ.js.map +0 -1
- package/dist/chunk-KJR7OVDX.js.map +0 -1
- package/dist/chunk-V4KUVE47.js +0 -27170
- package/dist/chunk-V4KUVE47.js.map +0 -1
- package/dist/chunk-ZQBTK3DO.js +0 -26518
- package/dist/chunk-ZQBTK3DO.js.map +0 -1
- package/dist/picker-6HRMETE7.js +0 -12
- package/plugin/tracevals/.claude-plugin/plugin.json +0 -9
- package/plugin/tracevals/hooks/hooks.json +0 -17
- /package/dist/{batch-A5HZKYIW.js.map → batch-DFRCLY77.js.map} +0 -0
- /package/dist/{calibrate-S5K6QHUY.js.map → build-Q5C6SX5J.js.map} +0 -0
- /package/dist/{capture-OZEZDABQ.js.map → calibrate-XQILKXS3.js.map} +0 -0
- /package/dist/{picker-6HRMETE7.js.map → capture-JQMOC3BW.js.map} +0 -0
- /package/dist/{chunk-HAPTXWU2.js.map → chunk-MYC3O5EJ.js.map} +0 -0
- /package/dist/{chunk-5HNHEUD5.js.map → chunk-XYLUCIKQ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/meta/types.ts","../src/meta/core/write-file.ts","../src/meta/core/manifest-cache.ts","../src/meta/core/schema-cache.ts","../src/meta/core/integrity.ts","../src/meta/schemas/citations/1.0.0.json","../src/meta/core/schema-registry.ts","../src/meta/core/json-text.ts","../src/meta/schemas/okf/0.1.json","../src/meta/schemas/diataxis/1.0.json","../src/meta/schemas/seven-action/1.0.json","../src/meta/schemas/tgdp/1.0.json","../src/meta/schemas/docusaurus-docs/3.10.json","../src/meta/schemas/docusaurus-blog/3.10.json","../src/meta/schemas/docusaurus-pages/3.10.json","../src/meta/schemas/starlight/0.41.json","../src/meta/schemas/antora/3.1.json","../src/meta/schemas/sphinx/9.1.json","../src/meta/schemas/myst/1.10.json","../src/meta/schemas/ogp/1.0.json","../src/meta/schemas/dcmi/1.1.json","../src/meta/schemas/microsoft-learn/1.0.json","../src/meta/schemas/dita/1.3.json","../src/meta/schemas/hugo/0.165.json","../src/meta/schemas/jekyll/4.4.json","../src/meta/schemas/vitepress/1.6.json","../src/meta/schemas/x-cards/1.0.json","../src/meta/schemas/agent-skills/1.0.json","../src/meta/schemas/claude-skill/2.1.json","../src/meta/schemas/mkdocs-material/9.7.json","../src/meta/schemas/claude-subagent/2.1.json","../src/meta/schemas/core/1.0.0.json","../src/meta/schemas/stewardship/1.0.0.json","../src/meta/schemas/audience/1.0.0.json","../src/meta/schemas/lifecycle/1.0.0.json","../src/meta/schemas/structure/1.0.0.json","../src/meta/schemas/terminology/1.0.0.json","../src/meta/schemas/ai-context/1.0.0.json","../src/meta/schemas/evals/1.0.0.json","../src/meta/schemas/artifact-evals/1.0.0.json","../src/meta/schemas/graph/1.0.0.json","../src/meta/schemas/core-strict/1.0.0.json","../src/meta/schemas/stewardship-strict/1.0.0.json","../src/meta/schemas/audience-strict/1.0.0.json","../src/meta/schemas/lifecycle-strict/1.0.0.json","../src/meta/schemas/structure-strict/1.0.0.json","../src/meta/schemas/terminology-strict/1.0.0.json","../src/meta/schemas/ai-context-strict/1.0.0.json","../src/meta/schemas/evals-strict/1.0.0.json","../src/meta/schemas/artifact-evals-strict/1.0.0.json","../src/meta/schemas/graph-strict/1.0.0.json","../src/meta/schemas/citations-strict/1.0.0.json","../src/meta/schemas/tgdp/1.1.json","../src/meta/schemas/tgdp-strict/1.1.json","../src/meta/schemas/artifact-evals/1.1.0.json","../src/meta/schemas/artifact-evals-strict/1.1.0.json","../src/meta/schemas/stewardship/1.1.0.json","../src/meta/schemas/stewardship-strict/1.1.0.json","../src/meta/core/resolve-schema.ts","../src/meta/extractors/frontmatter.ts","../src/meta/extractors/date-value.ts","../src/meta/extractors/pointer.ts","../src/meta/extractors/frontmatter-write.ts","../src/meta/extractors/patch-util.ts","../src/meta/core/yaml-splice.ts","../src/meta/extractors/markdown.ts","../src/meta/extractors/mdx.ts","../src/meta/extractors/asciidoc.ts","../src/meta/extractors/rst.ts","../src/meta/extractors/xml-read.ts","../src/meta/extractors/element-key.ts","../src/meta/extractors/dita.ts","../src/meta/extractors/xml-write.ts","../src/meta/extractors/xml-locate.ts","../src/meta/extractors/element-write.ts","../src/meta/extractors/dita-write.ts","../src/meta/extractors/xml.ts","../src/meta/extractors/html-read.ts","../src/meta/extractors/html-write.ts","../src/meta/extractors/html.ts","../src/meta/extractors/index.ts","../src/meta/core/load-files.ts","../src/meta/core/gitignore.ts","../src/meta/core/derive/types.ts","../src/meta/core/config.ts","../src/meta/core/register.ts","../src/meta/core/baseline.ts"],"sourcesContent":["/**\n * Shared types for docmeta.\n *\n * The pipeline is: load files -> extract metadata (format-specific) ->\n * resolve a schema set per file -> validate against each schema -> report.\n * Everything after extraction operates only on `ExtractedMetadata`, so new\n * input formats never touch validation, resolution, or reporting.\n */\nimport { ToolError } from \"../shared/errors.js\";\nimport type { Severity } from \"../shared/severity.js\";\n\n/** Result of pulling a metadata block out of a single document. */\nexport interface ExtractedMetadata {\n /** Parsed metadata key/values. `{}` when a block is present but empty. */\n data: Record<string, unknown>;\n /** Whether a metadata block was found at all. */\n present: boolean;\n /**\n * Whether the metadata came from a removable fenced front matter block.\n * A per-extraction fact, deliberately not an extractor capability: RST and\n * AsciiDoc read a fenced block when one exists and fall back to native\n * docinfo/attribute parsing when not, so the same extractor yields both\n * answers. Absent (element-backed, native-header) means `DELETE FROM docs`\n * has no block whose removal would leave the document whole, and refuses.\n */\n fenced?: boolean;\n /** Name of the extractor/format that produced this (e.g. \"markdown\"). */\n format: string;\n /**\n * Map a JSON Pointer (Ajv `instancePath`, e.g. \"/tags/0\") or a bare top-level\n * key to its 1-based source line, for precise annotations. Returns undefined\n * when no position is known.\n */\n lineFor(this: void, pointer: string): number | undefined;\n /**\n * The column counterpart of {@link lineFor}, 1-based, resolving the same\n * pointer forms.\n *\n * **Optional on purpose.** `lineFor` is required and public, so widening it\n * to return a position pair would break every consumer that implements\n * `MetadataExtractor` outside this repository. A format that cannot cheaply\n * give a column simply omits this — today that is every frontmatter-based\n * extractor, whose `yaml` node offsets would need an offset -> line/col\n * conversion first. `html` and `xml` implement it.\n */\n colFor?(this: void, pointer: string): number | undefined;\n}\n\n/** Fenced front matter flavors, in fence order: `---`, `+++`, `;;;`. */\nexport type FrontmatterFlavor = \"yaml\" | \"toml\" | \"json\";\n\n/** Top-level metadata keys to set. Keys with `undefined` values are ignored. */\nexport type MetadataPatch = Record<string, unknown>;\n\nexport interface ApplyOptions {\n /** Flavor to use when creating a block from scratch. Default \"yaml\". */\n newBlockFlavor?: FrontmatterFlavor;\n /**\n * Top-level keys to remove entirely — deletion, where `patch` can only set\n * (`undefined` values there are ignored by contract). Removing a key that\n * is already absent is a no-op. Writers that cannot remove a key ignore\n * this option, so a caller that needs certainty must re-extract and check —\n * `runQuery`'s apply phase does exactly that and refuses the run on a\n * survivor.\n */\n deletions?: readonly string[];\n /**\n * The document's path, when the caller knows it. `extract` receives one and\n * `apply` did not, which left a writer unable to use the extension as a\n * signal — the XML writer needs it to tell a DITA topic from hand-rolled XML\n * that happens to have a `<task>` root.\n */\n filePath?: string;\n /**\n * The same `elements:` paths extraction was given.\n *\n * A writer re-reads the document to find where each key came from, and a read\n * without these paths would not produce a config-declared key at all — so the\n * writer would treat it as absent and create it somewhere else. That is the\n * asymmetry proposal 0018 calls a loop, arriving through the options object\n * rather than through the code.\n */\n elements?: readonly string[];\n}\n\n/** Per-run inputs to extraction, beyond the document itself. */\nexport interface ExtractOptions {\n /**\n * Extra element paths to lift, from `elements:` config. Slash-separated from\n * the document root, optionally ending in `@attribute`. These *extend* the\n * per-format convention: a path producing a key the convention already filled\n * is a no-op, so naming one cannot retype a key a content model typed exactly.\n */\n elements?: readonly string[];\n}\n\n/** A pluggable metadata extractor for one document format. */\nexport interface MetadataExtractor {\n /** Stable name, also used as `ExtractedMetadata.format`. */\n name: string;\n /** Lowercase file extensions this extractor handles, incl. dot (e.g. \".md\"). */\n extensions: string[];\n /**\n * Extract metadata from raw file content.\n *\n * `this: void` — as on `apply` below, and on `ExtractedMetadata`'s\n * `lineFor`/`colFor`. Every implementation in this repo is a plain function\n * in an object literal and none of them reads `this`, so pulling one out\n * (`const apply = extractor.apply`) is the ordinary thing it looks like\n * rather than a binding hazard. Declaring that is what lets a reader — and\n * `unbound-method` — know it.\n *\n * Retyping these as properties holding functions would say the same thing,\n * and was tried first. It is the more expensive way: a property's parameters\n * are contravariant where a method's are bivariant, so on an *exported*\n * interface that swap silently narrows what an outside implementation may\n * be, which is a semver-visible change bought for a lint fix. `this: void`\n * leaves assignability exactly as it was.\n */\n extract(\n this: void,\n content: string,\n filePath: string,\n options?: ExtractOptions,\n ): ExtractedMetadata;\n /**\n * Return new content with every key in `patch` set at the top level. Pure:\n * no IO, no mutation, deterministic; returns `content` itself for a no-op.\n *\n * Absent means the format is read-only. Present but throwing `DocmetaError`\n * means this particular document cannot be rewritten safely.\n */\n apply?(\n this: void,\n content: string,\n patch: MetadataPatch,\n options?: ApplyOptions,\n ): string;\n}\n\n/** A single schema violation for one file, attributed to one schema. */\nexport interface FieldError {\n /** Schema id/ref that produced this error (e.g. \"google:okf:0.1\"). */\n schema: string;\n /** Ajv instancePath, e.g. \"/tags/0\" or \"\" for the root. */\n instancePath: string;\n /** Human-readable message. */\n message: string;\n /**\n * Ajv keyword that failed (e.g. \"required\", \"format\", \"pattern\"), or\n * \"parse\"/\"schema\" for the synthetic errors the command layer raises.\n *\n * This and `subject` are the machine-stable half of a violation's identity:\n * `message` is generated prose that an Ajv upgrade may reword, so nothing\n * durable — a baseline fingerprint, a SARIF `ruleId` — may be built from it.\n */\n keyword: string;\n /**\n * Discriminator within that keyword, when it is a stable identifier: the\n * missing property, the additional property, the format name, the expected\n * type. Deliberately unset for keywords whose parameter is a schema-authored\n * *value* (`pattern`'s regex, `enum`'s list, `minLength`'s number), which\n * changes whenever the schema is edited.\n */\n subject?: string;\n /** 1-based source line, when known. */\n line?: number;\n /** 1-based column, when known. */\n col?: number;\n /**\n * The file `line` and `col` refer to, when it is not the result's own file.\n *\n * Set only for a value a manifest supplied (proposal 0037), spelled\n * the way the run spells file labels. Absent means the document itself,\n * which is every violation that existed before external metadata. The finding's\n * subject file stays `ValidationResult.file`: that is its baseline identity\n * and its SARIF location, and this names where the *value* was written.\n */\n file?: string;\n /**\n * How much the finding weighs, on the family scale (`src/shared/severity.ts`).\n *\n * The invariant, stated here and nowhere else: a result's `ok` is true iff\n * no entry of its `errors` has severity `error`, and an **absent** severity\n * means `error`. So every producer that never sets this field is unchanged,\n * and a `warning` or `notice` is a finding that is reported, baselined and\n * fingerprinted like any other but never fails a file, and so never moves\n * the exit code. Nothing in meta's own validation sets one today; a sibling\n * tool's findings ride these types and reporters, and some of theirs are\n * advisory.\n *\n * Deliberately not part of the fingerprint: a rule that is downgraded from\n * error to warning is the same finding, and a baseline that forgot it on\n * the way down would re-open every instance.\n *\n * `isErrorSeverity` is the one reading of this field; derive `ok` through\n * it rather than restating the absent-means-error rule.\n */\n severity?: Severity;\n}\n\n/**\n * Whether a finding counts against `ok`: true for `error` and for an absent\n * severity, false for `warning` and `notice`. See `FieldError.severity` for\n * the invariant.\n */\nexport function isErrorSeverity(e: Pick<FieldError, \"severity\">): boolean {\n return e.severity === undefined || e.severity === \"error\";\n}\n\n/** Validation outcome for a single file. */\nexport interface ValidationResult {\n /** Absolute or cwd-relative path of the file. */\n file: string;\n /** Extractor/format used. */\n format: string;\n /** Whether validation passed against every schema in the set. */\n ok: boolean;\n /** Schema ids/refs the file was validated against. */\n schemas: string[];\n /** All violations, across every schema in the set. */\n errors: FieldError[];\n /**\n * Findings a baseline suppressed for this file. Absent when no baseline\n * governed the run, or when it forgave nothing here.\n */\n baselined?: number;\n}\n\n/** How a baseline shaped the run. Present only when one governed it. */\nexport interface BaselineSummary {\n /** Baseline file path, spelled the way the user would type it. */\n path: string;\n /** Whether this run wrote the file (`--write-baseline`) or only read it. */\n written: boolean;\n /**\n * Fingerprints the baseline holds. On a read this counts only the files the\n * run checked, so validating one file does not report the rest as prunable.\n */\n recorded: number;\n /** Findings the baseline suppressed. */\n suppressed: number;\n /** Recorded fingerprints for checked files that no longer occur. */\n stale: number;\n /** Fingerprints this write added. Write only. */\n added?: number;\n /** Fingerprints this write dropped. Write only. */\n removed?: number;\n}\n\n/** Aggregate run summary. */\nexport interface RunSummary {\n files: number;\n passed: number;\n failed: number;\n /**\n * Error-severity findings reported. Baselined ones are excluded — see\n * `baseline` — and so are warnings, which have their own count.\n */\n errors: number;\n /**\n * Warning-severity findings reported. Omitted when there are none, which is\n * every run of meta's own validation today, so the JSON summary is unchanged\n * for them. A warning never fails a file or the run.\n */\n warnings?: number;\n /**\n * Notice-severity findings reported. Omitted when there are none, as\n * `warnings` is. A notice never fails a file or the run.\n */\n notices?: number;\n /**\n * Candidate documents `.gitignore` removed from the walk. Omitted when it\n * removed none. Reported because silent removal is what makes the filter\n * dangerous — a counted removal is auditable.\n */\n gitignoreSkipped?: number;\n baseline?: BaselineSummary;\n}\n\n/** An operational/usage failure that should map to exit code 2. */\nexport class DocmetaError extends ToolError {\n constructor(message: string) {\n super(message);\n this.name = \"DocmetaError\";\n }\n}\n","/**\n * Atomic file writes.\n *\n * `fill` is the first command that modifies the user's sources, and it does so\n * in bulk over a glob, often while a dev server or editor is watching. A\n * truncated write from a crash or a full disk would be unrecoverable for them,\n * so every write lands via a temp file plus `rename` — the file either has its\n * old contents or its new ones, never half of each.\n *\n * The temp file must live in the *same directory* as the target: `rename` is\n * only atomic within a filesystem, and the OS temp dir is frequently a\n * different one.\n */\nimport { writeFile, rename, rm, stat, chmod, mkdir } from \"node:fs/promises\";\nimport { dirname, join, basename, resolve } from \"node:path\";\nimport { programName } from \"../../shared/program-name.js\";\nimport { invalidateManifestCache } from \"./manifest-cache.js\";\n\n/** Windows returns these when an editor or scanner holds the target open. */\nconst LOCKED = new Set([\"EPERM\", \"EBUSY\", \"EACCES\"]);\nconst RENAME_ATTEMPTS = 3;\n\nfunction errorCode(err: unknown): string | undefined {\n return typeof err === \"object\" && err !== null && \"code\" in err\n ? String(err.code)\n : undefined;\n}\n\nconst wait = (ms: number): Promise<void> =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\n/**\n * Write `contents` to `path`, replacing it atomically. Falls back to a direct\n * write (with a warning on stderr) if the rename keeps failing because the\n * target is locked — on Windows that is a real and recoverable situation, and\n * refusing to write at all would be worse than a non-atomic write.\n */\nexport async function writeFileAtomic(\n /**\n * Absolute, or relative to the process's current directory. The manifest\n * cache is keyed on absolute paths, and the invalidation in the `finally`\n * below resolves `path` against that same implicit directory — so a caller\n * that resolved its own path against some other base would invalidate a key\n * no cache holds, and the stale parse would survive the write. That miss is\n * silent, which is why the requirement is stated here rather than left to be\n * discovered.\n */\n path: string,\n /**\n * A `Uint8Array` writes byte-for-byte. `schemas vendor` needs that: the\n * integrity pin it records is taken over exactly what the server sent, and a\n * decode/re-encode round trip through a UTF-8 string would change the bytes\n * of a payload that is not valid UTF-8 — so the pin would be wrong the first\n * time anything checked it.\n */\n contents: string | Uint8Array,\n /**\n * `createParents` makes the target's directory, recursively, before the\n * temp file that lives in it. A manifest writer asks for it: a mirrored\n * per-page manifest (proposal 0058), `./meta/{page}.citations.yaml`, may be\n * the first file in its directory. Every other writer leaves it off, so a\n * missing directory stays the failure it always was (`--write-baseline`\n * into a directory that is not there, say).\n */\n options: { createParents?: boolean } = {},\n): Promise<void> {\n const tmp = join(\n dirname(path),\n `.${basename(path)}.manni-${process.pid}-${Math.random().toString(36).slice(2, 8)}.tmp`,\n );\n\n try {\n if (options.createParents === true) await mkdir(dirname(path), { recursive: true });\n\n // No encoding argument. Node ignores one when `contents` is a\n // `Uint8Array`, so passing `\"utf8\"` was harmless — but it reads as though a\n // decode happens, which is exactly what the byte-for-byte guarantee above\n // says must not. The two-argument overload defaults a string to UTF-8 and\n // writes bytes as they are, which is the behaviour both callers want.\n await writeFile(tmp, contents);\n\n // Carry the target's permissions over; a missing target just means we are\n // creating it, in which case the default mode is correct.\n try {\n const { mode } = await stat(path);\n await chmod(tmp, mode);\n } catch {\n // No existing file (or no permission to read its mode) — keep the default.\n }\n\n let lastError: unknown;\n for (let attempt = 1; attempt <= RENAME_ATTEMPTS; attempt++) {\n try {\n await rename(tmp, path);\n return;\n } catch (err) {\n lastError = err;\n const code = errorCode(err);\n if (code == null || !LOCKED.has(code)) throw err;\n if (attempt < RENAME_ATTEMPTS) await wait(attempt * 50);\n }\n }\n\n process.stderr.write(\n `${programName()}: ${path} is locked by another process; writing in place (not atomically).\\n`,\n );\n try {\n await writeFile(path, contents);\n } catch {\n throw lastError;\n }\n } finally {\n await rm(tmp, { force: true });\n // Every manifest write in the family lands here — `cite add`, `cite\n // update`, `cite remove`, `meta fill`, `meta derive`, `meta relocate`,\n // `meta query` — so this is the one place a parse another command cached\n // has to be dropped. Two writes inside one clock tick can leave `mtimeMs`\n // and size unchanged, so the cache cannot be left to notice on its own.\n // It runs whether or not the write succeeded: forgetting a parse that is\n // still current costs one re-read.\n invalidateManifestCache(resolve(path));\n }\n}\n","/**\n * One parse of one manifest, kept for the length of the process.\n *\n * An external-metadata manifest is read and parsed once per command, and a\n * process that runs several commands over one corpus — a test suite, an\n * editor integration, `key rotate` walking two tools — paid for that parse\n * every time. At this repository's own manifest size the parse is almost the\n * whole cost of a validate run, so the same bytes were being turned into the\n * same maps over and over.\n *\n * The entry is keyed on the file's absolute path together with its `mtimeMs`\n * and its size, so a manifest edited between two commands is read again. That\n * stat is a backstop and not the mechanism: two writes inside one clock tick\n * can leave `mtimeMs` and size unchanged, and a same-size edit would then be\n * invisible. What actually makes a write visible is `writeFileAtomic` calling\n * `invalidateManifestCache` on the path it wrote, so every command that writes\n * a manifest — `cite add`, `cite update`, `cite remove`, `meta fill`,\n * `meta derive`, `meta relocate`, `meta query` — drops the entry by going\n * through the one write path they share.\n *\n * Nothing here is a user-facing surface: there is no flag, no config key and\n * no message. A caller cannot observe the cache except by being faster.\n *\n * This module deliberately imports nothing from the rest of the tree. It sits\n * between `write-file.ts` and `external-metadata.ts`, and a dependency either\n * way round would close a cycle between them.\n */\nimport { stat } from \"node:fs/promises\";\n\n/** A cache that can be told to forget one path. */\ninterface Droppable {\n drop(path: string): void;\n}\n\n/**\n * Every live cache, so one write can reach all of them.\n *\n * The references are weak, so registering does not keep a cache alive. A\n * second instance — one a test builds after `vi.resetModules()`, or one a\n * second tool builds and discards — is collected like any other object, and\n * the sweep below clears the dead reference it leaves behind. Nothing has to\n * be disposed by hand, which is the point: a cache that must be deregistered\n * is a cache someone forgets to deregister.\n */\nconst caches = new Set<WeakRef<Droppable>>();\n\n/** Register `cache` for the invalidation sweep without retaining it. */\nfunction register(cache: Droppable): void {\n caches.add(new WeakRef(cache));\n}\n\n/**\n * Forget every parse of `path`, whatever it was read as.\n *\n * Called from `writeFileAtomic` for every write it performs. Most of those\n * paths were never manifests, and dropping an absent entry costs a map lookup.\n *\n * Deleting from a `Set` while iterating it is defined: an entry removed before\n * the iterator reaches it is skipped, and one removed after has already been\n * visited. So clearing the dead references in the same pass is safe.\n */\nexport function invalidateManifestCache(path: string): void {\n for (const ref of caches) {\n const cache = ref.deref();\n if (cache === undefined) caches.delete(ref);\n else cache.drop(path);\n }\n}\n\n/**\n * How many caches the sweep would reach, after clearing the dead references.\n *\n * Not a user-facing surface and not part of the cache's contract: it exists so\n * a test can assert that a cache which went out of scope is not retained here.\n */\nexport function registeredManifestCaches(): number {\n for (const ref of caches) if (ref.deref() === undefined) caches.delete(ref);\n return caches.size;\n}\n\n/** What a file looked like when it was read. */\ninterface Signature {\n mtimeMs: number;\n size: number;\n}\n\n/** `null` when the file cannot be stat'ed, which is never cached. */\nasync function signature(path: string): Promise<Signature | null> {\n try {\n const info = await stat(path);\n return { mtimeMs: info.mtimeMs, size: info.size };\n } catch {\n return null;\n }\n}\n\nconst same = (a: Signature, b: Signature): boolean =>\n a.mtimeMs === b.mtimeMs && a.size === b.size;\n\n/**\n * One parse per file, per `variant`.\n *\n * `variant` names everything other than the bytes that decides what the parse\n * produces — for a manifest, the collection it was declared by, the field it\n * joins on, the keys it owns, and the directory its entries resolve against.\n * One file declared twice, differently, parses twice.\n */\nexport class ManifestCache<T> {\n private readonly slots = new Map<string, { sig: Signature; variants: Map<string, T> }>();\n\n constructor() {\n register(this);\n }\n\n drop(path: string): void {\n this.slots.delete(path);\n }\n\n /** The cached parse of `path` under `variant`, or `compute()`'s result. */\n async parse(path: string, variant: string, compute: () => Promise<T>): Promise<T> {\n const before = await signature(path);\n if (before === null) return compute();\n\n const slot = this.slots.get(path);\n if (slot !== undefined && same(slot.sig, before)) {\n const hit = slot.variants.get(variant);\n if (hit !== undefined) return hit;\n }\n\n const parsed = await compute();\n\n // The file is stat'ed again, because `compute()` read it and the read is\n // not atomic with the stat that preceded it. A file that changed while it\n // was being read is not cached under either signature.\n const after = await signature(path);\n if (after === null || !same(before, after)) return parsed;\n\n const live = this.slots.get(path);\n if (live !== undefined && same(live.sig, after)) live.variants.set(variant, parsed);\n else this.slots.set(path, { sig: after, variants: new Map([[variant, parsed]]) });\n return parsed;\n }\n}\n","/**\n * The cross-run cache for schemas fetched over `http(s)`.\n *\n * The in-process `Map` in `schema-registry.ts` collapses N files into one\n * fetch and then dies with the process, so every `manni meta validate` in a\n * developer's edit loop re-fetches the same remote contract. This is the piece\n * that survives the run: one file per URL under `.manni/meta/schema-cache/`,\n * served while it is inside the TTL.\n *\n * **Its scope, stated honestly:** this is a local dev-loop and pre-commit win,\n * not a CI one. An ephemeral runner starts with an empty workspace, so the\n * cache is cold on every job and the remote host is still a single point of\n * failure for the org. Vendoring the schema into the consuming repo is what\n * fixes that; see `docs/proposals/0008-remote-schema-durability.md`.\n *\n * Written here rather than reusing `JsonCache` from `@hawkeyexl/inference`\n * (which `fill` keeps using for proposals) for three reasons the cache\n * semantics turn on: `JsonCache` has no TTL, no eviction, and writes with a\n * plain `writeFileSync`. Schema resolution is the most correctness-critical\n * path docmeta has, and a truncated entry there would be read back on the next\n * run — so writes go through `writeFileAtomic`.\n */\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, stat } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { writeFileAtomic } from \"./write-file.js\";\n\n/**\n * Where the cache lives, relative to the project root.\n *\n * `.manni/` is already ignored wholesale, and `fill` writes its proposal\n * cache to `.manni/meta/cache` — a different directory, so the two never collide.\n */\nexport const SCHEMA_CACHE_DIR = \".manni/meta/schema-cache\";\n\n/** The only entry format this version understands. */\nexport const SCHEMA_CACHE_VERSION = 1;\n\n/** How long a cached schema is served before it is re-fetched. */\nexport const DEFAULT_TTL_HOURS = 24;\n\n/**\n * How far ahead of `Date.now()` an mtime may sit and still count as written\n * \"now\" rather than as a clock problem.\n *\n * A file's timestamp and `Date.now()` do not come from the same clock: on\n * Windows the system clock ticks in ~15.6ms steps while `Date.now()` is\n * interpolated, so a file written this instant can read as one or two\n * milliseconds in the future. Measured at ~1ms here; a network filesystem can\n * be worse. Without a tolerance, an entry the current run just wrote is stale\n * the moment it is read, which quietly turns the cache off.\n *\n * A minute is far above any of that and far below the shortest useful TTL, so\n * it separates jitter from the hours-to-years skew a restored archive carries.\n */\nconst FUTURE_MTIME_TOLERANCE_MS = 60_000;\n\n/** The cache directory for a project rooted at `root`. */\nexport function schemaCacheDir(root: string): string {\n return join(root, SCHEMA_CACHE_DIR);\n}\n\n/** What one cache file holds. */\nexport interface SchemaCacheEntry {\n version: number;\n /** The URL this entry was fetched from; re-checked on read. */\n url: string;\n /**\n * When it was fetched, ISO-8601. **Diagnostic only** — freshness is measured\n * on the file's mtime, which a restored cache or a clock change cannot make\n * disagree with the filesystem the way an embedded timestamp can.\n */\n fetchedAt: string;\n schema: Record<string, unknown>;\n}\n\nexport interface ReadOptions {\n /**\n * Serve an entry regardless of age. What `--offline` needs: there is no\n * re-fetch available, so a stale copy beats failing the run outright.\n */\n ignoreTtl?: boolean;\n}\n\nexport class SchemaCache {\n constructor(\n private readonly dir: string,\n private readonly ttlHours: number = DEFAULT_TTL_HOURS,\n ) {}\n\n /** A TTL of 0 disables the cache in both directions. */\n get enabled(): boolean {\n return this.ttlHours > 0;\n }\n\n /**\n * The file an entry lives in.\n *\n * Keyed on a hex digest of the URL, never on the URL itself: a URL carries\n * `/`, `..`, `:`, and a query string, so `join(dir, url + \".json\")` lets the\n * *server's* address decide where the write lands. A digest cannot escape the\n * directory.\n */\n entryPath(url: string): string {\n const key = createHash(\"sha256\").update(url).digest(\"hex\");\n return join(this.dir, `${key}.json`);\n }\n\n /**\n * The cached schema for `url`, or null.\n *\n * Every malformation — an unreadable file, unparseable JSON, an unknown\n * version, an envelope naming a different URL, a payload that is not an\n * object — degrades to a **miss**. A cache is an optimization, and a corrupt\n * entry must cost one fetch, never a failed run that no `docmeta` command\n * explains how to fix.\n */\n async read(\n url: string,\n options: ReadOptions = {},\n ): Promise<Record<string, unknown> | null> {\n if (!this.enabled) return null;\n const file = this.entryPath(url);\n\n if (options.ignoreTtl !== true) {\n let mtimeMs: number;\n try {\n ({ mtimeMs } = await stat(file));\n } catch {\n return null;\n }\n const age = Date.now() - mtimeMs;\n // An age below `-FUTURE_MTIME_TOLERANCE_MS` is an entry stamped in the\n // future by more than clock jitter explains, and it would satisfy the TTL\n // check for as long as the clock took to catch up — hours of intended\n // lifetime turned into years. An archive keeps the mtimes it was packed\n // with, and a machine whose clock ran fast leaves every entry it wrote\n // ahead of now, so this outlives the clock that caused it.\n //\n // Treated as a miss rather than clamped: the miss costs one fetch, and\n // the write that follows re-stamps the file, so the entry heals instead\n // of staying suspect. `ignoreTtl` still serves it — `--offline` has no\n // fetch to fall back on, and there a stale contract beats no contract.\n if (\n age < -FUTURE_MTIME_TOLERANCE_MS ||\n age >= this.ttlHours * 3_600_000\n ) {\n return null;\n }\n }\n\n let raw: unknown;\n try {\n raw = JSON.parse(await readFile(file, \"utf8\"));\n } catch {\n return null;\n }\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n return null;\n }\n const entry = raw as Record<string, unknown>;\n if (entry.version !== SCHEMA_CACHE_VERSION) return null;\n // A digest collision cannot realistically produce this, but a hand-edited\n // or half-copied cache directory can, and validating against the wrong\n // contract is a silent wrong answer rather than an error.\n if (entry.url !== url) return null;\n const schema = entry.schema;\n if (typeof schema !== \"object\" || schema === null || Array.isArray(schema)) {\n return null;\n }\n return schema as Record<string, unknown>;\n }\n\n /**\n * Record a freshly fetched schema.\n *\n * A failure to write is swallowed. A read-only checkout, a full disk, or a\n * sandbox with no write access must cost the *next* run one fetch, not this\n * run its result.\n *\n * Returns whether the entry actually landed on disk, which is a different\n * question from whether the run should continue.\n */\n async write(url: string, schema: Record<string, unknown>): Promise<boolean> {\n if (!this.enabled) return false;\n const entry: SchemaCacheEntry = {\n version: SCHEMA_CACHE_VERSION,\n url,\n fetchedAt: new Date().toISOString(),\n schema,\n };\n try {\n await mkdir(this.dir, { recursive: true });\n await writeFileAtomic(\n this.entryPath(url),\n `${JSON.stringify(entry, null, 2)}\\n`,\n );\n return true;\n } catch {\n // Intentionally silent: see the doc comment. The boolean is how a caller\n // learns the entry is not on disk without the failure becoming fatal —\n // `schema-registry` needs exactly that to know an offline call cannot\n // legally be served from the in-process memo.\n return false;\n }\n }\n}\n","/**\n * Integrity pins for vendored schemas.\n *\n * A vendored schema is a file in the consuming repository's own history, so the\n * question an integrity pin answers is narrow: are the bytes on disk still the\n * bytes that were downloaded? That makes an edited, truncated, or\n * merge-mangled copy a loud failure instead of a contract that quietly changed\n * meaning.\n *\n * One algorithm and one encoding, deliberately. Every additional accepted form\n * is another state the mismatch message has to be right about, and there is no\n * interoperability argument here — docmeta writes these strings itself.\n */\nimport { createHash } from \"node:crypto\";\n\n/** The only digest algorithm `integrity:` accepts. */\nexport const INTEGRITY_ALGORITHM = \"sha256\";\n\n/** What a well-formed pin looks like, for error messages. */\nexport const INTEGRITY_SHAPE = `${INTEGRITY_ALGORITHM}-<64 hex characters>`;\n\nconst INTEGRITY_RE = new RegExp(`^${INTEGRITY_ALGORITHM}-([0-9a-f]{64})$`);\n\n/**\n * The pin for a byte sequence.\n *\n * Hashes the **bytes**, never a string: decoding to UTF-8 and re-encoding is\n * lossy for a payload that is not valid UTF-8, which would make the pin wrong\n * in exactly the case an integrity check exists to catch.\n */\nexport function integrityOf(bytes: Uint8Array): string {\n return `${INTEGRITY_ALGORITHM}-${createHash(INTEGRITY_ALGORITHM).update(bytes).digest(\"hex\")}`;\n}\n\n/** Whether `value` is a pin this version can verify. */\nexport function isIntegrity(value: string): boolean {\n return INTEGRITY_RE.test(value);\n}\n\n/**\n * How two byte sequences differ, for the mismatch message.\n *\n * `line-endings` is not a nicety. A vendored schema is committed, and a\n * repository with `core.autocrlf=true` (or a `*.json text` attribute) hands a\n * Windows checkout CRLF bytes that hash differently from the LF bytes that were\n * downloaded — a mismatch on a file nobody touched. Naming that case is the\n * difference between a five-minute fix and a user deleting the pin.\n */\nexport type IntegrityDiff = \"line-endings\" | \"content\";\n\n/** Bytes with every CRLF collapsed to LF. */\nfunction toLf(bytes: Uint8Array): Uint8Array {\n const out = new Uint8Array(bytes.length);\n let n = 0;\n for (let i = 0; i < bytes.length; i++) {\n const byte = bytes[i];\n if (byte === undefined) continue;\n // 0x0d CR followed by 0x0a LF: drop the CR, keep the LF.\n if (byte === 0x0d && bytes[i + 1] === 0x0a) continue;\n out[n++] = byte;\n }\n return out.subarray(0, n);\n}\n\n/** Bytes with every bare LF expanded to CRLF. */\nfunction toCrlf(bytes: Uint8Array): Uint8Array {\n const lf = toLf(bytes);\n const out = new Uint8Array(lf.length * 2);\n let n = 0;\n for (let i = 0; i < lf.length; i++) {\n const byte = lf[i];\n if (byte === undefined) continue;\n if (byte === 0x0a) out[n++] = 0x0d;\n out[n++] = byte;\n }\n return out.subarray(0, n);\n}\n\n/**\n * Why `bytes` does not match `expected`.\n *\n * Only ever called once a mismatch is established, so \"they are identical\" is\n * not among the answers.\n *\n * Both conversions are tried because only the *pin* survives, not the bytes it\n * was taken from, so there is no way to normalize both sides. A CRLF working\n * copy of an LF download is caught by the first; an LF checkout of a CRLF\n * download by the second.\n */\nexport function diagnoseIntegrity(\n bytes: Uint8Array,\n expected: string,\n): IntegrityDiff {\n if (integrityOf(toLf(bytes)) === expected) return \"line-endings\";\n if (integrityOf(toCrlf(bytes)) === expected) return \"line-endings\";\n return \"content\";\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:citations:1.0.0\",\n \"title\": \"manni citations vocabulary v1.0.0\",\n \"description\": \"What do this page's claims rest on? For each claim, the page lines that make it, the source lines it was written from, and a hash of each. A manni common vocabulary: any drift check can implement it, and other schemas may compose on top of it. A pin is a record of the past, not a copy of the present. It says what the lines were when the sentence was written. The check compares that record with the files as they are now. Recompute it on every run and there is nothing to compare against. `source-of-truth` (manni:stewardship:1.0.0) names the file a page answers to; a citation names the lines a sentence answers to. The page root stays open so sibling tools' keys pass untouched. The `citation-` prefix is reserved, so an unrecognized `citation-*` key is rejected and a typo fails loudly.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"citations\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/citationEntry\"\n },\n \"description\": \"The page's citations, one entry per claim or pin. An empty list is not a declaration; a page with no citations omits the key. Ids are unique within a page, and two entries claiming one id is an error. JSON Schema cannot say that over a list whose members may omit the id. So it is a requirement on implementations, stated here so every tool agrees.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"patternProperties\": {\n \"^citation-\": false\n },\n \"$defs\": {\n \"citationEntry\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"source\"\n ],\n \"description\": \"One citation: the page text it supports, the source lines it rests on, and how the two are anchored. Both ends share one shape, a line range and a hash.\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"A kebab-case name for this citation, unique within the page. A body marker names an entry by it, and findings are reported under it. Optional for an entry anchored by its claim lines or pinned bare. Required when a marker names the entry.\"\n },\n \"claim\": {\n \"$ref\": \"#/$defs/claim\"\n },\n \"source\": {\n \"$ref\": \"#/$defs/source\"\n },\n \"quote\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"The claim is a fenced block that reproduces the source lines. The pinned claim covers the whole block, fences included. An implementer compares the lines inside the fences with the source under the pin's rule. So a quoted snippet that drifts from its source is a finding even while the pin still holds. Under a marker, the block is the next fence after the marker. Default false.\"\n }\n }\n },\n \"claim\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"integrity\"\n ],\n \"description\": \"The page text the citation supports, pinned by lines and a hash. Absent, the entry is a bare pin, or a marker with no drift check on its sentence. Without `lines`, the text pinned is what a body marker naming this entry anchors.\",\n \"properties\": {\n \"lines\": {\n \"$ref\": \"#/$defs/lines\",\n \"description\": \"Lines of the page body. The body starts on the first line after the closing frontmatter fence, or on line 1 with no frontmatter. So editing the frontmatter never moves a claim. Required unless a marker names the entry, and never inside the frontmatter.\"\n },\n \"integrity\": {\n \"type\": \"string\",\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"`sha256-` and sixty-four lowercase hex digits over the claimed lines, under the rule `source.integrity` states. Always plain, never keyed: the page is public, so there is nothing to hide. With a marker, the lines hashed are the ones the marker anchors.\"\n }\n }\n },\n \"source\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"file\",\n \"integrity\"\n ],\n \"description\": \"The lines the claim rests on: a file, an optional line range, a pin, and the commit the pin was taken at.\",\n \"properties\": {\n \"file\": {\n \"$ref\": \"#/$defs/fileRef\"\n },\n \"lines\": {\n \"$ref\": \"#/$defs/lines\",\n \"description\": \"File lines. Absent, the whole file is pinned. The lines stay readable even when `file` is encrypted.\"\n },\n \"integrity\": {\n \"type\": \"string\",\n \"pattern\": \"^(?:sha256|hmac-sha256)-[0-9a-f]{64}$\",\n \"description\": \"The pin: an algorithm prefix and sixty-four lowercase hex digits over the cited lines under one rule. Decode as UTF-8 and drop one leading byte-order mark. Turn CRLF into LF, split on LF, and discard the empty element a trailing LF leaves. Take lines L1 to L2 inclusive, or every line for a whole file. Join with LF and no trailing LF, and keep trailing whitespace. A plain `file` is pinned `sha256-` over that text. An encrypted `file` is pinned `hmac-sha256-`: the HMAC-SHA256 of that text under a key derived from the encryption key. So a public page carries no verifier a reader could run against a guessed private line. The prefix follows `file`, and any other pairing is an invalid entry.\"\n },\n \"commit-sha\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{7,64}$\",\n \"description\": \"The git commit hash the source pin was taken at, as lowercase hex. Seven digits is what git abbreviates to; sixty-four covers a SHA-256 repository. A tool writes the full hash, because an abbreviation that is unique today need not be next year. Without it, a check can still say the lines changed. With it, the check can say since when, and whether the pin was ever true.\"\n }\n }\n },\n \"lines\": {\n \"oneOf\": [\n {\n \"type\": \"integer\",\n \"minimum\": 1\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^[1-9][0-9]*-[1-9][0-9]*$\"\n }\n ],\n \"description\": \"A line range, 1-based and inclusive: an integer for one line, or `\\\"L1-L2\\\"` for several. `L1 <= L2` is a rule on implementations, since a pattern cannot compare two numbers. There is no line 0 to cite.\"\n },\n \"fileRef\": {\n \"type\": \"string\",\n \"pattern\": \"^(?:~[A-Za-z0-9_-]{82,}|(?!~)(?:(?!\\\\.\\\\.?(?:/|$))[^/\\\\\\\\:\\\\r\\\\n\\\\t]+)(?:/(?:(?!\\\\.\\\\.?(?:/|$))[^/\\\\\\\\:\\\\r\\\\n\\\\t]+))*)$\",\n \"description\": \"The file: a path relative to the repository root, posix-separated, and free of `.` and `..` segments. Segments may hold spaces and dots but not `/`, `\\\\`, `:` or a line break. So a URL, a drive letter, a Windows path and an absolute path all fail here. In place of the path, `~` and at least 82 base64url characters is the path encrypted with the family key. The construction is the family's one ciphertext format. Only a checkout with the key and the files can decrypt the path and read the lines. So a public docs repo can cite a private code repo without publishing its paths. The value carries no encryption mark, because the citation tool encrypts it, and a plain path stays valid.\"\n }\n }\n}\n","/**\n * Source of truth for schemas. Holds the built-in schemas (addressed by\n * `vendor:name:version` ids) and knows how to load any schema reference —\n * a built-in id, a local `.json` path, or an `http(s)` URL.\n */\nimport { readFile } from \"node:fs/promises\";\nimport { resolve as resolvePath } from \"node:path\";\nimport { Buffer } from \"node:buffer\";\nimport { DocmetaError } from \"../types.js\";\nimport { stripBom } from \"./json-text.js\";\nimport {\n DEFAULT_TTL_HOURS,\n SchemaCache,\n schemaCacheDir,\n} from \"./schema-cache.js\";\nimport {\n INTEGRITY_SHAPE,\n diagnoseIntegrity,\n integrityOf,\n isIntegrity,\n} from \"./integrity.js\";\n\nimport okf01 from \"../schemas/okf/0.1.json\" with { type: \"json\" };\nimport diataxis10 from \"../schemas/diataxis/1.0.json\" with { type: \"json\" };\nimport sevenAction10 from \"../schemas/seven-action/1.0.json\" with { type: \"json\" };\nimport tgdp10 from \"../schemas/tgdp/1.0.json\" with { type: \"json\" };\nimport docusaurusDocs310 from \"../schemas/docusaurus-docs/3.10.json\" with { type: \"json\" };\nimport docusaurusBlog310 from \"../schemas/docusaurus-blog/3.10.json\" with { type: \"json\" };\nimport docusaurusPages310 from \"../schemas/docusaurus-pages/3.10.json\" with { type: \"json\" };\nimport starlight041 from \"../schemas/starlight/0.41.json\" with { type: \"json\" };\nimport antora31 from \"../schemas/antora/3.1.json\" with { type: \"json\" };\nimport sphinx91 from \"../schemas/sphinx/9.1.json\" with { type: \"json\" };\nimport myst110 from \"../schemas/myst/1.10.json\" with { type: \"json\" };\nimport ogp10 from \"../schemas/ogp/1.0.json\" with { type: \"json\" };\nimport dcmi11 from \"../schemas/dcmi/1.1.json\" with { type: \"json\" };\nimport microsoftLearn10 from \"../schemas/microsoft-learn/1.0.json\" with { type: \"json\" };\nimport ditaMetadata13 from \"../schemas/dita/1.3.json\" with { type: \"json\" };\nimport hugoPage0165 from \"../schemas/hugo/0.165.json\" with { type: \"json\" };\nimport jekyllPage44 from \"../schemas/jekyll/4.4.json\" with { type: \"json\" };\nimport vitepressPage16 from \"../schemas/vitepress/1.6.json\" with { type: \"json\" };\nimport xCards10 from \"../schemas/x-cards/1.0.json\" with { type: \"json\" };\nimport agentSkills10 from \"../schemas/agent-skills/1.0.json\" with { type: \"json\" };\nimport claudeSkill21 from \"../schemas/claude-skill/2.1.json\" with { type: \"json\" };\nimport mkdocsMaterial97 from \"../schemas/mkdocs-material/9.7.json\" with { type: \"json\" };\nimport claudeSubagent21 from \"../schemas/claude-subagent/2.1.json\" with { type: \"json\" };\nimport manniCore100 from \"../schemas/core/1.0.0.json\" with { type: \"json\" };\nimport manniStewardship100 from \"../schemas/stewardship/1.0.0.json\" with { type: \"json\" };\nimport manniAudience100 from \"../schemas/audience/1.0.0.json\" with { type: \"json\" };\nimport manniLifecycle100 from \"../schemas/lifecycle/1.0.0.json\" with { type: \"json\" };\nimport manniStructure100 from \"../schemas/structure/1.0.0.json\" with { type: \"json\" };\nimport manniTerminology100 from \"../schemas/terminology/1.0.0.json\" with { type: \"json\" };\nimport manniAiContext100 from \"../schemas/ai-context/1.0.0.json\" with { type: \"json\" };\nimport manniEvals100 from \"../schemas/evals/1.0.0.json\" with { type: \"json\" };\nimport manniArtifactEvals100 from \"../schemas/artifact-evals/1.0.0.json\" with { type: \"json\" };\nimport manniGraph100 from \"../schemas/graph/1.0.0.json\" with { type: \"json\" };\nimport manniCitations100 from \"../schemas/citations/1.0.0.json\" with { type: \"json\" };\nimport manniCoreStrict100 from \"../schemas/core-strict/1.0.0.json\" with { type: \"json\" };\nimport manniStewardshipStrict100 from \"../schemas/stewardship-strict/1.0.0.json\" with { type: \"json\" };\nimport manniAudienceStrict100 from \"../schemas/audience-strict/1.0.0.json\" with { type: \"json\" };\nimport manniLifecycleStrict100 from \"../schemas/lifecycle-strict/1.0.0.json\" with { type: \"json\" };\nimport manniStructureStrict100 from \"../schemas/structure-strict/1.0.0.json\" with { type: \"json\" };\nimport manniTerminologyStrict100 from \"../schemas/terminology-strict/1.0.0.json\" with { type: \"json\" };\nimport manniAiContextStrict100 from \"../schemas/ai-context-strict/1.0.0.json\" with { type: \"json\" };\nimport manniEvalsStrict100 from \"../schemas/evals-strict/1.0.0.json\" with { type: \"json\" };\nimport manniArtifactEvalsStrict100 from \"../schemas/artifact-evals-strict/1.0.0.json\" with { type: \"json\" };\nimport manniGraphStrict100 from \"../schemas/graph-strict/1.0.0.json\" with { type: \"json\" };\nimport manniCitationsStrict100 from \"../schemas/citations-strict/1.0.0.json\" with { type: \"json\" };\nimport tgdp11 from \"../schemas/tgdp/1.1.json\" with { type: \"json\" };\nimport tgdpStrict11 from \"../schemas/tgdp-strict/1.1.json\" with { type: \"json\" };\nimport manniArtifactEvals110 from \"../schemas/artifact-evals/1.1.0.json\" with { type: \"json\" };\nimport manniArtifactEvalsStrict110 from \"../schemas/artifact-evals-strict/1.1.0.json\" with { type: \"json\" };\nimport manniStewardship110 from \"../schemas/stewardship/1.1.0.json\" with { type: \"json\" };\nimport manniStewardshipStrict110 from \"../schemas/stewardship-strict/1.1.0.json\" with { type: \"json\" };\nimport { errorMessage } from \"../../shared/errors.js\";\n\nexport interface BuiltinInfo {\n id: string;\n title: string;\n description: string;\n}\n\n/** Built-in schemas keyed by `vendor:name:version` id. */\nconst BUILTINS = new Map<string, Record<string, unknown>>([\n [\"google:okf:0.1\", okf01],\n [\"diataxis:diataxis:1.0\", diataxis10],\n [\"passo-uno:seven-action:1.0\", sevenAction10],\n [\"tgdp:templates:1.0\", tgdp10],\n [\"docusaurus:docs:3.10\", docusaurusDocs310],\n [\"docusaurus:blog:3.10\", docusaurusBlog310],\n [\"docusaurus:pages:3.10\", docusaurusPages310],\n [\"astro:starlight:0.41\", starlight041],\n [\"antora:page:3.1\", antora31],\n [\"sphinx:docinfo:9.1\", sphinx91],\n [\"myst:frontmatter:1.10\", myst110],\n [\"ogp:article:1.0\", ogp10],\n [\"dcmi:elements:1.1\", dcmi11],\n [\"microsoft:learn:1.0\", microsoftLearn10],\n [\"oasis:dita-metadata:1.3\", ditaMetadata13],\n [\"hugo:page:0.165\", hugoPage0165],\n [\"jekyll:page:4.4\", jekyllPage44],\n [\"vitepress:page:1.6\", vitepressPage16],\n [\"x:cards:1.0\", xCards10],\n [\"agentskills:skill:1.0\", agentSkills10],\n [\"anthropic:claude-skill:2.1\", claudeSkill21],\n [\"mkdocs:material:9.7\", mkdocsMaterial97],\n [\"anthropic:claude-subagent:2.1\", claudeSubagent21],\n [\"manni:core:1.0.0\", manniCore100],\n [\"manni:stewardship:1.0.0\", manniStewardship100],\n [\"manni:audience:1.0.0\", manniAudience100],\n [\"manni:lifecycle:1.0.0\", manniLifecycle100],\n [\"manni:structure:1.0.0\", manniStructure100],\n [\"manni:terminology:1.0.0\", manniTerminology100],\n [\"manni:ai-context:1.0.0\", manniAiContext100],\n [\"manni:evals:1.0.0\", manniEvals100],\n [\"manni:artifact-evals:1.0.0\", manniArtifactEvals100],\n [\"manni:graph:1.0.0\", manniGraph100],\n [\"manni:citations:1.0.0\", manniCitations100],\n [\"manni:core-strict:1.0.0\", manniCoreStrict100],\n [\"manni:stewardship-strict:1.0.0\", manniStewardshipStrict100],\n [\"manni:audience-strict:1.0.0\", manniAudienceStrict100],\n [\"manni:lifecycle-strict:1.0.0\", manniLifecycleStrict100],\n [\"manni:structure-strict:1.0.0\", manniStructureStrict100],\n [\"manni:terminology-strict:1.0.0\", manniTerminologyStrict100],\n [\"manni:ai-context-strict:1.0.0\", manniAiContextStrict100],\n [\"manni:evals-strict:1.0.0\", manniEvalsStrict100],\n [\"manni:artifact-evals-strict:1.0.0\", manniArtifactEvalsStrict100],\n [\"manni:graph-strict:1.0.0\", manniGraphStrict100],\n [\"manni:citations-strict:1.0.0\", manniCitationsStrict100],\n [\"tgdp:templates:1.1\", tgdp11],\n [\"tgdp:templates-strict:1.1\", tgdpStrict11],\n [\"manni:artifact-evals:1.1.0\", manniArtifactEvals110],\n [\"manni:artifact-evals-strict:1.1.0\", manniArtifactEvalsStrict110],\n [\"manni:stewardship:1.1.0\", manniStewardship110],\n [\"manni:stewardship-strict:1.1.0\", manniStewardshipStrict110],\n]);\n\n/**\n * Built-in versions that only add annotations, each mapped to the predecessor\n * it validates exactly like. A baseline fingerprints a finding under the\n * predecessor's id, so moving to the successor leaves recorded entries intact.\n *\n * A version belongs here only when its validation is byte-identical in effect\n * to its predecessor's: the two differ in `x-manni-*` keys, `description`,\n * `title` and `$id` alone. The test suite holds every entry to that.\n */\nexport const ANNOTATION_ONLY_PREDECESSORS: ReadonlyMap<string, string> = new Map([\n [\"manni:stewardship:1.1.0\", \"manni:stewardship:1.0.0\"],\n [\"manni:stewardship-strict:1.1.0\", \"manni:stewardship-strict:1.0.0\"],\n]);\n\n/**\n * Refuse a built-in id whose first segment is `check`.\n *\n * `check:<name>` is a corpus check's identity inside baseline fingerprints and\n * rule ids (proposal 0026), and it deliberately matches `BUILTIN_ID` so\n * `classifyRef` passes it through untouched. That makes the first segment a\n * shared namespace: a real built-in published as `check:…` could collide with\n * a check's identity while both are legal. Reserved from this side so the\n * collision can never ship — the registry throws at load if the table gains\n * one.\n */\nexport function assertPublishableBuiltinId(id: string): void {\n const first = id.split(\":\")[0];\n if (first === \"check\") {\n throw new Error(\n `Built-in id \"${id}\" is not publishable: the \"check\" first segment is reserved for corpus check identities (check:<name>, proposal 0026).`,\n );\n }\n // `external:owned` is the identity of a document carrying a key a manifest\n // owns (proposal 0037), reserved for the same reason.\n if (first === \"external\") {\n throw new Error(\n `Built-in id \"${id}\" is not publishable: the \"external\" first segment is reserved for external-metadata finding identities (external:owned, external:duplicate, proposal 0037).`,\n );\n }\n // `encrypted:plain` and `encrypted:unreadable` are the identities of the\n // findings for a property marked `x-manni-encrypt` (proposal 0045).\n if (first === \"encrypted\") {\n throw new Error(\n `Built-in id \"${id}\" is not publishable: the \"encrypted\" first segment is reserved for encryption finding identities (encrypted:plain, encrypted:unreadable, proposal 0045).`,\n );\n }\n // `derived:stale` is the identity of a managed field whose asserted value\n // differs from what git, CODEOWNERS or the review record says, reserved likewise.\n if (first === \"derived\") {\n throw new Error(\n `Built-in id \"${id}\" is not publishable: the \"derived\" first segment is reserved for derived finding identities (derived:stale).`,\n );\n }\n}\n\nfor (const id of BUILTINS.keys()) assertPublishableBuiltinId(id);\n\n/** Is `id` one of the bundled built-in ids? */\nexport function isBuiltinId(id: string): boolean {\n return BUILTINS.has(id);\n}\n\n/**\n * A schema `meta.register` loaded from a local file (proposal 0070), named\n * everywhere by its own `$id`, as a built-in is named by its id.\n */\nexport interface RegisteredSchema {\n /** The schema's `$id`: `vendor:name:version`, or an `https://` URL. */\n id: string;\n /** The file, relative to the config file's directory, with forward slashes. */\n file: string;\n /** The file's absolute path. */\n path: string;\n /** The parsed schema: the object every lookup of `id` returns. */\n schema: Record<string, unknown>;\n}\n\n/** The registered schemas of one config, keyed by `$id`. */\nexport type RegisteredSchemas = ReadonlyMap<string, RegisteredSchema>;\n\n/**\n * The strict version's id for `id`, by the naming the manni overlays use:\n * `vendor:name:version` becomes `vendor:name-strict:version`. `undefined`\n * for anything that is not a three-segment id, a URL included.\n */\nexport function strictIdOf(id: string): string | undefined {\n if (classifyRef(id).kind !== \"builtin\") return undefined;\n const parts = id.split(\":\");\n if (parts.length !== 3) return undefined;\n const [vendor, name, version] = parts;\n if (vendor === undefined || name === undefined || version === undefined) return undefined;\n return `${vendor}:${name}-strict:${version}`;\n}\n\nexport function listBuiltins(): BuiltinInfo[] {\n return [...BUILTINS.entries()].map(([id, schema]) => ({\n id,\n title: typeof schema.title === \"string\" ? schema.title : id,\n description:\n typeof schema.description === \"string\" ? schema.description : \"\",\n }));\n}\n\n/**\n * Where the docs site serves byte-identical copies of the built-ins (0009).\n *\n * The site's `site` is `https://hawkeyexl.github.io` and its `base` is\n * `/manni`, and Astro serves `docs/public/**` at the site root — so\n * `docs/public/schemas/okf/0.1.json` is reachable at\n * `<PUBLISHED_BASE>okf/0.1.json`.\n */\nexport const PUBLISHED_BASE = \"https://hawkeyexl.github.io/manni/schemas/\";\n\n/**\n * Where the same bytes were served before the rename. Proposal 0009 promised\n * those URLs stay byte-stable, and the old repository's Pages keeps serving\n * them, so a `$schema` written against one keeps resolving to the bundle\n * rather than becoming a network fetch of a stranger's copy.\n */\nexport const LEGACY_PUBLISHED_BASE =\n \"https://hawkeyexl.github.io/docmeta/schemas/\";\n\n/**\n * Published URL → built-in id.\n *\n * Written out rather than derived, because the two sides do **not** correspond\n * mechanically: `passo-uno:seven-action:1.0` lives at `seven-action/1.0.json`,\n * `tgdp:templates:1.0` at `tgdp/1.0.json`, and `docusaurus:docs:3.10` at\n * `docusaurus-docs/3.10.json`. Any rule that reproduced one of those would get\n * the other two wrong, and getting it wrong means fetching a built-in over the\n * network — the regression stress test 1 of proposal 0009 exists to prevent.\n *\n * Matched as an exact string. A prefix or host rule would also swallow\n * `.../schemas/okf/9.9.json`, which does not exist and must stay an ordinary\n * remote ref that fails with a 404 rather than resolving to something else.\n */\nconst PUBLISHED_PATHS: readonly (readonly [string, string])[] = [\n [\"okf/0.1.json\", \"google:okf:0.1\"],\n [\"diataxis/1.0.json\", \"diataxis:diataxis:1.0\"],\n [\"seven-action/1.0.json\", \"passo-uno:seven-action:1.0\"],\n [\"tgdp/1.0.json\", \"tgdp:templates:1.0\"],\n [\"docusaurus-docs/3.10.json\", \"docusaurus:docs:3.10\"],\n [\"docusaurus-blog/3.10.json\", \"docusaurus:blog:3.10\"],\n [\"docusaurus-pages/3.10.json\", \"docusaurus:pages:3.10\"],\n [\"starlight/0.41.json\", \"astro:starlight:0.41\"],\n [\"antora/3.1.json\", \"antora:page:3.1\"],\n [\"sphinx/9.1.json\", \"sphinx:docinfo:9.1\"],\n [\"myst/1.10.json\", \"myst:frontmatter:1.10\"],\n [\"ogp/1.0.json\", \"ogp:article:1.0\"],\n [\"dcmi/1.1.json\", \"dcmi:elements:1.1\"],\n [\"microsoft-learn/1.0.json\", \"microsoft:learn:1.0\"],\n [\"dita/1.3.json\", \"oasis:dita-metadata:1.3\"],\n [\"hugo/0.165.json\", \"hugo:page:0.165\"],\n [\"jekyll/4.4.json\", \"jekyll:page:4.4\"],\n [\"vitepress/1.6.json\", \"vitepress:page:1.6\"],\n [\"x-cards/1.0.json\", \"x:cards:1.0\"],\n [\"agent-skills/1.0.json\", \"agentskills:skill:1.0\"],\n [\"claude-skill/2.1.json\", \"anthropic:claude-skill:2.1\"],\n [\"mkdocs-material/9.7.json\", \"mkdocs:material:9.7\"],\n [\"claude-subagent/2.1.json\", \"anthropic:claude-subagent:2.1\"],\n [\"core/1.0.0.json\", \"manni:core:1.0.0\"],\n [\"stewardship/1.0.0.json\", \"manni:stewardship:1.0.0\"],\n [\"audience/1.0.0.json\", \"manni:audience:1.0.0\"],\n [\"lifecycle/1.0.0.json\", \"manni:lifecycle:1.0.0\"],\n [\"structure/1.0.0.json\", \"manni:structure:1.0.0\"],\n [\"terminology/1.0.0.json\", \"manni:terminology:1.0.0\"],\n [\"ai-context/1.0.0.json\", \"manni:ai-context:1.0.0\"],\n [\"evals/1.0.0.json\", \"manni:evals:1.0.0\"],\n [\"artifact-evals/1.0.0.json\", \"manni:artifact-evals:1.0.0\"],\n [\"graph/1.0.0.json\", \"manni:graph:1.0.0\"],\n [\"citations/1.0.0.json\", \"manni:citations:1.0.0\"],\n [\"core-strict/1.0.0.json\", \"manni:core-strict:1.0.0\"],\n [\"stewardship-strict/1.0.0.json\", \"manni:stewardship-strict:1.0.0\"],\n [\"audience-strict/1.0.0.json\", \"manni:audience-strict:1.0.0\"],\n [\"lifecycle-strict/1.0.0.json\", \"manni:lifecycle-strict:1.0.0\"],\n [\"structure-strict/1.0.0.json\", \"manni:structure-strict:1.0.0\"],\n [\"terminology-strict/1.0.0.json\", \"manni:terminology-strict:1.0.0\"],\n [\"ai-context-strict/1.0.0.json\", \"manni:ai-context-strict:1.0.0\"],\n [\"evals-strict/1.0.0.json\", \"manni:evals-strict:1.0.0\"],\n [\"artifact-evals-strict/1.0.0.json\", \"manni:artifact-evals-strict:1.0.0\"],\n [\"graph-strict/1.0.0.json\", \"manni:graph-strict:1.0.0\"],\n [\"citations-strict/1.0.0.json\", \"manni:citations-strict:1.0.0\"],\n [\"tgdp/1.1.json\", \"tgdp:templates:1.1\"],\n [\"tgdp-strict/1.1.json\", \"tgdp:templates-strict:1.1\"],\n [\"artifact-evals/1.1.0.json\", \"manni:artifact-evals:1.1.0\"],\n [\"artifact-evals-strict/1.1.0.json\", \"manni:artifact-evals-strict:1.1.0\"],\n [\"stewardship/1.1.0.json\", \"manni:stewardship:1.1.0\"],\n [\"stewardship-strict/1.1.0.json\", \"manni:stewardship-strict:1.1.0\"],\n];\n\n/** Published URL → built-in id, under the current base. */\nconst PUBLISHED_ALIAS: ReadonlyMap<string, string> = new Map(\n PUBLISHED_PATHS.map(([path, id]) => [`${PUBLISHED_BASE}${path}`, id]),\n);\n\n/**\n * The same table under the pre-rename base. Consulted for resolution only;\n * `publishedBuiltins()` lists each built-in once, under the current URL.\n */\nconst LEGACY_PUBLISHED_ALIAS: ReadonlyMap<string, string> = new Map(\n PUBLISHED_PATHS.map(([path, id]) => [`${LEGACY_PUBLISHED_BASE}${path}`, id]),\n);\n\n/**\n * The bundled object a published URL names, or `undefined`.\n *\n * **Both** tables have to answer, not just `PUBLISHED_ALIAS`. A URL mapped to\n * an id that is not in `BUILTINS` — a typo in one of the two literals — is not\n * a published built-in at all: `loadSchema` would fall through to the network\n * for it. If membership alone decided, the trust boundary would exempt a URL\n * that then got fetched from a third party, which is the one combination\n * neither check may produce. One resolution, so the two cannot disagree.\n *\n * Unreachable in practice: a test asserts the table covers exactly\n * {@link listBuiltins}, so a mismatch fails the suite rather than shipping.\n * The point of resolving through both is that a future edit cannot quietly\n * turn a typo into a trust hole.\n */\nfunction publishedBuiltinSchema(\n ref: string,\n): Record<string, unknown> | undefined {\n const id = PUBLISHED_ALIAS.get(ref) ?? LEGACY_PUBLISHED_ALIAS.get(ref);\n return id === undefined ? undefined : BUILTINS.get(id);\n}\n\n/**\n * Does this reference name a built-in that docmeta happens to publish?\n *\n * A published URL resolves to a **bundled object**: no request is made, no\n * third party can answer for it, and the bytes are the ones in this package. So\n * every place that reasons about what a `url` ref can reach has to treat it as\n * the built-in it is — see `assertDocumentRefAllowed` in `resolve-schema.ts`,\n * which shares this predicate rather than repeating the table.\n */\nexport function isPublishedBuiltinUrl(ref: string): boolean {\n return publishedBuiltinSchema(ref) !== undefined;\n}\n\n/** One built-in, in both of its spellings, with the object they both name. */\nexport interface PublishedBuiltin {\n /** The `vendor:name:version` id, which is also the schema's own `$id`. */\n id: string;\n /** The docs-site URL serving byte-identical content. */\n url: string;\n /** The same content under the pre-rename base, still served and still honored. */\n legacyUrl: string;\n /** The bundled object — the same reference `loadSchema(id)` returns. */\n schema: Record<string, unknown>;\n}\n\n/**\n * Every built-in with its published URL, for callers that need both spellings.\n *\n * `validator.ts` registers these with each Ajv instance so a user's schema can\n * `$ref` a built-in by either name, and the tests assert this covers exactly\n * {@link listBuiltins} — adding a built-in without a URL fails there.\n */\nexport function publishedBuiltins(): PublishedBuiltin[] {\n const out: PublishedBuiltin[] = [];\n for (const [path, id] of PUBLISHED_PATHS) {\n const url = `${PUBLISHED_BASE}${path}`;\n const legacyUrl = `${LEGACY_PUBLISHED_BASE}${path}`;\n const schema = publishedBuiltinSchema(url);\n // A URL whose id is not in `BUILTINS` is skipped rather than registered as\n // `undefined`. Unreachable while both tables are literals here, and the\n // coverage test is what keeps it that way: it compares this list against\n // `listBuiltins()`, so a typo shows up as a missing entry — which is\n // exactly what skipping produces.\n if (schema) out.push({ id, url, legacyUrl, schema });\n }\n return out;\n}\n\nexport type RefKind = \"builtin\" | \"file\" | \"url\";\n\n/**\n * A built-in id looks like `seg(:seg)+` using only [a-z0-9._-] segments, with\n * no path separators and not ending in `.json`. This deliberately excludes\n * Windows paths (`C:\\...`), URLs, and `.json` files so a typo'd built-in is\n * reported as an unknown id rather than silently treated as a missing file.\n */\nconst BUILTIN_ID = /^[a-z0-9][a-z0-9._-]*(?::[a-z0-9][a-z0-9._-]*)+$/i;\n\nexport function classifyRef(ref: string): { kind: RefKind; ref: string } {\n if (/^https?:\\/\\//i.test(ref)) return { kind: \"url\", ref };\n if (\n !ref.includes(\"/\") &&\n !ref.includes(\"\\\\\") &&\n !ref.toLowerCase().endsWith(\".json\") &&\n BUILTIN_ID.test(ref)\n ) {\n return { kind: \"builtin\", ref };\n }\n return { kind: \"file\", ref };\n}\n\nconst urlCache = new Map<string, Record<string, unknown>>();\n\n/**\n * Refs whose `urlCache` entry came off the **network** in this process.\n *\n * `urlCache` is a memo, so an entry warmed by an earlier online call would\n * satisfy a later `offline` one — the guard never runs, because the short\n * circuit happens before it. For the CLI that is unreachable (each invocation\n * is a fresh process), but `loadSchema` is public API, and a long-lived\n * consumer doing `loadSchema(url)` then `loadSchema(url, { offline: true })`\n * would see offline \"work\" and then fail in an air-gapped process. Worse, it\n * holds even with no disk cache configured at all, so the run has nothing\n * legal to serve.\n *\n * Tracking provenance keeps the memo for entries an offline run may legally\n * use — anything read from the disk cache — while sending network-sourced refs\n * back through `resolveRemote`, which applies the guard.\n */\nconst urlFromNetwork = new Set<string>();\n\n/**\n * In-flight fetches, keyed on the *promise* rather than the resolved schema.\n *\n * `urlCache` only populates once the response has been read, so it collapses\n * repeat loads but not concurrent ones — and `fill` calls `loadSchema`\n * directly, once per file, inside a worker pool. Every worker therefore missed\n * the cache while the first fetch was still pending, and N files sharing one\n * remote ref fired N concurrent requests at the same host.\n *\n * Mirrors `Validator.compile`, including its two disciplines: the entry is\n * stored before the first await, and a rejection evicts it through a detached\n * `.catch()`. See the comments at the `set` below for why each matters.\n *\n * Keyed on `offline` as well as the ref, via {@link inflightKey}. Sharing one\n * entry across both modes let an offline caller join an online caller's open\n * fetch and receive the network result — the very thing `urlFromNetwork`\n * refuses one step earlier, undone by arriving a moment sooner.\n */\nconst urlInflight = new Map<string, Promise<Record<string, unknown>>>();\n\n/**\n * The `urlInflight` key for one call.\n *\n * Offline and online resolves of the same URL are different requests with\n * different answers, so they must not share an entry — in *either* direction.\n * An offline caller joining an online fetch is served over the network. An\n * online caller joining an offline resolve inherits its rejection when nothing\n * is cached, failing a run that had a working network the whole time.\n *\n * The cost is one extra resolve when a single process runs both modes against\n * one URL concurrently, which no CLI invocation does — every run has one\n * `offline` setting.\n *\n * `false` and `undefined` deliberately collapse to the same key: only `true`\n * means offline, and an absent flag is an online call, so the two must share an\n * entry or an ordinary run would dedup against nothing.\n */\nfunction inflightKey(ref: string, offline: boolean | undefined): string {\n return `${offline === true ? \"offline\" : \"online\"}:${ref}`;\n}\n\n/** Default network timeout for fetching a remote (`http(s)`) schema. */\nconst DEFAULT_TIMEOUT_MS = 10_000;\n\n/**\n * Default cap on a fetched schema's body, in bytes.\n *\n * `AbortSignal.timeout` covers a *slow* body but not a *fast, huge* one, so\n * without a cap a hostile or misconfigured endpoint can stream until the\n * process runs out of memory. The largest schema docmeta itself ships is the\n * 112 KB SARIF meta-schema, so 5 MB is roughly two orders of magnitude of\n * headroom over anything a real document contract needs.\n */\nconst DEFAULT_MAX_BYTES = 5 * 1024 * 1024;\n\n/**\n * Keys that make a JSON object a *contract* — something that can reject a\n * document. An object carrying none of them constrains nothing, so every\n * document passes it, and it is far likelier to be an error envelope served\n * with HTTP 200 (an API gateway, a proxy, a misconfigured bucket) than a\n * schema.\n *\n * This is deliberately **not** meta-schema validation. docmeta compiles four\n * dialects, and schema quality is the author's business: a sparse but real\n * schema must keep working. The guard targets one specific failure — a\n * non-schema served as one — and nothing else.\n *\n * The list is therefore deliberately **generous**, covering the standard\n * validation and applicator vocabularies across draft-04 through 2020-12. The\n * two failure directions are not symmetric: letting an odd payload through\n * means it fails at compile time or behaves as the permissive schema it\n * literally is, while rejecting a real schema breaks a working setup outright.\n * A schema whose only root keyword is `if`/`then` or `patternProperties` is\n * perfectly ordinary, and an error envelope carries none of these.\n */\nconst SCHEMA_KEYS = [\n // Core identity and reference\n \"$schema\",\n \"$id\",\n \"$ref\",\n \"$defs\",\n \"definitions\",\n // Applicators\n \"allOf\",\n \"anyOf\",\n \"oneOf\",\n \"not\",\n \"if\",\n \"then\",\n \"else\",\n \"dependentSchemas\",\n \"dependencies\",\n // Object shape\n \"type\",\n \"properties\",\n \"required\",\n \"additionalProperties\",\n \"patternProperties\",\n \"propertyNames\",\n \"unevaluatedProperties\",\n \"dependentRequired\",\n \"minProperties\",\n \"maxProperties\",\n // Array shape\n \"items\",\n \"prefixItems\",\n \"contains\",\n \"unevaluatedItems\",\n \"minItems\",\n \"maxItems\",\n \"uniqueItems\",\n \"minContains\",\n \"maxContains\",\n // Scalar constraints\n \"enum\",\n \"const\",\n \"format\",\n \"pattern\",\n \"minLength\",\n \"maxLength\",\n \"minimum\",\n \"maximum\",\n \"exclusiveMinimum\",\n \"exclusiveMaximum\",\n \"multipleOf\",\n] as const;\n\n/**\n * Backoff before the single retry.\n *\n * One attempt, not three: the timeout already means a hung host costs\n * `timeoutMs`, and three retries would make that three times over per URL. One\n * removes the most common flake at a bounded cost.\n */\nconst RETRY_DELAY_MS = 500;\n\n/**\n * Not `unref`'d, deliberately. During the backoff this timer is frequently the\n * only thing left on the event loop — an unref'd one lets node exit **0 with no\n * output at all**, turning a failed fetch into a silent green run.\n */\nconst wait = (ms: number): Promise<void> =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\n/**\n * What a config recorded about one reference beyond the reference itself.\n *\n * Kept out of the ref string deliberately: the ref appears in every report,\n * every baseline fingerprint, and `Validator`'s compile cache key, so it has to\n * stay exactly the string the user wrote.\n */\nexport interface SchemaPin {\n /** Where the reference was vendored from — a URL, or a local path. */\n source?: string;\n /** `sha256-<64 hex>` the file's bytes must hash to. */\n integrity?: string;\n}\n\nexport interface LoadSchemaOptions {\n /**\n * Directory a **relative local-file** ref is resolved against.\n *\n * Omitted means `process.cwd()`, which is what the CLI wants and what this\n * always did. A library caller passing `cwd` to a command core needs the\n * ref measured from *that* directory instead: `rebaseConfigSchemaRefs`\n * deliberately leaves refs untouched when the config already sits in the\n * run's `cwd`, so `./schema/house.json` arrives here exactly as written and\n * was then read against the wrong directory.\n *\n * Resolved at read time rather than by rewriting the ref, and that choice is\n * load-bearing: the ref string is what reports name, what `Validator` keys\n * its compile cache on, and what every baseline fingerprint is taken over.\n * Rewriting it to an absolute path would silently move every recorded\n * baseline. `canonicalSchemaRef` in `baseline.ts` already measures a relative\n * ref from the run's `cwd`, so this makes loading agree with fingerprinting\n * rather than introducing a new convention.\n */\n fileBase?: string;\n /** Abort a remote fetch after this many ms (default 10_000). */\n timeoutMs?: number;\n /** Reject a remote schema whose body exceeds this many bytes (default 5 MB). */\n maxBytes?: number;\n /**\n * Directory for the cross-run schema cache. Omitted means **no disk cache**:\n * the registry never guesses a project root, so a library caller gets the\n * in-process behavior until it opts in. The command cores pass\n * `schemaCacheDir(configDir ?? cwd)`.\n */\n cacheDir?: string;\n /** Hours a cached entry stays fresh; `0` disables the cache (default 24). */\n ttlHours?: number;\n /**\n * Never touch the network. A URL ref resolves from the disk cache — ignoring\n * the TTL, since there is no re-fetch to fall back on — and an uncached one\n * fails naming the URL. Built-ins and local files are unaffected.\n *\n * This is a *durability* control, not a trust boundary, and it never was:\n * whether a document may name a URL at all is decided upstream by\n * `schemaTrust` in `resolveSchemaSet`, which is the last place that still\n * knows a ref came from a document rather than from an operator (proposal\n * 0015). `offline` used to block that case by accident and was the only thing\n * standing there; it is now free to mean only what it says.\n */\n offline?: boolean;\n /**\n * Provenance and integrity pins, keyed on the reference exactly as it is\n * passed to `loadSchema`. Built by `collectSchemaPins` from the **rebased**\n * config, so both sides spell a local path the same way; a config with no\n * mapping-form `schemas:` entries produces an empty map and none of this\n * runs.\n */\n pins?: ReadonlyMap<string, SchemaPin>;\n /**\n * The schemas `meta.register` loaded (proposal 0070), keyed by `$id`. A ref\n * naming one resolves to its file's schema before anything else is\n * consulted, so a registered `https://` id is never fetched.\n */\n registered?: RegisteredSchemas;\n}\n\n/**\n * A fetch failure a second attempt might not hit: a network-level error, or a\n * 5xx. Never a 4xx — a 404 will not heal, and retrying it only doubles the\n * cost of a misconfiguration.\n *\n * Extends `DocmetaError` so that if the retry also fails, the error escaping\n * this module is already the operational error the CLI knows how to report.\n */\nclass RetryableFetchError extends DocmetaError {}\n\n/** An abort — ours are only ever raised by the request's timeout signal. */\nfunction isAbort(err: unknown): boolean {\n const name = (err as { name?: unknown } | null)?.name;\n return name === \"TimeoutError\" || name === \"AbortError\";\n}\n\n/**\n * The `JSON.parse` messages that splice a prefix of the parsed text into\n * themselves: `Unexpected token 'r', \"root:x:0:0\"... is not valid JSON`, with\n * an optional leading `...` when the failure is mid-document.\n *\n * The other family — `Expected ':' after property name in JSON at position 4\n * (line 1 column 5)` — quotes nothing back and is left exactly as V8 wrote it.\n */\nconst JSON_PARSE_EXCERPT =\n /^Unexpected token '[\\s\\S]', (?:\\.\\.\\.)?\"([\\s\\S]*)\"(?:\\.\\.\\.)? is not valid JSON$/;\n\n/** 1-based position of `index` in `text`, for an error message. */\nfunction lineColumn(text: string, index: number): string {\n let line = 1;\n let column = 1;\n const stop = Math.min(index, text.length);\n for (let i = 0; i < stop; i++) {\n if (text.charCodeAt(i) === 10) {\n line += 1;\n column = 1;\n } else {\n column += 1;\n }\n }\n return `line ${line} column ${column}`;\n}\n\n/**\n * A parse failure for a **file** ref, with the file's own bytes taken out.\n *\n * The excerpt V8 embeds is content off the operator's disk, and this message\n * reaches stderr *and* the `json`/`sarif` reports the formats workflow uploads\n * to code scanning — so before proposal 0015 it was readable by whoever opened\n * the pull request, roughly ten bytes per run and repeatable with a different\n * path each time.\n *\n * Position is what the operator actually needs, and it survives: the excerpt is\n * located in the text we just tried to parse, and its line and column are\n * reported instead of the excerpt itself. \"Where\", without the \"what\".\n *\n * Deliberately **not** applied to the remote-response excerpt above. `73c625f`\n * put that in front of the operator on purpose, and a response body from a URL\n * the operator configured is a different thing from bytes off their disk.\n */\nfunction withoutFileExcerpt(message: string, text: string): string {\n const match = JSON_PARSE_EXCERPT.exec(message);\n if (!match) return message;\n const quoted = match[1];\n const at = quoted === undefined || quoted === \"\" ? -1 : text.indexOf(quoted);\n return at < 0 ? \"unexpected token\" : `unexpected token at ${lineColumn(text, at)}`;\n}\n\n/** A short, single-line sample of a response body, for an error message. */\nfunction excerpt(raw: string, limit = 200): string {\n const flat = raw.replace(/\\s+/g, \" \").trim();\n return flat.length > limit ? `${flat.slice(0, limit)}…` : flat;\n}\n\n/**\n * Read a response body, aborting once it exceeds `maxBytes`.\n *\n * Counts the bytes actually received. `content-length` is advisory — it may be\n * absent on a chunked response and it may simply be a lie — so it is never\n * consulted; trusting it is what leaves the cap bypassable.\n */\nasync function readCappedBody(\n ref: string,\n res: Response,\n maxBytes: number,\n): Promise<Buffer> {\n const body = res.body;\n if (!body) return Buffer.alloc(0);\n // `@types/node` types `Response.body` as `ReadableStream<any>`, so every\n // chunk would arrive as `any` and the size accounting below would be done in\n // `any` arithmetic — which is how a cap silently stops being a cap. Name the\n // chunk type once, here, at the boundary where the `any` enters.\n const reader = body.getReader() as ReadableStreamDefaultReader<Uint8Array>;\n const chunks: Uint8Array[] = [];\n let total = 0;\n try {\n for (;;) {\n // Annotated `value?:` rather than taking `ReadableStreamReadResult`'s\n // word for it. That type is the more precise of the two — a discriminated\n // union promising a value whenever `done` is false — and it is deliberately\n // not used here: the promise is the *stream implementation's* to keep, not\n // something the reader enforces, and the guard below is only meaningful\n // while the type admits the case it guards.\n const { done, value }: { done: boolean; value?: Uint8Array } =\n await reader.read();\n if (done) break;\n // `Uint8Array` is always truthy, even at length 0, so this only ever\n // means \"no chunk this turn\" — not \"skip an empty chunk\".\n if (value === undefined) continue;\n total += value.byteLength;\n if (total > maxBytes) {\n throw new DocmetaError(\n `Schema \"${ref}\" is too large: the response exceeds the ${maxBytes}-byte limit.`,\n );\n }\n chunks.push(value);\n }\n } finally {\n // Drop the rest of the response when we bailed out early; a no-op once the\n // stream has already completed.\n void reader.cancel().catch(() => {});\n }\n // Concatenate rather than decoding per chunk: a multi-byte character can\n // straddle a chunk boundary. `total` is already exact, so passing it spares\n // `concat` a second pass to re-derive the same length.\n //\n // Returned as **bytes**. `schemas vendor` hashes and writes exactly what the\n // server sent, and a decode/re-encode round trip through a UTF-8 string is\n // lossy for a payload that is not valid UTF-8 — which would make an integrity\n // pin wrong in precisely the case it exists to catch.\n return Buffer.concat(chunks, total);\n}\n\n/**\n * Reject a fetched payload that is not a schema.\n *\n * Only remote refs are guarded. A local file or a built-in is something the\n * user chose deliberately and can inspect, and a no-op contract there is their\n * call; a URL is a live third party that can answer with anything.\n */\nfunction assertFetchedSchema(\n ref: string,\n value: unknown,\n raw: string,\n): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n // A bare `true` is a legal JSON Schema meaning \"everything passes\" — the\n // same false green as an envelope, and never what a published document\n // contract means.\n return failNotASchema(\n ref,\n raw,\n `expected a JSON object, got ${Array.isArray(value) ? \"an array\" : `a ${typeof value}`}`,\n );\n }\n const schema = value as Record<string, unknown>;\n if (!SCHEMA_KEYS.some((key) => key in schema)) {\n return failNotASchema(\n ref,\n raw,\n // Diagnosis only. Naming all ~47 accepted keywords here pushed several\n // hundred characters between the operator and the response excerpt below,\n // which is the part that actually identifies the culprit. The full list\n // is reference material and lives in the schema-resolution docs.\n \"it carries no JSON Schema keyword, so it constrains nothing and every \" +\n \"document would pass it\",\n );\n }\n return schema;\n}\n\nfunction failNotASchema(ref: string, raw: string, reason: string): never {\n throw new DocmetaError(\n `Schema \"${ref}\" does not look like a JSON Schema: ${reason}. ` +\n `The server returned: ${excerpt(raw)}`,\n );\n}\n\n/**\n * One request, returning an OK response.\n *\n * A network error and a 5xx are raised as `RetryableFetchError`; a 4xx and a\n * timeout are not. The timeout is deliberate: it is already the budget for a\n * host that is not answering, so retrying it buys no new information and\n * doubles the ceiling per URL.\n */\nasync function requestSchema(\n ref: string,\n timeoutMs: number,\n timedOut: DocmetaError,\n): Promise<Response> {\n let res: Response;\n try {\n res = await fetch(ref, { signal: AbortSignal.timeout(timeoutMs) });\n } catch (err) {\n if (isAbort(err)) throw timedOut;\n throw new RetryableFetchError(\n `Failed to fetch schema \"${ref}\": ${errorMessage(err)}`,\n );\n }\n if (!res.ok) {\n // Discard the body: nothing reads it, and leaving it undrained can hold the\n // socket open — which matters now that a second request may follow.\n void res.body?.cancel().catch(() => {});\n const message = `Failed to fetch schema \"${ref}\": HTTP ${res.status}.`;\n throw res.status >= 500\n ? new RetryableFetchError(message)\n : new DocmetaError(message);\n }\n return res;\n}\n\n/** A fetched schema, with the bytes it arrived as. */\nexport interface FetchedSchema {\n /** Exactly what the server sent, undecoded. */\n bytes: Buffer;\n /** The same payload, parsed and guarded. */\n schema: Record<string, unknown>;\n}\n\n/**\n * Fetch, size-cap, parse, and guard a remote schema. At most two requests.\n *\n * Exported for `schemas vendor`, which needs the raw bytes to write and to\n * hash. Sharing this path rather than fetching separately is what keeps\n * vendoring subject to the same size cap, retry policy, and payload guard as\n * validation — a vendored error envelope would otherwise be committed to the\n * repository and pass every document from then on.\n *\n * Deliberately **not** routed through the disk cache or `offline`: vendoring is\n * an explicit request to download, and the cache stores a parsed schema rather\n * than the bytes a pin has to be taken over.\n */\nexport async function fetchSchemaBytes(\n ref: string,\n options: LoadSchemaOptions = {},\n): Promise<FetchedSchema> {\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n const timedOut = new DocmetaError(\n `Failed to fetch schema \"${ref}\": timed out after ${timeoutMs}ms.`,\n );\n\n let res: Response;\n try {\n res = await requestSchema(ref, timeoutMs, timedOut);\n } catch (err) {\n if (!(err instanceof RetryableFetchError)) throw err;\n await wait(RETRY_DELAY_MS);\n // The second attempt is the last one. If it fails the same way, the error\n // is already a `DocmetaError` and propagates as the operational failure it\n // is.\n res = await requestSchema(ref, timeoutMs, timedOut);\n }\n\n let bytes: Buffer;\n try {\n bytes = await readCappedBody(ref, res, maxBytes);\n } catch (err) {\n if (err instanceof DocmetaError) throw err;\n // The headers arrive first, so a timeout during the body lands here rather\n // than on the `fetch` above. Reporting it as a parse failure — which is\n // what reading the body as JSON in one step did — points the operator at\n // the schema author instead of at the network.\n if (isAbort(err)) throw timedOut;\n throw new DocmetaError(\n `Failed to fetch schema \"${ref}\": ${errorMessage(err)}`,\n );\n }\n\n // `bytes` is returned untouched below — `schemas vendor` hashes it and writes\n // it, so the vendored copy is what the server actually sent. Only the string\n // we parse loses the BOM. See `stripBom`.\n const raw = stripBom(bytes.toString(\"utf8\"));\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n throw new DocmetaError(\n `Schema \"${ref}\" did not return valid JSON: ${errorMessage(err)}`,\n );\n }\n\n return { bytes, schema: assertFetchedSchema(ref, parsed, raw) };\n}\n\n/**\n * Resolve one remote ref: disk cache, then the network.\n *\n * Runs **inside** the in-flight promise the url branch stores, not beside it.\n * Hoisting the cache read out would put an `await` between the miss and the\n * `set`, which is the check-then-act race `urlInflight` exists to close — and\n * it would also let `fill`'s worker pool race N writes onto one cache file.\n */\nasync function resolveRemote(\n ref: string,\n options: LoadSchemaOptions,\n): Promise<Record<string, unknown>> {\n // Hoisted rather than read twice: `cache` is derived from it, so branching on\n // `cacheDir` first is what lets the compiler see that a working cache implies\n // a directory worth naming in the remedy below.\n const cacheDir = options.cacheDir;\n const cache = cacheDir\n ? new SchemaCache(cacheDir, options.ttlHours ?? DEFAULT_TTL_HOURS)\n : null;\n\n if (cache) {\n // Offline ignores the TTL: expiry exists to trigger a re-fetch, and there\n // is none available, so a stale contract beats no contract at all.\n const hit = await cache.read(ref, { ignoreTtl: options.offline === true });\n if (hit) {\n urlCache.set(ref, hit);\n // Served from disk, so an offline call may use this memo from now on.\n urlFromNetwork.delete(ref);\n return hit;\n }\n }\n\n if (options.offline === true) {\n // The remedy depends on the configuration, and the old wording named a\n // hard-coded directory while advising a re-run that could never help. With\n // no cache configured, or with the TTL set to 0, running online populates\n // nothing — so saying \"run once online\" there sends the operator in a\n // circle.\n // Branch on whether the cache *works*, not on whether the object exists.\n // `cacheDir` is always supplied by the CLI, so `cache` is non-null even\n // when `ttlHours: 0` has disabled reads and writes alike — and telling that\n // user to \"run once without --offline to populate the cache\" is advice that\n // can never work, which is the circular remedy this message was rewritten\n // to remove.\n // Three cases, not two, because \"no cache\" and \"cache switched off\" have\n // different remedies and naming the wrong one is what made the earlier\n // versions of this message send people in circles.\n // Same three cases, ordered so `cacheDir` is narrowed to a string by the\n // time the first branch interpolates it.\n const remedy =\n cacheDir === undefined\n ? \"No schema cache is configured for this run, so there is nothing for --offline to read. Pass a `cacheDir`, or point the reference at a local file or a built-in id.\"\n : cache?.enabled\n ? `Run once without --offline to populate ${cacheDir}, or point the reference at a local file.`\n : \"The schema cache is switched off (`schemaCache.ttlHours: 0`), so there is nothing for --offline to read. Set a non-zero `schemaCache.ttlHours`, or point the reference at a local file or a built-in id.\";\n throw new DocmetaError(\n `Cannot resolve schema \"${ref}\": --offline is set and it could not be served from cache. ${remedy}`,\n );\n }\n\n const { schema } = await fetchSchemaBytes(ref, options);\n urlCache.set(ref, schema);\n urlFromNetwork.add(ref);\n if (cache && (await cache.write(ref, schema))) {\n // Only once the entry really landed. `write` swallows its failures by\n // design — a read-only checkout must not fail the run — so clearing the\n // mark unconditionally would tell a later offline call it may use the memo\n // for a schema that never reached disk: the same false pass, one step\n // narrower.\n urlFromNetwork.delete(ref);\n }\n return schema;\n}\n\n/**\n * Settle the remote-schema options for one run, from the config and the flag.\n *\n * Lives here rather than in a command core because all three commands need the\n * same answer, and because \"where does the cache live\" is a property of schema\n * loading, not of `validate`. `root` is the config's directory when a config\n * governs the run, so a developer running from `docs/` shares the cache with\n * CI running from the repo root instead of quietly keeping a second one.\n */\nexport function schemaLoadOptions(args: {\n root: string;\n /**\n * Where a relative local-file schema ref is measured from — the run's `cwd`,\n * not `root`. The two differ when a config was discovered in an ancestor, and\n * a `--schema ./x.json` typed on the command line belongs to the directory\n * the user was standing in, not to the config's.\n */\n fileBase?: string;\n /** Config `schemaCache.ttlHours`. */\n ttlHours?: number;\n /** `--offline`, else config `offline:`. */\n offline?: boolean;\n /** From `collectSchemaPins(config)`; omitted when the config pins nothing. */\n pins?: ReadonlyMap<string, SchemaPin>;\n /** The config's registered schemas (`config.registered`), when it has any. */\n registered?: RegisteredSchemas;\n}): LoadSchemaOptions {\n return {\n cacheDir: schemaCacheDir(args.root),\n ...(args.fileBase !== undefined ? { fileBase: args.fileBase } : {}),\n ...(args.ttlHours !== undefined ? { ttlHours: args.ttlHours } : {}),\n ...(args.offline !== undefined ? { offline: args.offline } : {}),\n // An empty map is dropped so a config with no mapping-form entries produces\n // exactly the options object it produced before 0008.\n ...(args.pins !== undefined && args.pins.size > 0\n ? { pins: args.pins }\n : {}),\n ...(args.registered !== undefined && args.registered.size > 0\n ? { registered: args.registered }\n : {}),\n };\n}\n\n/**\n * How to get the bytes of a pinned reference back, for an error message.\n *\n * Two states, and they lead different places: the config recorded where the\n * schema came from, or it did not. Advising a re-vendor without a `source` to\n * re-vendor *from* is the kind of remedy that sends an operator in a circle.\n */\nfunction repinAdvice(ref: string, pin: SchemaPin): string {\n return pin.source !== undefined\n ? `Re-download it with \\`manni meta schemas vendor ${pin.source}\\`, or update the recorded integrity if the change was intended.`\n : `Restore the file from version control, or record the new bytes by re-running \\`manni meta schemas vendor\\` with the URL this copy came from. (No \\`source:\\` is recorded for \"${ref}\", so manni cannot say where that is.)`;\n}\n\n/**\n * Check a local schema file against its recorded pin.\n *\n * Three outcomes, all of them enumerated rather than defaulted: the pin is not\n * one this version can verify, the bytes match, or they do not — and in the\n * last case the *reason* is narrowed further, because a CRLF checkout of an LF\n * download is a mismatch on a file nobody edited and reads as corruption unless\n * it is named.\n */\nfunction assertIntegrity(\n ref: string,\n bytes: Buffer,\n pin: SchemaPin,\n integrity: string,\n): void {\n // Reachable only from a library caller building pins by hand; the config\n // parser rejects a malformed pin at its source, where the line number is.\n if (!isIntegrity(integrity)) {\n throw new DocmetaError(\n `Schema \"${ref}\" has an integrity pin manni cannot verify: \"${integrity}\". Expected \"${INTEGRITY_SHAPE}\".`,\n );\n }\n const found = integrityOf(bytes);\n if (found === integrity) return;\n\n const because =\n diagnoseIntegrity(bytes, integrity) === \"line-endings\"\n ? `The contents differ only in line endings, so this is almost certainly a checkout converting them rather than an edit — keep the file byte-exact with a \\`.gitattributes\\` rule such as \\`${ref.split(/[\\\\/]/).pop() ?? \"*.json\"} -text\\`.`\n : \"The file's contents have changed since it was vendored.\";\n\n throw new DocmetaError(\n `Schema \"${ref}\" does not match its recorded integrity.\\n` +\n ` expected ${integrity}\\n` +\n ` found ${found}\\n` +\n `${because} ${repinAdvice(ref, pin)}`,\n );\n}\n\n/**\n * The message for an id nothing answers to. It points at `manni meta schemas`\n * for the built-ins, which are too many to read in one line, and names the\n * registered ids, because a registered id is typed exactly like a built-in\n * one and a run with no config registers nothing.\n */\nexport function unknownSchemaMessage(\n ref: string,\n registered: RegisteredSchemas | undefined,\n): string {\n const ids = [...(registered?.keys() ?? [])];\n return `Unknown schema \"${ref}\". manni meta schemas lists the built-in ids. Registered by meta.register: ${ids.length > 0 ? ids.join(\", \") : \"none\"}.`;\n}\n\n/** Load and return the JSON Schema object for a reference. */\nexport async function loadSchema(\n ref: string,\n options: LoadSchemaOptions = {},\n): Promise<Record<string, unknown>> {\n // A registered schema answers for its id before a built-in, a cache or a\n // request is consulted: the config vouches for the file (proposal 0070).\n const registered = options.registered?.get(ref);\n if (registered) return registered.schema;\n\n const { kind } = classifyRef(ref);\n const pin = options.pins?.get(ref);\n\n // A pin on anything but a local file cannot be checked: a built-in has no\n // bytes on disk, and a URL may legitimately be served from the schema cache,\n // which stores the parsed schema rather than what the server sent. Silently\n // skipping it would leave a config that reads as pinned and is not, so this\n // fails loudly instead. The config parser rejects the same thing earlier and\n // with a better message; this catches a library caller.\n if (pin?.integrity !== undefined && kind !== \"file\") {\n throw new DocmetaError(\n `Schema \"${ref}\" carries an integrity pin, but a pin can only be verified against a local file (this is a ${kind === \"url\" ? \"URL\" : \"built-in id\"}). Vendor it with \\`manni meta schemas vendor\\`, or drop the pin.`,\n );\n }\n\n if (kind === \"builtin\") {\n const schema = BUILTINS.get(ref);\n if (!schema) throw new DocmetaError(unknownSchemaMessage(ref, options.registered));\n return schema;\n }\n\n if (kind === \"url\") {\n // First, ahead of every cache and every request: a URL docmeta publishes is\n // one of its own built-ins, and resolving it over the network would be\n // slower, subject to the timeout, broken offline, and broken air-gapped —\n // for a file that is already in this package. Returning the bundled object\n // itself (not a copy) also keeps the two spellings sharing one Ajv\n // registration, since `Validator.compileUncached` dedupes on `$id`.\n //\n // Placed inside the url branch rather than before it deliberately: an\n // integrity pin on a non-file ref is refused above, and that stays true for\n // a published URL. The pin would have nothing to verify — no bytes are\n // fetched — and a pin that silently checked nothing reads as protection\n // that is not there. Vendor the file if you want a pinned copy.\n // The same resolution `isPublishedBuiltinUrl` uses, so a URL the trust\n // boundary treated as a built-in cannot arrive here and be fetched.\n const published = publishedBuiltinSchema(ref);\n if (published) return published;\n\n const cached = urlCache.get(ref);\n // An offline call must not be satisfied by something this process pulled\n // over the network; it goes back through `resolveRemote` so the disk cache\n // and the guard both apply, exactly as they would in a fresh process.\n if (cached && !(options.offline === true && urlFromNetwork.has(ref))) {\n return cached;\n }\n const key = inflightKey(ref, options.offline);\n const inflight = urlInflight.get(key);\n // A caller joining an in-flight fetch inherits the first caller's\n // `timeoutMs`/`maxBytes` — there is one request, so there is one set of\n // limits. Every production call site uses the defaults, so this is only\n // reachable from a library consumer passing custom options for a URL\n // another call is already fetching.\n if (inflight) return inflight;\n // Synchronous by design: the `set` has to happen in the same tick as the\n // miss, or a second caller slips in before the entry exists and fetches\n // again.\n const pending = resolveRemote(ref, options);\n urlInflight.set(key, pending);\n // Evict once settled, either way. This map exists only to collapse\n // *concurrent* callers onto one request; `urlCache` is the actual cache and\n // is consulted first, so a resolved entry left here is a duplicate handle\n // that would accumulate one per distinct URL for the life of the process.\n // Eviction is safe at this point because `fetchSchema` populates `urlCache`\n // before it resolves, so a caller arriving after the delete finds the\n // schema rather than re-fetching.\n //\n // A failed fetch is likewise not retained, so a transient failure stays\n // retryable rather than poisoning the ref. The `catch` before `finally`\n // keeps this chain off the returned promise: without it, a rejection would\n // surface here as an unhandled one, and the caller's own rejection must\n // remain theirs to handle.\n void pending\n .catch(() => {})\n .finally(() => {\n if (urlInflight.get(key) === pending) urlInflight.delete(key);\n });\n return pending;\n }\n\n // file\n //\n // `resolve` is a no-op on an already-absolute ref, which is the shape\n // `rebaseConfigSchemaRefs` produces when the config lives somewhere other\n // than the run's `cwd`. So both paths land here correctly: an absolute ref\n // passes through, and a relative one is measured from the run's directory.\n // The pin is checked against that same resolved file, so a vendored schema\n // verifies from a library caller's `cwd` as well as from the CLI's.\n // A local file ref. `resolveSchemaSet` has already refused this one if a\n // *document* named it and it pointed outside the repository (proposal 0015);\n // by here the ref is just a string and that provenance is gone.\n const file = resolvePath(options.fileBase ?? process.cwd(), ref);\n let bytes: Buffer;\n try {\n // Bytes, not a decoded string: the pin below is taken over what is actually\n // on disk, and a UTF-8 round trip would silently repair a payload that is\n // not valid UTF-8 into one that hashes differently from the vendored copy.\n bytes = await readFile(file);\n } catch {\n // A vendored schema that is missing is a different problem from a mistyped\n // path — the file is supposed to be committed, so it is either not checked\n // in or the checkout is partial. Say where it came from when the config\n // recorded that.\n //\n // Either way it names the ref as written rather than the resolved path:\n // that is the string the user put in their config, and the one every other\n // message uses for it.\n throw new DocmetaError(\n pin?.source !== undefined\n ? `Schema file not found: \"${ref}\". It was vendored from ${pin.source}; commit the file, or re-download it with \\`manni meta schemas vendor ${pin.source}\\`.`\n : `Schema file not found: \"${ref}\".`,\n );\n }\n if (pin?.integrity !== undefined) {\n assertIntegrity(ref, bytes, pin, pin.integrity);\n }\n // After `assertIntegrity`, deliberately: the pin covers the bytes on disk,\n // BOM and all. See `stripBom`.\n const text = stripBom(bytes.toString(\"utf8\"));\n try {\n return JSON.parse(text) as Record<string, unknown>;\n } catch (err) {\n throw new DocmetaError(\n `Schema file \"${ref}\" is not valid JSON: ${withoutFileExcerpt(errorMessage(err), text)}`,\n );\n }\n}\n","/**\n * Concessions that belong to **JSON as text**, and to nothing else: reading it\n * into a value, and writing a value back out.\n *\n * Its own module so each rule below has one statement rather than several, and\n * so the constraint that makes it subtle is written down once, next to the code\n * it constrains.\n */\n\n/**\n * Drop a leading byte-order mark.\n *\n * `EF BB BF` at the head of a UTF-8 file decodes to U+FEFF, and Node's\n * `JSON.parse` rejects it — while almost every other tool accepts it. Windows\n * editors write it routinely: PowerShell 5.1's `Set-Content -Encoding utf8`,\n * Notepad, older VS Code configurations. The result was a schema file that\n * every other JSON tool read happily failing as\n * `is not valid JSON: unexpected token at line 1 column 1`, which reads as an\n * empty or corrupt file and points the operator nowhere near the cause.\n *\n * **Apply this to the decoded string that is about to be parsed, never to the\n * bytes.** An integrity pin is taken over exactly what is on disk or exactly\n * what a server sent, BOM included, and `schemas vendor` writes those same\n * bytes to the vendored copy. Stripping anywhere upstream of the hash would\n * make every pinned BOM'd schema fail its own pin, and would make the vendored\n * file differ from the source it claims to be a copy of. Parsing is the only\n * step that cares.\n *\n * Only U+FEFF, and only leading: a BOM anywhere else is real content, and\n * UTF-16/UTF-32 marks are a different problem — those files are not valid UTF-8\n * at all, and reporting them as bad JSON is honest.\n */\nexport function stripBom(text: string): string {\n return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n}\n\n/**\n * The indent an object-per-line JSON file uses, read off its first indented\n * line. The known blind spot is shared by every caller on purpose: a\n * single-line or minified file yields the two-space fallback and gets\n * re-emitted pretty-printed — acceptable for files whose edits are meant to be\n * read in a diff, and better stated once here than diverging per copy.\n */\nexport function detectJsonIndent(text: string): string {\n return /^\\{\\s*\\n([ \\t]+)/.exec(text)?.[1] ?? \" \";\n}\n\n/**\n * `JSON.stringify`, with the return type it actually has.\n *\n * `lib.es5.d.ts` declares the common overload as returning `string`, and that\n * is a lie the language ships with: `undefined`, a function and a symbol each\n * stringify to `undefined`, as does any value whose `toJSON` returns one. Four\n * places in this repo already handle that with `?? fallback` — and against the\n * declared type every one of those fallbacks reads as dead code, which is\n * exactly how a live guard eventually gets tidied away.\n *\n * The fallback stays the caller's decision, because it differs: `infer` samples\n * want an empty cell, `fill`'s canonical form wants the values kept *distinct*\n * from each other. This only makes the possibility visible.\n */\nexport function toJsonText(value: unknown): string | undefined {\n return JSON.stringify(value);\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"google:okf:0.1\",\n \"title\": \"Open Knowledge Format (OKF) v0.1\",\n \"description\": \"Frontmatter schema for OKF v0.1 concept files. OKF requires only `type`; all other fields are recommended, and unknown keys are explicitly tolerated. See https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md\",\n \"type\": \"object\",\n \"required\": [\"type\"],\n \"additionalProperties\": true,\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"A short string identifying the kind of concept. Used for routing, filtering, and presentation.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Human-readable display name. If omitted, consumers MAY derive a title from the filename.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Single-sentence summary used for indexing and previews.\"\n },\n \"resource\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"A URI uniquely identifying the underlying asset. Absent for abstract concepts.\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"description\": \"Short strings for categorization.\"\n },\n \"timestamp\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"description\": \"ISO 8601 datetime of last meaningful change.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"diataxis:diataxis:1.0\",\n \"title\": \"Diataxis documentation types v1.0\",\n \"description\": \"Requires `type` and constrains it to the four Diataxis forms. Adopting Diataxis is a statement that every page is one of the four, so an untyped page is a gap rather than an abstention. Like tgdp:templates:1.0 it classifies what a page *is*, so both claim the same key: stacking them narrows `type` to the intersection of the two vocabularies, so pick one. It composes freely with a schema keyed on a different field, such as passo-uno:seven-action:1.0. See https://diataxis.fr/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"required\": [\"type\"],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\"tutorial\", \"how-to\", \"reference\", \"explanation\"],\n \"description\": \"Which of the four Diataxis forms this page is. `tutorial` is learning-oriented, `how-to` is task-oriented, `reference` is information-oriented, and `explanation` is understanding-oriented.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"passo-uno:seven-action:1.0\",\n \"title\": \"Seven-Action Documentation Model v1.0\",\n \"description\": \"Constrains `action` to the seven reader actions of the Seven-Action Documentation Model (upstream model version 2025-01-09). `action` names what the reader is doing, which is independent of what the page is, so this schema composes with a content-type schema keyed on `type`. Vocabulary only: `action` is not required. See https://passo.uno/seven-action-model/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"action\": {\n \"type\": \"string\",\n \"enum\": [\n \"appraise\",\n \"understand\",\n \"explore\",\n \"practice\",\n \"remember\",\n \"develop\",\n \"troubleshoot\"\n ],\n \"description\": \"What the reader is trying to do on this page: `appraise` (discern whether something fits), `understand` (learn a concept), `explore` (discover what exists), `practice` (train a skill), `remember` (recall a detail), `develop` (integrate it into their own work), or `troubleshoot` (solve a problem).\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"tgdp:templates:1.0\",\n \"title\": \"The Good Docs Project template types v1.0\",\n \"description\": \"Requires `type` and constrains it to the 25 template slugs published by The Good Docs Project (upstream templates repo, main as of 2026-08-09). Unlike passo-uno:seven-action:1.0, which checks a value only if one is present, this schema also demands the key: adopting it is a statement that every page is one of the templates, so an untyped page is a gap. Like Diataxis it classifies what a page *is*, so both claim the same key: stacking them is not an error, but it narrows `type` to the intersection of the two vocabularies, so pick one. It composes freely with a schema keyed on a different field, such as passo-uno:seven-action:1.0. See https://www.thegooddocsproject.dev/template\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"required\": [\"type\"],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"api-getting-started\",\n \"api-reference\",\n \"bug-report\",\n \"changelog\",\n \"code-of-conduct\",\n \"code-of-conduct-incident-record\",\n \"code-of-conduct-remediation-record\",\n \"code-of-conduct-response-plan\",\n \"concept\",\n \"contact-support\",\n \"contributing-guide\",\n \"glossary\",\n \"how-to\",\n \"installation-guide\",\n \"our-team\",\n \"quickstart\",\n \"readme\",\n \"reference\",\n \"release-notes\",\n \"sdk-overview\",\n \"style-guide\",\n \"terminology-system\",\n \"troubleshooting\",\n \"tutorial\",\n \"user-personas\"\n ],\n \"description\": \"Which Good Docs Project template this page follows, as the template's slug. The Core pack is `concept`, `how-to`, `readme`, `reference`, `release-notes`, `troubleshooting`, and `tutorial`; the rest come from the Community and Misc packs.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"docusaurus:docs:3.10\",\n \"title\": \"Docusaurus docs front matter v3.10\",\n \"description\": \"Front matter accepted by @docusaurus/plugin-content-docs as of Docusaurus 3.10. Docusaurus marks no field as required, so this is a format check, not a presence check: it constrains the shape of every field the plugin documents and requires none of them. Unknown keys are tolerated, matching Docusaurus, which allows theme and plugin front matter. It claims neither `type` nor `action`, so it composes with diataxis:diataxis:1.0, tgdp:templates:1.0, or passo-uno:seven-action:1.0. Stacking it with google:okf:0.1 is the one exception: both define `tags`, and OKF allows string tags only, so a Docusaurus tag object fails against OKF. Pair it with docusaurus:blog:3.10 and docusaurus:pages:3.10 via per-directory config overrides. See https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"Unique document id. Defaults to the file path without the extension.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Text title used for page metadata. Defaults to the Markdown title, then the id. May be empty.\"\n },\n \"pagination_label\": {\n \"type\": \"string\",\n \"description\": \"Text shown in the next/previous buttons for this document. Defaults to `sidebar_label`, then `title`.\"\n },\n \"sidebar_label\": {\n \"type\": \"string\",\n \"description\": \"Text shown for this document in the sidebar. Defaults to `title`.\"\n },\n \"sidebar_position\": {\n \"type\": \"number\",\n \"description\": \"Position of this document in an autogenerated sidebar. A number, so quoting it makes it a string and Docusaurus rejects it.\"\n },\n \"sidebar_class_name\": {\n \"type\": \"string\",\n \"description\": \"Class name applied to this document's sidebar label.\"\n },\n \"sidebar_key\": {\n \"type\": \"string\",\n \"description\": \"Stable identifier for the sidebar item, used mainly for i18n.\"\n },\n \"sidebar_custom_props\": {\n \"type\": \"object\",\n \"description\": \"Arbitrary custom properties attached to this document's sidebar item.\"\n },\n \"displayed_sidebar\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Name of the sidebar to display when viewing this document, overriding the one it belongs to.\"\n },\n \"hide_title\": {\n \"type\": \"boolean\",\n \"description\": \"Hide the front matter title at the top of the page. Does not hide a Markdown `#` title.\"\n },\n \"hide_table_of_contents\": {\n \"type\": \"boolean\",\n \"description\": \"Hide the right-hand table of contents.\"\n },\n \"toc_min_heading_level\": {\n \"type\": \"number\",\n \"minimum\": 2,\n \"maximum\": 6,\n \"description\": \"Shallowest heading level shown in the table of contents. Between 2 and 6, and no deeper than `toc_max_heading_level`. Typed `number` rather than `integer` because upstream is `Joi.number().min(2).max(6)` with no `.integer()`; being stricter here would fail a page Docusaurus builds.\"\n },\n \"toc_max_heading_level\": {\n \"type\": \"number\",\n \"minimum\": 2,\n \"maximum\": 6,\n \"description\": \"Deepest heading level shown in the table of contents. Between 2 and 6. Typed `number` rather than `integer` to match upstream, as with `toc_min_heading_level`.\"\n },\n \"pagination_next\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Id of the document the \\\"Next\\\" link points to. `null` removes the link.\"\n },\n \"pagination_prev\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Id of the document the \\\"Previous\\\" link points to. `null` removes the link.\"\n },\n \"parse_number_prefixes\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the number-prefix parser applies to this document, overriding the plugin's `numberPrefixParser` option.\"\n },\n \"custom_edit_url\": {\n \"type\": [\"string\", \"null\"],\n \"format\": \"uri-reference\",\n \"description\": \"URL of this document's edit page. `null` removes the edit link; a relative path is legal.\"\n },\n \"keywords\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"description\": \"Keywords meta tag for search engines.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Meta description for search engines. Defaults to the first line of Markdown content. May be empty.\"\n },\n \"image\": {\n \"type\": \"string\",\n \"format\": \"uri-reference\",\n \"description\": \"Cover image used in social link previews. A site-root path such as `/img/card.png` is legal.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Custom URL for this document. Defaults to the file path.\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": [\"string\", \"object\"],\n \"required\": [\"label\", \"permalink\"],\n \"additionalProperties\": true,\n \"properties\": {\n \"label\": { \"type\": \"string\" },\n \"permalink\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" }\n }\n },\n \"description\": \"Tags for this document: either a string, or an object carrying both a `label` and a `permalink`. `required` and `properties` bind only to the object form, so a plain string tag passes and a half-written object reports the key it is missing.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"A draft document is available in development only. Cannot be combined with `unlisted`.\"\n },\n \"unlisted\": {\n \"type\": \"boolean\",\n \"description\": \"An unlisted document is published but hidden from navigation, search, and sitemaps. Cannot be combined with `draft`.\"\n },\n \"last_update\": {\n \"type\": \"object\",\n \"minProperties\": 1,\n \"additionalProperties\": false,\n \"properties\": {\n \"author\": {\n \"type\": \"string\",\n \"description\": \"Overrides the last-update author.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"description\": \"Overrides the last-update date.\"\n }\n },\n \"description\": \"Overrides the computed last-update information. Takes `author`, `date`, or both, and at least one of them.\"\n }\n },\n \"if\": {\n \"required\": [\"draft\"],\n \"properties\": { \"draft\": { \"const\": true } }\n },\n \"then\": {\n \"properties\": { \"unlisted\": { \"const\": false } }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"docusaurus:blog:3.10\",\n \"title\": \"Docusaurus blog front matter v3.10\",\n \"description\": \"Front matter accepted by @docusaurus/plugin-content-blog as of Docusaurus 3.10. Docusaurus marks no field as required, so this is a format check, not a presence check. Unknown keys are tolerated, matching Docusaurus. `authors` is deliberately loose — a key, an inline author object, or a list of either — because Docusaurus resolves author entries against `authors.yml` rather than validating them strictly. The single-author `author*` keys are the deprecated spelling that `authors` replaces. It claims neither `type` nor `action`, so it composes with the taxonomy vocabularies; stacking it with google:okf:0.1 is the one exception, since both define `tags` and OKF allows string tags only. See https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog#markdown-front-matter\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"authors\": {\n \"description\": \"One author or several: a key from `authors.yml`, an inline author object, or a list mixing the two. The `$ref` types the inline-object form and `items` the list form, so each shape is checked without an anyOf that would report every alternative as a separate failure.\",\n \"type\": [\"string\", \"object\", \"array\"],\n \"$ref\": \"#/$defs/authorFields\",\n \"items\": { \"$ref\": \"#/$defs/author\" }\n },\n \"author\": {\n \"type\": \"string\",\n \"description\": \"Deprecated in favor of `authors`. The post author's name.\"\n },\n \"author_url\": {\n \"type\": \"string\",\n \"format\": \"uri-reference\",\n \"description\": \"Deprecated in favor of `authors`. URL of the author's profile page.\"\n },\n \"author_image_url\": {\n \"type\": \"string\",\n \"format\": \"uri-reference\",\n \"description\": \"Deprecated in favor of `authors`. URL of the author's thumbnail image.\"\n },\n \"author_title\": {\n \"type\": \"string\",\n \"description\": \"Deprecated in favor of `authors`. A description of the author.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Blog post title. Defaults to the Markdown title.\"\n },\n \"title_meta\": {\n \"type\": \"string\",\n \"description\": \"SEO title used for `<title>` and `og:title`. Defaults to `title`.\"\n },\n \"sidebar_label\": {\n \"type\": \"string\",\n \"description\": \"Text shown for this post in the blog sidebar. Defaults to `title`.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"description\": \"Post creation date. Defaults to a date parsed from the file name, then the file's creation time.\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": [\"string\", \"object\"],\n \"required\": [\"label\", \"permalink\"],\n \"additionalProperties\": true,\n \"properties\": {\n \"label\": { \"type\": \"string\" },\n \"permalink\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" }\n }\n },\n \"description\": \"Tags for this post: either a string, or an object carrying both a `label` and a `permalink`. `required` and `properties` bind only to the object form, so a plain string tag passes and a half-written object reports the key it is missing.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"A draft post is available in development only. Cannot be combined with `unlisted`.\"\n },\n \"unlisted\": {\n \"type\": \"boolean\",\n \"description\": \"An unlisted post is published but hidden from listings, search, and sitemaps. Cannot be combined with `draft`.\"\n },\n \"hide_table_of_contents\": {\n \"type\": \"boolean\",\n \"description\": \"Hide the right-hand table of contents.\"\n },\n \"toc_min_heading_level\": {\n \"type\": \"number\",\n \"minimum\": 2,\n \"maximum\": 6,\n \"description\": \"Shallowest heading level shown in the table of contents. Between 2 and 6, and no deeper than `toc_max_heading_level`. Typed `number` rather than `integer` because upstream is `Joi.number().min(2).max(6)` with no `.integer()`; being stricter here would fail a page Docusaurus builds.\"\n },\n \"toc_max_heading_level\": {\n \"type\": \"number\",\n \"minimum\": 2,\n \"maximum\": 6,\n \"description\": \"Deepest heading level shown in the table of contents. Between 2 and 6. Typed `number` rather than `integer` to match upstream, as with `toc_min_heading_level`.\"\n },\n \"keywords\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"description\": \"Keywords meta tag for search engines.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Meta description for search engines. Defaults to the first line of Markdown content. May be empty.\"\n },\n \"image\": {\n \"type\": \"string\",\n \"format\": \"uri-reference\",\n \"description\": \"Cover image used in social link previews. A site-root path such as `/img/card.png` is legal.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Custom URL for this post. Defaults to the file path.\"\n },\n \"last_update\": {\n \"type\": \"object\",\n \"minProperties\": 1,\n \"additionalProperties\": false,\n \"properties\": {\n \"author\": {\n \"type\": \"string\",\n \"description\": \"Overrides the last-update author.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"description\": \"Overrides the last-update date.\"\n }\n },\n \"description\": \"Overrides the computed last-update information. Takes `author`, `date`, or both, and at least one of them.\"\n }\n },\n \"if\": {\n \"required\": [\"draft\"],\n \"properties\": { \"draft\": { \"const\": true } }\n },\n \"then\": {\n \"properties\": { \"unlisted\": { \"const\": false } }\n },\n \"$defs\": {\n \"authorFields\": {\n \"description\": \"The inline author fields, defined once and shared by the single-author and list forms so the two cannot drift apart. It declares no `type`, because `properties` is ignored for non-objects — that is what lets the single-author form apply it without excluding the string and array spellings.\",\n \"properties\": {\n \"key\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"title\": { \"type\": \"string\" },\n \"url\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n \"imageURL\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n \"email\": { \"type\": \"string\" },\n \"socials\": { \"type\": \"object\" },\n \"page\": { \"type\": [\"boolean\", \"object\"] }\n }\n },\n \"author\": {\n \"description\": \"One entry in an `authors` list: a key from `authors.yml`, or an inline author object.\",\n \"type\": [\"string\", \"object\"],\n \"$ref\": \"#/$defs/authorFields\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"docusaurus:pages:3.10\",\n \"title\": \"Docusaurus pages front matter v3.10\",\n \"description\": \"Front matter accepted by @docusaurus/plugin-content-pages as of Docusaurus 3.10. Docusaurus marks no field as required, so this is a format check, not a presence check. Unknown keys are tolerated, matching Docusaurus. The field set is the smallest of the three: standalone pages carry no sidebar, pagination, or tag metadata. See https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-pages#markdown-front-matter\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Page title. Defaults to the Markdown title. May be empty.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Meta description for search engines. Defaults to the first line of Markdown content. May be empty.\"\n },\n \"keywords\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"description\": \"Keywords meta tag for search engines.\"\n },\n \"image\": {\n \"type\": \"string\",\n \"format\": \"uri-reference\",\n \"description\": \"Cover image used in social link previews. A site-root path such as `/img/card.png` is legal.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Custom URL for this page. Defaults to the file path; `/` makes it the site root.\"\n },\n \"wrapperClassName\": {\n \"type\": \"string\",\n \"description\": \"Class name added to the page wrapper, for targeting this page in CSS.\"\n },\n \"hide_table_of_contents\": {\n \"type\": \"boolean\",\n \"description\": \"Hide the right-hand table of contents.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"A draft page is available in development only. Cannot be combined with `unlisted`.\"\n },\n \"unlisted\": {\n \"type\": \"boolean\",\n \"description\": \"An unlisted page is published but hidden from search and sitemaps. Cannot be combined with `draft`.\"\n }\n },\n \"if\": {\n \"required\": [\"draft\"],\n \"properties\": { \"draft\": { \"const\": true } }\n },\n \"then\": {\n \"properties\": { \"unlisted\": { \"const\": false } }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"astro:starlight:0.41\",\n \"title\": \"Astro Starlight front matter v0.41\",\n \"description\": \"Front matter accepted by Astro Starlight as of 0.41. Unlike the Docusaurus built-ins, this one requires `title`: Starlight refuses to build a page without it, so its absence is an error rather than a default. Every other field is optional and checked only when present. Unknown keys are tolerated, matching Starlight's own schema extension mechanism. See https://starlight.astro.build/reference/frontmatter/\",\n \"type\": \"object\",\n \"required\": [\"title\"],\n \"additionalProperties\": true,\n \"$defs\": {\n \"linkRef\": {\n \"description\": \"A pagination link: `false` to hide it, `true` for the default, a string to relabel it, or an object to set both target and text. Branched with `if`/`then` rather than `anyOf` so a fault inside the object form is reported once, against the key that is wrong.\",\n \"if\": { \"type\": \"object\" },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"link\": { \"type\": \"string\" },\n \"label\": { \"type\": \"string\" }\n }\n },\n \"else\": { \"type\": [\"boolean\", \"string\"] }\n },\n \"headingLevel\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 6\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Shown at the top of the page, in the browser tab, and in page metadata. The only field Starlight requires.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Used for page metadata and search engine optimization.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Overrides the URL slug derived from the file path.\"\n },\n \"editUrl\": {\n \"type\": [\"string\", \"boolean\"],\n \"format\": \"uri-reference\",\n \"description\": \"Customizes the edit-page link, or disables it with `false`. The format constrains the string branch only.\"\n },\n \"head\": {\n \"type\": \"array\",\n \"description\": \"Additional tags injected into this page's `<head>`.\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"tag\"],\n \"properties\": {\n \"tag\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The tag name, such as `meta` or `script`.\"\n },\n \"attrs\": {\n \"type\": \"object\",\n \"description\": \"Attributes set on the tag.\"\n },\n \"content\": {\n \"type\": \"string\",\n \"description\": \"Text content placed inside the tag.\"\n }\n }\n }\n },\n \"tableOfContents\": {\n \"description\": \"Controls which headings the on-page table of contents lists, or `false` to hide it entirely. Written as `if`/`then` rather than `anyOf` so that a bad heading level is reported against `/tableOfContents/maxHeadingLevel` — an `anyOf` collapses every branch failure onto the parent, which is the wrong caret.\",\n \"if\": { \"type\": \"object\" },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"minHeadingLevel\": { \"$ref\": \"#/$defs/headingLevel\" },\n \"maxHeadingLevel\": { \"$ref\": \"#/$defs/headingLevel\" }\n }\n },\n \"else\": { \"type\": \"boolean\", \"const\": false }\n },\n \"template\": {\n \"type\": \"string\",\n \"enum\": [\"doc\", \"splash\"],\n \"description\": \"Layout template. `doc` is the default; `splash` is the wider landing-page layout that pairs with `hero`.\"\n },\n \"hero\": {\n \"type\": \"object\",\n \"description\": \"Hero block shown at the top of the page, normally with `template: splash`.\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"tagline\": { \"type\": \"string\" },\n \"image\": {\n \"type\": \"object\",\n \"description\": \"One image, a light/dark pair, or raw HTML.\"\n },\n \"actions\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"text\", \"link\"],\n \"properties\": {\n \"text\": { \"type\": \"string\" },\n \"link\": { \"type\": \"string\" },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\"primary\", \"secondary\", \"minimal\"]\n },\n \"icon\": { \"type\": \"string\" },\n \"attrs\": { \"type\": \"object\" }\n }\n }\n }\n }\n },\n \"banner\": {\n \"type\": \"object\",\n \"required\": [\"content\"],\n \"description\": \"Announcement banner shown at the top of the page.\",\n \"properties\": {\n \"content\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Banner text. Inline HTML is allowed.\"\n }\n }\n },\n \"lastUpdated\": {\n \"type\": [\"string\", \"boolean\"],\n \"pattern\": \"^[0-9]{4}-[0-9]{2}-[0-9]{2}\",\n \"description\": \"A YAML date overriding the git-derived last-updated stamp, or a boolean turning the stamp on or off for this page. The pattern constrains the string branch only, and accepts a plain date or a full timestamp.\"\n },\n \"prev\": { \"$ref\": \"#/$defs/linkRef\" },\n \"next\": { \"$ref\": \"#/$defs/linkRef\" },\n \"pagefind\": {\n \"type\": \"boolean\",\n \"description\": \"Whether this page is included in the site search index. Defaults to true.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"A draft page is excluded from production builds. Defaults to false.\"\n },\n \"sidebar\": {\n \"type\": \"object\",\n \"description\": \"How this page appears in an autogenerated sidebar group.\",\n \"properties\": {\n \"label\": {\n \"type\": \"string\",\n \"description\": \"Sidebar link text. Defaults to the page title.\"\n },\n \"order\": {\n \"type\": \"number\",\n \"description\": \"Sort weight within the group; lower sorts higher.\"\n },\n \"hidden\": {\n \"type\": \"boolean\",\n \"description\": \"Omit this page from the autogenerated group. Defaults to false.\"\n },\n \"badge\": {\n \"description\": \"A badge beside the sidebar link: a string, or an object naming its variant.\",\n \"if\": { \"type\": \"object\" },\n \"then\": {\n \"required\": [\"text\"],\n \"properties\": {\n \"text\": { \"type\": \"string\" },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\"note\", \"tip\", \"caution\", \"danger\", \"success\", \"default\"]\n }\n }\n },\n \"else\": { \"type\": \"string\" }\n },\n \"attrs\": {\n \"type\": \"object\",\n \"description\": \"HTML attributes set on the sidebar link.\"\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"antora:page:3.1\",\n \"title\": \"Antora page header attributes v3.1\",\n \"description\": \"The AsciiDoc document header attributes Antora 3.1 reads from a page, plus the two AsciiDoc built-ins (`description`, `keywords`) it carries into page metadata. `title` is required because the page title is the only mandatory header element in Antora. Values are the *typed* results of AsciiDoc attribute entries: a bare `:page-partial:` is `true`, an unset `:!page-partial:` is `false`, and `:page-toclevels: 3` is the number 3. Custom `page-*` attributes are yours to define and are tolerated. See https://docs.antora.org/antora/latest/page/page-attributes/\",\n \"type\": \"object\",\n \"required\": [\"title\"],\n \"additionalProperties\": true,\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The page title, written as the `= Title` line. The only required header element.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"AsciiDoc built-in. Stored in an HTML meta tag on the published page.\"\n },\n \"keywords\": {\n \"type\": \"string\",\n \"description\": \"AsciiDoc built-in. A comma-separated list *as a single string* — AsciiDoc attribute values are text, so this is never a YAML array.\"\n },\n \"navtitle\": {\n \"type\": \"string\",\n \"description\": \"Link text used when the navigation references this page. Defaults to the page reftext.\"\n },\n \"page-aliases\": {\n \"type\": \"string\",\n \"description\": \"Comma-separated alternate resource IDs that should redirect to this page.\"\n },\n \"page-layout\": {\n \"type\": \"string\",\n \"description\": \"Which UI template renders this page. Defaults to the `default` layout.\"\n },\n \"page-partial\": {\n \"type\": \"boolean\",\n \"description\": \"Marks the page as a partial, kept unconverted for inclusion elsewhere. Set with a bare `:page-partial:` and cleared with `:!page-partial:`.\"\n },\n \"page-role\": {\n \"type\": \"string\",\n \"description\": \"Space-separated classes added to the page body. The default UI reserves `-toc`, which hides the table-of-contents sidebar.\"\n },\n \"page-toclevels\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 5,\n \"description\": \"How many heading levels the sidebar table of contents shows. The default UI shows 2.\"\n },\n \"page-tags\": {\n \"type\": \"string\",\n \"description\": \"Comma-separated tags as a single string, following the same attribute-entry typing as `keywords`.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"sphinx:docinfo:9.1\",\n \"title\": \"Sphinx file-wide metadata v9.1\",\n \"description\": \"The file-wide metadata fields Sphinx reads from a document's leading field list (docinfo), as of Sphinx 9.1. Sphinx requires none of them. The set is deliberately small because docinfo values are always parsed as strings by Sphinx itself — a field list cannot carry a list or a mapping — so anything richer belongs in front matter, not here. Flag fields are written bare (`:orphan:`), which reaches the validator as `true`. See https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"tocdepth\": {\n \"type\": \"integer\",\n \"description\": \"Maximum depth of the table of contents for this file. Affects the local toctree only, not the global sidebar.\"\n },\n \"orphan\": {\n \"type\": \"boolean\",\n \"description\": \"Suppresses the warning raised when this file is in no toctree. Written bare as `:orphan:`.\"\n },\n \"nocomments\": {\n \"type\": \"boolean\",\n \"description\": \"Suppresses the comment form on the generated page. Written bare as `:nocomments:`.\"\n },\n \"no-search\": {\n \"type\": \"boolean\",\n \"description\": \"Excludes this document from full-text search. Object search still applies. Written bare as `:no-search:`.\"\n },\n \"nosearch\": {\n \"type\": \"boolean\",\n \"deprecated\": true,\n \"description\": \"The pre-7.3 spelling of `no-search`. Sphinx renamed it in 7.3 and still accepts this form, so it is annotated rather than rejected — a schema that failed the build on a spelling the tool accepts would assert something untrue about the tool. Prefer `no-search`.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"myst:frontmatter:1.10\",\n \"title\": \"MyST page frontmatter v1.10\",\n \"description\": \"The page-level MyST frontmatter fields, as of mystmd 1.10. MyST requires nothing: a page with no `title` takes one from its first heading. What this schema does carry is MyST's documented length caps — 500 characters on `title`, `subtitle`, `description` and `label`, 40 on `short_title` and `subject` — which are the constraints a long title silently violates. Project-level keys that belong in `myst.yml` (`bibliography`, `references`, `requirements`, `social`) are not described here; they are tolerated like any unknown key. Controlled vocabularies MyST defines but this schema does not reproduce — the 14 CRediT contributor roles above all — are checked for shape only, never against a transcribed list. See https://mystmd.org/guide/frontmatter\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"person\": {\n \"description\": \"An author, editor or reviewer: an object, or a string referencing one declared elsewhere by id.\",\n \"if\": { \"type\": \"object\" },\n \"then\": {\n \"properties\": {\n \"name\": {\n \"type\": [\"string\", \"object\"],\n \"description\": \"Full name, or a CSL-JSON object of parsed name parts.\"\n },\n \"id\": { \"type\": \"string\" },\n \"orcid\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\", \"format\": \"email\" },\n \"corresponding\": {\n \"type\": \"boolean\",\n \"description\": \"Marks the corresponding author. MyST requires an `email` alongside it.\"\n },\n \"roles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"description\": \"CRediT contributor roles. Checked as strings only — the 14-term vocabulary and its aliases are not transcribed here, so a guessed enum cannot reject a valid role.\"\n },\n \"affiliations\": {\n \"type\": [\"string\", \"array\"],\n \"items\": { \"type\": [\"string\", \"object\"] }\n },\n \"equal_contributor\": { \"type\": \"boolean\" },\n \"deceased\": { \"type\": \"boolean\" },\n \"note\": { \"type\": \"string\" },\n \"url\": { \"type\": \"string\" }\n }\n },\n \"else\": { \"type\": \"string\" }\n },\n \"people\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"$ref\": \"#/$defs/person\" } },\n \"else\": { \"$ref\": \"#/$defs/person\" }\n },\n \"stringList\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"string\" } },\n \"else\": { \"type\": \"string\" }\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"maxLength\": 500,\n \"description\": \"Page title. When absent, MyST lifts it from the first heading and removes that heading from the content.\"\n },\n \"subtitle\": {\n \"type\": \"string\",\n \"maxLength\": 500,\n \"description\": \"Complementary title text shown beneath the title.\"\n },\n \"short_title\": {\n \"type\": \"string\",\n \"maxLength\": 40,\n \"description\": \"Abbreviated title for running headers and navigation. Capped at 40 characters.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"maxLength\": 500,\n \"description\": \"Summary of the page, used for previews and indexing.\"\n },\n \"label\": {\n \"type\": \"string\",\n \"maxLength\": 500,\n \"description\": \"Identifier this page can be cross-referenced by.\"\n },\n \"subject\": {\n \"type\": \"string\",\n \"maxLength\": 40,\n \"description\": \"Short subject categorization. Capped at 40 characters.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"description\": \"Publication date. MyST accepts ISO 8601 (`2026-08-23`) and RFC 2822 variants (`23 Aug 2026`), so this is not constrained to one format.\"\n },\n \"keywords\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Key concepts described by the page.\"\n },\n \"tags\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Categorization tags.\"\n },\n \"authors\": { \"$ref\": \"#/$defs/people\" },\n \"editors\": { \"$ref\": \"#/$defs/people\" },\n \"reviewers\": { \"$ref\": \"#/$defs/people\" },\n \"affiliations\": {\n \"type\": [\"object\", \"array\"],\n \"items\": { \"type\": [\"string\", \"object\"] },\n \"description\": \"Institutions referenced by `authors`, declared inline or by id.\"\n },\n \"license\": {\n \"type\": [\"string\", \"object\"],\n \"description\": \"An SPDX identifier such as `CC-BY-4.0`, or an object describing content and code licenses separately.\"\n },\n \"copyright\": { \"type\": \"string\" },\n \"open_access\": { \"type\": \"boolean\" },\n \"doi\": { \"type\": \"string\", \"description\": \"A DOI, bare or as a URL.\" },\n \"arxiv\": { \"type\": \"string\" },\n \"pmid\": { \"type\": \"integer\" },\n \"pmcid\": {\n \"type\": \"string\",\n \"pattern\": \"^PMC[0-9]+$\",\n \"description\": \"A PubMed Central id: the literal `PMC` followed by digits.\"\n },\n \"github\": {\n \"type\": \"string\",\n \"description\": \"A repository URL, or `owner/name`.\"\n },\n \"edit_url\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n \"source_url\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n \"binder\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n \"thumbnail\": { \"type\": \"string\" },\n \"banner\": { \"type\": \"string\" },\n \"first_page\": { \"type\": [\"string\", \"number\"] },\n \"last_page\": { \"type\": [\"string\", \"number\"] },\n \"venue\": { \"type\": [\"string\", \"object\"] },\n \"volume\": { \"type\": [\"string\", \"number\", \"object\"] },\n \"issue\": { \"type\": [\"string\", \"number\", \"object\"] },\n \"funding\": { \"type\": [\"object\", \"array\"] },\n \"kernelspec\": {\n \"type\": \"object\",\n \"description\": \"Jupyter kernel this page executes against.\"\n },\n \"execute\": { \"type\": \"object\" },\n \"math\": {\n \"type\": \"object\",\n \"description\": \"Macro dictionary applied to math on this page.\"\n },\n \"abbreviations\": { \"type\": \"object\" },\n \"numbering\": { \"type\": \"object\" },\n \"parts\": {\n \"type\": \"object\",\n \"description\": \"Named parts such as `abstract` or `data_availability`.\"\n },\n \"exports\": { \"type\": [\"object\", \"array\"] },\n \"downloads\": { \"type\": [\"object\", \"array\"] },\n \"options\": { \"type\": \"object\" }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"ogp:article:1.0\",\n \"title\": \"Open Graph protocol, article profile\",\n \"description\": \"The Open Graph protocol's basic metadata plus the `article` object type. Unusually among the built-ins, this one enforces genuine requirements: the protocol names `og:title`, `og:type`, `og:url` and `og:image` as required for every page, and a page missing one has no valid Open Graph object at all. It is also the built-in that checks something no build tool checks — nothing fails when `og:image` is absent, the page just renders badly everywhere it is shared. In HTML these live on `<meta property=\\\"…\\\">`, which docmeta reads alongside `name=`; in front matter they are ordinary quoted keys. See https://ogp.me/\",\n \"type\": \"object\",\n \"required\": [\"og:title\", \"og:type\", \"og:url\", \"og:image\"],\n \"additionalProperties\": true,\n \"$defs\": {\n \"url\": { \"type\": \"string\", \"format\": \"uri\" },\n \"urlList\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"$ref\": \"#/$defs/url\" } },\n \"else\": { \"$ref\": \"#/$defs/url\" }\n },\n \"textList\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"string\" } },\n \"else\": { \"type\": \"string\" }\n },\n \"timestamp\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"description\": \"An ISO 8601 datetime.\"\n }\n },\n \"properties\": {\n \"og:title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The object's title, as it should appear in the graph. Required.\"\n },\n \"og:type\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The object type, such as `article` or `website`. Required. Not enumerated: the protocol allows namespaced and vendor types beyond the published list.\"\n },\n \"og:url\": {\n \"$ref\": \"#/$defs/url\",\n \"description\": \"The canonical URL, used as the object's permanent id. Required, and absolute — a site-root path is not a canonical URL.\"\n },\n \"og:image\": {\n \"$ref\": \"#/$defs/urlList\",\n \"description\": \"URL of the image representing the object. Required.\"\n },\n \"og:description\": {\n \"type\": \"string\",\n \"description\": \"A one- or two-sentence description of the object.\"\n },\n \"og:site_name\": {\n \"type\": \"string\",\n \"description\": \"The name of the overall site this object belongs to.\"\n },\n \"og:determiner\": {\n \"type\": \"string\",\n \"enum\": [\"a\", \"an\", \"the\", \"\", \"auto\"],\n \"description\": \"The word preceding the title in a sentence. The protocol lists exactly these five, the empty string among them.\"\n },\n \"og:locale\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z]{2,3}(_[A-Z]{2})?$\",\n \"description\": \"Locale in `language_TERRITORY` form, such as `en_US`. Defaults to `en_US`. The hyphenated BCP 47 spelling `en-US` is not what the protocol specifies and is rejected here.\"\n },\n \"og:locale:alternate\": {\n \"if\": { \"type\": \"array\" },\n \"then\": {\n \"items\": { \"type\": \"string\", \"pattern\": \"^[a-z]{2,3}(_[A-Z]{2})?$\" }\n },\n \"else\": { \"type\": \"string\", \"pattern\": \"^[a-z]{2,3}(_[A-Z]{2})?$\" },\n \"description\": \"Other locales this page is available in.\"\n },\n \"og:audio\": {\n \"$ref\": \"#/$defs/urlList\",\n \"description\": \"URL of audio accompanying the object.\"\n },\n \"og:video\": {\n \"$ref\": \"#/$defs/urlList\",\n \"description\": \"URL of video accompanying the object.\"\n },\n \"article:published_time\": {\n \"$ref\": \"#/$defs/timestamp\",\n \"description\": \"When the article was first published.\"\n },\n \"article:modified_time\": {\n \"$ref\": \"#/$defs/timestamp\",\n \"description\": \"When the article was last changed.\"\n },\n \"article:expiration_time\": {\n \"$ref\": \"#/$defs/timestamp\",\n \"description\": \"When the article stops being current.\"\n },\n \"article:author\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Author profile URLs, or names. Repeated `<meta>` tags collapse to the last one on extraction, so a single string is the usual shape.\"\n },\n \"article:section\": {\n \"type\": \"string\",\n \"description\": \"The high-level section the article belongs to.\"\n },\n \"article:tag\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Tags describing the article.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"dcmi:elements:1.1\",\n \"title\": \"Dublin Core Metadata Element Set v1.1\",\n \"description\": \"The fifteen elements of the Dublin Core Metadata Element Set, as published in the DCMI Recommendation of 2020-01-20. DCMI marks no element mandatory, so this requires nothing and checks shape only. Every element is repeatable in Dublin Core, so each accepts a single value or a list of them. `type` is deliberately *not* enumerated: DCMI recommends a controlled vocabulary such as the DCMI Type Vocabulary rather than mandating one, and enumerating it here would reject conforming documents that use a different vocabulary. Element names are the unprefixed terms the Recommendation defines; documents using the DCMI-HTML `DC.title` spelling in `<meta name>` need a schema of their own. See https://www.dublincore.org/specifications/dublin-core/dcmi-terms/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"text\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"string\" } },\n \"else\": { \"type\": \"string\" }\n },\n \"w3cdtf\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\\\.[0-9]+)?)?(Z|[+-][0-9]{2}:[0-9]{2}))?)?)?$\"\n }\n },\n \"properties\": {\n \"title\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"A name given to the resource.\"\n },\n \"creator\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"An entity primarily responsible for making the resource.\"\n },\n \"contributor\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"An entity responsible for making contributions to the resource.\"\n },\n \"publisher\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"An entity responsible for making the resource available.\"\n },\n \"subject\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"The topic of the resource.\"\n },\n \"description\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"An account of the resource.\"\n },\n \"date\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"$ref\": \"#/$defs/w3cdtf\" } },\n \"else\": { \"$ref\": \"#/$defs/w3cdtf\" },\n \"description\": \"A point or period of time associated with an event in the lifecycle of the resource. Encoded as W3CDTF, which permits reduced precision — `2026`, `2026-08` and `2026-08-23` are all legal, and a full datetime carries a timezone.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"The nature or genre of the resource. Recommended best practice is a controlled vocabulary such as the DCMI Type Vocabulary (Collection, Dataset, Event, Image, InteractiveResource, MovingImage, PhysicalObject, Service, Software, Sound, StillImage, Text), but DCMI does not require one, so no enum is imposed.\"\n },\n \"format\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"The file format, physical medium, or dimensions of the resource. Recommended best practice is a MIME type.\"\n },\n \"identifier\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"An unambiguous reference to the resource within a given context.\"\n },\n \"source\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"A related resource from which the described resource is derived.\"\n },\n \"language\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"A language of the resource. Recommended best practice is an IETF BCP 47 tag.\"\n },\n \"relation\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"A related resource.\"\n },\n \"coverage\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"The spatial or temporal topic of the resource, its spatial applicability, or the jurisdiction under which it is relevant.\"\n },\n \"rights\": {\n \"$ref\": \"#/$defs/text\",\n \"description\": \"Information about rights held in and over the resource.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"microsoft:learn:1.0\",\n \"title\": \"Microsoft Learn article metadata\",\n \"description\": \"The YAML front matter Microsoft Learn requires and recommends on a documentation article. Five attributes are required — omitting any of them fails the Learn build — and two of them carry format rules that catch mistakes no generic date or length check would: `ms.date` is `MM/DD/YYYY`, not ISO 8601, and `description` has a documented 75-300 character range. `ms.topic` is a string rather than an enum on purpose: the authoritative list is an internal Microsoft taxonomy, the published docfx-era set and the values Azure repositories actually use disagree, and an invented enum would fail correct articles. Attribute names are case-sensitive. See https://learn.microsoft.com/en-us/contribute/content/metadata\",\n \"type\": \"object\",\n \"required\": [\"title\", \"description\", \"author\", \"ms.author\", \"ms.date\"],\n \"additionalProperties\": true,\n \"$defs\": {\n \"textList\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"string\" } },\n \"else\": { \"type\": \"string\" }\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The page title shown on the browser tab. Required, and the single most important attribute for search.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"minLength\": 75,\n \"maxLength\": 300,\n \"description\": \"A summary of the article, used in site search. Required. Microsoft documents the hard range as 75-300 characters and recommends 115-145; only the hard range is enforced here.\"\n },\n \"author\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The author's GitHub account ID — not a display name. Required.\"\n },\n \"ms.author\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"^[^@\\\\s]+$\",\n \"description\": \"The owner's Microsoft alias, without `@microsoft.com`. Required. The pattern rejects a full email address, which is the usual way this one is written wrong.\"\n },\n \"ms.date\": {\n \"type\": \"string\",\n \"pattern\": \"^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/[0-9]{4}$\",\n \"description\": \"The date of the last substantial edit, in `MM/DD/YYYY`. Required. Note that this is *not* ISO 8601: `2026-08-23` is rejected, `08/23/2026` is correct.\"\n },\n \"ms.topic\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The kind of article, such as `how-to`, `conceptual`, `quickstart`, `tutorial` or `overview`. Not enumerated — see this schema's description for why.\"\n },\n \"ms.service\": {\n \"type\": \"string\",\n \"description\": \"The service the article documents.\"\n },\n \"ms.subservice\": {\n \"type\": \"string\",\n \"description\": \"A component within `ms.service`.\"\n },\n \"ms.custom\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Free-form tags used for reporting and campaign tracking.\"\n },\n \"ms.collection\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Collections this article belongs to.\"\n },\n \"ms.reviewer\": {\n \"type\": \"string\",\n \"description\": \"Microsoft alias of the technical reviewer.\"\n },\n \"ms.devlang\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Programming languages the article covers.\"\n },\n \"ms.prod\": {\n \"type\": \"string\",\n \"description\": \"The product, for repositories that use `ms.prod` instead of `ms.service`.\"\n },\n \"ms.technology\": {\n \"type\": \"string\",\n \"description\": \"A technology within `ms.prod`.\"\n },\n \"keywords\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Search keywords for the article.\"\n },\n \"zone_pivot_groups\": {\n \"type\": \"string\",\n \"description\": \"The pivot group enabling tabbed variants of the article.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"oasis:dita-metadata:1.3\",\n \"title\": \"DITA 1.3 document metadata\",\n \"description\": \"The typed metadata elements OASIS defines for a DITA topic or map, as docmeta reads them. Named `dita-metadata` rather than `dita-prolog` because it constrains `topicmeta.*` too, and a name saying prolog would be wrong for every map. Keys follow docmeta's element rule — the containing element is the namespace — so a topic's `<prolog><metadata><audience>` is `metadata.audience` while a map's `<topicmeta><audience>` is `topicmeta.audience`. That is not a quirk: the OASIS content model makes them peers under `<topicmeta>` and nests them under `<prolog>` in a topic, and each key names where the value actually is. Cardinality is taken from the content model, so `author*` is a list and `source?` is a scalar. Requires nothing: DITA marks no metadata element mandatory. The `<othermeta name= content=>` channel keeps its flat keys and is not described here — a document may carry both, and both are validated. See https://docs.oasis-open.org/dita/dita/v1.3/os/part1-base/langRef/containers/prolog-elements.html\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"textList\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"scalarList\": {\n \"type\": \"array\",\n \"items\": { \"type\": [\"string\", \"number\"] },\n \"description\": \"Attribute values are parsed as YAML scalars, as they are in every format docmeta reads, so `year=\\\"2026\\\"` arrives as the number 2026 while `version=\\\"2.1.0\\\"` stays a string. Both are accepted rather than the reader special-casing these attributes, which would be a surprise nothing else in the tool prepares you for.\"\n },\n \"ditaDate\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}-[0-9]{2}-[0-9]{2}$\",\n \"description\": \"A `YYYY-MM-DD` date. DITA types these attributes as CDATA, so the DTD itself imposes no format — this is the convention DITA-OT and every toolchain around it assume, checked here because a date nothing validates is a date that drifts.\"\n }\n },\n \"properties\": {\n \"prolog.author\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Topic authors, from `<prolog><author>`. A list: the content model is `author*`.\"\n },\n \"prolog.source\": {\n \"type\": \"string\",\n \"description\": \"The resource this topic derives from, from `<prolog><source>`. Scalar: `source?`.\"\n },\n \"prolog.publisher\": {\n \"type\": \"string\",\n \"description\": \"Who makes the topic available, from `<prolog><publisher>`. Scalar: `publisher?`.\"\n },\n \"prolog.permissions\": {\n \"type\": \"string\",\n \"description\": \"Entitlement required to view the topic, from `<permissions @entitlement>`. Not enumerated — DITA suggests values without fixing them.\"\n },\n \"prolog.resourceid\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Application-specific identifiers, from `<resourceid @id>`. A list: `resourceid*`.\"\n },\n \"topicmeta.author\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Map authors, from `<topicmeta><author>`. The map spelling of `prolog.author`.\"\n },\n \"topicmeta.source\": {\n \"type\": \"string\",\n \"description\": \"The map spelling of `prolog.source`.\"\n },\n \"topicmeta.publisher\": {\n \"type\": \"string\",\n \"description\": \"The map spelling of `prolog.publisher`.\"\n },\n \"topicmeta.permissions\": {\n \"type\": \"string\",\n \"description\": \"The map spelling of `prolog.permissions`.\"\n },\n \"topicmeta.resourceid\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"The map spelling of `prolog.resourceid`.\"\n },\n \"topicmeta.audience\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Intended audiences, from `<topicmeta><audience @type>`. A map holds these directly; a topic nests them, where they are `metadata.audience`.\"\n },\n \"topicmeta.category\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Categories, from `<topicmeta><category>`. The map spelling of `metadata.category`.\"\n },\n \"critdates.created\": {\n \"$ref\": \"#/$defs/ditaDate\",\n \"description\": \"Creation date, from `<critdates><created @date>`. Scalar: `created?`. Identical in topics and maps, because the containing element is the same in both.\"\n },\n \"critdates.revised\": {\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/$defs/ditaDate\" },\n \"description\": \"Revision dates, from `<critdates><revised @modified>`. A list: `revised*`.\"\n },\n \"metadata.audience\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Intended audiences in a topic, from `<prolog><metadata><audience @type>`. A list: `audience*`. Not enumerated — the values are a project's own vocabulary.\"\n },\n \"metadata.category\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Categories in a topic, from `<prolog><metadata><category>`. A list: `category*`.\"\n },\n \"prodinfo.prodname\": {\n \"type\": \"string\",\n \"description\": \"Product name, from `<prodinfo><prodname>`. Scalar: `prodname?`.\"\n },\n \"prodinfo.brand\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Manufacturer or brand, from `<prodinfo><brand>`.\"\n },\n \"prodinfo.component\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Product component, from `<prodinfo><component>`.\"\n },\n \"prodinfo.featnum\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Feature number, from `<prodinfo><featnum>`.\"\n },\n \"prodinfo.platform\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Operating system or hardware, from `<prodinfo><platform>`.\"\n },\n \"prodinfo.prognum\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Program or order number, from `<prodinfo><prognum>`.\"\n },\n \"prodinfo.series\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Product series, from `<prodinfo><series>`. These six are a repeatable *choice* group in the content model, so they may interleave in any order.\"\n },\n \"vrm.version\": {\n \"$ref\": \"#/$defs/scalarList\",\n \"description\": \"Product version, from `<vrmlist><vrm @version>`. Keyed for the element rather than its container because `<vrm>` is EMPTY and carries three separate facts — keying it `vrmlist.vrm` would have to pick one and discard two. For an attribute the containing thing is the element, so the naming rule applies one level down rather than changing.\"\n },\n \"vrm.release\": {\n \"$ref\": \"#/$defs/scalarList\",\n \"description\": \"Product release, from `<vrmlist><vrm @release>`. A `<vrm>` carrying no `@release` contributes nothing here, and is dropped from the element list with it, so a write still lands on the element its value came from.\"\n },\n \"vrm.modification\": {\n \"$ref\": \"#/$defs/scalarList\",\n \"description\": \"Modification level, from `<vrmlist><vrm @modification>`.\"\n },\n \"copyright.copyryear\": {\n \"$ref\": \"#/$defs/scalarList\",\n \"description\": \"Copyright years, from `<copyright><copyryear @year>`. A list: the content model is `copyryear+`.\"\n },\n \"copyright.copyrholder\": {\n \"type\": \"string\",\n \"description\": \"Copyright holder, from `<copyright><copyrholder>`.\"\n },\n \"keywords.keyword\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Search keywords, from `<keywords><keyword>`. Reached through the children rather than the container: `<keywords>` holds `(indexterm | keyword)*` and has no text of its own.\"\n },\n \"keywords.indexterm\": {\n \"$ref\": \"#/$defs/textList\",\n \"description\": \"Index terms, from `<keywords><indexterm>`. A *nested* `<indexterm>` makes its parent a container rather than a value, so only flat terms are lifted.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"hugo:page:0.165\",\n \"title\": \"Hugo front matter v0.165\",\n \"description\": \"The front matter fields Hugo itself defines, as of 0.165. Hugo requires nothing — a page with no front matter at all builds — so this schema can only ever fail a page on the shape of a value it already carries. That is most of the value: `weight` must be an integer and `draft` a boolean, and the usual way a Hugo page goes quietly wrong is a quoted number or a `draft: \\\"false\\\"` that is true. Custom keys and taxonomy terms such as `tags` and `categories` are user-configured rather than defined by Hugo, so they are tolerated rather than described here. Dates are plain strings on purpose: Hugo parses several layouts, including bare years and Unix timestamps, so a `format` here would reject input Hugo accepts. Hugo's default fence is TOML, whose native dates docmeta normalizes to the string they were written as. See https://gohugo.io/content-management/front-matter/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"date\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"A date string. Hugo accepts several layouts, so only the type is checked.\"\n },\n \"stringList\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"listFlag\": {\n \"description\": \"How the page is listed: a boolean, or one of the three names `build.list` accepts. Kept separate from `renderFlag` because the two options do not share a vocabulary — `local` is meaningful only here, and merging the sets would accept `link` on the wrong one.\",\n \"if\": { \"type\": \"string\" },\n \"then\": { \"enum\": [\"always\", \"never\", \"local\"] },\n \"else\": { \"type\": \"boolean\" }\n },\n \"renderFlag\": {\n \"description\": \"How the page is rendered: a boolean, or one of the three names `build.render` accepts. `link` is meaningful only here — see `listFlag`.\",\n \"if\": { \"type\": \"string\" },\n \"then\": { \"enum\": [\"always\", \"never\", \"link\"] },\n \"else\": { \"type\": \"boolean\" }\n }\n },\n \"properties\": {\n \"aliases\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Page-relative or site-relative paths that redirect to this page.\"\n },\n \"build\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Per-page build options.\",\n \"properties\": {\n \"list\": { \"$ref\": \"#/$defs/listFlag\" },\n \"render\": { \"$ref\": \"#/$defs/renderFlag\" },\n \"publishResources\": { \"type\": \"boolean\" }\n }\n },\n \"cascade\": {\n \"description\": \"Values passed down to descendant pages unless overwritten. A map, or an array of maps each carrying a `_target` filter.\",\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"object\" } },\n \"else\": { \"type\": \"object\" }\n },\n \"date\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"The date associated with the page, typically its creation date.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Rendered into a meta element for search engines.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"A draft is not rendered unless `--buildDrafts` is passed. A quoted `\\\"false\\\"` is a string, and every string is truthy — this is the check that catches it.\"\n },\n \"expiryDate\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"After this date the page is no longer rendered.\"\n },\n \"headless\": {\n \"type\": \"boolean\",\n \"description\": \"Makes a leaf bundle headless: its resources stay available but it publishes no page.\"\n },\n \"isCJKLanguage\": {\n \"type\": \"boolean\",\n \"description\": \"Counts words the CJK way, which changes summaries and reading time.\"\n },\n \"keywords\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Keywords, typically rendered into a meta element.\"\n },\n \"lastmod\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"The date the page was last modified.\"\n },\n \"layout\": {\n \"type\": \"string\",\n \"description\": \"A template name overriding the default lookup order.\"\n },\n \"linkTitle\": {\n \"type\": \"string\",\n \"description\": \"A shorter title for lists and navigation.\"\n },\n \"markup\": {\n \"type\": \"string\",\n \"description\": \"The content format identifier, such as `md` or `html`.\"\n },\n \"menus\": {\n \"description\": \"Menus this page joins: one name, several names, or a map giving each entry its own options.\",\n \"if\": { \"type\": \"object\" },\n \"then\": { \"type\": \"object\" },\n \"else\": {\n \"if\": { \"type\": \"array\" },\n \"then\": { \"$ref\": \"#/$defs/stringList\" },\n \"else\": { \"type\": \"string\" }\n }\n },\n \"outputs\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Output formats to render this page in, such as `html` and `json`.\"\n },\n \"params\": {\n \"type\": \"object\",\n \"description\": \"Custom page parameters, reached as `.Params` in templates.\"\n },\n \"publishDate\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Before this date the page is not rendered.\"\n },\n \"resources\": {\n \"type\": \"array\",\n \"description\": \"Metadata attached to the page's resources. Each entry needs the `src` glob it applies to.\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"src\"],\n \"additionalProperties\": true,\n \"properties\": {\n \"src\": { \"type\": \"string\", \"minLength\": 1 },\n \"name\": { \"type\": \"string\" },\n \"title\": { \"type\": \"string\" },\n \"params\": { \"type\": \"object\" }\n }\n }\n },\n \"sitemap\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Per-page sitemap options.\",\n \"properties\": {\n \"changefreq\": {\n \"type\": \"string\",\n \"enum\": [\n \"always\",\n \"hourly\",\n \"daily\",\n \"weekly\",\n \"monthly\",\n \"yearly\",\n \"never\"\n ],\n \"description\": \"One of the seven values the sitemap protocol defines. Anything else is ignored by consumers.\"\n },\n \"priority\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 },\n \"disable\": { \"type\": \"boolean\" }\n }\n },\n \"sites\": {\n \"type\": \"object\",\n \"description\": \"The sites matrix and its complements.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Overrides the final segment of the URL path.\"\n },\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"An explicit summary, used instead of the one Hugo derives.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The page title. Not required: Hugo falls back to a title derived from the file name.\"\n },\n \"translationKey\": {\n \"type\": \"string\",\n \"description\": \"Relates translations of one page across languages.\"\n },\n \"type\": {\n \"type\": \"string\",\n \"description\": \"The content type, overriding the one derived from the section.\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"Overrides the entire URL path, ignoring the file's position in the section tree.\"\n },\n \"weight\": {\n \"type\": \"integer\",\n \"description\": \"Sort weight within a collection; lower sorts first. An integer — a quoted number sorts as a string, which is the classic way a Hugo menu comes out in the wrong order.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"jekyll:page:4.4\",\n \"title\": \"Jekyll front matter v4.4\",\n \"description\": \"The predefined front matter variables Jekyll itself defines, as of 4.4. The list is deliberately short because Jekyll's is: three global variables and four more for posts. Everything else you see in a Jekyll site — `nav_order`, `parent`, `has_children`, `redirect_from` — comes from a theme or a plugin, not from Jekyll, so it is tolerated rather than described here. Nothing is required: an empty `---` block is valid, and it is the block's *presence*, not its contents, that marks a file for processing. The check that earns its keep is `published`, which must be a boolean — `published: \\\"false\\\"` is a non-empty string, every string is truthy, and the post publishes anyway. See https://jekyllrb.com/docs/front-matter/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"termList\": {\n \"description\": \"One term, or several. Jekyll accepts a YAML list or a space-separated string.\",\n \"if\": { \"type\": \"array\" },\n \"then\": { \"items\": { \"type\": \"string\" } },\n \"else\": { \"type\": \"string\" }\n }\n },\n \"properties\": {\n \"layout\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"The layout file to wrap this document in, without its extension. `null` or `none` suppresses the layout entirely, which is why the null type is allowed.\"\n },\n \"permalink\": {\n \"type\": \"string\",\n \"description\": \"Overrides the built URL for this document.\"\n },\n \"published\": {\n \"type\": \"boolean\",\n \"description\": \"`false` keeps the document out of the generated site. Must be a real boolean: a quoted `\\\"false\\\"` is truthy and publishes.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Overrides the date taken from the post's file name, and so its ordering and permalink. A string — Jekyll accepts a date with an optional time and offset, so no single format applies.\"\n },\n \"category\": {\n \"$ref\": \"#/$defs/termList\",\n \"description\": \"The post's category. The singular and plural keys both work and are additive, which is how a post ends up filed twice.\"\n },\n \"categories\": {\n \"$ref\": \"#/$defs/termList\",\n \"description\": \"One or more categories the post belongs to.\"\n },\n \"tags\": {\n \"$ref\": \"#/$defs/termList\",\n \"description\": \"One or more tags on the post.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"vitepress:page:1.6\",\n \"title\": \"VitePress front matter v1.6\",\n \"description\": \"Front matter accepted by VitePress 1.6 — the four options every theme honours, plus the default theme's page-level toggles. Nothing is required: each option has a default, so a page with no front matter renders. Pinned to 1.6 because that is the stable line; 2.0 was still in alpha when this was written and is deliberately not described here. The fields worth having checked are the union-typed ones, `outline` above all: it takes a heading level, a pair of levels, `deep`, or `false`, and anything else is silently ignored rather than reported. See https://vitepress.dev/reference/frontmatter-config\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"headingLevel\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 6\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Overrides the site-level title for this page.\"\n },\n \"titleTemplate\": {\n \"type\": [\"string\", \"boolean\"],\n \"description\": \"The suffix appended to the title, or `false` to drop it.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Overrides the site-level description for this page.\"\n },\n \"head\": {\n \"type\": \"array\",\n \"description\": \"Extra tags injected into this page's `<head>`. Each entry is a `[tag, attrs]` pair, optionally followed by inner content.\",\n \"items\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"prefixItems\": [{ \"type\": \"string\", \"minLength\": 1 }]\n }\n },\n \"layout\": {\n \"type\": \"string\",\n \"enum\": [\"doc\", \"home\", \"page\"],\n \"description\": \"`doc` is the default and applies the documentation styling; `home` renders the hero and features; `page` is a blank slate.\"\n },\n \"hero\": {\n \"type\": \"object\",\n \"description\": \"The home layout's hero block: `name`, `text`, `tagline`, `image`, `actions`. Left unconstrained beyond its type — the shape varies with the theme.\"\n },\n \"features\": {\n \"type\": \"array\",\n \"description\": \"The home layout's feature cards.\",\n \"items\": { \"type\": \"object\" }\n },\n \"navbar\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the navbar shows on this page. Defaults to true.\"\n },\n \"sidebar\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the sidebar shows on this page. Defaults to true. This is the page-level toggle only — the sidebar's *contents* are configured in the site config, not here.\"\n },\n \"aside\": {\n \"description\": \"Where the aside sits, or `false` to hide it. `true` is the default (right); `left` moves it.\",\n \"if\": { \"type\": \"string\" },\n \"then\": { \"const\": \"left\" },\n \"else\": { \"type\": \"boolean\" }\n },\n \"outline\": {\n \"description\": \"Which heading levels the on-page outline lists: one level, a `[from, to]` pair, `deep` for every level, or `false` to hide it. Branched on array-ness with `if`/`then` rather than `anyOf`, so a bad level inside the pair is reported against the pair; an `anyOf` collapses every branch failure onto the parent and puts the caret on the wrong line. The scalar branch is one `enum` rather than a second nesting of `if`/`then`, so a wrong value produces a single error naming every value that would have worked.\",\n \"if\": { \"type\": \"array\" },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 2,\n \"maxItems\": 2,\n \"items\": { \"$ref\": \"#/$defs/headingLevel\" }\n },\n \"else\": { \"enum\": [1, 2, 3, 4, 5, 6, \"deep\", false] }\n },\n \"lastUpdated\": {\n \"type\": [\"boolean\", \"string\"],\n \"description\": \"Whether to show the last-updated stamp, or a date overriding it. The string branch is a date, which is how a YAML date arrives once parsed.\"\n },\n \"editLink\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the edit-this-page link shows. Defaults to true.\"\n },\n \"footer\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the footer shows. Defaults to true.\"\n },\n \"pageClass\": {\n \"type\": \"string\",\n \"description\": \"An extra CSS class set on the page root, for per-page styling.\"\n },\n \"isHome\": {\n \"type\": \"boolean\",\n \"description\": \"Forces home-page styling on a page whose layout is not `home`.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"x:cards:1.0\",\n \"title\": \"X (Twitter) Cards markup\",\n \"description\": \"The `twitter:*` meta tags that turn a shared link into a card on X. The companion to `ogp:article:1.0`: same `<meta>` channel, and the pair is normally shipped together, which is why a site with Open Graph tags and no card tags is the usual half-done state. Only `twitter:card` is required. `twitter:title`, `twitter:description` and `twitter:image` fall back to their `og:` equivalents, so requiring them here would fail pages that are correct — but `twitter:card` has no fallback, and without it X picks no card type at all. Like Open Graph, this checks something no build tool checks: nothing fails when the tags are wrong, the link just renders badly everywhere it is shared. In HTML these sit on `<meta name=\\\"…\\\">`; in front matter they are ordinary quoted keys. See https://developer.x.com/en/docs/x-for-websites/cards/overview/markup\",\n \"type\": \"object\",\n \"required\": [\"twitter:card\"],\n \"additionalProperties\": true,\n \"$defs\": {\n \"handle\": {\n \"type\": \"string\",\n \"pattern\": \"^@?[A-Za-z0-9_]{1,15}$\",\n \"description\": \"An X handle, with or without the leading `@`. Fifteen characters at most, letters, digits and underscores only — the pattern rejects an email address or a profile URL, which is how this field is usually written wrong.\"\n },\n \"accountId\": {\n \"type\": [\"string\", \"integer\"],\n \"pattern\": \"^[0-9]+$\",\n \"description\": \"A numeric account id. Typed for both channels: from HTML every attribute is a string, while front matter can carry a real number.\"\n },\n \"httpsUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"pattern\": \"^https://\",\n \"description\": \"An absolute HTTPS URL. X does not load card media over plain HTTP.\"\n },\n \"pixels\": {\n \"type\": [\"string\", \"integer\"],\n \"pattern\": \"^(?!0+$)[0-9]+$\",\n \"minimum\": 1,\n \"description\": \"A pixel count, at least 1. Typed for both channels: an HTML `content=` attribute is always a string, while front matter can carry a real number. Both branches enforce the same floor — `pattern` is ignored on a number and `minimum` on a string, so each needs its own spelling of \\\"not zero\\\", or the string form silently accepts a `0` the number form rejects.\"\n }\n },\n \"properties\": {\n \"twitter:card\": {\n \"type\": \"string\",\n \"enum\": [\"summary\", \"summary_large_image\", \"app\", \"player\"],\n \"description\": \"The card type. Required, and the one tag with no `og:` fallback — omit it and no card renders at all. Enumerated because X defines exactly these four and ignores anything else.\"\n },\n \"twitter:site\": {\n \"$ref\": \"#/$defs/handle\",\n \"description\": \"The handle of the site the card belongs to.\"\n },\n \"twitter:site:id\": {\n \"$ref\": \"#/$defs/accountId\",\n \"description\": \"The numeric id of the site's account, an alternative to `twitter:site`.\"\n },\n \"twitter:creator\": {\n \"$ref\": \"#/$defs/handle\",\n \"description\": \"The handle of the content's author.\"\n },\n \"twitter:creator:id\": {\n \"$ref\": \"#/$defs/accountId\",\n \"description\": \"The numeric id of the author's account.\"\n },\n \"twitter:title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 70,\n \"description\": \"The card's title. Truncated past 70 characters, so the length is a real limit rather than a style rule. Falls back to `og:title`.\"\n },\n \"twitter:description\": {\n \"type\": \"string\",\n \"maxLength\": 200,\n \"description\": \"The card's description. Truncated past 200 characters. Falls back to `og:description`.\"\n },\n \"twitter:image\": {\n \"$ref\": \"#/$defs/httpsUrl\",\n \"description\": \"The card's image. Must be HTTPS — an HTTP image is dropped and the card renders without it. Falls back to `og:image`.\"\n },\n \"twitter:image:alt\": {\n \"type\": \"string\",\n \"maxLength\": 420,\n \"description\": \"Alternative text for the image, for people using a screen reader. 420 characters at most.\"\n },\n \"twitter:player\": {\n \"$ref\": \"#/$defs/httpsUrl\",\n \"description\": \"The HTTPS URL of the iframe player. Player cards only.\"\n },\n \"twitter:player:width\": {\n \"$ref\": \"#/$defs/pixels\",\n \"description\": \"The player's width in pixels.\"\n },\n \"twitter:player:height\": {\n \"$ref\": \"#/$defs/pixels\",\n \"description\": \"The player's height in pixels.\"\n },\n \"twitter:player:stream\": {\n \"$ref\": \"#/$defs/httpsUrl\",\n \"description\": \"The URL of a raw video stream, as an alternative to an iframe player.\"\n },\n \"twitter:app:country\": {\n \"type\": \"string\",\n \"pattern\": \"^[A-Z]{2}$\",\n \"description\": \"The two-letter ISO 3166-1 alpha-2 country code for the app store to use. Uppercase.\"\n },\n \"twitter:app:name:iphone\": { \"type\": \"string\", \"minLength\": 1 },\n \"twitter:app:id:iphone\": { \"$ref\": \"#/$defs/accountId\" },\n \"twitter:app:url:iphone\": { \"type\": \"string\", \"format\": \"uri\" },\n \"twitter:app:name:ipad\": { \"type\": \"string\", \"minLength\": 1 },\n \"twitter:app:id:ipad\": { \"$ref\": \"#/$defs/accountId\" },\n \"twitter:app:url:ipad\": { \"type\": \"string\", \"format\": \"uri\" },\n \"twitter:app:name:googleplay\": { \"type\": \"string\", \"minLength\": 1 },\n \"twitter:app:id:googleplay\": { \"type\": \"string\", \"minLength\": 1 },\n \"twitter:app:url:googleplay\": { \"type\": \"string\", \"format\": \"uri\" }\n },\n \"if\": {\n \"properties\": { \"twitter:card\": { \"const\": \"player\" } },\n \"required\": [\"twitter:card\"]\n },\n \"then\": {\n \"required\": [\n \"twitter:title\",\n \"twitter:image\",\n \"twitter:player\",\n \"twitter:player:width\",\n \"twitter:player:height\"\n ],\n \"description\": \"A player card is the one type with its own required set: without the player URL and its dimensions there is nothing to embed, and X falls back to no card rather than to a summary.\"\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"agentskills:skill:1.0\",\n \"title\": \"Agent Skills SKILL.md frontmatter\",\n \"description\": \"Frontmatter for the Agent Skills open standard — the portable `SKILL.md` format published at agentskills.io and read by Claude, Codex, Gemini CLI, Copilot, Cursor and others. Six fields, two of them required. This is the one built-in that sets `additionalProperties: false`, and the reason is not strictness for its own sake: the tooling on the distribution path — `package_skill.py`, claude.ai skill uploads, the Skills API — fails with `Unexpected key(s) in SKILL.md frontmatter` rather than ignoring a field it does not know. A schema that tolerated unknown keys would pass exactly the file that cannot be shipped. Validate a skill you intend to distribute against this; validate a Claude Code-only skill against `anthropic:claude-skill:2.1`, which is the superset. One spec rule is out of reach here: `name` must also match the skill's parent directory name, which is a fact about the path rather than the front matter. The spec carries no version number of its own; `1.0` labels the format as published at https://agentskills.io/specification\",\n \"type\": \"object\",\n \"required\": [\"name\", \"description\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 64,\n \"pattern\": \"^[a-z0-9]+(?:-[a-z0-9]+)*$\",\n \"description\": \"The skill's identifier, 1-64 characters. Lowercase letters, digits and hyphens only, with no leading, trailing or consecutive hyphen. Must also equal the name of the directory holding this `SKILL.md`, which no front matter check can see.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024,\n \"description\": \"What the skill does *and* when to use it, in at most 1024 characters. Agents load this at startup for every installed skill and decide from it alone whether to open the body, so keywords that name the triggering task belong here.\"\n },\n \"license\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The license covering the skill: a license name such as `Apache-2.0`, or a pointer to a bundled file such as `Proprietary. LICENSE.txt has complete terms`.\"\n },\n \"compatibility\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 500,\n \"description\": \"Environment requirements, in at most 500 characters — intended product, required system packages, network access. Most skills do not need this field.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": { \"type\": \"string\" },\n \"description\": \"Client-defined properties the spec does not cover. A map from string keys to **string** values: the spec's own example quotes `version: \\\"1.0\\\"` because unquoted it is a YAML float and this map takes strings. Claude Code's `metadata` is free-form by comparison, so a nested or numeric value passes there and fails here.\"\n },\n \"allowed-tools\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Space-separated tools pre-approved to run, such as `Bash(git:*) Bash(jq:*) Read`. Marked experimental in the spec: support varies between agents, and the list form Claude Code also accepts is not part of the standard.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"anthropic:claude-skill:2.1\",\n \"title\": \"Claude Code SKILL.md frontmatter v2.1\",\n \"description\": \"Frontmatter accepted by Claude Code 2.1 in a `SKILL.md` file: the six fields of the Agent Skills standard plus the fourteen Claude Code adds for invocation control, subagent execution, tool grants and activation scope. It requires nothing, because Claude Code marks every field optional — a skill with no front matter at all loads, taking its description from the first paragraph of the body. Unknown keys are tolerated for the same reason: Claude Code ignores a field it does not recognise. That tolerance is exactly what makes this schema the wrong one to check a skill you intend to publish. The distribution path — claude.ai uploads, the Skills API, `package_skill.py` — accepts only the standard's six fields and hard-errors on the rest, so validate against `agentskills:skill:1.0` as well when the skill has to travel. Boolean fields take `yes`, `no`, `on`, `off`, `1` and `0` in any letter case as well as `true` and `false`; a YAML 1.2 parser hands most of those through as a string or an integer, so the schema accepts all three types rather than `boolean` alone. See https://code.claude.com/docs/en/skills\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"flag\": {\n \"description\": \"A Claude Code boolean. `true`/`false` reach the validator as booleans, `1`/`0` as integers, and `yes`/`no`/`on`/`off` — plus any mixed-case spelling such as `TrUe` — as strings, because YAML 1.2 resolves only the core spellings. Written as three type-scoped keywords rather than a branch: `pattern` constrains only the string form and `minimum`/`maximum` only the integer one, so a wrong value is reported once, against the key, instead of once per failed branch plus a summary.\",\n \"type\": [\"boolean\", \"string\", \"integer\"],\n \"pattern\": \"^(?:[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Yy][Ee][Ss]|[Nn][Oo]|[Oo][Nn]|[Oo][Ff][Ff]|[01])$\",\n \"minimum\": 0,\n \"maximum\": 1\n },\n \"wordsOrList\": {\n \"description\": \"A field Claude Code accepts either as one delimited string or as a YAML list of entries. `items` applies only to the array form, so no branch is needed and a bad entry is reported once, against the item that is wrong.\",\n \"type\": [\"string\", \"array\"],\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n }\n },\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Display name shown in skill listings, defaulting to the directory name. Deliberately unconstrained here: in a personal or project skill this is only a label, and Claude Code accepts spaces and capitals that the Agent Skills `name` rules forbid. Validate against `agentskills:skill:1.0` to hold it to the portable form. In a plugin skill it also sets the last segment of the command.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"What the skill does and when to use it, which is how Claude decides whether to load it. Falls back to the first paragraph of the body when absent. The listing truncates `description` and `when_to_use` together at 1,536 characters, so the key use case goes first; that cap is a truncation rather than an error, and is not enforced here.\"\n },\n \"when_to_use\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Extra triggering context — phrases or example requests — appended to `description` in the skill listing, and counted against the same 1,536-character cap. Claude Code only; not part of the Agent Skills standard.\"\n },\n \"argument-hint\": {\n \"type\": \"string\",\n \"description\": \"Autocomplete hint for the arguments the skill expects, such as `[issue-number]` or `[filename] [format]`.\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Named positional arguments for `$name` substitution in the body, as a space-separated string or a YAML list. Names map to argument positions in order.\"\n },\n \"disable-model-invocation\": {\n \"$ref\": \"#/$defs/flag\",\n \"description\": \"`true` keeps Claude from loading the skill on its own, leaving `/name` as the only way in. For workflows whose timing you want to own — commit, deploy, send. Also keeps the skill out of subagent preloads and scheduled-task prompts. Default: `false`.\"\n },\n \"user-invocable\": {\n \"$ref\": \"#/$defs/flag\",\n \"description\": \"`false` hides the skill from the `/` menu so only Claude can invoke it, for background knowledge nobody should trigger by hand. Default: `true`.\"\n },\n \"allowed-tools\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Tools pre-approved for the turn that invokes this skill, as a space- or comma-separated string or a YAML list. The grant clears with your next message and does not restrict anything: tools left off the list stay callable under your normal permission settings. A project skill's grant applies even in an untrusted folder, which is why one checked into a repository is worth reading before you run it.\"\n },\n \"disallowed-tools\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Tools removed from Claude's pool while the skill is active — an autonomous loop dropping `AskUserQuestion`, say. Clears with your next message. Cannot remove `EndConversation` while any other tool remains. Claude Code only.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model to use while the skill is active, taking the same values as `/model` plus `inherit`. Deliberately not enumerated: the accepted set moves with the product and with an organisation's `availableModels` allowlist, so a list assembled here would reject working skills. With `context: fork` it sets the forked subagent's model instead.\"\n },\n \"effort\": {\n \"enum\": [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n \"description\": \"Reasoning effort while the skill is active, overriding the session level. Which levels are actually available depends on the model. Claude Code only.\"\n },\n \"context\": {\n \"const\": \"fork\",\n \"description\": \"`fork` runs the skill in its own subagent context, with the rendered body as the prompt and no access to the conversation history. The only value Claude Code defines.\"\n },\n \"agent\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Which subagent type runs the skill. Applies only with `context: fork`. Not enumerated, because the set includes whatever agents the project, its plugins and the user define.\"\n },\n \"background\": {\n \"$ref\": \"#/$defs/flag\",\n \"description\": \"Applies only with `context: fork`. `false` waits for the forked subagent's result inside the invoking turn instead of letting it run in the background. Default: `true`; needs Claude Code 2.1.218 or later.\"\n },\n \"hooks\": {\n \"type\": \"object\",\n \"description\": \"Hooks registered when the skill is invoked, which then run for the rest of the session. Keyed by hook event, in the same shape as the hooks configuration, including the `once` option. The inner shape is left unconstrained here: it is the hooks contract rather than the skill contract, and it is versioned separately.\"\n },\n \"paths\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Glob patterns that scope automatic activation, as a comma-separated string or a YAML list. With these set, Claude loads the skill on its own only while working on matching files. Same format as path-specific memory rules. Ignored in a `.claude/commands/` file.\"\n },\n \"shell\": {\n \"enum\": [\"bash\", \"powershell\"],\n \"description\": \"Which shell runs the skill's inline `` !`command` `` injections. Defaults to `bash`, which fails the invocation outright on Windows without Git Bash; `powershell` routes them through the PowerShell tool instead.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"description\": \"Free-form map for your own tooling — entitlement or catalogue fields Claude Code reads but never acts on, dropping a value that is not a map. Looser than the standard's `metadata`, which takes string values only, so a nested or numeric entry here will not survive packaging for distribution. Do not reuse front matter field names such as `paths` as keys.\"\n },\n \"license\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"License covering the skill, from the Agent Skills standard. Claude Code accepts the field and does not act on it.\"\n },\n \"compatibility\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 500,\n \"description\": \"Environment requirements, from the Agent Skills standard, in at most 500 characters. Claude Code accepts the field and does not act on it.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"mkdocs:material:9.7\",\n \"title\": \"MkDocs Material front matter v9.7\",\n \"description\": \"Front matter read by MkDocs 1.6 and Material for MkDocs 9.7 — the two keys MkDocs itself defines (`title`, `template`), the six Material's own templates read, the three its bundled plugins read, and the eight the blog plugin reads on a post. Nothing is required: MkDocs takes a page title from the `nav`, the first H1 or the file name in turn, so a page with no front matter at all builds and renders. That makes it a pure shape check, and the shapes worth checking are the ones the build accepts and then acts on wrongly — a `hide` entry no template tests for, a `tags` string the search plugin skips, a `date` mapping with no `created`. Pinned to Material 9.7 because 9.7.0 is the last feature release of the line. See https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data and https://squidfunk.github.io/mkdocs-material/reference/\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"$defs\": {\n \"stringList\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Overrides the page title. MkDocs checks the `nav` entry, then this, then the first H1, then the file name, and stops at the first that answers — so nothing breaks without it.\"\n },\n \"template\": {\n \"type\": \"string\",\n \"description\": \"The theme template rendering this page, instead of `main.html`. Resolved against the theme's template directory, so a name the theme does not carry fails the build.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Becomes the page's `<meta name=\\\"description\\\">`, and the description on its social card.\"\n },\n \"author\": {\n \"type\": \"string\",\n \"description\": \"Becomes the page's `<meta name=\\\"author\\\">`. One name, not a list — Material renders the value straight into the attribute. The blog plugin's `authors` is a different key.\"\n },\n \"icon\": {\n \"type\": \"string\",\n \"description\": \"An icon shortcode, resolved as `.icons/<value>.svg` — so `material/cached`, not `material/cached.svg`. Shown beside the page in the navigation.\"\n },\n \"status\": {\n \"type\": \"string\",\n \"description\": \"A status marker shown in the navigation. `new` and `deprecated` ship with the theme; any other value has to be declared in `theme.extra.status`, so the set is site-configured and not enumerated here.\"\n },\n \"subtitle\": {\n \"type\": \"string\",\n \"description\": \"Rendered under the page's navigation entry. Added in Material 9.6.\"\n },\n \"hide\": {\n \"type\": \"array\",\n \"description\": \"Page elements to hide. Material tests membership of this list in its templates and reports nothing for an entry it does not know, so a value outside these six hides nothing and says nothing.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"navigation\", \"toc\", \"path\", \"tags\", \"footer\", \"feedback\"]\n }\n },\n \"tags\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Tags for this page, read by the tags plugin and added to the search index. A list, never a bare string: the search plugin skips a `tags` that is not a list without a word.\"\n },\n \"search\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Per-page search options.\",\n \"properties\": {\n \"exclude\": {\n \"type\": \"boolean\",\n \"description\": \"Keeps the page out of the search index entirely.\"\n },\n \"boost\": {\n \"type\": \"number\",\n \"description\": \"Multiplies the page's search ranking. Copied into the index as written, so a quoted number arrives as a string and ranks nothing.\"\n }\n }\n },\n \"social\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Per-page overrides of the social cards plugin's site-level settings.\",\n \"properties\": {\n \"cards\": {\n \"type\": \"boolean\",\n \"description\": \"`false` skips card generation for this page.\"\n },\n \"cards_layout\": {\n \"type\": \"string\",\n \"description\": \"The layout to render this page's card with, resolved under `cards_layout_dir`.\"\n },\n \"cards_layout_options\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Layout options merged over the site-level ones — `title`, `description`, `background_color`, `background_image`, `color`, `font_family`. Left unconstrained beyond its type, because the keys a layout reads are the layout's own.\"\n }\n }\n },\n \"date\": {\n \"description\": \"A blog post's date: the date itself, or a mapping carrying `created` plus any other date you want the templates to have. The blog plugin errors on a post with no `date` at all, and on a mapping with no `created`. Typed but not format-checked: MkDocs parses front matter with PyYAML, which resolves several timestamp spellings, so pinning one format here would fail input the plugin accepts.\",\n \"if\": { \"type\": \"object\" },\n \"then\": {\n \"type\": \"object\",\n \"required\": [\"created\"],\n \"additionalProperties\": { \"type\": \"string\" },\n \"properties\": {\n \"created\": { \"type\": \"string\" },\n \"updated\": { \"type\": \"string\" }\n }\n },\n \"else\": { \"type\": \"string\" }\n },\n \"authors\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"A blog post's authors, as identifiers defined in `.authors.yml`. Duplicates are dropped silently, so they are not an error here.\"\n },\n \"categories\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"A blog post's categories. Deduplicated the same way as `authors`.\"\n },\n \"draft\": {\n \"type\": \"boolean\",\n \"description\": \"Holds a post back from the built site. A quoted `\\\"false\\\"` is a string, which the post configuration refuses outright.\"\n },\n \"pin\": {\n \"type\": \"boolean\",\n \"description\": \"Pins a post to the top of the blog views. Defaults to false.\"\n },\n \"readtime\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"description\": \"Overrides the computed reading time, in minutes.\"\n },\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Overrides the URL segment a post is built at, otherwise derived from its title.\"\n },\n \"links\": {\n \"type\": \"array\",\n \"description\": \"Links shown in a post's sidebar, written in the same shape as `nav`: a path, or a mapping of label to path.\",\n \"items\": { \"type\": [\"string\", \"object\"] }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"anthropic:claude-subagent:2.1\",\n \"title\": \"Claude Code subagent definition front matter v2.1\",\n \"description\": \"Front matter accepted by Claude Code 2.1 in an agent definition — a markdown file under `.claude/agents/`, `~/.claude/agents/`, or a plugin's `agents/` directory, whose body is the subagent's system prompt. Eighteen fields, of which `name` and `description` are required: a file with no `name` is skipped as documentation and one with no `description` is refused with an error, so neither is optional the way a `SKILL.md` field is. Unknown keys are tolerated, because Claude Code records an unrecognised agent key as telemetry and loads the file anyway. The enumerated sets here are the ones the loader checks rather than the ones the documentation lists — `isolation` takes `remote` as well as `worktree`, and `permissionMode` takes `manual` as an alias for `default`. Three fields carry a plugin caveat: `permissionMode`, `hooks` and `mcpServers` are read for a project or user agent and ignored for a plugin one. Do not reach for this schema to check a `SKILL.md`. The two contracts look alike and are not, starting with tool grants spelled `tools` and `disallowedTools` here and `allowed-tools` and `disallowed-tools` there — see `anthropic:claude-skill:2.1`. See https://code.claude.com/docs/en/sub-agents\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"required\": [\"name\", \"description\"],\n \"$defs\": {\n \"wordsOrList\": {\n \"description\": \"A field Claude Code accepts either as one delimited string or as a YAML list of entries. The string form is split on commas and spaces falling outside parentheses, so a parenthesised rule such as `Bash(npm run test:*)` survives as a single entry. `items` applies only to the array form, so no branch is needed and a bad entry is reported once, against the item that is wrong.\",\n \"type\": [\"string\", \"array\"],\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n }\n },\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"^[^-]\",\n \"description\": \"The agent's identity: how the Agent tool, the `--agent` flag and an `Agent(...)` tool grant address it, and what a hook sees as `agent_type`. Required — a file without one is skipped silently as documentation rather than reported. Independent of the filename, which is only where the agent was found, and of the directory it sits in. Constrained here to the one rule the loader enforces, that a name may not begin with `-`. The documented lowercase-and-hyphens convention is not enforced, and agent types with capitals in them ship today, so a schema holding this to `^[a-z-]+$` would fail agents that work. Avoid `:` all the same: it is the separator in a plugin-scoped identifier such as `my-plugin:reviewer`.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"When to delegate to this agent, which is how Claude decides whether to call it and what the Agent tool listing shows. Required — an agent file without one is refused with `missing required 'description' in frontmatter`. Saying \\\"use proactively\\\" encourages automatic delegation. The descriptions of all custom agents share one budget, so keep this short; that budget is a truncation rather than an error, and is not enforced here.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model the agent runs on, taking the same values as `/model` plus `inherit`, which matches the spawning conversation and is also what omitting the field does. Deliberately not enumerated: the accepted set moves with the product and is narrowed further by an organisation's `availableModels` allowlist, so a list assembled here would reject working agents.\"\n },\n \"tools\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Allowlist of tools the agent may call, replacing the default inherited set. Entries are exact tool names, scoped rules such as `Bash(npm run test:*)`, `Agent(worker, researcher)` to bound which agents it may spawn, or an `mcp__<server>` pattern. A list containing `*` imposes no restriction at all, which is what omitting the field already does.\"\n },\n \"disallowedTools\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Denylist of tools removed from whatever pool the agent ends up with, in the same entry format as `tools`. Useful for narrowing the inherited set without enumerating everything kept — an agent that may run commands but must not edit files.\"\n },\n \"color\": {\n \"enum\": [\n \"red\",\n \"blue\",\n \"green\",\n \"yellow\",\n \"purple\",\n \"orange\",\n \"pink\",\n \"cyan\"\n ],\n \"description\": \"Display colour for the agent in the task list and transcript. A closed, published set of eight. Worth checking even though it is cosmetic: a colour outside the set is dropped without a warning, so the only symptom is an agent that never takes the colour you gave it.\"\n },\n \"effort\": {\n \"type\": [\"string\", \"integer\"],\n \"pattern\": \"^(?:low|medium|high|xhigh|max|-?[0-9]+)$\",\n \"description\": \"Reasoning effort while the agent runs, overriding the session level. Either one of the five published levels or an integer, which is why this is typed as two: `pattern` constrains only the string form and leaves the integer one alone, so a wrong value is reported once, against the key. Which levels a model actually offers varies. The loader additionally folds case and resolves two internal aliases; neither is part of the published contract, and both are left out here so the accepted set matches `anthropic:claude-skill:2.1`. The integer form carries **no lower bound**, deliberately, and that asymmetry with `maxTurns` is a fact about the loader rather than an oversight: `maxTurns` is checked for a positive integer and warns otherwise, while `effort` is checked with a bare integer test, so `0` and `-3` are both taken and neither is reported. A `minimum` here would fail an agent that runs. The integer may also be written quoted, which is why the pattern carries a digit branch as well as the five names — the loader reaches the numeric form through `parseInt` on the string, so `\\\"8\\\"` and `8` are the same value to it, exactly as they are for `maxTurns`.\"\n },\n \"permissionMode\": {\n \"enum\": [\n \"acceptEdits\",\n \"auto\",\n \"bypassPermissions\",\n \"default\",\n \"dontAsk\",\n \"manual\",\n \"plan\"\n ],\n \"description\": \"Permission mode the agent runs in, defaulting to the spawning conversation's. `manual` is accepted as an alias for `default` and normalised to it before the mode is checked, so both spellings are legal. Read for a project or user agent; ignored for a plugin agent, which is warned about rather than failed.\"\n },\n \"maxTurns\": {\n \"type\": [\"integer\", \"string\"],\n \"minimum\": 1,\n \"pattern\": \"^[1-9][0-9]*$\",\n \"description\": \"Cap on agentic turns before the agent stops; its output is then marked partial and it can be resumed. A positive integer, written either as a YAML number or as a quoted string — typed as both, with `minimum` constraining only the number and `pattern` only the string, so a wrong value is reported once. `null` is rejected on purpose: the loader treats it as an invalid value rather than as an absent one.\"\n },\n \"skills\": {\n \"$ref\": \"#/$defs/wordsOrList\",\n \"description\": \"Skills preloaded into the agent's context when it starts, by name. The full skill content is injected, so this is a budget as well as a convenience; the agent can still reach an unlisted skill through the Skill tool.\"\n },\n \"mcpServers\": {\n \"type\": \"array\",\n \"description\": \"MCP servers available to the agent. Each entry is either the name of a server the parent session already runs, reused by reference, or a one-key map defining a server inline and scoped to this agent alone. The inner shape of an inline definition is left unconstrained here: it is the MCP server contract rather than the agent contract, and it is versioned separately. Read for a project or user agent; ignored for a plugin agent.\",\n \"items\": { \"type\": [\"string\", \"object\"] }\n },\n \"hooks\": {\n \"type\": \"object\",\n \"description\": \"Hooks registered for the lifetime of this agent, keyed by hook event, in the same shape as the hooks configuration. `Stop` is registered as `SubagentStop`. The inner shape is left unconstrained here for the same reason as `mcpServers`: it is the hooks contract, versioned separately. Read for a project or user agent; ignored for a plugin agent, and it needs a trusted workspace.\"\n },\n \"memory\": {\n \"enum\": [\"user\", \"project\", \"local\"],\n \"description\": \"Scope of the agent's persistent memory directory: `user` for `~/.claude/agent-memory/<name>/`, `project` for `.claude/agent-memory/<name>/` — version-controlled and shared — and `local` for `.claude/agent-memory-local/<name>/`. Needs auto memory enabled. Setting this also forces the memory tools into the agent's tool set, even when `tools` did not list them.\"\n },\n \"background\": {\n \"type\": [\"boolean\", \"string\"],\n \"pattern\": \"^(?:true|false)$\",\n \"description\": \"`true` keeps the agent in the background even when Claude asks for its result in the foreground. Accepts a YAML boolean, or the exact lowercase strings `true` and `false`. The two branches are not the same set and the difference is invisible in the file: YAML 1.2 resolves `true`, `True` and `TRUE` to booleans, so all three reach the validator on the boolean branch and pass, while a *quoted* `\\\"True\\\"` stays a string and fails, because the loader compares the string form against `'true'` and `'false'` exactly. This is the trap in moving between the two Claude Code contracts: a `SKILL.md` flag takes `yes`, `no`, `on`, `off`, `1` and `0` as well, while the agent loader answers every one of those with `Must be 'true', 'false', or omitted.` Written as two type-scoped keywords rather than a branch, so a wrong value is reported once, against the key.\"\n },\n \"isolation\": {\n \"enum\": [\"worktree\", \"remote\"],\n \"description\": \"Where the agent's file changes land. `worktree` runs it in a temporary git worktree cut from the repository's default branch, cleaned up automatically when nothing changed; `remote` is the loader's other accepted value. The published documentation names only `worktree`, and the schema follows the loader, which warns on anything outside these two.\"\n },\n \"initialPrompt\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\",\n \"description\": \"First user turn, submitted automatically when this definition runs as the *main* session — through `--agent` or the `agent` setting — and prepended to any prompt the user supplies. Commands and skills in it are expanded. Not read when the definition is spawned as a subagent, which is the usual case, so an agent that only ever gets delegated to has no use for it. A value that is only whitespace is discarded silently by the loader, so the pattern requires one non-space character rather than leaving `minLength` to pass it.\"\n },\n \"observer\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\",\n \"description\": \"Agent type spawned automatically as a background observer whenever this agent runs, to watch how it works rather than to do the work. Names an agent type, so it is not enumerated: the set includes whatever the project, its plugins and the user define. Blank or whitespace-only is dropped silently, which is why the pattern demands a non-space character instead of letting `minLength` wave a run of spaces through.\"\n },\n \"observerMessage\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\",\n \"description\": \"Extra instruction appended, after the harness-owned default, to each activity digest sent to the `observer`. Only meaningful alongside `observer`; that pairing is a cross-field rule the schema does not express. Whitespace alone is discarded silently, so the pattern reports it.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:core:1.0.0\",\n \"title\": \"manni core vocabulary v1.0.0\",\n \"description\": \"What the page is: the descriptive floor of the manni house vocabulary, and the only vocabulary in the family that requires anything. Requires `title` and `description`, and holds every string it claims non-empty — an empty value is the habit a default exists to prevent, and an empty `type` reaches the tooling that switches on it (the graph type derivation, template selection) as a falsy key instead of a loud failure. Empty strings that other claimants permit are override cases, and so are Dublin Core's repeated-element arrays for type and language — the same recorded exception family as the required pair: core is deliberately stricter than the loosest claimant wherever looseness would teach a bad habit. Every other key here is a deliberately loose claim on a name other schemas share, made only where the fact is about the content and never where it is about the rendering, which stays with the generator. Facts about people are not here either: `authors` sits with `owner` and `reviewed-by` in `manni:stewardship:1.0.0`, because who made a page is a fact about its care rather than about what it is. One shape rule across the whole family: a single-valued fact is a plain string; a list-valued fact is a string or a list.\",\n \"type\": \"object\",\n \"required\": [\n \"title\",\n \"description\"\n ],\n \"additionalProperties\": true,\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"What the page is called, as one non-empty string. Deliberately stricter than the other schemas that claim this key: Dublin Core's repeated-title array and Docusaurus's empty title are override cases here, because a default whose floor accepts an empty title teaches the habit it exists to prevent.\",\n \"x-manni-location\": \"page\"\n },\n \"description\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"One full non-empty sentence saying what the page is for. Doubles as the search snippet, the link-card subtitle, and the first thing a retrieval system reads. Held to a single non-empty string for the same reason as `title`.\",\n \"x-manni-location\": \"page\"\n },\n \"id\": {\n \"type\": \"string\",\n \"description\": \"Stable identifier for this page, independent of its path. References from other pages (`related-pages`, `prerequisites`, `replaced-by`) stay valid across moves when they point at ids.\",\n \"minLength\": 1,\n \"x-manni-location\": \"page\"\n },\n \"type\": {\n \"type\": \"string\",\n \"description\": \"The kind of content this page is, as one string. Pair with a taxonomy schema (`diataxis:diataxis:1.0`, `tgdp:templates:1.0`) to constrain it to a published vocabulary; `graph.type` narrows it to the iiRDS ladder, and the seven-action `action` names what the reader is doing rather than what the page is.\",\n \"minLength\": 1,\n \"x-manni-location\": \"page\"\n },\n \"keywords\": {\n \"type\": [\n \"string\",\n \"array\"\n ],\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"Search keywords. A list of strings, or a single comma-separated string — the AsciiDoc form Antora reads. Deliberately distinct from two neighbors: `tags` (the browsable site taxonomy) is left entirely to your generator's schema, and `concepts` (manni:structure:1.0.0) holds controlled glossary terms rather than free words.\",\n \"minLength\": 1,\n \"x-manni-location\": \"page\"\n },\n \"language\": {\n \"type\": \"string\",\n \"description\": \"The natural language the page is written in, as one string. A BCP 47 language tag is the recommendation, not enforced. The tag carries region and script where they matter, as in `en-GB`, `pt-BR` or `zh-Hant`. The W3C's Language Tags and Locale Identifiers spec (LTLI) calls this a language tag, an identifier for the language of the content. It is the same fact that `lang`, `xml:lang`, `hreflang` and `dc:language` carry. Two neighbors are deliberately not this field. Open Graph's `og:locale` is that protocol's own key and takes the underscore form `en_US`. A programming language belongs to the code sample or to a key such as Microsoft Learn's `ms.devlang`, never here. Held to one string even against Dublin Core's repeatable `language` element, a recorded exception.\",\n \"minLength\": 1,\n \"x-manni-location\": \"page\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:stewardship:1.0.0\",\n \"title\": \"manni stewardship vocabulary v1.0.0\",\n \"description\": \"Is this page cared for: attribution, ownership, review, the document's own dates, and the anchors that make drift detectable. Every field records a fact a person asserts about the document, rather than one a tool reads off the file. `created` and `last-updated` are here on that line. Git's timestamps answer a neighbouring question: when this path first appeared in this repo, and when any byte of it last moved. That parts company with the document's own history at every migration, split, squashed import, typo fix and bulk frontmatter sweep. It is the same reason `authors` sits here — git records who committed a change, not who wrote the prose. A published page carries no repo, so a stamped date travels with the document where a derived one cannot. The cost is that a hand-typed `last-updated` goes stale quietly, and no JSON Schema can catch that. The review dates are records, not freshness gates: JSON Schema cannot compare a date to today, and deriving the due date from `last-reviewed` + `review-interval` belongs to tooling that can read a clock (any freshness grader reads `last-reviewed`).\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"authors\": {\n \"type\": [\n \"string\",\n \"object\",\n \"array\"\n ],\n \"description\": \"Who wrote the page: a name, a list of names, or the structured person objects MyST and Docusaurus define. Attribution rather than answerability — `owner` is the party on the hook for the page now, and the two part company the moment an author moves on. Not a `stringList`, and not the only field here that isn't: `verified-against` and `source-of-truth` take the same string-or-object-or-list shape, as `entryList`. `authors` keeps its own inline copy rather than sharing that definition, because MyST and Docusaurus claim this key too and the composability law holds it at their loosest published definition, which `entryList`'s uniqueness and member floors go past. List members are names or person objects — never bare numbers or nulls. Never empty in any form: minLength, minItems and minProperties each bind to their own type and are ignored for the others.\",\n \"items\": {\n \"type\": [\n \"string\",\n \"object\"\n ]\n },\n \"minLength\": 1,\n \"minItems\": 1,\n \"minProperties\": 1,\n \"x-manni-location\": \"external\"\n },\n \"owner\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"The person or team answerable for this page — the one required field of every docs-ownership system from Backstage to GitLab. A name, a handle, a chat channel, a team slug, or a list of them; write the spelling people can actually reach.\",\n \"x-manni-location\": \"external\"\n },\n \"stakeholders\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Who has a stake in this page being right: the feature's engineer, the product owner, the support lead who fields its tickets. The standing parties to consult before changing the page — where `reviewed-by` records who actually did the last pass. Page-level on purpose: the right stakeholders differ page by page, and project-wide ones belong in your project docs, not in every file's frontmatter.\",\n \"x-manni-location\": \"external\"\n },\n \"reviewed-by\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Who last reviewed the page. Named `reviewed-by` rather than `reviewers` because MyST already defines `reviewers` as scholarly person objects.\",\n \"x-manni-location\": \"external\"\n },\n \"created\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the document was written, as a W3CDTF date. The document's date, not the file's: a page migrated from a CMS, imported from another repo, split out of a longer one, or landed through a squashed history has a path in this repo that is younger than the content it holds, and `git log` can only report the path. Where the two agree, git agreeing is a bonus rather than the source.\",\n \"x-manni-location\": \"external\"\n },\n \"last-updated\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the content last changed in a way a reader would notice, as a W3CDTF date. The editorial fact, not the file's: a commit date also moves for a typo fix, a link sweep, a formatting pass and a bulk frontmatter migration, none of which change what the page says. Distinct from `last-reviewed`, which records the page being checked and found still true — an update changes the content, a review confirms it, and a page can have either without the other. Spelled with the `last-` prefix for exactly the reason `last-reviewed` carries one: both name the most recent instance of a repeating event, and the two read as the pair they are. That also keeps the key clear of every neighbour's spelling of the same fact, which are `lastmod`, `last_update`, `lastUpdated` and `article:modified_time`. A stale value here is the accepted cost of stamping a date instead of deriving one, and a check comparing it against the repo's own last-change date is the tooling answer, not a schema's.\",\n \"x-manni-location\": \"page\"\n },\n \"last-reviewed\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the page was last reviewed, as a W3CDTF date. The field freshness tooling reads to derive review deadlines. A record, not a freshness gate — JSON Schema cannot compare a date to today.\",\n \"x-manni-location\": \"external\"\n },\n \"review-interval\": {\n \"type\": \"string\",\n \"pattern\": \"^P(?:\\\\d+W|(?=\\\\d|T\\\\d)(?:\\\\d+Y)?(?:\\\\d+M)?(?:\\\\d+D)?(?:T(?=\\\\d)(?:\\\\d+H)?(?:\\\\d+M)?(?:\\\\d+S)?)?)$\",\n \"description\": \"How often the page should be reviewed, as an ISO 8601 duration: `P90D`, `P1Y`. ISO rather than `90d` so the value is machine-comparable. With `last-reviewed`, this is everything review tooling needs to derive the due date — a stored due date would only ever agree with them or lie.\",\n \"x-manni-location\": \"external\"\n },\n \"verified-against\": {\n \"$ref\": \"#/$defs/entryList\",\n \"description\": \"The product version, API revision, or spec the content was last verified against. A string is the short spelling — `operator 1.4.2` — and an object the checkable one, such as `{name: operator, version: 1.4.2}`, which a drift check can compare without parsing prose. A list says a page was verified against more than one thing, such as the operator and the cluster it runs on. What turns \\\"reviewed\\\" into \\\"reviewed against something\\\".\",\n \"x-manni-location\": \"external\"\n },\n \"source-of-truth\": {\n \"$ref\": \"#/$defs/entryList\",\n \"description\": \"Where reality lives for this page: a repo path, an API spec, a schema file. A string names it, an object structures it — `{path: charts/operator/values.yaml, kind: helm-values}` — and a list carries several, because a page usually answers to more than one source. The anchor a drift check compares the page against; a page without one cannot be drift-monitored.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"stringList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty string, or a non-empty list of unique ones — the same shape as the `labelList` of manni:graph:1.0.0.\"\n },\n \"entryList\": {\n \"type\": [\n \"string\",\n \"object\",\n \"array\"\n ],\n \"items\": {\n \"$comment\": \"The parent's keyword-per-type pattern again, one level down: minLength binds to a string member, minProperties to an object one, and each is ignored for the other. Repeated here rather than hoisted because a member's floor is a different assertion from the whole value's.\",\n \"type\": [\n \"string\",\n \"object\"\n ],\n \"minLength\": 1,\n \"minProperties\": 1\n },\n \"minLength\": 1,\n \"minItems\": 1,\n \"minProperties\": 1,\n \"uniqueItems\": true,\n \"description\": \"One entry, or a non-empty list of unique ones, where an entry is a non-empty string or a non-empty object. The shape `authors` carries, made a definition because two more fields need it: the short human spelling and the structured machine-checkable one, without minting a second field name for the same fact. Object keys are left open on purpose, and the recommendations live in each field's description. Every non-empty floor binds to its own type — minLength for the string, minProperties for the object, minItems and uniqueItems for the list — and `items` repeats the first two, so `\\\"\\\"`, `[]`, `{}`, `[\\\"\\\"]` and `[{}]` all fail. Unlike `authors`, no other schema claims the keys that use this, so the family is free to set that floor.\",\n \"$comment\": \"minLength, minItems, minProperties and uniqueItems each apply to one instance type and are ignored for the others; that is what lets one subschema hold three shapes without an anyOf whose errors name all three branches.\"\n },\n \"w3cdtf\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9](\\\\.[0-9]+)?)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9]))?)?)?$\",\n \"description\": \"A W3CDTF date, permitting reduced precision: `2026`, `2026-08`, `2026-08-23`, or a full timestamp — in which case the timezone designator is required, as the W3CDTF profile itself mandates (no local-time form). Field-ranged (month 01-12, day 01-31, hour 00-23) so an impossible date fails here rather than becoming Invalid Date in the tooling that derives review deadlines; not calendar-exact — February 31 is a reviewer's catch.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:audience:1.0.0\",\n \"title\": \"manni audience vocabulary v1.0.0\",\n \"description\": \"Who the page serves and who may see it. `audiences` works on day one in any repo; `personas` and `journeys` are the upgrade path once a content strategy exists to point into. `visibility` is the one enumerated ladder here, because something downstream switches on it and an unrecognized value would fail open — the deliberate asymmetry with `audiences`, whose taxonomy is the org's own. Reader expertise is deliberately absent: level belongs to the persona definitions a page points at, not to the page.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"audiences\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Who the page is for, in your own taxonomy — `administrators`, `sre`, `partner-engineers`. Plural because a page usually serves more than one; unenumerated because audience taxonomies are the org's own.\",\n \"x-manni-location\": \"page\"\n },\n \"personas\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Ids of the personas this page serves, referencing your content-strategy documents. May dangle if you keep no personas — adopt it when you do.\",\n \"x-manni-location\": \"external\"\n },\n \"journeys\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Ids of the user journeys (CUJs) this page belongs to. How a docs set proves coverage of its own strategy.\",\n \"x-manni-location\": \"external\"\n },\n \"intent\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The job the reader is trying to get done, in one line: `deploy the operator on a running cluster`. Retrieval and eval pipelines match questions against this, which is what earns a free-text field its place.\",\n \"x-manni-location\": \"page\"\n },\n \"visibility\": {\n \"enum\": [\n \"draft\",\n \"restricted\",\n \"confidential\",\n \"internal\",\n \"public\"\n ],\n \"description\": \"Who can see the page, from no audience yet to everyone: `draft` (authors and preview builds only), then the widening ladder `restricted` → `confidential` → `internal` → `public`. One switch folding what would otherwise be two house fields — a draft flag and an access level. Your generator's own draft/unlisted keys remain its rendering controls and are deliberately unclaimed here: a page can be visibility: public while the generator still hides it, and reconciling the two is site tooling's job, not a schema's. Enumerated — unlike `audiences` — because something downstream switches on it, and an unrecognized value would fail open. Distinct from `lifecycle` (manni:lifecycle:1.0.0): `lifecycle: draft` says the content is unfinished, `visibility: draft` says nobody outside the authors can see it.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"stringList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty string, or a non-empty list of unique ones — the same shape as the `labelList` of manni:graph:1.0.0.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:lifecycle:1.0.0\",\n \"title\": \"manni lifecycle vocabulary v1.0.0\",\n \"description\": \"Where the page is in its life, and what a deprecation owes its readers: a successor, a removal date, or both. The `lifecycle` ladder is a closed enum, chosen deliberately over an open string — it catches `depreciated`-style typos and makes the deprecation rule airtight, at the cost that an org-specific ladder must override the key.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"lifecycle\": {\n \"enum\": [\n \"draft\",\n \"published\",\n \"deprecated\",\n \"archived\"\n ],\n \"description\": \"Where the page is in its life. A closed ladder: it catches typos and makes the deprecation rule below airtight, at the cost that an org-specific ladder (`experimental`, `retired`…) must override this key. The editorial axis — who may see the page is `visibility` (manni:audience:1.0.0).\",\n \"x-manni-location\": \"page\"\n },\n \"replaced-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The page, id, or URL that supersedes this one. Required once `lifecycle: deprecated` unless `remove-by` says the page ends without a successor.\",\n \"x-manni-location\": \"page\"\n },\n \"supersedes\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Pages, ids, or URLs this page replaces — the other direction of `replaced-by`, and the record that survives once the old page is deleted. A record with a stated limit: JSON Schema validates one file at a time, so the pair of edges is not cross-checked here; a knowledge graph (`prov:wasRevisionOf`) is where the two are reconciled.\",\n \"x-manni-location\": \"external\"\n },\n \"remove-by\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the page should be removed, as a W3CDTF date. A date rather than a flag, following Ansible's deprecation practice: 'deprecated' without a horizon is a permanent state.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"lifecycle\": {\n \"const\": \"deprecated\"\n }\n },\n \"required\": [\n \"lifecycle\"\n ]\n },\n \"then\": {\n \"anyOf\": [\n {\n \"required\": [\n \"replaced-by\"\n ]\n },\n {\n \"required\": [\n \"remove-by\"\n ]\n }\n ],\n \"description\": \"A deprecated page must say what comes next: the replacement, or the removal date, or both.\"\n }\n }\n ],\n \"$defs\": {\n \"stringList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty string, or a non-empty list of unique ones — the same shape as the `labelList` of manni:graph:1.0.0.\"\n },\n \"w3cdtf\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9](\\\\.[0-9]+)?)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9]))?)?)?$\",\n \"description\": \"A W3CDTF date, permitting reduced precision; a timestamp requires its timezone designator, as the W3CDTF profile mandates. Field-ranged so an impossible date fails here rather than becoming Invalid Date downstream; not calendar-exact.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:structure:1.0.0\",\n \"title\": \"manni structure vocabulary v1.0.0\",\n \"description\": \"What the page connects to: products, concepts, and other pages. Relationships between pages — which no generator owns — never position in a navigation tree, which every generator does; there is deliberately no ordering, no parent, no nav title here. The applicability and concept fields are the harvest fallbacks of their deeper `graph` twins (manni:graph:1.0.0): where both are present, the deeper declaration wins.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"applies-to\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"What the page applies to, as flat product/variant/version labels — `operator-1.4`, `kubernetes`. Deliberately the same shape as `graph.applies-to`, whose deeper declaration wins when both are present. The labels are flat, with no named dimensions such as product vs deployment; an org that needs axes can prefix labels (`deploy:kubernetes`) or overlay its own schema.\",\n \"x-manni-location\": \"page\"\n },\n \"not-applicable-to\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Product/variant labels this page explicitly does NOT apply to — the carve-out `applies-to` alone cannot state: `applies-to: operator-1.4` with `not-applicable-to: operator-1.4-fips`. Same flat shape as `applies-to`, and the harvest fallback of the deeper `graph.not-applicable-to`, whose declaration wins when both are present. Disjointness from `applies-to` is a graph-layer (SHACL) check, exactly as it is one level down: JSON Schema cannot compare two sibling lists, and a page naming the same label on both sides passes here.\",\n \"x-manni-location\": \"page\"\n },\n \"concepts\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Controlled-vocabulary terms from your glossary that this page is about — a curated list, where `keywords` (manni:core:1.0.0) is free words. The bridge into knowledge-graph tooling, and the harvest fallback of the deeper `graph.concepts`.\",\n \"x-manni-location\": \"page\"\n },\n \"prerequisites\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Pages, ids, or capabilities the reader needs first. A relationship between pages — which no generator owns — not a position in a navigation tree, which every generator does.\",\n \"x-manni-location\": \"page\"\n },\n \"next-steps\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Where the reader goes after this page: several sensible follow-ons, unordered. Relationship, not navigation — the generator's `next`/`prev` position keys are a different fact and stay with the generator. **A deeper or more advanced treatment of the same topic belongs here too.** There is deliberately no separate `advanced` or `deeper-dive` field, and no ranking among these: \\\"more advanced\\\" is a claim about the reader, not about the page, and it is derived — two pages sharing `concepts` while pointing at `personas` of different levels (manni:audience:1.0.0) — which is the same reasoning that cut reader `expertise` from this family. A docs set with no persona definitions cannot derive it, and that is the deliberate day-one cost.\",\n \"x-manni-location\": \"page\"\n },\n \"related-pages\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Pages, ids, or URLs associatively related to this one. The `-pages` suffix is deliberate: `graph.related-concepts` relates concepts, this relates pages, and each name says which. **This is the field a site renders under a \\\"See also\\\" heading** — the key stays semantic, the label stays editorial, and there is deliberately no `see-also` alias, because one fact with two keys is the second surface this family exists to avoid. URLs are accepted, so an off-site \\\"Learn more\\\" target needs no separate field.\",\n \"x-manni-location\": \"page\"\n }\n },\n \"$defs\": {\n \"stringList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty string, or a non-empty list of unique ones — the same shape as the `labelList` of manni:graph:1.0.0, so the harvest fallback and the deeper twin accept identical values.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:terminology:1.0.0\",\n \"title\": \"manni terminology vocabulary v1.0.0\",\n \"description\": \"What a term entry says about its term: the names it goes by, what it means, and where it sits among other terms. The fields map onto SKOS, and each description names its SKOS term. They sit at the root of the page, flat, as every house vocabulary's do. `type`, `id` and `language` belong to manni:core:1.0.0 and are not declared here. `type: term` marks an entry, which then names its `label` and either defines the term or redirects with `see`. An entry carrying both is a finding for `manni term check`, not a schema error. `type: term-set` imposes nothing. The kind of label is the status: `label` is preferred, `alt-labels` are admitted, and `hidden-labels` are deprecated. On a page without a `graph` block, these fields are the harvest fallback of their graph twins (manni:graph:1.0.0). Files without the vocabulary's fields pass.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"label\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The one preferred name of the term (skos:prefLabel). Every other name goes in `alt-labels` or `hidden-labels`. Required on a `type: term` page.\",\n \"x-manni-location\": \"page\"\n },\n \"definition\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"What the term means, in full (skos:definition). This is the text a rendered entry shows. A `type: term` page carries it unless it redirects with `see`.\",\n \"x-manni-location\": \"page\"\n },\n \"abstract\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The short form of the definition, one sentence long. A hover card or a tooltip shows it where the full `definition` would not fit. It has no SKOS term of its own and narrows skos:definition.\",\n \"x-manni-location\": \"page\"\n },\n \"alt-labels\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Other admitted names for the term: synonyms, abbreviations and spelling variants (skos:altLabel). Search matches them, and writers may use them.\",\n \"x-manni-location\": \"page\"\n },\n \"hidden-labels\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Names the term must not go by: deprecated spellings, obsolete forms and common misspellings (skos:hiddenLabel). Search still matches them, so a reader who types one finds the entry.\",\n \"x-manni-location\": \"page\"\n },\n \"broader\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of broader terms, the parents of this one (skos:broader).\",\n \"x-manni-location\": \"page\"\n },\n \"narrower\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of narrower terms, the children of this one (skos:narrower).\",\n \"x-manni-location\": \"page\"\n },\n \"related-terms\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of associatively related terms (skos:related). The `-terms` suffix says what it points at, as `related-pages` and `graph.related-concepts` do.\",\n \"x-manni-location\": \"page\"\n },\n \"see\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The label of the entry this one redirects to. A redirect entry carries `see` in place of a definition, so a reader who looks up this name is sent to the preferred one. It has no SKOS term, and the relation it states is the one skos:altLabel states from the other side.\",\n \"x-manni-location\": \"page\"\n },\n \"scope-note\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"A note on how far the term reaches, and where it stops (skos:scopeNote). It says what the term covers in this set, not what it means.\",\n \"x-manni-location\": \"page\"\n }\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"type\": {\n \"const\": \"term\"\n }\n },\n \"required\": [\n \"type\"\n ]\n },\n \"then\": {\n \"required\": [\n \"label\"\n ],\n \"anyOf\": [\n {\n \"required\": [\n \"definition\"\n ]\n },\n {\n \"required\": [\n \"see\"\n ]\n }\n ],\n \"description\": \"A term entry names its term, and either defines it or redirects to the entry that does. Carrying both is left to the check.\"\n }\n }\n ],\n \"$defs\": {\n \"labelList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"uniqueItems\": true\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty label, or a non-empty unique list of them.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:ai-context:1.0.0\",\n \"title\": \"manni ai-context vocabulary v1.0.0\",\n \"description\": \"How machines made and may use this page: production provenance (`provenance`, `meta-provenance`) and consumption guidance (`risks`, `sample-questions`). `provenance` pins the body lines a machine wrote, and is managed by `manni meta derive`. `meta-provenance` is the family's human-review loop for metadata: machines propose fields and evals, and entries retire as humans review them. `risks` uses the open-enum idiom: recommended flags anchored in published prior art, any string legal, unknown values read as caution rather than absence. The machines that wrote a page are the distinct `generated-by` values across its `provenance` entries.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"provenance\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/provenanceEntry\"\n },\n \"description\": \"Which body lines a machine wrote: one entry per range, each naming the machine, the lines, and a pin over them. Lines are body lines, counted after the frontmatter as for a citation's claim. `lines` is where the pin was last seen and `integrity` is its identity, so a range that moves keeps its entry and a range whose text changes loses it. The field is managed by `manni meta derive`, which reads the evidence from git; `fill` never proposes it. Humans never appear here, because `authors` carries them. The machines that wrote the page are the distinct `generated-by` values across its entries, and a page no machine wrote has no `provenance`. They are what the self-preference-bias check reads: a judge is grading its own author when its model is among the machines attributed for what it grades. By the eval's `target`, that is the machines here for `body` (the default), the machines in `meta-provenance` for `frontmatter`, both for `raw`, and none for a companion file (`{source: file, path}`), which carries its own record if it is a page. The check covers the whole body, because `target` has no lines form. A knowledge-graph harvest reads the page's machines from here too. Complementary to `meta-provenance`, which attributes the page's metadata.\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"x-manni-location\": \"external\"\n },\n \"meta-provenance\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/metaProvenanceEntry\"\n },\n \"description\": \"Attribution for machine-proposed metadata, one entry per model (consumers merge by generated-by; the schema dedupes identical entries): which fields and which evals it proposed, at what confidence. The human-review trail for enrichment — a human deletes an entry once its fields and evals are reviewed, so a surviving entry means unreviewed machine metadata. Not managed and not derived: whoever proposes the values writes the entry. `manni meta fill` writes it for the fields it writes, in the same write: it merges into the entry whose `generated-by` is the run's model (the first such entry, if a person has made two), appending the written fields' JSON Pointers, escaped per RFC 6901 so a key `a/b` is `/a~1b`, after the entry's existing ones and setting their `confidence`; when the run's model has no entry, it appends one. Re-encrypting an existing value in place proposes nothing and is not recorded. `meta-provenance` is never proposed to a model: `fill` skips it as a candidate and leaves it out of the metadata it sends. One key serves the whole family, from page fields to proposed evals and the `graph` block. Complementary to `provenance`, which attributes the page's prose line by line.\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"x-manni-location\": \"external\"\n },\n \"risks\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"$ref\": \"#/$defs/riskFlag\"\n }\n },\n \"else\": {\n \"$ref\": \"#/$defs/riskFlag\"\n },\n \"description\": \"Flags for what following this page does, each a pre-flight question for an agent or reviewer. Cautions: `cost-incurring` (spends money), `destructive` (changes or deletes existing state), `irreversible` (cannot be undone), `privileged` (needs elevated permissions), `open-world` (reaches external systems beyond your control). Assurances: `read-only` (changes nothing) and `idempotent` (safe to repeat) — worth stating explicitly, because an unannotated page is unassessed, not safe. The last three mirror MCP's tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), the published prior art for agent-facing hints. All seven are recommendations, not a closed list: any non-empty string is legal, and a consumer switching on a flag should treat an unknown value as caution rather than absence.\",\n \"x-manni-location\": \"page\"\n },\n \"sample-questions\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One question, or a list of them, that a reader would ask that this page should answer — `How do I install the operator on EKS?`. The retrieval-eval hook: ask them against the corpus and measure whether this page carries the answer. Assertion-style per-page evals belong to manni:evals:1.0.0, not here.\",\n \"x-manni-location\": \"page\"\n }\n },\n \"$defs\": {\n \"provenanceEntry\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"generated-by\",\n \"lines\",\n \"integrity\"\n ],\n \"description\": \"One machine-written range of the body: who wrote it, where it was last seen, and the pin that identifies it.\",\n \"properties\": {\n \"generated-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The model, agent, or tool that wrote these lines.\"\n },\n \"lines\": {\n \"$ref\": \"#/$defs/lines\",\n \"description\": \"Lines of the page body, counted after the frontmatter as for a citation's claim: the body starts on the first line after the closing frontmatter fence, or on line 1 with no frontmatter. This is where the pin was last seen, not the entry's identity; `derive` rewrites it when the text moves.\"\n },\n \"integrity\": {\n \"type\": \"string\",\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"`sha256-` and sixty-four lowercase hex digits over the lines, under the hashing rule manni:citations:1.0.0 states. The pin, and the entry's identity. Always plain sha256, never keyed: the page is public, so there is nothing to hide.\"\n }\n }\n },\n \"metaProvenanceEntry\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"generated-by\"\n ],\n \"anyOf\": [\n {\n \"required\": [\n \"fields\"\n ]\n },\n {\n \"required\": [\n \"evals\"\n ]\n }\n ],\n \"description\": \"One model's proposals: which metadata values and which evals it proposed, at what confidence. At least one of `fields` or `evals` is required, because an entry naming neither says nothing.\",\n \"properties\": {\n \"generated-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model or agent that proposed the fields or evals.\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^/\"\n },\n \"uniqueItems\": true,\n \"description\": \"The metadata values it proposed, as JSON Pointers: the same form `validate` reports. `/intent` names a top-level key and `/graph/label` reaches into a block. Pointers let one entry shape cover every vocabulary stacked on the document.\"\n },\n \"evals\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\"\n },\n \"uniqueItems\": true,\n \"description\": \"The evals it proposed, by kebab id, so a reordered eval list does not orphan them.\"\n },\n \"confidence\": {\n \"type\": \"object\",\n \"propertyNames\": {\n \"pattern\": \"^(?:/.*|[a-z0-9][a-z0-9-]*)$\"\n },\n \"additionalProperties\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1\n },\n \"description\": \"Model confidence, 0..1, keyed by a pointer from `fields` or an id from `evals`. The two key forms cannot collide: a pointer starts with `/` and an id cannot. A confidence attached to a malformed key fails here instead of dangling.\"\n }\n }\n },\n \"lines\": {\n \"oneOf\": [\n {\n \"type\": \"integer\",\n \"minimum\": 1\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^[1-9][0-9]*-[1-9][0-9]*$\"\n }\n ],\n \"description\": \"A line range, 1-based and inclusive: an integer for one line, or `\\\"L1-L2\\\"` for several. `L1 <= L2` is a rule on implementations, since a pattern cannot compare two numbers. There is no line 0 to cite.\"\n },\n \"riskFlag\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"minLength\": 1\n },\n {\n \"enum\": [\n \"cost-incurring\",\n \"destructive\",\n \"irreversible\",\n \"privileged\",\n \"open-world\",\n \"read-only\",\n \"idempotent\"\n ]\n }\n ],\n \"description\": \"One risk flag: a recommended value, or any non-empty string. The enum branch is advisory — it feeds editor completion, docs, and fill proposals; the open string branch keeps an org-specific flag a correct document rather than a violation.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:evals:1.0.0\",\n \"title\": \"manni evals vocabulary v1.0.0\",\n \"description\": \"Page-level eval declarations: named, testable assertions about a page, each graded by code, an AI judge (a model or an agent), or a human. A manni common vocabulary: any grader, judge, or CI tool can implement it, and other schemas may compose on top of it. It adopts the house conventions - kebab-case keys, flat page-level facts - and claims three keys: `evals` (one assertion or the list), `eval-suite`, and `eval-skip`. There is no settings container: settings are page-level facts, and generation attribution lives in manni:ai-context:1.0.0. There, `provenance` names the machines that wrote the page's body, and `meta-provenance` the machines that proposed its metadata. Machine-proposed evals are attributed in that page-level `meta-provenance`, with the proposed ids under its `evals`. The page root stays open so sibling tools' keys pass untouched, but the `eval-` prefix is reserved and enforced here: an unrecognized `eval-*` key is rejected, giving the open root the loud-typo property a closed container would have.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"evals\": {\n \"type\": [\n \"string\",\n \"array\"\n ],\n \"minLength\": 1,\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/evalEntry\"\n },\n \"description\": \"The evals for this page: one AI-judged assertion as a string, or a non-empty list of entries — each a string shorthand, a `use:` reference to a config-defined eval, or an inline definition. An empty list is not a declaration; a page with no evals omits the key. Ids are unique within a page: two entries claiming one id is an error, not a last-one-wins override. JSON Schema cannot express that over a mixed-shape array - `uniqueItems` is whole-item equality - so it is a requirement on implementations, stated here so every tool agrees on the rule.\",\n \"x-manni-location\": \"external\"\n },\n \"eval-suite\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Named suite from the config whose evals apply to this page, alongside anything in `evals`. Page entries win on id collision. A suite assignment is a page-level fact.\",\n \"x-manni-location\": \"external\"\n },\n \"eval-skip\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Skip this page's evals entirely — reported as skipped, never silently ignored. Default false.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"evalEntry\": {\n \"if\": {\n \"type\": \"string\"\n },\n \"then\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"else\": {\n \"if\": {\n \"type\": \"object\",\n \"required\": [\n \"use\"\n ]\n },\n \"then\": {\n \"$ref\": \"#/$defs/evalReference\"\n },\n \"else\": {\n \"$ref\": \"#/$defs/inlineEval\"\n },\n \"description\": \"An object entry: a `use:` reference to a config-defined eval, else an inline definition. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong — the same rule the starlight built-in records.\"\n },\n \"description\": \"One eval: a string shorthand (an AI-judged assertion at error severity), or an object.\"\n },\n \"evalReference\": {\n \"type\": \"object\",\n \"required\": [\n \"use\"\n ],\n \"properties\": {\n \"use\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Name of an eval defined in the config.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/evalType\"\n },\n \"skip\": {\n \"type\": \"boolean\"\n },\n \"severity\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"weight\": {\n \"$ref\": \"#/$defs/weight\"\n },\n \"options\": {\n \"type\": \"object\"\n }\n },\n \"additionalProperties\": false,\n \"description\": \"A page joining an eval the config defines, with the overrides that are statements about *this page's relationship to that check*: whether it applies (`skip`), what kind of claim it is here (`type`), how badly a failure matters (`severity`), what it measures here (`options`), and how much it counts toward an aggregate (`weight`). Deliberately absent: `provider`, `model` and `runs`, which say how the tool executes rather than what this page claims - a corpus where each page picks its own judge model is one no operator can cost or reason about - and `target`, because changing which bytes a *named* eval reads makes one name mean two different things in one corpus, which is the confusion `use:` exists to prevent. An eval that needs a different subject is a different eval.\"\n },\n \"inlineEval\": {\n \"type\": \"object\",\n \"required\": [\n \"id\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"Unique (per page) kebab-case identifier for this eval. `id` matches the page-level `id` convention — in this family, `name` would mean a display name.\"\n },\n \"assertion\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The testable assertion, in plain language.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/evalType\"\n },\n \"grader\": {\n \"$ref\": \"#/$defs/grader\"\n },\n \"provider\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Which configured inference provider or agent judges an `ai`-graded eval — a model endpoint or an agent runner. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default. Meaningful only on `ai` evals.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model that judges an `ai`-graded eval, within `provider`. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default. Two uses: an eval that matters can name a stronger judge than the corpus default, and an eval can name a judge other than the machines that wrote what it grades - the escape hatch for the self-preference-bias check (manni:ai-context:1.0.0), which compares the judge's model with the machines in `provenance` for `target: body`, in `meta-provenance` for `target: frontmatter`, and in both for `target: raw`. Meaningful only on `ai` evals.\"\n },\n \"runs\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 50,\n \"description\": \"Ensemble runs for this eval, overriding the tool's configured default. Lets a high-stakes or known-flaky assertion buy more agreement than a cheap one, which a corpus-wide setting cannot. Capped because it multiplies cost directly. Meaningful only on `ai` evals.\"\n },\n \"evidence\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Hint scoping where the judge should look for evidence.\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/target\"\n },\n \"examples\": {\n \"type\": \"object\",\n \"properties\": {\n \"pass\": {\n \"$ref\": \"#/$defs/anchorList\"\n },\n \"fail\": {\n \"$ref\": \"#/$defs/anchorList\"\n }\n },\n \"additionalProperties\": false,\n \"description\": \"Anchor examples of passing and failing content for the judge — one or several each.\"\n },\n \"command\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"Command to execute for command-graded evals. {file} is replaced with the page path, and exit 0 (or `success-exit-codes`) is a pass. Omitting it is the generation contract: tooling generates a check script from the assertion, then writes `command` and `generated-assertion-hash` back. Legal only alongside `grader: command`.\"\n },\n \"success-exit-codes\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"integer\"\n },\n \"default\": [\n 0\n ],\n \"description\": \"Exit codes that count as a pass.\"\n },\n \"timeout-ms\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"Wall-clock budget for the command, in milliseconds.\"\n },\n \"generated-assertion-hash\": {\n \"type\": \"string\",\n \"description\": \"sha256 of the assertion when the check script was generated — written back alongside `command`, and never legal without it: a hash with no command is a half write-back, and a command with a differing hash triggers regeneration.\"\n },\n \"options\": {\n \"type\": \"object\",\n \"description\": \"Grader-specific options; validated by the grader at run time.\"\n },\n \"severity\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"weight\": {\n \"$ref\": \"#/$defs/weight\"\n },\n \"severity-map\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"description\": \"Maps a tool grader's own severities onto eval severities. Meaningful only on `tool:*` evals.\"\n },\n \"skip\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false,\n \"dependentRequired\": {\n \"generated-assertion-hash\": [\n \"command\"\n ]\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"not\": {\n \"required\": [\n \"grader\"\n ]\n }\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"anyOf\": [\n {\n \"required\": [\n \"assertion\"\n ]\n },\n {\n \"required\": [\n \"command\"\n ]\n }\n ]\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"human\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"required\": [\n \"command\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"An entry carrying an executable command must say grader: command — an execution payload on an ai or human eval is either dead weight or a surprise, depending on which field the runner keys on.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"success-exit-codes\"\n ]\n },\n {\n \"required\": [\n \"timeout-ms\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"success-exit-codes and timeout-ms configure command execution, so they are legal only alongside grader: command — with or without the command itself, since the generation contract writes the command later. On an ai or human eval they are dead weight the runner never reads.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"provider\"\n ]\n },\n {\n \"required\": [\n \"model\"\n ]\n },\n {\n \"required\": [\n \"runs\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"description\": \"provider, model and runs configure the AI judge, so they are legal only on an `ai` eval. `grader` is not required alongside them because `ai` is the default - omitting it is the common case, and the constraint is vacuous when it is absent.\"\n }\n }\n ]\n },\n \"evalType\": {\n \"enum\": [\n \"capability\",\n \"regression\"\n ],\n \"default\": \"regression\",\n \"description\": \"`capability` probes a boundary and is expected to fail sometimes; `regression` protects behavior that already works.\"\n },\n \"severity\": {\n \"enum\": [\n \"error\",\n \"warning\",\n \"notice\"\n ],\n \"default\": \"error\",\n \"description\": \"Only error-severity failures fail the run; warning and notice report but pass. The three levels are the family scale in manni's shared severity, so a finding reads the same in every tool. Default error — the string shorthand implies it.\"\n },\n \"weight\": {\n \"type\": \"number\",\n \"exclusiveMinimum\": 0,\n \"default\": 1,\n \"description\": \"Relative contribution to an aggregate score across evals. Does not change this eval's own pass/fail, nor its severity: an eval still passes or fails on its own terms, and weight only decides how much that outcome moves a suite or run total. Zero is excluded deliberately - a weightless eval is a silent disable, and `skip` already means that, loudly.\"\n },\n \"grader\": {\n \"type\": \"string\",\n \"pattern\": \"^(ai|command|human|tool:[a-z0-9][a-z0-9-]*)$\",\n \"default\": \"ai\",\n \"description\": \"How the assertion is checked: an AI judge (`ai`) — a direct inference provider or an agent, selected per-eval with `provider`; an executable check (`command`), generated from the assertion when no `command` is given; a human review queue (`human`); or a named tool integration (`tool:<kebab>`) — an open family, extensible without touching this schema. The judge may be an agent rather than a bare model — hence `ai`, not `llm`. The structural kinds stay closed because the conditionals above switch on them.\"\n },\n \"anchorList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One anchor example, or a non-empty list of them.\"\n },\n \"target\": {\n \"if\": {\n \"type\": \"object\"\n },\n \"then\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"source\",\n \"path\"\n ],\n \"properties\": {\n \"source\": {\n \"const\": \"file\"\n },\n \"path\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Path to the file to grade, relative to the page's directory.\"\n }\n }\n },\n \"else\": {\n \"enum\": [\n \"body\",\n \"raw\",\n \"frontmatter\"\n ]\n },\n \"default\": \"body\",\n \"description\": \"What the grader receives: the page body with frontmatter stripped (`body`), the file verbatim including frontmatter (`raw`), the parsed frontmatter alone (`frontmatter`), or a companion file. Distinct from `evidence`, which hints where to look within what is graded - this selects the bytes themselves, and it is structural, so deterministic graders honour it too. Named `target` rather than `focus` for that reason: a regex grader has no focus, it has a target. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong.\"\n }\n },\n \"patternProperties\": {\n \"^eval-(?!suite$|skip$)\": false\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:artifact-evals:1.0.0\",\n \"title\": \"manni artifact-evals vocabulary v1.0.0\",\n \"description\": \"Eval declarations for instruction artifacts - skills, agent definitions, and project-rules files: assertions about what must have held in an agent session that used the artifact. A manni common vocabulary sharing the entry shape of manni:evals:1.0.0. The page-side keys appear here one level down - `metadata.evals` (one assertion or the list), `metadata.eval-skip`, and `metadata.meta-provenance`, the page-level attribution record of manni:ai-context:1.0.0 with the same entry shape - because an artifact's top-level frontmatter is the host tool's contract and `metadata` is its sanctioned extension bag; there is no container object inside it - the list is the value. `metadata` stays open so other tools' members pass untouched, and the `eval-` prefix is reserved and enforced inside it: an unrecognized `eval-*` member is rejected, the same loud-typo guard as the page side.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"evals\": {\n \"type\": [\n \"string\",\n \"array\"\n ],\n \"minLength\": 1,\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/evalEntry\"\n },\n \"description\": \"The evals for this artifact: one AI-judged assertion as a string, or a non-empty list of entries — string shorthands, or closed objects with a required id. An empty list is not a declaration; an artifact with no evals omits the key. Ids are unique within an artifact: two entries claiming one id is an error, not a last-one-wins override. JSON Schema cannot express that over a mixed-shape array - `uniqueItems` is whole-item equality - so it is a requirement on implementations, stated here so every tool agrees on the rule.\"\n },\n \"eval-skip\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Skip this artifact's evals entirely — reported as skipped, never silently ignored. The page-side key, one level down; default false.\"\n },\n \"meta-provenance\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/metaProvenanceEntry\"\n },\n \"description\": \"Attribution for machine-proposed metadata, one entry per model (consumers merge by generated-by; the schema dedupes identical entries): which evals (by id) and which fields (by JSON Pointer) it proposed, at what confidence. A human deletes an entry once those are reviewed, so a surviving entry means unreviewed machine metadata. The page-level `meta-provenance`, one level down, with the entry shape repeated byte for byte. The name does not start with `eval-`, so the prefix guard does not apply to it.\",\n \"uniqueItems\": true\n }\n },\n \"patternProperties\": {\n \"^eval-(?!skip$)\": false\n },\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"metaProvenanceEntry\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"generated-by\"\n ],\n \"anyOf\": [\n {\n \"required\": [\n \"fields\"\n ]\n },\n {\n \"required\": [\n \"evals\"\n ]\n }\n ],\n \"description\": \"One model's proposals: which metadata values and which evals it proposed, at what confidence. At least one of `fields` or `evals` is required, because an entry naming neither says nothing.\",\n \"properties\": {\n \"generated-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model or agent that proposed the fields or evals.\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^/\"\n },\n \"uniqueItems\": true,\n \"description\": \"The metadata values it proposed, as JSON Pointers: the same form `validate` reports. `/intent` names a top-level key and `/graph/label` reaches into a block. Pointers let one entry shape cover every vocabulary stacked on the document.\"\n },\n \"evals\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\"\n },\n \"uniqueItems\": true,\n \"description\": \"The evals it proposed, by kebab id, so a reordered eval list does not orphan them.\"\n },\n \"confidence\": {\n \"type\": \"object\",\n \"propertyNames\": {\n \"pattern\": \"^(?:/.*|[a-z0-9][a-z0-9-]*)$\"\n },\n \"additionalProperties\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1\n },\n \"description\": \"Model confidence, 0..1, keyed by a pointer from `fields` or an id from `evals`. The two key forms cannot collide: a pointer starts with `/` and an id cannot. A confidence attached to a malformed key fails here instead of dangling.\"\n }\n }\n },\n \"evalEntry\": {\n \"if\": {\n \"type\": \"string\"\n },\n \"then\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"else\": {\n \"$ref\": \"#/$defs/inlineEval\"\n },\n \"description\": \"One eval: a string shorthand (an AI-judged assertion at error severity — the legitimately id-less form), or a closed object. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong.\"\n },\n \"inlineEval\": {\n \"type\": \"object\",\n \"required\": [\n \"id\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"Unique (per artifact) kebab-case identifier. Required on the object form — position-derived names orphan cached verdicts whenever entries move; if an eval is worth an object, it is worth a stable name.\"\n },\n \"assertion\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"What must have held in the session that used this artifact.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/evalType\"\n },\n \"grader\": {\n \"$ref\": \"#/$defs/grader\"\n },\n \"provider\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Which configured inference provider or agent judges an `ai`-graded eval. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model that judges an `ai`-graded eval, within `provider`. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default. Two uses: an eval that matters can name a stronger judge than the default, and an eval can name a judge other than the model that produced the session it grades - a model asked whether its own session followed the rules is the sharpest form of self-preference bias there is. Meaningful only on `ai` evals.\"\n },\n \"runs\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 50,\n \"description\": \"Ensemble runs for this eval, overriding the tool's configured default. Lets a high-stakes or known-flaky assertion buy more agreement than a cheap one, which a corpus-wide setting cannot. Capped because it multiplies cost directly. Meaningful only on `ai` evals.\"\n },\n \"command\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"Command to execute for command-graded evals. {trace} is replaced with the session trace path — the artifact-side analog of the page side's {file} — and exit 0 (or `success-exit-codes`) is a pass. Omitting it is the generation contract: tooling generates a check script from the assertion, then writes `command` and `generated-assertion-hash` back. Legal only alongside `grader: command`.\"\n },\n \"success-exit-codes\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"integer\"\n },\n \"default\": [\n 0\n ],\n \"description\": \"Exit codes that count as a pass.\"\n },\n \"timeout-ms\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"Timeout for command-graded evals.\"\n },\n \"generated-assertion-hash\": {\n \"type\": \"string\",\n \"description\": \"sha256 of the assertion when the check script was generated — written back alongside `command`, and never legal without it. A mismatch with the current assertion triggers regeneration.\"\n },\n \"options\": {\n \"type\": \"object\",\n \"description\": \"Grader-specific options; validated by the grader at run time, deliberately outside this schema — a grader's options evolve on the grader's schedule.\"\n },\n \"severity\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"weight\": {\n \"type\": \"number\",\n \"exclusiveMinimum\": 0,\n \"default\": 1,\n \"description\": \"Relative contribution to an aggregate score across evals. Does not change this eval's own pass/fail, nor its severity: an eval still passes or fails on its own terms, and weight only decides how much that outcome moves a run total. Zero is excluded deliberately - a weightless eval is a silent disable, and `skip` already means that, loudly.\"\n },\n \"severity-map\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"description\": \"Maps a tool grader's own severities onto eval severities. Meaningful only on `tool:*` evals — imported from the page side to keep the entry vocabularies congruent.\"\n },\n \"skip\": {\n \"type\": \"boolean\"\n },\n \"evidence\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Hint telling the judge where in the session to look.\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/target\"\n },\n \"examples\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pass\": {\n \"$ref\": \"#/$defs/anchorList\"\n },\n \"fail\": {\n \"$ref\": \"#/$defs/anchorList\"\n }\n },\n \"description\": \"Anchor examples of passing and failing behavior for the judge — one or several each.\"\n }\n },\n \"additionalProperties\": false,\n \"dependentRequired\": {\n \"generated-assertion-hash\": [\n \"command\"\n ]\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"not\": {\n \"required\": [\n \"grader\"\n ]\n }\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ],\n \"description\": \"No grader means the `ai` default, so the assertion the judge reads is required.\"\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"human\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"anyOf\": [\n {\n \"required\": [\n \"assertion\"\n ]\n },\n {\n \"required\": [\n \"command\"\n ]\n }\n ],\n \"description\": \"A command eval carries either the assertion its script is generated from, or the command itself - the generation contract writes the second from the first.\"\n }\n },\n {\n \"if\": {\n \"required\": [\n \"command\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"An entry carrying an executable command must say grader: command.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"success-exit-codes\"\n ]\n },\n {\n \"required\": [\n \"timeout-ms\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"success-exit-codes and timeout-ms configure command execution, so they are legal only alongside grader: command — present, or generated later under the generation contract.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"provider\"\n ]\n },\n {\n \"required\": [\n \"model\"\n ]\n },\n {\n \"required\": [\n \"runs\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"description\": \"provider, model and runs configure the AI judge, so they are legal only on an `ai` eval. `grader` is not required alongside them because `ai` is the default.\"\n }\n }\n ]\n },\n \"evalType\": {\n \"enum\": [\n \"capability\",\n \"regression\"\n ],\n \"default\": \"regression\",\n \"description\": \"`capability` probes a boundary and is expected to fail sometimes; `regression` protects behavior that already works. Reported, not enforced.\"\n },\n \"severity\": {\n \"enum\": [\n \"error\",\n \"warning\",\n \"notice\"\n ],\n \"default\": \"error\",\n \"description\": \"Only error-severity failures fail the eval; warning and notice report but pass. The three levels are the family scale in manni's shared severity, so a finding reads the same in every tool. Default error — the string shorthand implies it.\"\n },\n \"grader\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"pattern\": \"^(tool:)?[a-z0-9][a-z0-9-]*$\"\n },\n {\n \"enum\": [\n \"ai\",\n \"human\",\n \"command\",\n \"tool-usage\",\n \"skill-invoked\",\n \"file-access\",\n \"turn-count\",\n \"cost\",\n \"regex\",\n \"json-output\"\n ]\n }\n ],\n \"default\": \"ai\",\n \"description\": \"How the assertion is checked: the AI judge (`ai`); a human review queue (`human` — judged per session, since every trace is new, unlike the page side where a verdict persists until the page changes); an executable check over the trace (`command`); a deterministic session grader — `tool-usage`, `skill-invoked`, `file-access`, `turn-count`, `cost`, `regex`, `json-output`; or a `tool:<kebab>` integration, the page side's namespace, accepted here so one grader spelling ports across both eval vocabularies. Recommended values, not a closed list: any kebab name is legal and validated against the grader registry at run time, so a new grader never needs a schema version — the one cost is that a stale or misspelled grader name passes this schema and is rejected by the registry instead.\"\n },\n \"anchorList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One anchor example, or a non-empty list of them.\"\n },\n \"target\": {\n \"if\": {\n \"type\": \"object\"\n },\n \"then\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"source\",\n \"path\"\n ],\n \"properties\": {\n \"source\": {\n \"const\": \"file\"\n },\n \"path\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Path to the file to grade, relative to the session's working directory.\"\n }\n }\n },\n \"else\": {\n \"enum\": [\n \"transcript\",\n \"last-message\",\n \"files\",\n \"artifact\"\n ]\n },\n \"default\": \"transcript\",\n \"description\": \"What the grader receives: the whole session (`transcript`), the final assistant message (`last-message`), the list of files the session wrote (`files`), the instruction artifact itself (`artifact`), or a named file. Distinct from `evidence`, which hints where to look within what is graded - this selects the bytes themselves, and it is structural, so deterministic graders honour it too. Named `target` rather than `focus` for that reason: a regex grader has no focus, it has a target. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:graph:1.0.0\",\n \"title\": \"manni graph vocabulary v1.0.0\",\n \"description\": \"SKOS concept fields, PROV-O provenance, and iiRDS Core/Software typing under the top-level `graph` key — a manni common vocabulary for knowledge-graph frontmatter that any graph builder or retrieval tool can implement and compose on. It adopts the house conventions: kebab-case keys, plain-language names, and single-value-or-list forgiveness on label fields. The `graph` envelope survives the house flattening rule deliberately: it is what lets a closed, typo-catching block coexist with an open page. Where the block and a page-level field speak to the same fact (`type`, `concepts`, `applies-to`, `revision-of`/`supersedes`), the deeper declaration wins and the page-level field is the harvest fallback. The root fields of manni:terminology:1.0.0 are the fallback for seven more: `label`, `alt-labels`, `broader`, `narrower`, `related-concepts` (from `related-terms`), `definition` and `abstract`. The RDF term each field becomes is named in its description — iiRDS itself spells its properties kebab (has-topic-type, relates-to-product-variant), so the mapping is stated, not mirrored in key names. Files without a `graph` key pass. AI provenance lives outside this block, in manni:ai-context:1.0.0. The machines that wrote the page come from the page-level `provenance`, as the distinct `generated-by` values across its entries, and that is where a graph builder's harvest reads them. Attribution for machine-proposed graph fields is in the page-level `meta-provenance`, with pointers under `/graph/` (`/graph/label`). A pointer can name any graph field, including the hand-curated `sections`, `revision-of` and `derived-from`. Keeping those out of machine attribution belongs to the graph builder's harvest, not to this schema.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"graph\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"label\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The one canonical name of the concept this document is primarily about (skos:prefLabel). `alt-labels` carry every other name the concept goes by. On a page without a `graph` block, the root `label` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"alt-labels\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Alternative names — synonyms, abbreviations, spelling variants — for the primary concept (skos:altLabel). What search and retrieval match; `label` is what the graph displays. On a page without a `graph` block, the root `alt-labels` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"definition\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The definition of the concept this document is primarily about (skos:definition). It needs `label`, the name it defines. On a page without a `graph` block, the root `definition` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"abstract\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The one-sentence form of `definition`, for a hover card or a tooltip. It narrows skos:definition and needs the `definition` it shortens. On a page without a `graph` block, the root `abstract` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"broader\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of broader (parent) concepts (skos:broader). On a page without a `graph` block, the root `broader` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"narrower\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of narrower (child) concepts (skos:narrower). On a page without a `graph` block, the root `narrower` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"related-concepts\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Labels of associatively related concepts (skos:related) — a claim about the concept graph, independent of what this page covers. Named in step with the page-level `related-pages`: each says what it points at. On a page without a `graph` block, the root `related-terms` of manni:terminology:1.0.0 is the harvest fallback.\"\n },\n \"concepts\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Concept labels this document is about (dcterms:subject, minting a skos:Concept per value). The deeper twin of the page-level `concepts`, same shape; when both are present this one wins.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/topicType\",\n \"description\": \"iiRDS Core topic type (iirds:has-topic-type). The deeper twin of the page-level `type`: same name, and this closed iiRDS enum wins when present — the authority the no-invented-enums rule asks for. When absent, the deriver may default it from the page's type (how-to → task, tutorial → learning, explanation → concept).\"\n },\n \"applies-to\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Product/variant labels this document applies to (iirds:relates-to-product-variant, minting iirds:ProductVariant nodes). The deeper twin of the page-level `applies-to`, same flat shape; when both are present, this one wins and the page-level field is the harvest fallback.\"\n },\n \"about-product-lifecycle\": {\n \"$ref\": \"#/$defs/lifecyclePhaseList\",\n \"description\": \"Which phases of the PRODUCT's lifecycle the content covers (iirds:relates-to-product-lifecycle-phase): a page about deploying or uninstalling the product. The `about-` prefix makes the about-ness structural — this says what the page is about, never anything about the page's own `lifecycle`.\"\n },\n \"about-product-aspect\": {\n \"$ref\": \"#/$defs/productAspectList\",\n \"description\": \"Which aspects of the product the content is about (iirds:has-subject, Software domain): its architecture, its interfaces, or its system requirements. Pairs with `about-product-lifecycle`.\"\n },\n \"not-applicable-to\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Product/variant labels this document explicitly does NOT apply to. The deeper twin of the page-level `not-applicable-to` (manni:structure:1.0.0), same flat shape; when both are present this one wins and the page-level field is the harvest fallback — the same rule `applies-to` follows, so the positive and its negative behave alike at both altitudes. Disjointness from `applies-to` is checked at the graph layer (SHACL), not here.\"\n },\n \"not-about-product-aspect\": {\n \"$ref\": \"#/$defs/productAspectList\",\n \"description\": \"Product aspects this document is explicitly NOT about. Disjoint from `about-product-aspect`, checked at the graph layer.\"\n },\n \"sections\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/sectionMetadata\"\n },\n \"description\": \"Per-section iiRDS typing, keyed by GitHub-style heading slug. Keys are deliberately unconstrained here: a key matching no heading is flagged at graph build time, which is the right layer for that check.\"\n },\n \"revision-of\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Repo-relative paths or URLs of earlier documents this one revises (prov:wasRevisionOf). The deeper counterpart of the page-level `supersedes`, which emits the same predicate as the harvest fallback.\"\n },\n \"derived-from\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Repo-relative paths or URLs this document was derived from (prov:wasDerivedFrom). Lineage between documents — distinct from the page-level `source-of-truth`, which anchors the page to external reality.\"\n }\n },\n \"dependentRequired\": {\n \"alt-labels\": [\n \"label\"\n ],\n \"broader\": [\n \"label\"\n ],\n \"narrower\": [\n \"label\"\n ],\n \"related-concepts\": [\n \"label\"\n ],\n \"definition\": [\n \"label\"\n ],\n \"abstract\": [\n \"definition\"\n ]\n },\n \"x-manni-location\": \"page\"\n }\n },\n \"$defs\": {\n \"labelList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"uniqueItems\": true\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty label, or a non-empty unique list of them.\"\n },\n \"topicType\": {\n \"enum\": [\n \"task\",\n \"concept\",\n \"reference\",\n \"learning\",\n \"troubleshooting\",\n \"form\"\n ]\n },\n \"lifecyclePhaseList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"enum\": [\n \"administration\",\n \"customization\",\n \"update\",\n \"deployment\",\n \"integration\",\n \"deinstallation\"\n ]\n },\n \"uniqueItems\": true\n },\n \"else\": {\n \"enum\": [\n \"administration\",\n \"customization\",\n \"update\",\n \"deployment\",\n \"integration\",\n \"deinstallation\"\n ]\n },\n \"description\": \"One iiRDS Software-domain product lifecycle phase, or a unique list of them.\"\n },\n \"productAspectList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"enum\": [\n \"architecture\",\n \"interface\",\n \"system-requirement\"\n ]\n },\n \"uniqueItems\": true\n },\n \"else\": {\n \"enum\": [\n \"architecture\",\n \"interface\",\n \"system-requirement\"\n ]\n },\n \"description\": \"One iiRDS Software-domain aspect, or a unique list of them.\"\n },\n \"sectionMetadata\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"minProperties\": 1,\n \"description\": \"iiRDS typing for one heading section. Fields mirror the document-level graph fields; nothing is inherited from the document, and the SKOS hierarchy fields are deliberately not available per section.\",\n \"properties\": {\n \"type\": {\n \"$ref\": \"#/$defs/topicType\",\n \"description\": \"iiRDS Core topic type for this section (iirds:has-topic-type).\"\n },\n \"applies-to\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Product/variant labels this section applies to (iirds:relates-to-product-variant).\"\n },\n \"about-product-lifecycle\": {\n \"$ref\": \"#/$defs/lifecyclePhaseList\",\n \"description\": \"Product lifecycle phases this section covers.\"\n },\n \"about-product-aspect\": {\n \"$ref\": \"#/$defs/productAspectList\",\n \"description\": \"Product aspects this section is about.\"\n },\n \"not-applicable-to\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Product/variant labels this section explicitly does NOT apply to.\"\n },\n \"not-about-product-aspect\": {\n \"$ref\": \"#/$defs/productAspectList\",\n \"description\": \"Product aspects this section is explicitly NOT about.\"\n },\n \"concepts\": {\n \"$ref\": \"#/$defs/labelList\",\n \"description\": \"Concept labels for this section (dcterms:subject).\"\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:core-strict:1.0.0\",\n \"title\": \"manni core strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:core:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"title\": {\n \"$ref\": \"#/$defs/trimmed\",\n \"description\": \"Strict holds the title to one line with no leading or trailing whitespace.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:[\\\\s\\\\S]*\\\\S)?$\",\n \"description\": \"Strict rejects leading or trailing whitespace. The description may still span several lines.\"\n },\n \"id\": {\n \"$ref\": \"#/$defs/kebab\",\n \"description\": \"Strict holds the id to kebab case, lowercase letters, digits and hyphens.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/kebab\",\n \"description\": \"Strict holds the type to kebab case, lowercase letters, digits and hyphens.\"\n },\n \"keywords\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"$ref\": \"#/$defs/trimmed\"\n },\n \"description\": \"Strict takes keywords as a list only, so the comma-separated string form fails. The list is non-empty and unique, and each keyword is trimmed.\"\n },\n \"language\": {\n \"$ref\": \"#/$defs/bcp47\",\n \"description\": \"Strict holds the language to a well-formed BCP 47 tag, such as `en`, `pt-BR` or `zh-Hant-TW`.\"\n }\n },\n \"$defs\": {\n \"kebab\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"Lowercase letters, digits and hyphens, starting with a letter or digit.\"\n },\n \"trimmed\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"description\": \"One line with no leading or trailing whitespace.\"\n },\n \"bcp47\": {\n \"type\": \"string\",\n \"pattern\": \"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8})(?:-[A-Za-z]{4})?(?:-(?:[A-Za-z]{2}|[0-9]{3}))?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[0-9A-WY-Za-wy-z](?:-[A-Za-z0-9]{2,8})+)*(?:-x(?:-[A-Za-z0-9]{1,8})+)?|x(?:-[A-Za-z0-9]{1,8})+)$\",\n \"description\": \"A well-formed RFC 5646 language tag, or a private-use tag that starts with `x-`. Well-formed means the tag has the right shape. The registry is not consulted.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:stewardship-strict:1.0.0\",\n \"title\": \"manni stewardship strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:stewardship:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"authors\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"required\": [\n \"name\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"email\": {\n \"type\": \"string\",\n \"pattern\": \"^[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+$\"\n },\n \"url\": {\n \"type\": \"string\",\n \"pattern\": \"^https?://\\\\S+$\"\n }\n }\n },\n \"description\": \"Strict takes authors as a list of unique entries. A string entry is one line with no surrounding space. A person object names the person, and its `email` and `url` are well formed.\"\n },\n \"owner\": {\n \"$ref\": \"#/$defs/handles\",\n \"description\": \"Strict holds each owner to a handle a GitHub or GitLab CODEOWNERS file accepts, in the string form and the list form alike.\"\n },\n \"stakeholders\": {\n \"$ref\": \"#/$defs/names\",\n \"description\": \"Strict holds each stakeholder to one line with no surrounding space. A stakeholder is a person or team, named in any form.\"\n },\n \"reviewed-by\": {\n \"$ref\": \"#/$defs/names\",\n \"description\": \"Strict holds each reviewer to one line with no surrounding space. `manni meta derive` writes review-API logins and commit-trailer names, so no handle form is required.\"\n },\n \"created\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the creation date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"last-updated\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the update date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"last-reviewed\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the review date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"verified-against\": {\n \"required\": [\n \"name\",\n \"version\"\n ],\n \"items\": {\n \"required\": [\n \"name\",\n \"version\"\n ]\n },\n \"description\": \"Strict requires an object entry to carry `name` and `version`, alone or in a list. The version's format stays free, and a string entry is unchanged. The top-level `required` holds the single-object form, and `items` holds each object in a list, since `required` applies only to an object.\"\n },\n \"source-of-truth\": {\n \"$ref\": \"#/$defs/source\",\n \"items\": {\n \"$ref\": \"#/$defs/source\"\n },\n \"description\": \"Strict requires an object entry to carry `path` or `url`, alone or in a list. A string entry is one id, path or URL on one line with no surrounding space. The top-level `$ref` holds the string and single-object forms, and `items` holds each entry in a list, since `required` applies only to an object.\"\n }\n },\n \"$defs\": {\n \"handles\": {\n \"pattern\": \"^(?:@@?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?(?:/[A-Za-z0-9._-]+)*|[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+)$\",\n \"items\": {\n \"pattern\": \"^(?:@@?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?(?:/[A-Za-z0-9._-]+)*|[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+)$\"\n },\n \"description\": \"A handle a CODEOWNERS file accepts, as a string or as each member of a list. That is `@user`, `@org/team`, a GitLab nested group or `@@role`, or an email address.\"\n },\n \"names\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"description\": \"One line with no surrounding space, as a string or as each member of a list.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9]))?$\",\n \"description\": \"An RFC 3339 full date, or a date-time with seconds and an offset.\"\n },\n \"source\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"anyOf\": [\n {\n \"required\": [\n \"path\"\n ]\n },\n {\n \"required\": [\n \"url\"\n ]\n }\n ],\n \"description\": \"A source entry. A string is one id, path or URL on one line with no surrounding space. An object carries `path` or `url`.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:audience-strict:1.0.0\",\n \"title\": \"manni audience strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:audience:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"audiences\": {\n \"$ref\": \"#/$defs/kebabOrList\",\n \"description\": \"Strict holds each audience to kebab case, in the string form and the list form alike.\"\n },\n \"personas\": {\n \"$ref\": \"#/$defs/kebabOrList\",\n \"description\": \"Strict holds each persona id to kebab case, in the string form and the list form alike.\"\n },\n \"journeys\": {\n \"$ref\": \"#/$defs/kebabOrList\",\n \"description\": \"Strict holds each journey id to kebab case, in the string form and the list form alike.\"\n },\n \"intent\": {\n \"type\": \"string\",\n \"pattern\": \"^[^\\\\r\\\\n]+$\",\n \"description\": \"Strict holds the intent to a single line.\"\n }\n },\n \"$defs\": {\n \"kebabOrList\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\"\n },\n \"description\": \"Lowercase letters, digits and hyphens, starting with a letter or digit. It applies to a single string and to each item of a list.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:lifecycle-strict:1.0.0\",\n \"title\": \"manni lifecycle strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:lifecycle:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"replaced-by\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"description\": \"Strict holds the successor to one id, path or URL on one line with no surrounding space. A path may contain spaces.\"\n },\n \"supersedes\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"description\": \"Strict holds each superseded page to one id, path or URL on one line with no surrounding space, in the string form and the list form alike.\"\n },\n \"remove-by\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$\",\n \"description\": \"Strict holds the removal date to an RFC 3339 full date, `YYYY-MM-DD`. A year or month alone fails, and so does a timestamp.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:structure-strict:1.0.0\",\n \"title\": \"manni structure strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:structure:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key. `concepts` is unchanged, because a glossary label may contain spaces.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"applies-to\": {\n \"$ref\": \"#/$defs/applicability\",\n \"description\": \"Strict holds each label to lowercase letters, digits, dots and hyphens, in the string form and the list form alike. One prefix such as `deploy:` may lead it.\"\n },\n \"not-applicable-to\": {\n \"$ref\": \"#/$defs/applicability\",\n \"description\": \"Strict holds each label to lowercase letters, digits, dots and hyphens, in the string form and the list form alike. One prefix such as `deploy:` may lead it.\"\n },\n \"prerequisites\": {\n \"$ref\": \"#/$defs/refs\",\n \"description\": \"Strict holds each prerequisite to one id, path or URL on one line with no surrounding space, in the string form and the list form alike.\"\n },\n \"next-steps\": {\n \"$ref\": \"#/$defs/refs\",\n \"description\": \"Strict holds each next step to one id, path or URL on one line with no surrounding space, in the string form and the list form alike.\"\n },\n \"related-pages\": {\n \"$ref\": \"#/$defs/refs\",\n \"description\": \"Strict holds each related page to one id, path or URL on one line with no surrounding space, in the string form and the list form alike.\"\n }\n },\n \"$defs\": {\n \"applicability\": {\n \"pattern\": \"^(?:[a-z0-9-]+:)?[a-z0-9][a-z0-9.-]*$\",\n \"items\": {\n \"pattern\": \"^(?:[a-z0-9-]+:)?[a-z0-9][a-z0-9.-]*$\"\n },\n \"description\": \"A flat applicability label, as a string or as each member of a list. `operator-1.4` and `deploy:k8s-1.30` pass.\"\n },\n \"refs\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"description\": \"An id, path or URL on one line with no surrounding space, as a string or as each member of a list.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:terminology-strict:1.0.0\",\n \"title\": \"manni terminology strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:terminology:1.0.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key. An entry either defines its term or redirects with `see`, so strict rejects a page that carries both. The open vocabulary leaves that case to `manni term check`.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"label\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"description\": \"Strict holds the preferred label to one line with no surrounding space.\"\n },\n \"see\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"description\": \"Strict holds the redirect target to one line with no surrounding space, the form a label takes.\"\n }\n },\n \"not\": {\n \"required\": [\n \"definition\",\n \"see\"\n ]\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:ai-context-strict:1.0.0\",\n \"title\": \"manni ai-context strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:ai-context:1.0.0. Stack it beside the open vocabulary, which owns every key and every required rule. It narrows the form of `meta-provenance` entries and closes `risks` to its seven named flags. It leaves `provenance` alone, because `manni meta derive` writes commit-trailer names there as git records them.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"meta-provenance\": {\n \"description\": \"Strict adds three rules to each entry. `generated-by` is a model id with no spaces. Each of `fields` is a well-formed RFC 6901 pointer. Each `confidence` key is such a pointer or a kebab eval id.\",\n \"items\": {\n \"properties\": {\n \"generated-by\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"fields\": {\n \"items\": {\n \"pattern\": \"^(?:/(?:[^~/]|~[01])*)+$\",\n \"description\": \"A JSON Pointer in which every `~` begins an RFC 6901 escape, `~0` or `~1`.\"\n }\n },\n \"confidence\": {\n \"propertyNames\": {\n \"pattern\": \"^(?:(?:/(?:[^~/]|~[01])*)+|[a-z0-9][a-z0-9-]*)$\",\n \"description\": \"A well-formed JSON Pointer, or a kebab eval id.\"\n }\n }\n }\n }\n },\n \"risks\": {\n \"description\": \"Strict closes the flags to the seven the open vocabulary recommends, in both the single-string and the list form. The `if`/`then` pair holds the single string, and the sibling `items` holds each member of a list. Each keyword applies to one type only, so neither needs a type guard.\",\n \"if\": {\n \"type\": \"string\"\n },\n \"then\": {\n \"$ref\": \"#/$defs/riskFlag\"\n },\n \"items\": {\n \"$ref\": \"#/$defs/riskFlag\"\n }\n }\n },\n \"$defs\": {\n \"riskFlag\": {\n \"enum\": [\n \"cost-incurring\",\n \"destructive\",\n \"irreversible\",\n \"privileged\",\n \"open-world\",\n \"read-only\",\n \"idempotent\"\n ],\n \"description\": \"One of the seven named flags. Strict accepts no other string.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:evals-strict:1.0.0\",\n \"title\": \"manni evals strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:evals:1.0.0. Stack it beside the open vocabulary, which owns every key, every required rule and every conditional. It narrows names to kebab ids and model ids, exit codes to the range a process returns, companion paths to relative ones, and the assertion hash to its full form.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"evals\": {\n \"description\": \"Strict narrows the object entries of the list. A string shorthand, alone or in the list, passes as the open vocabulary reads it.\",\n \"items\": {\n \"$ref\": \"#/$defs/entry\"\n }\n },\n \"eval-suite\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"Strict requires a kebab suite name.\"\n }\n },\n \"$defs\": {\n \"entry\": {\n \"description\": \"The rules strict adds to an object entry, either a `use:` reference or an inline definition.\",\n \"properties\": {\n \"use\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"A kebab eval name from the config.\"\n },\n \"provider\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"A kebab provider name, such as `anthropic` or `llama-cpp`.\"\n },\n \"model\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"success-exit-codes\": {\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 255\n },\n \"description\": \"Distinct exit codes, each from 0 to 255, the range a process can return.\"\n },\n \"target\": {\n \"properties\": {\n \"path\": {\n \"pattern\": \"^(?![\\\\\\\\/~])(?![A-Za-z]:)(?![A-Za-z][A-Za-z0-9+.-]*://).+$\",\n \"description\": \"A relative path. It starts with no `/`, `\\\\` or `~`, no drive letter, and no URL scheme.\"\n }\n }\n },\n \"generated-assertion-hash\": {\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"`sha256-` and sixty-four lowercase hex digits.\"\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:artifact-evals-strict:1.0.0\",\n \"title\": \"manni artifact-evals strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:artifact-evals:1.0.0. Stack it beside the open vocabulary, which owns every key, every required rule and every conditional. Inside `metadata`, it narrows provider and model names, exit codes, companion paths and the assertion hash as manni:evals-strict:1.0.0 does. It also closes `grader` to the named graders and `tool:` integrations.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"metadata\": {\n \"description\": \"Strict narrows the object entries of `metadata.evals`. A string shorthand passes as the open vocabulary reads it, and every other member of `metadata` passes untouched.\",\n \"properties\": {\n \"evals\": {\n \"items\": {\n \"$ref\": \"#/$defs/entry\"\n }\n },\n \"meta-provenance\": {\n \"description\": \"Strict holds each entry to the rules the ai-context overlay applies to the same shape. `generated-by` is a model id with no spaces, and each pointer is well formed.\",\n \"items\": {\n \"properties\": {\n \"generated-by\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"fields\": {\n \"items\": {\n \"pattern\": \"^(?:/(?:[^~/]|~[01])*)+$\",\n \"description\": \"A JSON Pointer in which every `~` begins an RFC 6901 escape, `~0` or `~1`.\"\n }\n },\n \"confidence\": {\n \"propertyNames\": {\n \"pattern\": \"^(?:(?:/(?:[^~/]|~[01])*)+|[a-z0-9][a-z0-9-]*)$\",\n \"description\": \"A well-formed JSON Pointer, or a kebab eval id.\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"$defs\": {\n \"entry\": {\n \"description\": \"The rules strict adds to an object entry.\",\n \"properties\": {\n \"grader\": {\n \"anyOf\": [\n {\n \"enum\": [\n \"ai\",\n \"human\",\n \"command\",\n \"tool-usage\",\n \"skill-invoked\",\n \"file-access\",\n \"turn-count\",\n \"cost\",\n \"regex\",\n \"json-output\"\n ]\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^tool:[a-z0-9][a-z0-9-]*$\"\n }\n ],\n \"description\": \"One of the ten named graders, or a `tool:<kebab>` integration. Strict accepts no other kebab name.\"\n },\n \"provider\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"A kebab provider name, such as `anthropic` or `llama-cpp`.\"\n },\n \"model\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"success-exit-codes\": {\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 255\n },\n \"description\": \"Distinct exit codes, each from 0 to 255, the range a process can return.\"\n },\n \"target\": {\n \"properties\": {\n \"path\": {\n \"pattern\": \"^(?![\\\\\\\\/~])(?![A-Za-z]:)(?![A-Za-z][A-Za-z0-9+.-]*://).+$\",\n \"description\": \"A relative path. It starts with no `/`, `\\\\` or `~`, no drive letter, and no URL scheme.\"\n }\n }\n },\n \"generated-assertion-hash\": {\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"`sha256-` and sixty-four lowercase hex digits.\"\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:graph-strict:1.0.0\",\n \"title\": \"manni graph strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:graph:1.0.0. Stack it beside the open vocabulary, which owns the closed `graph` block and its iiRDS enums. It narrows section keys to heading slugs and lineage references to single tokens.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"graph\": {\n \"description\": \"Strict narrows `sections` keys, `revision-of` and `derived-from`. Every other member of the block passes as the open vocabulary reads it.\",\n \"properties\": {\n \"sections\": {\n \"propertyNames\": {\n \"pattern\": \"^[\\\\p{Ll}\\\\p{Lm}\\\\p{Lo}\\\\p{M}\\\\p{Nd}_-]+$\",\n \"description\": \"A heading slug of lowercase letters, caseless letters and their marks, digits, `_` and `-`. It admits slugs from scripts without case, such as Han, Arabic and Devanagari. The pattern uses Unicode property escapes, so a validator must compile it with the ECMA-262 `u` flag, as Ajv does for a 2020-12 schema.\"\n }\n },\n \"revision-of\": {\n \"$ref\": \"#/$defs/refList\"\n },\n \"derived-from\": {\n \"$ref\": \"#/$defs/refList\"\n }\n }\n }\n },\n \"$defs\": {\n \"refList\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"description\": \"A path or URL on one line with no surrounding space, alone or in each item of the list. A path may contain spaces.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:citations-strict:1.0.0\",\n \"title\": \"manni citations strict overlay v1.0.0\",\n \"description\": \"The strict overlay for manni:citations:1.0.0. Stack it beside the open vocabulary, which owns every key and every required rule. It asks for the full commit hash a tool writes, and it pairs the pin's prefix with the source file.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"citations\": {\n \"description\": \"Strict narrows each entry's `source`. An encrypted `file` takes an `hmac-sha256-` pin, a plain one takes a `sha256-` pin, and `commit-sha` is a full hash.\",\n \"items\": {\n \"properties\": {\n \"source\": {\n \"properties\": {\n \"commit-sha\": {\n \"pattern\": \"^(?:[0-9a-f]{40}|[0-9a-f]{64})$\",\n \"description\": \"A full commit hash, forty lowercase hex digits or sixty-four in a SHA-256 repository.\"\n }\n },\n \"if\": {\n \"properties\": {\n \"file\": {\n \"pattern\": \"^~\"\n }\n },\n \"required\": [\n \"file\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"integrity\": {\n \"pattern\": \"^hmac-sha256-\",\n \"description\": \"An encrypted `file` is pinned `hmac-sha256-`.\"\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"integrity\": {\n \"pattern\": \"^sha256-\",\n \"description\": \"A plain `file` is pinned `sha256-`.\"\n }\n }\n }\n }\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"tgdp:templates:1.1\",\n \"title\": \"The Good Docs Project templates v1.1\",\n \"description\": \"Requires `type` and recommends the 25 template slugs that The Good Docs Project publishes (upstream templates repo, main as of 2026-08-09). Any other non-empty string names a page type TGDP does not publish, and passes. Stack tgdp:templates-strict:1.1 beside it to close `type` to the 25 slugs. Adopting it states that every page has a type, so an untyped page is a gap. Diataxis classifies what a page *is* on the same key, so a page under both has to satisfy both. Pick one. It composes freely with a schema keyed on a different field, such as passo-uno:seven-action:1.0. See https://www.thegooddocsproject.dev/template\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"required\": [\n \"type\"\n ],\n \"properties\": {\n \"type\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"minLength\": 1\n },\n {\n \"enum\": [\n \"api-getting-started\",\n \"api-reference\",\n \"bug-report\",\n \"changelog\",\n \"code-of-conduct\",\n \"code-of-conduct-incident-record\",\n \"code-of-conduct-remediation-record\",\n \"code-of-conduct-response-plan\",\n \"concept\",\n \"contact-support\",\n \"contributing-guide\",\n \"glossary\",\n \"how-to\",\n \"installation-guide\",\n \"our-team\",\n \"quickstart\",\n \"readme\",\n \"reference\",\n \"release-notes\",\n \"sdk-overview\",\n \"style-guide\",\n \"terminology-system\",\n \"troubleshooting\",\n \"tutorial\",\n \"user-personas\"\n ]\n }\n ],\n \"description\": \"Which page type this page is, as a Good Docs Project template slug where one fits. The 25 slugs are the recommended values. The Core pack is `concept`, `how-to`, `readme`, `reference`, `release-notes`, `troubleshooting` and `tutorial`. The rest come from the Community and Misc packs. Any other non-empty string names a page type TGDP does not publish. The enum recommends and rejects nothing; stack tgdp:templates-strict:1.1 to close the list.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"tgdp:templates-strict:1.1\",\n \"title\": \"The Good Docs Project templates strict overlay v1.1\",\n \"description\": \"The strict overlay for tgdp:templates:1.1. Stack it beside the open schema, which owns the key and the required rule. It closes `type` to the 25 template slugs and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"enum\": [\n \"api-getting-started\",\n \"api-reference\",\n \"bug-report\",\n \"changelog\",\n \"code-of-conduct\",\n \"code-of-conduct-incident-record\",\n \"code-of-conduct-remediation-record\",\n \"code-of-conduct-response-plan\",\n \"concept\",\n \"contact-support\",\n \"contributing-guide\",\n \"glossary\",\n \"how-to\",\n \"installation-guide\",\n \"our-team\",\n \"quickstart\",\n \"readme\",\n \"reference\",\n \"release-notes\",\n \"sdk-overview\",\n \"style-guide\",\n \"terminology-system\",\n \"troubleshooting\",\n \"tutorial\",\n \"user-personas\"\n ],\n \"description\": \"Stacked beside tgdp:templates:1.1, strict closes `type` to the 25 template slugs. That is the check tgdp:templates:1.0 makes in one file.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:artifact-evals:1.1.0\",\n \"title\": \"manni artifact-evals vocabulary v1.1.0\",\n \"description\": \"Eval declarations for instruction artifacts - skills, agent definitions, and project-rules files: assertions about what must have held in an agent session that used the artifact. A manni common vocabulary sharing the entry shape of manni:evals:1.0.0. The page-side keys appear here one level down - `metadata.evals` (one assertion or the list), `metadata.eval-skip`, and `metadata.meta-provenance`, the page-level attribution record of manni:ai-context:1.0.0 with the same entry shape - because an artifact's top-level frontmatter is the host tool's contract and `metadata` is its sanctioned extension bag; there is no container object inside it - the list is the value. `metadata` stays open so other tools' members pass untouched, and the `eval-` prefix is reserved and enforced inside it: an unrecognized `eval-*` member is rejected, the same loud-typo guard as the page side.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"evals\": {\n \"type\": [\n \"string\",\n \"array\"\n ],\n \"minLength\": 1,\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/evalEntry\"\n },\n \"description\": \"The evals for this artifact: one AI-judged assertion as a string, or a non-empty list of entries — string shorthands, or closed objects with a required id. An empty list is not a declaration; an artifact with no evals omits the key. Ids are unique within an artifact: two entries claiming one id is an error, not a last-one-wins override. JSON Schema cannot express that over a mixed-shape array - `uniqueItems` is whole-item equality - so it is a requirement on implementations, stated here so every tool agrees on the rule.\"\n },\n \"eval-skip\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Skip this artifact's evals entirely — reported as skipped, never silently ignored. The page-side key, one level down; default false.\"\n },\n \"meta-provenance\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/metaProvenanceEntry\"\n },\n \"description\": \"Attribution for machine-proposed metadata, one entry per model (consumers merge by generated-by; the schema dedupes identical entries): which evals (by id) and which fields (by JSON Pointer) it proposed, at what confidence. A human deletes an entry once those are reviewed, so a surviving entry means unreviewed machine metadata. The page-level `meta-provenance`, one level down, with the entry shape repeated byte for byte. The name does not start with `eval-`, so the prefix guard does not apply to it.\",\n \"uniqueItems\": true\n }\n },\n \"patternProperties\": {\n \"^eval-(?!skip$)\": false\n },\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"metaProvenanceEntry\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"generated-by\"\n ],\n \"anyOf\": [\n {\n \"required\": [\n \"fields\"\n ]\n },\n {\n \"required\": [\n \"evals\"\n ]\n }\n ],\n \"description\": \"One model's proposals: which metadata values and which evals it proposed, at what confidence. At least one of `fields` or `evals` is required, because an entry naming neither says nothing.\",\n \"properties\": {\n \"generated-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model or agent that proposed the fields or evals.\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^/\"\n },\n \"uniqueItems\": true,\n \"description\": \"The metadata values it proposed, as JSON Pointers: the same form `validate` reports. `/intent` names a top-level key and `/graph/label` reaches into a block. Pointers let one entry shape cover every vocabulary stacked on the document.\"\n },\n \"evals\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\"\n },\n \"uniqueItems\": true,\n \"description\": \"The evals it proposed, by kebab id, so a reordered eval list does not orphan them.\"\n },\n \"confidence\": {\n \"type\": \"object\",\n \"propertyNames\": {\n \"pattern\": \"^(?:/.*|[a-z0-9][a-z0-9-]*)$\"\n },\n \"additionalProperties\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1\n },\n \"description\": \"Model confidence, 0..1, keyed by a pointer from `fields` or an id from `evals`. The two key forms cannot collide: a pointer starts with `/` and an id cannot. A confidence attached to a malformed key fails here instead of dangling.\"\n }\n }\n },\n \"evalEntry\": {\n \"if\": {\n \"type\": \"string\"\n },\n \"then\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"else\": {\n \"$ref\": \"#/$defs/inlineEval\"\n },\n \"description\": \"One eval: a string shorthand (an AI-judged assertion at error severity — the legitimately id-less form), or a closed object. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong.\"\n },\n \"inlineEval\": {\n \"type\": \"object\",\n \"required\": [\n \"id\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"Unique (per artifact) kebab-case identifier. Required on the object form — position-derived names orphan cached verdicts whenever entries move; if an eval is worth an object, it is worth a stable name.\"\n },\n \"assertion\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"What must have held in the session that used this artifact.\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/evalType\"\n },\n \"grader\": {\n \"$ref\": \"#/$defs/grader\"\n },\n \"provider\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Which configured inference provider or agent judges an `ai`-graded eval. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Model that judges an `ai`-graded eval, within `provider`. Legal values are whatever the inference dependency supports, validated at run time; omit for the config default. Two uses: an eval that matters can name a stronger judge than the default, and an eval can name a judge other than the model that produced the session it grades - a model asked whether its own session followed the rules is the sharpest form of self-preference bias there is. Meaningful only on `ai` evals.\"\n },\n \"runs\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 50,\n \"description\": \"Ensemble runs for this eval, overriding the tool's configured default. Lets a high-stakes or known-flaky assertion buy more agreement than a cheap one, which a corpus-wide setting cannot. Capped because it multiplies cost directly. Meaningful only on `ai` evals.\"\n },\n \"command\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"Command to execute for command-graded evals. {trace} is replaced with the session trace path — the artifact-side analog of the page side's {file} — and exit 0 (or `success-exit-codes`) is a pass. Omitting it is the generation contract: tooling generates a check script from the assertion, then writes `command` and `generated-assertion-hash` back. Legal only alongside `grader: command`.\"\n },\n \"success-exit-codes\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"integer\"\n },\n \"default\": [\n 0\n ],\n \"description\": \"Exit codes that count as a pass.\"\n },\n \"timeout-ms\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"Timeout for command-graded evals.\"\n },\n \"generated-assertion-hash\": {\n \"type\": \"string\",\n \"description\": \"sha256 of the assertion when the check script was generated — written back alongside `command`, and never legal without it. A mismatch with the current assertion triggers regeneration.\"\n },\n \"options\": {\n \"type\": \"object\",\n \"description\": \"Grader-specific options; validated by the grader at run time, deliberately outside this schema — a grader's options evolve on the grader's schedule.\"\n },\n \"severity\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"weight\": {\n \"type\": \"number\",\n \"exclusiveMinimum\": 0,\n \"default\": 1,\n \"description\": \"Relative contribution to an aggregate score across evals. Does not change this eval's own pass/fail, nor its severity: an eval still passes or fails on its own terms, and weight only decides how much that outcome moves a run total. Zero is excluded deliberately - a weightless eval is a silent disable, and `skip` already means that, loudly.\"\n },\n \"severity-map\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/severity\"\n },\n \"description\": \"Maps a tool grader's own severities onto eval severities. Meaningful only on `tool:*` evals — imported from the page side to keep the entry vocabularies congruent.\"\n },\n \"skip\": {\n \"type\": \"boolean\"\n },\n \"evidence\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Hint telling the judge where in the session to look.\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/target\"\n },\n \"examples\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pass\": {\n \"$ref\": \"#/$defs/anchorList\"\n },\n \"fail\": {\n \"$ref\": \"#/$defs/anchorList\"\n }\n },\n \"description\": \"Anchor examples of passing and failing behavior for the judge — one or several each.\"\n }\n },\n \"additionalProperties\": false,\n \"dependentRequired\": {\n \"generated-assertion-hash\": [\n \"command\"\n ]\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"not\": {\n \"required\": [\n \"grader\"\n ]\n }\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ],\n \"description\": \"No grader means the `ai` default, so the assertion the judge reads is required.\"\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"human\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"required\": [\n \"assertion\"\n ]\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ]\n },\n \"then\": {\n \"anyOf\": [\n {\n \"required\": [\n \"assertion\"\n ]\n },\n {\n \"required\": [\n \"command\"\n ]\n }\n ],\n \"description\": \"A command eval carries either the assertion its script is generated from, or the command itself - the generation contract writes the second from the first.\"\n }\n },\n {\n \"if\": {\n \"required\": [\n \"command\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"An entry carrying an executable command must say grader: command.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"success-exit-codes\"\n ]\n },\n {\n \"required\": [\n \"timeout-ms\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"command\"\n }\n },\n \"required\": [\n \"grader\"\n ],\n \"description\": \"success-exit-codes and timeout-ms configure command execution, so they are legal only alongside grader: command — present, or generated later under the generation contract.\"\n }\n },\n {\n \"if\": {\n \"anyOf\": [\n {\n \"required\": [\n \"provider\"\n ]\n },\n {\n \"required\": [\n \"model\"\n ]\n },\n {\n \"required\": [\n \"runs\"\n ]\n }\n ]\n },\n \"then\": {\n \"properties\": {\n \"grader\": {\n \"const\": \"ai\"\n }\n },\n \"description\": \"provider, model and runs configure the AI judge, so they are legal only on an `ai` eval. `grader` is not required alongside them because `ai` is the default.\"\n }\n }\n ]\n },\n \"evalType\": {\n \"enum\": [\n \"capability\",\n \"regression\"\n ],\n \"default\": \"regression\",\n \"description\": \"`capability` probes a boundary and is expected to fail sometimes; `regression` protects behavior that already works. Reported, not enforced.\"\n },\n \"severity\": {\n \"enum\": [\n \"error\",\n \"warning\",\n \"notice\"\n ],\n \"default\": \"error\",\n \"description\": \"Only error-severity failures fail the eval; warning and notice report but pass. The three levels are the family scale in manni's shared severity, so a finding reads the same in every tool. Default error — the string shorthand implies it.\"\n },\n \"grader\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"pattern\": \"^(tool:)?[a-z0-9][a-z0-9-]*$\"\n },\n {\n \"enum\": [\n \"ai\",\n \"human\",\n \"command\",\n \"tool-usage\",\n \"skill-invoked\",\n \"file-access\",\n \"turn-count\",\n \"cost\",\n \"regex\",\n \"json-output\",\n \"tool-order\"\n ]\n }\n ],\n \"default\": \"ai\",\n \"description\": \"How the assertion is checked: the AI judge (`ai`); a human review queue (`human` — judged per session, since every trace is new, unlike the page side where a verdict persists until the page changes); an executable check over the trace (`command`); a deterministic session grader — `tool-usage`, `tool-order`, `skill-invoked`, `file-access`, `turn-count`, `cost`, `regex`, `json-output`; or a `tool:<kebab>` integration, the page side's namespace, accepted here so one grader spelling ports across both eval vocabularies. Recommended values, not a closed list: any kebab name is legal and validated against the grader registry at run time, so a new grader never needs a schema version — the one cost is that a stale or misspelled grader name passes this schema and is rejected by the registry instead.\"\n },\n \"anchorList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One anchor example, or a non-empty list of them.\"\n },\n \"target\": {\n \"if\": {\n \"type\": \"object\"\n },\n \"then\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"source\",\n \"path\"\n ],\n \"properties\": {\n \"source\": {\n \"const\": \"file\"\n },\n \"path\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Path to the file to grade, relative to the session's working directory.\"\n }\n }\n },\n \"else\": {\n \"enum\": [\n \"transcript\",\n \"last-message\",\n \"files\",\n \"artifact\"\n ]\n },\n \"default\": \"transcript\",\n \"description\": \"What the grader receives: the whole session (`transcript`), the final assistant message (`last-message`), the list of files the session wrote (`files`), the instruction artifact itself (`artifact`), or a named file. Distinct from `evidence`, which hints where to look within what is graded - this selects the bytes themselves, and it is structural, so deterministic graders honour it too. Named `target` rather than `focus` for that reason: a regex grader has no focus, it has a target. Branched with if/then rather than oneOf so a fault inside the object form is reported once, against the key that is wrong.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:artifact-evals-strict:1.1.0\",\n \"title\": \"manni artifact-evals strict overlay v1.1.0\",\n \"description\": \"The strict overlay for manni:artifact-evals:1.1.0. Stack it beside the open vocabulary, which owns every key, every required rule and every conditional. Inside `metadata`, it narrows provider and model names, exit codes, companion paths and the assertion hash as manni:evals-strict:1.0.0 does. It also closes `grader` to the named graders and `tool:` integrations.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"metadata\": {\n \"description\": \"Strict narrows the object entries of `metadata.evals`. A string shorthand passes as the open vocabulary reads it, and every other member of `metadata` passes untouched.\",\n \"properties\": {\n \"evals\": {\n \"items\": {\n \"$ref\": \"#/$defs/entry\"\n }\n },\n \"meta-provenance\": {\n \"description\": \"Strict holds each entry to the rules the ai-context overlay applies to the same shape. `generated-by` is a model id with no spaces, and each pointer is well formed.\",\n \"items\": {\n \"properties\": {\n \"generated-by\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"fields\": {\n \"items\": {\n \"pattern\": \"^(?:/(?:[^~/]|~[01])*)+$\",\n \"description\": \"A JSON Pointer in which every `~` begins an RFC 6901 escape, `~0` or `~1`.\"\n }\n },\n \"confidence\": {\n \"propertyNames\": {\n \"pattern\": \"^(?:(?:/(?:[^~/]|~[01])*)+|[a-z0-9][a-z0-9-]*)$\",\n \"description\": \"A well-formed JSON Pointer, or a kebab eval id.\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"$defs\": {\n \"entry\": {\n \"description\": \"The rules strict adds to an object entry.\",\n \"properties\": {\n \"grader\": {\n \"anyOf\": [\n {\n \"enum\": [\n \"ai\",\n \"human\",\n \"command\",\n \"tool-usage\",\n \"skill-invoked\",\n \"file-access\",\n \"turn-count\",\n \"cost\",\n \"regex\",\n \"json-output\",\n \"tool-order\"\n ]\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^tool:[a-z0-9][a-z0-9-]*$\"\n }\n ],\n \"description\": \"One of the eleven named graders, or a `tool:<kebab>` integration. Strict accepts no other kebab name.\"\n },\n \"provider\": {\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"description\": \"A kebab provider name, such as `anthropic` or `llama-cpp`.\"\n },\n \"model\": {\n \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9._:/\\\\\\\\@-]*$\",\n \"description\": \"A model id of letters in either case, digits, `.`, `_`, `:`, `/`, `\\\\`, `@` and `-`, with no spaces. A Windows path to a local model passes.\"\n },\n \"success-exit-codes\": {\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 255\n },\n \"description\": \"Distinct exit codes, each from 0 to 255, the range a process can return.\"\n },\n \"target\": {\n \"properties\": {\n \"path\": {\n \"pattern\": \"^(?![\\\\\\\\/~])(?![A-Za-z]:)(?![A-Za-z][A-Za-z0-9+.-]*://).+$\",\n \"description\": \"A relative path. It starts with no `/`, `\\\\` or `~`, no drive letter, and no URL scheme.\"\n }\n }\n },\n \"generated-assertion-hash\": {\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"`sha256-` and sixty-four lowercase hex digits.\"\n }\n }\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:stewardship:1.1.0\",\n \"title\": \"manni stewardship vocabulary v1.1.0\",\n \"description\": \"Is this page cared for? This vocabulary covers attribution, ownership, review, the document's own dates, and the anchors that make drift detectable. Every field records a fact a person asserts about the document, not one a tool reads off the file. That is why `created`, `last-updated` and `authors` are here. Git records when a path changed and who committed the change, not when the document was written or who wrote it. Those part company at every migration, split, squashed import, typo fix and bulk frontmatter sweep. A published page carries no repo, so a stamped date travels with the document where a derived one cannot. The cost is that a hand-typed `last-updated` goes stale quietly, and no JSON Schema can catch that. The review dates are records, not freshness gates. Tooling that can read a clock derives the due date from `last-reviewed` and `review-interval`. Version 1.1.0 adds `x-manni-graph-output: false` to `owner`, `stakeholders` and `reviewed-by`. Those three name people, so a published graph leaves them out: its Turtle, its JSON-LD, its iiRDS package and its search index. Validation is the same as in 1.0.0.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"authors\": {\n \"type\": [\n \"string\",\n \"object\",\n \"array\"\n ],\n \"description\": \"Who wrote the page: a name, a list of names, or the structured person objects MyST and Docusaurus define. Attribution rather than answerability — `owner` is the party on the hook for the page now, and the two part company the moment an author moves on. Not a `stringList`, and not the only field here that isn't: `verified-against` and `source-of-truth` take the same string-or-object-or-list shape, as `entryList`. `authors` keeps its own inline copy rather than sharing that definition, because MyST and Docusaurus claim this key too and the composability law holds it at their loosest published definition, which `entryList`'s uniqueness and member floors go past. List members are names or person objects — never bare numbers or nulls. Never empty in any form: minLength, minItems and minProperties each bind to their own type and are ignored for the others.\",\n \"items\": {\n \"type\": [\n \"string\",\n \"object\"\n ]\n },\n \"minLength\": 1,\n \"minItems\": 1,\n \"minProperties\": 1,\n \"x-manni-location\": \"external\"\n },\n \"owner\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"The person or team answerable for this page — the one required field of every docs-ownership system from Backstage to GitLab. A name, a handle, a chat channel, a team slug, or a list of them; write the spelling people can actually reach. A published graph does not carry it, because it names people.\",\n \"x-manni-location\": \"external\",\n \"x-manni-graph-output\": false\n },\n \"stakeholders\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Who has a stake in this page being right: the feature's engineer, the product owner, the support lead who fields its tickets. The standing parties to consult before changing the page — where `reviewed-by` records who actually did the last pass. Page-level on purpose: the right stakeholders differ page by page, and project-wide ones belong in your project docs, not in every file's frontmatter. A published graph does not carry it, because it names people.\",\n \"x-manni-location\": \"external\",\n \"x-manni-graph-output\": false\n },\n \"reviewed-by\": {\n \"$ref\": \"#/$defs/stringList\",\n \"description\": \"Who last reviewed the page. Named `reviewed-by` rather than `reviewers` because MyST already defines `reviewers` as scholarly person objects. A published graph does not carry it, because it names people.\",\n \"x-manni-location\": \"external\",\n \"x-manni-graph-output\": false\n },\n \"created\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the document was written, as a W3CDTF date. The document's date, not the file's: a page migrated from a CMS, imported from another repo, split out of a longer one, or landed through a squashed history has a path in this repo that is younger than the content it holds, and `git log` can only report the path. Where the two agree, git agreeing is a bonus rather than the source.\",\n \"x-manni-location\": \"external\"\n },\n \"last-updated\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the content last changed in a way a reader would notice, as a W3CDTF date. The editorial fact, not the file's: a commit date also moves for a typo fix, a link sweep, a formatting pass and a bulk frontmatter migration, none of which change what the page says. Distinct from `last-reviewed`, which records the page being checked and found still true — an update changes the content, a review confirms it, and a page can have either without the other. Spelled with the `last-` prefix for exactly the reason `last-reviewed` carries one: both name the most recent instance of a repeating event, and the two read as the pair they are. That also keeps the key clear of every neighbour's spelling of the same fact, which are `lastmod`, `last_update`, `lastUpdated` and `article:modified_time`. A stale value here is the accepted cost of stamping a date instead of deriving one, and a check comparing it against the repo's own last-change date is the tooling answer, not a schema's.\",\n \"x-manni-location\": \"page\"\n },\n \"last-reviewed\": {\n \"$ref\": \"#/$defs/w3cdtf\",\n \"description\": \"When the page was last reviewed, as a W3CDTF date. The field freshness tooling reads to derive review deadlines. A record, not a freshness gate — JSON Schema cannot compare a date to today.\",\n \"x-manni-location\": \"external\"\n },\n \"review-interval\": {\n \"type\": \"string\",\n \"pattern\": \"^P(?:\\\\d+W|(?=\\\\d|T\\\\d)(?:\\\\d+Y)?(?:\\\\d+M)?(?:\\\\d+D)?(?:T(?=\\\\d)(?:\\\\d+H)?(?:\\\\d+M)?(?:\\\\d+S)?)?)$\",\n \"description\": \"How often the page should be reviewed, as an ISO 8601 duration: `P90D`, `P1Y`. ISO rather than `90d` so the value is machine-comparable. With `last-reviewed`, this is everything review tooling needs to derive the due date — a stored due date would only ever agree with them or lie.\",\n \"x-manni-location\": \"external\"\n },\n \"verified-against\": {\n \"$ref\": \"#/$defs/entryList\",\n \"description\": \"The product version, API revision, or spec the content was last verified against. A string is the short spelling — `operator 1.4.2` — and an object the checkable one, such as `{name: operator, version: 1.4.2}`, which a drift check can compare without parsing prose. A list says a page was verified against more than one thing, such as the operator and the cluster it runs on. What turns \\\"reviewed\\\" into \\\"reviewed against something\\\".\",\n \"x-manni-location\": \"external\"\n },\n \"source-of-truth\": {\n \"$ref\": \"#/$defs/entryList\",\n \"description\": \"Where reality lives for this page: a repo path, an API spec, a schema file. A string names it, an object structures it — `{path: charts/operator/values.yaml, kind: helm-values}` — and a list carries several, because a page usually answers to more than one source. The anchor a drift check compares the page against; a page without one cannot be drift-monitored.\",\n \"x-manni-location\": \"external\"\n }\n },\n \"$defs\": {\n \"stringList\": {\n \"if\": {\n \"type\": \"array\"\n },\n \"then\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"else\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"description\": \"One non-empty string, or a non-empty list of unique ones — the same shape as the `labelList` of manni:graph:1.0.0.\"\n },\n \"entryList\": {\n \"type\": [\n \"string\",\n \"object\",\n \"array\"\n ],\n \"items\": {\n \"$comment\": \"The parent's keyword-per-type pattern again, one level down: minLength binds to a string member, minProperties to an object one, and each is ignored for the other. Repeated here rather than hoisted because a member's floor is a different assertion from the whole value's.\",\n \"type\": [\n \"string\",\n \"object\"\n ],\n \"minLength\": 1,\n \"minProperties\": 1\n },\n \"minLength\": 1,\n \"minItems\": 1,\n \"minProperties\": 1,\n \"uniqueItems\": true,\n \"description\": \"One entry, or a non-empty list of unique ones, where an entry is a non-empty string or a non-empty object. The shape `authors` carries, made a definition because two more fields need it: the short human spelling and the structured machine-checkable one, without minting a second field name for the same fact. Object keys are left open on purpose, and the recommendations live in each field's description. Every non-empty floor binds to its own type — minLength for the string, minProperties for the object, minItems and uniqueItems for the list — and `items` repeats the first two, so `\\\"\\\"`, `[]`, `{}`, `[\\\"\\\"]` and `[{}]` all fail. Unlike `authors`, no other schema claims the keys that use this, so the family is free to set that floor.\",\n \"$comment\": \"minLength, minItems, minProperties and uniqueItems each apply to one instance type and are ignored for the others; that is what lets one subschema hold three shapes without an anyOf whose errors name all three branches.\"\n },\n \"w3cdtf\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9](\\\\.[0-9]+)?)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9]))?)?)?$\",\n \"description\": \"A W3CDTF date, permitting reduced precision: `2026`, `2026-08`, `2026-08-23`, or a full timestamp — in which case the timezone designator is required, as the W3CDTF profile itself mandates (no local-time form). Field-ranged (month 01-12, day 01-31, hour 00-23) so an impossible date fails here rather than becoming Invalid Date in the tooling that derives review deadlines; not calendar-exact — February 31 is a reviewer's catch.\"\n }\n }\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:stewardship-strict:1.1.0\",\n \"title\": \"manni stewardship strict overlay v1.1.0\",\n \"description\": \"The strict overlay for manni:stewardship:1.1.0. Stack it beside the open vocabulary. It narrows the form of values the open vocabulary already claims and requires no key.\",\n \"additionalProperties\": true,\n \"type\": \"object\",\n \"properties\": {\n \"authors\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"required\": [\n \"name\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"email\": {\n \"type\": \"string\",\n \"pattern\": \"^[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+$\"\n },\n \"url\": {\n \"type\": \"string\",\n \"pattern\": \"^https?://\\\\S+$\"\n }\n }\n },\n \"description\": \"Strict takes authors as a list of unique entries. A string entry is one line with no surrounding space. A person object names the person, and its `email` and `url` are well formed.\"\n },\n \"owner\": {\n \"$ref\": \"#/$defs/handles\",\n \"description\": \"Strict holds each owner to a handle a GitHub or GitLab CODEOWNERS file accepts, in the string form and the list form alike.\"\n },\n \"stakeholders\": {\n \"$ref\": \"#/$defs/names\",\n \"description\": \"Strict holds each stakeholder to one line with no surrounding space. A stakeholder is a person or team, named in any form.\"\n },\n \"reviewed-by\": {\n \"$ref\": \"#/$defs/names\",\n \"description\": \"Strict holds each reviewer to one line with no surrounding space. `manni meta derive` writes review-API logins and commit-trailer names, so no handle form is required.\"\n },\n \"created\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the creation date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"last-updated\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the update date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"last-reviewed\": {\n \"$ref\": \"#/$defs/date\",\n \"description\": \"Strict holds the review date to an RFC 3339 full date or date-time. A year or month alone fails, and so does a timestamp without seconds.\"\n },\n \"verified-against\": {\n \"required\": [\n \"name\",\n \"version\"\n ],\n \"items\": {\n \"required\": [\n \"name\",\n \"version\"\n ]\n },\n \"description\": \"Strict requires an object entry to carry `name` and `version`, alone or in a list. The version's format stays free, and a string entry is unchanged. The top-level `required` holds the single-object form, and `items` holds each object in a list, since `required` applies only to an object.\"\n },\n \"source-of-truth\": {\n \"$ref\": \"#/$defs/source\",\n \"items\": {\n \"$ref\": \"#/$defs/source\"\n },\n \"description\": \"Strict requires an object entry to carry `path` or `url`, alone or in a list. A string entry is one id, path or URL on one line with no surrounding space. The top-level `$ref` holds the string and single-object forms, and `items` holds each entry in a list, since `required` applies only to an object.\"\n }\n },\n \"$defs\": {\n \"handles\": {\n \"pattern\": \"^(?:@@?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?(?:/[A-Za-z0-9._-]+)*|[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+)$\",\n \"items\": {\n \"pattern\": \"^(?:@@?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?(?:/[A-Za-z0-9._-]+)*|[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+)$\"\n },\n \"description\": \"A handle a CODEOWNERS file accepts, as a string or as each member of a list. That is `@user`, `@org/team`, a GitLab nested group or `@@role`, or an email address.\"\n },\n \"names\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"items\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\"\n },\n \"description\": \"One line with no surrounding space, as a string or as each member of a list.\"\n },\n \"date\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9]))?$\",\n \"description\": \"An RFC 3339 full date, or a date-time with seconds and an offset.\"\n },\n \"source\": {\n \"pattern\": \"^\\\\S(?:.*\\\\S)?$\",\n \"anyOf\": [\n {\n \"required\": [\n \"path\"\n ]\n },\n {\n \"required\": [\n \"url\"\n ]\n }\n ],\n \"description\": \"A source entry. A string is one id, path or URL on one line with no surrounding space. An object carries `path` or `url`.\"\n }\n }\n}\n","/**\n * Resolve the schema *set* for a single file by precedence:\n * 1. CLI --schema overrides (apply to all files)\n * 2. $schema in the file's metadata (string or list)\n * 3. first matching config override (by glob or collection), which replaces\n * the set unless it sets `defaults: true`\n * 4. config `schemas`, joined after the default set unless `defaults: false`\n * 5. the built-in default set (DEFAULT_SCHEMAS)\n * Tiers 3 to 5 then stack strict versions when `strict` is set (proposal 0070).\n */\nimport { isAbsolute, relative, resolve } from \"node:path\";\nimport type {\n DocmetaConfig,\n DocumentRefTrust,\n SchemaEntry,\n SchemaOverride,\n SchemaTrustRoot,\n} from \"./config.js\";\nimport {\n classifyRef,\n isBuiltinId,\n isPublishedBuiltinUrl,\n strictIdOf,\n type RegisteredSchemas,\n type SchemaPin,\n} from \"./schema-registry.js\";\nimport { DocmetaError } from \"../types.js\";\nimport { matchesFileGlob } from \"../../shared/globs.js\";\n\n/**\n * The default set (proposal 0070): what a file is judged by when nothing\n * replaces it, and what `schemas:` joins unless `defaults: false`.\n *\n * Seven-Action constrains `action`, a key documents don't otherwise carry,\n * and requires nothing. Diataxis is deliberately absent: it both requires and\n * constrains `type`, so defaulting it would fail every repo not already on\n * Diataxis. The manni vocabularies follow; core requires `title` and\n * `description`, and nothing else in the set requires anything.\n * Terminology, artifact-evals and every `-strict` overlay stay opt-in.\n */\nexport const DEFAULT_SCHEMAS: readonly string[] = Object.freeze([\n \"google:okf:0.1\",\n \"passo-uno:seven-action:1.0\",\n \"manni:core:1.0.0\",\n \"manni:audience:1.0.0\",\n \"manni:structure:1.0.0\",\n \"manni:stewardship:1.1.0\",\n \"manni:lifecycle:1.0.0\",\n \"manni:ai-context:1.0.0\",\n \"manni:evals:1.0.0\",\n \"manni:graph:1.0.0\",\n \"manni:citations:1.0.0\",\n]);\nexport const FILE_SCHEMA_KEY = \"$schema\";\n\n/**\n * A built-in id's `vendor:name`, its version dropped: what two versions of\n * one vocabulary share. `undefined` for anything but a three-segment id.\n */\nfunction vocabularyOf(id: string): string | undefined {\n const parts = id.split(\":\");\n if (parts.length !== 3) return undefined;\n return `${parts[0] ?? \"\"}:${parts[1] ?? \"\"}`;\n}\n\n/**\n * The default set's vocabularies, by `vendor:name`, for the per-ref lookup in\n * `withStrict`: any version of one of them is paired with its overlay, so a\n * pinned older version keeps the strict version it shipped with.\n */\nconst DEFAULT_VOCABULARIES: ReadonlySet<string> = new Set(\n DEFAULT_SCHEMAS.map(vocabularyOf).filter((v): v is string => v !== undefined),\n);\n\n/**\n * The reference a `schemas:` entry loads, in either form.\n *\n * The ref *string* is what `resolveSchemaSet` returns and therefore what every\n * report names, what every baseline fingerprint is taken over, and what keys\n * `Validator`'s compile cache. Widening those to carry a mapping would have\n * changed all three; the `{source, integrity}` pair travels separately, in\n * the pin map below.\n */\nexport function schemaEntryRef(entry: SchemaEntry): string {\n return typeof entry === \"string\" ? entry : entry.ref;\n}\n\n/**\n * The ref → pin map for a config, for `loadSchema` to consult.\n *\n * Only entries that actually carry `source` or `integrity` are recorded, so a\n * config written entirely in the string form produces an empty map and nothing\n * about how it loads changes.\n *\n * Keyed on the ref exactly as `resolveSchemaSet` will hand it to `loadSchema`,\n * which means this must be built from the **rebased** config — the same\n * absolute spelling on both sides, or the pin silently fails to apply.\n */\nexport function collectSchemaPins(\n config: DocmetaConfig | null | undefined,\n): Map<string, SchemaPin> {\n const pins = new Map<string, SchemaPin>();\n for (const entry of config?.schemas ?? []) {\n if (typeof entry === \"string\") continue;\n if (entry.source === undefined && entry.integrity === undefined) continue;\n pins.set(entry.ref, {\n ...(entry.source !== undefined ? { source: entry.source } : {}),\n ...(entry.integrity !== undefined ? { integrity: entry.integrity } : {}),\n });\n }\n return pins;\n}\n\n/**\n * Re-point a config's **local file** schema refs at the config's own directory.\n *\n * `schemas: [\"./house.schema.json\"]` means the file next to the config; that is\n * what the person editing the config can see. But `loadSchema` reads a file ref\n * relative to the process's working directory, so once the config lives\n * somewhere other than where the command was invoked — via `-c ../x.yaml`, or\n * via discovery finding an ancestor — the same ref points at nothing.\n *\n * Only refs the *config* supplied are rebased. A document's own `$schema` and a\n * `--schema` on the command line were both written by someone standing in the\n * working directory, so they keep resolving from there. Built-in ids and URLs\n * have no base to speak of and pass through untouched.\n *\n * When the config's directory *is* the working directory — every setup that\n * works today — the config object is returned unchanged, so nothing about an\n * existing run moves, right down to the ref strings that appear in reports.\n * The rebased form is absolute rather than relative on purpose: relative would\n * only be correct while `process.cwd()` matched `cwd`, which is true of the CLI\n * but not of `runValidate` called as a library.\n */\nexport function rebaseConfigSchemaRefs(\n config: DocmetaConfig,\n configDir: string,\n cwd: string,\n): DocmetaConfig {\n // Exact string comparison, deliberately. `path.resolve` preserves input\n // casing rather than canonicalizing it, so two differently-cased spellings of\n // the same directory on a case-insensitive filesystem would compare unequal\n // and refs would be rebased to absolute paths needlessly — cosmetic, not\n // incorrect. Lowercasing instead would be wrong on a case-sensitive\n // filesystem, where two casings really are two directories. In practice both\n // values reach here from the same `resolve(cwd)` call site.\n if (resolve(configDir) === resolve(cwd)) return config;\n\n const rebase = (ref: string): string =>\n classifyRef(ref).kind === \"file\" && !isAbsolute(ref)\n ? resolve(configDir, ref)\n : ref;\n\n /**\n * The mapping form rebases its `ref` for the same reason a string does, and\n * its `source` too when that is itself a local path — a schema vendored from\n * a checkout elsewhere on disk names a file the config's author could see,\n * not one the caller's working directory can.\n *\n * A `source` that is a URL passes through `rebase` untouched, so no branch is\n * needed here for it.\n */\n const rebaseEntry = (entry: SchemaEntry): SchemaEntry =>\n typeof entry === \"string\"\n ? rebase(entry)\n : {\n ...entry,\n ref: rebase(entry.ref),\n ...(entry.source !== undefined\n ? { source: rebase(entry.source) }\n : {}),\n };\n\n return {\n ...config,\n ...(config.schemas ? { schemas: config.schemas.map(rebaseEntry) } : {}),\n ...(config.overrides\n ? {\n overrides: config.overrides.map((o) => ({\n ...o,\n schemas: o.schemas.map(rebase),\n })),\n }\n : {}),\n };\n}\n\nexport interface ResolveParams {\n /** File path (relative is fine) used for override glob matching. */\n filePath: string;\n /** `$schema` value pulled from the file's metadata. */\n fileSchema?: unknown;\n /** Repeatable `--schema` values; non-empty means override. */\n cliSchemas?: string[];\n /** Loaded config, if any. */\n config?: DocmetaConfig | null;\n /**\n * Directory a **relative document-supplied** file ref is measured from — the\n * run's `cwd`, matching `LoadSchemaOptions.fileBase`. Only the containment\n * check below reads it; the ref string itself is never rewritten.\n */\n fileBase?: string;\n /**\n * The repository a document-supplied local path may not escape. Supplied by\n * the command cores via `schemaTrustRoot`.\n *\n * **Omitting it skips containment.** The resolver is synchronous and pure,\n * and finding a git root is a filesystem walk — so the root is settled once\n * per run by the caller rather than rediscovered per file. `runValidate` and\n * `runFill` both pass it, and `test/commands.test.ts` proves they do end to\n * end; a library caller that resolves refs itself opts in the same way.\n */\n trustRoot?: SchemaTrustRoot;\n /**\n * Diagnostics for the user. Used by `documentRefs: none`, which must say\n * which document's `$schema` it dropped — discarding input in silence is the\n * failure mode this key exists to remove.\n */\n onNotice?: (message: string) => void;\n /**\n * The collections this file belongs to (proposal 0041), from `memberOf`.\n *\n * What an `overrides[].collection` entry is matched against, in place of the\n * glob match a `files:` entry gets. Absent means the caller decided\n * membership does not apply — a library caller with no config file, or a\n * command that has not resolved it — and a `collection:` override then\n * matches nothing, rather than everything.\n */\n memberOf?: readonly string[];\n}\n\n/**\n * The shared glob matcher, re-exported for the callers that reached it here\n * while it lived in this module. Membership (0041) and override resolution\n * ask the same question, so they share one matcher in `src/shared/globs.ts`.\n */\nexport { matchesFileGlob };\n\n/**\n * An override's `files:` as a list, whatever shape it was written in.\n *\n * The single place the string and list forms collapse. Exported because the\n * two places that *display* a group's globs — the collections exclusion notice\n * and `query`'s split-corpus remedy — need the same list, and a second\n * spelling of \"is it an array?\" scattered across them is how the two forms\n * start disagreeing.\n */\nexport function overrideGlobs(\n files: string | readonly string[] | undefined,\n): readonly string[] {\n if (files === undefined) return [];\n return typeof files === \"string\" ? [files] : files;\n}\n\n/**\n * Does this override govern this file?\n *\n * The one place the two spellings of \"which files\" collapse (0041 rule 8): an\n * entry carries exactly one of `files:` (globs, matched by the shared matcher)\n * or `collection:` (a name, matched against the file's membership). Resolution\n * itself is unchanged — first match wins, in config order — so the two forms\n * are interchangeable at the point of decision and nowhere else.\n */\nexport function overrideMatches(\n override: SchemaOverride,\n filePath: string,\n memberOf: readonly string[],\n): boolean {\n if (override.collection !== undefined) {\n return memberOf.includes(override.collection);\n }\n return (\n override.files !== undefined && matchesFileGlob(filePath, override.files)\n );\n}\n\nfunction coerceFileSchema(value: unknown): string[] | undefined {\n if (value === undefined || value === null) return undefined;\n if (typeof value === \"string\") return [value];\n if (Array.isArray(value) && value.every((v) => typeof v === \"string\")) {\n return value;\n }\n throw new Error(\n `Invalid \"${FILE_SCHEMA_KEY}\": must be a string or a list of strings.`,\n );\n}\n\nfunction dedupe(refs: string[]): string[] {\n return [...new Set(refs)];\n}\n\n/**\n * Does a document-supplied URL name a host the config listed?\n *\n * Both `hostname` (`schemas.example.com`) and `host` (`127.0.0.1:8080`) are\n * compared, so an entry may carry a port or not. Case-insensitive, because DNS\n * is: an allowlist that `Schemas.Example.com` slipped past would be a footgun,\n * not a feature.\n */\nfunction hostAllowed(url: URL, hosts: readonly string[]): boolean {\n const hostname = url.hostname.toLowerCase();\n const host = url.host.toLowerCase();\n return hosts.some((h) => {\n const want = h.trim().toLowerCase();\n return want === hostname || want === host;\n });\n}\n\n/**\n * Refuse a ref this document is not trusted to name.\n *\n * Called **only** from the `fileSchema` branch below, which is the last place\n * that still knows where a ref came from — by the time `loadSchema` sees one it\n * is just a string. Config- and CLI-supplied refs never reach here, in any\n * mode, and that is deliberate: an operator wrote those.\n *\n * Throws `DocmetaError` per ref. `runValidate` and `runFill` both catch it and\n * file it as a per-file `keyword: \"schema\"` finding, so a refusal is **one\n * failing file** (exit 1) annotated on the offending document rather than an\n * aborted run.\n */\nfunction assertDocumentRefAllowed(\n ref: string,\n mode: Exclude<DocumentRefTrust, \"none\">,\n params: ResolveParams,\n): void {\n const { kind } = classifyRef(ref);\n\n // A built-in is bundled with docmeta: it names no host and reads no file, so\n // there is nothing for a document to reach with it. Allowed in every mode —\n // `test/fixtures/schema-ref.md` and the documented \"self-describing document\"\n // pattern both depend on that.\n //\n // A **published** built-in URL (proposal 0009) is the same object under a\n // second name: `loadSchema` aliases it back to the bundled copy before any\n // cache or request, so it too reaches nothing. It is exempted here, above the\n // `kind === \"url\"` block, rather than inside it — because there are two\n // refusals to clear, not one. `documentRefs: \"local\"` rejects any URL outright\n // and never consults `hosts`; `documentRefs: \"any\"` with a non-empty `hosts`\n // rejects a host the operator did not list. An exemption placed inside the url\n // block would clear the second and leave the first, which would make the\n // spelling docmeta itself advertises unusable in the stricter mode.\n //\n // Deliberately narrow: this is an exact-match table lookup, not a host or\n // prefix rule, so any other URL on the same host stays subject to both checks.\n //\n // A registered id (proposal 0070) counts as a built-in for the same reason:\n // the config vouches for the file, and `loadSchema` answers from it before\n // any request, so a registered `https://` id reaches nothing either.\n if (\n kind === \"builtin\" ||\n isPublishedBuiltinUrl(ref) ||\n params.config?.registered?.has(ref) === true\n ) {\n return;\n }\n\n if (kind === \"url\") {\n if (mode === \"local\") {\n throw new DocmetaError(\n `Refusing the \"${FILE_SCHEMA_KEY}\" URL \"${ref}\": schemaTrust.documentRefs is \"local\", so a document may name a built-in id or a schema file inside the repository, but not a URL. Vendor it with \\`manni meta schemas vendor ${ref}\\` and reference the local copy, or put the URL in \\`schemas:\\` where an operator controls it.`,\n );\n }\n const hosts = params.config?.schemaTrust?.hosts;\n if (!hosts || hosts.length === 0) return; // `any` with no list: as before\n let url: URL;\n try {\n url = new URL(ref);\n } catch {\n throw new DocmetaError(\n `Refusing the \"${FILE_SCHEMA_KEY}\" URL \"${ref}\": it cannot be parsed as a URL, so it cannot be checked against schemaTrust.hosts.`,\n );\n }\n if (!hostAllowed(url, hosts)) {\n throw new DocmetaError(\n `Refusing the \"${FILE_SCHEMA_KEY}\" URL \"${ref}\": host \"${url.host}\" is not in schemaTrust.hosts (${hosts.join(\", \")}). Add the host there, or reference a schema the config already names.`,\n );\n }\n return;\n }\n\n // A local path. \"A schema in this project\" is what a document naming one\n // reasonably means — not any file the CI process happens to be able to open.\n // Applies in `any` as well as `local`: containment costs no existing setup a\n // feature, so it is not something a repo should have to opt into.\n //\n // No `trustRoot` means the caller did not settle a boundary; see the field's\n // documentation for why that is the caller's job and not this function's.\n const root = params.trustRoot;\n if (!root) return;\n const abs = resolve(params.fileBase ?? process.cwd(), ref);\n const within = relative(root.dir, abs);\n // `\"\"` is the root directory itself, which is not a file either way.\n // `path.relative` compares case-insensitively on Windows, so a differently\n // cased spelling of an in-repo path is still recognized as inside.\n if (within !== \"\" && !within.startsWith(\"..\") && !isAbsolute(within)) return;\n // The boundary is named by the rule that produced it. Saying \"the config's\n // own directory\" to someone who has no config file sends them looking for a\n // file that is not there, and the `cwd` case is the one where the boundary\n // moves depending on where the command was run — which is worth saying out\n // loud rather than leaving them to infer it.\n const boundary =\n root.source === \"git\"\n ? `the repository root (${root.dir})`\n : root.source === \"config\"\n ? `${root.dir} — no git repository was found, so the config file's own directory is the boundary`\n : `${root.dir} — no git repository and no config file were found, so the directory the command was run from is the boundary`;\n const scope = root.source === \"git\" ? \"the repository\" : \"the project\";\n throw new DocmetaError(\n `Refusing the \"${FILE_SCHEMA_KEY}\" path \"${ref}\": it resolves outside ${boundary}. A document may only name a schema inside ${scope}; a path in \\`schemas:\\` or on \\`--schema\\` is not restricted this way.`,\n );\n}\n\n/** Which precedence level produced a schema set. */\nexport type SchemaSetSource =\n | \"cli\"\n | \"document\"\n | \"override\"\n | \"config\"\n | \"default\";\n\nexport interface ResolvedSchemaSet {\n schemas: string[];\n source: SchemaSetSource;\n /**\n * Which `overrides[]` entry won, when `source` is `\"override\"`. Absent for\n * every other source.\n *\n * Under proposal 0027 this decided collection membership, and so which SQL\n * view a file appeared in. It no longer does: 0041 decides membership from\n * the collection's own globs, independently of which contract judged the\n * file. What still needs the index is `query`'s split-set refusal, which\n * names the override groups a run spans so it can suggest one to re-run\n * over.\n */\n overrideIndex?: number;\n /** Whether the default set was put into this set (proposal 0070). */\n defaults: boolean;\n /** Whether `strict` stacked strict versions into this set. */\n strict: boolean;\n}\n\n/**\n * Stack each default or registered schema's strict version right after it,\n * where one exists (proposal 0070).\n *\n * A default's strict version is a built-in; a registered schema's is\n * registered. Any version of a default vocabulary counts as a default, so a\n * pinned `manni:stewardship:1.0.0` pairs with `manni:stewardship-strict:1.0.0`.\n * Any other schema in the set is left alone, a listed built-in outside the\n * default vocabularies included: a team that wants one closed lists its\n * overlay. Duplicates are then removed, the first kept, so an overlay also\n * listed by hand sits once, after its base.\n *\n * A default id counts as a default however it reached the set. With\n * `defaults: false`, `strict: true` and `schemas: [manni:core:1.0.0]`, the\n * set is core then core-strict: `strict` pairs what the set holds, and\n * `defaults` only decides whether the default set joins it.\n */\nfunction withStrict(\n refs: readonly string[],\n registered: RegisteredSchemas | undefined,\n): string[] {\n const out: string[] = [];\n for (const ref of refs) {\n out.push(ref);\n const strictId = strictIdOf(ref);\n if (strictId === undefined) continue;\n const vocabulary = vocabularyOf(ref);\n const isDefault = vocabulary !== undefined && DEFAULT_VOCABULARIES.has(vocabulary);\n if (isDefault && isBuiltinId(ref) && isBuiltinId(strictId)) out.push(strictId);\n else if (registered?.has(ref) === true && registered.has(strictId)) out.push(strictId);\n }\n return dedupe(out);\n}\n\n/**\n * Drop each built-in another version of which was listed: a listed\n * `manni:stewardship:1.0.0` replaces the default's `1.1.0`, and its overlay\n * the default's overlay, so one vocabulary never judges a page twice.\n */\nfunction withoutReplacedVersions(set: readonly string[], listed: readonly string[]): string[] {\n const explicit = new Set<string>();\n for (const ref of listed) {\n if (!isBuiltinId(ref)) continue;\n explicit.add(ref);\n const strictId = strictIdOf(ref);\n if (strictId !== undefined) explicit.add(strictId);\n }\n const pinned = new Set(\n [...explicit].map(vocabularyOf).filter((v): v is string => v !== undefined),\n );\n return set.filter((ref) => {\n if (explicit.has(ref) || !isBuiltinId(ref)) return true;\n const vocabulary = vocabularyOf(ref);\n return vocabulary === undefined || !pinned.has(vocabulary);\n });\n}\n\n/**\n * One tier's set: the defaults first when `defaults`, then `listed`, with\n * duplicates removed and the first kept, then `strict` applied. A listed\n * version of a built-in replaces the default's version of it.\n */\nfunction joined(\n listed: readonly string[],\n defaults: boolean,\n strict: boolean,\n registered: RegisteredSchemas | undefined,\n): string[] {\n const set = dedupe([...(defaults ? DEFAULT_SCHEMAS : []), ...listed]);\n const paired = strict ? withStrict(set, registered) : set;\n return defaults ? withoutReplacedVersions(paired, listed) : paired;\n}\n\n/**\n * Is this set the default set alone, strict versions included when `strict`\n * applied? The set `query`'s DDL refuses, because it names no schema of the\n * corpus's own to evolve.\n */\nexport function isDefaultSetOnly(resolved: ResolvedSchemaSet): boolean {\n if (!resolved.defaults) return false;\n const own = joined([], true, resolved.strict, undefined);\n return (\n resolved.schemas.length === own.length &&\n resolved.schemas.every((ref) => own.includes(ref))\n );\n}\n\n/**\n * `resolveSchemaSet`, plus the branch that won.\n *\n * The caller needs this to answer one question: if a ref in this set fails to\n * *load*, whose problem is it? A schema the **document** chose is that\n * document's problem and belongs in its own finding. A schema the **operator**\n * configured invalidates every file in the run, so it stays operational and\n * aborts. Without the source those two are indistinguishable by the time a\n * `DocmetaError` comes back from `loadSchema`, and both aborted — which let one\n * contributed document take down validation of every other file.\n *\n * Kept as a separate export rather than widening `resolveSchemaSet`'s return,\n * which is public API and is what every existing caller wants.\n */\nexport function resolveSchemaSetWithSource(\n params: ResolveParams,\n): ResolvedSchemaSet {\n const { filePath, fileSchema, cliSchemas, config } = params;\n\n const registered = config?.registered;\n\n if (cliSchemas && cliSchemas.length > 0) {\n return { schemas: dedupe(cliSchemas), source: \"cli\", defaults: false, strict: false };\n }\n\n const fromFile = coerceFileSchema(fileSchema);\n if (fromFile && fromFile.length > 0) {\n // The one branch a trust boundary can be applied in. `none` drops the refs\n // and falls through to the levels below; the other two modes vet each ref\n // and throw on the first they refuse.\n const mode = config?.schemaTrust?.documentRefs ?? \"any\";\n if (mode === \"none\") {\n params.onNotice?.(\n `${filePath}: \"${FILE_SCHEMA_KEY}\" is ignored (${fromFile.join(\", \")}) — schemaTrust.documentRefs is \"none\", so the schema set comes from the config instead. Remove the key from the document, or set schemaTrust.documentRefs to \"local\" or \"any\" to honor it.`,\n );\n } else {\n for (const ref of fromFile) assertDocumentRefAllowed(ref, mode, params);\n return { schemas: dedupe(fromFile), source: \"document\", defaults: false, strict: false };\n }\n }\n\n // An override replaces the set unless it sets `defaults: true`, and never\n // inherits the top-level `schemas`, `defaults` or `strict`.\n if (config?.overrides) {\n const memberOf = params.memberOf ?? [];\n for (const [i, ov] of config.overrides.entries()) {\n if (overrideMatches(ov, filePath, memberOf) && ov.schemas.length > 0) {\n const defaults = ov.defaults === true;\n const strict = ov.strict === true;\n return {\n schemas: joined(ov.schemas, defaults, strict, registered),\n source: \"override\",\n overrideIndex: i,\n defaults,\n strict,\n };\n }\n }\n }\n\n const defaults = config?.defaults !== false;\n const strict = config?.strict === true;\n\n if (config?.schemas && config.schemas.length > 0) {\n return {\n schemas: joined(config.schemas.map(schemaEntryRef), defaults, strict, registered),\n source: \"config\",\n defaults,\n strict,\n };\n }\n\n // `defaults: false` with no `schemas` is refused when a config file is\n // parsed; a config built in code that says it gets the empty set it asked\n // for.\n return {\n schemas: joined([], defaults, strict, registered),\n source: defaults ? \"default\" : \"config\",\n defaults,\n strict,\n };\n}\n\nexport function resolveSchemaSet(params: ResolveParams): string[] {\n return resolveSchemaSetWithSource(params).schemas;\n}\n\n/**\n * The `elements:` paths that apply to one file.\n *\n * Accumulating, not first-match-wins. `schemas:` replaces because a schema set\n * is a complete statement about how a file is judged; `elements:` is a list of\n * extra places to look, so the repo-wide list and every matching override all\n * contribute. An override that silently dropped the repo-wide paths would turn\n * adding a directory rule into losing checks elsewhere.\n */\nexport function resolveElements(\n filePath: string,\n config: DocmetaConfig | null | undefined,\n memberOf: readonly string[] = [],\n): string[] {\n const out: string[] = [];\n if (config?.elements) out.push(...config.elements);\n for (const ov of config?.overrides ?? []) {\n if (ov.elements && overrideMatches(ov, filePath, memberOf)) {\n out.push(...ov.elements);\n }\n }\n return dedupe(out);\n}\n","/**\n * Shared front matter extractor, used by the Markdown, MDX, AsciiDoc, and\n * reStructuredText formats. Three fenced flavors are supported, matching Vale\n * (the `adrg/frontmatter` convention):\n *\n * - YAML — fenced by `--- … ---` (or `...` close).\n * - TOML — fenced by `+++ … +++`.\n * - JSON — fenced by `;;; … ;;;`, with a JSON object inside.\n *\n * Every flavor is the same-shape fenced block (open fence on line 1, content\n * from line 2, matching close fence), so we split them uniformly and only the\n * inner parse differs. YAML and JSON are parsed with the `yaml` AST + a\n * LineCounter to recover a JSON-Pointer -> source-line map (JSON is a strict\n * subset of YAML, so the same walk gives per-key and per-array-item lines for\n * free). TOML is parsed with `smol-toml` for native typing, with a best-effort\n * top-level-key line scan.\n */\nimport { parseDocument, LineCounter, isMap, isSeq, isScalar } from \"yaml\";\nimport { parse as parseToml } from \"smol-toml\";\nimport { isoDateValue } from \"./date-value.js\";\nimport type { ExtractedMetadata, FrontmatterFlavor } from \"../types.js\";\n\ntype Flavor = FrontmatterFlavor;\n\n/** Any recognized opening fence, for the adoc/rst delegation gate. */\nconst OPEN_FENCE = /^(?:---|\\+\\+\\+|;;;)\\r?\\n/;\n\ninterface Fence {\n open: RegExp;\n flavor: Flavor;\n isClose(line: string): boolean;\n}\n\nconst FENCES: Fence[] = [\n { open: /^---\\r?\\n/, flavor: \"yaml\", isClose: (l) => l === \"---\" || l === \"...\" },\n { open: /^\\+\\+\\+\\r?\\n/, flavor: \"toml\", isClose: (l) => l === \"+++\" },\n { open: /^;;;\\r?\\n/, flavor: \"json\", isClose: (l) => l === \";;;\" },\n];\n\n/**\n * Character offsets bracketing the leading fenced block, measured against the\n * *original* content — BOM included, CRLF intact. Writing metadata back is a\n * surgical splice of `[innerStart, innerEnd)`, so everything outside that range\n * (the BOM, both fences, the whole body, the file's final-newline state) is\n * preserved byte for byte by construction rather than by careful reassembly.\n */\nexport interface FrontmatterLocation {\n /** Which flavor the opening fence selected. */\n flavor: Flavor;\n /** Offset of the opening fence's first char (1 when a BOM precedes it). */\n openStart: number;\n /** Offset just past the opening fence's terminator == start of inner text. */\n innerStart: number;\n /** Offset of the closing fence line's first char == end of inner text. */\n innerEnd: number;\n /** Offset just past the closing fence's terminator (or EOF). */\n closeEnd: number;\n /** Line terminator of the opening fence line — the block's EOL on re-emission. */\n eol: \"\\n\" | \"\\r\\n\";\n /** 1-based file line of the first content line (always 2). */\n firstContentLine: number;\n}\n\n/** Strip a leading BOM; it stays part of line 1 and doesn't shift line numbers. */\nfunction stripBom(content: string): string {\n return content.charCodeAt(0) === 0xfeff ? content.slice(1) : content;\n}\n\n/** True when the content opens with a recognized front matter fence. */\nexport function hasFrontmatterFence(content: string): boolean {\n return OPEN_FENCE.test(stripBom(content));\n}\n\n/**\n * Locate the leading fenced front matter block, if any. Returns null when there\n * is no opening fence *or* no matching closing fence — an unterminated fence is\n * not front matter (see the rst extractor, which relies on that distinction).\n */\nexport function locateFrontmatter(content: string): FrontmatterLocation | null {\n const bom = content.charCodeAt(0) === 0xfeff ? 1 : 0;\n const body = bom === 1 ? content.slice(1) : content;\n const fence = FENCES.find((f) => f.open.test(body));\n if (!fence) return null;\n\n // The open regexes all require a terminator, so this newline always exists.\n const openNl = body.indexOf(\"\\n\");\n const eol = openNl > 0 && body.charCodeAt(openNl - 1) === 13 ? \"\\r\\n\" : \"\\n\";\n const innerStart = openNl + 1;\n\n let cursor = innerStart;\n while (cursor <= body.length) {\n const nl = body.indexOf(\"\\n\", cursor);\n const hasNl = nl !== -1;\n const lineEnd = hasNl ? nl : body.length;\n const hadCr = lineEnd > cursor && body.charCodeAt(lineEnd - 1) === 13;\n const line = body.slice(cursor, hadCr ? lineEnd - 1 : lineEnd);\n if (fence.isClose(line)) {\n return {\n flavor: fence.flavor,\n openStart: bom,\n innerStart: innerStart + bom,\n innerEnd: cursor + bom,\n closeEnd: (hasNl ? lineEnd + 1 : lineEnd) + bom,\n eol,\n firstContentLine: 2,\n };\n }\n if (!hasNl) break;\n cursor = lineEnd + 1;\n }\n return null;\n}\n\n/**\n * The block's inner text, LF-normalized with the final terminator removed —\n * byte-identical to what the parsers have always received, which is what lets\n * `extractFrontmatter` sit on top of the locator with no behavior change.\n */\nexport function frontmatterInnerText(\n content: string,\n loc: FrontmatterLocation,\n): string {\n return content\n .slice(loc.innerStart, loc.innerEnd)\n .replace(/\\r\\n/g, \"\\n\")\n .replace(/\\n$/, \"\");\n}\n\n// Re-exported so `asciidoc` and `rst` keep one import site while the\n// implementations live with the other pointer helpers, where `html` and `xml`\n// can share them instead of each keeping a copy.\nexport {\n escapePointerSegment,\n positionForFactory as lineForFactory,\n} from \"./pointer.js\";\nimport { escapePointerSegment, positionForFactory } from \"./pointer.js\";\n\n/** Build a JSON-Pointer -> 1-based file line map from a parsed YAML/JSON block. */\nfunction buildLineMap(\n doc: ReturnType<typeof parseDocument>,\n lc: LineCounter,\n prefixLines: number,\n): Map<string, number> {\n const map = new Map<string, number>();\n // Root pointer maps to the opening fence line (block start).\n map.set(\"\", 1);\n\n const lineAt = (offset: number | undefined): number | undefined =>\n offset == null ? undefined : lc.linePos(offset).line + prefixLines;\n\n const walk = (node: unknown, pointer: string): void => {\n if (isMap(node)) {\n for (const pair of node.items) {\n const key = isScalar(pair.key)\n ? String(pair.key.value)\n : String(pair.key);\n const ptr = `${pointer}/${escapePointerSegment(key)}`;\n // `| null` in the asserted type, not decoration: `yaml` types a\n // Pair's key as nullable, and asserting it away would make the `?.`\n // below read as dead code while the null it guards is still reachable.\n const line = lineAt(\n (pair.key as { range?: [number, number, number] } | null)?.range?.[0],\n );\n if (line != null) map.set(ptr, line);\n if (pair.value) walk(pair.value, ptr);\n }\n } else if (isSeq(node)) {\n node.items.forEach((item, i) => {\n const ptr = `${pointer}/${i}`;\n // `| null` for the same reason as the Pair key above.\n const line = lineAt(\n (item as { range?: [number, number, number] } | null)?.range?.[0],\n );\n if (line != null) map.set(ptr, line);\n walk(item, ptr);\n });\n }\n };\n\n if (doc.contents) walk(doc.contents, \"\");\n return map;\n}\n\n// A top-level TOML key assignment — bare (`key = …`) or simply quoted\n// (`\"my key\" = …` / `'my-key' = …`) — or a `[table]` / `[[array of tables]]`\n// header. Dotted keys and basic-quoted keys containing escape sequences are not\n// matched (best-effort: they fall back to the block's opening line).\nconst TOML_KEY = /^\\s*(?:([A-Za-z0-9_-]+)|\"([^\"\\\\]*)\"|'([^']*)')\\s*=/;\nconst TOML_TABLE = /^\\s*\\[\\[?\\s*([A-Za-z0-9_-]+)/;\n\n/**\n * Best-effort TOML line map: `smol-toml` returns a plain object without\n * positions, so scan the raw block for top-level `key =` assignments and\n * `[table]` / `[[array of tables]]` headers. Only keys in the root-table context are\n * top-level pointers — once a table header appears, subsequent `key =` lines are\n * nested under it, so they are not recorded as top-level keys (that would\n * mis-attribute e.g. `[meta]\\ntitle = …` to the root `/title`). Nested pointers\n * resolve to the nearest recorded ancestor via `lineForFactory`.\n */\nfunction buildTomlLineMap(raw: string, prefixLines: number): Map<string, number> {\n const map = new Map<string, number>();\n map.set(\"\", 1);\n // First occurrence wins; record a pointer only if not already seen.\n const record = (key: string, i: number): void => {\n const ptr = `/${escapePointerSegment(key)}`;\n if (!map.has(ptr)) map.set(ptr, i + 1 + prefixLines);\n };\n\n let inRootTable = true;\n raw.split(\"\\n\").forEach((line, i) => {\n const table = TOML_TABLE.exec(line);\n if (table?.[1] != null) {\n // A `[table]` / `[[array of tables]]` header: record it, then leave root\n // context — every following `key =` belongs to a table, not the root.\n record(table[1], i);\n inRootTable = false;\n return;\n }\n if (!inRootTable) return;\n const km = TOML_KEY.exec(line);\n // Group 1 = bare key, 2 = basic-quoted, 3 = literal-quoted.\n const key = km?.[1] ?? km?.[2] ?? km?.[3];\n if (key != null) record(key, i);\n });\n return map;\n}\n\n/**\n * Coerce a parsed document root to the metadata object shape. An empty document\n * (`null`/`undefined`) is treated as no metadata (`{}`). A scalar or array root\n * is malformed frontmatter — metadata is a key/value object — so it throws,\n * uniformly across flavors. `label` names the flavor for the error message.\n */\nfunction rootObject(parsed: unknown, label: string): Record<string, unknown> {\n if (parsed == null) return {};\n if (typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n throw new Error(`Invalid ${label} frontmatter: root must be an object`);\n}\n\nfunction parseYamlBlock(\n raw: string,\n prefixLines: number,\n format: string,\n): ExtractedMetadata {\n const lc = new LineCounter();\n const doc = parseDocument(raw, { lineCounter: lc });\n if (doc.errors.length > 0) {\n const e = doc.errors[0];\n // Surface as a thrown error; the command layer records it as a per-file\n // failure so the rest of the run continues.\n throw new Error(`Invalid YAML frontmatter: ${e?.message ?? \"parse error\"}`);\n }\n const data = rootObject(doc.toJS({ maxAliasCount: 100 }) as unknown, \"YAML\");\n const map = buildLineMap(doc, lc, prefixLines);\n return { data, present: true, format, lineFor: positionForFactory(map) };\n}\n\nfunction emptyBlock(format: string): ExtractedMetadata {\n // An empty fenced block is present with no data (parity with empty YAML).\n const map = new Map<string, number>([[\"\", 1]]);\n return { data: {}, present: true, format, lineFor: positionForFactory(map) };\n}\n\nfunction parseJsonBlock(\n raw: string,\n prefixLines: number,\n format: string,\n): ExtractedMetadata {\n if (raw.trim() === \"\") return emptyBlock(format);\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n throw new Error(\n `Invalid JSON frontmatter: ${e instanceof Error ? e.message : \"parse error\"}`,\n );\n }\n // Thrown outside the try so its message isn't re-wrapped as a parse error.\n const data = rootObject(parsed, \"JSON\");\n // JSON is a strict subset of YAML: reuse the YAML AST purely for the line map.\n const lc = new LineCounter();\n const doc = parseDocument(raw, { lineCounter: lc });\n const map = buildLineMap(doc, lc, prefixLines);\n return { data, present: true, format, lineFor: positionForFactory(map) };\n}\n\n/**\n * Replace TOML's native dates with the strings they were authored as.\n *\n * TOML is the only flavor with a real date type: `date = 2026-06-25` parses to\n * a `Date`, where the same line under a YAML or JSON fence yields a string. A\n * schema sees the parsed value, so without this a field typed `\"string\"` —\n * OKF's `timestamp`, Hugo's `date` and `lastmod` — rejects the *unquoted*\n * spelling, which is the idiomatic one, and accepts only the quoted one.\n *\n * The per-value spelling is `isoDateValue`, shared with `schemas infer` so the\n * two cannot disagree about what a `Date` looks like as JSON.\n *\n * Recursive, because a date can sit inside a `[table]` or an array.\n */\nfunction withoutNativeDates(value: unknown): unknown {\n if (value instanceof Date) return isoDateValue(value);\n if (Array.isArray(value)) return value.map(withoutNativeDates);\n if (value !== null && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, withoutNativeDates(v)]),\n );\n }\n return value;\n}\n\nfunction parseTomlBlock(\n raw: string,\n prefixLines: number,\n format: string,\n): ExtractedMetadata {\n if (raw.trim() === \"\") return emptyBlock(format);\n let parsed: unknown;\n try {\n parsed = parseToml(raw);\n } catch (e) {\n throw new Error(\n `Invalid TOML frontmatter: ${e instanceof Error ? e.message : \"parse error\"}`,\n );\n }\n // A valid TOML document is always a table, but stay uniform with the others.\n const data = rootObject(withoutNativeDates(parsed), \"TOML\");\n const map = buildTomlLineMap(raw, prefixLines);\n return { data, present: true, format, lineFor: positionForFactory(map) };\n}\n\n/** Core front matter extraction shared by the markdown, mdx, adoc, rst formats. */\nexport function extractFrontmatter(\n content: string,\n format: string,\n): ExtractedMetadata {\n const loc = locateFrontmatter(content);\n if (!loc) {\n return { data: {}, present: false, format, lineFor: () => undefined };\n }\n\n const raw = frontmatterInnerText(content, loc);\n const prefixLines = loc.firstContentLine - 1;\n // `fenced` is stamped here, the one place that just located a complete\n // block — a per-extraction fact, not an extractor capability: RST and\n // AsciiDoc reach their native-header fallbacks through their own extract()\n // and never pass this point for those files.\n switch (loc.flavor) {\n case \"yaml\":\n return { ...parseYamlBlock(raw, prefixLines, format), fenced: true };\n case \"json\":\n return { ...parseJsonBlock(raw, prefixLines, format), fenced: true };\n case \"toml\":\n return { ...parseTomlBlock(raw, prefixLines, format), fenced: true };\n }\n}\n","/**\n * The JSON spelling of a parsed date.\n *\n * Two callers need this and they need it to agree. TOML is the only front\n * matter flavor with a real date type, so `date = 2026-06-25` reaches us as a\n * `Date` where the identical line under a YAML or JSON fence yields a string —\n * and both the extractor (which hands values to a schema) and `schemas infer`\n * (which reports the JSON type it saw) have to render that `Date` the same way,\n * or a field is a string in one and something else in the other.\n *\n * `smol-toml` returns a `TomlDate`, whose `toISOString` round-trips the form the\n * author wrote rather than widening it: a local date stays `YYYY-MM-DD` instead\n * of becoming a datetime, and an offset is restored rather than rewritten to\n * `Z`. That is what lets `format: \"date\"` still match a date.\n *\n * Its own module rather than a copy in each caller, for the reason `patch-util`\n * gives for `deepEqual`: a second copy is a second chance for the two to\n * disagree, and the disagreement would be silent.\n */\n\n/** A `Date` as its authored ISO string; any other value unchanged. */\nexport function isoDateValue(value: unknown): unknown {\n if (!(value instanceof Date)) return value;\n // An invalid date cannot reach here from `parseToml`, which throws first, but\n // `toISOString` throws on NaN — so fall back to the \"Invalid Date\" spelling\n // rather than letting an exception escape a parser.\n return Number.isNaN(value.getTime()) ? String(value) : value.toISOString();\n}\n","/**\n * JSON Pointer helpers shared by every extractor.\n *\n * These lived in `frontmatter.ts` and were imported from there by `asciidoc`\n * and `rst`, while `html` and `xml` each carried a byte-identical private copy\n * — three implementations of two functions, and nothing keeping them in step.\n * Adding the column map made that concrete: the same fix would have had to be\n * applied in three places, and a reader had no way to tell which copy was\n * canonical.\n *\n * A pointer is not a frontmatter concept, so this is their home rather than\n * that one.\n */\n\n/**\n * Escape one JSON Pointer segment, per RFC 6901.\n *\n * `~` first, or the `/` replacement's `~1` would be re-escaped to `~01`.\n */\nexport function escapePointerSegment(key: string): string {\n return key.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n\n/**\n * Build a pointer -> position lookup over one map.\n *\n * Position-agnostic on purpose: a line map and a column map share exactly one\n * resolution rule, so they cannot drift into answering from different nodes and\n * pair a line from one place with a column from another.\n *\n * Three steps, in order: a bare top-level key is normalized to its pointer, an\n * exact hit wins, and otherwise it walks up to the nearest recorded ancestor —\n * Ajv reports nested pointers like `/tags/0` for a value the extractor recorded\n * only at `/tags`. The document root is the last resort.\n */\nexport function positionForFactory(\n map: ReadonlyMap<string, number>,\n): (pointer: string) => number | undefined {\n return (pointer: string) => {\n // A bare top-level key (e.g. \"type\") maps to its \"/type\" JSON pointer.\n const start =\n pointer !== \"\" && !pointer.startsWith(\"/\")\n ? `/${escapePointerSegment(pointer)}`\n : pointer;\n if (map.has(start)) return map.get(start);\n let p = start;\n while (p.length > 0) {\n const idx = p.lastIndexOf(\"/\");\n if (idx < 0) break;\n p = p.slice(0, idx);\n if (map.has(p)) return map.get(p);\n }\n return map.get(\"\");\n };\n}\n","/**\n * Front matter write-back, the inverse of `extractFrontmatter`.\n *\n * The whole design rests on one idea: splice only the characters *between* the\n * fences. `locateFrontmatter` gives offsets into the original content, so the\n * BOM, both fences, the entire document body, and the file's final-newline state\n * survive byte for byte by construction rather than by careful reassembly.\n *\n * Per flavor the merge differs, because the fidelity hazards differ:\n *\n * - YAML splices the root mapping's text with the primitives the manifest\n * writer uses (`../core/yaml-splice.ts`). A replaced key's value is\n * rewritten in place, a new key goes after the last one, and a deleted\n * key's lines go. Every key the write does not name keeps its bytes, so a\n * flow list is not padded and a multi-line value is not joined.\n * - TOML splices one key's line span at a time. Re-emitting the block through\n * `smol-toml` would delete every comment and silently rewrite untouched\n * values (`2026-06-25T10:00:00Z` becomes `2026-06-25T10:00:00.000Z`), which\n * is exactly the corruption this module exists to prevent.\n * - JSON re-emits wholesale: it has no comments to lose, and a spread keeps key\n * order, so a surgical splice would buy nothing.\n *\n * Every merge is verified by re-parsing the result and comparing it against the\n * expected data before anything is returned, so a serializer bug becomes a\n * refusal rather than a damaged document.\n */\nimport {\n parseDocument,\n isMap,\n isCollection,\n isScalar,\n type Document,\n type Pair,\n type YAMLMap,\n} from \"yaml\";\nimport { parse as parseToml, stringify as stringifyToml } from \"smol-toml\";\nimport {\n DocmetaError,\n type ApplyOptions,\n type FrontmatterFlavor,\n type MetadataPatch,\n} from \"../types.js\";\nimport {\n hasFrontmatterFence,\n locateFrontmatter,\n frontmatterInnerText,\n} from \"./frontmatter.js\";\nimport { dropUndefined, deepEqual } from \"./patch-util.js\";\nimport { detectJsonIndent } from \"../core/json-text.js\";\nimport {\n blockLines,\n detectEol,\n detectStyle,\n insertKey,\n keyString,\n rangeOf,\n removeKey,\n replaceBlockValue,\n replaceFlowValue,\n type Edit,\n} from \"../core/yaml-splice.js\";\n\nconst FENCE: Record<FrontmatterFlavor, string> = {\n yaml: \"---\",\n toml: \"+++\",\n json: \";;;\",\n};\n\n/**\n * Merge `patch` into the document's leading metadata block and return the new\n * content. Pure: no IO, no mutation, and the input string itself is returned\n * when the patch is a no-op.\n */\nexport function applyFrontmatter(\n content: string,\n patch: MetadataPatch,\n options: ApplyOptions = {},\n): string {\n const loc = locateFrontmatter(content);\n\n // Structural checks run before the empty-patch shortcut, so an empty patch\n // is a usable pre-flight probe for \"can this document be written at all?\".\n // `fill` uses it to avoid paying for inference on a file it could never\n // write. Returning the content unchanged here would report a false all-clear.\n if (!loc && hasFrontmatterFence(content)) {\n // An opening fence with no closing fence is not front matter, so the\n // locator returns null — but prepending a fresh block above a stray `---`\n // would produce two overlapping fences and corrupt the file. Refuse.\n throw new DocmetaError(\n \"Unterminated front matter fence: the opening fence has no matching close. Add a closing fence before filling metadata.\",\n );\n }\n\n const clean = dropUndefined(patch);\n // A key both set and deleted would be ambiguous; the set wins, matching the\n // rule that `patch` is applied and `deletions` removes what remains.\n const deletions = (options.deletions ?? []).filter(\n (k) => !Object.prototype.hasOwnProperty.call(clean, k),\n );\n if (Object.keys(clean).length === 0 && deletions.length === 0) return content;\n\n // No block: nothing to delete from, so deletions are no-ops by contract —\n // only a set may create a block. Without this guard a delete-only call on a\n // block-less document would insert a bare `---\\n---\\n`.\n if (!loc) {\n if (Object.keys(clean).length === 0) return content;\n return createBlock(content, clean, options.newBlockFlavor ?? \"yaml\");\n }\n\n const inner = frontmatterInnerText(content, loc);\n const merged = mergeBlock(loc.flavor, inner, clean, deletions);\n verify(loc.flavor, inner, merged, clean, deletions);\n\n /* c8 ignore next 3 -- defensive: every serializer above emits LF only. */\n if (merged.includes(\"\\r\")) {\n throw new DocmetaError(\"Internal error: serialized front matter contains CR.\");\n }\n const emitted = loc.eol === \"\\r\\n\" ? merged.replace(/\\n/g, \"\\r\\n\") : merged;\n\n return (\n content.slice(0, loc.innerStart) +\n (emitted === \"\" ? \"\" : emitted + loc.eol) +\n content.slice(loc.innerEnd)\n );\n}\n\n/**\n * Remove the fenced front matter block entirely — fences included, plus the\n * single blank separator line that conventionally follows the close. This is\n * not the same as deleting every key, which leaves an empty block behind\n * (`_present` still 1). A document with no located block returns unchanged.\n */\nexport function stripFrontmatter(content: string): string {\n const loc = locateFrontmatter(content);\n if (!loc) return content;\n const bom = content.slice(0, loc.openStart);\n let rest = content.slice(loc.closeEnd);\n if (rest.startsWith(loc.eol)) rest = rest.slice(loc.eol.length);\n return bom + rest;\n}\n\n/**\n * Write-back for formats that *also* have a native metadata syntax (rst\n * docinfo, AsciiDoc document headers). Those native reads are lossy — values\n * are coerced through a YAML scalar parse, and an rst `title` is synthesized\n * from the section heading — so they are not round-trippable. Nor can a fenced\n * block simply be created: a bare `---` is a transition in reStructuredText and\n * an open-block delimiter in AsciiDoc, so inventing one would silently change\n * how the document renders. Write only into a block that already exists.\n */\nexport function applyFencedOnly(\n content: string,\n patch: MetadataPatch,\n options: ApplyOptions | undefined,\n format: string,\n): string {\n // Checked before the empty-patch shortcut so this doubles as a writability\n // probe — see the note in applyFrontmatter.\n if (locateFrontmatter(content) === null) {\n if (hasFrontmatterFence(content)) {\n throw new DocmetaError(\n \"Unterminated front matter fence: the opening fence has no matching close. Add a closing fence before filling metadata.\",\n );\n }\n throw new DocmetaError(\n `This ${format} document has no fenced front matter block; manni can only write fenced front matter for ${format}. Add a fenced block, or set the field manually.`,\n );\n }\n if (\n Object.keys(dropUndefined(patch)).length === 0 &&\n (options?.deletions ?? []).length === 0\n ) {\n return content;\n }\n return applyFrontmatter(content, patch, options);\n}\n// ---------------------------------------------------------------------------\n// Block creation\n// ---------------------------------------------------------------------------\n\nfunction createBlock(\n content: string,\n patch: MetadataPatch,\n flavor: FrontmatterFlavor,\n): string {\n const bom = content.charCodeAt(0) === 0xfeff ? \"\\uFEFF\" : \"\";\n const rest = bom === \"\" ? content : content.slice(1);\n // Take the document's *first* terminator, not any CRLF anywhere in it \\u2014 a\n // stray CRLF inside a pasted code block must not make an otherwise\n // LF-normalized file gain a CRLF front matter block.\n const eol = /\\r\\n|\\n/.exec(rest)?.[0] === \"\\r\\n\" ? \"\\r\\n\" : \"\\n\";\n const fence = FENCE[flavor];\n\n const body = mergeBlock(flavor, \"\", patch);\n verify(flavor, \"\", body, patch);\n\n const block = [fence, ...body.split(\"\\n\"), fence].join(eol) + eol;\n // One blank line between the block and the document, unless the document is\n // empty or already starts with one.\n const gap = rest === \"\" || rest.startsWith(\"\\n\") || rest.startsWith(\"\\r\\n\") ? \"\" : eol;\n return bom + block + gap + rest;\n}\n\n// ---------------------------------------------------------------------------\n// Per-flavor merge\n// ---------------------------------------------------------------------------\n\nfunction mergeBlock(\n flavor: FrontmatterFlavor,\n inner: string,\n patch: MetadataPatch,\n deletions: readonly string[] = [],\n): string {\n switch (flavor) {\n case \"yaml\":\n return mergeYaml(inner, patch, deletions);\n case \"toml\":\n return mergeToml(inner, patch, deletions);\n case \"json\":\n return mergeJson(inner, patch, deletions);\n }\n}\n\n/**\n * Write the patch into a YAML block by splicing the root mapping's text, one\n * key at a time. Each edit re-parses the text it follows, so every range it\n * uses is current. A key the patch does not name keeps its bytes.\n */\nfunction mergeYaml(\n inner: string,\n patch: MetadataPatch,\n deletions: readonly string[] = [],\n): string {\n const parsed = parseYamlBlock(inner);\n const root = parsed.contents;\n if (root != null && !isMap(root)) {\n throw new DocmetaError(\n \"Cannot rewrite front matter: the root must be a mapping.\",\n );\n }\n // A flow mapping at the root (`{ title: T }`) has no lines to add a key to\n // or cut one from, so it is re-emitted whole, as it always was.\n if (isMap(root) && root.flow === true) {\n return reemitYaml(inner, patch, deletions);\n }\n\n let text = inner;\n // The first key reads the parse above; each later one re-parses the text the\n // previous splice left, so every range it uses is current.\n let first: Document | undefined = parsed;\n for (const [key, value] of Object.entries(patch)) {\n const next = spliceYamlKey(text, key, value, first);\n first = undefined;\n // `undefined` is a shape the splice does not edit, such as a key written\n // as an explicit `? key`. The whole block is then re-emitted instead.\n if (next === undefined) return reemitYaml(inner, patch, deletions);\n text = next;\n }\n for (const key of deletions) {\n const next = removeYamlKey(text, key);\n if (next === undefined) return reemitYaml(inner, patch, deletions);\n text = next;\n }\n return text;\n}\n\nfunction parseYamlBlock(text: string): Document {\n const doc = parseDocument(text);\n if (doc.errors.length > 0) {\n throw new DocmetaError(\n `Cannot rewrite invalid YAML front matter: ${doc.errors[0]?.message ?? \"parse error\"}`,\n );\n }\n return doc;\n}\n\n/** The root pair for `key`, or `undefined` when the block has none. */\nfunction rootPair(root: YAMLMap, key: string): Pair | undefined {\n return root.items.find((p) => keyString(p.key) === key);\n}\n\n/** `text` with `key` set to `value`; `undefined` for a shape the splice does not edit. */\nfunction spliceYamlKey(\n text: string,\n key: string,\n value: unknown,\n parsed: Document = parseYamlBlock(text),\n): string | undefined {\n const root = parsed.contents;\n const eol = detectEol(text);\n if (root == null) {\n // An empty block, or one that holds only comments: the key goes last.\n const lines = blockLines({ [key]: value }, 0, { step: 2, indentSeq: true, eol });\n if (text === \"\") return lines;\n // A block that already ends in a line break needs none added before the key.\n return text.endsWith(\"\\n\") ? text + lines : text + eol + lines;\n }\n if (!isMap(root) || root.flow === true) return undefined;\n const style = detectStyle(text, root, eol);\n const pair = rootPair(root, key);\n let edit: Edit | undefined;\n if (pair === undefined) {\n edit = insertKey(text, root, key, value, style);\n } else {\n const old = pair.value;\n const isCollectionValue = value !== null && typeof value === \"object\";\n if (isCollectionValue && isCollection(old) && old.flow === true) {\n // A flow list stays a flow list, padded only if the page padded it.\n // The first two characters say which: `[ ` is padded, `[a` is not, and\n // an empty `[]` is not, which is right, since `[ ]` would be odd.\n const r = rangeOf(old);\n const padded = r !== undefined && /^[[{][ \\t]/.test(text.slice(r[0], r[0] + 2));\n edit = replaceFlowValue(text, pair, value, padded);\n } else if (!isCollectionValue && isScalar(old)) {\n // The old node's style, tag and number format carry over, so a quoted\n // scalar stays quoted. The stringifier still re-quotes when the old\n // style would read back as another type.\n const node = old.clone();\n /* c8 ignore next -- defensive: a Scalar clones to a Scalar. */\n if (!isScalar(node)) return undefined;\n node.value = value;\n node.comment = undefined;\n node.commentBefore = undefined;\n node.spaceBefore = undefined;\n edit = replaceBlockValue(text, pair, node, style);\n } else {\n edit = replaceBlockValue(text, pair, value, style);\n }\n }\n if (edit === undefined) return undefined;\n return text.slice(0, edit.start) + edit.insert + text.slice(edit.end);\n}\n\n/** `text` without `key`; `undefined` for a shape the splice does not edit. */\nfunction removeYamlKey(text: string, key: string): string | undefined {\n const root = parseYamlBlock(text).contents;\n if (!isMap(root)) return text;\n if (root.flow === true) return undefined;\n const pair = rootPair(root, key);\n if (pair === undefined) return text;\n const edit = removeKey(text, pair, detectEol(text));\n if (edit === undefined) return undefined;\n return text.slice(0, edit.start) + text.slice(edit.end);\n}\n\n/**\n * The whole block re-emitted through the `yaml` Document API. It keeps\n * comments, key order and scalar styles, but it lays out every key again.\n * Only the shapes the splice does not edit come here.\n */\nfunction reemitYaml(\n inner: string,\n patch: MetadataPatch,\n deletions: readonly string[],\n): string {\n const doc = parseYamlBlock(inner);\n for (const [key, value] of Object.entries(patch)) {\n if (value !== null && typeof value === \"object\") {\n // Collections must be rebuilt, but carry the previous flow/block style so\n // `tags: [a, b]` doesn't silently become a block sequence.\n const prev = doc.get(key, true);\n const node = doc.createNode(value);\n if (isCollection(prev) && isCollection(node) && prev.flow) node.flow = true;\n doc.set(key, node);\n } else {\n // Raw scalar: takes YAMLMap.add's in-place branch, preserving the\n // existing node's comments and quoting style.\n doc.set(key, value);\n }\n }\n // Deleting through the Document API removes the key's node — and its own\n // comments with it — while every other node stays untouched.\n for (const key of deletions) doc.delete(key);\n // lineWidth: 0 disables folding. The default (80) would wrap long values onto\n // continuation lines, rewriting keys the patch never touched.\n return doc.toString({ lineWidth: 0 }).replace(/\\n$/, \"\");\n}\n\nfunction mergeJson(\n inner: string,\n patch: MetadataPatch,\n deletions: readonly string[] = [],\n): string {\n const parsed = parseJsonBlockText(inner);\n const indent = detectJsonIndent(inner);\n const merged = Object.fromEntries(\n Object.entries({ ...parsed, ...patch }).filter(\n ([key]) => !deletions.includes(key),\n ),\n );\n return JSON.stringify(merged, null, indent);\n}\n\n// ---------------------------------------------------------------------------\n// TOML: surgical per-key line splicing\n// ---------------------------------------------------------------------------\n\n// A top-level key assignment, bare or simply quoted. Mirrors the reader's\n// TOML_KEY so read and write agree on what \"top-level\" means.\nconst TOML_KEY = /^\\s*(?:([A-Za-z0-9_-]+)|\"([^\"\\\\]*)\"|'([^']*)')\\s*=/;\nconst TOML_TABLE = /^\\s*\\[\\[?\\s*([A-Za-z0-9_-]+)/;\n\ninterface RootAssignment {\n key: string;\n /** Line index of the assignment's first line. */\n start: number;\n /** Line index just past its last line (values may span lines). */\n end: number;\n}\n\n/**\n * Index the root table's key assignments. Once a `[table]` header appears every\n * following assignment belongs to that table, not the root, so scanning stops\n * there — `rootEnd` is where new root keys must be inserted.\n */\nfunction scanRootTable(lines: string[]): {\n assignments: RootAssignment[];\n rootEnd: number;\n} {\n const assignments: RootAssignment[] = [];\n let i = 0;\n for (; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n if (TOML_TABLE.test(line)) break;\n const m = TOML_KEY.exec(line);\n const key = m?.[1] ?? m?.[2] ?? m?.[3];\n if (key == null) continue;\n const end = assignmentEnd(lines, i);\n assignments.push({ key, start: i, end });\n i = end - 1;\n }\n return { assignments, rootEnd: i };\n}\n\n/**\n * Line index just past an assignment starting at `start`. A value continues\n * across lines while brackets/braces are unbalanced or a multi-line string is\n * open, so quotes and `#` comments must be tracked to avoid counting brackets\n * that sit inside them.\n */\nfunction assignmentEnd(lines: string[], start: number): number {\n let depth = 0;\n let multi: string | null = null;\n let i = start;\n for (; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n let j = 0;\n while (j < line.length) {\n if (multi != null) {\n if (line.startsWith(multi, j)) {\n multi = null;\n j += 3;\n } else j++;\n continue;\n }\n if (line.startsWith('\"\"\"', j) || line.startsWith(\"'''\", j)) {\n multi = line.slice(j, j + 3);\n j += 3;\n continue;\n }\n const ch = line[j] ?? \"\";\n if (ch === '\"' || ch === \"'\") {\n j = skipString(line, j, ch);\n continue;\n }\n if (ch === \"#\") break; // comment runs to end of line\n if (ch === \"[\" || ch === \"{\") depth++;\n else if (ch === \"]\" || ch === \"}\") depth--;\n j++;\n }\n if (multi == null && depth <= 0) return i + 1;\n }\n return i;\n}\n\n/** Index just past the string literal opening at `from`. */\nfunction skipString(line: string, from: number, quote: string): number {\n let j = from + 1;\n while (j < line.length) {\n const c = line[j];\n if (quote === '\"' && c === \"\\\\\") {\n j += 2;\n continue;\n }\n j++;\n if (c === quote) break;\n }\n return j;\n}\n\n/** Emit one `key = value` line, rejecting values TOML cannot express inline. */\nfunction emitTomlLine(key: string, value: unknown): string {\n if (value === null) {\n throw new DocmetaError(\n `TOML has no null value; cannot set \"${key}\" in TOML front matter.`,\n );\n }\n if (\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n !(value instanceof Date)\n ) {\n throw new DocmetaError(\n `Cannot write the object value for \"${key}\" into TOML front matter.`,\n );\n }\n const line = stringifyToml({ [key]: value }).trimEnd();\n if (line.includes(\"\\n\") || line.startsWith(\"[\")) {\n throw new DocmetaError(\n `Cannot write the value for \"${key}\" into TOML front matter.`,\n );\n }\n return line;\n}\n\nfunction mergeToml(\n inner: string,\n patch: MetadataPatch,\n deletions: readonly string[] = [],\n): string {\n const lines = inner === \"\" ? [] : inner.split(\"\\n\");\n const { assignments, rootEnd } = scanRootTable(lines);\n const byKey = new Map(assignments.map((a) => [a.key, a]));\n\n // Replace in place, marking replaced spans; collect the rest for appending.\n const replaced = new Map<number, string>();\n const dropped = new Set<number>();\n const appended: string[] = [];\n\n for (const [key, value] of Object.entries(patch)) {\n const line = emitTomlLine(key, value);\n const hit = byKey.get(key);\n if (!hit) {\n appended.push(line);\n continue;\n }\n replaced.set(hit.start, line);\n for (let i = hit.start + 1; i < hit.end; i++) dropped.add(i);\n }\n\n // Deletion is the replacement's degenerate case: the whole span goes,\n // nothing comes back. The same splice discipline keeps comments and every\n // untouched line byte-identical.\n for (const key of deletions) {\n const hit = byKey.get(key);\n if (!hit) continue;\n for (let i = hit.start; i < hit.end; i++) dropped.add(i);\n }\n\n // New keys go at the end of the root table, above any blank lines that\n // separate it from the first `[table]` header.\n let insertAt = rootEnd;\n while (insertAt > 0 && (lines[insertAt - 1] ?? \"\").trim() === \"\") insertAt--;\n\n const out: string[] = [];\n for (let i = 0; i < lines.length; i++) {\n if (i === insertAt) out.push(...appended);\n if (dropped.has(i)) continue;\n out.push(replaced.get(i) ?? lines[i] ?? \"\");\n }\n if (insertAt >= lines.length) out.push(...appended);\n return out.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Verification\n// ---------------------------------------------------------------------------\n\nfunction parseJsonBlockText(text: string): Record<string, unknown> {\n if (text.trim() === \"\") return {};\n const parsed: unknown = JSON.parse(text);\n if (parsed == null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new DocmetaError(\n \"Cannot rewrite front matter: the root must be an object.\",\n );\n }\n return parsed as Record<string, unknown>;\n}\n\n/**\n * Read a block back with its own flavor's parser, for the verification pass.\n *\n * **TOML dates stay native here, unlike on the read path.** `extractFrontmatter`\n * normalizes a `TomlDate` to the string it was authored as, because a schema\n * typed `\"string\"` must accept the unquoted spelling. Verification must not:\n * `emitTomlLine` accepts a `Date` and `stringifyToml` needs one to emit an\n * unquoted date, so a patch value arrives here as a `Date` and the re-read has\n * to produce a `Date` for `deepEqual` to match. Normalizing this call for\n * consistency would make every `Date` write fail its own verify step and be\n * refused. `test/frontmatter-write.test.ts` pins both halves.\n */\nfunction parseBlock(\n flavor: FrontmatterFlavor,\n text: string,\n): Record<string, unknown> {\n switch (flavor) {\n case \"json\":\n return parseJsonBlockText(text);\n case \"toml\":\n return text.trim() === \"\"\n ? {}\n : parseToml(text);\n case \"yaml\": {\n const doc = parseDocument(text);\n if (doc.errors.length > 0) {\n throw new DocmetaError(\n `Cannot rewrite invalid YAML front matter: ${doc.errors[0]?.message ?? \"parse error\"}`,\n );\n }\n const js: unknown = doc.toJS({ maxAliasCount: 100 });\n if (js == null) return {};\n if (typeof js !== \"object\" || Array.isArray(js)) {\n throw new DocmetaError(\n \"Cannot rewrite front matter: the root must be a mapping.\",\n );\n }\n return js as Record<string, unknown>;\n }\n }\n}\n\n/**\n * Re-read the merged block and confirm it says exactly what it should. This is\n * the difference between a serializer bug being a refusal and a serializer bug\n * being a corrupted file.\n */\nfunction verify(\n flavor: FrontmatterFlavor,\n inner: string,\n merged: string,\n patch: MetadataPatch,\n deletions: readonly string[] = [],\n): void {\n const expected = Object.fromEntries(\n Object.entries({ ...parseBlock(flavor, inner), ...patch }).filter(\n ([key]) => !deletions.includes(key),\n ),\n );\n const actual = parseBlock(flavor, merged);\n if (!deepEqual(actual, expected)) {\n throw new DocmetaError(\n \"Refusing to write front matter: the rewritten block did not read back as expected.\",\n );\n }\n}\n","/**\n * Helpers shared by every `apply` implementation.\n *\n * These began as private functions in `frontmatter-write.ts`. They moved here\n * when HTML and XML gained write support, because a second copy of `deepEqual`\n * is a second chance for the verify step to disagree with itself — and a verify\n * step that quietly accepts what it should reject is worse than none.\n */\nimport type { MetadataPatch } from \"../types.js\";\n\n/** Keys explicitly set to `undefined` mean \"no opinion\", not \"set to null\". */\nexport function dropUndefined(patch: MetadataPatch): MetadataPatch {\n const out: MetadataPatch = {};\n for (const [k, v] of Object.entries(patch)) if (v !== undefined) out[k] = v;\n return out;\n}\n\n/** Structural equality, used by every writer's verify-before-return step. */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a instanceof Date || b instanceof Date) {\n const at = a instanceof Date ? a.getTime() : NaN;\n const bt = b instanceof Date ? b.getTime() : NaN;\n return at === bt;\n }\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n return a.every((x, i) => deepEqual(x, b[i]));\n }\n if (a == null || b == null || typeof a !== \"object\" || typeof b !== \"object\") {\n return false;\n }\n const ao = a as Record<string, unknown>;\n const bo = b as Record<string, unknown>;\n const ak = Object.keys(ao);\n const bk = Object.keys(bo);\n if (ak.length !== bk.length) return false;\n return ak.every(\n (k) => Object.prototype.hasOwnProperty.call(bo, k) && deepEqual(ao[k], bo[k]),\n );\n}\n","/**\n * Formatting-preserving edits to YAML text. Each edit replaces one range of\n * the original text and leaves every other byte as it was: comments, key\n * order, quoting, blank lines and line endings.\n *\n * The text is parsed once for its node ranges, and an edit is computed from\n * those ranges. Two writers use these primitives. The manifest writer\n * (`external-metadata-write.ts`) edits one entry of a manifest, and the\n * frontmatter writer (`frontmatter-write.ts`) edits a page's root mapping.\n */\nimport {\n isMap,\n isNode,\n isPair,\n isScalar,\n isSeq,\n stringify,\n type Pair,\n type YAMLMap,\n} from \"yaml\";\n\n/** How a document lays itself out, so a new value matches its neighbours. */\nexport interface Style {\n /** Spaces per nesting level. */\n step: number;\n /** Whether a list under a key is indented past it (`key:\\n - a`). */\n indentSeq: boolean;\n eol: string;\n}\n\n/** One replacement of the original text. */\nexport interface Edit {\n start: number;\n end: number;\n insert: string;\n}\n\ntype Range = [number, number, number];\n\n/** A key the mapping does not have, after the mapping's last line. */\nexport function insertKey(\n text: string,\n entryMap: YAMLMap,\n key: string,\n value: unknown,\n style: Style,\n): Edit | undefined {\n const firstKey = rangeOf(entryMap.items[0]?.key);\n const end = contentEnd(text, entryMap);\n if (!firstKey || end === undefined) return undefined;\n const pos = lineEnd(text, end);\n return {\n start: pos,\n end: pos,\n insert: style.eol + blockLines({ [key]: value }, colOf(text, firstKey[0]), style),\n };\n}\n\n/**\n * A present key in a block mapping: everything from its `:` to the end of its\n * value is the new value. A comment on the key's own line is kept, and the\n * value then starts on the next line.\n */\nexport function replaceBlockValue(\n text: string,\n pair: Pair,\n value: unknown,\n style: Style,\n): Edit | undefined {\n const colon = colonEnd(text, pair);\n const keyRange = rangeOf(pair.key);\n if (colon === undefined || !keyRange) return undefined;\n const keyCol = colOf(text, keyRange[0]);\n let start = colon;\n let ownLine = false;\n let i = colon;\n while (text.charAt(i) === \" \" || text.charAt(i) === \"\\t\") i++;\n if (text.charAt(i) === \"#\") {\n start = lineEnd(text, i);\n ownLine = true;\n }\n const old = pair.value;\n const oldEnd =\n isScalar(old) && old.value === null && emptySource(text, old)\n ? start\n : (contentEnd(text, old) ?? start);\n const end = Math.max(start, oldEnd);\n let insert = afterColon(value, keyCol, style);\n if (ownLine && !insert.startsWith(style.eol)) {\n insert = style.eol + \" \".repeat(keyCol + style.step) + insert.trimStart();\n }\n return { start, end, insert };\n}\n\n/**\n * A present key whose value is written in flow style: the value, and only the\n * value, in flow style. `padded` chooses `[ a ]` or `[a]`; left out, the\n * `yaml` package's default applies.\n */\nexport function replaceFlowValue(\n text: string,\n pair: Pair,\n value: unknown,\n padded?: boolean,\n): Edit | undefined {\n const r = rangeOf(pair.value);\n if (!r || emptySource(text, pair.value)) return undefined;\n const end = contentEnd(text, pair.value) ?? r[1];\n return { start: r[0], end, insert: flowText(value, padded) };\n}\n\n/**\n * The lines to cut to remove a key: from the start of the line `from` is on\n * through the line break after the line `to` is on. On the last line, with no\n * break after it, the break before it goes instead.\n */\nexport function keyLines(\n text: string,\n from: number,\n to: number,\n eol: string,\n): { start: number; end: number } {\n let start = text.lastIndexOf(\"\\n\", from - 1) + 1;\n let end = lineEnd(text, to);\n if (text.startsWith(eol, end)) end += eol.length;\n else if (start >= eol.length) start -= eol.length;\n return { start, end };\n}\n\n/** A present key in a block mapping, removed with its value's lines. */\nexport function removeKey(text: string, pair: Pair, eol: string): Edit | undefined {\n const from = rangeOf(pair.key);\n const to = contentEnd(text, pair.value) ?? contentEnd(text, pair.key);\n if (!from || to === undefined) return undefined;\n const { start, end } = keyLines(text, from[0], to, eol);\n return { start, end, insert: \"\" };\n}\n\n// ---------------------------------------------------------------------------\n// Serialization. `stringify` lays the value out; the splice only indents it.\n// `lineWidth: 0` disables folding, so a long value stays on its line.\n// ---------------------------------------------------------------------------\n\n/** `{ key: value }` as block lines at column `col`, joined with the document's line ending. */\nexport function blockLines(pair: Record<string, unknown>, col: number, style: Style): string {\n const s = stringify(pair, { lineWidth: 0, indent: style.step, indentSeq: style.indentSeq });\n return indentLines(s.replace(/\\n$/, \"\").split(\"\\n\"), col, 0).join(style.eol);\n}\n\n/**\n * The text that follows `key:` for `value`, for a key at column `col`: ` x`\n * for a scalar or an empty collection, or a line break and the block for a\n * mapping or a list with members.\n */\nexport function afterColon(value: unknown, col: number, style: Style): string {\n const s = stringify({ k: value }, { lineWidth: 0, indent: style.step, indentSeq: style.indentSeq });\n const lines = s.replace(/\\n$/, \"\").slice(\"k:\".length).split(\"\\n\");\n return indentLines(lines, col, 1).join(style.eol);\n}\n\n/** Every non-empty line from index `from` on, shifted right by `col` spaces. */\nexport function indentLines(lines: string[], col: number, from: number): string[] {\n const pad = \" \".repeat(col);\n return lines.map((l, i) => (i < from || l === \"\" ? l : pad + l));\n}\n\n/** `value` on one line, in flow style: JSON when YAML's flow form would wrap. */\nexport function flowText(value: unknown, padded?: boolean): string {\n const s = stringify(value, {\n lineWidth: 0,\n collectionStyle: \"flow\",\n ...(padded === undefined ? {} : { flowCollectionPadding: padded }),\n }).replace(/\\n$/, \"\");\n return s.includes(\"\\n\") ? JSON.stringify(value) : s;\n}\n\n// ---------------------------------------------------------------------------\n// Positions.\n// ---------------------------------------------------------------------------\n\n/** The text's line ending, from its first line break; LF when it has none. */\nexport function detectEol(text: string): string {\n const i = text.indexOf(\"\\n\");\n return i > 0 && text.charAt(i - 1) === \"\\r\" ? \"\\r\\n\" : \"\\n\";\n}\n\n/** The indentation step and list style the document already uses. */\nexport function detectStyle(text: string, root: YAMLMap, eol: string): Style {\n let step = 2;\n for (const pair of root.items) {\n const v = pair.value;\n const entryKey = rangeOf(pair.key);\n const ownedKey = isMap(v) && v.flow !== true ? rangeOf(v.items[0]?.key) : undefined;\n if (entryKey && ownedKey) {\n const d = colOf(text, ownedKey[0]) - colOf(text, entryKey[0]);\n if (d > 0) {\n step = d;\n break;\n }\n }\n }\n return { step, indentSeq: seqIndented(text, root) ?? true, eol };\n}\n\n/** Whether the first block list under a key is indented past it; undefined when there is none. */\nfunction seqIndented(text: string, node: unknown): boolean | undefined {\n if (isMap(node)) {\n for (const pair of node.items) {\n const v = pair.value;\n if (isSeq(v) && v.flow !== true && v.items.length > 0) {\n const k = rangeOf(pair.key);\n const s = rangeOf(v);\n if (k && s) return colOf(text, s[0]) > colOf(text, k[0]);\n }\n const inner = seqIndented(text, v);\n if (inner !== undefined) return inner;\n }\n } else if (isSeq(node)) {\n for (const item of node.items) {\n const inner = seqIndented(text, item);\n if (inner !== undefined) return inner;\n }\n }\n return undefined;\n}\n\n/**\n * Where a node's own text ends: the last character of its last scalar or\n * flow collection. A block collection's range runs on through the line break\n * and any comments after its last item, which belong to what follows.\n */\nexport function contentEnd(text: string, node: unknown): number | undefined {\n if (isMap(node) && node.flow !== true) {\n const last = node.items.at(-1);\n if (last) return contentEnd(text, last.value) ?? contentEnd(text, last.key);\n } else if (isSeq(node) && node.flow !== true) {\n const last: unknown = node.items.at(-1);\n if (last !== undefined) {\n return isPair(last)\n ? (contentEnd(text, last.value) ?? contentEnd(text, last.key))\n : contentEnd(text, last);\n }\n }\n const r = rangeOf(node);\n if (!r) return undefined;\n let end = r[1];\n while (end > r[0] && /\\s/.test(text.charAt(end - 1))) end--;\n return end;\n}\n\n/** Just past the `:` that follows a pair's key; undefined for an explicit `? key`. */\nexport function colonEnd(text: string, pair: Pair): number | undefined {\n const r = rangeOf(pair.key);\n if (!r) return undefined;\n let i = r[1];\n while (text.charAt(i) === \" \" || text.charAt(i) === \"\\t\") i++;\n return text.charAt(i) === \":\" ? i + 1 : undefined;\n}\n\n/** The offset of the line break ending the line `i` is on, or the end of the text. */\nexport function lineEnd(text: string, i: number): number {\n const j = text.indexOf(\"\\n\", i);\n if (j < 0) return text.length;\n return j > 0 && text.charAt(j - 1) === \"\\r\" ? j - 1 : j;\n}\n\n/** 0-based column of `offset`, not counting a byte-order mark. */\nexport function colOf(text: string, offset: number): number {\n if (offset === 0) return 0;\n let start = text.lastIndexOf(\"\\n\", offset - 1) + 1;\n if (start === 0 && text.startsWith(\"\")) start = 1;\n return offset - start;\n}\n\nexport function rangeOf(node: unknown): Range | undefined {\n return isNode(node) ? (node.range ?? undefined) : undefined;\n}\n\n/** A node with no text of its own: `key:` with nothing after it. */\nexport function emptySource(text: string, node: unknown): boolean {\n const r = rangeOf(node);\n return !r || text.slice(r[0], r[1]).trim() === \"\";\n}\n\n/** A mapping key as the loader compares it. */\nexport function keyString(key: unknown): string {\n return isScalar(key) ? String(key.value) : String(key);\n}\n","/**\n * Markdown frontmatter extractor. Delegates to the shared, flavor-detecting\n * `extractFrontmatter`, which reads YAML (`--- … ---`), TOML (`+++ … +++`), or\n * JSON (`;;; … ;;;`) fenced front matter.\n */\nimport type { MetadataExtractor } from \"../types.js\";\nimport { extractFrontmatter } from \"./frontmatter.js\";\nimport { applyFrontmatter } from \"./frontmatter-write.js\";\n\nexport const markdownExtractor: MetadataExtractor = {\n name: \"markdown\",\n extensions: [\".md\", \".markdown\"],\n extract: (content) => extractFrontmatter(content, \"markdown\"),\n apply: (content, patch, options) =>\n applyFrontmatter(content, patch, options),\n};\n","/**\n * MDX extractor. MDX frontmatter is identical to Markdown's, so we reuse the\n * same logic (YAML/TOML/JSON fenced blocks). Parsing `export const meta = {...}`\n * is future work.\n */\nimport { extractFrontmatter } from \"./frontmatter.js\";\nimport { applyFrontmatter } from \"./frontmatter-write.js\";\nimport type { MetadataExtractor } from \"../types.js\";\n\nexport const mdxExtractor: MetadataExtractor = {\n name: \"mdx\",\n extensions: [\".mdx\"],\n extract: (content) => extractFrontmatter(content, \"mdx\"),\n apply: (content, patch, options) =>\n applyFrontmatter(content, patch, options),\n};\n","/**\n * AsciiDoc metadata extractor.\n *\n * Two metadata styles are accepted:\n * 1. A leading fenced frontmatter block (YAML `--- … ---`, TOML `+++ … +++`,\n * or JSON `;;; … ;;;`), as some static-site generators use. This delegates\n * to the shared `extractFrontmatter` so the values are typed and the line\n * map comes for free.\n * 2. The native AsciiDoc document header: the `= Title` line plus `:key: value`\n * attribute entries, running from the first line until the first blank line.\n * Attribute values are parsed as YAML scalars so `2` -> number, `true` ->\n * boolean, etc., consistent with frontmatter typing.\n */\nimport { parse as parseYamlScalar } from \"yaml\";\nimport type { ExtractedMetadata, MetadataExtractor } from \"../types.js\";\nimport {\n extractFrontmatter,\n hasFrontmatterFence,\n escapePointerSegment,\n lineForFactory,\n} from \"./frontmatter.js\";\nimport { applyFencedOnly } from \"./frontmatter-write.js\";\n\nconst TITLE = /^=\\s+(.+?)\\s*$/;\n// `:!name:` or `:name!:` — an unset attribute.\nconst UNSET = /^:(?:!([^:\\s]+)|([^:\\s]+)!):\\s*$/;\n// `:name:` or `:name: value` — a set attribute (value optional).\nconst SET = /^:([^:\\s!][^:\\s]*):(?:\\s+(.*\\S))?\\s*$/;\n\n/** Parse a raw attribute value as a YAML scalar, falling back to the string. */\nfunction typeValue(raw: string): unknown {\n try {\n return parseYamlScalar(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Parse the native AsciiDoc document header (title + attribute entries).\n * `lineOffset` shifts reported source lines when the caller has sliced content\n * off the front (e.g. a stray fence line), so annotations stay aligned.\n */\nfunction extractHeader(content: string, lineOffset = 0): ExtractedMetadata {\n const body = content.charCodeAt(0) === 0xfeff ? content.slice(1) : content;\n const lines = body.split(/\\r?\\n/);\n\n const data: Record<string, unknown> = {};\n const map = new Map<string, number>();\n map.set(\"\", 1 + lineOffset);\n\n const setKey = (key: string, value: unknown, line: number): void => {\n data[key] = value;\n map.set(`/${escapePointerSegment(key)}`, line);\n };\n\n for (const [i, line] of lines.entries()) {\n // The header ends at the first blank line.\n if (line.trim() === \"\") break;\n\n if (i === 0) {\n const title = TITLE.exec(line);\n if (title?.[1] != null) {\n setKey(\"title\", title[1], i + 1 + lineOffset);\n continue;\n }\n }\n\n const unset = UNSET.exec(line);\n if (unset) {\n const name = unset[1] ?? unset[2];\n if (name != null) setKey(name, false, i + 1 + lineOffset);\n continue;\n }\n\n const set = SET.exec(line);\n if (set?.[1] != null) {\n const value = set[2] === undefined ? true : typeValue(set[2]);\n setKey(set[1], value, i + 1 + lineOffset);\n continue;\n }\n // Non-attribute header lines (e.g. author/revision) are ignored.\n }\n\n const present = Object.keys(data).length > 0;\n return {\n data,\n present,\n format: \"asciidoc\",\n lineFor: lineForFactory(map),\n };\n}\n\nexport const asciidocExtractor: MetadataExtractor = {\n name: \"asciidoc\",\n extensions: [\".adoc\", \".asciidoc\"],\n apply: (content, patch, options) =>\n applyFencedOnly(content, patch, options, \"asciidoc\"),\n extract(content) {\n if (hasFrontmatterFence(content)) {\n // Delegate only when a complete frontmatter block is actually present;\n // a stray opening fence with no closing delimiter should not shadow a\n // native AsciiDoc header that follows.\n const fm = extractFrontmatter(content, \"asciidoc\");\n if (fm.present) return fm;\n // A stray opening fence with no closing delimiter is not frontmatter. Slice\n // the fence line off entirely (not blank it — `extractHeader` stops at the\n // first blank line) so a native `= Title` lands at the header start, and\n // pass a matching line offset so every attribute keeps its true source\n // line. `= Title` on line 2 must be at the header start to count, since an\n // AsciiDoc document title is only recognized as the first header line.\n const nl = content.indexOf(\"\\n\");\n if (nl !== -1) return extractHeader(content.slice(nl + 1), 1);\n }\n return extractHeader(content);\n },\n};\n","/**\n * reStructuredText metadata extractor.\n *\n * Two metadata styles are accepted:\n * 1. A leading fenced frontmatter block (YAML `--- … ---`, TOML `+++ … +++`,\n * or JSON `;;; … ;;;`), as some static-site generators (e.g. MyST) use.\n * This delegates to the shared `extractFrontmatter` so the values are typed\n * and the line map comes for free.\n * 2. The native reStructuredText docinfo field list: the run of `:name: value`\n * entries at the top of the document, optionally preceded by a section\n * title (which we skip — only page-level metadata is extracted, not\n * headings). Field values are parsed as YAML scalars so `2` -> number,\n * `[a, b]` -> array, etc., consistent with frontmatter typing.\n */\nimport { parse as parseYamlScalar } from \"yaml\";\nimport type { ExtractedMetadata, MetadataExtractor } from \"../types.js\";\nimport {\n extractFrontmatter,\n hasFrontmatterFence,\n escapePointerSegment,\n lineForFactory,\n} from \"./frontmatter.js\";\nimport { applyFencedOnly } from \"./frontmatter-write.js\";\n\n// `:name:` or `:name: value` — a docinfo field (value optional). The name may\n// contain spaces but not a colon; the value (if any) may.\nconst FIELD = /^:([^:]+):(?:\\s+(.*\\S))?\\s*$/;\n// A section-title adornment: a line of two or more identical punctuation chars.\nconst ADORN = /^([=\\-~:.'\"*+#_^<>])\\1+$/;\n\n/** Parse a raw field value as a YAML scalar, falling back to the string. */\nfunction typeValue(raw: string): unknown {\n try {\n return parseYamlScalar(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Detect a leading section title — a text line underlined with punctuation,\n * optionally also overlined — after any blank lines. The title is collected as\n * page metadata; `next` is the index where docinfo field-list parsing resumes.\n */\ninterface TitleInfo {\n /** Title text, when a leading section title is present. */\n title?: string;\n /** 1-based source line of the title text. */\n line?: number;\n /** Index of the first line after the title (and its adornment lines). */\n next: number;\n}\n\n/** A run of identical title-adornment punctuation, or null for any other line. */\nfunction adornment(line: string): { char: string; length: number } | null {\n const m = ADORN.exec(line);\n return m && m[1] != null ? { char: m[1], length: line.length } : null;\n}\n\nfunction parseTitle(lines: string[]): TitleInfo {\n let i = 0;\n while (i < lines.length && (lines[i] ?? \"\").trim() === \"\") i++;\n if (i >= lines.length) return { next: i };\n\n const first = lines[i] ?? \"\";\n // A field line starts the docinfo block, not a title.\n if (FIELD.test(first)) return { next: i };\n\n const over = adornment(first);\n if (over) {\n // Over- and under-lined: adornment / title text / matching adornment. RST\n // requires the over- and underline to use the same character and length,\n // and to be at least as long as the title text.\n const text = lines[i + 1] ?? \"\";\n const under = adornment(lines[i + 2] ?? \"\");\n if (\n text.trim() !== \"\" &&\n !FIELD.test(text) &&\n under != null &&\n under.char === over.char &&\n under.length === over.length &&\n over.length >= text.trim().length\n ) {\n return { title: text.trim(), line: i + 2, next: i + 3 };\n }\n // A lone adornment that isn't a valid overlined title — not metadata.\n return { next: i };\n }\n\n // Underlined: title text / adornment at least as long as the title.\n const under = adornment(lines[i + 1] ?? \"\");\n if (under != null && under.length >= first.trim().length) {\n return { title: first.trim(), line: i + 1, next: i + 2 };\n }\n\n return { next: i };\n}\n\n/**\n * Parse the native reStructuredText page metadata: a leading section title\n * (collected as `title`) followed by the docinfo field list. An explicit\n * `:title:` field takes precedence over the heading.\n */\nfunction extractDocinfo(content: string): ExtractedMetadata {\n const body = content.charCodeAt(0) === 0xfeff ? content.slice(1) : content;\n const lines = body.split(/\\r?\\n/);\n\n const data: Record<string, unknown> = {};\n const map = new Map<string, number>();\n // First source line of the metadata block (title or, failing that, a field).\n let blockStart = -1;\n\n const titleInfo = parseTitle(lines);\n if (titleInfo.title != null && titleInfo.line != null) {\n data.title = titleInfo.title;\n map.set(\"/title\", titleInfo.line);\n blockStart = titleInfo.line;\n }\n\n // Skip blank lines between the title and the field list.\n let i = titleInfo.next;\n while (i < lines.length && (lines[i] ?? \"\").trim() === \"\") i++;\n\n for (; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n // The field list ends at the first blank or non-field line.\n if (line.trim() === \"\") break;\n const field = FIELD.exec(line);\n if (!field || field[1] == null) break;\n\n const name = field[1].trim();\n const value = field[2] === undefined ? true : typeValue(field[2]);\n if (blockStart === -1) blockStart = i + 1;\n data[name] = value;\n map.set(`/${escapePointerSegment(name)}`, i + 1);\n }\n\n const present = blockStart !== -1;\n // Root pointer maps to the block start. When no metadata is present we record\n // nothing, so `lineFor` reports unknown rather than misleadingly annotating\n // missing-metadata errors at line 1.\n if (present) map.set(\"\", blockStart);\n\n return {\n data,\n present,\n format: \"rst\",\n lineFor: lineForFactory(map),\n };\n}\n\nexport const rstExtractor: MetadataExtractor = {\n name: \"rst\",\n extensions: [\".rst\"],\n apply: (content, patch, options) =>\n applyFencedOnly(content, patch, options, \"rst\"),\n extract(content) {\n if (hasFrontmatterFence(content)) {\n // Delegate only when a complete frontmatter block is actually present.\n const fm = extractFrontmatter(content, \"rst\");\n if (fm.present) return fm;\n // A stray opening fence with no closing delimiter is not frontmatter, and\n // it must not shadow a native docinfo field list that follows. Blank the\n // fence line (keeping its newline so source lines stay aligned) before\n // reading the native metadata — otherwise docinfo parsing would stop on\n // the fence line.\n const nl = content.indexOf(\"\\n\");\n if (nl !== -1) return extractDocinfo(content.slice(nl));\n }\n return extractDocinfo(content);\n },\n};\n","/**\n * The XML read model, split out so that `xml.ts` (which extracts) and\n * `xml-write.ts` (which writes back) share one implementation of it.\n *\n * Metadata comes from the root element's attributes. Namespace declarations\n * (`xmlns`, `xmlns:*`) are dropped as transport noise. Attribute values are\n * parsed as YAML scalars so `\"2\"` -> number and `\"true\"` -> boolean, consistent\n * with the AsciiDoc and HTML extractors.\n *\n * The parsed root is handed back along with the data, because the writer needs\n * the same node the reader drew its values from. Deciding \"which attribute is\n * this key\" twice, in two modules, is how a write ends up landing somewhere the\n * read does not look.\n */\nimport { DOMParser } from \"@xmldom/xmldom\";\nimport { parse as parseYamlScalar } from \"yaml\";\nimport { escapePointerSegment, positionForFactory } from \"./pointer.js\";\nimport {\n childElements,\n ditaShape,\n liftRoot,\n metadataContainers,\n otherMetaEntries,\n DITA_CONTENT_MODEL,\n DITA_LIFTS,\n type DitaLift,\n type DitaShape,\n} from \"./dita.js\";\nimport {\n liftKey,\n pairValues,\n parseElementPath,\n type ElementPath,\n} from \"./element-key.js\";\nimport type { ExtractedMetadata, ExtractOptions } from \"../types.js\";\n\ntype XmlDocument = ReturnType<DOMParser[\"parseFromString\"]>;\nexport type XmlElement = NonNullable<XmlDocument[\"documentElement\"]>;\n\n/** Where a key's effective value came from. */\nexport type XmlSource =\n | { kind: \"attr\"; name: string }\n | { kind: \"othermeta\"; el: XmlElement }\n /**\n * A value read from element text. `els` carries every occurrence, in document\n * order, because the key is a list — a write replaces the whole set, and one\n * element out of several is not a location a write can aim at.\n */\n | { kind: \"element-text\"; els: XmlElement[] }\n /**\n * A value read from an element's *attribute* — `<created date=…/>`. Kept\n * distinct from `element-text` because a writer aiming at the text of an\n * empty element would produce `<created>2026-01-15</created>`, which is\n * neither what the reader looks at nor valid against the DTD.\n */\n | { kind: \"element-attr\"; els: XmlElement[]; name: string };\n\nexport interface XmlRead {\n data: Record<string, unknown>;\n lineMap: Map<string, number>;\n colMap: Map<string, number>;\n /** The root element, or undefined for a document that has none. */\n root: XmlElement | undefined;\n /** The text actually parsed — the source minus any leading BOM. */\n body: string;\n /**\n * The element each key's effective value was read from, so a write can land\n * on the same one. DITA has two channels; plain XML has one.\n */\n sources: Map<string, XmlSource>;\n /** Set when the document is DITA, describing where its metadata belongs. */\n dita: DitaShape | undefined;\n}\n\n/** Parse a raw attribute value as a YAML scalar, falling back to the string. */\nexport function typeValue(raw: string): unknown {\n // An explicitly empty attribute (`title=\"\"`) is the empty string, not the\n // YAML `null` that parsing \"\" would yield.\n if (raw === \"\") return \"\";\n try {\n return parseYamlScalar(raw);\n } catch {\n return raw;\n }\n}\n\n/** Whether an attribute carries metadata, as opposed to describing the document. */\nexport function isMetadataAttribute(name: string): boolean {\n return name !== \"xmlns\" && !name.startsWith(\"xmlns:\");\n}\n\n/**\n * The text an element carries, or `undefined` when it carries none worth\n * lifting.\n *\n * Two exclusions, and both are the reason this returns `undefined` rather than\n * an empty string:\n *\n * - **An element with element children is structure, not a value.** `<body>`\n * full of `<p>` is a container; lifting it would concatenate the prose of the\n * whole document into one key.\n * - **Whitespace-only text is not a value either.** Indented markup puts a\n * newline and some spaces inside every container, so treating that as content\n * would lift every element in the file.\n *\n * Comments and processing instructions are ignored rather than disqualifying,\n * so `<title><!-- note -->Set up</title>` is still a value.\n *\n * A deliberately empty element (`<title></title>`) therefore yields nothing by\n * convention. That is right for the convention, which has to keep structural\n * elements out of the key set without a hardcoded ignore list, and wrong for a\n * path someone named in `elements:` config — where \"present but empty\" is\n * exactly what they want checked. The config path passes `allowEmpty`.\n */\nexport function elementText(\n el: XmlElement,\n allowEmpty = false,\n): string | undefined {\n let text = \"\";\n for (let n = el.firstChild; n; n = n.nextSibling) {\n if (n.nodeType === 1) return undefined;\n if (n.nodeType === 3 || n.nodeType === 4) text += n.nodeValue ?? \"\";\n }\n if (!allowEmpty && text.trim() === \"\") return undefined;\n return text.trim();\n}\n\n/**\n * DITA's typed metadata elements, grouped by the key each contributes.\n *\n * Walks down from `<prolog>` or `<topicmeta>`, descending into any child the\n * content-model table knows — which is how `<critdates>`, `<metadata>` and\n * `<prodinfo>` are reached without either being named here. What is lifted, and\n * whether from text or an attribute, is `DITA_LIFTS`' decision; this only\n * traverses.\n */\nfunction ditaLiftedElements(\n container: XmlElement,\n): Map<string, { els: XmlElement[]; spec: DitaLift }> {\n const out = new Map<string, { els: XmlElement[]; spec: DitaLift }>();\n const add = (key: string, el: XmlElement, spec: DitaLift): void => {\n const found = out.get(key);\n if (found) found.els.push(el);\n else out.set(key, { els: [el], spec });\n };\n const walk = (parent: XmlElement): void => {\n const parentName = parent.nodeName.toLowerCase();\n const lifts = own(DITA_LIFTS, parentName);\n for (const child of childElements(parent)) {\n const childName = child.nodeName.toLowerCase();\n const spec = lifts ? own(lifts, childName) : undefined;\n if (spec?.attrKeys) {\n // One element, several values. The key is named for the *element*,\n // because for an attribute that is the containing thing.\n for (const attr of spec.attrKeys) {\n add(liftKey(childName, attr), child, {\n attr,\n repeatable: spec.repeatable,\n });\n }\n } else if (spec) {\n add(liftKey(parentName, childName), child, spec);\n }\n if (own(DITA_CONTENT_MODEL, childName) !== undefined) walk(child);\n }\n };\n walk(container);\n return out;\n}\n\n/**\n * Own-property lookup on a plain-object table.\n *\n * A document supplies these names, and `Object.prototype` answers to plenty of\n * them: a `<constructor>` element would find `DITA_LIFTS.constructor` and a\n * `<toString>` would descend into a content model that does not exist. `get.ts`\n * already guards the same way where a *field* name indexes an object, for the\n * same reason.\n */\nfunction own<T>(table: Record<string, T>, key: string): T | undefined {\n return Object.prototype.hasOwnProperty.call(table, key)\n ? table[key]\n : undefined;\n}\n\n/**\n * The root's direct children that are values, grouped by the key they\n * contribute, in document order.\n *\n * Grouped rather than emitted one at a time because repeated element names\n * share a key, and every occurrence has to survive — dropping all but the first\n * would discard data silently, which is the failure this whole mechanism exists\n * to avoid.\n */\nfunction liftableChildren(\n root: XmlElement,\n): Map<string, { els: XmlElement[]; values: unknown[] }> {\n const out = new Map<string, { els: XmlElement[]; values: unknown[] }>();\n for (const child of childElements(root)) {\n // Read once. Testing with `elementText` and then reading with it again\n // walked every child element's text twice, on every file.\n const text = elementText(child);\n if (text === undefined) continue;\n const key = liftKey(root.nodeName, child.nodeName);\n const group = out.get(key);\n if (group) {\n group.els.push(child);\n group.values.push(typeValue(text));\n } else {\n out.set(key, { els: [child], values: [typeValue(text)] });\n }\n }\n return out;\n}\n\n/**\n * Every element a config path selects, walked down the child axis from the\n * document root.\n *\n * A plain descent, deliberately: no predicates, no axes, no wildcards. The\n * syntax is documented as a subset of XPath's child axis, and matching that\n * promise exactly is cheaper than explaining which parts of XPath work.\n */\nfunction matchElementPath(\n root: XmlElement,\n segments: string[],\n): XmlElement[] {\n if (root.nodeName.toLowerCase() !== segments[0]) return [];\n let current: XmlElement[] = [root];\n for (const segment of segments.slice(1)) {\n const next: XmlElement[] = [];\n for (const el of current) next.push(...childElements(el, segment));\n current = next;\n }\n return current;\n}\n\n/**\n * Parse and read. Throws for malformed XML, which the command layer records as\n * a per-file failure so the rest of the run continues (mirroring frontmatter).\n */\nexport function readXml(\n content: string,\n filePath?: string,\n options?: ExtractOptions,\n): XmlRead {\n // A BOM stays part of line 1; it doesn't shift line numbers.\n const body = content.charCodeAt(0) === 0xfeff ? content.slice(1) : content;\n\n const errors: string[] = [];\n const doc = new DOMParser({\n onError: (level, msg) => {\n if (level !== \"error\" && level !== \"fatalError\") return;\n // An entity the parser can't resolve is not structural damage. Only the\n // five built-in XML entities are known, and no external DTD is ever\n // fetched, so every DTD-declared entity (` `, `—` — the norm\n // in DITA) lands here while the document itself is fine. The root\n // element and its attributes still parse, so extraction continues; a\n // reference that is genuinely malformed reports a different error.\n // Matches the @xmldom/xmldom >=0.9 message; re-check on a major bump.\n // The DITA entity test fails loudly if the wording changes.\n if (/entity not found/i.test(msg)) return;\n errors.push(msg);\n },\n }).parseFromString(body, \"text/xml\");\n\n if (errors.length > 0) {\n throw new Error(`Invalid XML: ${errors[0] ?? \"parse error\"}`);\n }\n\n const lineMap = new Map<string, number>();\n const colMap = new Map<string, number>();\n const data: Record<string, unknown> = {};\n const sources = new Map<string, XmlSource>();\n const root = doc.documentElement ?? undefined;\n if (!root) {\n return {\n data,\n lineMap,\n colMap,\n root: undefined,\n body,\n sources,\n dita: undefined,\n };\n }\n\n // Both are 1-based, verified against the parser rather than its typings:\n // `@xmldom/xmldom` documents `lineNumber` as zero-based and `columnNumber`\n // as one-based, but it reports a root element opening on source line 3 as\n // `lineNumber: 3`. The doc comment is wrong; both count from 1.\n const rootLine = root.lineNumber ?? 1;\n const rootCol = root.columnNumber ?? 1;\n lineMap.set(\"\", rootLine);\n colMap.set(\"\", rootCol);\n\n const attrs = root.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs.item(i);\n if (!attr) continue;\n const name = attr.name;\n if (!isMetadataAttribute(name)) continue;\n data[name] = typeValue(attr.value);\n sources.set(name, { kind: \"attr\", name });\n const pointer = `/${escapePointerSegment(name)}`;\n lineMap.set(pointer, attr.lineNumber ?? rootLine);\n // An attribute's `columnNumber` is the opening quote of its value, so\n // the caret lands on the value that failed. Recorded only when the line\n // came from the same attribute: pairing a real column with the root's\n // fallback line would point at a character on the wrong line, and an\n // absent entry falls back to the root pair, which is at least coherent.\n if (attr.lineNumber != null && attr.columnNumber != null) {\n colMap.set(pointer, attr.columnNumber);\n }\n }\n\n // Element-derived metadata. Plain XML carries no content model, so the\n // convention stops at the root's direct children and lifts only the ones that\n // are values rather than structure — see `elementText`. Anything deeper needs\n // an explicit `elements:` path, because guessing which nested element is\n // metadata and which is prose is how a document body turns into a key per\n // paragraph.\n for (const [key, { els, values }] of liftableChildren(root)) {\n // Overwrites, deliberately, and only one thing can be overwritten: a root\n // attribute *literally named* `article.title`, since a dot is a legal XML\n // NameChar. The element convention owns its key space — a reader looking at\n // `<article><title>` expects that to be what `article.title` means — so the\n // element wins. `assertNoElementCollision` in the writer is the other half:\n // it refuses to *create* such an attribute, so docmeta never authors the\n // collision it resolves here.\n //\n // Always a list. XML says nothing about cardinality, so a type that\n // depended on how many elements this document happened to carry would be\n // unwritable against; a schema that means \"exactly one\" says `maxItems: 1`.\n data[key] = values;\n sources.set(key, { kind: \"element-text\", els });\n const first = els[0];\n const pointer = `/${escapePointerSegment(key)}`;\n // The caret goes on the first occurrence: it is where a reader looks, and\n // where a write that replaces the set begins.\n if (first?.lineNumber != null) lineMap.set(pointer, first.lineNumber);\n if (first?.columnNumber != null) colMap.set(pointer, first.columnNumber);\n }\n\n // DITA keeps document metadata in <prolog>/<topicmeta>, not on the root\n // element. Reading it is not optional once `fill` can write it: a value the\n // writer puts in an <othermeta> that the reader cannot see leaves the field\n // missing, so `validate` fails again and the next run rewrites it forever.\n const dita = ditaShape(body, root, filePath);\n if (dita) {\n // The typed elements first. They are namespaced by their container, so they\n // cannot collide with the flat `<othermeta>` names below — which is what\n // lets a topic carry the same fact in both channels and have both checked,\n // rather than one quietly overwriting the other.\n const liftContainer = liftRoot(root, dita);\n if (liftContainer) {\n for (const [key, { els, spec }] of ditaLiftedElements(liftContainer)) {\n // Elements and values are kept **paired**. An element that contributes\n // nothing — a second `<vrm>` with no `@release`, a `<created>` with no\n // `@date` — must not stay in `els`, or `els[i]` stops naming the\n // element `values[i]` came from and a write aims at an attribute that\n // is not there.\n const found = pairValues(\n els,\n (el) => (spec.attr ? el.getAttribute(spec.attr) : elementText(el)),\n typeValue,\n );\n if (found.values.length === 0) continue;\n data[key] = spec.repeatable ? found.values : found.values[0];\n sources.set(\n key,\n spec.attr\n ? { kind: \"element-attr\", els: found.els, name: spec.attr }\n : { kind: \"element-text\", els: found.els },\n );\n const first = found.els[0];\n const pointer = `/${escapePointerSegment(key)}`;\n if (first?.lineNumber != null) lineMap.set(pointer, first.lineNumber);\n if (first?.columnNumber != null) colMap.set(pointer, first.columnNumber);\n }\n }\n\n const { container } = metadataContainers(root, dita);\n if (container) {\n for (const { key, value, el } of otherMetaEntries(container)) {\n // othermeta wins over a root attribute of the same name: it is the\n // explicit metadata channel, while root attributes are mostly\n // structural.\n data[key] = typeValue(value);\n sources.set(key, { kind: \"othermeta\", el });\n const pointer = `/${escapePointerSegment(key)}`;\n if (el.lineNumber != null) lineMap.set(pointer, el.lineNumber);\n if (el.columnNumber != null) colMap.set(pointer, el.columnNumber);\n }\n }\n }\n\n // Config paths last. The convention and DITA's content model both ran above,\n // so a path naming a key they already filled is a no-op — which is what keeps\n // adding one from retyping `prolog.source` from a scalar into a list.\n for (const raw of options?.elements ?? []) {\n const spec: ElementPath = parseElementPath(raw);\n if (data[spec.key] !== undefined) continue;\n const matched = matchElementPath(root, spec.segments);\n const found = pairValues(\n matched,\n (el) => (spec.attr ? el.getAttribute(spec.attr) : elementText(el, true)),\n typeValue,\n );\n if (found.values.length === 0) continue;\n data[spec.key] = found.values;\n sources.set(\n spec.key,\n spec.attr\n ? { kind: \"element-attr\", els: found.els, name: spec.attr }\n : { kind: \"element-text\", els: found.els },\n );\n const first = found.els[0];\n const pointer = `/${escapePointerSegment(spec.key)}`;\n if (first?.lineNumber != null) lineMap.set(pointer, first.lineNumber);\n if (first?.columnNumber != null) colMap.set(pointer, first.columnNumber);\n }\n\n return { data, lineMap, colMap, root, body, sources, dita };\n}\n\n/** Shape the read into the generic extractor result. */\nexport function toExtracted(read: XmlRead): ExtractedMetadata {\n return {\n data: read.data,\n present: Object.keys(read.data).length > 0,\n format: \"xml\",\n lineFor: positionForFactory(read.lineMap),\n colFor: positionForFactory(read.colMap),\n };\n}\n","/**\n * The naming rule for element-derived metadata, shared by every structured\n * format.\n *\n * **The containing element is the namespace.** A value that lives in an element\n * rather than in an attribute is keyed `<immediate parent>.<element name>`:\n *\n * <prolog><author>Ada</author> -> prolog.author\n * <head><title>Docs</title> -> head.title\n * <article><byline>Ada</byline> -> article.byline\n *\n * Existing flat keys do not move. Root attributes, `<meta>`, `<othermeta>` and\n * HTML's `<title>` keep the names they have always had, so a document can carry\n * the same fact in two channels and **both are validated** — neither wins, and\n * neither is silently discarded.\n *\n * The separator is a dot in the key and a slash in an `elements:` config path,\n * and the asymmetry is deliberate. XML element names may legally contain dots\n * (`.` is a NameChar, just not a NameStartChar), so a dotted *path* cannot be\n * parsed: `a.b.c` could be `<a.b><c>`, `<a><b.c>` or `<a><b><c>`. That never\n * reaches the key, because nothing parses a key back into a path — a schema\n * names the exact string. It only reaches config, which must parse, and `/`\n * cannot appear in an element name.\n *\n * This is not a new convention. docmeta already prints exactly it: JSON Pointer\n * separates structure with slashes and tolerates a dot inside one segment,\n * which is why `/ms.date` has worked since `microsoft:learn:1.0` shipped.\n */\n\nimport { DocmetaError } from \"../types.js\";\n\n/** The metadata key an element contributes, given its parent's name. */\nexport function liftKey(parentName: string, elementName: string): string {\n return `${parentName.toLowerCase()}.${elementName.toLowerCase()}`;\n}\n\n/**\n * Read a value out of each element, dropping the ones that have none — and\n * dropping the element with it.\n *\n * The pairing is the point. `values[i]` must have come from `els[i]`, because\n * that is how a write knows where to put the replacement back. Filtering the\n * values alone leaves the two lists a different length and silently\n * misaligned, which surfaces later as a write aimed at an attribute the element\n * does not carry, or a caret on an element that contributed nothing.\n *\n * Generic over the node type, and shared, because the XML and HTML readers each\n * had their own copy of the loop and only one of them was fixed the first time.\n */\nexport function pairValues<E>(\n els: readonly E[],\n read: (el: E) => string | null | undefined,\n type: (raw: string) => unknown,\n): { els: E[]; values: unknown[] } {\n const keptEls: E[] = [];\n const values: unknown[] = [];\n for (const el of els) {\n const raw = read(el);\n if (raw == null) continue;\n keptEls.push(el);\n values.push(type(raw));\n }\n return { els: keptEls, values };\n}\n\n/** One `elements:` entry, parsed. */\nexport interface ElementPath {\n /** Element names from the document root down, lowercased. At least two. */\n segments: string[];\n /** Attribute carrying the value. Absent means the element's text. */\n attr?: string;\n /** The key this path contributes, derived by {@link liftKey}. */\n key: string;\n}\n\n/**\n * Parsed paths, keyed by their source string.\n *\n * `elements:` paths are a handful of strings reused for every file in the run,\n * so re-splitting them per document is pure waste — a thousand files and three\n * paths is three thousand parses of the same three strings.\n *\n * Capped, because this module is also reachable through the exported\n * `readXml`/`readHtml`. In the CLI the key set is the config and stays tiny; an\n * embedding that passed a different path per request would otherwise grow a map\n * that never evicts. Past the cap parsing simply happens again, which is the\n * behaviour before the cache existed.\n */\nconst parsed = new Map<string, ElementPath>();\nconst PARSE_CACHE_MAX = 256;\n\n/**\n * Parse an `elements:` path — a slash-separated child path from the document\n * root, optionally ending in `@attribute`.\n *\n * article/byline/author -> key `byline.author`, from element text\n * html/head/link@href -> key `head.link`, from the href attribute\n *\n * A deliberate subset of XPath's child axis. Naming the subset sets the\n * expectation that predicates, axes and functions are not coming, rather than\n * leaving someone to try `article/byline[1]` and file a bug.\n *\n * Two segments are the minimum because the key needs a parent to be the\n * namespace. A bare `title` names an element with no container, so there is no\n * key to derive — that is a config error, not an empty result, since silently\n * ignoring it would leave someone waiting for a check that never runs.\n */\nexport function parseElementPath(path: string): ElementPath {\n const hit = parsed.get(path);\n if (hit) return hit;\n const result = parseElementPathUncached(path);\n if (parsed.size < PARSE_CACHE_MAX) parsed.set(path, result);\n return result;\n}\n\nfunction parseElementPathUncached(path: string): ElementPath {\n const at = path.indexOf(\"@\");\n const attr = at === -1 ? undefined : path.slice(at + 1).trim();\n const body = at === -1 ? path : path.slice(0, at);\n const segments = body\n .split(\"/\")\n .map((s) => s.trim().toLowerCase())\n .filter((s) => s !== \"\");\n\n if (segments.length < 2) {\n throw new DocmetaError(\n `Invalid elements path \"${path}\": it needs at least two segments, ` +\n \"because the key is named after the element's parent \" +\n '(so \"article/title\" gives `article.title`).',\n );\n }\n if (at !== -1 && attr === \"\") {\n throw new DocmetaError(\n `Invalid elements path \"${path}\": \"@\" must be followed by an attribute name.`,\n );\n }\n\n // Both indices are in bounds — the length check above guarantees it. The\n // fallbacks are how `noUncheckedIndexedAccess` is satisfied, not a defence\n // against a case that can happen: it widens `string[][n]` to\n // `string | undefined` regardless of any guard the compiler cannot follow.\n const parent = segments[segments.length - 2] ?? \"\";\n const name = segments[segments.length - 1] ?? \"\";\n return { segments, ...(attr ? { attr } : {}), key: liftKey(parent, name) };\n}\n","/**\n * What docmeta knows about DITA, shared by the reader and the writer.\n *\n * DITA is XML, but its document metadata does not live where the generic XML\n * reader looks. A topic keeps it in\n * `<prolog><metadata><othermeta name=\"…\" content=\"…\"/></metadata></prolog>`;\n * a map keeps it in `<topicmeta>`. The root element's attributes are mostly\n * structural — `id`, `xml:lang`, `class`, `DITAArchVersion` — and, crucially,\n * the DTD declares which of them are allowed. Adding one it does not declare\n * produces a topic that fails validation in the user's own toolchain, which is\n * why the metadata channel and not the root element is the place to write.\n */\nimport type { XmlElement } from \"./xml-read.js\";\nimport { liftKey } from \"./element-key.js\";\n\n/** Which flavour of DITA a document is, and where its metadata belongs. */\nexport interface DitaShape {\n kind: \"topic\" | \"map\";\n /** The element that directly contains `<othermeta>`. */\n container: \"metadata\" | \"topicmeta\";\n /**\n * Elements that must precede the metadata container in the content model. A\n * new container is inserted after the last of these, which in practice means\n * \"before the first child that is not one of them\".\n */\n preamble: Set<string>;\n}\n\nconst TOPIC_ROOTS = new Set([\n \"topic\",\n \"concept\",\n \"task\",\n \"reference\",\n \"glossentry\",\n \"glossgroup\",\n]);\n\nconst MAP_ROOTS = new Set([\"map\", \"bookmap\", \"subjectscheme\"]);\n\n/** Every root element name that suggests DITA, for the extension-backed signal. */\nexport const DITA_ROOTS = new Set([...TOPIC_ROOTS, ...MAP_ROOTS]);\n\n/**\n * Whether this document is DITA, and if so what shape.\n *\n * Positive signals only, in descending order of confidence. A root element\n * merely *named* `map` or `task` is far too weak on its own — those are ordinary\n * names in hand-rolled XML — so the name counts only when the file extension\n * agrees.\n */\nexport function ditaShape(\n content: string,\n root: XmlElement,\n filePath: string | undefined,\n): DitaShape | undefined {\n const name = root.nodeName.toLowerCase();\n const cls = root.getAttribute(\"class\") ?? \"\";\n\n const byDoctype = hasDitaDoctype(content);\n // DITA-OT output carries the specialization ancestry in @class.\n const byClass = /^\\s*[-+]\\s+(topic|map)\\//.test(cls);\n const byArch = root.getAttribute(\"DITAArchVersion\") != null;\n const lower = filePath?.toLowerCase() ?? \"\";\n const byExtension =\n (lower.endsWith(\".dita\") || lower.endsWith(\".ditamap\")) &&\n DITA_ROOTS.has(name);\n\n if (!byDoctype && !byClass && !byArch && !byExtension) return undefined;\n\n // `@class` is the most precise statement of which model applies; the root\n // name and the extension are the fallbacks, in that order.\n const isMap =\n /^\\s*[-+]\\s+map\\//.test(cls) ||\n MAP_ROOTS.has(name) ||\n lower.endsWith(\".ditamap\");\n\n return isMap\n ? { kind: \"map\", container: \"topicmeta\", preamble: new Set([\"title\"]) }\n : {\n kind: \"topic\",\n container: \"metadata\",\n preamble: new Set([\n \"title\",\n \"titlealts\",\n \"shortdesc\",\n \"abstract\",\n \"prolog\",\n ]),\n };\n}\n\n/**\n * Whether the document declares a DITA DTD.\n *\n * Comments are blanked first, at their original length so offsets still line up.\n * Two things go wrong otherwise, and both are silent: a comment containing a\n * tag-like `<word` ends the search window early — `<!-- covers <integration> -->`\n * ahead of the DOCTYPE hides it entirely — and a comment that merely *mentions*\n * a DITA DTD would announce one that isn't there.\n *\n * Missing the DOCTYPE is the dangerous direction. A hand-authored DITA topic\n * carries no `@class` or `@DITAArchVersion` to fall back on, so the file would\n * be taken for plain XML and written as such — a root attribute its DTD does\n * not declare, which is the one outcome this whole module exists to avoid.\n */\nfunction hasDitaDoctype(content: string): boolean {\n // Cheap exit before the expensive one. Masking allocates a same-length string\n // per comment match, and this runs once per file — including on DITA-OT\n // output, which is already identified by `@class` and rarely carries a\n // DOCTYPE at all. Sound in one direction only, which is the direction needed:\n // masking replaces text with spaces and never introduces any, so a document\n // whose raw bytes hold no `<!DOCTYPE` cannot have one after masking either.\n if (!content.includes(\"<!DOCTYPE\")) return false;\n const masked = content.replace(/<!--[\\s\\S]*?-->/g, (m) => \" \".repeat(m.length));\n const doctype = doctypeText(masked);\n if (doctype === undefined) return false;\n\n // A DITA public identifier is unambiguous on its own.\n if (/\\/\\/DTD DITA/i.test(doctype)) return true;\n\n // A SYSTEM-only declaration has no public identifier to match, and DITA\n // written against a local DTD copy looks exactly like that. Two weak signals\n // are required together, because either alone is ordinary in hand-rolled XML:\n // the declared root element has to be a DITA type, *and* the system\n // identifier has to name a DITA DTD.\n const declared = /<!DOCTYPE\\s+([A-Za-z_][\\w.-]*)/.exec(doctype)?.[1];\n if (declared === undefined || !DITA_ROOTS.has(declared.toLowerCase())) {\n return false;\n }\n return /\\b(?:concept|task|reference|topic|map|bookmap|glossentry|glossgroup|ditabase|subjectscheme)\\.dtd\\b/i.test(\n doctype,\n );\n}\n\n/**\n * The whole `<!DOCTYPE …>` declaration, internal subset included.\n *\n * Scanning rather than matching `[^>]*`: an internal subset is full of `>` —\n * `<!ENTITY nbsp \" \">` is why most DITA files have one at all — and a\n * pattern that stopped at the first would read only part of the declaration.\n * Quotes and `[ … ]` nesting are tracked so the `>` that ends the declaration is\n * the one actually found.\n */\nfunction doctypeText(masked: string): string | undefined {\n const start = masked.indexOf(\"<!DOCTYPE\");\n if (start === -1) return undefined;\n let quote: string | undefined;\n let depth = 0;\n for (let i = start + \"<!DOCTYPE\".length; i < masked.length; i++) {\n const ch = masked[i];\n if (quote !== undefined) {\n if (ch === quote) quote = undefined;\n continue;\n }\n if (ch === '\"' || ch === \"'\") quote = ch;\n else if (ch === \"[\") depth++;\n else if (ch === \"]\") depth--;\n else if (ch === \">\" && depth === 0) return masked.slice(start, i + 1);\n }\n return undefined;\n}\n\n/**\n * One element docmeta lifts out of DITA's typed metadata, and how.\n *\n * `repeatable` is not a guess. It is read straight off the OASIS content model:\n * `author*` is a list, `source?` is a scalar. Generic XML defaults everything to\n * a list because it has no such statement to consult; DITA does, so its keys are\n * typed exactly and a schema can say `format: date` on a scalar rather than\n * reaching through a one-item array.\n */\nexport interface DitaLift {\n /** Attribute carrying the value. Absent means the element's text. */\n attr?: string;\n /**\n * Attributes that are each a value in their own right, rather than one\n * attribute being where the element's single value happens to sit.\n *\n * `<created date=\"…\"/>` is the first case: the element means one thing and\n * `@date` is where it lives, so the key stays `critdates.created`. `<vrm\n * version=\"2\" release=\"1\" modification=\"0\"/>` is the second: three separate\n * facts on one EMPTY element, and keying it `vrmlist.vrm` would have to pick\n * one and discard two.\n *\n * The naming rule does not change to accommodate it — it applies one level\n * down. For an attribute the containing thing is the *element*, so these are\n * `vrm.version`, `vrm.release`, `vrm.modification`.\n */\n attrKeys?: readonly string[];\n /** Whether the content model permits more than one. */\n repeatable: boolean;\n}\n\n/**\n * The typed metadata elements docmeta reads, keyed by the element that contains\n * them — which is also the namespace their key takes.\n *\n * A container appearing as a key here is descended into, so `<prolog>` reaches\n * `<critdates>`, `<metadata>` and `<prodinfo>` without any of them being named\n * as a special case in the walker.\n *\n * `topicmeta` repeats most of `prolog` rather than deferring to it because the\n * two models genuinely differ: `<topicmeta>` holds `audience`, `category`,\n * `prodinfo`, `othermeta` and `resourceid` as **direct children**, where a topic\n * nests them inside `<prolog><metadata>`. Verified against the OASIS\n * content-model appendix rather than assumed — the same fact reads as\n * `topicmeta.audience` in a map and `metadata.audience` in a topic, and both are\n * correct, because each key names where the value actually is.\n *\n * Covers the whole prolog vocabulary docmeta reads. An earlier draft deferred\n * `<copyright>`, `<keywords>` and the `<prodinfo>` tail; proposal 0020 records\n * why each turned out to be reachable by the same mechanism that was said not\n * to reach it.\n */\nexport const DITA_LIFTS: Readonly<\n Record<string, Readonly<Record<string, DitaLift>>>\n> = {\n prolog: {\n author: { repeatable: true },\n source: { repeatable: false },\n publisher: { repeatable: false },\n permissions: { attr: \"entitlement\", repeatable: false },\n resourceid: { attr: \"id\", repeatable: true },\n },\n topicmeta: {\n author: { repeatable: true },\n source: { repeatable: false },\n publisher: { repeatable: false },\n permissions: { attr: \"entitlement\", repeatable: false },\n resourceid: { attr: \"id\", repeatable: true },\n audience: { attr: \"type\", repeatable: true },\n category: { repeatable: true },\n },\n critdates: {\n created: { attr: \"date\", repeatable: false },\n revised: { attr: \"modified\", repeatable: true },\n },\n metadata: {\n audience: { attr: \"type\", repeatable: true },\n category: { repeatable: true },\n },\n copyright: {\n copyryear: { attr: \"year\", repeatable: true },\n copyrholder: { repeatable: false },\n },\n keywords: {\n keyword: { repeatable: true },\n indexterm: { repeatable: true },\n },\n prodinfo: {\n prodname: { repeatable: false },\n brand: { repeatable: true },\n component: { repeatable: true },\n featnum: { repeatable: true },\n platform: { repeatable: true },\n prognum: { repeatable: true },\n series: { repeatable: true },\n },\n vrmlist: {\n vrm: {\n attrKeys: [\"version\", \"release\", \"modification\"],\n repeatable: true,\n },\n },\n};\n\n/**\n * Keys produced by {@link DitaLift.attrKeys} — `vrm.version` and friends.\n *\n * Derived rather than written out, so the two cannot disagree. The writer needs\n * it to tell such a key apart from an ordinary `container.element` one: they\n * look identical, and creating `vrm.version` would mean synthesising a\n * `<vrmlist><vrm/></vrmlist>` and folding three keys into one element, which is\n * not what the create path does.\n */\nexport const DITA_ATTR_KEYS: ReadonlySet<string> = new Set(\n Object.entries(DITA_LIFTS).flatMap(([, lifts]) =>\n Object.entries(lifts).flatMap(([element, spec]) =>\n (spec.attrKeys ?? []).map((attr) => liftKey(element, attr)),\n ),\n ),\n);\n\n/**\n * The ordered content models, for placing an element that does not exist yet.\n *\n * A DITA container is a *sequence*, not a set: `<critdates>` after `<metadata>`\n * is invalid even though both are allowed, so a writer creating an element has\n * to know what may precede it. `shape.preamble` answers that question for one\n * position — where a whole new `<prolog>` goes — and this answers it for every\n * position inside one.\n *\n * Names not listed for a container are unknown to docmeta and sort last, which\n * keeps a specialization docmeta has never seen from being inserted in the\n * middle of a model it does not understand.\n */\nexport const DITA_CONTENT_MODEL: Readonly<Record<string, readonly string[]>> = {\n prolog: [\n \"author\",\n \"source\",\n \"publisher\",\n \"copyright\",\n \"critdates\",\n \"permissions\",\n \"metadata\",\n \"resourceid\",\n \"data\",\n ],\n topicmeta: [\n \"navtitle\",\n \"linktext\",\n \"searchtitle\",\n \"shortdesc\",\n \"author\",\n \"source\",\n \"publisher\",\n \"copyright\",\n \"critdates\",\n \"permissions\",\n \"metadata\",\n \"audience\",\n \"category\",\n \"keywords\",\n \"exportanchors\",\n \"prodinfo\",\n \"othermeta\",\n \"resourceid\",\n \"ux-window\",\n \"data\",\n ],\n critdates: [\"created\", \"revised\"],\n metadata: [\n \"audience\",\n \"category\",\n \"keywords\",\n \"prodinfo\",\n \"othermeta\",\n \"data\",\n ],\n copyright: [\"copyryear\", \"copyrholder\"],\n // `(indexterm | keyword)*` — a repeatable *choice*, so any interleaving is\n // valid and the order here only decides where a created element lands.\n keywords: [\"indexterm\", \"keyword\"],\n vrmlist: [\"vrm\"],\n // `prodname, vrmlist?, (brand | component | featnum | platform | prognum |\n // series)*`. The tail is a choice group too, so its internal order is\n // likewise a placement preference rather than a rule.\n prodinfo: [\n \"prodname\",\n \"vrmlist\",\n \"brand\",\n \"component\",\n \"featnum\",\n \"platform\",\n \"prognum\",\n \"series\",\n ],\n};\n\n/**\n * The container an element of this name lives inside, or `undefined` when it\n * hangs directly off the root.\n *\n * A map is flatter than a topic. `<topicmeta>` holds `audience`, `category` and\n * `prodinfo` as direct children, where a topic nests the first two inside\n * `<prolog><metadata>` and `prodinfo` one deeper still. Encoding it here keeps\n * that asymmetry in the one file that already knows about it.\n */\nexport function ditaContainerParent(\n shape: DitaShape,\n name: string,\n): string | undefined {\n if (name === \"prolog\" || name === \"topicmeta\") return undefined;\n // Two levels below the root are the same in both flavours: `<keywords>` and\n // `<prodinfo>` hang off `<metadata>`, and `<vrmlist>` off `<prodinfo>`. Only\n // the *top* level differs, which is what the fallthrough handles.\n if (name === \"vrmlist\") return \"prodinfo\";\n if (name === \"keywords\" || name === \"prodinfo\") {\n // A map may hold these directly under `<topicmeta>` or nest them in a\n // `<metadata>`; both are legal. Creating one goes to `<metadata>` in a\n // topic, where it is the only option, and directly under `<topicmeta>` in\n // a map, where it is the shorter of the two.\n return shape.kind === \"map\" ? \"topicmeta\" : \"metadata\";\n }\n return shape.kind === \"map\" ? \"topicmeta\" : \"prolog\";\n}\n\n/**\n * Where a new child goes inside a container, by content-model position.\n *\n * Returns the element it should be inserted *before*, or `undefined` for \"at the\n * end\", which the caller turns into an offset.\n *\n * Children the model does not list are skipped rather than used as anchors.\n * They are specializations docmeta has never seen, and inserting before one\n * would be a guess about a model it does not understand; going last is at least\n * a position the author can see and move.\n */\nexport function childAnchor(\n container: XmlElement,\n containerName: string,\n childName: string,\n): XmlElement | undefined {\n const model = DITA_CONTENT_MODEL[containerName] ?? [];\n const target = model.indexOf(childName);\n if (target === -1) return undefined;\n for (const child of childElements(container)) {\n const at = model.indexOf(child.nodeName.toLowerCase());\n if (at === -1) continue;\n if (at > target) return child;\n }\n return undefined;\n}\n\n/** Find a metadata container by name, searching down from the lift root. */\nexport function findContainer(\n from: XmlElement,\n name: string,\n): XmlElement | undefined {\n if (from.nodeName.toLowerCase() === name) return from;\n for (const child of childElements(from)) {\n const found = findContainer(child, name);\n if (found) return found;\n }\n return undefined;\n}\n\n/**\n * The element a document's typed metadata hangs off: `<prolog>` in a topic,\n * `<topicmeta>` in a map. Undefined when the document has neither.\n *\n * Distinct from {@link metadataContainers}, which finds the element holding\n * `<othermeta>` — one level deeper in a topic.\n */\nexport function liftRoot(\n root: XmlElement,\n shape: DitaShape,\n): XmlElement | undefined {\n const { prolog, container } = metadataContainers(root, shape);\n return shape.kind === \"map\" ? container : prolog;\n}\n\n/** Direct child elements of `el`, optionally filtered by name. */\nexport function childElements(el: XmlElement, name?: string): XmlElement[] {\n const out: XmlElement[] = [];\n for (let n = el.firstChild; n; n = n.nextSibling) {\n if (n.nodeType !== 1) continue;\n const child = n as unknown as XmlElement;\n if (name === undefined || child.nodeName.toLowerCase() === name) {\n out.push(child);\n }\n }\n return out;\n}\n\n/**\n * The element that directly holds `<othermeta>`, if the document already has\n * one, along with the `<prolog>` that would hold it for a topic.\n *\n * Both are reported because the writer needs to know which one is missing: a\n * topic with a `<prolog>` but no `<metadata>` needs only the inner element\n * created, while one with neither needs the whole block.\n */\nexport function metadataContainers(\n root: XmlElement,\n shape: DitaShape,\n): { prolog: XmlElement | undefined; container: XmlElement | undefined } {\n if (shape.kind === \"map\") {\n return { prolog: undefined, container: childElements(root, \"topicmeta\")[0] };\n }\n const prolog = childElements(root, \"prolog\")[0];\n return {\n prolog,\n container: prolog ? childElements(prolog, \"metadata\")[0] : undefined,\n };\n}\n\n/** The `<othermeta>` entries inside a metadata container, in document order. */\nexport function otherMetaEntries(\n container: XmlElement,\n): { key: string; value: string; el: XmlElement }[] {\n const out: { key: string; value: string; el: XmlElement }[] = [];\n for (const el of childElements(container, \"othermeta\")) {\n const key = el.getAttribute(\"name\");\n const value = el.getAttribute(\"content\");\n if (key != null && key !== \"\" && value != null) out.push({ key, value, el });\n }\n return out;\n}\n","/**\n * XML write-back, the inverse of the root-attribute read in `xml-read.ts`.\n *\n * Same discipline as `frontmatter-write.ts` and `html-write.ts`: splice, never\n * re-serialize. `XMLSerializer` would normalize the DOCTYPE's spelling, rewrite\n * single-quoted attributes as double-quoted, re-encode `>` inside values, and —\n * worst for the DITA-adjacent files this extractor also reads — turn an\n * unresolvable ` ` into `&nbsp;`, because the parser keeps such a\n * reference only as literal text. `xml-read.ts` goes out of its way to keep\n * those files readable; re-serializing would corrupt them on the way back out.\n *\n * The ranges come from `xml-locate.ts`, because xmldom reports positions and not\n * offsets. See that module for why the line index has to recognise six break\n * forms rather than one.\n *\n * Metadata lives in the root element's attributes, so that is where a write\n * goes. There is only the one channel, so \"write back to where the value was\n * read from\" holds by construction here — unlike DITA, which keeps metadata in\n * `<prolog>` and is refused below until it has a writer of its own.\n */\nimport { stringify as stringifyYaml } from \"yaml\";\nimport {\n DocmetaError,\n type ApplyOptions,\n type MetadataPatch,\n} from \"../types.js\";\nimport { dropUndefined, deepEqual } from \"./patch-util.js\";\nimport {\n readXml,\n isMetadataAttribute,\n type XmlElement,\n} from \"./xml-read.js\";\nimport { elementEdits } from \"./element-write.js\";\nimport { ditaEdits } from \"./dita-write.js\";\nimport {\n lineStarts,\n offsetAt,\n attrValueSpan,\n afterElementName,\n} from \"./xml-locate.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\ninterface Edit {\n start: number;\n end: number;\n text: string;\n}\n\nconst DQ = String.fromCharCode(34);\nconst BOM_CODE = 0xfeff;\n\nexport function applyXml(\n original: string,\n patch: MetadataPatch,\n options: ApplyOptions = {},\n): string {\n // `readXml` strips a BOM before parsing, so every position it reports is\n // relative to the stripped text. Splice against the same text and put the BOM\n // back afterwards — a prefix, so there is no offset arithmetic to get wrong.\n const bom = original.charCodeAt(0) === BOM_CODE;\n\n let before;\n try {\n before = readXml(original, options.filePath, { elements: options.elements });\n } catch (err) {\n // A document the reader rejects has no trustworthy positions, so there is\n // nothing safe to splice.\n throw new DocmetaError(\n `Refusing to write metadata: ${errorMessage(err)}`,\n );\n }\n\n const content = before.body;\n const root = before.root;\n if (root === undefined) {\n throw new DocmetaError(\n \"This XML document has no root element, so there is nowhere to write metadata.\",\n );\n }\n\n const clean = dropUndefined(patch);\n if (Object.keys(clean).length === 0) return original;\n\n // DITA keeps its metadata in <prolog>/<topicmeta>, and its DTD declares which\n // root attributes a topic may carry — so the generic root-attribute write\n // below would produce a document the user's own toolchain rejects.\n if (before.dita) {\n const next = spliceAll(\n content,\n ditaEdits(content, before, before.dita, clean, emitScalar, escapeAttr),\n );\n verify(next, before.data, clean, options);\n return bom ? original.slice(0, 1) + next : next;\n }\n\n const starts = lineStarts(content);\n const quoteOffsets = new Map<string, number>();\n const attrs = root.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs.item(i);\n if (!attr || !isMetadataAttribute(attr.name)) continue;\n if (attr.lineNumber == null || attr.columnNumber == null) continue;\n // An attribute's reported column is the opening quote of its value.\n quoteOffsets.set(\n attr.name,\n offsetAt(starts, attr.lineNumber, attr.columnNumber),\n );\n }\n\n const edits: Edit[] = [];\n const inserts: string[] = [];\n for (const [key, value] of Object.entries(clean)) {\n // Element-derived keys first. Without this the key falls through to the\n // attribute branch below and `article.title` is written as a *root\n // attribute* — a legal XML Name, so nothing would stop it — while the\n // reader keeps taking that key from the element. Proposal 0018 calls that\n // asymmetry a loop.\n const source = before.sources.get(key);\n if (source && source.kind !== \"attr\") {\n edits.push(\n ...elementEdits(content, starts, source, key, value, emitScalar, escapeAttr),\n );\n continue;\n }\n\n const emitted = emitScalar(key, value);\n const quoteOffset = quoteOffsets.get(key);\n if (quoteOffset === undefined) {\n // The key becomes an attribute *name*, which — unlike a value — cannot be\n // escaped into safety. A key that is not a legal XML Name would produce a\n // document that no longer parses, and the failure would surface from the\n // parser rather than from here.\n assertWritableName(key);\n assertNoElementCollision(key, root);\n inserts.push(`${key}=\"${escapeAttr(emitted, DQ)}\"`);\n continue;\n }\n const span = attrValueSpan(content, quoteOffset);\n if (span === undefined) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": its attribute value could not be located precisely.`,\n );\n }\n edits.push({\n start: span.start,\n end: span.end,\n text: escapeAttr(emitted, span.quote),\n });\n }\n\n if (inserts.length > 0) {\n const at = rootNameEnd(content, starts, root);\n edits.push({ start: at, end: at, text: ` ${inserts.join(\" \")}` });\n }\n\n const next = spliceAll(content, edits);\n verify(next, before.data, clean, options);\n return bom ? original.slice(0, 1) + next : next;\n}\n\n/** Where a new attribute goes: just past the root element's name. */\nfunction rootNameEnd(\n content: string,\n starts: number[],\n root: XmlElement,\n): number {\n const tagOffset = offsetAt(\n starts,\n root.lineNumber ?? 1,\n root.columnNumber ?? 1,\n );\n const at = afterElementName(content, tagOffset);\n if (at === undefined) {\n throw new DocmetaError(\n \"Refusing to write XML metadata: the root element's start tag could not be located.\",\n );\n }\n return at;\n}\n\n/**\n * Refuse a key that cannot be an XML attribute name.\n *\n * Values are escaped on the way in, so any value is writable; a *name* has no\n * such escape hatch. This covers the practical cases — a leading digit, a\n * space, a namespace prefix manni cannot declare, or an `xmlns:` that would\n * rewrite a namespace declaration — rather than the full XML Name production,\n * and errs toward refusing rather than emitting something the parser will\n * reject downstream.\n *\n * Deliberately stricter than XML itself: `xml:lang` is a perfectly legal name,\n * and its prefix is even predefined, but allowing colons in general would let\n * through prefixes with no binding in the document. Refusing something safe\n * costs a rename; allowing something unsafe costs a file that will not parse.\n * The message says which of the two reasons applied.\n */\nfunction assertWritableName(key: string): void {\n if (!/^[A-Za-z_][A-Za-z0-9._-]*$/.test(key)) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": it is not a valid XML attribute name, or uses a namespace prefix manni cannot declare. Writing it would produce a document that no longer parses. Rename the property, or set it manually.`,\n );\n }\n}\n\n/**\n * Refuse to *create* an attribute whose name collides with an element-derived\n * key on this document.\n *\n * A dot is legal in an XML Name, so nothing in `assertWritableName` stops\n * `article.title` becoming a root attribute on `<article>`. It must not: the\n * convention lifts the root's children as `<root>.<child>`, so the moment the\n * document grows an `<article><title>`, the reader takes that key from the\n * element and the attribute written here goes silently unread — one key meaning\n * two places depending on what the document happens to contain.\n *\n * Narrow on purpose. Only a first segment matching *this* root's name can\n * collide, so `dc.title` and `ms.date` stay writable, as they have always been.\n */\nfunction assertNoElementCollision(key: string, root: XmlElement): void {\n const [head, ...rest] = key.split(\".\");\n if (rest.length === 0 || head !== root.nodeName.toLowerCase()) return;\n throw new DocmetaError(\n `Refusing to create \"${key}\" as an attribute of <${root.nodeName}>: that name is how manni reads <${root.nodeName}><${rest.join(\".\")}>, so an attribute here would go unread as soon as the element exists. Add the element to the document and manni will update it in place.`,\n );\n}\n\n/** Emit a value the way the reader will parse it back: as a YAML scalar. */\nfunction emitScalar(key: string, value: unknown): string {\n const text = stringifyYaml(value).replace(/\\n$/, \"\");\n if (text.includes(\"\\n\")) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": the value needs more than one line, which an XML attribute cannot hold. Set it manually.`,\n );\n }\n return text;\n}\n\nfunction escapeAttr(value: string, quote: string): string {\n const escaped = value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n return quote === \"'\"\n ? escaped.replace(/'/g, \"'\")\n : escaped.replace(/\"/g, \""\");\n}\n\n/** Apply every edit back-to-front, so earlier offsets stay valid. */\nfunction spliceAll(content: string, edits: Edit[]): string {\n const ordered = [...edits].sort((a, b) => b.start - a.start);\n let out = content;\n let lastStart = Number.POSITIVE_INFINITY;\n for (const edit of ordered) {\n /* c8 ignore next 5 -- defensive: attributes are distinct spans by construction. */\n if (edit.end > lastStart) {\n throw new DocmetaError(\n \"Internal error: overlapping edits while writing XML metadata.\",\n );\n }\n out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);\n lastStart = edit.start;\n }\n return out;\n}\n\n/**\n * Re-read the written document and confirm it says exactly what it should. A\n * bug above becomes a refusal rather than a corrupted file.\n */\nfunction verify(\n next: string,\n before: Record<string, unknown>,\n patch: MetadataPatch,\n options: ApplyOptions,\n): void {\n const expected = { ...before, ...patch };\n // Same path as the original read: a `.dita` file re-read as plain XML would\n // not see the <othermeta> just written, and the check would fail for the\n // wrong reason.\n //\n // The re-parse is guarded because it is the one place a writer bug shows up\n // as a *parse* failure rather than a mismatch, and `apply`'s contract is that\n // a document it cannot rewrite safely raises `DocmetaError` — not whatever\n // the parser happened to throw.\n let actual;\n try {\n // Re-read with the *same* options the write used. Without the config\n // element paths this cannot see a key an `elements:` path produced, so it\n // would find the key missing and refuse every write to one.\n actual = readXml(next, options.filePath, {\n elements: options.elements,\n }).data;\n } catch (err) {\n throw new DocmetaError(\n `Refusing to write XML metadata: the rewritten document did not parse (${errorMessage(err)}).`,\n );\n }\n if (!deepEqual(actual, expected)) {\n throw new DocmetaError(\n \"Refusing to write XML metadata: the rewritten document did not read back as expected.\",\n );\n }\n}\n","/**\n * Turning xmldom's positions into character offsets.\n *\n * xmldom reports only where a node *starts*, as `lineNumber` and\n * `columnNumber` — there is no `startOffset`, no end position, and no marker for\n * the end of a start tag. (The SAX layer does compute an offset per attribute\n * and then discards it converting to line/column.) Splicing needs ranges, so\n * this module rebuilds them.\n *\n * The subtlety is which characters count as line breaks. xmldom measures against\n * `normalizeLineEndings(source)`, which folds CR LF, lone CR, NEL (U+0085), LINE\n * SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) all down to LF before\n * counting. An index that recognised only LF would drift the moment a document\n * used any of the others, and the symptom is not a wrong answer — it is a splice\n * at the wrong offset, which is a corrupted file. So the index below counts\n * exactly those six forms, and `xml-write.test.ts` pins each one.\n *\n * CR LF is two characters folding to one, which shortens the normalized string.\n * That is harmless here because reconstruction goes from (line, line-relative\n * column) against the *original*, so a length change earlier in the file cannot\n * shift anything.\n */\n\n/** The six break forms xmldom folds to LF before counting lines. */\nconst LINE_BREAK = /\\r\\n|\\r|\\n|\\u0085|\\u2028|\\u2029/g;\n\n/** Character offsets at which each 1-based line begins. */\nexport function lineStarts(source: string): number[] {\n const starts = [0];\n LINE_BREAK.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = LINE_BREAK.exec(source)) !== null) {\n starts.push(match.index + match[0].length);\n }\n return starts;\n}\n\n/**\n * The offset of a 1-based (line, column) pair. Out-of-range lines clamp to the\n * start of the document rather than returning NaN, so a caller that mis-reads a\n * position gets a refusal from the verify step rather than a silent splice at\n * an undefined index.\n */\nexport function offsetAt(starts: number[], line: number, column: number): number {\n const base = starts[line - 1];\n if (base === undefined) return 0;\n return base + column - 1;\n}\n\n/**\n * The span of a quoted attribute value, given the offset of its opening quote —\n * which is exactly what xmldom's `columnNumber` points at for an attribute.\n *\n * Returns the range *inside* the quotes and the quote character in use, so a\n * rewrite keeps the document's original quoting style.\n */\nexport function attrValueSpan(\n source: string,\n quoteOffset: number,\n): { start: number; end: number; quote: string } | undefined {\n const quote = source[quoteOffset];\n if (quote !== '\"' && quote !== \"'\") return undefined;\n const close = source.indexOf(quote, quoteOffset + 1);\n if (close === -1) return undefined;\n return { start: quoteOffset + 1, end: close, quote };\n}\n\n/**\n * The offset just past a start tag's element name, which is where a new\n * attribute can always be inserted.\n *\n * Inserting here rather than before the closing `>` is deliberate: finding that\n * `>` means scanning past attribute values that may themselves contain one,\n * while the name ends at the first whitespace, `/` or `>` and cannot be\n * mistaken. `tagOffset` is the offset of the `<`.\n */\nexport function afterElementName(\n source: string,\n tagOffset: number,\n): number | undefined {\n if (source[tagOffset] !== \"<\") return undefined;\n let i = tagOffset + 1;\n while (i < source.length && !/[\\s/>]/.test(source[i] ?? \"\")) i++;\n return i > tagOffset + 1 ? i : undefined;\n}\n\n/**\n * The offset just past a start tag's closing `>`, and whether it self-closed.\n *\n * Attribute values can contain `>`, so this tracks quoting rather than scanning\n * for the first one. `tagOffset` is the offset of the `<`.\n */\nexport function startTagEnd(\n source: string,\n tagOffset: number,\n): { end: number; selfClosing: boolean } | undefined {\n if (source[tagOffset] !== \"<\") return undefined;\n let quote: string | undefined;\n for (let i = tagOffset + 1; i < source.length; i++) {\n const ch = source[i];\n if (quote !== undefined) {\n if (ch === quote) quote = undefined;\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === \">\") {\n return { end: i + 1, selfClosing: source[i - 1] === \"/\" };\n }\n }\n return undefined;\n}\n\n/**\n * The offset of `</name>` searching forward from `from`.\n *\n * Used only for the shallow, non-recursive containers DITA metadata lives in\n * (`prolog`, `metadata`, `topicmeta`), none of which nests inside itself, so a\n * forward search cannot find the wrong one.\n *\n * This is a text search, not a lexer: it does not skip comments or CDATA, so a\n * `<!-- </prolog> -->` ahead of the real close tag would match here and the\n * write would splice into the comment. That cannot reach disk — the caller\n * re-reads the result, finds the key absent because xmldom ignores comment\n * text, and refuses — but the refusal reads as the generic \"did not read back\n * as expected\", so this note is the missing half of that diagnosis.\n */\nexport function closeTagStart(\n source: string,\n from: number,\n name: string,\n): number | undefined {\n const needle = `</${name}`;\n let i = source.indexOf(needle, from);\n while (i !== -1) {\n const after = source[i + needle.length];\n if (after === \">\" || (after !== undefined && /\\s/.test(after))) return i;\n i = source.indexOf(needle, i + 1);\n }\n return undefined;\n}\n","/**\n * Writing back to element-derived metadata, shared by the plain-XML and DITA\n * writers.\n *\n * Both cases here **replace a span that already exists**, which is what makes\n * them safe in a dialect docmeta knows nothing about: swapping the text between\n * `<title>` and `</title>`, or the value inside an attribute's quotes, cannot\n * change whether the document is valid. Creating an element that is *not* there\n * is a different problem — it needs to know where the element is legal — and\n * lives with the content model that can answer that.\n *\n * The count rule is the other half. A key backed by N elements receiving M\n * values is only unambiguous when M equals N: each value replaces one element,\n * in document order. Fewer values would mean deleting elements and more would\n * mean creating them, and both change the document's shape rather than its\n * content. Those are refused by name rather than guessed at, because a `fill`\n * that quietly dropped an `<author>` is worse than one that declines.\n */\nimport { DocmetaError } from \"../types.js\";\nimport type { XmlElement, XmlSource } from \"./xml-read.js\";\nimport {\n attrValueSpan,\n closeTagStart,\n offsetAt,\n startTagEnd,\n} from \"./xml-locate.js\";\n\n/** One character-range replacement in the source. */\nexport interface Edit {\n start: number;\n end: number;\n text: string;\n}\n\n/**\n * Escape text destined for element content.\n *\n * `&` and `<` are mandatory. `>` is escaped too — not required by XML except\n * after `]]`, but linters flag it and the attribute path already escapes it, so\n * matching keeps one rule rather than two.\n */\nexport function escapeText(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n}\n\n/**\n * The values a write should distribute across the elements backing a key.\n *\n * A scalar key is one value; a list key is its items. Anything else — a list\n * whose length no longer matches, or an object where text was read — is refused\n * here rather than partially applied.\n */\nexport function valuesFor(\n key: string,\n value: unknown,\n count: number,\n): unknown[] {\n const values = Array.isArray(value) ? value : [value];\n if (values.length !== count) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": the document has ${count} element${\n count === 1 ? \"\" : \"s\"\n } for it and ${values.length} value${\n values.length === 1 ? \"\" : \"s\"\n } was given. manni updates elements in place; adding or removing one ` +\n \"changes the document's shape, which it will not do on your behalf.\",\n );\n }\n return values;\n}\n\n/** Replace the text between an element's start and end tags. */\nexport function elementTextEdit(\n content: string,\n starts: number[],\n el: XmlElement,\n key: string,\n emitted: string,\n): Edit {\n const from = elementOffset(starts, el, key);\n const open = startTagEnd(content, from);\n if (open === undefined) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": the <${el.nodeName}> start tag could not be located.`,\n );\n }\n if (open.selfClosing) {\n // `<title/>` has no text span to replace. Turning it into `<title>x</title>`\n // is a shape change, and the count rule above says those are the author's\n // to make.\n throw new DocmetaError(\n `Refusing to write \"${key}\": <${el.nodeName}> is self-closing, so it has no text to replace.`,\n );\n }\n const close = closeTagStart(content, open.end, el.nodeName);\n if (close === undefined) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": <${el.nodeName}> has no closing tag.`,\n );\n }\n return { start: open.end, end: close, text: escapeText(emitted) };\n}\n\n/** Replace the value inside an element attribute's quotes. */\nexport function elementAttrEdit(\n content: string,\n starts: number[],\n el: XmlElement,\n attrName: string,\n key: string,\n emitted: string,\n escape: (value: string, quote: string) => string,\n): Edit {\n const attrs = el.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs.item(i);\n if (!attr || attr.name !== attrName) continue;\n /* c8 ignore next -- xmldom always reports a position for an attribute it parsed. */\n if (attr.lineNumber == null || attr.columnNumber == null) break;\n const span = attrValueSpan(\n content,\n offsetAt(starts, attr.lineNumber, attr.columnNumber),\n );\n if (span === undefined) break;\n return {\n start: span.start,\n end: span.end,\n text: escape(emitted, span.quote),\n };\n }\n throw new DocmetaError(\n `Refusing to write \"${key}\": the \"${attrName}\" attribute on <${el.nodeName}> could not be located precisely.`,\n );\n}\n\nfunction elementOffset(\n starts: number[],\n el: XmlElement,\n key: string,\n): number {\n /* c8 ignore next 5 -- xmldom reports a position for every element it parsed. */\n if (el.lineNumber == null || el.columnNumber == null) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": <${el.nodeName}> has no recorded position.`,\n );\n }\n return offsetAt(starts, el.lineNumber, el.columnNumber);\n}\n\n/**\n * Edits for a key whose value lives in elements rather than a root attribute.\n *\n * One edit per element, in document order, after `valuesFor` has confirmed the\n * counts line up.\n */\nexport function elementEdits(\n content: string,\n starts: number[],\n source: Exclude<XmlSource, { kind: \"attr\" }>,\n key: string,\n value: unknown,\n emit: (key: string, value: unknown) => string,\n escape: (value: string, quote: string) => string,\n): Edit[] {\n if (source.kind === \"othermeta\") {\n return [\n elementAttrEdit(\n content,\n starts,\n source.el,\n \"content\",\n key,\n emit(key, value),\n escape,\n ),\n ];\n }\n const values = valuesFor(key, value, source.els.length);\n return source.els.map((el, i) =>\n source.kind === \"element-attr\"\n ? elementAttrEdit(\n content,\n starts,\n el,\n source.name,\n key,\n emit(key, values[i]),\n escape,\n )\n : elementTextEdit(content, starts, el, key, emit(key, values[i])),\n );\n}\n","/**\n * DITA write-back.\n *\n * The proposal that introduced write support called a `<prolog>` writer \"a\n * separate project\" and left DITA read-only permanently. This is that project.\n * The reason it is not simply \"XML, but deeper\" is the content model: DITA\n * declares which attributes a topic may carry, so the generic XML writer's move\n * — add an attribute to the root element — produces a topic the user's own\n * toolchain rejects. Metadata has a designated home instead:\n * `<prolog><metadata><othermeta/></metadata></prolog>` for topics,\n * `<topicmeta>` for maps.\n *\n * Which of those a given key uses is not this module's decision. `fill` corrects\n * values that are present but *invalid*, not only missing ones, so a rule like\n * \"new values go in an othermeta\" would add a correction beside the stale root\n * attribute a DITA processor actually reads — docmeta reporting green over a\n * topic that still says the wrong thing. So:\n *\n * 1. read from a root attribute -> update that attribute's value span\n * 2. read from an <othermeta> -> update its `content` span\n * 3. absent from both -> insert an <othermeta>, creating\n * <metadata> and <prolog> only as needed\n *\n * Cases 1 and 2 replace spans that already exist and so cannot change whether\n * the document is valid. Only case 3 adds structure, and it adds it where the\n * DTD already allows it.\n */\nimport {\n DocmetaError,\n type MetadataPatch,\n} from \"../types.js\";\nimport {\n childAnchor,\n childElements,\n ditaContainerParent,\n findContainer,\n liftRoot,\n metadataContainers,\n DITA_ATTR_KEYS,\n DITA_CONTENT_MODEL,\n DITA_LIFTS,\n type DitaLift,\n type DitaShape,\n} from \"./dita.js\";\nimport { elementEdits, escapeText } from \"./element-write.js\";\nimport type { XmlElement, XmlRead } from \"./xml-read.js\";\nimport {\n lineStarts,\n offsetAt,\n attrValueSpan,\n startTagEnd,\n closeTagStart,\n} from \"./xml-locate.js\";\n\nexport interface Edit {\n start: number;\n end: number;\n text: string;\n}\n\n/**\n * Build the edits that set `patch` on a DITA document. The caller splices and\n * verifies, so this stays a pure description of what should change.\n */\nexport function ditaEdits(\n content: string,\n read: XmlRead,\n shape: DitaShape,\n patch: MetadataPatch,\n emit: (key: string, value: unknown) => string,\n escape: (value: string, quote: string) => string,\n): Edit[] {\n const root = read.root;\n /* c8 ignore next 3 -- the caller has already refused a rootless document. */\n if (!root) {\n throw new DocmetaError(\"This DITA document has no root element.\");\n }\n\n const starts = lineStarts(content);\n const edits: Edit[] = [];\n const fresh: { key: string; value: string }[] = [];\n const freshElements: FreshElement[] = [];\n\n for (const [key, raw] of Object.entries(patch)) {\n const source = read.sources.get(key);\n // Emitted per branch rather than up front. A list-valued key — `author*` in\n // the content model — is emitted one item at a time by `elementEdits`;\n // emitting the whole array here would serialize it as a YAML block, hit the\n // \"needs more than one line\" guard, and refuse a write that is perfectly\n // expressible as two `<author>` elements.\n if (source?.kind === \"attr\") {\n edits.push(\n attributeEdit(content, starts, root, source.name, emit(key, raw), escape),\n );\n } else if (source?.kind === \"othermeta\") {\n edits.push(\n otherMetaEdit(content, starts, source.el, key, emit(key, raw), escape),\n );\n } else if (\n source?.kind === \"element-text\" ||\n source?.kind === \"element-attr\"\n ) {\n // A typed prolog element — <author>, <created date=…>. Written where it\n // was read, which for DITA also means written where the DTD already\n // allows it: the element exists, so only its value changes.\n edits.push(...elementEdits(content, starts, source, key, raw, emit, escape));\n } else {\n // A key naming a typed element docmeta knows — `prolog.author` — is\n // created as that element. Anything else keeps the othermeta channel,\n // which is where a key with no place in the content model belongs.\n const dot = key.indexOf(\".\");\n const container = dot === -1 ? \"\" : key.slice(0, dot);\n const element = dot === -1 ? \"\" : key.slice(dot + 1);\n if (DITA_ATTR_KEYS.has(key)) {\n // `vrm.version` and friends look exactly like a `container.element`\n // key and are not one: the key names an *attribute*, three of which\n // share one `<vrm>`. Creating it would mean synthesising the element\n // and folding the sibling keys into it, which is not what the create\n // path does — and falling through to an `<othermeta>` would put the\n // value where the reader stops looking the moment a real `<vrm>`\n // appears. Refusing is the only honest option until it has a writer.\n throw new DocmetaError(\n `manni meta fill cannot create \"${key}\": it names an attribute of an element the document does not have. Add the <${key.slice(0, key.indexOf(\".\"))}> element, and manni will keep it up to date.`,\n );\n }\n const spec = ownLift(container, element);\n if (spec) {\n freshElements.push({ key, container, element, spec, value: raw });\n } else {\n fresh.push({ key, value: emit(key, raw) });\n }\n }\n }\n\n if (fresh.length > 0) {\n edits.push(insertEdit(content, starts, root, shape, fresh, escape));\n }\n if (freshElements.length > 0) {\n edits.push(\n ...newElementEdits(\n content,\n starts,\n root,\n shape,\n freshElements,\n emit,\n escape,\n ),\n );\n }\n return edits;\n}\n\n/**\n * Own-property lookup into the lift table.\n *\n * The key comes from a patch, so `constructor.name` would otherwise find\n * `Object.prototype` and be treated as a liftable element.\n */\nfunction ownLift(container: string, element: string): DitaLift | undefined {\n if (!Object.prototype.hasOwnProperty.call(DITA_LIFTS, container)) {\n return undefined;\n }\n const lifts = DITA_LIFTS[container];\n return lifts && Object.prototype.hasOwnProperty.call(lifts, element)\n ? lifts[element]\n : undefined;\n}\n\n/** A typed element the document does not have yet. */\ninterface FreshElement {\n key: string;\n container: string;\n element: string;\n spec: DitaLift;\n value: unknown;\n}\n\n/**\n * Create typed elements the document is missing, in content-model order.\n *\n * This is the one place in the DITA writer that adds structure rather than\n * replacing a span, so it is the one place that can produce a topic the user's\n * DTD rejects. Four things keep it honest:\n *\n * - **Position comes from the content model, not from convenience.** A DITA\n * container is a sequence, so `<critdates>` after `<metadata>` is invalid even\n * though both are allowed.\n * - **Blocks are grouped by anchor, not by container.** Two containers can\n * resolve to one insertion point, and two edits at one offset overlap —\n * which `spliceAll` refuses, turning a legitimate multi-field `fill` into an\n * internal error.\n * - **Containers that do not exist yet are merged into one nest.** Every\n * placement is computed against the *original* document, so three keys that\n * each need a `<metadata>` would each create one. `metadata*` is repeatable,\n * so three siblings are technically valid and no content-model check catches\n * it — it is simply not what a person would write, and `fill` is not supposed\n * to be identifiable by its output.\n * - **Tags and created containers interleave by model position.** `<source>`\n * has to precede a `<copyright>` created in the same edit, so ordering cannot\n * be \"values first, then containers\".\n */\nfunction newElementEdits(\n content: string,\n starts: number[],\n root: XmlElement,\n shape: DitaShape,\n items: FreshElement[],\n emit: (key: string, value: unknown) => string,\n escape: (value: string, quote: string) => string,\n): Edit[] {\n const eol = content.includes(CRLF) ? CRLF : LF;\n const liftRootEl = liftRoot(root, shape);\n\n /** `<author>Ada</author>` or `<created date=\"…\"/>`, one per value. */\n const tagsFor = (item: FreshElement): Tag[] => {\n const values = Array.isArray(item.value) ? item.value : [item.value];\n return values.map((v) => {\n const emitted = emit(item.key, v);\n return {\n name: item.element,\n text: item.spec.attr\n ? `<${item.element} ${item.spec.attr}=\"${escape(emitted, DQ)}\"/>`\n : `<${item.element}>${escapeText(emitted)}</${item.element}>`,\n };\n });\n };\n\n const byContainer = new Map<string, FreshElement[]>();\n for (const item of items) {\n const group = byContainer.get(item.container);\n if (group) group.push(item);\n else byContainer.set(item.container, [item]);\n }\n\n const placements: Placement[] = [];\n for (const [containerName, group] of byContainer) {\n const missing: string[] = [];\n let name: string | undefined = containerName;\n let host: XmlElement | undefined;\n while (name !== undefined) {\n const found = liftRootEl ? findContainer(liftRootEl, name) : undefined;\n if (found) {\n host = found;\n break;\n }\n missing.unshift(name);\n name = ditaContainerParent(shape, name);\n }\n\n const tags = group.flatMap(tagsFor);\n const outermost = missing[0] ?? group[0]?.element ?? \"\";\n\n if (host) {\n const hostName = host.nodeName.toLowerCase();\n const before = childAnchor(host, hostName, outermost);\n const at = before\n ? offsetAt(starts, before.lineNumber ?? 1, before.columnNumber ?? 1)\n : closeOf(content, starts, host, host.nodeName);\n placements.push({\n at,\n base: \"\",\n hostName,\n missing,\n tags,\n atClose: before === undefined,\n });\n } else {\n placements.push({\n at: newContainerAnchor(content, starts, root, shape),\n base: siblingIndent(content, starts, root),\n hostName: \"\",\n missing,\n tags,\n atClose: false,\n });\n }\n }\n\n const byAnchor = new Map<number, Placement[]>();\n for (const p of placements) {\n const group = byAnchor.get(p.at);\n if (group) group.push(p);\n else byAnchor.set(p.at, [p]);\n }\n\n const edits: Edit[] = [];\n for (const [at, group] of byAnchor) {\n const base = group.find((p) => p.base !== \"\")?.base ?? \"\";\n const anchor = anchorBefore(content, at, base || \" \");\n const atClose = group.some((p) => p.atClose);\n const indent = base || anchor.indent + (atClose ? \" \" : \"\");\n const hostName = group.find((p) => p.hostName !== \"\")?.hostName ?? \"\";\n\n // Merge every placement at this anchor into one tree, so containers that\n // do not exist yet are created once rather than once per key.\n const nest: Nest = { tags: [], children: new Map() };\n for (const p of group) {\n let node = nest;\n for (const name of p.missing) {\n let child = node.children.get(name);\n if (!child) {\n child = { tags: [], children: new Map() };\n node.children.set(name, child);\n }\n node = child;\n }\n node.tags.push(...p.tags);\n }\n\n edits.push({\n start: anchor.start,\n end: anchor.end,\n text:\n (anchor.lead ? eol : \"\") +\n renderNest(nest, hostName, indent, 0).join(eol) +\n eol +\n anchor.indent,\n });\n }\n return edits;\n}\n\n/** A tag to emit, with the element name its model position is looked up by. */\ninterface Tag {\n name: string;\n text: string;\n}\n\n/** Values and sub-containers to create inside one container. */\ninterface Nest {\n tags: Tag[];\n children: Map<string, Nest>;\n}\n\n/**\n * Serialize a nest, interleaving values and sub-containers by model position.\n *\n * Sorting the two separately would put `<source>` after a `<copyright>` created\n * beside it, which the content model forbids.\n */\nfunction renderNest(\n nest: Nest,\n containerName: string,\n indent: string,\n depth: number,\n): string[] {\n const pad = indent + \" \".repeat(depth);\n const entries: { order: number; lines: string[] }[] = [];\n\n for (const tag of nest.tags) {\n entries.push({\n order: modelIndex(containerName, tag.name),\n lines: [pad + tag.text],\n });\n }\n for (const [name, child] of nest.children) {\n entries.push({\n order: modelIndex(containerName, name),\n lines: [\n pad + `<${name}>`,\n ...renderNest(child, name, indent, depth + 1),\n pad + `</${name}>`,\n ],\n });\n }\n\n // A stable sort keeps repeated values (two `<author>`) in the order they were\n // given, since they share one model position.\n return entries\n .sort((a, b) => a.order - b.order)\n .flatMap((e) => e.lines);\n}\n\n/** One block of new markup, and where it goes. */\ninterface Placement {\n at: number;\n base: string;\n /** The existing container the block goes inside, or \"\" for the root. */\n hostName: string;\n missing: string[];\n tags: Tag[];\n /**\n * Whether the anchor is the container's closing tag rather than an existing\n * sibling. It changes the indent by one level: a sibling already sits where\n * the new block goes, but a closing tag sits a level out from the children it\n * closes over.\n */\n atClose: boolean;\n}\n\n/** Position of `name` in `container`'s content model; unknown sorts last. */\nfunction modelIndex(container: string, name: string): number {\n const model = DITA_CONTENT_MODEL[container] ?? [];\n const at = model.indexOf(name);\n return at === -1 ? Number.MAX_SAFE_INTEGER : at;\n}\n\n/** Replace a root attribute's value span — case 1. */\nfunction attributeEdit(\n content: string,\n starts: number[],\n root: XmlElement,\n name: string,\n emitted: string,\n escape: (value: string, quote: string) => string,\n): Edit {\n const attrs = root.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs.item(i);\n if (!attr || attr.name !== name) continue;\n /* c8 ignore next -- xmldom always reports a position for an attribute it parsed. */\n if (attr.lineNumber == null || attr.columnNumber == null) break;\n const span = attrValueSpan(\n content,\n offsetAt(starts, attr.lineNumber, attr.columnNumber),\n );\n if (span === undefined) break;\n return { start: span.start, end: span.end, text: escape(emitted, span.quote) };\n }\n throw new DocmetaError(\n `Refusing to write \"${name}\": its attribute value could not be located precisely.`,\n );\n}\n\n/** Replace an existing `<othermeta>`'s `content` value span — case 2. */\nfunction otherMetaEdit(\n content: string,\n starts: number[],\n el: XmlElement,\n key: string,\n emitted: string,\n escape: (value: string, quote: string) => string,\n): Edit {\n const attrs = el.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs.item(i);\n if (!attr || attr.name !== \"content\") continue;\n /* c8 ignore next -- xmldom always reports a position for an attribute it parsed. */\n if (attr.lineNumber == null || attr.columnNumber == null) break;\n const span = attrValueSpan(\n content,\n offsetAt(starts, attr.lineNumber, attr.columnNumber),\n );\n if (span === undefined) break;\n return { start: span.start, end: span.end, text: escape(emitted, span.quote) };\n }\n throw new DocmetaError(\n `Refusing to write \"${key}\": its <othermeta> content attribute could not be located precisely.`,\n );\n}\n\n/**\n * Insert new `<othermeta>` entries, creating whatever containers are missing —\n * case 3.\n *\n * Each insertion replaces the whitespace run in front of an anchor rather than\n * inserting at the anchor itself. Inserting would leave that run stranded as a\n * blank line, and a `fill` that reformats the file around its own edit is the\n * thing the splice-only rule exists to prevent.\n */\nfunction insertEdit(\n content: string,\n starts: number[],\n root: XmlElement,\n shape: DitaShape,\n fresh: { key: string; value: string }[],\n escape: (value: string, quote: string) => string,\n): Edit {\n const { prolog, container } = metadataContainers(root, shape);\n const eol = content.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const tag = (f: { key: string; value: string }): string =>\n `<othermeta name=\"${escape(f.key, DQ)}\" content=\"${escape(f.value, DQ)}\"/>`;\n const build = (a: Anchor, lines: string[]): Edit => ({\n start: a.start,\n end: a.end,\n text: (a.lead ? eol : \"\") + lines.join(eol) + eol + a.indent,\n });\n\n // The container exists: append inside it. `<othermeta>` sits late in the\n // metadata content model, so appending keeps the order the DTD expects.\n if (container) {\n const anchor = anchorBefore(\n content,\n closeOf(content, starts, container, container.nodeName),\n );\n return build(\n anchor,\n fresh.map((f) => anchor.indent + \" \" + tag(f)),\n );\n }\n\n // A topic with a <prolog> but no <metadata>: create just the inner element.\n if (prolog) {\n const anchor = anchorBefore(\n content,\n closeOf(content, starts, prolog, prolog.nodeName),\n );\n const meta = anchor.indent + \" \";\n return build(anchor, [\n meta + \"<metadata>\",\n ...fresh.map((f) => meta + \" \" + tag(f)),\n meta + \"</metadata>\",\n ]);\n }\n\n // Neither exists: create the whole block, in the position the content model\n // requires — after the title and friends, before the body.\n const at = newContainerAnchor(content, starts, root, shape);\n // Two different indents. `anchor.indent` is the anchor's own, restored after\n // the block so the element that follows keeps its position; `base` is where\n // the new block sits. They differ when the anchor is the root's closing tag,\n // which sits a level out from the children the block joins.\n const base = siblingIndent(content, starts, root);\n const anchor = anchorBefore(content, at, base);\n if (shape.kind === \"map\") {\n return build(anchor, [\n base + \"<topicmeta>\",\n ...fresh.map((f) => base + \" \" + tag(f)),\n base + \"</topicmeta>\",\n ]);\n }\n return build(anchor, [\n base + \"<prolog>\",\n base + \" <metadata>\",\n ...fresh.map((f) => base + \" \" + tag(f)),\n base + \" </metadata>\",\n base + \"</prolog>\",\n ]);\n}\n\ninterface Anchor {\n start: number;\n end: number;\n indent: string;\n lead: boolean;\n}\n\n/**\n * The whitespace run in front of `at`, so new lines can replace it and put it\n * back — which is what keeps the anchor's own indentation intact.\n *\n * When `at` does not begin its line there is no run to reuse, so the caller\n * emits a leading newline and falls back to a supplied indent.\n */\nfunction anchorBefore(content: string, at: number, fallback = \" \"): Anchor {\n let i = at;\n while (i > 0 && (content[i - 1] === \" \" || content[i - 1] === \"\\t\")) i--;\n if (i > 0 && content[i - 1] === \"\\n\") {\n return { start: i, end: at, indent: content.slice(i, at), lead: false };\n }\n return { start: at, end: at, indent: fallback, lead: true };\n}\n\n/**\n * The indentation of the root's first child element, used when a new container\n * is anchored on the root's closing tag — which sits at the parent's indent and\n * so would put the block a level too far out.\n */\nfunction siblingIndent(\n content: string,\n starts: number[],\n root: XmlElement,\n): string {\n const first = childElements(root)[0];\n if (!first) return \" \";\n const at = offsetAt(starts, first.lineNumber ?? 1, first.columnNumber ?? 1);\n const lineStart = content.lastIndexOf(\"\\n\", at - 1) + 1;\n const between = content.slice(lineStart, at);\n return /^[ \\t]*$/.test(between) ? between : \" \";\n}\n\nconst DQ = String.fromCharCode(34);\nconst CRLF = String.fromCharCode(13, 10);\nconst LF = String.fromCharCode(10);\n\n/**\n * The offset of a container's close tag, which is where new children go.\n *\n * `name` is the element's own `nodeName`, not the canonical lowercase one the\n * shape carries. The reader finds these containers by comparing lowercased\n * names, so it accepts a `<Metadata>`; searching for `</metadata>` here would\n * then refuse a document the reader had just read, with a message describing a\n * tag the file does not contain.\n */\nfunction closeOf(\n content: string,\n starts: number[],\n el: XmlElement,\n name: string,\n): number {\n const from = offsetAt(starts, el.lineNumber ?? 1, el.columnNumber ?? 1);\n const open = startTagEnd(content, from);\n if (open === undefined || open.selfClosing) {\n // `<metadata/>` has no inside to append to. Refusing beats rewriting the\n // tag, which would take this out of splice-only territory.\n throw new DocmetaError(\n `Refusing to write DITA metadata: <${name}> is self-closing, so there is nowhere to add an entry. Expand it to <${name}></${name}> and retry.`,\n );\n }\n const close = closeTagStart(content, open.end, name);\n if (close === undefined) {\n throw new DocmetaError(\n `Refusing to write DITA metadata: <${name}> has no closing tag.`,\n );\n }\n return close;\n}\n\n/**\n * Where a brand-new metadata container goes: immediately before the first child\n * that is not part of the preamble, or before the root's close tag when every\n * child is (a topic with a title and nothing else).\n */\nfunction newContainerAnchor(\n content: string,\n starts: number[],\n root: XmlElement,\n shape: DitaShape,\n): number {\n for (const child of childElements(root)) {\n if (shape.preamble.has(child.nodeName.toLowerCase())) continue;\n return offsetAt(starts, child.lineNumber ?? 1, child.columnNumber ?? 1);\n }\n const from = offsetAt(starts, root.lineNumber ?? 1, root.columnNumber ?? 1);\n const open = startTagEnd(content, from);\n const close =\n open === undefined\n ? undefined\n : closeTagStart(content, open.end, root.nodeName);\n if (close === undefined) {\n throw new DocmetaError(\n \"Refusing to write DITA metadata: the root element's closing tag could not be located.\",\n );\n }\n return close;\n}\n","/**\n * XML metadata extractor.\n *\n * Also handles DITA topics (`.dita`) and maps (`.ditamap`), which are XML.\n *\n * Reads metadata from the document's root-element attributes, e.g.\n * `<document type=\"concept\" version=\"2\">` yields `{ type: \"concept\", version: 2 }`.\n * Attribute values are parsed as YAML scalars so `\"2\"` -> number and `\"true\"` ->\n * boolean, consistent with the AsciiDoc header extractor. Namespace declarations\n * (`xmlns`, `xmlns:*`) are dropped as transport noise. Per-node line and column\n * numbers from the parser give JSON-Pointer -> source-line and -> source-column\n * maps for precise annotations. Both are 1-based.\n *\n * Malformed XML is surfaced as a thrown error; the command layer records it as a\n * per-file failure so the rest of the run continues (mirroring frontmatter).\n *\n * The read itself lives in `xml-read.ts`, shared with `xml-write.ts` so that a\n * write lands on the attribute the read took its value from.\n */\nimport { readXml, toExtracted } from \"./xml-read.js\";\nimport { applyXml } from \"./xml-write.js\";\nimport type { ExtractedMetadata, MetadataExtractor } from \"../types.js\";\n\nexport const xmlExtractor: MetadataExtractor = {\n name: \"xml\",\n // DITA topics and maps are XML, and their metadata lives on the root element\n // (`id`, `type`, `xml:lang`, …), so they need no extractor of their own.\n extensions: [\".xml\", \".dita\", \".ditamap\"],\n extract(content, filePath, options): ExtractedMetadata {\n return toExtracted(readXml(content, filePath, options));\n },\n apply: applyXml,\n};\n","/**\n * The HTML read model, split out so that `html.ts` (which extracts) and\n * `html-write.ts` (which writes back) share one implementation of it.\n *\n * That sharing is the point, not tidiness. A write has to land in the same\n * place the read takes its value from; if the two disagree about which tag wins,\n * `fill` writes somewhere the reader ignores, the field stays invalid, and the\n * next run proposes it again. So precedence is decided exactly once, here, and\n * `sources` reports the winner so the writer can aim at it.\n */\nimport { parse, defaultTreeAdapter, type DefaultTreeAdapterMap } from \"parse5\";\nimport { parse as parseYamlScalar } from \"yaml\";\nimport { escapePointerSegment } from \"./pointer.js\";\nimport {\n liftKey,\n pairValues,\n parseElementPath,\n type ElementPath,\n} from \"./element-key.js\";\nimport type { ExtractOptions } from \"../types.js\";\n\nexport type Element = DefaultTreeAdapterMap[\"element\"];\n\n/** Where a key's winning value came from. */\nexport type HtmlSource =\n | { kind: \"meta\"; el: Element }\n | { kind: \"title\"; el: Element }\n /**\n * A value read from the text of a `<head>` child. `els` carries every\n * occurrence because the key may be a list — a write replaces the whole set,\n * and one element out of several is not a location a write can aim at.\n */\n | { kind: \"element-text\"; els: Element[] }\n /** A value read from an element's attribute — `<link href=…>`. */\n | { kind: \"element-attr\"; els: Element[]; name: string };\n\nexport interface HtmlRead {\n data: Record<string, unknown>;\n /** The text actually parsed — the source minus any leading BOM. */\n body: string;\n lineMap: Map<string, number>;\n colMap: Map<string, number>;\n /** The element each key's effective value was read from. */\n sources: Map<string, HtmlSource>;\n /** The `<head>` element, or undefined when the document has none. */\n head: Element | undefined;\n}\n\n/** Parse a raw value as a YAML scalar, falling back to the string. */\nexport function typeValue(raw: string): unknown {\n // Empty meta content (`content=\"\"`) is the empty string, not the YAML `null`\n // that parsing \"\" would yield.\n if (raw === \"\") return \"\";\n try {\n return parseYamlScalar(raw);\n } catch {\n return raw;\n }\n}\n\nexport function attrValue(el: Element, name: string): string | undefined {\n return el.attrs.find((a) => a.name === name)?.value;\n}\n\n/**\n * `<head>` children that carry text but are not metadata.\n *\n * Both are text-bearing, so the generic rule would lift them, and neither says\n * anything about the document: lifting them would put a stylesheet and a line\n * of JavaScript into the key set of every page docmeta reads.\n */\nconst HEAD_NOT_METADATA = new Set([\"script\", \"style\"]);\n\n/**\n * `<head>` children the HTML content model permits at most once, which are\n * therefore scalars rather than one-item lists.\n *\n * `<base>` is here for completeness; being void it carries no text and so never\n * reaches the convention at all. `<meta>`, `<link>` and the rest may repeat.\n */\nconst HEAD_SINGLETONS = new Set([\"title\", \"base\"]);\n\nconst elementName = (el: Element | undefined): string =>\n el ? el.tagName.toLowerCase() : \"\";\n\n/**\n * The text a `<head>` child carries, or `undefined` when it carries none worth\n * lifting — an element child makes it a container, and whitespace-only text is\n * indentation rather than content.\n */\nfunction headText(el: Element, allowEmpty = false): string | undefined {\n let text = \"\";\n for (const node of el.childNodes) {\n if (defaultTreeAdapter.isElementNode(node)) return undefined;\n if (defaultTreeAdapter.isTextNode(node)) text += node.value;\n }\n if (!allowEmpty && text.trim() === \"\") return undefined;\n return text.trim();\n}\n\n/**\n * The `<head>` children that are values, grouped by the key they contribute.\n *\n * Void elements — `<meta>`, `<link>`, `<base>` — hold their value in an\n * attribute and so produce nothing here. That is deliberate rather than an\n * omission: lifting `<link>` by `href` would collapse a canonical URL and three\n * stylesheets into one list and discard the `rel` that distinguished them. An\n * `elements:` path naming the attribute addresses them instead.\n */\nfunction liftableHeadChildren(\n head: Element,\n): Map<string, { els: Element[]; texts: string[] }> {\n const out = new Map<string, { els: Element[]; texts: string[] }>();\n for (const node of head.childNodes) {\n if (!defaultTreeAdapter.isElementNode(node)) continue;\n const name = node.tagName.toLowerCase();\n if (HEAD_NOT_METADATA.has(name)) continue;\n // Read once and carried out with the element. Testing here and reading\n // again at the call site walked every child's text twice.\n const text = headText(node);\n if (text === undefined) continue;\n const key = liftKey(\"head\", name);\n const group = out.get(key);\n if (group) {\n group.els.push(node);\n group.texts.push(text);\n } else {\n out.set(key, { els: [node], texts: [text] });\n }\n }\n return out;\n}\n\n/** Every element a config path selects, walked down the child axis. */\nfunction matchHtmlPath(\n doc: DefaultTreeAdapterMap[\"document\"],\n segments: string[],\n): Element[] {\n const childrenNamed = (\n nodes: readonly DefaultTreeAdapterMap[\"childNode\"][],\n name: string,\n ): Element[] => {\n const out: Element[] = [];\n for (const n of nodes) {\n if (defaultTreeAdapter.isElementNode(n) && n.tagName.toLowerCase() === name) {\n out.push(n);\n }\n }\n return out;\n };\n\n let current = childrenNamed(doc.childNodes, segments[0] ?? \"\");\n for (const segment of segments.slice(1)) {\n const next: Element[] = [];\n for (const el of current) next.push(...childrenNamed(el.childNodes, segment));\n current = next;\n }\n return current;\n}\n\n/** Read metadata, positions, and per-key provenance from HTML source. */\nexport function readHtml(\n source: string,\n options?: ExtractOptions,\n): HtmlRead {\n // A BOM is invisible in an editor, so letting the parser count it as a\n // character puts every caret on line 1 one column to the right of what the\n // reader sees. `xml-read.ts` has always stripped it for that reason.\n //\n // For HTML there is a second, sharper reason. The BOM is character data as\n // far as the HTML parser is concerned, and it lands *before* `<html>` — which\n // pushes parse5 into a mode where `<html>`, `<head>` and `<body>` are all\n // reported as implied, with no source locations, even when the document\n // spells them out. Everything downstream that needs to know where `<head>`\n // is would then be looking at a document that appears not to have one.\n //\n // Stripping is safe for line numbers: the BOM sits on line 1 and removing it\n // deletes no line. `body` is returned so a caller that splices — the writer —\n // measures against the same text these positions describe.\n const body = source.charCodeAt(0) === 0xfeff ? source.slice(1) : source;\n const doc = parse(body, { sourceCodeLocationInfo: true });\n\n const data: Record<string, unknown> = {};\n const lineMap = new Map<string, number>();\n const colMap = new Map<string, number>();\n const sources = new Map<string, HtmlSource>();\n let head: Element | undefined;\n // The document node has no location; anchor the root pointer at 1:1.\n lineMap.set(\"\", 1);\n colMap.set(\"\", 1);\n\n const setKey = (\n key: string,\n value: unknown,\n source: HtmlSource,\n line: number | undefined,\n col: number | undefined,\n ): void => {\n data[key] = value;\n sources.set(key, source);\n const pointer = `/${escapePointerSegment(key)}`;\n if (line != null) lineMap.set(pointer, line);\n if (col != null) colMap.set(pointer, col);\n };\n\n const visit = (node: DefaultTreeAdapterMap[\"childNode\"]): void => {\n if (defaultTreeAdapter.isElementNode(node)) {\n const location = node.sourceCodeLocation;\n const line = location?.startLine;\n if (node.tagName === \"head\" && head === undefined) {\n head = node;\n } else if (node.tagName === \"title\") {\n // The first <title> wins; later ones (e.g. in SVG) are ignored. A\n // <meta name=\"title\"> still overwrites it, in either document order.\n if (data.title === undefined) {\n const first = node.childNodes[0];\n const text =\n first && defaultTreeAdapter.isTextNode(first) ? first.value : \"\";\n setKey(\"title\", text, { kind: \"title\", el: node }, line, location?.startCol);\n }\n } else if (node.tagName === \"meta\") {\n const key = attrValue(node, \"name\") ?? attrValue(node, \"property\");\n const value = attrValue(node, \"content\");\n if (key != null && value != null) {\n // parse5 locates each attribute separately, so the caret can land\n // on `content=` — the thing that failed — rather than on `<meta`.\n //\n // Only when it is on the *same* line as the tag, though. `line`\n // stays the tag's opening line (changing that would move existing\n // annotations), so borrowing a column from an attribute wrapped\n // onto a later line would pair a real line with a column measured\n // somewhere else, and point at nothing.\n const attrLocation = location?.attrs?.[\"content\"];\n const col =\n attrLocation != null && attrLocation.startLine === line\n ? attrLocation.startCol\n : location?.startCol;\n setKey(key, typeValue(value), { kind: \"meta\", el: node }, line, col);\n }\n }\n // Same guard, same node, nothing between that could change the answer:\n // recursion belongs inside the one check rather than behind a second.\n for (const child of node.childNodes) visit(child);\n }\n };\n\n for (const child of doc.childNodes) visit(child);\n\n // Element-derived metadata, lifted from `<head>` only. The body is prose, and\n // an SVG `<title>` down in it labels a graphic rather than the page — which is\n // also why this walks `head` directly instead of reusing the visitor above.\n if (head) {\n for (const [key, { els, texts }] of liftableHeadChildren(head)) {\n // Not `pairValues` here, and still paired: `els` and `texts` are appended\n // in the same iteration, so index i names the element value i came from\n // by construction rather than by a helper enforcing it afterwards. That\n // is the invariant the config paths need `pairValues` for — those match\n // elements first and only then discover which ones carry a value.\n const values = texts.map(typeValue);\n // HTML has a content model, so where it fixes the cardinality the key\n // follows it. `<title>` is permitted once, so it is a scalar rather than\n // a one-item list; generic XML defaults to a list precisely because it\n // has no such statement to follow.\n const singleton = HEAD_SINGLETONS.has(elementName(els[0]));\n data[key] = singleton ? values[0] : values;\n sources.set(key, { kind: \"element-text\", els });\n const first = els[0];\n const location = first?.sourceCodeLocation;\n const pointer = `/${escapePointerSegment(key)}`;\n if (location?.startLine != null) lineMap.set(pointer, location.startLine);\n if (location?.startCol != null) colMap.set(pointer, location.startCol);\n }\n }\n\n // Config paths last, so a path naming a key the convention already filled is\n // a no-op rather than a silent retype.\n for (const raw of options?.elements ?? []) {\n const spec: ElementPath = parseElementPath(raw);\n if (data[spec.key] !== undefined) continue;\n // Paired, so `els[i]` still names the element `values[i]` came from — a\n // `<link>` with no `@href` must leave the element list with its value.\n const found = pairValues(\n matchHtmlPath(doc, spec.segments),\n (el) => (spec.attr ? attrValue(el, spec.attr) : headText(el, true)),\n typeValue,\n );\n if (found.values.length === 0) continue;\n data[spec.key] = found.values;\n sources.set(\n spec.key,\n spec.attr\n ? { kind: \"element-attr\", els: found.els, name: spec.attr }\n : { kind: \"element-text\", els: found.els },\n );\n const location = found.els[0]?.sourceCodeLocation;\n const pointer = `/${escapePointerSegment(spec.key)}`;\n if (location?.startLine != null) lineMap.set(pointer, location.startLine);\n if (location?.startCol != null) colMap.set(pointer, location.startCol);\n }\n\n return { data, body, lineMap, colMap, sources, head };\n}\n","/**\n * HTML write-back, the inverse of `readHtml`.\n *\n * Same idea as `frontmatter-write.ts`: never re-serialize, only splice. parse5's\n * serializer would materialize implied `<html>`/`<head>`/`<body>`, re-encode\n * entities, drop the original attribute quoting and rewrite the doctype — a\n * hand-authored page would come back reformatted and `fill` would produce a diff\n * touching every line. Instead every edit is a character range taken from\n * parse5's `sourceCodeLocation`, so everything outside the ranges survives by\n * construction rather than by careful reassembly.\n *\n * Where a value goes is decided by `readHtml`'s `sources` map, not by a rule of\n * this module's own. `fill` rewrites values that are present but *invalid*, not\n * just missing ones, so \"new values go in a fresh <meta>\" would leave the stale\n * tag the reader actually honors sitting right beside the correction — green\n * report, wrong page. A write lands on whatever the read took its value from.\n *\n * Values are emitted as YAML scalars because that is how they are read back\n * (`typeValue`). The string \"2\" therefore emits with its quotes and survives the\n * round trip; a value needing more than one line cannot fit in an attribute at\n * all and is refused rather than truncated.\n */\nimport { stringify as stringifyYaml } from \"yaml\";\nimport {\n DocmetaError,\n type ApplyOptions,\n type MetadataPatch,\n} from \"../types.js\";\nimport { dropUndefined, deepEqual } from \"./patch-util.js\";\nimport { readHtml, type Element, type HtmlRead } from \"./html-read.js\";\nimport { escapeText, valuesFor } from \"./element-write.js\";\n\n/** One character-range replacement in the source. */\ninterface Edit {\n start: number;\n end: number;\n text: string;\n}\n\nexport function applyHtml(\n original: string,\n patch: MetadataPatch,\n options: ApplyOptions = {},\n): string {\n // `readHtml` strips a leading BOM before parsing — see there for why parse5\n // makes that necessary — so every position it reports is relative to the text\n // it hands back. Splice against that same text and restore the BOM as a\n // prefix, which leaves no offset arithmetic to get wrong.\n const before = readHtml(original, { elements: options.elements });\n const content = before.body;\n\n // Structural checks run before the empty-patch shortcut, so an empty patch is\n // a usable pre-flight probe for \"can this document be written at all?\".\n // `fill` uses it to skip paying for inference on a file it could never write.\n const headStart = before.head?.sourceCodeLocation?.startTag;\n if (before.head === undefined || headStart == null) {\n throw new DocmetaError(\n \"This HTML document has no <head> element; manni meta fill writes metadata into <head>. Add one, or set the field manually.\",\n );\n }\n\n const clean = dropUndefined(patch);\n if (Object.keys(clean).length === 0) return original;\n\n const edits: Edit[] = [];\n const inserts: string[] = [];\n /** Elements this write touches, so `verify` knows which keys move with them. */\n const moved = new Set<Element>();\n for (const [key, value] of Object.entries(clean)) {\n const source = before.sources.get(key);\n // Emitted per branch rather than up front. A list-valued key is emitted one\n // item at a time below; emitting the whole array here would serialize it as\n // a YAML block and refuse it as \"needs more than one line\" — a write that\n // is perfectly expressible as one value per element.\n if (source === undefined) {\n const name = escapeAttr(key, DQ);\n inserts.push(\n \"<meta name=\" + DQ + name + DQ + \" content=\" + DQ +\n escapeAttr(emitScalar(key, value), DQ) + DQ + \">\",\n );\n } else if (source.kind === \"meta\") {\n edits.push(metaEdit(content, source.el, key, emitScalar(key, value)));\n moved.add(source.el);\n } else if (source.kind === \"title\") {\n edits.push(elementTextEdit(source.el, key, emitScalar(key, value)));\n moved.add(source.el);\n } else {\n // An element-derived key — `head.title`, or a config `@attr` path.\n // Written where it was read, exactly as the XML side does: both replace\n // a span that already exists, which changes content and not shape and so\n // cannot make the document invalid.\n const values = valuesFor(key, value, source.els.length);\n source.els.forEach((el, i) => {\n const one = emitScalar(key, values[i]);\n edits.push(\n source.kind === \"element-attr\"\n ? headAttrEdit(content, el, source.name, key, one)\n : elementTextEdit(el, key, one),\n );\n moved.add(el);\n });\n }\n }\n\n if (inserts.length > 0) {\n edits.push(insertEdit(content, before.head, headStart.endOffset, inserts));\n }\n\n const next = spliceAll(content, edits);\n verify(next, before, clean, moved, options);\n // `content === original` is the BOM test: `readHtml` returns `body` with any\n // leading BOM removed, so the two are the same value exactly when there was\n // none to remove. When there was, it is the single character at `original[0]`,\n // put back in front of the spliced text.\n return content === original ? next : original.slice(0, 1) + next;\n}\n\nconst DQ = String.fromCharCode(34);\nconst SQ = String.fromCharCode(39);\n\n/** Replace the value span of an existing `<meta>`'s `content` attribute. */\nfunction metaEdit(\n content: string,\n el: Element,\n key: string,\n emitted: string,\n): Edit {\n return headAttrEdit(content, el, \"content\", key, emitted);\n}\n\n/**\n * Replace the value span of a named attribute on any element.\n *\n * Named apart from `element-write.ts`'s exported `elementAttrEdit`, which this\n * module already imports from. The two do the same job on different trees —\n * parse5 nodes here, xmldom nodes there — and cannot be shared, so they should\n * at least not read as the same function.\n */\nfunction headAttrEdit(\n content: string,\n el: Element,\n attrName: string,\n key: string,\n emitted: string,\n): Edit {\n const attrs = el.sourceCodeLocation?.attrs;\n const attrLocation =\n attrs && Object.prototype.hasOwnProperty.call(attrs, attrName)\n ? attrs[attrName]\n : undefined;\n if (attrLocation == null) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": <${el.tagName}> has no locatable \"${attrName}\" attribute.`,\n );\n }\n const span = attrValueSpan(\n content,\n attrLocation.startOffset,\n attrLocation.endOffset,\n );\n if (span === undefined) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": its \"${attrName}\" attribute could not be located precisely.`,\n );\n }\n const value = escapeAttr(emitted, span.quote);\n return {\n start: span.start,\n end: span.end,\n text: span.wrap ? span.quote + value + span.quote : value,\n };\n}\n\n/**\n * Replace the text span of an element — `<title>`, or any `<head>` child a\n * lifted key was read from.\n *\n * `<title>` is RCDATA, so markup is not parsed inside it, but an unescaped \"<\"\n * still ends the element for some consumers. `escapeText` escapes \">\" too,\n * which RCDATA does not require but linters and stricter parsers flag, and\n * which the attribute path already does.\n */\nfunction elementTextEdit(el: Element, key: string, emitted: string): Edit {\n const location = el.sourceCodeLocation;\n const open = location?.startTag;\n const close = location?.endTag;\n if (open == null || close == null) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": the <${el.tagName}> element is not explicitly closed.`,\n );\n }\n return {\n start: open.endOffset,\n end: close.startOffset,\n text: escapeText(emitted),\n };\n}\n\n/**\n * Insert new `<meta>` tags immediately after `<head>`'s start tag, indented to\n * match whatever is already inside it.\n */\nfunction insertEdit(\n content: string,\n head: Element,\n at: number,\n tags: string[],\n): Edit {\n const { eol, indent } = headStyle(content, head, at);\n const text = tags.map((t) => `${eol}${indent}${t}`).join(\"\");\n return { start: at, end: at, text };\n}\n\n/**\n * The line ending and indentation to use inside `<head>`, taken from its first\n * existing child so an inserted tag looks like the ones around it.\n */\nfunction headStyle(\n content: string,\n head: Element,\n at: number,\n): { eol: string; indent: string } {\n for (const child of head.childNodes) {\n const start = child.sourceCodeLocation?.startOffset;\n if (start == null || start < at) continue;\n const lineStart = content.lastIndexOf(\"\\n\", start - 1) + 1;\n const between = content.slice(lineStart, start);\n // Only whitespace counts as indentation; a tag sharing a line with other\n // content tells us nothing about how the file is laid out.\n if (/^[ \\t]*$/.test(between)) {\n return {\n eol: crlfAt(content, lineStart) ? \"\\r\\n\" : \"\\n\",\n indent: between,\n };\n }\n }\n // Reached only for an empty `<head></head>`, where there is no child to copy\n // the style from. Look only at the text above the insertion point: a document\n // that mixes endings — an LF head in a generator's CRLF body — would\n // otherwise take its head's line ending from the body below it.\n const above = content.slice(0, at);\n return { eol: above.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\", indent: \" \" };\n}\n\nfunction crlfAt(content: string, lineStart: number): boolean {\n return lineStart >= 2 && content.slice(lineStart - 2, lineStart) === \"\\r\\n\";\n}\n\n/**\n * Find the value span inside an attribute's `name=\"value\"` range, and the quote\n * character in use, so the original quoting style survives the write.\n */\nfunction attrValueSpan(\n content: string,\n start: number,\n end: number,\n): { start: number; end: number; quote: string; wrap: boolean } | undefined {\n const eq = content.indexOf(\"=\", start);\n if (eq === -1 || eq >= end) return undefined;\n let i = eq + 1;\n while (i < end && /\\s/.test(content[i] ?? \"\")) i++;\n // Nothing but whitespace after the `=`. parse5 should never report an\n // attribute that way, but falling through would return a zero-width span at\n // `end`, and the write would *insert* beside the attribute rather than\n // replace its value. `verify` would catch it; refusing here says which\n // attribute could not be located instead of reporting a mismatch later.\n if (i >= end) return undefined;\n const quote = content[i];\n if (quote === DQ || quote === SQ) {\n const close = content.indexOf(quote, i + 1);\n if (close === -1 || close > end) return undefined;\n return { start: i + 1, end: close, quote, wrap: false };\n }\n // Unquoted value: it runs to the end of the attribute's range, and the\n // replacement has to supply its own quotes — `wrap`. Leaving it bare would\n // hold only while the new value had no spaces: `content=hello world`\n // tokenizes as `content=\"hello\"` plus a boolean `world` attribute, which the\n // verify step then rejects with its generic message instead of the write\n // simply working.\n return { start: i, end, quote: DQ, wrap: true };\n}\n\n/** Emit a value the way the reader will parse it back: as a YAML scalar. */\nfunction emitScalar(key: string, value: unknown): string {\n const text = stringifyYaml(value).replace(/\\n$/, \"\");\n if (text.includes(\"\\n\")) {\n throw new DocmetaError(\n `Refusing to write \"${key}\": the value needs more than one line, which an HTML attribute cannot hold. Set it manually.`,\n );\n }\n return text;\n}\n\nfunction escapeAttr(value: string, quote: string): string {\n const escaped = value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n return quote === SQ\n ? escaped.replace(/'/g, \"'\")\n : escaped.replace(/\"/g, \""\");\n}\n\n/** Apply every edit back-to-front, so earlier offsets stay valid. */\nfunction spliceAll(content: string, edits: Edit[]): string {\n const ordered = [...edits].sort((a, b) => b.start - a.start);\n let out = content;\n let lastStart = Number.POSITIVE_INFINITY;\n for (const edit of ordered) {\n /* c8 ignore next 5 -- defensive: sources are distinct tags by construction. */\n if (edit.end > lastStart) {\n throw new DocmetaError(\n \"Internal error: overlapping edits while writing HTML metadata.\",\n );\n }\n out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);\n lastStart = edit.start;\n }\n return out;\n}\n\n/**\n * Re-read the written document and confirm it says exactly what it should. This\n * is the difference between a bug here being a refusal and a bug here being a\n * corrupted page.\n *\n * `moved` names the elements this write edited. Since element-derived metadata\n * arrived, one element can back **two** keys — `<title>` is read as both the\n * flat `title` and as `head.title` — so writing one of them necessarily moves\n * the other. Holding the co-derived key to its *old* value would fail every\n * `<title>` write, which is exactly what it did before this argument existed.\n *\n * The invariant is not weakened by exempting them. A co-derived key reads from\n * the same text as the key that was written, and that key is still checked\n * strictly: if the element had not been updated, the written key would mismatch\n * and this would still throw. Everything sourced from an element the write did\n * not touch is still held to its old value exactly.\n */\nfunction verify(\n next: string,\n before: HtmlRead,\n patch: MetadataPatch,\n moved: Set<Element>,\n options: ApplyOptions,\n): void {\n // Re-read with the *same* options the write used, or a key an `elements:`\n // path produced is invisible here and every write to one is refused.\n const actual = readHtml(next, { elements: options.elements }).data;\n const expected: Record<string, unknown> = { ...before.data, ...patch };\n for (const [key, source] of before.sources) {\n if (key in patch) continue;\n const els =\n source.kind === \"element-text\" || source.kind === \"element-attr\"\n ? source.els\n : [source.el];\n if (els.some((el: Element) => moved.has(el))) expected[key] = actual[key];\n }\n if (!deepEqual(actual, expected)) {\n throw new DocmetaError(\n \"Refusing to write HTML metadata: the rewritten document did not read back as expected.\",\n );\n }\n}\n","/**\n * HTML metadata extractor.\n *\n * Reads document metadata from `<meta>` tags and `<title>`:\n * - `<title>…</title>` -> `title` (the text content, kept verbatim).\n * - `<meta name=\"X\" content=\"Y\">` (or `property=\"X\"` for OpenGraph-style tags)\n * -> `X: Y`. `content` values are parsed as YAML scalars so `\"2\"` -> number\n * and `\"true\"` -> boolean, consistent with the AsciiDoc/XML extractors.\n *\n * Tags with neither `name` nor `property` (e.g. `charset`, `http-equiv`) carry no\n * document metadata and are skipped. Duplicate keys: last tag wins; the first\n * `<title>` wins. The parser (parse5) decodes HTML entities and recovers from\n * malformed markup, so extraction never throws. Per-node — and per-attribute —\n * positions give JSON-Pointer -> source-line and -> source-column maps for\n * annotations. Both are 1-based, as parse5 reports them.\n *\n * The read itself lives in `html-read.ts`, shared with `html-write.ts` so that a\n * write lands wherever the read took its value from. See that module for why\n * the two must not each carry their own copy of the precedence rule.\n */\nimport { readHtml } from \"./html-read.js\";\nimport { applyHtml } from \"./html-write.js\";\nimport { positionForFactory } from \"./pointer.js\";\nimport type { ExtractedMetadata, MetadataExtractor } from \"../types.js\";\n\nexport const htmlExtractor: MetadataExtractor = {\n name: \"html\",\n extensions: [\".html\", \".htm\"],\n extract(content, _filePath, options): ExtractedMetadata {\n const { data, lineMap, colMap } = readHtml(content, options);\n return {\n data,\n present: Object.keys(data).length > 0,\n format: \"html\",\n lineFor: positionForFactory(lineMap),\n colFor: positionForFactory(colMap),\n };\n },\n apply: applyHtml,\n};\n","/**\n * Extractor registry. Maps file extensions to extractors and resolves an\n * extractor by name (for the `--as` override). A registered extractor reads\n * its format, so registration is what makes an extension supported.\n */\nimport type { MetadataExtractor } from \"../types.js\";\nimport { markdownExtractor } from \"./markdown.js\";\nimport { mdxExtractor } from \"./mdx.js\";\nimport { asciidocExtractor } from \"./asciidoc.js\";\nimport { rstExtractor } from \"./rst.js\";\nimport { xmlExtractor } from \"./xml.js\";\nimport { htmlExtractor } from \"./html.js\";\n\nexport const EXTRACTORS: MetadataExtractor[] = [\n markdownExtractor,\n mdxExtractor,\n asciidocExtractor,\n rstExtractor,\n xmlExtractor,\n htmlExtractor,\n];\n\nconst byExtension = new Map<string, MetadataExtractor>();\nconst byName = new Map<string, MetadataExtractor>();\nfor (const ex of EXTRACTORS) {\n byName.set(ex.name, ex);\n for (const ext of ex.extensions) byExtension.set(ext.toLowerCase(), ex);\n}\n\n/** Resolve the extractor for a file extension (incl. dot). */\nexport function extractorForExtension(\n ext: string,\n): MetadataExtractor | undefined {\n return byExtension.get(ext.toLowerCase());\n}\n\n/** Resolve an extractor by its `--as` name. */\nexport function extractorByName(name: string): MetadataExtractor | undefined {\n return byName.get(name.toLowerCase());\n}\n\n/** Extensions handled by registered extractors (used for directory walks). */\nexport function supportedExtensions(): string[] {\n return EXTRACTORS.flatMap((e) => e.extensions);\n}\n\n/** All registered format names, with their writable status. */\nexport function listFormats(): {\n name: string;\n extensions: string[];\n writable: boolean;\n}[] {\n return EXTRACTORS.map((e) => ({\n name: e.name,\n extensions: e.extensions,\n // Writability is the presence of the optional `apply` method, so a format\n // never has to declare it twice and the two can't drift apart.\n writable: typeof e.apply === \"function\",\n }));\n}\n","/**\n * Resolve a mix of explicit files, directories, and globs into a concrete,\n * de-duplicated, sorted list of file paths (posix-style, relative to cwd).\n * Directory and glob expansion is restricted to the given extensions; explicit\n * file arguments are always included so the user can target any single file.\n */\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { stat } from \"node:fs/promises\";\nimport { extname, relative, resolve } from \"node:path\";\nimport fg from \"fast-glob\";\nimport picomatch from \"picomatch\";\nimport { matchesFileGlob } from \"../../shared/globs.js\";\nimport { supportedExtensions } from \"../extractors/index.js\";\nimport { DocmetaError } from \"../types.js\";\nimport { GITIGNORE_UNAVAILABLE, gitIgnored } from \"./gitignore.js\";\n\nconst DEFAULT_IGNORE = [\"**/node_modules/**\", \"**/.git/**\"];\n\nexport const STDIN_TOKEN = \"-\";\n\n/**\n * What a stdin result is labelled in output. Lives here beside the input token\n * so the two spellings cannot drift: commands set it, reporters test for it,\n * and a reporter that missed a rename would give a `<stdin>` result an\n * `artifactLocation.uri` naming a file that does not exist.\n */\nexport const STDIN_LABEL = \"<stdin>\";\n\nfunction toPosix(p: string): string {\n return p.replace(/\\\\/g, \"/\");\n}\n\nasync function statOrNull(p: string) {\n try {\n return await stat(p);\n } catch {\n return null;\n }\n}\n\n/**\n * One `..` step, spelled as a segment a wildcard will cross.\n *\n * Every matcher the family could use refuses to let `**` match a literal `..`\n * segment — picomatch does it deliberately, and so does the micromatch inside\n * fast-glob. That is the whole reason an ignore glob went quiet the moment the\n * walked tree sat outside cwd: the path the run reports is\n * `../sibling/docs/a.md`, and a glob opening with `**` cannot see past the\n * first segment of it - the node_modules and .git defaults included.\n *\n * Substituting a marker restores the one frame. It is one marker per step, not\n * one for the run, so `../a/**` still fails to match `../../a/x.md`: those name\n * two different directories and a pattern for one must not cover the other.\n */\nconst UP = \"^^\";\n\n/**\n * A path or a pattern with its leading `../` steps in matchable form, so an\n * ignore glob and the file it is tested against meet in the same frame — the\n * run's cwd, whether or not the file is underneath it.\n *\n * Nothing else is touched. A path that does not escape cwd arrives at the\n * matcher exactly as fast-glob's own `ignore` would have seen it, which is what\n * keeps a target under cwd behaving as it always has.\n */\nfunction cwdFrame(posix: string): string {\n let rest = posix.startsWith(\"./\") ? posix.slice(2) : posix;\n const steps: string[] = [];\n while (rest === \"..\" || rest.startsWith(\"../\")) {\n steps.push(UP);\n rest = rest === \"..\" ? \"\" : rest.slice(3);\n }\n if (steps.length === 0) return rest;\n return rest === \"\" ? steps.join(\"/\") : `${steps.join(\"/\")}/${rest}`;\n}\n\n/**\n * Does any ignore glob cover this file? `file` is posix-style and relative to\n * the run's cwd; `framed` is the ignore list run through {@link cwdFrame} once.\n *\n * This is the **authority** on what an exclude removes. fast-glob is still\n * given an ignore list below, but only as a prune — a walk that never descends\n * into `node_modules` is the difference between a fast run and a slow one, and\n * anything it prunes this would remove anyway.\n */\nfunction ignoredByGlobs(file: string, framed: string[]): boolean {\n return matchesFileGlob(cwdFrame(file), framed);\n}\n\n/**\n * Walk a directory argument recursively and return each hit posix-style and\n * relative to `cwd`, with the ignore globs applied.\n *\n * A directory is a *path*, and the two things that go wrong come from feeding\n * one to a pattern matcher unchanged.\n *\n * `(`, `)`, `[`, `!`, `+` and `@` are literal characters in a directory name\n * and glob metacharacters in a pattern, so `docs (2024)` or\n * `Program Files (x86)` interpolated raw matches nothing at all - which\n * surfaces as \"no files matched\" and exit 2, pointing nowhere near the cause.\n * `fg.escapePath` settles that.\n *\n * And a directory whose cwd-relative form escapes cwd begins with a `..`\n * segment, which a leading `**` will not cross - so a pattern rooted at\n * `../sibling/docs` hands fast-glob entries its own ignore list cannot match\n * (see the marker above, which is what settles that). The walk is\n * therefore anchored at the directory itself in that case, which keeps the\n * entries well formed; what the ignore globs mean is then settled once, above,\n * in the run's frame rather than in the walk's.\n */\nasync function walkDirectory(\n cwd: string,\n abs: string,\n ignore: string[],\n framed: string[],\n): Promise<string[]> {\n const base = toPosix(relative(cwd, abs));\n // A whole segment, not a prefix: `relative()` answers `..archive` for\n // `<cwd>/..archive`, an ordinary directory inside cwd that escapes nothing.\n const escapes = base === \"..\" || base.startsWith(\"../\");\n const anchorAtDir = base === \"\" || escapes;\n const root = anchorAtDir ? abs : cwd;\n const found = await fg(anchorAtDir ? \"**/*\" : `${fg.escapePath(base)}/**/*`, {\n cwd: root,\n // Anchored at the directory, these entries are in *its* frame, and a user's\n // exclude is not - so only the structural defaults go down, which mean the\n // same thing in any frame. Where the two frames coincide the whole list\n // prunes, exactly as it always did.\n ignore: escapes ? DEFAULT_IGNORE : ignore,\n onlyFiles: true,\n dot: false,\n });\n const files: string[] = [];\n for (const file of found) {\n const rel = toPosix(relative(cwd, resolve(root, file)));\n if (!ignoredByGlobs(rel, framed)) files.push(rel);\n }\n return files;\n}\n\nexport interface ResolveOptions {\n /** Positional inputs: files, directories, or globs. `-` is ignored here. */\n inputs: string[];\n /** Extensions to keep during dir/glob expansion (default: supported). */\n exts?: string[];\n /** Extra exclude globs (added to node_modules/.git defaults). */\n exclude?: string[];\n cwd?: string;\n /**\n * Do not report inputs that name a path which does not exist. Set by\n * `--allow-empty` / `allowEmpty:` for callers that legitimately run against\n * a repo where the targets may be absent (a shared CI template, a\n * pre-commit hook with an empty file list).\n */\n allowEmpty?: boolean;\n /**\n * Skip files `.gitignore` covers during directory and glob expansion.\n * Default true; `--no-gitignore` / `respectGitignore: false` turns it off.\n *\n * Explicitly named files are never filtered — the user who types a path\n * means it — which mirrors how an explicit file already bypasses `--ext`.\n */\n respectGitignore?: boolean;\n /**\n * Called when filtering was asked for but git could not answer (no\n * repository, no git binary). Callers pass this only when the user asked\n * for filtering *explicitly*, since on the default it would put a line of\n * stderr on every run outside a repo.\n */\n onGitignoreUnavailable?: () => void;\n}\n\nexport interface ResolvedTargets {\n /** The files to process, posix-style and relative to `cwd`. */\n files: string[];\n /**\n * Candidate documents `.gitignore` removed. Counted **after** the extension\n * filter, so the number answers \"how many files I would otherwise have\n * checked did .gitignore take away\" rather than including every ignored\n * `.png` under `build/`. `--exclude` removals are not counted here; those\n * are the caller's own instruction, not a surprise.\n */\n gitignoreSkipped: number;\n /**\n * The subset of `files` a positional input named directly rather than a\n * directory or glob produced. A sibling tool reads a named file it would\n * never walk (a term manifest, say) by telling the two apart here.\n */\n named: string[];\n}\n\n/**\n * Settle the two gitignore knobs every command core passes down, so the three\n * of them cannot drift on either the precedence or the diagnostic.\n *\n * `flag` is `--no-gitignore` (or a programmatic override), `configured` is\n * `respectGitignore:` from config, and the default is on.\n */\nexport function gitignoreOptions(opts: {\n flag?: boolean;\n configured?: boolean;\n onNotice?: (message: string) => void;\n}): Pick<ResolveOptions, \"respectGitignore\" | \"onGitignoreUnavailable\"> {\n // Only a value someone actually wrote is worth a diagnostic. On the default,\n // a note would land on every run outside a repository — an extracted\n // tarball, `npm pack` output, some Docker build contexts — for a filter\n // nobody asked for.\n const asked =\n opts.flag === true || (opts.flag === undefined && opts.configured === true);\n const notice = opts.onNotice;\n return {\n respectGitignore: opts.flag ?? opts.configured ?? true,\n ...(asked && notice\n ? {\n onGitignoreUnavailable: () => {\n notice(GITIGNORE_UNAVAILABLE);\n },\n }\n : {}),\n };\n}\n\n/** The file list alone, for callers with no use for what was filtered out. */\nexport async function resolveTargets(opts: ResolveOptions): Promise<string[]> {\n return (await resolveTargetSet(opts)).files;\n}\n\n/**\n * One walk per distinct target set while `fn` runs. `manni check` hands every\n * domain the same collections, and each would otherwise glob them and spawn\n * its own `git check-ignore`. Scoped to the call, so nothing outlives a run\n * and no other caller ever sees a cached list.\n */\nexport function withSharedWalks<T>(fn: () => Promise<T>): Promise<T> {\n return sharedWalks.run(new Map(), fn);\n}\n\nconst sharedWalks = new AsyncLocalStorage<Map<string, Promise<ResolvedTargets>>>();\n\nexport async function resolveTargetSet(\n opts: ResolveOptions,\n): Promise<ResolvedTargets> {\n const memo = sharedWalks.getStore();\n if (memo === undefined) return walkTargetSet(opts);\n // Everything that changes the answer. The unavailable-gitignore callback\n // only reports, and a run says it once anyway, so a shared walk fires the\n // first caller's alone. A new ResolveOptions field that changes the walk\n // must join this key, or two callers would share a wrong list.\n const key = JSON.stringify([\n resolve(opts.cwd ?? process.cwd()),\n opts.inputs,\n opts.exts ?? null,\n opts.exclude ?? [],\n opts.allowEmpty ?? false,\n opts.respectGitignore ?? true,\n ]);\n let walk = memo.get(key);\n if (walk === undefined) {\n walk = walkTargetSet(opts);\n memo.set(key, walk);\n // A failed walk is the caller's error to report, not an answer to keep.\n walk.catch(() => memo.delete(key));\n }\n // Each caller gets its own copy, so one domain cannot edit another's list.\n return structuredClone(await walk);\n}\n\nasync function walkTargetSet(opts: ResolveOptions): Promise<ResolvedTargets> {\n const cwd = opts.cwd ?? process.cwd();\n const exts = (opts.exts ?? supportedExtensions()).map((e) =>\n e.toLowerCase().startsWith(\".\") ? e.toLowerCase() : `.${e.toLowerCase()}`,\n );\n const ignore = [...DEFAULT_IGNORE, ...(opts.exclude ?? [])];\n // Framed once per run, not once per file: the matcher caches on the list.\n const framed = ignore.map((pattern) => cwdFrame(toPosix(pattern)));\n // Kept apart until the end: `named` is what the user typed and is never\n // filtered, `walked` is what a directory or glob produced and is.\n const named = new Set<string>();\n const walked = new Set<string>();\n\n const keepByExt = (file: string): boolean =>\n exts.includes(extname(file).toLowerCase());\n\n // Inputs that name a single path rather than describing a pattern, and that\n // do not exist. Collected rather than thrown on first sight so one error can\n // name every mistake.\n const missing: string[] = [];\n\n for (const input of opts.inputs) {\n if (input === STDIN_TOKEN) continue;\n\n // Normalize before resolving, not after. `path.resolve` treats a backslash\n // as a separator on Windows and as an ordinary filename character on Linux,\n // so `nested\\doc.md` would stat successfully on a developer's machine and\n // then fail on Linux CI — while the not-found message, built from the posix\n // form, named a different path than the one actually looked for. Normalizing\n // here keeps the stat, the glob, and the message on one spelling.\n //\n // The cost is that a Linux file whose name genuinely contains a backslash is\n // not addressable. That is accepted: this module already treats backslash as\n // a separator everywhere else (glob expansion and the returned labels both\n // go through `toPosix`), and a docs tree containing such a name is a\n // hypothetical, whereas Windows-authored paths reaching Linux CI is routine.\n const posixInput = toPosix(input);\n const abs = resolve(cwd, posixInput);\n const st = await statOrNull(abs);\n\n if (st?.isFile()) {\n named.add(toPosix(relative(cwd, abs)));\n continue;\n }\n\n if (st?.isDirectory()) {\n for (const f of await walkDirectory(cwd, abs, ignore, framed)) {\n if (keepByExt(f)) walked.add(f);\n }\n continue;\n }\n\n // Nothing on disk. Decide whether this input was a *name* or a *pattern*:\n // a name that does not exist is a mistake worth reporting, while a pattern\n // matching nothing is the caller's business (the command cores check for an\n // empty result set).\n if (!picomatch.scan(posixInput).isGlob) {\n missing.push(posixInput);\n continue;\n }\n\n const found = await fg(posixInput, {\n cwd,\n ignore,\n onlyFiles: true,\n dot: false,\n });\n // Through the same authority as the directory walk. A glob can escape cwd\n // too (`../sibling/docs/**`), and its entries then carry the `..` segments\n // fast-glob's own ignore list cannot match past.\n for (const f of found) {\n if (ignoredByGlobs(toPosix(f), framed)) continue;\n if (keepByExt(f)) walked.add(f);\n }\n }\n\n if (missing.length > 0 && !opts.allowEmpty) {\n const names = missing.map((m) => `\"${m}\"`).join(\", \");\n throw new DocmetaError(\n missing.length === 1\n ? `File not found: ${names}.`\n : `Files not found: ${names}.`,\n );\n }\n\n // Gitignore runs last, over the extension-filtered walk only. A file the\n // user also named explicitly is excluded from the question rather than from\n // the answer, so it can neither be dropped nor inflate the skipped count.\n let gitignoreSkipped = 0;\n if (opts.respectGitignore !== false && walked.size > 0) {\n const candidates = [...walked].filter((f) => !named.has(f));\n const { ignored, available } = await gitIgnored(candidates, cwd);\n if (available) {\n for (const f of ignored) {\n if (walked.delete(f)) gitignoreSkipped += 1;\n }\n } else {\n opts.onGitignoreUnavailable?.();\n }\n }\n\n return {\n files: [...new Set([...named, ...walked])].sort(),\n gitignoreSkipped,\n named: [...named].sort(),\n };\n}\n\nexport interface NonEmptyParams {\n /** Files actually resolved. */\n files: string[];\n /** The positional inputs, stdin token already removed. */\n inputs: string[];\n /** Whether `-` was among the inputs; stdin is one input, so it is not empty. */\n usingStdin: boolean;\n allowEmpty?: boolean;\n exclude?: string[];\n exts?: string[];\n /** Candidates `.gitignore` removed, so an empty set says so rather than baffles. */\n gitignoreSkipped?: number;\n /** Past-tense verb for the message: \"validated\", \"read\", \"filled\". */\n action: string;\n}\n\n/**\n * Resolving zero files is an operational error, not a pass.\n *\n * Exit 0 means \"every file passed\"; with no files there is no verdict, so\n * reporting success turns a broken glob, a moved directory, or a too-broad\n * `--exclude` into a permanently green gate that checks nothing. Exit 2 (a\n * `DocmetaError`) is the documented code for \"docmeta could not produce a\n * verdict\", which is exactly this case.\n */\nexport function assertNonEmpty(p: NonEmptyParams): void {\n if (p.allowEmpty || p.usingStdin || p.files.length > 0) return;\n\n const tried = p.inputs.map((i) => `\"${i}\"`).join(\", \");\n const notes: string[] = [];\n // Name the filters, because \"no files matched\" is baffling when the pattern\n // plainly matches files on disk and an --ext or --exclude removed them.\n if (p.exts && p.exts.length > 0) {\n notes.push(`extensions: ${p.exts.join(\", \")}`);\n }\n if (p.exclude && p.exclude.length > 0) {\n notes.push(`excludes: ${p.exclude.map((e) => `\"${e}\"`).join(\", \")}`);\n }\n // The one filter the user never wrote down, so it is the one most worth\n // naming: a docs tree the repo happens to ignore looks like a broken glob.\n if (p.gitignoreSkipped && p.gitignoreSkipped > 0) {\n notes.push(\n `.gitignore skipped ${p.gitignoreSkipped} (pass --no-gitignore to check them)`,\n );\n }\n\n throw new DocmetaError(\n [\n `No files matched. Patterns tried: ${tried}.`,\n ...(notes.length > 0 ? [`Filters applied — ${notes.join(\"; \")}.`] : []),\n `Nothing was ${p.action}, so this is an error rather than a pass.`,\n `Pass --allow-empty (or set allowEmpty: true) if matching nothing is expected.`,\n ].join(\"\\n\"),\n );\n}\n","/**\n * Ask git which paths `.gitignore` covers.\n *\n * Delegated to `git check-ignore` rather than reimplemented. Gitignore is not a\n * flat pattern list: precedence stacks across nested `.gitignore` files,\n * directory-only patterns and leading-`/` anchoring change what a pattern means,\n * `**` differs from glob `**`, and `.git/info/exclude` and `core.excludesFile`\n * contribute rules that are not in the tree at all. The rule that settles it is\n * that a negation cannot re-include a file below an excluded directory — given\n * `tmp/` then `!keep.md`, git still ignores `docs/tmp/keep.md`. No translation\n * into picomatch patterns expresses that, and being subtly wrong here silently\n * changes which files get validated.\n *\n * One subprocess per repository the candidates live in, fed that repository's\n * candidates on stdin — one per run in the ordinary single-checkout case. Measured at\n * 5,000 candidates: 0.111 s with none ignored, 0.260 s with half ignored.\n */\nimport { spawn, type ChildProcessWithoutNullStreams } from \"node:child_process\";\nimport { dirname, relative, resolve, sep } from \"node:path\";\nimport { findGitRoot } from \"../../shared/git-root.js\";\n\nexport interface GitignoreAnswer {\n /** Ignored paths, spelled exactly as they were handed in. */\n ignored: Set<string>;\n /**\n * Whether git answered for at least one repository the candidates live in.\n * False means no candidate was inside a repository git could answer for —\n * no repository, no `git` on `PATH`, or git failed everywhere — in which\n * case **nothing** is filtered and `ignored` is empty.\n *\n * A run spanning several repositories where git answers for some and not\n * others is *available*: the answered roots are filtered, and a root git\n * could not answer for is treated like no repository at all, so its\n * candidates are kept. A partial answer is never reported as none, because\n * the notice for `false` says \"no files were skipped\" and that would be a\n * lie about the roots that did answer.\n */\n available: boolean;\n}\n\n/** Said once, on stderr, when a run explicitly asked for filtering it did not get. */\nexport const GITIGNORE_UNAVAILABLE =\n \".gitignore filtering was requested but git could not answer here (no repository, or no git on PATH); no files were skipped.\";\n\nconst unavailable = (): GitignoreAnswer => ({\n ignored: new Set(),\n available: false,\n});\n\n/**\n * `paths` are relative to `cwd`, posix-style, spelled however the caller\n * spelled them; the answer uses the same spelling.\n *\n * Candidates may lie in more than one repository (proposal 0037): a config in\n * one checkout whose `paths:` reach into another, or a nested checkout under\n * the run's own root. `git check-ignore` refuses a path outside the repository\n * it runs in with exit 128, and it must not be allowed to refuse for the whole\n * batch — one cross-root candidate then switched filtering off for every file\n * in the run, silently, while the notice blamed a missing repository. So the\n * candidates are grouped by the repository that contains them and git is asked\n * once per root, from that root, with paths relative to it. A candidate inside\n * no repository is kept: there is no `.gitignore` that could cover it.\n *\n * `available` is false only when git failed to answer for a repository that\n * exists, or when no candidate was in any repository at all — the two cases\n * where filtering was asked for and nothing could be filtered.\n */\nexport async function gitIgnored(\n paths: string[],\n cwd: string,\n): Promise<GitignoreAnswer> {\n // Nothing to ask about. Skipping the subprocess also keeps a run over\n // explicitly named files alone from reporting git as unavailable.\n if (paths.length === 0) {\n return { ignored: new Set<string>(), available: true };\n }\n\n // Group by containing repository. The root walk is one `existsSync` per\n // directory level and memoized per directory, so a 5,000-file corpus in a\n // handful of directories costs a handful of walks.\n const rootOf = new Map<string, string | null>();\n const byRoot = new Map<string, { rel: string; spelled: string }[]>();\n let inSomeRepo = false;\n for (const spelled of paths) {\n const abs = resolve(cwd, spelled);\n const dir = dirname(abs);\n let root = rootOf.get(dir);\n if (root === undefined) {\n root = findGitRoot(dir);\n rootOf.set(dir, root);\n }\n if (root === null) continue;\n inSomeRepo = true;\n const rel = relative(root, abs).split(sep).join(\"/\");\n const bucket = byRoot.get(root);\n if (bucket) bucket.push({ rel, spelled });\n else byRoot.set(root, [{ rel, spelled }]);\n }\n if (!inSomeRepo) return unavailable();\n\n const ignored = new Set<string>();\n let answered = 0;\n for (const [root, bucket] of byRoot) {\n const answer = await checkIgnore(\n bucket.map((b) => b.rel),\n root,\n );\n // A root git cannot answer for (a broken `.git`, say) is treated like no\n // repository: its candidates are kept. See `GitignoreAnswer.available`.\n if (!answer.available) continue;\n answered += 1;\n for (const b of bucket) {\n if (answer.ignored.has(b.rel)) ignored.add(b.spelled);\n }\n }\n return answered > 0 ? { ignored, available: true } : unavailable();\n}\n\n/** One `git check-ignore` run, from `cwd`, over paths relative to it. */\nfunction checkIgnore(paths: string[], cwd: string): Promise<GitignoreAnswer> {\n return new Promise((settle) => {\n let done = false;\n const finish = (answer: GitignoreAnswer): void => {\n if (done) return;\n done = true;\n settle(answer);\n };\n\n // Explicitly typed rather than relying on evolving-`let` inference, so\n // the stream handles below are checked rather than merely assumed.\n let child: ChildProcessWithoutNullStreams;\n try {\n // -z: NUL-delimited in *and* out. Newline delimiting would corrupt a\n // filename containing a newline, for no benefit.\n child = spawn(\"git\", [\"check-ignore\", \"--stdin\", \"-z\"], {\n cwd,\n windowsHide: true,\n });\n } catch {\n finish(unavailable());\n return;\n }\n\n let out = \"\";\n child.stdout.setEncoding(\"utf8\");\n child.stdout.on(\"data\", (chunk: string) => {\n out += chunk;\n });\n // Drain stderr so a chatty git cannot fill the pipe and stall.\n child.stderr.resume();\n // No binary on PATH lands here rather than throwing from spawn().\n child.on(\"error\", () => {\n finish(unavailable());\n });\n // A dead child makes the pipe write fail; that is reported by 'error'/'close'.\n child.stdin.on(\"error\", () => {});\n\n child.on(\"close\", (code) => {\n // Exit 1 means *nothing matched* — a successful answer meaning \"keep\n // everything\", not a failure. Treating it as one would make the filter\n // silently no-op on every clean repo, which is the whole common case.\n // Only a real failure (128 outside a repo, or a signal, which is null)\n // means git could not answer.\n if (code !== 0 && code !== 1) {\n finish(unavailable());\n return;\n }\n finish({\n ignored: new Set(out.split(\"\\0\").filter((p) => p !== \"\")),\n available: true,\n });\n });\n\n child.stdin.end(paths.join(\"\\0\"));\n });\n}\n","/**\n * The derived metadata channel: values computed from git history, CODEOWNERS\n * and the review record on GitHub or GitLab rather than written by hand.\n *\n * A derived value never merges into what the schema sees. `manni meta derive`\n * stamps the managed fields (`derive.fields` in the config) into the\n * document, and `validate` reports a managed field whose asserted value\n * differs from the derived one as a finding. This module holds the shared\n * vocabulary — which fields can be derived, from which sources — and the two\n * pure steps every source feeds: comparing an asserted value with a derived\n * one, and turning the stale comparisons into findings.\n */\nimport type { ExtractedMetadata, FieldError } from \"../../types.js\";\nimport { escapePointerSegment } from \"../../extractors/pointer.js\";\nimport { toJsonText } from \"../json-text.js\";\nimport type { RangeResult } from \"./provenance.js\";\n\n/** The seven built-in fields, in the order messages list them. */\nexport const DERIVABLE_FIELDS = [\n \"created\",\n \"last-updated\",\n \"authors\",\n \"owner\",\n \"reviewed-by\",\n \"last-reviewed\",\n \"provenance\",\n] as const;\n\n/**\n * The one built-in field that is a list of pins rather than a value\n * (proposal 0046): compared by `compareProvenance`, never `compareDerived`,\n * and the one managed field a manifest may own.\n */\nexport const PROVENANCE_FIELD = \"provenance\";\n\nexport type BuiltinDerivableField = (typeof DERIVABLE_FIELDS)[number];\n\n/**\n * The merge-safe fields (proposal 0069), in the order messages list them:\n * the ones whose stamp, written in a pull request, still reads current after\n * a squash merge. `derive.fields` absent manages these, and on each page only\n * the ones its schemas claim.\n */\nexport const MERGE_SAFE_FIELDS = [\"owner\", \"created\", \"last-updated\", \"provenance\"] as const;\n\n/** The dated fields the git source reads from the stamp a fact commit carries. */\nexport const STAMPED_DATE_FIELDS = [\"created\", \"last-updated\"] as const;\n\nexport type StampedDateField = (typeof STAMPED_DATE_FIELDS)[number];\n\n/**\n * The fields a `derive:` block manages when a page's schemas claim them:\n * `fields` as written, or the merge-safe fields when it is absent. None when\n * there is no `derive:` block at all.\n */\nexport function managedFields(\n derive: { fields?: readonly DerivableField[] } | undefined,\n): readonly DerivableField[] {\n if (derive === undefined) return [];\n return derive.fields ?? MERGE_SAFE_FIELDS;\n}\n\n/**\n * Does derive manage fields on a file that belongs to `memberOf`? Only a\n * member of one of `derive.collections` is stamped and compared (proposal\n * 0070); with no `collections`, every file is.\n */\nexport function deriveCovers(\n derive: { collections?: readonly string[] } | undefined,\n memberOf: readonly string[],\n): boolean {\n const scope = derive?.collections;\n if (scope === undefined) return true;\n return memberOf.some((name) => scope.includes(name));\n}\n\n/**\n * A managed field name: one of the seven built-ins, or a key with an entry in\n * `derive.commands`. The config parser guarantees one or the other.\n */\nexport type DerivableField = string;\n\nexport function isBuiltinField(x: string): x is BuiltinDerivableField {\n return (DERIVABLE_FIELDS as readonly string[]).includes(x);\n}\n\n/** Every source `derive.sources` may name; absent means all five. */\nexport const DERIVE_SOURCES = [\"git\", \"codeowners\", \"github\", \"gitlab\", \"command\"] as const;\n\nexport type DeriveSource = (typeof DERIVE_SOURCES)[number];\n\n/**\n * One configured command, as `derive.commands` reads after parsing: the argv\n * to run, the program first, and how long to wait for it.\n */\nexport interface DeriveCommand {\n run: readonly string[];\n timeoutMs: number;\n}\n\nexport function isDeriveSource(x: string): x is DeriveSource {\n return (DERIVE_SOURCES as readonly string[]).includes(x);\n}\n\n/**\n * Every field a run can derive: the built-ins in the order messages list\n * them, then the command keys sorted, so the list is the same whatever\n * order the config wrote them in.\n */\nexport function derivableFields(\n commands?: Readonly<Record<string, DeriveCommand>>,\n): DerivableField[] {\n return [...DERIVABLE_FIELDS, ...Object.keys(commands ?? {}).sort()];\n}\n\n/**\n * One fact a source produced, with where it came from. `evidence` is the\n * short human-readable trail a finding quotes — a commit, a CODEOWNERS line,\n * a pull request — so the reader can check the claim without re-running.\n */\nexport interface DerivedValue {\n value: unknown;\n source: DeriveSource;\n evidence: string;\n}\n\n/**\n * Everything derived for one document. A `null` field means a source was\n * consulted and had no fact to offer (a file with no commits yet, a path no\n * CODEOWNERS rule matches); an absent field means no source answered for it.\n */\nexport interface DerivedRecord {\n file: string;\n fields: Record<DerivableField, DerivedValue | null>;\n}\n\n/** Whether a source can answer at all; `reason` names the fix when not. */\nexport interface SourceStatus {\n available: boolean;\n reason?: string;\n}\n\n/** Which host the origin remote points at, and what to call the project there. */\nexport interface RemoteIdentity {\n kind: \"github\" | \"gitlab\";\n host: string;\n /** `owner/repo` on GitHub; the full namespace path on GitLab. */\n project: string;\n}\n\n/** One `APPROVED` review, the latest per reviewer. */\nexport interface Approval {\n login: string;\n /** ISO-8601. */\n submittedAt: string;\n}\n\n/** The merged PR/MR that carried a commit. Immutable once merged, so cacheable. */\nexport interface MergedChange {\n /** The PR number or MR iid. */\n id: number;\n /** ISO-8601. */\n mergedAt: string;\n /** Approvals only, deduplicated by login; the built-in clients order them oldest first. */\n approvals: Approval[];\n}\n\n/**\n * The review half of the derive context: the merged change behind a commit and\n * who approved it. Reached through `gh` / `glab`, never an HTTP client — see\n * `reviews.ts`.\n */\nexport interface ReviewClient {\n detect(): Promise<RemoteIdentity | null>;\n /** Binary on PATH and authenticated for the host; `reason` names the fix. */\n status(): Promise<SourceStatus>;\n /** The merged PR/MR that contains the commit, or null (open, none, or unknown). */\n mergedChangeFor(sha: string): Promise<MergedChange | null>;\n}\n\n/** One document as the sources see it. */\nexport interface DeriveInput {\n label: string;\n absPath: string;\n content: string;\n extracted: ExtractedMetadata;\n /**\n * Where the page's `provenance` record lives when a manifest owns it\n * (proposal 0046), so evidence rule 2 reads the manifest's blob at each\n * commit rather than the page's frontmatter. Absent: the page's own.\n */\n provenanceManifest?: ManifestRef;\n /**\n * Where the page's `created` and `last-updated` live when a manifest owns\n * them (proposal 0069, rule 1), so the git source reads the stamp a fact\n * commit carries from the manifest's blob at that commit as well as from\n * the page's. A field with no entry: the page's own.\n */\n stampManifests?: Partial<Readonly<Record<StampedDateField, ManifestRef>>>;\n /**\n * `manni meta derive <path>:L1-L2 --generated-by <name>`: the file lines\n * each target names go to `generatedBy`, committed or not, unless evidence\n * names another machine, and no other uncommitted line does. Ranges that\n * overlap attribute their union. Each target is a positional as typed,\n * which every refusal quotes.\n */\n attribution?: { targets: string[]; generatedBy: string };\n}\n\n/** A manifest that holds one page's managed field, as the git source reads it at a commit. */\nexport interface ManifestRef {\n /** The manifest file, absolute. */\n absPath: string;\n /** The page's key there: its path relative to the config directory, or its join value. */\n entry: string;\n /** `path`, or the page field the manifest joins on. */\n join: string;\n}\n\n/** What a derive run holds constant across every document it visits. */\nexport interface DeriveContext {\n /** The run's working directory, the fallback when no config directory applies. */\n cwd: string;\n /** Directory the input labels are relative to, as `resolveRunConfig` settled it. */\n base: string;\n configDir?: string;\n sources: readonly DeriveSource[];\n fields: readonly DerivableField[];\n /** CODEOWNERS path, when the config names one; resolved from `configDir`. */\n codeowners?: string;\n /** The `command` source's table, by the field each command derives; absent means none configured. */\n commands?: Readonly<Record<string, DeriveCommand>>;\n cache: boolean;\n now: () => Date;\n /** The review client for every repository in the run; the built-in `gh` / `glab` clients when absent. */\n reviews?: ReviewClient;\n /** `--generated-by` or `MANNI_GENERATED_BY` (proposal 0046): who uncommitted body lines go to. */\n generatedBy?: string;\n /** `derive.machines`: trailer identities that are machines; `[\"*[bot]\"]` when absent. */\n machines?: readonly string[];\n}\n\n/**\n * How an asserted value stands against the derived one.\n *\n * - `current` — they agree.\n * - `stale` — the document says one thing and a source says another.\n * - `unset` — the document says nothing and a source has a value.\n * - `unknown` — no source could answer, so nothing is claimed either way.\n */\nexport type DerivedStatus = \"current\" | \"stale\" | \"unset\" | \"unknown\";\n\nexport interface DerivedField {\n field: DerivableField;\n /** What the document carries; absent when it carries nothing. */\n asserted?: unknown;\n /**\n * What the sources say. `null` when they could not answer, which is exactly\n * when `status` is `unknown`.\n */\n derived: unknown;\n source?: DeriveSource;\n evidence?: string;\n status: DerivedStatus;\n /** Whether `derive` wrote the value into the document. */\n written: boolean;\n /**\n * `provenance` only (proposal 0046): one verdict per range, in file lines.\n * The field's own `status` is `current` when every range is, and\n * otherwise `stale`, or `unset` when the page carries no record at all.\n */\n ranges?: RangeResult[];\n /**\n * `provenance` only: the manifest that holds the page's record, as the run\n * reports it, when one does. `derive` writes there, never into the page.\n */\n manifest?: string;\n /**\n * Proposal 0047: the manifest a field other than `provenance` is written\n * into, as the run reports it, when a manifest of the page's collections\n * owns the key. Absent when the value goes to the page.\n */\n destination?: string;\n /** The 1-based line of the key in `destination` after the write. Absent under `dryRun` and `check`. */\n destinationLine?: number;\n}\n\n/**\n * The `schema` ref a stale-field finding carries, and so its baseline and\n * rule identity: `derived:stale/derived`. Shaped like `check:<name>` and\n * `external:owned` so `classifyRef` passes it through as a built-in id rather\n * than resolving it as a cwd-relative file path, and reserved in the registry\n * for the same reason those are.\n */\nexport const DERIVED_STALE_SCHEMA = \"derived:stale\";\n\n/** The `keyword` every derived finding carries: no Ajv keyword produced it. */\nexport const DERIVED_KEYWORD = \"derived\";\n\n/**\n * Compare what a document asserts with what a source derived.\n *\n * Pure. Lists compare as sets — order-insensitive, members deep-equal — so a\n * reordered `authors:` is not a stale one. A missing or `null` derived value\n * means the sources could not answer, which is `unknown` rather than a\n * verdict either way. `written` is always false here; only `derive` writes.\n */\nexport function compareDerived(\n field: DerivableField,\n asserted: unknown,\n derived: DerivedValue | null | undefined,\n): DerivedField {\n const base = {\n field,\n ...(asserted !== undefined ? { asserted } : {}),\n };\n if (derived == null) {\n return { ...base, derived: null, status: \"unknown\", written: false };\n }\n const status: DerivedStatus =\n asserted === undefined\n ? \"unset\"\n : deepEqual(asserted, derived.value)\n ? \"current\"\n : \"stale\";\n return {\n ...base,\n derived: derived.value,\n source: derived.source,\n evidence: derived.evidence,\n status,\n written: false,\n };\n}\n\n/**\n * The findings `validate` files for a document's managed fields: one per\n * field that is `stale` or `unset`. Current and unknown fields file nothing.\n *\n * `lineFor` is the document's own pointer lookup, so a finding lands on the\n * line the asserted key sits on; an unset field has no line. `locate` answers\n * for a value a manifest supplied (proposal 0047): the finding then names the\n * manifest and its line, as every other manifest finding does.\n */\nexport function staleFindings(\n fields: readonly DerivedField[],\n lineFor: (pointer: string) => number | undefined,\n locate?: (pointer: string) => { file: string; line?: number } | undefined,\n): FieldError[] {\n const findings: FieldError[] = [];\n for (const f of fields) {\n if (f.status !== \"stale\" && f.status !== \"unset\") continue;\n const instancePath = `/${escapePointerSegment(f.field)}`;\n const at = locate?.(instancePath);\n const line = at !== undefined ? at.line : lineFor(instancePath);\n const says = `${f.source ?? \"a source\"} says ${fmt(f.derived)}`;\n const trail = f.evidence === undefined ? \"\" : ` (${f.evidence})`;\n const head =\n f.status === \"stale\"\n ? `${f.field} says ${fmt(f.asserted)}`\n : `${f.field} is not set`;\n findings.push({\n schema: DERIVED_STALE_SCHEMA,\n keyword: DERIVED_KEYWORD,\n subject: f.field,\n instancePath,\n message: `${head}; ${says}${trail} — run manni meta derive`,\n ...(at !== undefined ? { file: at.file } : {}),\n ...(line !== undefined ? { line } : {}),\n });\n }\n return findings;\n}\n\n/** Strings bare, everything else as compact JSON. */\nfunction fmt(value: unknown): string {\n if (typeof value === \"string\") return value;\n return toJsonText(value) ?? String(value);\n}\n\n/**\n * Structural equality with lists as multisets.\n *\n * Objects compare key by key; lists compare by matching each member of one\n * against an unused member of the other, so `[a, b]` equals `[b, a]` but not\n * `[a, a]`. Leaves compare through their JSON text, which is the projection\n * every reporter and the query table already use, so a `Date` and its ISO\n * string agree here exactly when they agree there.\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (isList(a) || isList(b)) {\n if (!isList(a) || !isList(b) || a.length !== b.length) return false;\n const unused = [...b];\n for (const x of a) {\n const i = unused.findIndex((y) => deepEqual(x, y));\n if (i === -1) return false;\n unused.splice(i, 1);\n }\n return true;\n }\n if (isPlainObject(a) || isPlainObject(b)) {\n if (!isPlainObject(a) || !isPlainObject(b)) return false;\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n return keys.every(\n (k) => Object.hasOwn(b, k) && deepEqual(a[k], b[k]),\n );\n }\n return toJsonText(a) === toJsonText(b);\n}\n\n/** `Array.isArray` narrows `unknown` to `any[]`; this keeps the members unknown. */\nfunction isList(v: unknown): v is unknown[] {\n return Array.isArray(v);\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return (\n typeof v === \"object\" && v !== null && !isList(v) && !(v instanceof Date)\n );\n}\n","/**\n * Optional lightweight YAML config: the `meta:` section of the family file\n * (`manni.config.yaml`), or the whole of a pre-family `docmeta.config.yaml`.\n * Supplies the default schema set and optional per-glob or per-collection\n * overrides, so CI can run a bare `manni meta validate`. Which documents exist\n * is not here: proposal 0041 moved that to the family-level `collections:`.\n *\n * Finding the file is shared with every tool under the umbrella\n * (src/shared/config-file.ts); what the section may contain is decided here.\n */\nimport { resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { DocmetaError } from \"../types.js\";\nimport {\n findConfigFile,\n readConfigFile,\n type ConfigFile,\n type ConfigFileOptions,\n} from \"../../shared/config-file.js\";\nimport { findGitRoot } from \"../../shared/git-root.js\";\nimport {\n selectCollections,\n type CollectionConfig,\n} from \"../../shared/collections.js\";\nimport { FILE_SCHEMA_KEY, rebaseConfigSchemaRefs } from \"./resolve-schema.js\";\nimport { classifyRef, type RegisteredSchemas } from \"./schema-registry.js\";\nimport { loadRegisteredSchemas } from \"./register.js\";\nimport { INTEGRITY_SHAPE, isIntegrity } from \"./integrity.js\";\nimport { parseElementPath } from \"../extractors/element-key.js\";\nimport {\n DERIVABLE_FIELDS,\n DERIVE_SOURCES,\n isBuiltinField,\n isDeriveSource,\n PROVENANCE_FIELD,\n type BuiltinDerivableField,\n type DerivableField,\n type DeriveSource,\n} from \"./derive/types.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\nexport interface SchemaOverride {\n /**\n * The glob, or globs, this override governs. A file matches when **any** of\n * them matches, so a list groups path shapes that brace expansion cannot\n * express as one pattern: a per-skill `SKILL.md` one directory down and a\n * flat `.claude/agents` file share a schema set but have no common stem.\n *\n * Kept as written rather than normalized to a list, because a programmatic\n * caller may hand `runValidate` a config object it built itself, and that\n * caller's bare string must keep working. Read it through `overrideGlobs`\n * rather than directly — that is the one place the two shapes collapse.\n *\n * Optional since proposal 0041: an entry carries **exactly one** of `files`\n * or `collection`.\n */\n files?: string | string[];\n schemas: string[];\n /**\n * The collection this override governs (proposal 0041), in place of globs of\n * its own: it matches the members of the named collection, which are decided\n * once, at the top level of the family file, for every tool. Must name a\n * collection `collections:` defines — checked by `loadConfig`, which is the\n * first place both halves of the file are known.\n *\n * This is what `overrides[].name` was for under 0027, inverted: a collection\n * is the thing that has a name, and an override points at it.\n */\n collection?: string;\n /**\n * Extra element paths for files matching `files`. Unlike `schemas`, which the\n * first matching override *replaces* because a schema set is a complete\n * statement, these accumulate: every matching override contributes, on top of\n * the top-level `elements:`. A list of extra places to look is additive by\n * nature, and an override that silently dropped the repo-wide ones would be a\n * trap.\n */\n elements?: string[];\n /**\n * Put the default set first, then this entry's `schemas` (proposal 0070).\n * Absent or `false` means the entry's `schemas` replace the set, as an\n * override always did. An override never inherits the top-level `schemas`.\n */\n defaults?: boolean;\n /**\n * Stack the strict version of each default or registered schema in the\n * entry's set right after its base, where one exists.\n */\n strict?: boolean;\n}\n\n/**\n * A `schemas:` entry in its long form: a reference plus where it came from and\n * what it must hash to.\n *\n * Written by `manni meta schemas vendor`, which downloads a remote schema into the\n * repository and records both. `source` keeps the provenance the URL used to\n * carry, so a re-vendor knows where to look and an error can say what to\n * re-download; `integrity` makes an edited or corrupted copy a loud failure\n * rather than a silently changed contract.\n */\nexport interface SchemaRefEntry {\n /** What is loaded: a built-in id, a local `.json` path, or a URL. */\n ref: string;\n /** Where `ref` was vendored from — a URL, or a path for a local copy. */\n source?: string;\n /** `sha256-<64 hex>` over the bytes of `ref`. Local files only. */\n integrity?: string;\n}\n\n/**\n * One `schemas:` entry. A bare string is the original form and is unchanged by\n * 0008; the mapping form adds provenance and a pin.\n */\nexport type SchemaEntry = string | SchemaRefEntry;\n\n/** The keys a `schemas:` mapping entry may carry. */\nconst SCHEMA_ENTRY_KEYS = [\"ref\", \"source\", \"integrity\"] as const;\n\n/**\n * What a **document** is allowed to name in its own `$schema`.\n *\n * - `any` — the default, and today's behavior: a built-in id, a file in the\n * repository, or a URL. `schemaTrust.hosts` narrows the URL case.\n * - `local` — a built-in id or a file in the repository; a URL is refused.\n * - `none` — the document's `$schema` is ignored and config decides, with a\n * notice on stderr naming the file whose key was dropped.\n */\nexport type DocumentRefTrust = \"any\" | \"local\" | \"none\";\n\n/** The values `schemaTrust.documentRefs` accepts, in the order documented. */\nexport const DOCUMENT_REF_TRUST = [\"any\", \"local\", \"none\"] as const;\n\n/**\n * How far a **document** is trusted to choose the contract it is judged by.\n *\n * Nothing here touches a ref an *operator* supplied: `schemas:`,\n * `overrides[].schemas`, and `-s/--schema` are never filtered, in any mode. A\n * person who can edit the config or pass a flag is not the attacker this key\n * has in mind — a pull request against a public docs repo is.\n */\nexport interface SchemaTrustConfig {\n /** Defaults to `any`, which is exactly what docmeta has always done. */\n documentRefs?: DocumentRefTrust;\n /**\n * Hosts a document-supplied URL may name. Consulted **only** under\n * `documentRefs: any`; absent means any host, as before.\n *\n * A convenience for pointing at one known publisher, not a security\n * boundary: `fetch` follows redirects, so an allowlisted host that answers\n * `302` sends the fetch anywhere it likes. A repo that genuinely distrusts\n * its contributors wants `documentRefs: local`.\n */\n hosts?: string[];\n}\n\n/** The keys a `schemaTrust:` mapping may carry. */\nconst SCHEMA_TRUST_KEYS = [\"documentRefs\", \"hosts\"] as const;\n\n/** The keys a `schemaCache:` mapping may carry. */\nconst SCHEMA_CACHE_KEYS = [\"ttlHours\"] as const;\n\n/**\n * Validate an `elements:` list, rejecting a path that cannot produce a key.\n *\n * Parsed here rather than at extraction so a typo is an error when the config\n * loads, naming the file and the key. Left to extraction it would be a silent\n * no-op: the path would match nothing, no key would appear, and the check the\n * author thought they had configured would simply never run.\n */\nfunction asElementPaths(\n value: unknown,\n where: string,\n source: string,\n): string[] {\n const list = asStringList(value, where, source);\n for (const path of list) {\n try {\n parseElementPath(path);\n } catch (err) {\n throw new DocmetaError(`${source}: ${where} — ${errorMessage(err)}`);\n }\n }\n return list;\n}\n\n/** The keys one `overrides:` entry may carry. */\nconst OVERRIDE_KEYS = [\n \"collection\",\n \"files\",\n \"schemas\",\n \"elements\",\n \"defaults\",\n \"strict\",\n] as const;\n\n/**\n * One named corpus check (proposal 0026): SQL run over the `docs` projection\n * by `validate`, whose result rows are findings under the id `check:<name>`.\n */\nexport interface CheckConfig {\n /** The check's name — the durable half of its findings' identity. */\n name: string;\n /** One SQL statement whose rows follow the finding column convention. */\n query: string;\n}\n\n/** The keys one `checks:` entry may carry. */\nconst CHECK_KEYS = [\"name\", \"query\"] as const;\n\n/**\n * One `derive.commands` entry: a program to run for a field's value, as the\n * config spells it. `run` is the argv, the program first; `timeout` is in\n * seconds. The derive context carries the parsed form, `DeriveCommand`.\n */\nexport interface DeriveCommandConfig {\n run: string[];\n timeout?: number;\n}\n\n/**\n * The derived channel: managed fields `manni meta derive` stamps from git\n * history, CODEOWNERS, the review record on GitHub or GitLab, or a configured\n * command, and `validate` checks for drift.\n */\nexport interface DeriveConfig {\n /**\n * The managed fields. Each is one of `DERIVABLE_FIELDS` or a key of\n * `commands`, never `$schema`, and never a key a manifest owns: a value\n * with two authorities has none.\n *\n * Absent means the merge-safe fields (`MERGE_SAFE_FIELDS`, proposal 0069),\n * each managed only on a page whose schemas claim it as a top-level\n * property. `[]` manages nothing. Read it through `managedFields`.\n */\n fields?: DerivableField[];\n /** Which sources to consult; absent means all of `DERIVE_SOURCES`. */\n sources?: DeriveSource[];\n /**\n * CODEOWNERS path, relative to the config file's directory, when it is not\n * in one of the places the codeowners source looks by itself. Checked for\n * existence at run time, not here.\n */\n codeowners?: string;\n /**\n * The `command` source's table, by the field each command derives. A key\n * is never a built-in field, `$schema`, or a key a manifest owns.\n */\n commands?: Record<string, DeriveCommandConfig>;\n /**\n * Trailer identities that are machines (proposal 0046), as globs matched\n * case-sensitively against a trailer's name and its email, with literal\n * brackets. A match names a machine for `provenance` and is left out of\n * `authors`. Absent means `[\"*[bot]\"]`, which is 0040's rule; read it\n * through `machinesOf`.\n */\n machines?: string[];\n /**\n * The collections whose members derive manages (proposal 0070). A file in\n * none of them is neither stamped nor compared. Absent means every\n * validated file. Read it through `deriveCovers`.\n */\n collections?: string[];\n}\n\n/** The keys a `derive:` mapping may carry. */\nconst DERIVE_KEYS = [\n \"fields\",\n \"sources\",\n \"codeowners\",\n \"commands\",\n \"machines\",\n \"collections\",\n] as const;\n\n/** The keys one `derive.commands` entry may carry. */\nconst DERIVE_COMMAND_KEYS = [\"run\", \"timeout\"] as const;\n\n/** Which built-in source claims each built-in field, as a refusal names it. */\nconst BUILTIN_CLAIMED_BY: Readonly<Record<BuiltinDerivableField, string>> = {\n created: \"git\",\n \"last-updated\": \"git\",\n authors: \"git\",\n owner: \"codeowners\",\n \"reviewed-by\": \"GitHub or GitLab\",\n \"last-reviewed\": \"GitHub or GitLab\",\n provenance: \"git\",\n};\n\n/**\n * The `derived` table's own columns, which a command key may not be spelled\n * like: the view is `_path`, the derivable fields, then `_sources`.\n */\nconst DERIVED_TABLE_RESERVED: ReadonlySet<string> = new Set([\"_path\", \"_sources\"]);\n\n/** The tail every not-derivable message ends with. */\nconst DERIVABLE_LIST = `Derivable fields: ${DERIVABLE_FIELDS.join(\", \")}, or any key with an entry in derive.commands.`;\n\n/**\n * The grammar a check's name must satisfy: one built-in id *segment*.\n *\n * Not taste. The finding's `schema` field carries `check:<name>` and the\n * baseline canonicalizes that field through `classifyRef` before\n * fingerprinting — so the name must make `check:<name>` classify as a builtin\n * id (`BUILTIN_ID`, schema-registry.ts). A name with a space, a slash, or a\n * `.json` tail would classify as a **file path** and be resolved cwd-relative:\n * a fingerprint that changes with the directory you run from, the exact bug\n * `canonicalSchemaRef` exists to prevent. Enforced at parse time so the\n * failure names the config line, not a baseline mismatch three runs later.\n *\n * Exported for `checkSchemaRef`, which asserts the same grammar for\n * programmatic `CheckConfig` callers that never pass through this parser.\n */\nexport const CHECK_NAME = /^[a-z0-9][a-z0-9._-]*$/;\n\n/**\n * Check names a config may not claim, each with why.\n *\n * `query` is reserved: `manni meta query --check` files its ad-hoc findings as\n * the pseudo-check `check:query`, and a configured check with that name would\n * mint the identical rule id — two different rules sharing one baseline\n * identity. `derive` is reserved beside it: `manni meta derive` is a verb of\n * its own with its own finding identity (`derived:stale`), and a check\n * reporting as `check:derive` would read as that verb's findings.\n */\nconst RESERVED_CHECK_NAMES = new Map<string, string>([\n [\n \"query\",\n \"`manni meta query --check` files its ad-hoc findings as check:query, and a configured check with the same name would share their identity\",\n ],\n [\n \"derive\",\n \"`manni meta derive` is a verb of its own, and a check reporting as check:derive would read as its findings\",\n ],\n]);\n\n/** The keys a `fill:` mapping may carry. */\nconst FILL_KEYS = [\n \"provider\",\n \"model\",\n \"confidenceThreshold\",\n \"maxTurns\",\n \"chunkChars\",\n \"concurrency\",\n] as const;\n\n/**\n * The keys the config's top level may carry.\n *\n * Adding a key to `DocmetaConfig` means adding it here too, or a config using\n * it is rejected. That coupling is the point: the alternative is the silence\n * this list exists to end.\n */\nconst CONFIG_KEYS = [\n \"schemas\",\n \"defaults\",\n \"strict\",\n \"register\",\n \"overrides\",\n \"checks\",\n \"derive\",\n \"baseline\",\n \"allowEmpty\",\n \"respectGitignore\",\n \"offline\",\n \"schemaCache\",\n \"schemaTrust\",\n \"fill\",\n \"elements\",\n] as const;\n\n/**\n * Reject any key outside `allowed`, naming what was supported.\n *\n * One helper so every level of the config reports a typo the same way. A key\n * the parser does not recognize is dropped in silence otherwise, which is the\n * failure this whole class of check exists to prevent: a misspelled\n * `schemaTust:` leaves a repository that reads as guarded and is not, and a\n * misspelled `intergrity:` leaves a schema that reads as pinned and is not.\n * Neither produces a diagnostic anywhere, at any verbosity.\n *\n * `where` names the mapping as the user would recognize it — `\"schemaTrust\"`,\n * `schemas[0]`, or `the top level`.\n */\nfunction rejectUnknownKeys(\n raw: Record<string, unknown>,\n allowed: readonly string[],\n where: string,\n source: string,\n): void {\n for (const key of Object.keys(raw)) {\n if (!allowed.includes(key)) {\n throw new DocmetaError(\n `${source}: ${where} has unknown key \"${key}\". Supported keys: ${allowed.join(\", \")}.`,\n );\n }\n }\n}\n\n/** Defaults for the `fill` command; every key is overridable by a CLI flag. */\nexport interface FillConfig {\n provider?: string;\n model?: string;\n /** Minimum self-reported confidence to write a value (0-1). */\n confidenceThreshold?: number;\n /** Stop after this many inference calls. Counts calls, not files. */\n maxTurns?: number;\n /** Characters of document per call. Default 12000. */\n chunkChars?: number;\n concurrency?: number;\n}\n\n/** Settings for the cross-run cache of schemas fetched over `http(s)`. */\nexport interface SchemaCacheConfig {\n /**\n * Hours a cached schema is served before it is re-fetched. `0` disables the\n * cache entirely, in both directions.\n */\n ttlHours?: number;\n}\n\n/**\n * Upper bound on `schemaCache.ttlHours` — one year.\n *\n * Not tidiness: freshness compares elapsed time against `ttlHours * 3_600_000`,\n * and a finite-but-enormous value overflows that product to `Infinity`, so no\n * entry is ever older than the limit and the cache silently stops expiring.\n * `Number.isFinite` alone does not catch it, because `1e308` is finite.\n */\nconst MAX_TTL_HOURS = 8760;\n\nexport interface DocmetaConfig {\n /**\n * The schemas every file no override matches is judged by. Each entry is\n * either a reference string or a `{ ref, source?, integrity? }` mapping —\n * see `SchemaEntry`. They join the default set unless `defaults` is false.\n */\n schemas?: SchemaEntry[];\n /**\n * Put the default set first, then `schemas`, for the files no override\n * matches (proposal 0070). Absent means `true`; `false` makes `schemas`\n * replace the default set.\n */\n defaults?: boolean;\n /**\n * For those files, stack the strict version of each default or registered\n * schema in the set right after its base, where one exists. Absent means\n * `false`.\n */\n strict?: boolean;\n /**\n * JSON Schema files, or directories of them (`*.json`, recursively),\n * relative to the config file. Each is loaded once and named by its `$id`.\n */\n register?: string[];\n /**\n * The schemas `register` names, loaded by `loadConfig` and keyed by `$id`.\n * Not a key of the file: it is what the file's `register` produced.\n */\n registered?: RegisteredSchemas;\n overrides?: SchemaOverride[];\n /**\n * Named corpus checks `validate` runs after the per-file schemas, when the\n * run's file set is the config-resolved corpus. See `CheckConfig`.\n */\n checks?: CheckConfig[];\n /**\n * The managed fields `derive` stamps and `validate` checks for drift. See\n * `DeriveConfig`.\n */\n derive?: DeriveConfig;\n /**\n * Element paths to lift in addition to each format's convention. See\n * `parseElementPath` for the syntax.\n */\n elements?: string[];\n fill?: FillConfig;\n /**\n * Path to a validation baseline, relative to **this config file**. Setting it\n * implies `--baseline` on every run; `--no-baseline` suppresses it for one.\n */\n baseline?: string;\n /**\n * Treat an input set that resolves to zero files as success rather than an\n * operational error. Off by default: a glob that stops matching would\n * otherwise leave a permanently green gate that checks nothing.\n */\n allowEmpty?: boolean;\n /**\n * Skip files `.gitignore` covers when expanding directories and globs. On by\n * default; set false to check generated or vendored documents the repo does\n * not track. Setting it **true** explicitly also asks to be told when git\n * cannot answer — see `GITIGNORE_UNAVAILABLE`.\n */\n respectGitignore?: boolean;\n /** Defaults for the cross-run schema cache. See `SchemaCacheConfig`. */\n schemaCache?: SchemaCacheConfig;\n /**\n * Never fetch a remote schema. A URL reference resolves from the schema\n * cache; an uncached one is an operational error naming the URL. Built-in and\n * local-file references are unaffected — neither touches the network.\n */\n offline?: boolean;\n /**\n * How far a document's own `$schema` is trusted. Absent means `any` — every\n * setup that exists today, unchanged. See `SchemaTrustConfig`.\n */\n schemaTrust?: SchemaTrustConfig;\n}\n\n/** The metadata tool's key in the family config file. */\nexport const META_SECTION = \"meta\";\n\n/**\n * The tool's own filenames from before the family file. Still discovered,\n * with a deprecation warning; their whole document is the `meta:` section.\n */\nexport const LEGACY_CONFIG_NAMES: readonly string[] = [\n \"docmeta.config.yaml\",\n \"docmeta.config.yml\",\n];\n\nconst CONFIG_FILE: ConfigFileOptions = {\n section: META_SECTION,\n legacyNames: LEGACY_CONFIG_NAMES,\n toError: (message) => new DocmetaError(message),\n};\n\nfunction asStringList(value: unknown, field: string, source: string): string[] {\n if (!Array.isArray(value) || value.some((v) => typeof v !== \"string\")) {\n throw new DocmetaError(\n `${source}: \"${field}\" must be a list of strings.`,\n );\n }\n return value as string[];\n}\n\n/**\n * Parse `overrides[].files`, which accepts a single glob or a list of them.\n *\n * Deliberately not `asStringList`: that helper rejects a bare string, and the\n * single form is what every existing config and every doc example is written\n * in. The shape is preserved rather than normalized — see `SchemaOverride.files`\n * for why — so this validates and returns, it does not convert.\n *\n * The refusals are the ones a silently-matching-nothing rule would otherwise\n * cause: an empty list, and a blank glob in either shape. Both read as\n * configured and are not, which is the same false green the neighbouring\n * \"sets neither schemas nor elements\" check exists to end.\n */\nfunction asFileGlobs(\n value: unknown,\n where: string,\n source: string,\n): string | string[] {\n if (typeof value === \"string\") {\n if (value.trim() === \"\") {\n throw new DocmetaError(`${source}: ${where} must be a non-empty glob string.`);\n }\n return value;\n }\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new DocmetaError(\n `${source}: ${where} is an empty list, so it matches nothing and the override has no effect.`,\n );\n }\n // Indexed, because \"one of these six globs is blank\" is not actionable.\n value.forEach((glob, j) => {\n if (typeof glob !== \"string\" || glob.trim() === \"\") {\n throw new DocmetaError(\n `${source}: ${where}[${j}] must be a non-empty glob string.`,\n );\n }\n });\n return value as string[];\n }\n throw new DocmetaError(\n `${source}: ${where} must be a glob string or a list of glob strings.`,\n );\n}\n\n/**\n * Parse the top-level `schemas:` list, which accepts both forms.\n *\n * Separate from `asStringList` on purpose. That helper also validates\n * `elements` and `overrides[].schemas`, and widening it in place would have\n * quietly widened those too — `elements: [{ref: …}]` would have started\n * parsing and then failed somewhere far from the config file.\n */\nfunction asSchemaList(\n value: unknown,\n field: string,\n source: string,\n): SchemaEntry[] {\n if (!Array.isArray(value)) {\n throw new DocmetaError(\n `${source}: \"${field}\" must be a list of schema references.`,\n );\n }\n return value.map((entry, i) => parseSchemaEntry(entry, `${field}[${i}]`, source));\n}\n\nfunction parseSchemaEntry(\n entry: unknown,\n where: string,\n source: string,\n): SchemaEntry {\n if (typeof entry === \"string\") return entry;\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) {\n throw new DocmetaError(\n `${source}: ${where} must be a schema reference string, or a mapping with \"ref\" (and optionally \"source\" and \"integrity\").`,\n );\n }\n const raw = entry as Record<string, unknown>;\n\n // A misspelled key is the failure worth catching here: `intergrity:` would\n // otherwise be dropped in silence, leaving a config that reads as pinned and\n // a schema that is not.\n rejectUnknownKeys(raw, SCHEMA_ENTRY_KEYS, where, source);\n\n if (typeof raw.ref !== \"string\" || raw.ref.trim() === \"\") {\n throw new DocmetaError(\n `${source}: ${where}.ref must be a non-empty schema reference string.`,\n );\n }\n const parsed: SchemaRefEntry = { ref: raw.ref };\n\n if (raw.source !== undefined) {\n if (typeof raw.source !== \"string\" || raw.source.trim() === \"\") {\n throw new DocmetaError(\n `${source}: ${where}.source must be a non-empty string naming where \"${raw.ref}\" was vendored from.`,\n );\n }\n parsed.source = raw.source;\n }\n\n if (raw.integrity !== undefined) {\n if (typeof raw.integrity !== \"string\" || !isIntegrity(raw.integrity)) {\n throw new DocmetaError(\n `${source}: ${where}.integrity must look like \"${INTEGRITY_SHAPE}\". Record one with \\`manni meta schemas vendor\\`.`,\n );\n }\n // A pin is checked against bytes on disk. On a built-in id there are no\n // bytes to read, and on a URL the copy that satisfies a run may come from\n // the schema cache, which stores the parsed schema rather than what the\n // server sent. Accepting either would record a pin nothing ever verifies —\n // a config that reads as pinned and is not.\n const kind = classifyRef(parsed.ref).kind;\n if (kind !== \"file\") {\n throw new DocmetaError(\n `${source}: ${where}.integrity applies to a vendored local file, but \"${parsed.ref}\" is a ${kind === \"url\" ? \"URL\" : \"built-in id\"}. Vendor it first with \\`manni meta schemas vendor\\`, or drop the pin.`,\n );\n }\n parsed.integrity = raw.integrity;\n }\n\n return parsed;\n}\n\n/**\n * Parse and validate config YAML text whose top level *is* the metadata\n * tool's config — a pre-family `docmeta.config.yaml`, or a section already\n * cut out of the family file.\n */\nexport function parseConfig(text: string, source: string): DocmetaConfig {\n let raw: unknown;\n try {\n raw = parseYaml(text);\n } catch (err) {\n throw new DocmetaError(\n `${source}: invalid YAML: ${errorMessage(err)}`,\n );\n }\n return parseConfigValue(raw, source);\n}\n\n/**\n * Validate an already-parsed config value.\n *\n * `section` is the family-file key the value was cut from, when it was. The\n * validator labels fields relative to the document it is handed — `\"paths\"`,\n * `overrides[0]` — and the one place that knows those fields sit under\n * `meta:` is here, so the label gains the section on the way out rather than\n * every check learning to spell it.\n */\nexport function parseConfigValue(\n raw: unknown,\n source: string,\n section?: string,\n): DocmetaConfig {\n // Deliberately outside the `withSection` wrapper below, and outside both\n // branches' `try`. These four messages name `meta` in their own prose, so\n // `withSection` rewriting `\"paths\"` into `\"meta.paths\"` would produce\n // `\"meta.paths\" is no longer a meta key` — a sentence that contradicts\n // itself. They run for the unwrapped legacy form too, because a\n // `docmeta.config.yaml` that still says `paths:` is exactly the file whose\n // owner needs to be told where the key went (0041 § discovery).\n assertNoMovedKeys(raw, source);\n let config: DocmetaConfig;\n try {\n config = parseConfigDocument(raw, source);\n } catch (err) {\n if (section !== undefined && err instanceof DocmetaError) {\n throw new DocmetaError(withSection(err.message, source, section));\n }\n throw err;\n }\n // Outside the wrapper: the sentence names two keys, and `withSection`\n // prefixes only the first.\n if (config.defaults === false && (config.schemas ?? []).length === 0) {\n const key = (name: string): string =>\n section === undefined ? name : `${section}.${name}`;\n throw new DocmetaError(\n `${source}: ${key(\"defaults\")}: false with no ${key(\"schemas\")} leaves files with no schema. List schemas, or remove defaults.`,\n );\n }\n return config;\n}\n\n/**\n * Every message the validator produces opens with `${source}: ` and then\n * names what is wrong in one of three shapes: a quoted key (`\"paths\"`,\n * `\"fill.model\"`), an unquoted path (`overrides[0].files`, `checks[1]`,\n * `elements — …`), or \"the top level\". Each gains the section.\n */\nfunction withSection(message: string, source: string, section: string): string {\n const head = `${source}: `;\n if (!message.startsWith(head)) return message;\n const rest = message.slice(head.length);\n if (rest.startsWith(\"the top level \")) {\n return `${head}\\`${section}:\\`${rest.slice(\"the top level\".length)}`;\n }\n if (rest.startsWith('\"')) return `${head}\"${section}.${rest.slice(1)}`;\n if (/^[a-zA-Z]+(\\[|\\.| —| must |: )/.test(rest)) return `${head}${section}.${rest}`;\n return message;\n}\n\n/** Where the configuration reference documents each moved key. */\nconst CONFIG_REF = \"https://hawkeyexl.github.io/manni/meta/reference/configuration/\";\n\n/**\n * The three keys proposal 0041 moved out of `meta:` and up to the family\n * level, with the sentence that says where each went.\n *\n * Refused rather than aliased: an alias is a permanent second surface for one\n * concept, and the whole point of `collections:` is that the document set is\n * declared **once** for every tool. This is the umbrella's rule for a moved\n * command, applied to a moved key.\n */\nconst MOVED_KEYS: readonly (readonly [string, string])[] = [\n [\n \"paths\",\n `Document sets are declared once for every tool, under a top-level collections: list. See ${CONFIG_REF}#collections`,\n ],\n [\n \"exclude\",\n `Document sets are declared once for every tool, under a top-level collections: list. See ${CONFIG_REF}#collections`,\n ],\n [\n \"sidecars\",\n `It is externalMetadata on a collection, under the top-level collections: list. See ${CONFIG_REF}#external-metadata`,\n ],\n];\n\n/**\n * Refuse a key 0041 moved, in either the wrapped or the unwrapped form.\n *\n * Reads the raw value as a mapping rather than going through\n * `parseConfigDocument`, because it must run *before* the unknown-key check\n * (which would report `paths` as a typo) and before `withSection` (which would\n * rewrite the key into the message's own subject).\n */\nfunction assertNoMovedKeys(raw: unknown, source: string): void {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) return;\n const obj = raw as Record<string, unknown>;\n for (const [key, remedy] of MOVED_KEYS) {\n if (Object.hasOwn(obj, key)) {\n throw new DocmetaError(\n `${source}: \"${key}\" is no longer a meta key. ${remedy}`,\n );\n }\n }\n // `overrides[].name` went the same way, one level down: a collection is the\n // thing that has a name now (0041 supersedes 0027), and an override points\n // at one. Indexed, because a long `overrides:` list needs to say which entry.\n if (!Array.isArray(obj.overrides)) return;\n for (const [i, entry] of obj.overrides.entries()) {\n if (\n typeof entry === \"object\" &&\n entry !== null &&\n !Array.isArray(entry) &&\n Object.hasOwn(entry as Record<string, unknown>, \"name\")\n ) {\n throw new DocmetaError(\n `${source}: overrides[${i}] no longer carries \"name\". Define a collection with that name and point the override at it with collection:.`,\n );\n }\n }\n}\n\n/**\n * A message from a rule that runs outside `parseConfigValue`, with the prefix\n * that parser gives its own. A check in `loadConfig` needs both halves of the\n * family file, so it cannot sit inside the parser, but its message should\n * still name the key the way the reader wrote it: `meta.overrides[0] …`, as\n * the configuration reference documents. A legacy per-tool file has no\n * section, so its message is unchanged.\n */\nfunction inSection(message: string, source: string, section: string | undefined): string {\n return section === undefined ? message : withSection(message, source, section);\n}\n\n/**\n * Refuse an `overrides[].collection` naming a collection nobody declared.\n *\n * Checked here rather than in the section parser because it is the one\n * override rule that needs the *other* half of the family file: `collections:`\n * is a top-level key, parsed by the shared loader, and the section parser\n * never sees it. The message goes through `inSection`, so it reads\n * `meta.overrides[i].collection` like every error the section parser raises\n * (0041 § interface).\n */\nfunction assertOverrideCollections(\n config: DocmetaConfig,\n collections: readonly CollectionConfig[],\n source: string,\n section: string | undefined,\n): void {\n const names = new Set(collections.map((c) => c.name));\n for (const [i, ov] of (config.overrides ?? []).entries()) {\n if (ov.collection === undefined || names.has(ov.collection)) continue;\n const defined =\n collections.length === 0\n ? \"(none)\"\n : collections.map((c) => c.name).join(\", \");\n throw new DocmetaError(\n inSection(\n `${source}: overrides[${i}].collection names \"${ov.collection}\", which collections: does not define. Defined: ${defined}.`,\n source,\n section,\n ),\n );\n }\n}\n\n/**\n * Refuse a `derive.collections` entry naming a collection nobody declared,\n * for the reason `assertOverrideCollections` refuses an override's.\n */\nfunction assertDeriveCollections(\n config: DocmetaConfig,\n collections: readonly CollectionConfig[],\n source: string,\n section: string | undefined,\n): void {\n const names = new Set(collections.map((c) => c.name));\n for (const name of config.derive?.collections ?? []) {\n if (names.has(name)) continue;\n throw new DocmetaError(\n inSection(\n `${source}: derive.collections names \"${name}\", which no collection declares.`,\n source,\n section,\n ),\n );\n }\n}\n\n/** Where a key is owned: the manifest, and its place in the family file. */\nexport interface ManifestOwner {\n /** Index into `collections:`. */\n collection: number;\n /** The collection's name, for a message a person reads. */\n name: string;\n /** Index into that collection's `externalMetadata:`. */\n entry: number;\n /** The manifest's `file`, as the config wrote it. */\n file: string;\n}\n\n/**\n * The URL manifest that owns `key`, if any declared collection has one.\n *\n * Every declared collection counts, not only the ones a run selected: a\n * manifest's `keys:` list is a claim about the key everywhere, not about one\n * run. No manifest is read, because the config's own `keys:` list is the whole\n * claim. A URL manifest with no `keys` (proposal 0068) owns a key only for the\n * pages whose schemas mark it, so it is refused per page when a write reaches\n * it, through `keyHome`.\n */\nexport function urlManifestOwning(\n key: string,\n collections: readonly CollectionConfig[],\n): ManifestOwner | undefined {\n for (const [c, collection] of collections.entries()) {\n for (const [e, manifest] of collection.externalMetadata.entries()) {\n if (manifest.keys?.includes(key) === true && classifyRef(manifest.file).kind === \"url\") {\n return { collection: c, name: collection.name, entry: e, file: manifest.file };\n }\n }\n }\n return undefined;\n}\n\n/**\n * The sentence for a write that would land in a URL manifest (proposal 0047,\n * M6): `derive`, `fill` and `query` all say it the same way.\n */\nexport function urlManifestMessage(key: string, file: string): string {\n return `\"${key}\" is owned by manifest ${file}, which is fetched and cannot be written; set it in that repository.`;\n}\n\n/**\n * Refuse a `derive.fields` entry or a `derive.commands` key that a URL\n * manifest owns (proposal 0047, message M6).\n *\n * A local manifest that owns a managed field is where `derive` writes it,\n * which generalizes 0046's `provenance` exception; a URL manifest is fetched\n * and cannot be written. The rule needs both halves of the family file,\n * `meta.derive` and the top-level `collections:`, so it runs here for the same\n * reason `assertOverrideCollections` does. `manni meta derive --fields` asks\n * `urlManifestOwning` directly, because that flag never passes through here.\n *\n * The message goes through `inSection`, as `assertOverrideCollections` does, so\n * it reads `meta.derive.fields[1]` the way the configuration reference says a\n * `meta:` error reads. Manifests exist only in a family file, so in practice\n * the section is always there.\n */\nfunction assertManagedFieldsUnowned(\n config: DocmetaConfig,\n collections: readonly CollectionConfig[],\n source: string,\n section: string | undefined,\n): void {\n const refuse = (path: string, owner: ManifestOwner): never => {\n const message = `${source}: ${path} is owned by manifest ${owner.file}, which is fetched and cannot be written; set it in that repository.`;\n throw new DocmetaError(\n inSection(message, source, section),\n );\n };\n // Commands first, as the parser reads them: a command's key is where a\n // field outside the built-ins is claimed, so that is the line to name.\n for (const key of Object.keys(config.derive?.commands ?? {})) {\n const owner = urlManifestOwning(key, collections);\n if (owner !== undefined) refuse(`derive.commands.${key}`, owner);\n }\n for (const [i, field] of (config.derive?.fields ?? []).entries()) {\n // Proposal 0046: `provenance` keeps its own refusal, raised where derive\n // places the record, so a reader (`validate`, `get`) still loads.\n if (field === PROVENANCE_FIELD) continue;\n const owner = urlManifestOwning(field, collections);\n if (owner !== undefined) refuse(`derive.fields[${i}] \"${field}\"`, owner);\n }\n}\n\n/**\n * Parse `derive:`.\n *\n * A `derive:` must say something: `fields` to manage, or `sources` or\n * `codeowners` to shape the reads (`get --derived`, the `derived` table). A\n * bare `derive:` reads as configured and is not — the same silence\n * `rejectUnknownKeys` exists to end. When the other keys carry the block,\n * `fields` stays absent, which is the merge-safe default (proposal 0069).\n * `fields: []` manages nothing, so a repository without `gh` can narrow\n * `sources` for its reads without managing a field.\n * A field is refused when it is not derivable (nothing could ever fill it)\n * or repeated. `$schema` falls out of the derivable list, so it never needs a\n * rule of its own there. A field a URL manifest owns is refused as well, by\n * `assertManagedFieldsUnowned` in `loadConfig`, because manifests are declared\n * on the top-level `collections:` this parser never sees.\n *\n * `commands` is parsed before `fields`, because a key of `commands` is what\n * makes a non-built-in field derivable. A command may only derive a field\n * no built-in source claims, and the refusal names the source that does.\n */\nfunction parseDerive(\n raw: unknown,\n source: string,\n): DeriveConfig {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n throw new DocmetaError(\n `${source}: \"derive\" must be a mapping. Write it as \\`derive:\\` with \\`fields:\\` beneath it.`,\n );\n }\n const e = raw as Record<string, unknown>;\n rejectUnknownKeys(e, DERIVE_KEYS, '\"derive\"', source);\n\n if (\n e.fields === undefined &&\n e.sources === undefined &&\n e.codeowners === undefined &&\n e.commands === undefined &&\n e.machines === undefined &&\n e.collections === undefined\n ) {\n throw new DocmetaError(\n `${source}: \"derive\" sets nothing. Give it \\`fields:\\` to manage, \\`commands:\\` to derive from a command, or \\`sources:\\`, \\`codeowners:\\` or \\`machines:\\` to shape the reads.`,\n );\n }\n\n const commands =\n e.commands === undefined ? undefined : parseDeriveCommands(e.commands, source);\n\n if (\n e.fields !== undefined &&\n (!Array.isArray(e.fields) ||\n e.fields.some((f) => typeof f !== \"string\"))\n ) {\n throw new DocmetaError(\n `${source}: derive.fields must be a list of field names. ${DERIVABLE_LIST}`,\n );\n }\n const fields: DerivableField[] = [];\n ((e.fields ?? []) as string[]).forEach((f, i) => {\n if (!isBuiltinField(f) && !(commands !== undefined && Object.hasOwn(commands, f))) {\n throw new DocmetaError(\n `${source}: derive.fields[${i}] \"${f}\" is not derivable. ${DERIVABLE_LIST}`,\n );\n }\n if (fields.includes(f)) {\n throw new DocmetaError(`${source}: derive.fields lists \"${f}\" twice.`);\n }\n fields.push(f);\n });\n const derive: DeriveConfig = e.fields === undefined ? {} : { fields };\n\n if (e.sources !== undefined) {\n if (\n !Array.isArray(e.sources) ||\n e.sources.length === 0 ||\n e.sources.some((s) => typeof s !== \"string\")\n ) {\n throw new DocmetaError(\n `${source}: derive.sources must be a non-empty list of source names. Sources: ${DERIVE_SOURCES.join(\", \")}.`,\n );\n }\n const sources: DeriveSource[] = [];\n (e.sources as string[]).forEach((s, i) => {\n if (!isDeriveSource(s)) {\n throw new DocmetaError(\n `${source}: derive.sources[${i}] \"${s}\" is not a source. Sources: ${DERIVE_SOURCES.join(\", \")}.`,\n );\n }\n if (sources.includes(s)) {\n throw new DocmetaError(`${source}: derive.sources lists \"${s}\" twice.`);\n }\n sources.push(s);\n });\n derive.sources = sources;\n }\n\n if (e.codeowners !== undefined) {\n if (typeof e.codeowners !== \"string\" || e.codeowners.trim() === \"\") {\n throw new DocmetaError(\n `${source}: derive.codeowners must be a non-empty path to a CODEOWNERS file, relative to the config file.`,\n );\n }\n derive.codeowners = e.codeowners;\n }\n\n if (commands !== undefined) derive.commands = commands;\n\n if (e.machines !== undefined) {\n if (\n !Array.isArray(e.machines) ||\n e.machines.length === 0 ||\n e.machines.some((m) => typeof m !== \"string\")\n ) {\n throw new DocmetaError(\n `${source}: derive.machines must be a non-empty list of globs, matched against a trailer's name and its email. Default: [\"*[bot]\"].`,\n );\n }\n const machines: string[] = [];\n (e.machines as string[]).forEach((m, i) => {\n if (m.trim() === \"\") {\n throw new DocmetaError(`${source}: derive.machines[${i}] is blank; a glob must name something.`);\n }\n if (machines.includes(m)) {\n throw new DocmetaError(`${source}: derive.machines lists \"${m}\" twice.`);\n }\n machines.push(m);\n });\n derive.machines = machines;\n }\n\n // Which collections exist is known only to `loadConfig`, which checks each\n // name against the top-level `collections:`.\n if (e.collections !== undefined) {\n const names: unknown[] = Array.isArray(e.collections) ? e.collections : [];\n const valid = names.filter((c): c is string => typeof c === \"string\" && c.trim() !== \"\");\n if (names.length === 0 || valid.length !== names.length) {\n throw new DocmetaError(\n `${source}: derive.collections must be a non-empty list of collection names.`,\n );\n }\n derive.collections = [...new Set(valid)];\n }\n\n return derive;\n}\n\n/**\n * Parse `derive.commands`: a mapping of field name to command. A key is\n * refused when it is empty, `$schema`, or a built-in field (a command may\n * only derive a field no built-in source claims). A key a URL manifest owns\n * is refused too, by `assertManagedFieldsUnowned` in `loadConfig`. Each command\n * carries `run`, the argv with the program first, and an optional `timeout`\n * in seconds.\n */\nfunction parseDeriveCommands(\n raw: unknown,\n source: string,\n): Record<string, DeriveCommandConfig> {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n throw new DocmetaError(\n `${source}: derive.commands must be a mapping of field name to command.`,\n );\n }\n const commands: Record<string, DeriveCommandConfig> = {};\n for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {\n if (key.trim() === \"\") {\n throw new DocmetaError(`${source}: derive.commands has an empty field name.`);\n }\n if (key === FILE_SCHEMA_KEY) {\n throw new DocmetaError(\n `${source}: derive.commands may not derive \"${FILE_SCHEMA_KEY}\" — a command never chooses the schema a document is judged by.`,\n );\n }\n if (isBuiltinField(key)) {\n throw new DocmetaError(\n `${source}: derive.commands.${key} targets a field ${BUILTIN_CLAIMED_BY[key]} already derives; a command may only derive a field no built-in source claims.`,\n );\n }\n // Every command key is a column of the `derived` table beside `_path`\n // and `_sources`, so one spelled like either would be declared twice and\n // SQLite would refuse the table with a raw error, mid-query. Refused\n // here for the reason a collection named `derived` is (see\n // `parseCollections`): a name collision is a config mistake, said at\n // parse time.\n if (DERIVED_TABLE_RESERVED.has(key)) {\n throw new DocmetaError(\n `${source}: derive.commands.${key} collides with a column of the derived table a query builds (${[...DERIVED_TABLE_RESERVED].join(\", \")}). Pick another field name.`,\n );\n }\n\n const where = `derive.commands.${key}`;\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new DocmetaError(\n `${source}: ${where} must be a mapping with \\`run:\\` beneath it.`,\n );\n }\n const c = value as Record<string, unknown>;\n rejectUnknownKeys(c, DERIVE_COMMAND_KEYS, where, source);\n\n if (!Array.isArray(c.run) || c.run.length === 0) {\n throw new DocmetaError(\n `${source}: ${where}.run must be a non-empty list of strings, the program first.`,\n );\n }\n const run: string[] = [];\n (c.run as unknown[]).forEach((arg, j) => {\n if (typeof arg !== \"string\" || arg.trim() === \"\") {\n throw new DocmetaError(`${source}: ${where}.run[${j}] must be a non-empty string.`);\n }\n run.push(arg);\n });\n const command: DeriveCommandConfig = { run };\n\n if (c.timeout !== undefined) {\n // Whole seconds, because the reference says so and because a fraction\n // reads as a budget while acting as a kill switch: `timeout: 0.001` is\n // a 1 ms allowance that ends every spawn before it can answer.\n if (typeof c.timeout !== \"number\" || !Number.isInteger(c.timeout) || c.timeout <= 0) {\n throw new DocmetaError(\n `${source}: ${where}.timeout must be a whole number of seconds, greater than zero.`,\n );\n }\n command.timeout = c.timeout;\n }\n commands[key] = command;\n }\n return commands;\n}\n\nfunction parseConfigDocument(raw: unknown, source: string): DocmetaConfig {\n if (raw == null) return {};\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw new DocmetaError(`${source}: top level must be a mapping.`);\n }\n const obj = raw as Record<string, unknown>;\n rejectUnknownKeys(obj, CONFIG_KEYS, \"the top level\", source);\n const config: DocmetaConfig = {};\n\n if (obj.schemas !== undefined)\n config.schemas = asSchemaList(obj.schemas, \"schemas\", source);\n\n if (obj.defaults !== undefined) {\n if (typeof obj.defaults !== \"boolean\") {\n throw new DocmetaError(`${source}: defaults must be true or false.`);\n }\n config.defaults = obj.defaults;\n }\n\n if (obj.strict !== undefined) {\n if (typeof obj.strict !== \"boolean\") {\n throw new DocmetaError(`${source}: strict must be true or false.`);\n }\n config.strict = obj.strict;\n }\n\n // The files are read by `loadConfig`, which knows the config's directory.\n if (obj.register !== undefined) {\n const register = asStringList(obj.register, \"register\", source);\n register.forEach((entry, i) => {\n if (entry.trim() === \"\") {\n throw new DocmetaError(\n `${source}: register[${i}] must be a non-empty path to a schema file or a directory.`,\n );\n }\n });\n config.register = register;\n }\n\n if (obj.overrides !== undefined) {\n if (!Array.isArray(obj.overrides)) {\n throw new DocmetaError(`${source}: \"overrides\" must be a list.`);\n }\n config.overrides = obj.overrides.map((entry, i) => {\n if (typeof entry !== \"object\" || entry === null) {\n throw new DocmetaError(`${source}: overrides[${i}] must be a mapping.`);\n }\n const e = entry as Record<string, unknown>;\n // Before the field checks, so a misspelling is reported as the typo it\n // is. `schemass:` beside a correct `schemas:` was dropped in silence and\n // the run passed — the false green this whole check exists to end, in the\n // one section it had not reached. Alone, it produced `\"overrides[0].\n // schemas\" must be a list of strings`, blaming the key that is missing\n // rather than the one that is wrong.\n rejectUnknownKeys(e, OVERRIDE_KEYS, `overrides[${i}]`, source);\n // Exactly one of the two ways to say which files an override governs\n // (0041 rule 8). Both would need a rule for how they combine, and\n // neither is a rule that governs nothing — the same reads-as-configured\n // silence the no-effect refusal below exists to end.\n const hasFiles = e.files !== undefined;\n const hasCollection = e.collection !== undefined;\n if (hasFiles === hasCollection) {\n throw new DocmetaError(\n `${source}: overrides[${i}] must carry exactly one of \"files\" or \"collection\".`,\n );\n }\n const files = hasFiles\n ? asFileGlobs(e.files, `overrides[${i}].files`, source)\n : undefined;\n let collection: string | undefined;\n if (hasCollection) {\n if (typeof e.collection !== \"string\" || e.collection.trim() === \"\") {\n throw new DocmetaError(\n `${source}: overrides[${i}].collection must be a non-empty string naming a collection.`,\n );\n }\n collection = e.collection;\n }\n const schemas =\n e.schemas === undefined\n ? []\n : asStringList(e.schemas, `overrides[${i}].schemas`, source);\n const elements =\n e.elements === undefined\n ? undefined\n : asElementPaths(e.elements, `overrides[${i}].elements`, source);\n // An override naming neither is a rule that does nothing, which reads as\n // configured and is not — the same silence `rejectUnknownKeys` exists to\n // end, one level down.\n if (schemas.length === 0 && (elements === undefined || elements.length === 0)) {\n throw new DocmetaError(\n `${source}: overrides[${i}] sets neither \"schemas\" nor \"elements\", so it has no effect.`,\n );\n }\n for (const key of [\"defaults\", \"strict\"] as const) {\n if (e[key] !== undefined && typeof e[key] !== \"boolean\") {\n throw new DocmetaError(\n `${source}: overrides[${i}].${key} must be true or false.`,\n );\n }\n }\n // Both shape the entry's schema set, so on an entry with none, one that\n // only adds `elements`, they would switch nothing.\n const setKeys = ([\"defaults\", \"strict\"] as const).filter((key) => e[key] !== undefined);\n if (schemas.length === 0 && setKeys.length > 0) {\n const one = setKeys.length === 1 ? setKeys[0] : undefined;\n throw new DocmetaError(\n one !== undefined\n ? `${source}: overrides[${i}] sets ${one}, which applies to the entry's schemas. Add schemas, or remove ${one}.`\n : `${source}: overrides[${i}] sets defaults and strict, which apply to the entry's schemas. Add schemas, or remove them.`,\n );\n }\n // Whether `collection` names a *declared* collection is checked by\n // `loadConfig`, the first place both halves of the family file are\n // known. Every view-name refusal 0027 made here — blank, `docs`,\n // `sqlite_`, duplicate — now lives in `parseCollections`, beside the\n // name it belongs to.\n return {\n ...(files !== undefined ? { files } : {}),\n ...(collection !== undefined ? { collection } : {}),\n schemas,\n ...(elements ? { elements } : {}),\n ...(typeof e.defaults === \"boolean\" ? { defaults: e.defaults } : {}),\n ...(typeof e.strict === \"boolean\" ? { strict: e.strict } : {}),\n };\n });\n }\n\n if (obj.checks !== undefined) {\n config.checks = parseChecks(obj.checks, source);\n }\n\n // Whether a managed field is a key some manifest owns is checked by\n // `loadConfig`, beside the override collections: manifests are declared on\n // the top-level `collections:`, which this parser never sees.\n if (obj.derive !== undefined) {\n config.derive = parseDerive(obj.derive, source);\n }\n\n if (obj.elements !== undefined) {\n config.elements = asElementPaths(obj.elements, \"elements\", source);\n }\n\n if (obj.baseline !== undefined) {\n if (typeof obj.baseline !== \"string\" || obj.baseline.trim() === \"\") {\n throw new DocmetaError(\n `${source}: \"baseline\" must be a path to a baseline file.`,\n );\n }\n config.baseline = obj.baseline;\n }\n\n if (obj.allowEmpty !== undefined) {\n if (typeof obj.allowEmpty !== \"boolean\") {\n throw new DocmetaError(`${source}: \"allowEmpty\" must be a boolean.`);\n }\n config.allowEmpty = obj.allowEmpty;\n }\n\n if (obj.respectGitignore !== undefined) {\n if (typeof obj.respectGitignore !== \"boolean\") {\n throw new DocmetaError(`${source}: \"respectGitignore\" must be a boolean.`);\n }\n config.respectGitignore = obj.respectGitignore;\n }\n\n if (obj.offline !== undefined) {\n if (typeof obj.offline !== \"boolean\") {\n throw new DocmetaError(`${source}: \"offline\" must be a boolean.`);\n }\n config.offline = obj.offline;\n }\n\n if (obj.schemaCache !== undefined) {\n config.schemaCache = parseSchemaCache(obj.schemaCache, source);\n }\n\n if (obj.schemaTrust !== undefined) {\n config.schemaTrust = parseSchemaTrust(obj.schemaTrust, source);\n }\n\n if (obj.fill !== undefined) config.fill = parseFill(obj.fill, source);\n\n return config;\n}\n\n/**\n * Parse the `checks:` list with the same shape discipline `overrides:` has:\n * array guard, per-entry mapping guard, unknown keys rejected before the field\n * checks (so a `querry:` typo is reported as the typo it is), and a missing\n * `name` or `query` refused by index.\n */\nfunction parseChecks(value: unknown, source: string): CheckConfig[] {\n if (!Array.isArray(value)) {\n throw new DocmetaError(`${source}: \"checks\" must be a list.`);\n }\n const seen = new Set<string>();\n return value.map((entry, i) => {\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) {\n throw new DocmetaError(\n `${source}: checks[${i}] must be a mapping with \"name\" and \"query\".`,\n );\n }\n const e = entry as Record<string, unknown>;\n rejectUnknownKeys(e, CHECK_KEYS, `checks[${i}]`, source);\n if (typeof e.name !== \"string\" || e.name === \"\") {\n throw new DocmetaError(\n `${source}: checks[${i}].name must be a non-empty string.`,\n );\n }\n // The grammar is baseline identity — see CHECK_NAME. The `.json` tail is\n // excluded separately because BUILTIN_ID excludes it: `check:slugs.json`\n // would classify as a file path.\n if (!CHECK_NAME.test(e.name) || e.name.toLowerCase().endsWith(\".json\")) {\n throw new DocmetaError(\n `${source}: checks[${i}].name \"${e.name}\" must match [a-z0-9][a-z0-9._-]* and not end in \".json\" — the name is part of each finding's identity (check:<name>).`,\n );\n }\n const reserved = RESERVED_CHECK_NAMES.get(e.name);\n if (reserved !== undefined) {\n throw new DocmetaError(\n `${source}: checks[${i}].name \"${e.name}\" is reserved — ${reserved}. Pick another name.`,\n );\n }\n // Two checks sharing a name would share every finding's identity, so the\n // baseline could not tell their findings apart.\n if (seen.has(e.name)) {\n throw new DocmetaError(\n `${source}: checks[${i}] reuses the name \"${e.name}\"; check names must be unique.`,\n );\n }\n seen.add(e.name);\n if (typeof e.query !== \"string\" || e.query.trim() === \"\") {\n throw new DocmetaError(\n `${source}: checks[${i}].query must be a non-empty SQL statement.`,\n );\n }\n return { name: e.name, query: e.query };\n });\n}\n\nfunction parseSchemaCache(value: unknown, source: string): SchemaCacheConfig {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new DocmetaError(`${source}: \"schemaCache\" must be a mapping.`);\n }\n const raw = value as Record<string, unknown>;\n rejectUnknownKeys(raw, SCHEMA_CACHE_KEYS, '\"schemaCache\"', source);\n const schemaCache: SchemaCacheConfig = {};\n\n const ttl = raw.ttlHours;\n if (ttl !== undefined) {\n // A YAML `1e999` parses to Infinity, and a bare range check would accept\n // it. A negative TTL is worse than useless: every entry would read as\n // stale, so the cache would silently do nothing at all.\n //\n // The upper bound is not tidiness. Freshness compares against\n // `ttlHours * 3_600_000`, and a finite-but-huge value overflows that\n // product to Infinity, so `elapsed >= Infinity` is never true and every\n // entry is served forever — a cache that silently stops expiring, which is\n // the opposite of what a TTL is for. One year is well past any real\n // setting, and anyone wanting \"never expire\" has a clearer way to say it.\n if (\n typeof ttl !== \"number\" ||\n !Number.isFinite(ttl) ||\n ttl < 0 ||\n ttl > MAX_TTL_HOURS\n ) {\n throw new DocmetaError(\n `${source}: \"schemaCache.ttlHours\" must be a number of hours between 0 and ${MAX_TTL_HOURS} (0 disables the cache).`,\n );\n }\n schemaCache.ttlHours = ttl;\n }\n\n return schemaCache;\n}\n\n/**\n * Parse `schemaTrust:`, shaped after `parseSchemaCache` — a nested mapping with\n * every key optional, so an absent one leaves the default in exactly one place.\n *\n * Unknown nested keys are rejected the way a `schemas:` mapping entry rejects\n * them, and for the same reason: a misspelled `documentRef:` would otherwise be\n * dropped in silence, leaving a repo that reads as guarded and is not. A\n * misspelled `schemaTrust:` is now rejected too — `parseConfig` checks the top\n * level against `CONFIG_KEYS` rather than walking only the keys it knows. What\n * remains, and cannot be fixed here, is an *older* docmeta reading a config\n * written for a newer one: it has never heard of the key and ignores it. See\n * the version-floor note in the configuration reference.\n */\nfunction parseSchemaTrust(value: unknown, source: string): SchemaTrustConfig {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new DocmetaError(\n `${source}: \"schemaTrust\" must be a mapping. Write it as \\`schemaTrust:\\` with \\`documentRefs:\\` and optionally \\`hosts:\\` beneath it.`,\n );\n }\n const raw = value as Record<string, unknown>;\n rejectUnknownKeys(raw, SCHEMA_TRUST_KEYS, '\"schemaTrust\"', source);\n const schemaTrust: SchemaTrustConfig = {};\n\n const mode = raw.documentRefs;\n if (mode !== undefined) {\n if (\n typeof mode !== \"string\" ||\n !(DOCUMENT_REF_TRUST as readonly string[]).includes(mode)\n ) {\n throw new DocmetaError(\n `${source}: \"schemaTrust.documentRefs\" must be one of: ${DOCUMENT_REF_TRUST.join(\", \")}. Use \\`documentRefs: any\\` for today's behavior, \\`local\\` to refuse a URL a document names, or \\`none\\` to let the config decide alone.`,\n );\n }\n schemaTrust.documentRefs = mode as DocumentRefTrust;\n }\n\n const hosts = raw.hosts;\n if (hosts !== undefined) {\n if (\n !Array.isArray(hosts) ||\n hosts.some((h) => typeof h !== \"string\" || h.trim() === \"\")\n ) {\n throw new DocmetaError(\n `${source}: \"schemaTrust.hosts\" must be a list of host names, such as \"schemas.example.com\". Remove the key to allow any host.`,\n );\n }\n schemaTrust.hosts = hosts as string[];\n }\n\n return schemaTrust;\n}\n\nfunction parseFill(value: unknown, source: string): FillConfig {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new DocmetaError(`${source}: \"fill\" must be a mapping.`);\n }\n const raw = value as Record<string, unknown>;\n rejectUnknownKeys(raw, FILL_KEYS, '\"fill\"', source);\n const fill: FillConfig = {};\n\n const asString = (key: \"provider\" | \"model\"): void => {\n const v = raw[key];\n if (v === undefined) return;\n if (typeof v !== \"string\") {\n throw new DocmetaError(`${source}: \"fill.${key}\" must be a string.`);\n }\n fill[key] = v;\n };\n asString(\"provider\");\n asString(\"model\");\n\n const asNumber = (\n key: \"confidenceThreshold\" | \"maxTurns\" | \"chunkChars\" | \"concurrency\",\n min: number,\n max: number,\n integer = false,\n ): void => {\n const v = raw[key];\n if (v === undefined) return;\n // A YAML `1e999` parses to Infinity, and a bare range check would accept\n // it, so require a finite number explicitly.\n if (typeof v !== \"number\" || !Number.isFinite(v) || v < min || v > max) {\n throw new DocmetaError(\n `${source}: \"fill.${key}\" must be a number between ${min} and ${max}.`,\n );\n }\n // A fractional worker count would be silently truncated downstream rather\n // than rejected, so catch it where the user can see the mistake.\n if (integer && !Number.isInteger(v)) {\n throw new DocmetaError(\n `${source}: \"fill.${key}\" must be a whole number.`,\n );\n }\n fill[key] = v;\n };\n asNumber(\"confidenceThreshold\", 0, 1);\n asNumber(\"maxTurns\", 1, Number.MAX_SAFE_INTEGER, true);\n asNumber(\"chunkChars\", 1, Number.MAX_SAFE_INTEGER, true);\n asNumber(\"concurrency\", 1, 64, true);\n\n return fill;\n}\n\nexport interface LoadedConfig {\n config: DocmetaConfig;\n /** Absolute path to the file the config was read from. */\n path: string;\n /**\n * Directory holding that file. Relative paths written *in* the config — a\n * collection's `paths:`, local-file schema refs — are meaningful relative to\n * this, not to the directory the command happened to be invoked from.\n */\n dir: string;\n /**\n * The file as the user would name it, which is how every config message\n * spells it. Threaded from `ConfigFile.source` so `selectCollections` can\n * name the file a `--collection` failed to find a collection in.\n */\n source: string;\n /**\n * The family-file key the config was read from under (`\"meta\"`), when it\n * was. Absent for a pre-family file, whose top level is the config. A\n * command that writes the file back (`schemas vendor`) needs to know.\n */\n section?: string;\n /**\n * Every collection the family file declares (proposal 0041), in declaration\n * order. `[]` for a legacy per-tool file, which carries no family-wide keys.\n */\n collections: CollectionConfig[];\n /**\n * The family file's top-level `encryptionKey:` (proposal 0045), when it has\n * one. `MANNI_ENCRYPTION_KEY` wins over it: read the run's key through\n * `resolveEncryptionKey`, never from here directly.\n */\n encryptionKey?: string;\n /**\n * The file itself, as family discovery found it. What a write that needs a\n * key hands `ensureEncryptionKey`, so the key lands in the file that\n * governs the run.\n */\n configFile?: ConfigFile;\n}\n\n// The project boundary lives with the family config discovery now; the SARIF\n// reporter still imports it from here.\nexport { findGitRoot };\n\n/**\n * The directory a **document-supplied** local schema path must stay inside.\n *\n * The git root rather than the config's directory, so a monorepo package whose\n * documents reference `../shared/x.json` keeps working — that path is still\n * inside the repository, which is what \"a schema in this project\" means.\n *\n * `source` is not decoration, and it has **three** values rather than a\n * boolean: with no repository the boundary falls back to the config's\n * directory, and with no config either it falls back to the run's `cwd`. Those\n * are progressively narrower and less obvious rules, and the refusal message\n * has to name the one it actually applied — telling someone with no config file\n * that \"the config's own directory is the boundary\" sends them looking for a\n * file that is not there.\n *\n * Same reasoning as `SARIF_NO_GIT_ROOT`: \"there is no repository\" and \"the\n * repository root is where you are standing\" must stay distinguishable.\n */\nexport interface SchemaTrustRoot {\n /** Absolute directory the path must resolve inside. */\n dir: string;\n /** Which rule produced `dir`, so a refusal can name it accurately. */\n source: \"git\" | \"config\" | \"cwd\";\n}\n\n/** Settle the containment root once per run, for `resolveSchemaSet`. */\nexport function schemaTrustRoot(\n cwd: string,\n configDir?: string,\n): SchemaTrustRoot {\n const git = findGitRoot(cwd);\n if (git !== null) return { dir: git, source: \"git\" };\n if (configDir !== undefined) return { dir: resolve(configDir), source: \"config\" };\n return { dir: resolve(cwd), source: \"cwd\" };\n}\n\n/**\n * Load config from an explicit path (error if missing) or by discovery.\n *\n * Discovery checks cwd and then each ancestor up to and including the nearest\n * `.git` boundary. Within a directory the order is the family file\n * (`manni.config.yaml`, then `.yml`, read at its `meta:` key), then\n * `docmeta.config.yaml` and `.yml` whole. The **first file found wins** and\n * the walk stops there — ancestor configs are never merged, because\n * `schemas:` is a set a file must satisfy in full and `overrides:` is\n * first-match-wins ordered, so a partial merge would silently redefine what\n * \"the contract\" means. See src/shared/config-file.ts\n * for the rest of the rules, the deprecation warnings included.\n *\n * Returns null when no config is found via discovery.\n */\nexport async function loadConfig(\n explicitPath?: string,\n cwd: string = process.cwd(),\n): Promise<LoadedConfig | null> {\n const file = explicitPath\n ? await readConfigFile(explicitPath, cwd, CONFIG_FILE)\n : await findConfigFile(cwd, CONFIG_FILE);\n if (file === null) return null;\n return loadedFrom(file);\n}\n\n/**\n * `loadConfig` for a sibling tool that reads meta's section of a file it was\n * pointed at (proposal 0074). An explicit path whose document is no family\n * file is that tool's own section, not meta's, so it governs nothing here and\n * the result is `null`. Discovery is `loadConfig`'s own.\n */\nexport async function loadMetaSection(\n explicitPath?: string,\n cwd: string = process.cwd(),\n): Promise<LoadedConfig | null> {\n if (explicitPath === undefined) return loadConfig(undefined, cwd);\n const file = await readConfigFile(explicitPath, cwd, CONFIG_FILE);\n return file.wrapped ? loadedFrom(file) : null;\n}\n\nasync function loadedFrom(file: ConfigFile): Promise<LoadedConfig> {\n const section = file.wrapped ? META_SECTION : undefined;\n const config = parseConfigValue(file.value, file.source, section);\n assertOverrideCollections(config, file.collections, file.source, section);\n assertManagedFieldsUnowned(config, file.collections, file.source, section);\n assertDeriveCollections(config, file.collections, file.source, section);\n if (config.register !== undefined) {\n try {\n config.registered = await loadRegisteredSchemas(config.register, file.dir);\n } catch (err) {\n if (!(err instanceof DocmetaError)) throw err;\n throw new DocmetaError(\n inSection(`${file.source}: ${err.message}`, file.source, section),\n );\n }\n }\n return {\n config,\n path: file.path,\n dir: file.dir,\n source: file.source,\n collections: file.collections,\n ...(section !== undefined ? { section } : {}),\n ...(file.encryptionKey !== undefined ? { encryptionKey: file.encryptionKey } : {}),\n configFile: file,\n };\n}\n\n/** Told to a caller once, when a run turns out to be governed by a config. */\nexport interface ConfigNotice {\n /** Absolute path to the config file. */\n path: string;\n /** Directory holding it. */\n dir: string;\n}\n\nexport interface RunConfigOptions {\n /** Defaults to `process.cwd()`, matching `loadConfig`. */\n cwd?: string;\n /** `-c/--config`. */\n configPath?: string;\n /** `--no-config`: skip discovery and run on the built-in defaults. */\n noConfig?: boolean;\n /**\n * Positional inputs; empty means fall back to the configured collections'\n * `paths:` (proposal 0041). The stdin token `-` cancels that implicit\n * fallback like any other input, but never an explicit `--collection`:\n * stdin is no path, so it rides beside the flag and the named collection is\n * still resolved.\n */\n inputs: string[];\n /**\n * `--collection <name>`, repeatable: the collections this run covers. Empty\n * or absent means every declared collection — the same thing, because\n * commander's repeatable collector hands a caller `[]` when the flag was\n * never passed (see `selectCollections`).\n */\n collections?: string[];\n onConfigLoaded?: (info: ConfigNotice) => void;\n}\n\n/**\n * The stdin token, `load-files.ts`'s `STDIN_TOKEN`, repeated as a literal so\n * this module does not depend on the file loader it sits below. It is the one\n * input allowed beside `--collection`: stdin is not a path, so it says nothing\n * about which collections the run covers.\n */\nconst STDIN_TOKEN_LITERAL = \"-\";\n\nexport interface RunConfig {\n /** The config, with its local file schema refs already rebased. */\n config: DocmetaConfig | null;\n /**\n * What to resolve: the positional inputs, or the selected collections'\n * `paths:` concatenated in declaration order — with the stdin token, when\n * `--collection` put both in one run, kept at the front.\n */\n inputs: string[];\n /**\n * Directory those inputs — and so every resolved file path, and every file\n * read — are relative to.\n *\n * A run uses *either* positional paths *or* the collections' `paths:`, never\n * both, so there is exactly one base per run and no ambiguity about which it\n * is. Positional paths are typed by a person standing in a shell, so they\n * stay relative to the working directory; a collection's globs were written\n * next to the config, so they resolve from there. Stdin decides nothing\n * here: it is no path, so it needs no base of its own, and a `-` beside\n * `--collection` leaves the base to the collections.\n */\n base: string;\n /**\n * Directory holding the config that governed the run, when one did.\n *\n * Distinct from `base`: `base` follows *the inputs*, so it is the working\n * directory whenever positional paths were given. Anything written **in** the\n * config — the `baseline:` path — is relative to the config itself no matter\n * where the command was run from, which is the whole point of discovering an\n * ancestor config in the first place.\n */\n configDir?: string;\n /**\n * Absolute path of the config file itself, when one governs the run. The\n * one honest way to edit the governing config: discovery accepts both\n * `docmeta.config.yaml` and `.yml`, `-c` accepts any name, and the file may\n * live in an ancestor — so re-deriving the path from a directory plus an\n * assumed filename names the wrong file in every one of those setups.\n */\n configPath?: string;\n /**\n * The key the tool's config sits under in that file — `meta` for a family\n * file, `undefined` for a legacy per-tool file whose whole document is the\n * section.\n *\n * Anything that *rewrites* the config by hand has to know: `schemas:` is at\n * the top level of a legacy file and one level down in a family file, so a\n * rewriter that assumes the top level silently finds nothing in the shape\n * proposal 0033 made the default. `query`'s DDL repointing did exactly that\n * until the 0041 fixtures stopped being legacy files and made it visible.\n */\n configSection?: string;\n /**\n * The collections this run covers (proposal 0041): every declared one, or\n * the ones `--collection` named. `[]` when no config governs the run.\n *\n * Selected even when the inputs are positional, because membership is what\n * external metadata attaches to (rule 4) and a file the operator typed is\n * still a member of whatever collections contain it.\n */\n collections: CollectionConfig[];\n /**\n * Every collection the config declares, in declaration order — the same list\n * `collections` narrows. `query` needs both: membership and manifests follow\n * the *selected* set, while every *declared* collection is a SQL view (0041\n * rule 11), so a statement naming one the run did not select still answers.\n */\n declaredCollections: CollectionConfig[];\n /**\n * Whether the collections supplied `inputs` rather than the command line.\n * The corpus invariant every scoped check reads: a positional path means the\n * operator chose part of the corpus. True whenever `--collection` named one,\n * stdin beside it included.\n */\n fromCollections: boolean;\n /**\n * The governing config file, when one governs the run: what the run's\n * encryption key resolves from (proposal 0045), with `MANNI_ENCRYPTION_KEY`\n * winning over it, and where a write that needs a key writes one.\n */\n configFile?: ConfigFile;\n}\n\n/**\n * Settle the three things every command core needs from config before it can\n * touch the filesystem: which config governs the run, what to resolve, and\n * what those relative paths are relative to.\n */\nexport async function resolveRunConfig(\n opts: RunConfigOptions,\n): Promise<RunConfig> {\n // `--no-config` wins over an explicit path. The CLI cannot supply both (they\n // are one commander option), but the cores are public API.\n const cwd = opts.cwd ?? process.cwd();\n\n // `--collection` names something only a config can define, and it selects a\n // set the operator did not type — so it composes with neither positional\n // paths nor `--no-config`. Both refusals come before discovery, so the\n // message is about the flags rather than about whatever the walk found.\n const wanted = opts.collections ?? [];\n // The paths the operator actually typed. Stdin is not one of them, which is\n // what lets a `-` ride beside the flag instead of being refused as a path.\n const typedInputs = opts.inputs.filter((i) => i !== STDIN_TOKEN_LITERAL);\n if (wanted.length > 0 && typedInputs.length > 0) {\n throw new DocmetaError(\n \"--collection selects a configured collection; it cannot be combined with paths.\",\n );\n }\n\n const loaded = opts.noConfig ? null : await loadConfig(opts.configPath, cwd);\n if (wanted.length > 0 && loaded === null) {\n throw new DocmetaError(\"--collection needs a config file to select from.\");\n }\n if (loaded) opts.onConfigLoaded?.({ path: loaded.path, dir: loaded.dir });\n\n const config = loaded\n ? rebaseConfigSchemaRefs(loaded.config, loaded.dir, cwd)\n : null;\n\n // Selected whatever the inputs are: a positional file is still a member of\n // the collections that contain it, so its manifests have to be loadable.\n const collections = loaded\n ? selectCollections(\n loaded.collections,\n opts.collections,\n loaded.source,\n (message) => new DocmetaError(message),\n )\n : [];\n\n // `--collection` is a request, and a run has to honour it: the flag names a\n // collection, so the collection's files are resolved even when stdin rides\n // beside it. Counting `-` as a path made `validate - --as markdown\n // --collection guides` check stdin, open no file of the collection, print no\n // warning and exit 0 — a green run that checked nothing the flag named.\n //\n // The *implicit* fallback is not a request, and a lone `-` cancels it as\n // before. A piped document is a run of its own: it has no history to derive\n // from and is a member of nothing, so pulling the whole configured corpus in\n // beside it would be a surprise rather than a service.\n const fromCollections = wanted.length > 0 || opts.inputs.length === 0;\n const collectionPaths = fromCollections\n ? collections.flatMap((c) => c.paths)\n : [];\n // Stdin keeps its typed position; the collections' globs follow it in\n // declaration order.\n const inputs = fromCollections\n ? [...opts.inputs, ...collectionPaths]\n : opts.inputs;\n // One base per run, and only a *path* needs one: the base follows the\n // collections' globs when they contributed, and stays at the working\n // directory otherwise — including for a run whose only input is stdin.\n const base = collectionPaths.length > 0 && loaded ? loaded.dir : cwd;\n\n return {\n config,\n inputs,\n base,\n collections,\n declaredCollections: loaded ? [...loaded.collections] : [],\n fromCollections,\n ...(loaded\n ? {\n configDir: loaded.dir,\n configPath: loaded.path,\n ...(loaded.section === undefined ? {} : { configSection: loaded.section }),\n ...(loaded.configFile === undefined ? {} : { configFile: loaded.configFile }),\n }\n : {}),\n };\n}\n","/**\n * `meta.register` (proposal 0070): local JSON Schema files a config names by\n * path, loaded once when the config loads and referred to everywhere after\n * by their own `$id`, as a built-in is referred to by its id.\n *\n * Every refusal here is a config error. The messages carry no `<source>: `\n * prefix; `loadConfig` adds it, and the `meta.` section with it.\n */\nimport { readFile, readdir, stat } from \"node:fs/promises\";\nimport type { Stats } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport { DocmetaError } from \"../types.js\";\nimport { warn } from \"../../shared/warn.js\";\nimport { stripBom } from \"./json-text.js\";\nimport {\n isBuiltinId,\n isPublishedBuiltinUrl,\n type RegisteredSchema,\n} from \"./schema-registry.js\";\n\n/**\n * Vendors a registered id may not use: `manni` is the house vocabularies'\n * vendor, and the other four are finding identities that share the built-in\n * id namespace (see `assertPublishableBuiltinId`).\n */\nexport const RESERVED_VENDORS: readonly string[] = [\n \"manni\",\n \"check\",\n \"external\",\n \"encrypted\",\n \"derived\",\n];\n\n/**\n * `vendor:name:version`, each segment the built-in id grammar allows.\n * Case-insensitive to match `BUILTIN_ID` in `schema-registry.ts`, so every\n * three-segment id `classifyRef` reads as an id can be registered. Ids still\n * resolve by exact string, as built-in ids do, and the reserved-vendor check\n * lowercases the vendor, so `Manni:` is refused like `manni:`.\n */\nconst REGISTERED_ID = /^[a-z0-9][a-z0-9._-]*:[a-z0-9][a-z0-9._-]*:[a-z0-9][a-z0-9._-]*$/i;\n\n/** Is `id` one of the two shapes a registered schema's `$id` may take? */\nfunction isRegistrableId(id: string): boolean {\n if (/^https:\\/\\//i.test(id)) {\n try {\n new URL(id);\n return true;\n } catch {\n return false;\n }\n }\n return REGISTERED_ID.test(id) && !id.toLowerCase().endsWith(\".json\");\n}\n\n/**\n * Every `*.json` file under `dir`, recursively, in a stable order.\n *\n * A symlink is followed to a file, as the top-level `stat` in\n * `loadRegisteredSchemas` follows one, so a directory of linked schemas\n * registers them. A symlink to a directory is not descended, so a link cycle\n * cannot loop the walk; it is named on stderr, so its schemas are not missed\n * in silence.\n */\nasync function jsonFilesUnder(dir: string, configDir: string): Promise<string[]> {\n const out: string[] = [];\n const entries = await readdir(dir, { withFileTypes: true });\n entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));\n for (const entry of entries) {\n const path = join(dir, entry.name);\n if (entry.isDirectory()) out.push(...(await jsonFilesUnder(path, configDir)));\n else if (entry.isSymbolicLink() && (await isDirectoryTarget(path))) {\n warn(`meta.register: ${shown(configDir, path)} is a symlink to a directory, which is not followed.`);\n } else if (!entry.name.toLowerCase().endsWith(\".json\")) continue;\n else if (entry.isFile() || (entry.isSymbolicLink() && (await isFileTarget(path)))) {\n out.push(path);\n }\n }\n return out;\n}\n\n/** Does the symlink at `path` resolve to a directory? A dangling link does not. */\nasync function isDirectoryTarget(path: string): Promise<boolean> {\n try {\n return (await stat(path)).isDirectory();\n } catch {\n return false;\n }\n}\n\n/** Does the symlink at `path` resolve to a file? A dangling link does not. */\nasync function isFileTarget(path: string): Promise<boolean> {\n try {\n return (await stat(path)).isFile();\n } catch {\n return false;\n }\n}\n\n/** A path relative to the config's directory, with forward slashes. */\nfunction shown(configDir: string, path: string): string {\n return relative(configDir, path).split(sep).join(\"/\");\n}\n\n/**\n * Load every schema `register` names, relative to `configDir`.\n *\n * A directory registers each `*.json` beneath it. A file named twice, once\n * directly and once through its directory, registers once; two different\n * files claiming one `$id` are refused.\n */\nexport async function loadRegisteredSchemas(\n register: readonly string[],\n configDir: string,\n): Promise<Map<string, RegisteredSchema>> {\n const files: string[] = [];\n for (const [i, entry] of register.entries()) {\n const path = resolve(configDir, entry);\n let entryStats: Stats;\n try {\n entryStats = await stat(path);\n } catch {\n throw new DocmetaError(`register[${i}] names ${entry}, which does not exist.`);\n }\n // A pipe, socket or device would reach `readFile`, and a FIFO blocks it.\n if (!entryStats.isDirectory() && !entryStats.isFile()) {\n throw new DocmetaError(\n `register[${i}] names ${entry}, which is not a file or a directory.`,\n );\n }\n if (!entryStats.isDirectory()) {\n files.push(path);\n continue;\n }\n const found = await jsonFilesUnder(path, configDir);\n if (found.length === 0) {\n throw new DocmetaError(`register[${i}] names a directory with no .json files.`);\n }\n files.push(...found);\n }\n\n const registered = new Map<string, RegisteredSchema>();\n const seen = new Set<string>();\n for (const path of files) {\n if (seen.has(path)) continue;\n seen.add(path);\n const file = shown(configDir, path);\n let parsed: unknown;\n try {\n parsed = JSON.parse(stripBom(await readFile(path, \"utf8\")));\n } catch {\n throw new DocmetaError(`register: ${file} is not valid JSON.`);\n }\n const schema =\n typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : undefined;\n const id = schema?.[\"$id\"];\n if (schema === undefined || typeof id !== \"string\" || id.trim() === \"\") {\n throw new DocmetaError(\n `register: ${file} has no $id. A registered schema is named by its $id.`,\n );\n }\n if (!isRegistrableId(id)) {\n throw new DocmetaError(\n `register: ${file}'s $id \"${id}\" is neither vendor:name:version nor an https URL.`,\n );\n }\n if (isBuiltinId(id) || isPublishedBuiltinUrl(id)) {\n throw new DocmetaError(`register: ${file} registers \"${id}\", which is a built-in id.`);\n }\n const vendor = /^https:/i.test(id) ? undefined : id.split(\":\")[0]?.toLowerCase();\n if (vendor !== undefined && RESERVED_VENDORS.includes(vendor)) {\n throw new DocmetaError(\n `register: ${file} registers \"${id}\" under the reserved \"${vendor}\" vendor.`,\n );\n }\n const earlier = registered.get(id);\n if (earlier !== undefined) {\n throw new DocmetaError(\n `register: ${earlier.file} and ${file} both register \"${id}\".`,\n );\n }\n registered.set(id, { id, file, path, schema });\n }\n return registered;\n}\n","/**\n * The validation baseline — a ratchet.\n *\n * A baseline records today's violations so a run can fail on *new* ones only.\n * That is what lets a team make a field `required` on a Monday instead of after\n * a 1,200-file cleanup: the standard tightens immediately, the backlog is\n * recorded, and nothing regresses past the recorded state.\n *\n * A violation is identified by a fingerprint over the parts of it that are\n * machine-stable. See `fingerprint` for what is deliberately excluded and why.\n */\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { relative, resolve } from \"node:path\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\nimport { warn } from \"../../shared/warn.js\";\nimport {\n DocmetaError,\n isErrorSeverity,\n type BaselineSummary,\n type FieldError,\n type ValidationResult,\n} from \"../types.js\";\nimport { stripBom } from \"./json-text.js\";\nimport { STDIN_LABEL } from \"./load-files.js\";\nimport { ANNOTATION_ONLY_PREDECESSORS, classifyRef } from \"./schema-registry.js\";\nimport { writeFileAtomic } from \"./write-file.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\n\n/** Where `--baseline` / `--write-baseline` / `baseline:` point when unspecified. */\nexport const DEFAULT_BASELINE_PATH = \".manni-baseline.json\";\n\n/**\n * The default before the rename. A baseline is committed, so an existing one\n * is still read when the new name is absent — with a warning, because two\n * defaults is one too many to keep.\n */\nexport const LEGACY_BASELINE_PATH = \".docmeta-baseline.json\";\n\n/** The only file format this version understands. */\nexport const BASELINE_VERSION = 1;\n\n/** Exactly what `fingerprint` emits: 16 lowercase hex characters. */\nconst FINGERPRINT_RE = /^[0-9a-f]{16}$/;\n\nexport interface Baseline {\n version: number;\n /** docmeta version that produced the file, for diagnosis only. */\n generatedWith: string;\n /** File path (as reported in results) -> sorted violation fingerprints. */\n entries: Record<string, string[]>;\n}\n\n/** The parts of a violation a fingerprint is built from. */\nexport type Fingerprintable = Pick<\n FieldError,\n \"schema\" | \"instancePath\" | \"keyword\" | \"subject\"\n>;\n\n/** What a schema reference is measured against when it names a local file. */\nexport interface FingerprintContext {\n /** Working directory a relative file ref was written against. */\n cwd: string;\n /** Directory canonical paths are expressed relative to: the config's, else `cwd`. */\n base: string;\n /**\n * Directory a `ValidationResult.file` label is relative to. Usually `base`,\n * but a run that took positional paths resolves them against `cwd` instead,\n * so the two genuinely differ. Defaults to `base` when omitted.\n */\n runBase?: string;\n}\n\n/**\n * The key a file's entry is stored under.\n *\n * Result labels are relative to whatever the run resolved against, so the same\n * page is `docs/legacy.md` from the repo root and `legacy.md` from inside\n * `docs/`. A baseline is a committed, shared artifact, so its keys have to name\n * the file the same way from anywhere — otherwise the lookup misses and every\n * baselined finding reads as new, without the fingerprints ever being compared.\n */\nexport function canonicalFilePath(\n file: string,\n ctx?: FingerprintContext,\n): string {\n if (!ctx) return file;\n const from = ctx.runBase ?? ctx.base;\n return relative(ctx.base, resolve(from, file)).replace(/\\\\/g, \"/\");\n}\n\n/**\n * A schema reference reduced to a form that does not depend on where the\n * command was run from.\n *\n * The ref is part of a violation's identity, and config discovery rewrites a\n * config's **local file** refs to absolute paths whenever the config directory\n * is not the working directory. Left alone, that would give one fingerprint set\n * when CI runs from the repo root and a different, machine-specific one when a\n * developer runs from `docs/` — the whole baselined backlog reading as new for\n * exactly the subdirectory workflow config discovery exists to support.\n *\n * Built-in ids and URLs are already stable and pass through untouched. A local\n * file ref becomes its path relative to `base`, with posix separators so a\n * baseline recorded on Windows matches one recorded on Linux.\n *\n * Only the *fingerprint input* is canonicalized. Reports and schema loading\n * keep using the ref exactly as the user wrote it.\n */\nexport function canonicalSchemaRef(\n ref: string,\n ctx?: FingerprintContext,\n): string {\n if (!ctx) return ref;\n if (classifyRef(ref).kind !== \"file\") return ref;\n // `resolve` is a no-op on an already-absolute ref, which is the rebased case.\n const abs = resolve(ctx.cwd, ref);\n return relative(ctx.base, abs).replace(/\\\\/g, \"/\");\n}\n\n/**\n * A violation's stable identity: 16 hex characters of\n * `sha256(schema NUL instancePath NUL keyword NUL subject)`.\n *\n * Deliberately excludes:\n *\n * - **the line number** — adding one key to frontmatter shifts every line below\n * it, and a fingerprint that moved with it would present a pure reordering as\n * a wall of new findings;\n * - **the message prose** — Ajv generates it, so any Ajv release that rewords a\n * message would invalidate every affected entry in every consuming repo at\n * once, presenting as \"docmeta broke our build\";\n * - **the file path** — it is already the entry key, so hashing it again buys\n * nothing.\n *\n * 64 bits against a realistic per-file population of tens of violations is\n * overwhelming headroom, and a collision costs one forgiven violation rather\n * than a corrupt file. The NUL separators are what keep `(\"ab\", undefined)` and\n * `(\"a\", \"b\")` apart.\n *\n * Note the sharp edge in the *included* half: the schema **ref string** is part\n * of the identity, so re-pointing a schema from `google:okf:0.1` to a URL\n * serving the same bytes changes every fingerprint. That is correct — docmeta\n * cannot tell it is the same contract — but it is surprising, and the remedy is\n * a re-record. The exception is a built-in version that only adds annotations:\n * it hashes as its predecessor (`ANNOTATION_ONLY_PREDECESSORS`), so a default\n * set that moves to it keeps every recorded entry.\n */\nexport function fingerprint(\n e: Fingerprintable,\n ctx?: FingerprintContext,\n): string {\n const ref = canonicalSchemaRef(e.schema, ctx);\n const parts = [\n ANNOTATION_ONLY_PREDECESSORS.get(ref) ?? ref,\n e.instancePath,\n e.keyword,\n e.subject ?? \"\",\n ];\n return createHash(\"sha256\").update(parts.join(\"\\0\")).digest(\"hex\").slice(0, 16);\n}\n\n/** Sorted keys and sorted fingerprints, so the file diffs and merges legibly. */\nexport function serializeBaseline(baseline: Baseline): string {\n // Null-prototype for the same reason `parseBaseline` uses one: a file key of\n // `__proto__` assigned into a plain object literal would set the prototype\n // and drop the entry, so a parse/serialize round-trip would lose it silently.\n const entries = Object.create(null) as Record<string, string[]>;\n for (const file of Object.keys(baseline.entries).sort()) {\n entries[file] = [...(baseline.entries[file] ?? [])].sort();\n }\n return `${JSON.stringify(\n {\n version: baseline.version,\n generatedWith: baseline.generatedWith,\n entries,\n },\n null,\n 2,\n )}\\n`;\n}\n\nfunction bad(source: string, detail: string): never {\n throw new DocmetaError(`Baseline \"${source}\": ${detail}`);\n}\n\n/** Parse baseline JSON. `source` is the path as the user would type it. */\nexport function parseBaseline(text: string, source: string): Baseline {\n let raw: unknown;\n try {\n // A baseline is a committed file an editor may have re-saved. Nothing here\n // hashes it, so this is purely the parsing concession. See `stripBom`.\n raw = JSON.parse(stripBom(text));\n } catch (err) {\n bad(source, `invalid JSON: ${errorMessage(err)}`);\n }\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n bad(source, \"top level must be an object.\");\n }\n const obj = raw as Record<string, unknown>;\n\n if (obj.version !== BASELINE_VERSION) {\n bad(\n source,\n `unsupported version ${JSON.stringify(obj.version)} (this manni writes version ${BASELINE_VERSION}). Re-record it with \\`manni meta validate --write-baseline\\`.`,\n );\n }\n\n const generatedWith =\n typeof obj.generatedWith === \"string\" ? obj.generatedWith : \"\";\n\n const rawEntries = obj.entries;\n if (\n typeof rawEntries !== \"object\" ||\n rawEntries === null ||\n Array.isArray(rawEntries)\n ) {\n bad(source, '\"entries\" must be an object mapping file paths to fingerprints.');\n }\n\n // Null-prototype, so a file key of `__proto__` is stored as an ordinary entry\n // rather than triggering the inherited setter — which would replace this\n // object's prototype and silently drop the entry. Every other malformation\n // here is rejected loudly; this one would not even be visible.\n const entries = Object.create(null) as Record<string, string[]>;\n for (const [file, value] of Object.entries(\n rawEntries as Record<string, unknown>,\n )) {\n if (!Array.isArray(value) || value.some((v) => typeof v !== \"string\")) {\n bad(source, `entries[\"${file}\"] must be a list of fingerprint strings.`);\n }\n // A fingerprint that is not the shape this code writes can never match a\n // real violation, so a typo in a hand-edited baseline would otherwise\n // present as \"that finding came back\" with nothing to explain it. Reject it\n // where the user can still see which entry is wrong.\n const malformed = (value as string[]).find((v) => !FINGERPRINT_RE.test(v));\n if (malformed !== undefined) {\n bad(\n source,\n `entries[\"${file}\"] contains ${JSON.stringify(malformed)}, which is not a fingerprint (16 lowercase hex characters).`,\n );\n }\n entries[file] = value as string[];\n }\n\n return { version: BASELINE_VERSION, generatedWith, entries };\n}\n\n/** Read a baseline from disk. Returns null when the file does not exist. */\nexport async function readBaseline(\n absPath: string,\n source: string,\n): Promise<Baseline | null> {\n let text: string;\n try {\n text = await readFile(absPath, \"utf8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw new DocmetaError(\n `Baseline \"${source}\" could not be read: ${errorMessage(err)}`,\n );\n }\n return parseBaseline(text, source);\n}\n\n/**\n * Write the baseline atomically.\n *\n * The baseline is a committed artifact the whole team's gate reads, and a\n * truncated write is not merely lost work: the next run cannot parse it and\n * exits 2 until someone re-records. `writeFileAtomic` gives the same\n * temp-file-plus-rename guarantee `fill` relies on when it edits sources.\n *\n * Failures are wrapped the same way `readBaseline` wraps its own, so a missing\n * parent directory or a read-only checkout names the baseline and reads as an\n * operational error rather than surfacing a bare `ENOENT` through the CLI's\n * \"Unexpected error\" branch.\n */\nexport async function writeBaselineFile(\n absPath: string,\n baseline: Baseline,\n source: string,\n): Promise<void> {\n try {\n await writeFileAtomic(absPath, serializeBaseline(baseline));\n } catch (err) {\n throw new DocmetaError(\n `Baseline \"${source}\" could not be written: ${errorMessage(err)}`,\n );\n }\n}\n\n/** Record every finding in `results` as a baseline. Clean files are omitted. */\nexport function buildBaseline(\n results: ValidationResult[],\n generatedWith: string,\n ctx?: FingerprintContext,\n): Baseline {\n // Null-prototype, matching `parseBaseline` and `serializeBaseline` — and here\n // it prevents a crash rather than a lost entry. `__proto__` is the famous\n // collision but not the reachable one; `toString` is a legal filename. A file\n // that is *clean* gets no entry, so `applyBaseline`'s lookup would find the\n // inherited method instead of `undefined`, pass the `!known` guard because a\n // function is truthy, and then die in `new Set(known)` with \"function is not\n // iterable\".\n const entries = Object.create(null) as Record<string, string[]>;\n for (const r of results) {\n if (r.errors.length === 0) continue;\n // Two identical violations in one file are one fingerprint; storing the\n // duplicate would only make the count meaningless.\n const prints = [...new Set(r.errors.map((e) => fingerprint(e, ctx)))].sort();\n entries[canonicalFilePath(r.file, ctx)] = prints;\n }\n return { version: BASELINE_VERSION, generatedWith, entries };\n}\n\nexport interface AppliedBaseline {\n /** Results with baselined findings removed and `ok`/`baselined` updated. */\n results: ValidationResult[];\n /** Fingerprints the baseline holds **for the files this run checked**. */\n recorded: number;\n /** Findings suppressed because the baseline already had them. */\n suppressed: number;\n /** Recorded fingerprints for checked files that no longer occur. */\n stale: number;\n}\n\n/**\n * Subtract a baseline from a run's results.\n *\n * `recorded` and `stale` count only the files this run actually checked. The\n * alternative — counting the whole file — would make `manni meta validate one.md\n * --baseline` announce that hundreds of entries \"no longer occur\", and the\n * advice that follows (`--write-baseline` to prune) would then destroy them.\n */\nexport function applyBaseline(\n results: ValidationResult[],\n baseline: Baseline,\n ctx?: FingerprintContext,\n): AppliedBaseline {\n let recorded = 0;\n let suppressed = 0;\n let stale = 0;\n\n const applied = results.map((r) => {\n const known = baseline.entries[canonicalFilePath(r.file, ctx)];\n if (!known) return r; // no entry: a new or renamed file, everything is new\n const recordedHere = new Set(known);\n recorded += recordedHere.size;\n\n const seen = new Set<string>();\n const fresh: FieldError[] = [];\n for (const e of r.errors) {\n const print = fingerprint(e, ctx);\n if (recordedHere.has(print)) {\n seen.add(print);\n suppressed += 1;\n } else {\n fresh.push(e);\n }\n }\n stale += recordedHere.size - seen.size;\n\n const baselined = r.errors.length - fresh.length;\n return {\n ...r,\n // The severity invariant, not `fresh.length === 0`: a warning that the\n // baseline did not forgive is still reported, and still not a failure.\n ok: !fresh.some(isErrorSeverity),\n errors: fresh,\n ...(baselined > 0 ? { baselined } : {}),\n };\n });\n\n return { results: applied, recorded, suppressed, stale };\n}\n\n/**\n * Count fingerprints added and dropped between two baselines.\n *\n * The `removed` half is the load-bearing one: an accidental `--write-baseline`\n * on a narrowed glob or a mistyped `--exclude` silently forgives everything it\n * did not see, and this number is the only thing that makes that visible in a\n * CI log.\n */\nexport function diffBaselines(\n previous: Baseline | null,\n next: Baseline,\n): { added: number; removed: number } {\n const flatten = (b: Baseline | null): Set<string> => {\n const out = new Set<string>();\n if (!b) return out;\n for (const [file, prints] of Object.entries(b.entries)) {\n for (const p of prints) out.add(`${file}\\0${p}`);\n }\n return out;\n };\n const before = flatten(previous);\n const after = flatten(next);\n let added = 0;\n let removed = 0;\n for (const k of after) if (!before.has(k)) added += 1;\n for (const k of before) if (!after.has(k)) removed += 1;\n return { added, removed };\n}\n\n/** Total fingerprints held in a baseline, across every file. */\nexport function countFingerprints(baseline: Baseline): number {\n let n = 0;\n for (const prints of Object.values(baseline.entries)) n += prints.length;\n return n;\n}\n\n/** The flags a baseline request is settled from; a subset of every tool's options. */\nexport interface BaselineFlags {\n /**\n * `--baseline [path]`: compare findings against a recorded baseline. `true`\n * is the default path; `false` is `--no-baseline`, which suppresses a\n * baseline the config would otherwise apply.\n */\n baseline?: string | boolean;\n /** `--write-baseline [path]`: record this run's findings. Wins over `baseline`. */\n writeBaseline?: string | boolean;\n}\n\n/**\n * The file names a tool's baseline lives under when no path was typed.\n *\n * Each tool has its own, because the baseline file has no per-tool key: one\n * shared name would let one tool's `--write-baseline` erase another's backlog.\n * `legacy` is the name a tool was published under before a rename, read only\n * when `current` is absent; a tool that never renamed passes none.\n */\nexport interface BaselineDefaults {\n current: string;\n legacy?: string;\n}\n\n/** A resolved `--baseline` / `--write-baseline` / `baseline:` request. */\nexport interface BaselineRequest {\n absPath: string;\n /** The path spelled as the user would type it, for messages. */\n label: string;\n write: boolean;\n}\n\n/**\n * Settle which baseline file (if any) governs this run, and where it lives.\n *\n * The one subtlety is the base directory. A path the user typed on the command\n * line is relative to where they are standing; a `baseline:` written in a config\n * file is relative to **the config**, because that is where the person editing\n * it can see the file. Resolving a configured path against `cwd` instead would\n * mean running from a subdirectory silently finds no baseline and reports the\n * entire backlog as new — the exact class of bug config discovery exists to fix.\n */\nexport function resolveBaselineRequest(\n opts: BaselineFlags,\n configured: string | undefined,\n configDir: string | undefined,\n cwd: string,\n defaults: BaselineDefaults,\n): BaselineRequest | null {\n /** A path typed on the command line: relative to where the user is standing. */\n const named = (label: string): Omit<BaselineRequest, \"write\"> => ({\n absPath: resolve(cwd, label),\n label,\n });\n\n /**\n * The file this project's baseline lives in when no path was typed.\n *\n * A configured `baseline:` wins over the built-in default here, and that is\n * load-bearing rather than a nicety: read and write have to agree on one\n * file. A repo that points `baseline:` somewhere other than the default, then\n * runs a bare `--write-baseline`, would otherwise record into a second file\n * nothing ever reads — and the ratchet would silently do nothing at all.\n *\n * Both spellings resolve against the **config's** directory, not `cwd`. An\n * implied baseline is a property of the project, the same as the config that\n * governs it, so it has to be the same file wherever the command is run from.\n * Resolving it against `cwd` would break the ratchet the moment someone runs\n * from `docs/` — the subdirectory workflow config discovery exists to support\n * — and a later write from there would quietly give the project a second\n * baseline that nothing reads. An explicitly *typed* path stays relative to\n * where the user is standing, which is what a shell argument should mean.\n */\n const implied = (): Omit<BaselineRequest, \"write\"> => {\n const base = configDir ?? cwd;\n if (configured !== undefined) {\n return { absPath: resolve(base, configured), label: configured };\n }\n // A baseline recorded before a rename is still the project's baseline.\n // Only when the new name is absent, so a project that has moved is never\n // pulled back by a stale file it forgot to delete.\n const current = resolve(base, defaults.current);\n if (defaults.legacy !== undefined) {\n const legacy = resolve(base, defaults.legacy);\n if (!existsSync(current) && existsSync(legacy)) {\n warn(\n `\"${defaults.legacy}\" is the pre-rename baseline file name. Rename it to \"${defaults.current}\".`,\n );\n return { absPath: legacy, label: defaults.legacy };\n }\n }\n return { absPath: current, label: defaults.current };\n };\n\n const requested = (\n value: string | true,\n ): Omit<BaselineRequest, \"write\"> =>\n typeof value === \"string\" ? named(value) : implied();\n\n // Recording wins over comparing: `--write-baseline` must not depend on\n // whether the file it is about to replace could be read.\n if (opts.writeBaseline !== undefined && opts.writeBaseline !== false) {\n return { ...requested(opts.writeBaseline), write: true };\n }\n if (opts.baseline === false) return null; // --no-baseline\n if (opts.baseline !== undefined) {\n return { ...requested(opts.baseline), write: false };\n }\n if (configured) return { ...implied(), write: false };\n return null;\n}\n\n/**\n * Apply — or record — the baseline, and describe what it did.\n *\n * On a write, the freshly recorded baseline is then applied to the same\n * results, so `--write-baseline` reports the files it recorded as clean and\n * exits 0 without the exit code needing a special case anywhere.\n *\n * `<stdin>` is the one exception, and deliberately so: it is not a path anyone\n * can look up on the next run, so it is never recorded, never matches, and its\n * findings still fail the run. Reporting it clean would announce success for a\n * violation that was neither fixed nor baselined.\n */\nexport async function settleBaseline(\n results: ValidationResult[],\n request: BaselineRequest | null,\n ctx: FingerprintContext,\n): Promise<{ results: ValidationResult[]; baseline?: BaselineSummary }> {\n if (!request) return { results };\n\n const previous = await readBaseline(request.absPath, request.label);\n\n if (request.write) {\n // `<stdin>` is not a path anyone can look up on the next run, so recording\n // it would only leave an entry that can never match again.\n const recordable = results.filter((r) => r.file !== STDIN_LABEL);\n const next = buildBaseline(recordable, pkg.version, ctx);\n const { added, removed } = diffBaselines(previous, next);\n await writeBaselineFile(request.absPath, next, request.label);\n const applied = applyBaseline(results, next, ctx);\n return {\n results: applied.results,\n baseline: {\n path: request.label,\n written: true,\n recorded: countFingerprints(next),\n suppressed: applied.suppressed,\n stale: applied.stale,\n added,\n removed,\n },\n };\n }\n\n if (!previous) {\n throw new DocmetaError(\n `Baseline \"${request.label}\" not found. Record one with \\`manni meta validate --write-baseline\\`, or drop --baseline.`,\n );\n }\n\n const applied = applyBaseline(results, previous, ctx);\n return {\n results: applied.results,\n baseline: {\n path: request.label,\n written: false,\n recorded: applied.recorded,\n suppressed: applied.suppressed,\n stale: applied.stale,\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8MO,SAAS,gBAAgB,GAA0C;AACxE,SAAO,EAAE,aAAa,UAAa,EAAE,aAAa;AACpD;AAyEO,IAAM,eAAN,cAA2B,UAAU;AAAA,EAC1C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ACjRA,SAAS,WAAW,QAAQ,IAAI,QAAAA,OAAM,OAAO,aAAa;AAC1D,SAAS,SAAS,MAAM,UAAU,eAAe;;;ACajD,SAAS,YAAY;AAiBrB,IAAM,SAAS,oBAAI,IAAwB;AAG3C,SAAS,SAAS,OAAwB;AACxC,SAAO,IAAI,IAAI,QAAQ,KAAK,CAAC;AAC/B;AAYO,SAAS,wBAAwB,MAAoB;AAC1D,aAAW,OAAO,QAAQ;AACxB,UAAM,QAAQ,IAAI,MAAM;AACxB,QAAI,UAAU,OAAW,QAAO,OAAO,GAAG;AAAA,QACrC,OAAM,KAAK,IAAI;AAAA,EACtB;AACF;AAoBA,eAAe,UAAU,MAAyC;AAChE,MAAI;AACF,UAAM,OAAO,MAAM,KAAK,IAAI;AAC5B,WAAO,EAAE,SAAS,KAAK,SAAS,MAAM,KAAK,KAAK;AAAA,EAClD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAM,OAAO,CAAC,GAAc,MAC1B,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE;AAUnC,IAAM,gBAAN,MAAuB;AAAA,EACX,QAAQ,oBAAI,IAA0D;AAAA,EAEvF,cAA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AACvD,UAAM,EAAE,OAAO,QAAQ,IAAI,cAAc,UAAU,IAAI;AACvD,UAAM,kBAAkB,QAAQ,SAAS,MAAM,QAAQ,KAAK;AAC5D,UAAMG,WAAU,cAAc,SAAS,MAAM,GAAG;AAChD,WAAO;AAAA,MACL,SAASA,SAAQ;AAAA,MACjB,UAAU;AAAA,QACR,MAAM,QAAQ;AAAA,QACd,SAAS;AAAA,QACT,UAAU,kBAAkB,IAAI;AAAA,QAChC,YAAYA,SAAQ;AAAA,QACpB,OAAOA,SAAQ;AAAA,QACf;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR,aAAa,QAAQ,KAAK;AAAA,IAC5B;AAAA,EACF;AAEA,QAAM,UAAU,cAAc,SAAS,UAAU,GAAG;AACpD,SAAO;AAAA,IACL,SAAS,QAAQ;AAAA,IACjB,UAAU;AAAA,MACR,MAAM,QAAQ;AAAA,MACd,SAAS;AAAA,MACT,UAAU,QAAQ;AAAA,MAClB,YAAY,QAAQ;AAAA,MACpB,OAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AACF;","names":["stat","parsed","resolve","stat","mkdir","stat","join","join","stat","mkdir","createHash","readFile","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","__default","wait","resolve","parsed","readFile","resolve","resolve","resolve","own","defaults","strict","stripBom","lineEnd","parsed","parseDocument","isMap","isScalar","parseToml","isMap","isScalar","isSeq","parsed","parseYamlBlock","isMap","parseDocument","isScalar","TOML_KEY","TOML_TABLE","parseToml","parseYamlScalar","typeValue","parseYamlScalar","under","parseYamlScalar","elementName","byExtension","isMap","typeValue","parseYamlScalar","anchor","DQ","next","verify","parseYamlScalar","typeValue","parseYamlScalar","source","stringifyYaml","escapeAttr","DQ","emitScalar","elementTextEdit","insertEdit","spliceAll","verify","attrValueSpan","stringifyYaml","stat","relative","resolve","dirname","relative","resolve","resolve","dirname","relative","stat","relative","resolve","resolve","relative","deepEqual","resolve","readFile","stat","join","relative","resolve","sep","join","stat","relative","sep","register","resolve","parsed","readFile","parsed","register","resolve","createHash","readFile","relative","resolve","relative","resolve","createHash","readFile","applied"]}
|