@dogsbay/types 0.2.0-beta.15 → 0.2.0-beta.151

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.
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Directive nodes — source-level DITA/Jinja authoring constructs.
3
+ *
4
+ * ── Corpus survey (2026-07-06) ────────────────────────────────────────
5
+ * The authoritative directive vocabulary is @dogsbay/minja's AST
6
+ * (packages/minja/src/types.ts):
7
+ * - variable `{{ name }}` → VariableNode { name }
8
+ * - if/elif/else `{% if expr %}…` → IfNode { condition, trueBranch, elif[], else }
9
+ * - include `{% include "path" %}` → IncludeNode { path }
10
+ * - set `{% set name = expr %}` → SetNode { name, value }
11
+ * - switch / leveloffset / comment → richer forms
12
+ * AsciiDoc `ifdef`/`ifndef` convert to minja `if` (adoc2md-modular);
13
+ * DITA conref/keyref map to includes/variables (format-dita). Profiling
14
+ * attributes (`@platform`/`@audience`) are plain node `props`, filtered
15
+ * at build via ditaval — no new node type needed.
16
+ *
17
+ * ── Why these types exist ─────────────────────────────────────────────
18
+ * Today these constructs are resolved to a STRING before TreeNode exists
19
+ * (standalone minja; see docs-dev/editor-framework-decision.md). TreeNode
20
+ * is the resolved-output model and has no representation of them. The
21
+ * editor edits the *unresolved source*, so it needs them as first-class,
22
+ * round-trippable nodes. The definitions below are ADDITIVE:
23
+ * - block directives ride TreeNode's open `type: string` — NO union change;
24
+ * - inline directives extend InlineNode via `InlineNodeWithDirectives`
25
+ * (below) rather than the base union, so the monorepo's ~10 exhaustive
26
+ * InlineNode consumers keep compiling. Folding them into the base
27
+ * union and updating those consumers is Phase 2 — see
28
+ * plans/editor-directive-model.md.
29
+ *
30
+ * ── Fidelity rule ─────────────────────────────────────────────────────
31
+ * Anything not modeled first-class (elif/else chains, switch, leveloffset,
32
+ * unknown directives) is preserved verbatim as a `directive-raw` node — a
33
+ * source-of-truth tool must never drop a construct it cannot fully model.
34
+ */
35
+ import type { TreeNode, InlineNode } from "./tree.js";
36
+ /** `{% if test %} … {% endif %}` — guarded flow content. elif/else: Phase 2. */
37
+ export interface ConditionalNode extends TreeNode {
38
+ type: "conditional";
39
+ /** raw expression source, e.g. `platform == "mac"` */
40
+ props: {
41
+ test: string;
42
+ };
43
+ children: TreeNode[];
44
+ }
45
+ /** `{% include "src" %}` — transclusion of another topic/fragment. */
46
+ export interface IncludeNode extends TreeNode {
47
+ type: "include";
48
+ /** `src` is the include target as written; extra keys pass through */
49
+ props: {
50
+ src: string;
51
+ [key: string]: unknown;
52
+ };
53
+ }
54
+ /** `{% set name = value %}` — in-document variable definition. */
55
+ export interface VarDefNode extends TreeNode {
56
+ type: "var-def";
57
+ /** `value` is the raw value-expression source */
58
+ props: {
59
+ name: string;
60
+ value: string;
61
+ };
62
+ }
63
+ /** Any directive not modeled first-class, preserved verbatim for round-trip. */
64
+ export interface DirectiveRawNode extends TreeNode {
65
+ type: "directive-raw";
66
+ /** `source` is the exact span; `kind` is a best-effort hint (e.g. "switch") */
67
+ props: {
68
+ source: string;
69
+ kind?: string;
70
+ };
71
+ }
72
+ export type DirectiveBlockNode = ConditionalNode | IncludeNode | VarDefNode | DirectiveRawNode;
73
+ export declare const isConditional: (n: TreeNode) => n is ConditionalNode;
74
+ export declare const isInclude: (n: TreeNode) => n is IncludeNode;
75
+ export declare const isVarDef: (n: TreeNode) => n is VarDefNode;
76
+ export declare const isDirectiveRaw: (n: TreeNode) => n is DirectiveRawNode;
77
+ export declare const isDirectiveBlock: (n: TreeNode) => n is DirectiveBlockNode;
78
+ /**
79
+ * Inline `{{ expr }}` — a variable/expression chip.
80
+ *
81
+ * The optional flags mirror InlineText's flat formatting annotations:
82
+ * a directive inside `**…**` carries its containing span's formatting
83
+ * (there is no wrapper node in the flat inline model to carry it).
84
+ */
85
+ export interface InlineVariable {
86
+ type: "variable";
87
+ /** raw source between the braces, e.g. `product.name` */
88
+ expr: string;
89
+ bold?: boolean;
90
+ italic?: boolean;
91
+ strikethrough?: boolean;
92
+ }
93
+ /** Inline conditional span: content shown only when `test` holds. */
94
+ export interface InlineConditionalSpan {
95
+ type: "conditional-span";
96
+ /** raw expression source */
97
+ test: string;
98
+ children: InlineNode[];
99
+ bold?: boolean;
100
+ italic?: boolean;
101
+ strikethrough?: boolean;
102
+ }
103
+ /** Inline directive not modeled first-class, preserved verbatim. */
104
+ export interface InlineDirectiveRaw {
105
+ type: "directive-raw-inline";
106
+ /** exact source span */
107
+ source: string;
108
+ bold?: boolean;
109
+ italic?: boolean;
110
+ strikethrough?: boolean;
111
+ }
112
+ export type InlineDirectiveNode = InlineVariable | InlineConditionalSpan | InlineDirectiveRaw;
113
+ /**
114
+ * InlineNode extended with directive members. Directive-aware code (the
115
+ * editor, the preserve-mode parser) uses this; the base `InlineNode` union
116
+ * stays unchanged so existing exhaustive consumers keep compiling. Phase 2
117
+ * folds these into the base union and updates those consumers.
118
+ */
119
+ export type InlineNodeWithDirectives = InlineNode | InlineDirectiveNode;
120
+ export declare const isInlineDirective: (n: InlineNodeWithDirectives) => n is InlineDirectiveNode;
121
+ export declare const PROFILING_ATTRS: readonly ["platform", "product", "audience", "rev", "otherprops"];
122
+ export type ProfilingAttr = (typeof PROFILING_ATTRS)[number];
123
+ /** Extract the profiling attributes present on a node's `props`. */
124
+ export declare function profilingOf(node: TreeNode): Partial<Record<ProfilingAttr, unknown>>;
@@ -0,0 +1,26 @@
1
+ export const isConditional = (n) => n.type === "conditional";
2
+ export const isInclude = (n) => n.type === "include";
3
+ export const isVarDef = (n) => n.type === "var-def";
4
+ export const isDirectiveRaw = (n) => n.type === "directive-raw";
5
+ export const isDirectiveBlock = (n) => isConditional(n) || isInclude(n) || isVarDef(n) || isDirectiveRaw(n);
6
+ const INLINE_DIRECTIVE_TYPES = new Set([
7
+ "variable",
8
+ "conditional-span",
9
+ "directive-raw-inline",
10
+ ]);
11
+ export const isInlineDirective = (n) => INLINE_DIRECTIVE_TYPES.has(n.type);
12
+ /* ───────────────────── profiling attributes ───────────────────────────
13
+ * DITA-style profiling — the *attribute* form of a conditional (the
14
+ * *wrapper* form is ConditionalNode). Lives in plain `props`, filtered at
15
+ * build via ditaval. A reserved-key convention, not a type change.
16
+ */
17
+ export const PROFILING_ATTRS = ["platform", "product", "audience", "rev", "otherprops"];
18
+ /** Extract the profiling attributes present on a node's `props`. */
19
+ export function profilingOf(node) {
20
+ const out = {};
21
+ for (const key of PROFILING_ATTRS) {
22
+ if (node.props && key in node.props)
23
+ out[key] = node.props[key];
24
+ }
25
+ return out;
26
+ }
package/dist/format.d.ts CHANGED
@@ -16,6 +16,20 @@ export interface Heading {
16
16
  export interface ExportPage {
17
17
  /** File path relative to docs root, e.g. "getting-started" or "guides/install" */
18
18
  slug: string;
19
+ /**
20
+ * The source file, relative to the content root (`agent/index.md`), for an
21
+ * importer whose pages keep the author's relative links. Relative links are
22
+ * written against the FILE, and a directory's `index.md` has the directory
23
+ * as its slug, so the slug alone cannot say where `./overview` points.
24
+ * Importers that rewrite links to root-absolute leave it unset.
25
+ */
26
+ sourcePath?: string;
27
+ /**
28
+ * The page is its folder's index, served at `/<slug>/` where a leaf is served at `/<slug>`
29
+ * (Docusaurus's category index docs). Written as `<slug>/index.md`, which every Dogsbay MD
30
+ * reader serves at the same slug.
31
+ */
32
+ folderIndex?: boolean;
19
33
  /** Page title */
20
34
  title: string;
21
35
  /** Page content as TreeNode[] */
@@ -24,6 +38,26 @@ export interface ExportPage {
24
38
  headings: Heading[];
25
39
  /** Target URL for redirect/navigation pages (no body content, just a link) */
26
40
  redirect?: string;
41
+ /**
42
+ * Marks an include fragment (not a routable page): content meant to be
43
+ * `{% include %}`'d into other pages. Exporters write it as a plain `.md`
44
+ * include target at its slug — no frontmatter, no title, no nav entry. Used
45
+ * by structural-partial import modes (Docusaurus `--partial-mode include`,
46
+ * AsciiDoc fragments).
47
+ */
48
+ fragment?: boolean;
49
+ /**
50
+ * The page uses template-page syntax (plans/page-templates.md): Dogsbay-MD
51
+ * writes `template: jinja` in its front matter so the build renders it as
52
+ * a template page. Set by importers converting partials with parameters.
53
+ */
54
+ template?: boolean;
55
+ /**
56
+ * A template partial's declared parameters (`name`, or `name?` when
57
+ * optional). Dogsbay-MD writes them as front matter `params:` on the
58
+ * fragment, and the build validates every include against them.
59
+ */
60
+ templateParams?: string[];
27
61
  /**
28
62
  * Raw frontmatter data from the source page. Includes all YAML fields that
29
63
  * were present in the original source (title, description, tags, custom
@@ -60,6 +94,26 @@ export interface ExportPage {
60
94
  * See plans/multi-source-content.md.
61
95
  */
62
96
  multiSource?: MultiSourceMeta;
97
+ /**
98
+ * Direct-from-source markdown body, when the importer can produce
99
+ * one. Bypasses the TreeNode round-trip for callers that want to
100
+ * preserve the source's line structure verbatim (most importantly,
101
+ * `migrate-asciidoc`, which would otherwise see markdown-it fold
102
+ * adjacent non-blank lines into one paragraph and the
103
+ * format-dogsbay-md serializer flatten that paragraph onto a single
104
+ * line — turning every `ifdef` / `endif` block in the original
105
+ * `.adoc` into an unreadable wall of text).
106
+ *
107
+ * Importers that produce a faithful direct-from-source markdown
108
+ * (currently `format-asciidoc`) populate this field. Importers that
109
+ * don't (most format plugins) leave it `undefined` and consumers
110
+ * fall back to the TreeNode-derived body via `treeToDogsbayMd`.
111
+ *
112
+ * The TreeNode round-trip is still the canonical path for runtime
113
+ * rendering — `bodyMarkdown` is a migration-time convenience that
114
+ * doesn't change the import contract.
115
+ */
116
+ bodyMarkdown?: string;
63
117
  }
64
118
  /**
65
119
  * Per-page axis metadata. Set by the loader's aggregator when
@@ -81,6 +135,14 @@ export interface MultiSourceMeta {
81
135
  * page across versions / locales".
82
136
  */
83
137
  originalSlug: string;
138
+ /**
139
+ * With a `products:` block (@dogsbay/site-files products.ts): the
140
+ * version's URL segment, which may differ from its id (`latest` for
141
+ * `3.32`; `""` when the version is served at the product's root).
142
+ */
143
+ versionPath?: string;
144
+ /** With a `products:` block: the URL segments of the product's other versions (what a root version's menu leaves out). */
145
+ siblingVersionPaths?: string[];
84
146
  }
85
147
  /**
86
148
  * Navigation item for sidebar/TOC structures.
@@ -93,6 +155,39 @@ export interface NavItem {
93
155
  label: string;
94
156
  href?: string;
95
157
  children?: NavItem[];
158
+ /**
159
+ * Granularity book view (plans/granularity-views.md). Opt-in, per nav node:
160
+ * - "yes" — emit one rolled-up single page for this node's subtree.
161
+ * - "children" — emit a single page for each direct child (chapters); a
162
+ * child may override with its own "no".
163
+ * - "no" — no single page (the default when omitted).
164
+ */
165
+ singlePage?: "yes" | "no" | "children";
166
+ /**
167
+ * A state marker rendered beside the label — structured DATA, not text
168
+ * baked into `label`. Release comparisons use it for changed/new/removed
169
+ * pages; the same slot serves "new since your last visit", deprecation
170
+ * flags, and version badges.
171
+ *
172
+ * The renderer is responsible for making it perceivable WITHOUT colour
173
+ * (distinct glyph + visually-hidden text) — see SidebarNavTree.
174
+ *
175
+ * A branch may carry a marker for its SUBTREE: a collapsed group hides
176
+ * its children, so a change inside it must signal outward (the same
177
+ * visibility rule the diff renderer applies to tabs).
178
+ */
179
+ mark?: NavMark;
180
+ }
181
+ export type NavMarkKind = "added" | "changed" | "removed" | "moved";
182
+ export interface NavMark {
183
+ kind: NavMarkKind;
184
+ /**
185
+ * Announced to assistive tech and shown on hover. Defaults to `kind`.
186
+ * A branch aggregating its subtree says so ("3 pages changed").
187
+ */
188
+ label?: string;
189
+ /** True when this marker summarizes DESCENDANTS, not the item itself. */
190
+ subtree?: boolean;
96
191
  }
97
192
  /**
98
193
  * Standard interface for format plugins.
@@ -114,12 +209,153 @@ export interface FormatPlugin {
114
209
  /** Format-specific CLI options for export */
115
210
  exportOptions?: FormatOption[];
116
211
  /** Import: read source format, produce pages + nav */
117
- import?(source: string, opts: Record<string, unknown>): Promise<{
118
- pages: ExportPage[];
119
- nav: NavItem[];
120
- }>;
212
+ import?(source: string, opts: Record<string, unknown>): Promise<ImportResult>;
121
213
  /** Export: write pages + nav to target format */
122
214
  export?(pages: ExportPage[], nav: NavItem[], output: string, opts: Record<string, unknown>): Promise<void>;
215
+ /**
216
+ * What the exporter can represent, per TreeNode type: one cell of the
217
+ * component × format matrix (`MATRIX_ROWS` in @dogsbay/serialize-core).
218
+ * Required of every exporter — the CLI's capability-matrix test fails on a
219
+ * missing cell. Same shape as serialize-core's `CapabilityDeclaration`.
220
+ */
221
+ capabilities?: readonly FormatCapability[];
222
+ }
223
+ /** One feature's support in one export format (see `FormatPlugin.capabilities`). */
224
+ export interface FormatCapability {
225
+ feature: string;
226
+ support: "full" | "partial" | "none";
227
+ /** Required when support is not "full": how it degrades. */
228
+ note?: string;
229
+ rendersAs?: string;
230
+ }
231
+ export interface ImportResult {
232
+ pages: ExportPage[];
233
+ nav: NavItem[];
234
+ /**
235
+ * Directories whose CONTENTS should be mounted at `_assets/` in the output,
236
+ * so the `/_assets/…` refs importers rewrite image paths to actually
237
+ * resolve.
238
+ *
239
+ * An importer that knows where its media lives (a Starlight `src/assets`, a
240
+ * Docusaurus `static/`) declares it here. Without this the reference
241
+ * survives the conversion and the FILE does not — a page count, a retention
242
+ * score and a clean exit all look fine while every image 404s.
243
+ *
244
+ * `into` targets an `_assets/<into>` subdir; `mediaOnly` copies only media
245
+ * files, for the case where the mounted dir is the docs tree itself and
246
+ * carries co-located images.
247
+ */
248
+ assetMounts?: {
249
+ dir: string;
250
+ into?: string;
251
+ mediaOnly?: boolean;
252
+ exclude?: string[];
253
+ /**
254
+ * Public directory the mount lands in. Defaults to `_assets` — the name
255
+ * every IMPORTER rewrites its refs to. Hand-authored content differs: an
256
+ * author who has not read docs/images.md types `/images/logo.png`, so
257
+ * `format-dogsbay-md` also recognises `images/` and `assets/` and sets
258
+ * this to whichever it found. The copy must preserve the name, or the
259
+ * reference and the file disagree — the exact failure this field's
260
+ * neighbours exist to prevent.
261
+ */
262
+ root?: string;
263
+ }[];
264
+ /**
265
+ * Directory that page slugs are relative to, when it is NOT the path the
266
+ * user passed on the command line.
267
+ *
268
+ * MkDocs keeps its pages under `docs/`, Hugo under `content/`, a Docusaurus
269
+ * instance under its own docs dir — so a page at slug `guide/install`
270
+ * writing `{% include "_snippets/note.md" %}` means
271
+ * `<source>/docs/_snippets/note.md`, not `<source>/_snippets/note.md`.
272
+ * Resolving includes against the CLI argument missed every fragment in
273
+ * those corpora, which (since unresolved includes now fail the run) turned
274
+ * a working conversion into a hard error.
275
+ *
276
+ * Omit when slugs are relative to `source` itself.
277
+ */
278
+ contentRoot?: string;
279
+ /**
280
+ * SEVERAL content roots, each mounted under a slug prefix — the Antora
281
+ * PLAYBOOK case (#067): `docs/guides/` → `guides/`, `docs/server-admin-4.9/`
282
+ * → `server-admin/server-4.9/`. Fragments (partials, examples, images)
283
+ * under each `dir` are mirrored beneath its `prefix` so a page at
284
+ * `guides/deploy/x` writing `{% include "../../modules/ROOT/partials/y.md" %}`
285
+ * finds `<content>/guides/modules/ROOT/partials/y.md`. Takes precedence
286
+ * over `contentRoot` when present. `prefix` is `""` for the root mount.
287
+ */
288
+ sourceMounts?: {
289
+ dir: string;
290
+ prefix: string;
291
+ }[];
292
+ /**
293
+ * Antora playbook mode (#067): loaded components by NAME → root dir +
294
+ * slug prefix, for the engine's cross-component resource-ID
295
+ * resolution in fragments (pages get it via the plugin's own parse).
296
+ */
297
+ antoraComponents?: Record<string, {
298
+ dir: string;
299
+ prefix: string;
300
+ }>;
301
+ /**
302
+ * Attribute values the CORPUS declares (Antora playbook + component
303
+ * `asciidoc.attributes`, an AsciiBinder distro map, …) that the site
304
+ * build must resolve — a `{{ serverversion49 }}` the migrate emitted
305
+ * shipped as literal `{serverversion49}` because nothing wrote them into
306
+ * `dogsbay.config.yml` (#067 review). Migrate persists these under the
307
+ * user's own `--attribute` values (user wins).
308
+ */
309
+ corpusAttributes?: Record<string, unknown>;
310
+ /**
311
+ * What the import could not convert cleanly, by source file and line (the file is relative
312
+ * to the corpus root). A host lists these (the playground under Problems, the CLI in its
313
+ * summary); `MIGRATION.md` carries them too. Known loss, never silent loss.
314
+ */
315
+ ledger?: ImportLedgerEntry[];
316
+ /**
317
+ * Data files the import wrote for its pages (docs/data-files.md): `path` is relative to the
318
+ * data folder. Set only when the host asked for Dogsbay MD output, which reads them; the host
319
+ * writes them into `data/` beside the content.
320
+ */
321
+ dataFiles?: {
322
+ path: string;
323
+ text: string;
324
+ }[];
325
+ /**
326
+ * API viewer pages made API pages of their own (`openapi: "split"`, docs/openapi.md): each is a
327
+ * `from: openapi` source the host writes into dogsbay.config.yml, over the copied spec
328
+ * (`spec`, a `/_assets/…` path in the output) and MOUNTED at the page (`mount`, its slug).
329
+ * `pages` is how many pages the build makes from the spec, when it read.
330
+ */
331
+ apiSources?: {
332
+ spec: string;
333
+ mount: string;
334
+ pages?: number;
335
+ }[];
336
+ }
337
+ /** One note from an import: what was not converted cleanly, and where. */
338
+ export interface ImportLedgerEntry {
339
+ /** Source file, relative to the corpus root. */
340
+ file?: string;
341
+ /** 1-based line in that file, front matter included. */
342
+ line?: number;
343
+ /**
344
+ * The converted page the note is about, as a path in the migrated project
345
+ * (`content/guide/x.md`); set by the browser imports' `migrate` (and GitBook's project
346
+ * writer, which the CLI shares). Absent when the file
347
+ * became no page of its own (a config, a sidebar, a partial spliced into other pages).
348
+ */
349
+ page?: string;
350
+ /**
351
+ * 1-based line in `page`, front matter included, where the construct is. Given only
352
+ * when that line holds it: no line rather than a wrong one.
353
+ */
354
+ pageLine?: number;
355
+ severity: "info" | "warning";
356
+ /** Stable kebab-case kind, e.g. `unmapped-construct`, `slug-collision`. */
357
+ code: string;
358
+ message: string;
123
359
  }
124
360
  export interface FormatOption {
125
361
  flags: string;
@@ -157,6 +393,8 @@ export interface PlausibleConfig {
157
393
  export interface SiteConfig {
158
394
  /** Site name shown in header, page title suffixes, copyright notices. */
159
395
  siteName: string;
396
+ /** The line under the site name in the sidebar header (`site.tagline`). Default "Documentation". */
397
+ tagline?: string;
160
398
  /**
161
399
  * Canonical site URL. Required for `<link rel="canonical">`,
162
400
  * sitemap.xml entries, and absolute OG meta tags. Without it, those
@@ -197,6 +435,11 @@ export interface SiteConfig {
197
435
  editUri?: string;
198
436
  /** Footer copyright text. */
199
437
  copyright?: string;
438
+ /**
439
+ * "Powered by DogsBay" footer attribution. Defaults to true for generated
440
+ * sites; `poweredBy: false` in dogsbay.config.yml removes it entirely.
441
+ */
442
+ poweredBy?: boolean;
200
443
  /**
201
444
  * Brand keywords for the site, used by the
202
445
  * `seo/h1-brand-keyword` audit rule to verify that landing
@@ -223,6 +466,12 @@ export interface SiteConfig {
223
466
  * chips with prefix-keyed colors. See plans/tag-display-config.md.
224
467
  */
225
468
  tagPrefixes?: Record<string, TagPrefixDisplay>;
469
+ /**
470
+ * Color tag chips whose prefix has no color with a palette color
471
+ * chosen by a hash of the first segment. Sourced from
472
+ * `taxonomies.tags.autoColor`. See plans/tag-auto-color.md.
473
+ */
474
+ tagAutoColor?: boolean;
226
475
  /**
227
476
  * Per-tag leaf-label overrides (slug → display string). URLs and
228
477
  * taxonomy term-page paths still use the slug; only chip text
@@ -270,6 +519,30 @@ export interface SiteConfig {
270
519
  * human-facing UI cluster.
271
520
  */
272
521
  llmActions?: LlmActionsConfig;
522
+ /**
523
+ * Resolved glyphs for the internal/external link-icon affordance.
524
+ * When present, `DocsLayout` marks links in the prose with a small
525
+ * trailing icon so readers can tell internal navigation from links
526
+ * that leave the site. Sourced from `content.linkIcons` in
527
+ * `dogsbay.config.yml` and normalized by the CLI. Omitted (whole
528
+ * object absent) when the feature is off. Either side may be absent
529
+ * to show an icon for only that link kind. A core feature — not tied
530
+ * to any importer. See plans/link-resolution-and-icons.md.
531
+ */
532
+ linkIcons?: LinkIconsConfig;
533
+ }
534
+ /**
535
+ * Resolved glyphs for the internal/external link-icon affordance
536
+ * (`SiteConfig.linkIcons`). Classification is by href shape at render
537
+ * time: external = absolute (`http(s)://`) or protocol-relative
538
+ * (`//host`); internal = root/relative. An absent side shows no icon
539
+ * for that kind.
540
+ */
541
+ export interface LinkIconsConfig {
542
+ /** Glyph appended after external links (e.g. "↗"). */
543
+ external?: string;
544
+ /** Glyph appended after internal links (e.g. "→"). */
545
+ internal?: string;
273
546
  }
274
547
  /**
275
548
  * Closed list of LLM provider deep-link targets. Each one is a
@@ -329,6 +602,27 @@ export interface TaxonomyDisplay {
329
602
  prefixes?: Record<string, TagPrefixDisplay>;
330
603
  /** Per-slug label overrides; key = full slug, value = display string. */
331
604
  labels?: Record<string, string>;
605
+ /**
606
+ * Sort weight for the facet column in the search dialog. Lower
607
+ * numbers appear first; unset facets sort alphabetically after
608
+ * any pinned ones. Use this to pin "Type" or "Audience" to the
609
+ * top of the sidebar even though they sort later by name.
610
+ */
611
+ order?: number;
612
+ /**
613
+ * Render this facet as a hierarchical tree in the search dialog
614
+ * instead of a flat checkbox list. Two render strategies depending
615
+ * on the value shape:
616
+ * - Values containing `/` are treated as slash-encoded paths
617
+ * (`concept/a11y` → `concept → a11y`). Common for tag taxonomies.
618
+ * - Values without `/` derive their tree from `nav.json` document
619
+ * order (the auto-`category` facet shape).
620
+ * Parent click auto-selects all descendant values; three-state
621
+ * checkboxes reflect partial selection. Off by default — set true
622
+ * on `category` and on slash-nested tag taxonomies.
623
+ * See plans/hierarchical-facets.md.
624
+ */
625
+ hierarchical?: boolean;
332
626
  }
333
627
  /**
334
628
  * Display config for one taxonomy prefix. Color is one of the
@@ -347,4 +641,3 @@ export interface TagPrefixDisplay {
347
641
  * type-narrow without importing CLI internals.
348
642
  */
349
643
  export type TagPaletteName = "blue" | "amber" | "emerald" | "violet" | "rose" | "slate";
350
- //# sourceMappingURL=format.d.ts.map
package/dist/format.js CHANGED
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=format.js.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The frontmatter checker: one page's frontmatter against the vocabulary in
3
+ * frontmatter-schema.ts and the site's policy. Pure, so every surface reports
4
+ * the same findings:
5
+ *
6
+ * - `dogsbay validate` (@dogsbay/commands), which adds a one-click fix;
7
+ * - the `frontmatter/valid` rule of `@dogsbay/site-check`, run by
8
+ * `dogsbay site check` and `dogsbay-ssg check`.
9
+ */
10
+ import { type FrontmatterPolicy } from "./frontmatter-schema.js";
11
+ export interface FrontmatterFinding {
12
+ severity: "error" | "warning";
13
+ /** `frontmatter-type`, `frontmatter-required`, … (the codes `dogsbay validate` reports). */
14
+ code: string;
15
+ message: string;
16
+ /** The top-level key the finding is about, when there is one. */
17
+ key?: string;
18
+ /** 1-based line of that key, when `keyLines` has it. */
19
+ line?: number;
20
+ /** Near-miss values for a closed set. */
21
+ candidates?: string[];
22
+ /** A replacement safe to apply without asking (a case-only slip): set `key` to `value`. */
23
+ fix?: {
24
+ key: string;
25
+ value: string;
26
+ label: string;
27
+ };
28
+ }
29
+ /**
30
+ * Findings for one page. `path` is the page's source path as the policy's
31
+ * `roots` see it (the globs match its content-relative form); `keyLines`
32
+ * gives each key's line (`frontmatterKeyLines(source)`).
33
+ */
34
+ export declare function checkFrontmatter(frontmatter: Record<string, unknown> | undefined, path: string, policy: FrontmatterPolicy, keyLines?: Map<string, number>): FrontmatterFinding[];
35
+ /**
36
+ * The policy from a parsed `dogsbay.config.*` object: declared `taxonomies:`
37
+ * (their `values`/`hierarchical` ARE the check), `propSchema:`, and the
38
+ * opt-in `content.frontmatter` strictness. `roots` are the content roots
39
+ * (`content.sources[].path`). A malformed `content.frontmatter.unknown` sets
40
+ * `invalid` rather than being guessed around.
41
+ */
42
+ export declare function frontmatterPolicyFromConfig(cfg: Record<string, unknown> | null | undefined, roots: string[]): FrontmatterPolicy;