@orkestrel/guide 0.0.23 → 0.0.24
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/dist/src/core/index.cjs +25 -7
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +17 -10
- package/dist/src/core/index.d.ts +17 -10
- package/dist/src/core/index.js +25 -7
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +25 -7
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +11 -7
- package/dist/src/server/index.d.ts +11 -7
- package/dist/src/server/index.js +25 -7
- package/dist/src/server/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/core/constants.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts","../../../src/core/Guide.ts","../../../src/core/sources/Source.ts","../../../src/core/sources/SourceManager.ts","../../../src/core/Parity.ts","../../../src/core/parsers.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n","import type { ManifestEntry, ParityFinding } from '../core/types.js'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n","import type { ParityDirection } from '../core/types.js'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n","/**\n * Lists the declaration keywords a documented or exported symbol carries, in the order the\n * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and\n * `surfaceSymbolShape` all derive from.\n *\n * @remarks\n * One frozen list feeds the type, the guard, and the shape, so a keyword cannot be admitted by one\n * and refused by another. Comment and template payload is excluded before reflection, and `enum`\n * is outside this population rather than forbidden by general package policy.\n */\nexport const EXPORT_KEYWORDS = Object.freeze([\n\t'type',\n\t'interface',\n\t'const',\n\t'function',\n\t'class',\n] satisfies ReadonlyArray<'type' | 'interface' | 'const' | 'function' | 'class'>)\n\n/**\n * Lists the compared sites a {@link Drift} can describe.\n */\nexport const DRIFT_CATEGORIES = Object.freeze(['summary', 'example'] satisfies ReadonlyArray<\n\t'summary' | 'example'\n>)\n\n/**\n * Names the `## Surface` heading text a guide's documented exports section is keyed on.\n */\nexport const SURFACE: string = 'Surface'\n\n/**\n * Names the `## Methods` heading text a guide's documented interface-methods section is keyed on.\n */\nexport const METHODS: string = 'Methods'\n\n/**\n * Names the `## Tests` heading text a guide's documented test-link section is keyed on.\n */\nexport const TESTS: string = 'Tests'\n\n/**\n * Names the header text of the column a `## Surface` table's declaration keyword is read from.\n */\nexport const KIND: string = 'Kind'\n\n/**\n * Names the header text of the column a `## Surface` or `## Methods` table's compared\n * description paragraph is read from.\n */\nexport const SUMMARY: string = 'Summary'\n\n/**\n * Names the `## By concept` heading text the manifest's run-map table is keyed on.\n */\nexport const MANIFEST: string = 'By concept'\n\n/**\n * Holds the default character budget a rewritten doc block's description paragraph wraps\n * inside — the greatest number of characters a re-wrapped line may carry, counted from the\n * line's first character with a tab counting as one, so a wrapped line reads\n * `${indent} * ${text}` and never passes that count.\n *\n * @remarks\n * The budget counts characters, not rendered columns. A block indented with tabs therefore\n * measures each tab as one character, and a formatter that renders a tab wider reads the same\n * line as longer; a caller whose formatter measures differently passes its own width instead of\n * taking this default. A doc block's own wrapping is not recoverable from its text either — the\n * blocks this package's own source carries are hand-wrapped, and no single greedy width\n * reproduces them — so a rewrite cannot infer a per-block width and falls back to this budget.\n */\nexport const WRAP_WIDTH: number = 100\n\n/**\n * Lists the link `href` schemes a guides-parity link check skips as external — a link\n * with one of these prefixes (or a bare `#` anchor, handled separately in\n * `isExternalLink`) is never resolved against the filesystem.\n */\nexport const EXTERNAL_SCHEMES: readonly string[] = Object.freeze([\n\t'http:',\n\t'https:',\n\t'mailto:',\n\t'tel:',\n])\n","import type { Guard } from '@orkestrel/contract'\nimport type {\n\tDrift,\n\tDriftCategory,\n\tExportKeyword,\n\tManifestEntry,\n\tMethodEntry,\n\tMethodGroup,\n\tSourceExample,\n\tSurfaceSymbol,\n} from './types.js'\nimport { arrayOf, isString, literalOf, recordOf, unionOf } from '@orkestrel/contract'\nimport { DRIFT_CATEGORIES, EXPORT_KEYWORDS } from './constants.js'\n\n// AGENTS.md § Design laws: guards are total. Every guard here validates an arbitrary\n// `unknown` value crossing an untrusted boundary (parsed guide/manifest data)\n// against a data type's full shape, composed from @orkestrel/contract\n// combinators and hoisted as module-level values (compiled once, not per call).\n\n/**\n * Checks whether `value` is one of the documented {@link ExportKeyword}\n * literals — the guard behind extracting a Surface table's `Kind` cell into a\n * typed symbol.\n *\n * @param value - The candidate value\n * @returns True if `value` is a valid {@link ExportKeyword}; false otherwise\n *\n * @example\n * ```ts\n * isExportKeyword('class') // true\n * isExportKeyword('enum') // false\n * ```\n */\nexport const isExportKeyword: Guard<ExportKeyword> = literalOf(EXPORT_KEYWORDS)\n\n/** Checks whether `value` names a supported drift category. */\nexport const isDriftCategory: Guard<DriftCategory> = literalOf(DRIFT_CATEGORIES)\n\n/**\n * Checks whether `value` is a well-formed {@link SurfaceSymbol} — a `name`\n * string paired with a valid {@link ExportKeyword}, and an optional `summary`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link SurfaceSymbol}; false otherwise\n *\n * @example\n * ```ts\n * isSurfaceSymbol({ name: 'Markdown', keyword: 'class' }) // true\n * isSurfaceSymbol({ name: 'Markdown', keyword: 'enum' }) // false\n * ```\n */\nexport const isSurfaceSymbol: Guard<SurfaceSymbol> = recordOf(\n\t{\n\t\tname: isString,\n\t\tkeyword: isExportKeyword,\n\t\tsummary: isString,\n\t},\n\t['summary'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link MethodEntry} — a `name` string with an\n * optional `summary`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link MethodEntry}; false otherwise\n *\n * @example\n * ```ts\n * isMethodEntry({ name: 'walk' }) // true\n * isMethodEntry({ name: 1 }) // false\n * ```\n */\nexport const isMethodEntry: Guard<MethodEntry> = recordOf(\n\t{\n\t\tname: isString,\n\t\tsummary: isString,\n\t},\n\t['summary'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link SourceExample} — a `name` and `code`\n * string with an optional `title` and `language`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link SourceExample}; false otherwise\n *\n * @example\n * ```ts\n * isSourceExample({ name: 'walk', code: 'walk()' }) // true\n * isSourceExample({ name: 'walk' }) // false\n * ```\n */\nexport const isSourceExample: Guard<SourceExample> = recordOf(\n\t{\n\t\tname: isString,\n\t\ttitle: isString,\n\t\tcode: isString,\n\t\tlanguage: isString,\n\t},\n\t['title', 'language'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link Drift} — a compared `key` with an optional\n * `guide` and `source` text.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link Drift}; false otherwise\n *\n * @example\n * ```ts\n * isDrift({ key: 'class Widget', category: 'summary', guide: 'A widget.' }) // true\n * isDrift({ guide: 'A widget.' }) // false\n * ```\n */\nexport const isDrift: Guard<Drift> = recordOf(\n\t{\n\t\tkey: isString,\n\t\tcategory: isDriftCategory,\n\t\tguide: isString,\n\t\tsource: isString,\n\t},\n\t['guide', 'source'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link MethodGroup} — a backticked\n * `interface` name paired with its documented {@link MethodEntry} rows.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link MethodGroup}; false otherwise\n *\n * @example\n * ```ts\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }) // true\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false\n * ```\n */\nexport const isMethodGroup: Guard<MethodGroup> = recordOf({\n\tinterface: isString,\n\tmethods: arrayOf(isMethodEntry),\n})\n\n/**\n * Checks whether `value` is a well-formed {@link ManifestEntry} — a\n * `## By concept` manifest row, its `source` accepting either a single directory\n * or several.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link ManifestEntry}; false otherwise\n *\n * @example\n * ```ts\n * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * isManifestEntry({ concept: 1 }) // false\n * ```\n */\nexport const isManifestEntry: Guard<ManifestEntry> = recordOf({\n\tconcept: isString,\n\tspec: isString,\n\tsource: unionOf(isString, arrayOf(isString)),\n\ttests: isString,\n})\n","import type {\n\tBlockNode,\n\tCodeBlockNode,\n\tInlineNode,\n\tMarkdownDocument,\n\tMarkdownSpan,\n\tTableNode,\n} from '@orkestrel/markdown'\nimport type {\n\tDeclaration,\n\tDeclarationHead,\n\tDeclarationKeyword,\n\tDrift,\n\tFenceImport,\n\tGuideFence,\n\tGuideInterface,\n\tGuideModule,\n\tMethodEntry,\n\tMethodGroup,\n\tParityFinding,\n\tSourceComment,\n\tSourceExample,\n\tSourceInterface,\n\tSourceLine,\n\tSurfaceSymbol,\n} from './types.js'\nimport {\n\tcoalesceText,\n\tcreateMarkdown,\n\tflattenText,\n\tisBlockquoteNode,\n\tisCodeBlockNode,\n\tisCodeSpanNode,\n\tisEmphasisNode,\n\tisHeadingNode,\n\tisImageNode,\n\tisLinkNode,\n\tisParagraphNode,\n\tisTableNode,\n\trenderMarkdown,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport { isNonEmptyString, isString } from '@orkestrel/contract'\nimport {\n\tEXTERNAL_SCHEMES,\n\tKIND,\n\tMETHODS,\n\tSUMMARY,\n\tSURFACE,\n\tTESTS,\n\tWRAP_WIDTH,\n} from './constants.js'\nimport { isExportKeyword } from './validators.js'\n\n/**\n * Extracts aligned physical source-line records in one character traversal.\n * Real line and block comments and complete template tokens become spaces in\n * {@link SourceLine.code}, while ordinary code, quoted strings, and recognized\n * regex literals retain their columns. Genuine JSDoc opened from reflection\n * code is retained span by span at its exact physical column in\n * {@link SourceLine.jsdoc}; faux openers in comments and templates are\n * excluded. Membership remains each consumer's separate anchored grammar.\n *\n * @remarks\n * Regex recognition is a bounded lexical goal rather than TypeScript parser\n * grammar. Literal ECMAScript Unicode identifiers participate in slash-state\n * recognition, including private identifiers, without decoding escaped\n * identifier spellings. Slash after bare `}` is division, and a post-brace\n * regex statement requires an explicit `;`. General semicolonless\n * declaration/ASI classification is outside this finite projector, so callers\n * place an explicit `;` before a slash-leading statement after such a\n * declaration.\n *\n * @param source - The TypeScript source text to project\n * @returns One aligned terminator-free record per LF or CRLF physical line, including the final line\n *\n * @example Project source into physical code lines\n * ```ts\n * import { extractSourceLines } from '@orkestrel/guide'\n *\n * extractSourceLines('export const visible = true // note\\n')\n * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }]\n * // … one record per remaining line\n * ```\n */\nexport function extractSourceLines(source: string): readonly SourceLine[] {\n\tconst lines: SourceLine[] = []\n\tlet characters: string[] = []\n\tlet jsdocCharacters: string[] = []\n\tconst identifier = /#?[$_\\p{ID_Start}][$_\\u200C\\u200D\\p{ID_Continue}]*/uy\n\tconst templates: number[] = []\n\tconst parentheses: Array<{ role: string; phase: string; binding: boolean }> = []\n\tlet start = 0\n\tlet mode = 'code'\n\tlet escaped = false\n\tlet regexClass = false\n\tlet operandExpected = true\n\tlet memberExpected = false\n\tlet pendingRole: string | undefined\n\tlet restricted: string | undefined\n\tlet separated = false\n\tlet blockTemplate = false\n\tlet lineTemplate = false\n\tlet jsdoc = false\n\tlet jsdocPresent = false\n\n\tfor (let offset = 0; offset < source.length; offset += 1) {\n\t\tconst character = source[offset]\n\t\tif (character === undefined) continue\n\t\tconst next = source[offset + 1]\n\t\tconst crlf = character === '\\r' && next === '\\n'\n\t\tif (character === '\\n' || crlf) {\n\t\t\tconst code = characters.join('')\n\t\t\tconst present = jsdocPresent || jsdoc\n\t\t\tlines.push({\n\t\t\t\tsource: source.slice(start, offset),\n\t\t\t\tcode,\n\t\t\t\tjsdoc: present ? jsdocCharacters.join('').padEnd(code.length, ' ') : undefined,\n\t\t\t})\n\t\t\tcharacters = []\n\t\t\tjsdocCharacters = []\n\t\t\tjsdocPresent = jsdoc\n\t\t\tif (mode !== 'template') separated = true\n\t\t\tif (restricted !== undefined) {\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = undefined\n\t\t\t}\n\t\t\tif (crlf) offset += 1\n\t\t\tstart = offset + 1\n\n\t\t\tif (mode === 'line') mode = lineTemplate ? 'templateCode' : 'code'\n\t\t\telse if (mode === 'regex') {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = true\n\t\t\t\tregexClass = false\n\t\t\t} else if (mode === 'templateLine' || mode === 'templateRegex') {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = true\n\t\t\t\tregexClass = false\n\t\t\t} else if (mode === 'single' || mode === 'double') {\n\t\t\t\tif (!escaped) {\n\t\t\t\t\tmode = 'code'\n\t\t\t\t\toperandExpected = true\n\t\t\t\t}\n\t\t\t} else if (mode === 'templateSingle' || mode === 'templateDouble') {\n\t\t\t\tif (!escaped) {\n\t\t\t\t\tmode = 'templateCode'\n\t\t\t\t\toperandExpected = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tescaped = false\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'line' || mode === 'templateLine') {\n\t\t\tcharacters.push(' ')\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'block' || mode === 'templateBlock') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (jsdoc) jsdocCharacters.push(character)\n\t\t\tif (character === '*' && next === '/') {\n\t\t\t\tcharacters.push(' ')\n\t\t\t\tif (jsdoc) {\n\t\t\t\t\tjsdocCharacters.push('/')\n\t\t\t\t\tjsdoc = false\n\t\t\t\t}\n\t\t\t\toffset += 1\n\t\t\t\tmode = blockTemplate ? 'templateCode' : 'code'\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'single' || mode === 'double') {\n\t\t\tcharacters.push(character)\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ((mode === 'single' && character === \"'\") || (mode === 'double' && character === '\"')) {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'regex') {\n\t\t\tcharacters.push(character)\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '[') regexClass = true\n\t\t\telse if (character === ']') regexClass = false\n\t\t\telse if (character === '/' && !regexClass) {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'templateSingle' || mode === 'templateDouble') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (\n\t\t\t\t(mode === 'templateSingle' && character === \"'\") ||\n\t\t\t\t(mode === 'templateDouble' && character === '\"')\n\t\t\t) {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'templateRegex') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '[') regexClass = true\n\t\t\telse if (character === ']') regexClass = false\n\t\t\telse if (character === '/' && !regexClass) {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'template') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '$' && next === '{') {\n\t\t\t\tcharacters.push(' ')\n\t\t\t\toffset += 1\n\t\t\t\tconst index = templates.length - 1\n\t\t\t\tif (index >= 0) templates[index] = 1\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '`') {\n\t\t\t\ttemplates.pop()\n\t\t\t\tmode = templates.length === 0 ? 'code' : 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst templateCode = mode === 'templateCode'\n\t\tif (character === '/' && next === '/') {\n\t\t\tcharacters.push(' ', ' ')\n\t\t\toffset += 1\n\t\t\tlineTemplate = templateCode\n\t\t\tmode = templateCode ? 'templateLine' : 'line'\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '/' && next === '*') {\n\t\t\tcharacters.push(' ', ' ')\n\t\t\tif (!templateCode && source[offset + 2] === '*') {\n\t\t\t\tconst column = offset - start\n\t\t\t\tconst width = jsdocCharacters.join('').length\n\t\t\t\tjsdocCharacters.push(' '.repeat(column - width), '/', '*')\n\t\t\t\tjsdoc = true\n\t\t\t\tjsdocPresent = true\n\t\t\t}\n\t\t\toffset += 1\n\t\t\tblockTemplate = templateCode\n\t\t\tmode = templateCode ? 'templateBlock' : 'block'\n\t\t\tcontinue\n\t\t}\n\n\t\tif (character === \"'\") {\n\t\t\tcharacters.push(templateCode ? ' ' : character)\n\t\t\tmode = templateCode ? 'templateSingle' : 'single'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '\"') {\n\t\t\tcharacters.push(templateCode ? ' ' : character)\n\t\t\tmode = templateCode ? 'templateDouble' : 'double'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '`') {\n\t\t\tcharacters.push(' ')\n\t\t\ttemplates.push(0)\n\t\t\tmode = 'template'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tconst visible = templateCode ? ' ' : character\n\t\tif (character === '/' && next === '=' && !operandExpected) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '=')\n\t\t\toffset += 1\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '/') {\n\t\t\tcharacters.push(visible)\n\t\t\tif (operandExpected) {\n\t\t\t\tmode = templateCode ? 'templateRegex' : 'regex'\n\t\t\t\tescaped = false\n\t\t\t\tregexClass = false\n\t\t\t} else {\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t}\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tidentifier.lastIndex = offset\n\t\tconst identifierMatch = identifier.exec(source)\n\t\tif (identifierMatch !== null) {\n\t\t\tconst token = identifierMatch[0]\n\t\t\tcharacters.push(templateCode ? ' '.repeat(token.length) : token)\n\t\t\tif (token.startsWith('#')) {\n\t\t\t\toperandExpected = false\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = undefined\n\t\t\t\tseparated = false\n\t\t\t\toffset += token.length - 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tconst label = restricted === 'label'\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tif (memberExpected) {\n\t\t\t\tmemberExpected = false\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t} else if (label) {\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = 'complete'\n\t\t\t} else if (/^(?:if|while|with)$/.test(token)) {\n\t\t\t\tpendingRole = 'statement'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'for') {\n\t\t\t\tpendingRole = 'for'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'export') {\n\t\t\t\tpendingRole = 'export'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'default' && pendingRole === 'export') {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:switch|catch)$/.test(token)) {\n\t\t\t\tpendingRole = 'block'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'await' && pendingRole === 'for') {\n\t\t\t\toperandExpected = true\n\t\t\t} else if (\n\t\t\t\t/^(?:return|throw|case|delete|void|typeof|new|await|yield|else|do|extends)$/.test(token)\n\t\t\t) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:in|instanceof)$/.test(token)) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:break|continue)$/.test(token)) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = false\n\t\t\t\trestricted = 'label'\n\t\t\t} else if (token === 'debugger') {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = false\n\t\t\t\trestricted = 'complete'\n\t\t\t} else if (\n\t\t\t\ttoken === 'of' &&\n\t\t\t\tframe?.role === 'for' &&\n\t\t\t\tframe.phase === 'left' &&\n\t\t\t\t!frame.binding &&\n\t\t\t\t!operandExpected\n\t\t\t) {\n\t\t\t\tframe.phase = 'right'\n\t\t\t\toperandExpected = true\n\t\t\t\tpendingRole = undefined\n\t\t\t} else if (\n\t\t\t\t/^(?:const|let|var)$/.test(token) &&\n\t\t\t\tframe?.role === 'for' &&\n\t\t\t\tframe.phase === 'left'\n\t\t\t) {\n\t\t\t\tframe.binding = true\n\t\t\t\toperandExpected = true\n\t\t\t\tpendingRole = undefined\n\t\t\t} else {\n\t\t\t\tif (frame?.binding === true) frame.binding = false\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t}\n\t\t\toffset += token.length - 1\n\t\t\tcontinue\n\t\t}\n\t\tif (/[0-9]/.test(character)) {\n\t\t\tlet end = offset + 1\n\t\t\twhile (end < source.length) {\n\t\t\t\tconst part = source[end]\n\t\t\t\tif (part === undefined || !/[A-Za-z0-9_$.]/.test(part)) break\n\t\t\t\tend += 1\n\t\t\t}\n\t\t\tconst token = source.slice(offset, end)\n\t\t\tcharacters.push(templateCode ? ' '.repeat(token.length) : token)\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\toffset = end - 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif (\n\t\t\t(character === '!' && next === '=' && source[offset + 2] === '=') ||\n\t\t\t(character === '=' && next === '=' && source[offset + 2] === '=')\n\t\t) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : source.slice(offset + 1, offset + 3))\n\t\t\toffset += 2\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif ((character === '!' || character === '=') && next === '=') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '=')\n\t\t\toffset += 1\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif ((character === '+' && next === '+') || (character === '-' && next === '-')) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : next)\n\t\t\toffset += 1\n\t\t\tif (separated) operandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '.' && next === '.' && source[offset + 2] === '.') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '..')\n\t\t\toffset += 2\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '?' && next === '.') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '.')\n\t\t\toffset += 1\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = true\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\n\t\tcharacters.push(visible)\n\t\tif (/\\s/.test(character)) continue\n\t\tseparated = false\n\t\trestricted = undefined\n\t\tif (character === '(') {\n\t\t\tparentheses.push({ role: pendingRole ?? 'plain', phase: 'left', binding: false })\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ')') {\n\t\t\tconst frame = parentheses.pop()\n\t\t\toperandExpected = frame?.role === 'statement' || frame?.role === 'for'\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ';') {\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tif (frame?.role === 'for' && frame.phase === 'left') frame.phase = 'classic'\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '.') {\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = true\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ']' || character === '}') {\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tif (frame?.role === 'for' && frame.phase === 'left' && frame.binding) {\n\t\t\t\tframe.binding = false\n\t\t\t}\n\t\t}\n\t\tif (character === ']') operandExpected = false\n\t\telse if (character === '}') {\n\t\t\tconst index = templates.length - 1\n\t\t\tconst depth = templates[index]\n\t\t\tif (templateCode && index >= 0 && depth !== undefined) {\n\t\t\t\ttemplates[index] = depth - 1\n\t\t\t\tif (depth === 1) mode = 'template'\n\t\t\t}\n\t\t\toperandExpected = false\n\t\t} else if (character === '{') {\n\t\t\tconst index = templates.length - 1\n\t\t\tconst depth = templates[index]\n\t\t\tif (templateCode && index >= 0 && depth !== undefined) templates[index] = depth + 1\n\t\t\toperandExpected = true\n\t\t} else if (character !== '!') operandExpected = true\n\t\tmemberExpected = false\n\t\tpendingRole = undefined\n\t}\n\n\tconst code = characters.join('')\n\tconst present = jsdocPresent || jsdoc\n\tlines.push({\n\t\tsource: source.slice(start),\n\t\tcode,\n\t\tjsdoc: present ? jsdocCharacters.join('').padEnd(code.length, ' ') : undefined,\n\t})\n\treturn lines\n}\n\n/**\n * Checks whether an opaque inventory key contains only canonical slash-separated\n * segments. Empty, `.` and `..` segments are rejected without rewriting the\n * key; ordinary dotfile segments remain valid.\n *\n * @param key - The opaque inventory key to inspect\n * @returns True if every segment is canonical; false otherwise\n *\n * @example\n * ```ts\n * hasCanonicalSegments('src/.hidden.ts') // true\n * hasCanonicalSegments('src/../alias.ts') // false\n * ```\n */\nexport function hasCanonicalSegments(key: string): boolean {\n\treturn key.split('/').every((segment) => segment !== '' && segment !== '.' && segment !== '..')\n}\n\n/**\n * Normalizes a module scope to its canonical directory list. `'.'` represents\n * workspace root; empty, trailing, and dot-segment spellings reduce through\n * {@link resolvePath}, and duplicates are removed in first-seen order.\n *\n * @param module - The module scope to normalize\n * @returns The directory list `module` denotes\n *\n * @example\n * ```ts\n * normalizeDirectories('src/core') // ['src/core']\n * normalizeDirectories(['src/core', 'src/browser']) // ['src/core', 'src/browser']\n * ```\n */\nexport function normalizeDirectories(module: GuideModule): readonly string[] {\n\tconst directories: string[] = []\n\tconst seen = new Set<string>()\n\tfor (const value of isString(module) ? [module] : module) {\n\t\tconst directory = resolvePath('.', value)\n\t\tif (seen.has(directory)) continue\n\t\tseen.add(directory)\n\t\tdirectories.push(directory)\n\t}\n\treturn directories\n}\n\n/**\n * Computes the stable cache key for a {@link GuideModule}. Directories normalize before\n * joining, so equivalent module spellings share one key. The NUL separator\n * cannot occur in filesystem-backed canonical-segment inventory keys, so no\n * directory boundary can collide with directory text.\n *\n * @param module - The module scope to key\n * @returns The normalized directories joined by NUL\n *\n * @example\n * ```ts\n * computeModuleKey(['src/core', 'src/browser']) // 'src/core\\0src/browser'\n * ```\n */\nexport function computeModuleKey(module: GuideModule): string {\n\treturn normalizeDirectories(module).join('\\0')\n}\n\n/**\n * Selects the exact opaque file-inventory keys belonging under any canonical\n * {@link GuideModule} directory, sorted. `'.'` selects canonical root-relative\n * keys without accepting `/`, `./`, or `../` aliases. Every selected exact\n * `index.ts` and every `.test.ts` key is excluded independent of scope order.\n *\n * @param files - The workspace file inventory, root-relative path → file text\n * @param module - The module scope to filter to\n * @returns The scope's file keys, root-relative and sorted\n *\n * @example\n * ```ts\n * selectModuleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']\n * ```\n */\nexport function selectModuleKeys(\n\tfiles: Readonly<Record<string, string>>,\n\tmodule: GuideModule,\n): readonly string[] {\n\tconst dirs = normalizeDirectories(module)\n\tconst indexes = new Set(dirs.map((directory) => resolvePath(directory, 'index.ts')))\n\tconst keys: string[] = []\n\n\tfor (const key of Object.keys(files)) {\n\t\tif (!hasCanonicalSegments(key)) continue\n\t\tif (!key.endsWith('.ts')) continue\n\t\tif (key.endsWith('.test.ts')) continue\n\t\tif (\n\t\t\t!dirs.some((directory) => directory === '.' || key.startsWith(`${directory}/`)) ||\n\t\t\tindexes.has(key)\n\t\t) {\n\t\t\tcontinue\n\t\t}\n\n\t\tkeys.push(key)\n\t}\n\n\treturn keys.sort()\n}\n\n/**\n * Computes the bijection key for a surface symbol — `${keyword} ${name}` — so a symbol-set\n * comparison diffs (name, keyword) pairs rather than names alone.\n *\n * @param symbol - The symbol to key\n * @returns The `${keyword} ${name}` key\n *\n * @example\n * ```ts\n * computeSymbolKey({ name: 'Markdown', keyword: 'class' }) // 'class Markdown'\n * ```\n */\nexport function computeSymbolKey(symbol: SurfaceSymbol): string {\n\treturn `${symbol.keyword} ${symbol.name}`\n}\n\n/**\n * Finds the names present in `names` but absent from `source` — the set-difference\n * behind a both-directions bijection assertion.\n *\n * @param names - The candidate names\n * @param source - The names to compare against\n * @returns The names in `names` that are not in `source`\n *\n * @example\n * ```ts\n * findMissing(['a', 'b'], ['a']) // ['b']\n * ```\n */\nexport function findMissing(\n\tnames: readonly string[],\n\tsource: readonly string[],\n): readonly string[] {\n\tconst existing = new Set(source)\n\treturn names.filter((name) => !existing.has(name))\n}\n\n/**\n * Finds the fences whose language is absent from the caller's listed languages.\n * Untagged fences are always returned because they have no language to list.\n *\n * @param fences - The guide fences to check\n * @param languages - The listed language tags\n * @returns The unlisted fences in input order\n *\n * @example\n * ```ts\n * findUnlisted([{ language: 'typescript', code: 'walk()' }], ['ts'])\n * // [{ language: 'typescript', code: 'walk()' }]\n * ```\n */\nexport function findUnlisted(\n\tfences: readonly GuideFence[],\n\tlanguages: readonly string[],\n): readonly GuideFence[] {\n\tconst listed = new Set(languages)\n\treturn fences.filter((fence) => fence.language === undefined || !listed.has(fence.language))\n}\n\n/**\n * Finds the symbol-key set-difference between two symbol lists — `symbols` present but\n * absent from `source`, compared by {@link computeSymbolKey} so a symbol can drift in\n * neither name nor keyword.\n *\n * @param symbols - The candidate symbols\n * @param source - The symbols to compare against\n * @returns The symbol keys in `symbols` that are not in `source`\n *\n * @example\n * ```ts\n * findMissingSymbols([{ name: 'X', keyword: 'class' }], []) // ['class X']\n * ```\n */\nexport function findMissingSymbols(\n\tsymbols: readonly SurfaceSymbol[],\n\tsource: readonly SurfaceSymbol[],\n): readonly string[] {\n\treturn findMissing(symbols.map(computeSymbolKey), source.map(computeSymbolKey))\n}\n\n/**\n * Checks whether a source declares at least one behavioural member — a `class` or `interface`\n * in its surface that carries a call-signature member — so a guide owes a `## Methods` group only\n * where the source has one to document.\n *\n * @param source - The reflected source under parity\n * @returns True if a surface `class` or `interface` declares a member; false otherwise\n *\n * @example\n * ```ts\n * hasBehaviouralSurface(createSource({ files: { 'src/types.ts': 'export interface Widget { render(): void }' }, module: 'src' })) // true\n * hasBehaviouralSurface(createSource({ files: { 'src/constants.ts': 'export const NAMES = Object.freeze({})' }, module: 'src' })) // false\n * ```\n */\nexport function hasBehaviouralSurface(source: SourceInterface): boolean {\n\treturn source\n\t\t.surface()\n\t\t.some(\n\t\t\t(symbol) =>\n\t\t\t\t(symbol.keyword === 'class' || symbol.keyword === 'interface') &&\n\t\t\t\tsource.methods(symbol.name).length > 0,\n\t\t)\n}\n\n/**\n * Finds the names in `names` that have no example — a fence containing the name at a\n * word boundary in `fences`, or a membership in `examples`, both count as\n * \"has an example\"; presence-only, fence and JSDoc content are never checked.\n *\n * @param names - The candidate symbol/member names to check\n * @param fences - The guide's ```ts Patterns fence bodies to search\n * @param examples - The names already known to carry an `@example` JSDoc block\n * @returns The names in `names` with no fence mention and no `@example`\n *\n * @example\n * ```ts\n * findUnexampled(['walk', 'fold'], ['walk()'], []) // ['fold']\n * findUnexampled(['walk'], [], ['walk']) // []\n * ```\n */\nexport function findUnexampled(\n\tnames: readonly string[],\n\tfences: readonly string[],\n\texamples: readonly string[],\n): readonly string[] {\n\tconst exampled = new Set(examples)\n\treturn names.filter((name) => {\n\t\tif (exampled.has(name)) return false\n\t\tconst boundary = new RegExp(`\\\\b${escapeRegExp(name)}\\\\b`)\n\t\treturn !fences.some((fence) => boundary.test(fence))\n\t})\n}\n\n/**\n * Parses a fence's brace `import` statements into per-specifier imported identifier names —\n * `import type`, mixed multiline braces, and `x as y` aliases all count, each alias resolved to\n * the exported name `x` because that is the name the checked barrel surface must hold. Brace\n * bindings only: a default, namespace, side-effect, or mixed `import Default, { named }`\n * statement is not surfaced.\n *\n * @param fence - A ```ts Patterns fence's verbatim body text\n * @returns One entry per `import ... from 'specifier'` statement, in fence order\n *\n * @example\n * ```ts\n * extractFenceImports(\"import { a, b as c } from 'x'\\n\") // [{ specifier: 'x', names: ['a', 'b'] }]\n * ```\n */\nexport function extractFenceImports(fence: string): readonly FenceImport[] {\n\tconst results: FenceImport[] = []\n\tconst pattern = /import\\s+(?:type\\s+)?\\{([^}]*)\\}\\s*from\\s*['\"]([^'\"]+)['\"]/gs\n\n\tlet match: RegExpExecArray | null\n\twhile ((match = pattern.exec(fence)) !== null) {\n\t\tconst body = match[1]\n\t\tconst specifier = match[2]\n\t\tif (body === undefined || specifier === undefined) continue\n\n\t\tconst names = body\n\t\t\t.split(',')\n\t\t\t.map((part) => part.trim())\n\t\t\t.filter((part) => part.length > 0)\n\t\t\t.map((part) => part.replace(/^type\\s+/, ''))\n\t\t\t.map((part) => {\n\t\t\t\tconst asMatch = part.match(/^(\\w+)\\s+as\\s+\\w+$/)\n\t\t\t\treturn asMatch?.[1] ?? part\n\t\t\t})\n\t\t\t.filter((part) => /^\\w+$/.test(part))\n\n\t\tresults.push({ specifier, names })\n\t}\n\n\treturn results\n}\n\n/**\n * Checks whether a guides-parity link check skips a link `href` — an external\n * scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.\n *\n * @param href - The link destination\n * @returns True if a link check leaves the href unresolved against the filesystem; false otherwise\n *\n * @example\n * ```ts\n * isExternalLink('https://example.com') // true\n * isExternalLink('../helpers.ts') // false\n * ```\n */\nexport function isExternalLink(href: string): boolean {\n\tif (href.startsWith('#')) return true\n\treturn EXTERNAL_SCHEMES.some((scheme) => href.startsWith(scheme))\n}\n\n/**\n * Resolves a relative `target` from a root-relative `directory`, normalizing\n * forward-slash dot segments without filesystem or extension inference. A\n * parent pops only a retained real component; every excess leading parent is\n * preserved.\n *\n * @param directory - The root-relative directory to resolve from\n * @param target - The relative target to resolve\n * @returns The normalized path, or `'.'` when no segment remains, retaining every excess parent\n *\n * @example\n * ```ts\n * resolvePath('guides/src', '../../src/core/helpers.ts') // 'src/core/helpers.ts'\n * resolvePath('.', '../../outside.ts') // '../../outside.ts'\n * ```\n */\nexport function resolvePath(directory: string, target: string): string {\n\tconst combined = `${directory}/${target}`\n\tconst segments: string[] = []\n\n\tfor (const segment of combined.split('/')) {\n\t\tif (segment === '' || segment === '.') continue\n\t\tif (segment === '..') {\n\t\t\tconst previous = segments[segments.length - 1]\n\t\t\tif (previous !== undefined && previous !== '..') segments.pop()\n\t\t\telse segments.push(segment)\n\t\t\tcontinue\n\t\t}\n\t\tsegments.push(segment)\n\t}\n\n\treturn segments.length === 0 ? '.' : segments.join('/')\n}\n\n/**\n * Resolves a relative `target` from the directory containing a root-relative\n * declaring `file`. A slashless file belongs to the workspace root; path\n * reduction is delegated to {@link resolvePath}.\n *\n * @param file - The root-relative declaring file\n * @param target - The relative link destination to resolve\n * @returns The normalized path, retaining every excess leading parent\n *\n * @example\n * ```ts\n * resolveLink('guides/src/guide.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'\n * resolveLink('index.ts', './root.ts') // 'root.ts'\n * ```\n */\nexport function resolveLink(file: string, target: string): string {\n\tconst index = file.lastIndexOf('/')\n\tconst directory = index < 0 ? '.' : file.slice(0, index)\n\treturn resolvePath(directory, target)\n}\n\n/**\n * Finds the first code-span value by descending an inline node list, following\n * into `emphasis` / `link` / `image` children — the extraction rule behind a\n * Surface or Methods table row's first-column identifier.\n *\n * @param nodes - The inline nodes to search\n * @returns The first code span's literal text, or `undefined` when none is found\n *\n * @example\n * ```ts\n * findFirstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'\n * ```\n */\nexport function findFirstCode(nodes: readonly InlineNode[]): string | undefined {\n\tfor (const node of nodes) {\n\t\tif (isCodeSpanNode(node)) return node.value\n\t\tif (isEmphasisNode(node) || isLinkNode(node) || isImageNode(node)) {\n\t\t\tconst value = findFirstCode(node.children)\n\t\t\tif (value !== undefined) return value\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Extracts the link hrefs within one table cell's inline content, in walk order.\n *\n * @param cell - The cell's inline nodes\n * @returns The cell's link hrefs, in walk order\n *\n * @example\n * ```ts\n * extractCellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']\n * ```\n */\nexport function extractCellLinks(cell: readonly InlineNode[]): readonly string[] {\n\tconst links: string[] = []\n\tfor (const node of walkNodes({ element: 'paragraph', children: cell })) {\n\t\tif (isLinkNode(node)) links.push(node.href)\n\t}\n\treturn links\n}\n\n/**\n * Returns the identifier prefix of a code-span text — everything before its first `<`,\n * trimmed. Guide cells and headings may annotate a generic-parameterized name\n * (`MarkdownHandler<TNode, T>`) for readability, but the bijection key is the\n * bare identifier the source scanner captures, so both sides must normalize\n * the same way.\n *\n * @param code - A code span's literal text\n * @returns The identifier prefix, or an empty string when `code` is empty\n *\n * @example\n * ```ts\n * normalizeIdentifier('MarkdownHandler<TNode, T>') // 'MarkdownHandler'\n * normalizeIdentifier('fold') // 'fold'\n * ```\n */\nexport function normalizeIdentifier(code: string): string {\n\tconst index = code.indexOf('<')\n\treturn (index < 0 ? code : code.slice(0, index)).trim()\n}\n\n/**\n * Extracts compared inline content — the text of a table cell or candidate entity heading\n * flattened with every code span kept as a code span, so `` `Widget` `` reads the same wherever\n * the parity reader compares it. Emphasis drops to its text, a link drops to its text, an image\n * drops to its alternative text, and the markdown parser has already unescaped `\\|`.\n *\n * @param cell - The inline nodes to flatten\n * @returns The compared text, code spans included\n *\n * @example\n * ```ts\n * extractCellText([{ element: 'codeSpan', value: 'Widget' }]) // '`Widget`'\n * ```\n */\nexport function extractCellText(cell: readonly InlineNode[]): string {\n\tlet text = ''\n\tfor (const node of cell) {\n\t\tif (isCodeSpanNode(node)) text += `\\`${node.value}\\``\n\t\telse if (isEmphasisNode(node) || isLinkNode(node) || isImageNode(node)) {\n\t\t\ttext += extractCellText(node.children)\n\t\t} else text += flattenText(node)\n\t}\n\treturn text\n}\n\n/**\n * Builds one table cell's inline content from its compared text — the inverse of\n * {@link extractCellText}. A single-backtick run whose text carries no inner backtick and\n * neither a leading nor a trailing space becomes a code span; every other character, a backtick\n * included, becomes literal text, which `renderMarkdown` escapes so the rendered cell parses back\n * to the text this function was given.\n *\n * @remarks\n * The compared form spells every code span with one backtick per side, because\n * {@link extractCellText} emits `` `${value}` `` whatever delimiter the source used. A run this\n * function refuses is therefore a run no parsed cell produced, and emitting it as text is what\n * keeps the projection total: reading the rendered cell back through {@link extractCellText}\n * returns the text, so a rendered row and a hand-written row compare the same. A code span whose\n * own text carries a backtick or a boundary space is outside the compared form's fidelity in\n * either direction, and this function writes it as text rather than guessing a delimiter.\n *\n * @param text - The cell's compared text, as {@link extractCellText} returns it\n * @returns The cell's inline nodes, in text order\n *\n * @example\n * ```ts\n * buildCell('Holds a `Widget`.')\n * // [{ element: 'text', value: 'Holds a ' }, { element: 'codeSpan', value: 'Widget' }, { element: 'text', value: '.' }]\n * ```\n */\nexport function buildCell(text: string): readonly InlineNode[] {\n\tconst nodes: InlineNode[] = []\n\tconst spans = /`([^`]+)`/g\n\tlet cursor = 0\n\tlet span: RegExpExecArray | null\n\n\twhile ((span = spans.exec(text)) !== null) {\n\t\tconst value = span[1]\n\t\tif (value === undefined) continue\n\t\tif (span.index > cursor) nodes.push({ element: 'text', value: text.slice(cursor, span.index) })\n\t\tif (value.trim() === value) nodes.push({ element: 'codeSpan', value })\n\t\telse nodes.push({ element: 'text', value: span[0] })\n\t\tcursor = span.index + span[0].length\n\t}\n\tif (cursor < text.length) nodes.push({ element: 'text', value: text.slice(cursor) })\n\n\treturn coalesceText(nodes)\n}\n\n/**\n * Finds the index of the column whose header text is `header` so a table's columns survive\n * reordering. The match is exact and case-sensitive — a table without that exact header\n * contributes nothing to the projection reading it, so a `## Surface` table with no\n * {@link SUMMARY} column leaves every row's summary absent and {@link findDrift} reports each\n * of those rows, never agreement.\n *\n * @param table - The table to inspect\n * @param header - The exact header text to locate, for example `Kind`\n * @returns The column's index, or `undefined` when the table has no such header\n *\n * @example\n * ```ts\n * findColumnIndex(table, 'Kind') // 1, or undefined\n * ```\n */\nexport function findColumnIndex(table: TableNode, header: string): number | undefined {\n\tfor (let index = 0; index < table.header.length; index += 1) {\n\t\tconst cell = table.header[index]\n\t\tif (\n\t\t\tcell !== undefined &&\n\t\t\tflattenText({ element: 'paragraph', children: cell }).trim() === header\n\t\t) {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Extracts the module-scope exports declared in one file's source text — the declaration keys\n * {@link collectKeys} reports, each split back into the keyword and name that built it, deduped by\n * (keyword, name).\n *\n * @remarks\n * That one grammar matches `export (async)? (function(\\*)?|class|const|interface|type) Name`; a\n * generator export (`export function* walk`) keys as the `function` keyword, its trailing `*`\n * stripped before the {@link ExportKeyword} check. Scanning uses {@link extractSourceLines}, so\n * comment and template payload is excluded while its uninterrupted column-zero head remains\n * required; preserved columns do not grant membership to leading/interrupted comment forms. The\n * population is exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is outside\n * this reflection contract, not forbidden by general package policy.\n *\n * @param source - The file's source text\n * @returns The file's exported symbols, in file order\n *\n * @example\n * ```ts\n * extractExports('export class Markdown {}\\n') // [{ name: 'Markdown', keyword: 'class' }]\n * extractExports('export function* walk() {}\\n') // [{ name: 'walk', keyword: 'function' }]\n * ```\n */\nexport function extractExports(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst summaries = collectSummaries(lines)\n\tconst keys = collectKeys(lines)\n\n\tfor (const line of lines) {\n\t\tconst key = keys.get(line)\n\t\tif (key === undefined || seen.has(key)) continue\n\n\t\t// A declaration key is `${keyword} ${name}`, so its one space splits it back into the pair\n\t\t// that built it. A member key carries no space, so its keyword reads empty and the keyword\n\t\t// guard drops it here — no second head pattern excludes it.\n\t\tconst space = key.indexOf(' ')\n\t\tconst keyword = key.slice(0, Math.max(space, 0))\n\t\tif (!isExportKeyword(keyword)) continue\n\n\t\tseen.add(key)\n\t\tconst name = key.slice(space + 1)\n\t\tconst summary = summaries.get(line)\n\t\tsymbols.push({ name, keyword, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Extracts the module-scope declarations lacking the `export` keyword in one file's source text —\n * the mirror image of {@link extractExports}'s grammar, anchored the same way (column 0, so an\n * indented inner declaration never matches).\n *\n * @remarks\n * Scans only the {@link ExportKeyword} keywords (`function` / `class` / `const` / `interface` /\n * `type`) — a module-scope `let` or `var` is outside this scanner's declaration-keyword grammar\n * and out of this check's contract. Scanning uses {@link extractSourceLines}, so comment and\n * template payload is excluded while its uninterrupted column-zero head remains required;\n * preserved columns do not widen membership. `enum` is likewise outside this reflection\n * population, not forbidden by general package policy.\n *\n * @param source - The file's source text\n * @returns The file's hidden (non-exported) symbols, in file order\n *\n * @example\n * ```ts\n * extractHidden('function secretHelper() {}\\n') // [{ name: 'secretHelper', keyword: 'function' }]\n * extractHidden('export class X {}\\n') // []\n * ```\n */\nexport function extractHidden(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst summaries = collectSummaries(lines)\n\n\tfor (const line of lines) {\n\t\tif (line.code.startsWith('export ')) continue\n\t\tconst match = line.code.match(/^(?:async )?(function\\*?|class|const|interface|type) (\\w+)/)\n\t\tconst rawKeyword = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst keyword = rawKeyword === undefined ? undefined : rawKeyword.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(keyword) || !isNonEmptyString(name) || !isExportKeyword(keyword)) continue\n\n\t\tconst key = `${keyword} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tconst summary = summaries.get(line)\n\t\tsymbols.push({ name, keyword, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Joins the declaration head starting at `start` into one space-separated\n * line, consuming lines until the first that opens a body: one that ends with\n * `{`, or one that closes an empty body with `{}` or `{ }`.\n *\n * @remarks\n * A line ending with `{}` closes an empty body only when every angle, round,\n * and square bracket the head opened outside quoted text has closed; inside\n * one, `{}` is a type or an argument, and an arrow's `=>` closes nothing. A\n * head that reaches the next column-zero `export` line opens no body.\n *\n * @param lines - The file's source lines\n * @param start - The index of the head's first line\n * @returns The joined head, or `undefined` when no line opens a body\n *\n * @example\n * ```ts\n * joinHead(['export class X {'], 0) // { text: 'export class X {', end: 0 }\n * joinHead(['export interface Y extends X {}'], 0) // { text: 'export interface Y extends X {}', end: 0 }\n * ```\n */\nexport function joinHead(lines: readonly string[], start: number): DeclarationHead | undefined {\n\tconst parts: string[] = []\n\n\tfor (let index = start; index < lines.length; index += 1) {\n\t\tconst line = lines[index]\n\t\tif (line === undefined) break\n\t\tconst text = line.trimEnd()\n\t\t// A wrapped head never continues on an exported declaration, so reaching one means no body opened.\n\t\tif (index > start && text.startsWith('export ')) return undefined\n\t\tparts.push(index === start ? text : text.trimStart())\n\t\tif (text.endsWith('{')) return { text: parts.join(' '), end: index }\n\t\tconst bare = parts.join(' ').replace(/'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/g, '')\n\t\tconst closed =\n\t\t\t(bare.match(/</g)?.length ?? 0) <= (bare.match(/(?<!=)>/g)?.length ?? 0) &&\n\t\t\t(bare.match(/\\(/g)?.length ?? 0) <= (bare.match(/\\)/g)?.length ?? 0) &&\n\t\t\t(bare.match(/\\[/g)?.length ?? 0) <= (bare.match(/\\]/g)?.length ?? 0)\n\t\tif (closed && /\\{\\s*\\}$/.test(text)) return { text: parts.join(' '), end: index }\n\t}\n\n\treturn undefined\n}\n\n/**\n * Escapes every regex metacharacter in a literal string so it reads as text\n * inside a larger `RegExp` source rather than as syntax.\n *\n * @remarks\n * A caller-supplied name reaches a `RegExp` through this: {@link\n * findUnexampled} splices it into a word-boundary search, so a name carrying\n * `$`, `(`, `[`, or `.` matches that character literally instead of throwing or\n * matching text it does not name. Pure and total; never throws.\n *\n * @param value - The literal string to escape\n * @returns `value` with every regex metacharacter backslash-escaped\n *\n * @example\n * ```ts\n * escapeRegExp('A.B') // 'A\\\\.B'\n * new RegExp(`^${escapeRegExp('A.B')}$`).test('AxB') // false\n * ```\n */\nexport function escapeRegExp(value: string): string {\n\treturn value.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n}\n\n/**\n * Collects every `export class` / `export interface` declaration one file's source text declares,\n * each keyed `${keyword} ${name}` and carrying the body lines and the base identifiers read from\n * its own head, so a body and a heritage clause always come from the same declaration.\n *\n * @remarks\n * The whole file is projected once through {@link extractSourceLines} and every head is read from\n * that one projection, so a scope resolving many names reads each file once rather than once per\n * name. A head is a column-zero `export class` / `export interface` line, an oxfmt-wrapped\n * signature joined through {@link joinHead}, with an optional generic parameter list and an\n * optional heritage clause between the identifier and the opening `{`; the identifier is the head's\n * own run up to that list or clause, so it enters the key as literal text and no name reaches a\n * `RegExp`. Body lines are the raw source between the head and the first projected column-zero `}`,\n * keeping JSDoc evidence intact; a head whose last line closes its own body with `{}` or `{ }`\n * records an empty body. Every balanced `<...>` span is removed from the head before its\n * `extends` clause is read, so a `T extends Base` type parameter is never a base and `Base<T>`\n * reads as `Base`; a class's `implements` clause and everything after it is excluded, and a\n * qualified base such as `namespace.Base` is returned verbatim. The first head of a key that opens\n * a column-zero close answers for that key: a head that opens none records nothing, and a later\n * head of a key already collected adds nothing unless the earlier head recorded neither a body\n * nor bases, which declares nothing as {@link Source} reads it, so the later head replaces it.\n *\n * @param source - The file's source text to read\n * @returns One entry per collected declaration, keyed `${keyword} ${name}`\n *\n * @example\n * ```ts\n * collectDeclarations('export interface X extends Y {\\n\\twalk(): void\\n}\\n').get('interface X')\n * // { body: ['\\twalk(): void'], bases: ['Y'] }\n * ```\n */\nexport function collectDeclarations(source: string): ReadonlyMap<string, Declaration> {\n\tconst declarations = new Map<string, Declaration>()\n\tconst opener = /^export (?:class|interface) /\n\tconst grammar = /^export (class|interface) ([^\\s<]+)(?:<.*>)?(?: .*)? \\{(?:\\s*\\})?$/\n\tconst lines = extractSourceLines(source)\n\tconst projected = lines.map((line) => line.code)\n\n\tfor (let index = 0; index < projected.length; index += 1) {\n\t\tconst line = projected[index]\n\t\tif (line === undefined || !opener.test(line)) continue\n\n\t\tconst head = joinHead(projected, index)\n\t\tif (head === undefined) continue\n\t\tconst declared = grammar.exec(head.text)\n\t\tconst keyword = declared?.[1]\n\t\tconst name = declared?.[2]\n\t\tif (keyword === undefined || name === undefined) continue\n\n\t\tconst key = `${keyword} ${name}`\n\t\tconst known = declarations.get(key)\n\t\t// A head with neither a body nor bases declares nothing, as Source reads it, so a later head answers.\n\t\tif (known !== undefined && (known.body.length > 0 || known.bases.length > 0)) continue\n\n\t\tlet depth = 0\n\t\tlet flat = ''\n\t\tfor (const character of head.text.slice(`export ${key}`.length, head.text.lastIndexOf('{'))) {\n\t\t\tif (character === '<') depth += 1\n\t\t\telse if (character === '>') depth = Math.max(0, depth - 1)\n\t\t\telse if (depth === 0) flat += character\n\t\t}\n\t\tconst clause = flat.replace(/\\bimplements\\b[\\s\\S]*$/, '').match(/\\bextends\\b([\\s\\S]*)$/)?.[1]\n\t\tconst bases =\n\t\t\tclause === undefined\n\t\t\t\t? []\n\t\t\t\t: clause\n\t\t\t\t\t\t.split(',')\n\t\t\t\t\t\t.map((base) => base.trim())\n\t\t\t\t\t\t.filter(isNonEmptyString)\n\n\t\t// joinHead ends a head on `}` only where its line closes an empty body, so no close follows it.\n\t\tif (head.text.endsWith('}')) {\n\t\t\tdeclarations.set(key, { body: [], bases })\n\t\t\tcontinue\n\t\t}\n\n\t\tfor (let close = head.end + 1; close < projected.length; close += 1) {\n\t\t\tif (projected[close] !== '}') continue\n\t\t\tdeclarations.set(key, {\n\t\t\t\tbody: lines.slice(head.end + 1, close).map((record) => record.source),\n\t\t\t\tbases,\n\t\t\t})\n\t\t\tbreak\n\t\t}\n\n\t\t// An unterminated body records nothing — keep scanning in case a later head closes.\n\t}\n\n\treturn declarations\n}\n\n/**\n * Locates the named `export class` / `export interface` declaration in one file's source text\n * and returns its body lines and its base identifiers read from that one head, so a body and a\n * heritage clause always come from the same declaration, or `undefined` when the file declares\n * no such head.\n *\n * @remarks\n * The one named lookup over {@link collectDeclarations}, which owns the head grammar, the body\n * window, and the base reading. This lookup spells the map's `${keyword} ${name}` key for its\n * caller, so a consumer reading one name never writes that convention itself. `name` is compared\n * as literal text against the identifier the head itself carries, so a metacharacter in `name`\n * names that character rather than matching text it does not name. Every call collects the whole\n * file afresh: a consumer reading many names from one file calls {@link collectDeclarations} once\n * and reads the map, and {@link Source} holds one such map per module scope.\n *\n * @param source - The file's source text to search\n * @param keyword - Whether to look for a `class` or an `interface`\n * @param name - The declaration's identifier\n * @returns Its body and bases, or `undefined` when `source` declares no such head\n *\n * @example\n * ```ts\n * extractDeclaration('export interface X extends Y {\\n\\twalk(): void\\n}\\n', 'interface', 'X')\n * // { body: ['\\twalk(): void'], bases: ['Y'] }\n * ```\n */\nexport function extractDeclaration(\n\tsource: string,\n\tkeyword: DeclarationKeyword,\n\tname: string,\n): Declaration | undefined {\n\treturn collectDeclarations(source).get(`${keyword} ${name}`)\n}\n\n/**\n * Selects the member lines declaring a callable member: plain, `async`, generator\n * (`*`), and optional (`records?(`) methods all count; getters, setters,\n * `static` members, and `#` privates never do (their keyword or `#` breaks\n * the `name(` shape). The grammar is {@link collectKeys}'s, read once over\n * {@link extractBodyLines}'s projection of the body, so commented method-like payload never\n * becomes eligible and each member keys to the owner head that projection supplies. Each member\n * carries its own doc block's description paragraph, read through {@link collectSummaries}; the\n * first declaration of a name answers for it.\n *\n * @param lines - A declaration's body lines\n * @returns The declared members, deduplicated by name and sorted by name\n *\n * @example\n * ```ts\n * extractMemberMethods(['\\tmap(): void', '\\tfilter(): void']) // [{ name: 'filter' }, { name: 'map' }]\n * ```\n */\nexport function extractMemberMethods(lines: readonly string[]): readonly MethodEntry[] {\n\tconst methods = new Map<string, MethodEntry>()\n\tconst projected = extractBodyLines(lines)\n\tconst summaries = collectSummaries(projected)\n\tconst keys = collectKeys(projected)\n\n\tfor (const line of projected) {\n\t\t// A member key is `${owner}.${member}`, so its dot splits the member name back out and a\n\t\t// declaration key, which carries none, drops out here.\n\t\tconst key = keys.get(line) ?? ''\n\t\tconst dot = key.indexOf('.')\n\t\tif (dot < 0) continue\n\n\t\tconst name = key.slice(dot + 1)\n\t\tif (methods.has(name)) continue\n\t\tconst summary = summaries.get(line)\n\t\tmethods.set(name, { name, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn Array.from(methods.values()).sort((a, b) =>\n\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t)\n}\n\n/**\n * Selects the block nodes under the named `##` heading, up to the next `##`-or-higher\n * heading (or the document's end) — the section-scoping window `extractSurface` /\n * `extractMethods` walk over.\n *\n * @param document - The parsed guide document\n * @param heading - The `##` heading text to scope to, for example `Surface`\n * @returns The blocks belonging to that section, in document order\n *\n * @example\n * ```ts\n * selectSectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`\n * ```\n */\nexport function selectSectionBlocks(\n\tdocument: MarkdownDocument,\n\theading: string,\n): readonly BlockNode[] {\n\tconst blocks: BlockNode[] = []\n\tlet active = false\n\n\tfor (const block of document.children) {\n\t\tif (isHeadingNode(block) && block.level <= 2) {\n\t\t\tif (block.level === 2 && flattenText(block).trim() === heading) {\n\t\t\t\tactive = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (active) break\n\t\t}\n\n\t\tif (active) blocks.push(block)\n\t}\n\n\treturn blocks\n}\n\n/**\n * Extracts one `## Surface` table row's symbol — its column 0 code span as the name, its\n * {@link KIND} column as the keyword, and its {@link SUMMARY} column as the compared summary\n * when the table has that column. A row with no code-span name and a row whose `Kind` text is\n * no {@link ExportKeyword} have no symbol to key, so each returns `undefined`.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's symbol, or `undefined` when the row keys none\n *\n * @example\n * ```ts\n * extractRowSymbol(table, 0) // { name: 'walk', keyword: 'function', summary: 'Walks the tree.' }\n * ```\n */\nexport function extractRowSymbol(table: TableNode, row: number): SurfaceSymbol | undefined {\n\tconst cells = table.rows[row]\n\tif (cells === undefined) return undefined\n\n\tconst nameCell = cells[0]\n\tconst rawName = nameCell === undefined ? undefined : findFirstCode(nameCell)\n\tconst name = rawName === undefined ? undefined : normalizeIdentifier(rawName)\n\tif (name === undefined) return undefined\n\n\tconst column = findColumnIndex(table, KIND)\n\tconst kindCell = column === undefined ? undefined : cells[column]\n\tconst keyword =\n\t\tkindCell === undefined ? '' : flattenText({ element: 'paragraph', children: kindCell }).trim()\n\tif (!isExportKeyword(keyword)) return undefined\n\n\tconst summary = extractRowSummary(table, row)\n\treturn { name, keyword, ...(summary === undefined ? {} : { summary }) }\n}\n\n/**\n * Extracts one `## Methods` table row's entry — its column 0 code span as the name and its\n * {@link SUMMARY} column as the compared summary when the table has that column. A row with no\n * code-span name has no member to key, so it returns `undefined`.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's entry, or `undefined` when the row keys none\n *\n * @example\n * ```ts\n * extractRowEntry(table, 0) // { name: 'walk', summary: 'Walks the tree.' }\n * ```\n */\nexport function extractRowEntry(table: TableNode, row: number): MethodEntry | undefined {\n\tconst cells = table.rows[row]\n\tif (cells === undefined) return undefined\n\n\tconst cell = cells[0]\n\tconst rawName = cell === undefined ? undefined : findFirstCode(cell)\n\tconst name = rawName === undefined ? undefined : normalizeIdentifier(rawName)\n\tif (name === undefined) return undefined\n\n\tconst summary = extractRowSummary(table, row)\n\treturn { name, ...(summary === undefined ? {} : { summary }) }\n}\n\n/**\n * Extracts one row's compared summary — its {@link SUMMARY} column read through\n * {@link extractCellText} and {@link normalizeSummary}. A table with no such column and a row\n * whose cell is empty each carry no summary and return `undefined` rather than an empty string,\n * so {@link findDrift} reports the absence.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's compared summary, or `undefined` when it carries none\n *\n * @example\n * ```ts\n * extractRowSummary(table, 0) // 'Walks the tree.'\n * ```\n */\nexport function extractRowSummary(table: TableNode, row: number): string | undefined {\n\tconst described = findColumnIndex(table, SUMMARY)\n\tconst cells = table.rows[row]\n\tconst cell = described === undefined || cells === undefined ? undefined : cells[described]\n\tconst summary = cell === undefined ? '' : normalizeSummary(extractCellText(cell))\n\treturn summary.length === 0 ? undefined : summary\n}\n\n/**\n * Extracts every `## Surface` identifier the guide documents — each table row's column 0\n * code span (the name) paired with its `Kind` column (located by header text), unioned with every\n * H3 entity heading whose trimmed compared inline content is exactly its backticked code-span\n * name, deduped by {@link computeSymbolKey}. A row with no code-span name has no name to key a\n * symbol on, so this reader skips it and {@link extractUnnamed} reports it; a row with an\n * unrecognized `Kind` text is skipped. A row also carries its {@link SUMMARY} column's compared\n * text when the table has that column; a table without it leaves every row's summary absent,\n * which {@link findDrift} reports.\n *\n * @remarks\n * The heading boundary compares {@link extractCellText} with the raw value from\n * {@link findFirstCode} before {@link normalizeIdentifier} strips a generic annotation.\n * Surrounding spaces, emphasis, and links preserve that identity. This reader refuses a heading\n * carrying any other visible text or an additional code span. Entries retain encounter order, and\n * the first-seen name + keyword wins: a genuine heading before its table row keeps the heading's\n * summary-less class entry, while a table row before that heading keeps its `Summary`.\n *\n * @param document - The parsed guide document\n * @returns The documented surface, in encounter order\n *\n * @example\n * ```ts\n * extractSurface(document) // [{ name: 'Markdown', keyword: 'class' }, ...]\n * ```\n */\nexport function extractSurface(document: MarkdownDocument): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const block of selectSectionBlocks(document, SURFACE)) {\n\t\tif (isTableNode(block)) {\n\t\t\tfor (let row = 0; row < block.rows.length; row += 1) {\n\t\t\t\tconst symbol = extractRowSymbol(block, row)\n\t\t\t\tif (symbol === undefined) continue\n\t\t\t\tconst key = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(key)) continue\n\t\t\t\tseen.add(key)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isHeadingNode(block) && block.level === 3) {\n\t\t\tconst rawName = findFirstCode(block.children)\n\t\t\tif (rawName === undefined || extractCellText(block.children).trim() !== `\\`${rawName}\\``) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst name = normalizeIdentifier(rawName)\n\t\t\tconst symbol: SurfaceSymbol = { name, keyword: 'class' }\n\t\t\tconst key = computeSymbolKey(symbol)\n\t\t\tif (seen.has(key)) continue\n\t\t\tseen.add(key)\n\t\t\tsymbols.push(symbol)\n\t\t}\n\t}\n\n\treturn symbols\n}\n\n/**\n * Extracts one {@link MethodGroup} per documented behavioral interface in `## Methods` —\n * an H4 with a code span sets the current interface, and the table immediately\n * following becomes its documented methods. A row with no code-span name has no name to key a\n * member on, so this reader skips it and {@link extractUnnamed} reports it. Each row carries its\n * {@link SUMMARY} column's compared text when the table has that column.\n *\n * @param document - The parsed guide document\n * @returns The documented method groups, in document order\n *\n * @example\n * ```ts\n * extractMethods(document) // [{ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }]\n * ```\n */\nexport function extractMethods(document: MarkdownDocument): readonly MethodGroup[] {\n\tconst groups: MethodGroup[] = []\n\n\tfor (const [table, name] of collectGroups(document)) {\n\t\tconst methods: MethodEntry[] = []\n\t\tfor (let row = 0; row < table.rows.length; row += 1) {\n\t\t\tconst entry = extractRowEntry(table, row)\n\t\t\tif (entry !== undefined) methods.push(entry)\n\t\t}\n\t\tgroups.push({ interface: name, methods })\n\t}\n\n\treturn groups\n}\n\n/**\n * Collects each `## Methods` table keyed to the interface its `####` heading names — an H4\n * carrying a code span sets the current interface and the table immediately following claims it,\n * so a heading with no table and a table with no heading before it contribute nothing. The map\n * iterates in document order and a node keys itself, so a repeated identical table keeps its own\n * entry.\n *\n * @param document - The parsed guide document\n * @returns One entry per documented `## Methods` table, in document order\n *\n * @example\n * ```ts\n * collectGroups(document).values().next().value // 'GuideInterface'\n * ```\n */\nexport function collectGroups(document: MarkdownDocument): ReadonlyMap<TableNode, string> {\n\tconst groups = new Map<TableNode, string>()\n\tlet current: string | undefined\n\n\tfor (const block of selectSectionBlocks(document, METHODS)) {\n\t\tif (isHeadingNode(block) && block.level === 4) {\n\t\t\tconst rawInterface = findFirstCode(block.children)\n\t\t\tcurrent = rawInterface === undefined ? undefined : normalizeIdentifier(rawInterface)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isTableNode(block) && current !== undefined) {\n\t\t\tgroups.set(block, current)\n\t\t\tcurrent = undefined\n\t\t}\n\t}\n\n\treturn groups\n}\n\n/**\n * Extracts every `## Surface` or `## Methods` table row whose first cell carries no code span.\n * {@link extractSurface} and {@link extractMethods} skip such a row, because a row with no\n * name gives them nothing to key a symbol or a member on, and this projection is what reports\n * the skip. Each entry is the row's cells read through {@link extractCellText} and joined\n * by ` | `, so a reader can locate the row in the guide; the `## Surface` rows come first,\n * then the `## Methods` rows, each in document order. {@link GuideInterface.unnamed} caches it.\n *\n * @param document - The parsed guide document\n * @returns One entry per row carrying no code-span name\n *\n * @example\n * ```ts\n * extractUnnamed(document) // ['Widget | class | Represents a widget.']\n * ```\n */\nexport function extractUnnamed(document: MarkdownDocument): readonly string[] {\n\tconst unnamed: string[] = []\n\n\tfor (const heading of [SURFACE, METHODS]) {\n\t\tfor (const block of selectSectionBlocks(document, heading)) {\n\t\t\tif (!isTableNode(block)) continue\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst cell = row[0]\n\t\t\t\tif (cell !== undefined && findFirstCode(cell) !== undefined) continue\n\t\t\t\tunnamed.push(row.map((content) => extractCellText(content)).join(' | '))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn unnamed\n}\n\n/**\n * Extracts every link href in the guide document, including table cells — a full,\n * depth-first walk of the whole AST.\n *\n * @param document - The parsed guide document\n * @returns Every link's href, in walk order\n *\n * @example\n * ```ts\n * extractLinks(document) // ['../../src/core/helpers.ts', 'https://example.com']\n * ```\n */\nexport function extractLinks(document: MarkdownDocument): readonly string[] {\n\tconst links: string[] = []\n\tfor (const node of walkNodes(document)) {\n\t\tif (isLinkNode(node)) links.push(node.href)\n\t}\n\treturn links\n}\n\n/**\n * Extracts the relative test links declared under `## Tests` — every link href found\n * within that section only.\n *\n * @param document - The parsed guide document\n * @returns The `## Tests` section's link hrefs, in walk order\n *\n * @example\n * ```ts\n * extractTests(document) // ['../../tests/src/core/Markdown.test.ts', ...]\n * ```\n */\nexport function extractTests(document: MarkdownDocument): readonly string[] {\n\tconst links: string[] = []\n\tfor (const block of selectSectionBlocks(document, TESTS)) {\n\t\tfor (const node of walkNodes(block)) {\n\t\t\tif (isLinkNode(node)) links.push(node.href)\n\t\t}\n\t}\n\treturn links\n}\n\n/**\n * Returns the canonical body of one genuine JSDoc span — the `/**` opener, the closing\n * marker, each line's continuation marker, and the block's leading indentation removed,\n * with per-line trailing whitespace trimmed and the surrounding blank lines dropped. A\n * line's own indentation beyond the marker is kept, so an `@example` fence body keeps the\n * shape it was written in.\n *\n * @param comment - One complete genuine JSDoc span's raw text\n * @returns The span's unwrapped body\n *\n * @example\n * ```ts\n * normalizeComment('/**' + ' Creates a widget. *' + '/') // 'Creates a widget.'\n * ```\n */\nexport function normalizeComment(comment: string): string {\n\treturn unwrapComment(comment).join('\\n').replace(/^\\n+/, '').replace(/\\n+$/, '')\n}\n\n/**\n * Unwraps one genuine JSDoc span into one content line per physical line — the `/**` opener,\n * the closing marker, each line's continuation marker, and per-line trailing whitespace removed,\n * with a line's own indentation past the marker kept. The result is aligned with\n * `comment.split('\\n')`, so an index found in it addresses the same physical line of the span it\n * was built from, which is what lets a rewrite keep every line it does not replace.\n * {@link normalizeComment} is this projection joined and trimmed at its ends.\n *\n * @param comment - One complete genuine JSDoc span's raw text\n * @returns One content line per physical line of the span\n *\n * @example\n * ```ts\n * unwrapComment('/**' + '\\n * Walks.\\n *' + '/') // ['', 'Walks.', '']\n * ```\n */\nexport function unwrapComment(comment: string): readonly string[] {\n\tconst body = /^[ \\t]*\\/\\*([\\s\\S]*?)\\*\\/[ \\t]*$/.exec(comment)?.[1] ?? comment\n\treturn body.split('\\n').map((line) => line.replace(/^[ \\t]*\\*[ \\t]?/, '').replace(/[ \\t]+$/, ''))\n}\n\n/**\n * Returns the canonical compared form of a description paragraph. `{@link Target}` and\n * `{@link Target | label}` become the code token of the target text, or of the label where one is\n * written; a target's module part — the inline import form `import('./module.js').` and TSDoc's\n * package-qualified form `@scope/pkg#` — is dropped first. Every run of whitespace, including a\n * collapsed continuation marker and a line break, becomes one space, the ends trim, and a code\n * span keeps its delimiters while its own boundary whitespace goes. The guide's side and the\n * source's side read through this one form.\n *\n * @remarks\n * The clauses land in a fixed order, because each one decides what the next one sees. Every\n * single-backtick code span — one backtick per side, no inner backtick, no adjacent backtick —\n * is located first, so a delimiter the `{@link}` expansion inserts afterwards is never mistaken\n * for an authored one. The expansion then runs outside those spans\n * only, so a `{@link}` written inside a code span stays literal on both sides. Whitespace\n * collapses next, which is what makes a span wrapped across two physical lines comparable at\n * all. The boundary trim runs last, inside each located span: the markdown parser strips one\n * space from each end of a code span it reads, and this trim is the symmetric rule that meets\n * it, so `` ` | ` ``, `` ` |` ``, and `` `|` `` all reach `` `|` `` from either side. A span\n * whose content is all whitespace keeps one space, because a parser strips nothing from that\n * one.\n *\n * A target's module part is the inline import form `import('./module.js').` or TSDoc's\n * package-qualified form `@scope/pkg#`, and the expansion drops it, so a cross-file link and the\n * code token a guide cell documents it with reach the same text. A package qualifier carries `@`\n * or `/`; text before a `#` carrying neither is JSDoc's member reference, so `{@link Owner#member}`\n * and `{@link #member}` travel whole and a guide cell documents each as written. An unscoped\n * package name is spelled like an owner, so `{@link pkg#Name}` travels whole too — write the\n * scoped or the path form where a cell must drop the package. Everything after a module part\n * travels: `Owner.member` keeps its owner, and a dotted target no module part precedes is\n * untouched. A label is text rather than a target, so `{@link Target | label}` renders its label\n * whole.\n *\n * A code span delimited by more than one backtick is outside the compared form's representable\n * set and travels untouched, as does a code span whose own text carries a backtick: the form\n * spells every span with one backtick per side, so neither can be written back. A summary that\n * needs one of those constructs takes another shape: name the construct in prose rather than\n * expecting the comparison to converge it.\n *\n * @param text - A doc block's description paragraph, or a guide cell's flattened text\n * @returns The compared form of that text\n *\n * @example\n * ```ts\n * normalizeSummary('Creates a\\n{@link Widget}.') // 'Creates a `Widget`.'\n * normalizeSummary(\"Reads {@link import('./widgets.js').Widget}.\") // 'Reads `Widget`.'\n * normalizeSummary('Reads {@link @scope/widgets#Widget}.') // 'Reads `Widget`.'\n * normalizeSummary('Reads {@link Widget#render}.') // 'Reads `Widget#render`.'\n * normalizeSummary('cells joined by ` | `.') // 'cells joined by `|`.'\n * ```\n */\nexport function normalizeSummary(text: string): string {\n\tconst parts = text.split(/((?<!`)`[^`]+`(?!`))/)\n\tlet normalized = ''\n\n\tfor (let index = 0; index < parts.length; index += 1) {\n\t\tconst part = parts[index] ?? ''\n\t\tif (index % 2 === 0) {\n\t\t\tnormalized += part\n\t\t\t\t.replace(/\\{@link\\s+[^}|]*\\|\\s*([^}]*?)\\s*\\}/g, '`$1`')\n\t\t\t\t.replace(/\\{@link\\s+(?:import\\([^)]*\\)\\.|[^}|#\\s]*[@/][^}|#\\s]*#)?([^}|]*?)\\s*\\}/g, '`$1`')\n\t\t\tcontinue\n\t\t}\n\t\tconst value = part.slice(1, -1).replace(/\\s+/g, ' ').trim()\n\t\tnormalized += `\\`${value.length === 0 ? ' ' : value}\\``\n\t}\n\n\treturn normalized.replace(/\\s+/g, ' ').trim()\n}\n\n/**\n * Wraps one paragraph into greedy lines no longer than `width` characters. Every run of\n * whitespace separates words, and a word longer than `width` takes its own line rather than\n * being split, so a long code token or URL survives the wrap intact.\n *\n * @param text - The paragraph to wrap\n * @param width - The greatest length a returned line may reach\n * @returns The wrapped lines, in order, or an empty list when `text` carries no word\n *\n * @example\n * ```ts\n * wrapText('one two three', 8) // ['one two', 'three']\n * ```\n */\nexport function wrapText(text: string, width: number): readonly string[] {\n\tconst lines: string[] = []\n\tlet current = ''\n\n\tfor (const word of text.split(/\\s+/)) {\n\t\tif (word.length === 0) continue\n\t\tif (current.length === 0) current = word\n\t\telse if (current.length + 1 + word.length <= width) current += ` ${word}`\n\t\telse {\n\t\t\tlines.push(current)\n\t\t\tcurrent = word\n\t\t}\n\t}\n\tif (current.length > 0) lines.push(current)\n\n\treturn lines\n}\n\n/**\n * Builds one genuine JSDoc span from its content lines — the inverse of {@link unwrapComment}.\n * Each line is emitted at `indent` behind a continuation marker, an empty line as the bare\n * marker so no line carries trailing whitespace, and the leading and trailing empty lines are\n * dropped because the opener and the closer take those physical lines.\n *\n * @param lines - The span's content lines, as {@link unwrapComment} returns them\n * @param indent - The whitespace the span opens at\n * @returns The span's raw text, opener and closer included\n *\n * @example\n * ```ts\n * buildComment(['Walks.'], '') // '/**\\n * Walks.\\n *' + '/'\n * ```\n */\nexport function buildComment(lines: readonly string[], indent: string): string {\n\tconst content = [...lines]\n\twhile (content[0] === '') content.shift()\n\twhile (content[content.length - 1] === '') content.pop()\n\n\tconst raw = [`${indent}/**`]\n\tfor (const line of content) raw.push(line.length === 0 ? `${indent} *` : `${indent} * ${line}`)\n\traw.push(`${indent} */`)\n\n\treturn raw.join('\\n')\n}\n\n/**\n * Returns one doc block's unwrapped text with every fenced body replaced by aligned spaces,\n * so a tag search reads the block's structure and never its example code. A line opening with\n * three or more backticks or tildes opens a body, the first line opening with a run of the same\n * character at least as long closes it, an unclosed body runs to the end, and the marker lines\n * themselves stay. The projection preserves every line and every column, so an index found in\n * it addresses the same character of the text it was built from.\n *\n * @param text - One doc block's unwrapped text, as {@link normalizeComment} returns it\n * @returns The same text with each fenced body's characters replaced by spaces\n *\n * @example\n * ```ts\n * maskFences('@example\\n~~~\\n@decorator()\\n~~~').split('\\n')[2] // ' '\n * ```\n */\nexport function maskFences(text: string): string {\n\tconst masked: string[] = []\n\tlet marker: string | undefined\n\n\tfor (const line of text.split('\\n')) {\n\t\tconst fence = /^[ \\t]*(`{3,}|~{3,})/.exec(line)?.[1]\n\t\tif (marker === undefined) {\n\t\t\tmasked.push(line)\n\t\t\tmarker = fence\n\t\t\tcontinue\n\t\t}\n\t\tconst closing = fence !== undefined && fence.startsWith(marker)\n\t\tmasked.push(closing ? line : ' '.repeat(line.length))\n\t\tif (closing) marker = undefined\n\t}\n\n\treturn masked.join('\\n')\n}\n\n/**\n * Extracts every eligible genuine JSDoc block paired with the physical record it documents.\n *\n * @remarks\n * An opener is eligible only when it is the first non-whitespace source material of its record; a\n * leading whitespace-separated span chain is last-span authoritative; intervening source material\n * severs association, while a leading JSDoc on the next record replaces pending state. Any other\n * next physical record is returned once and consumes it. This parser walks aligned records without\n * rescanning source syntax or applying declaration/member grammar, and every reader of a doc\n * block's text — the description paragraph, the `@example` blocks, the member summaries — reads it\n * through this one walk.\n *\n * @param lines - Aligned physical source-line records\n * @returns One record per documented physical line, in source order\n *\n * @example\n * ```ts\n * extractSourceComments(extractSourceLines('/**' + ' Walks. *' + '/\\nexport function walk() {}'))\n * // [{ text: 'Walks.', line: the `export function walk() {}` SourceLine }]\n * ```\n */\nexport function extractSourceComments(lines: readonly SourceLine[]): readonly SourceComment[] {\n\tconst comments: SourceComment[] = []\n\tlet block = false\n\tlet eligible = false\n\tlet span: string[] = []\n\tlet pending: string | undefined\n\n\tfor (const line of lines) {\n\t\tconst projection = line.jsdoc\n\t\tconst first = projection?.indexOf('/**') ?? -1\n\n\t\tif (pending !== undefined) {\n\t\t\tif (!block && first >= 0 && line.source.slice(0, first).trim() === '') pending = undefined\n\t\t\telse {\n\t\t\t\tcomments.push({ text: pending, line })\n\t\t\t\tpending = undefined\n\t\t\t}\n\t\t}\n\n\t\tif (projection === undefined) continue\n\n\t\tlet cursor = 0\n\t\tif (block) {\n\t\t\tconst close = projection.indexOf('*/')\n\t\t\tconst end = close < 0 ? projection.length : close + 2\n\t\t\tspan.push(projection.slice(0, end))\n\t\t\tif (close < 0) continue\n\n\t\t\tblock = false\n\t\t\tconst opener = projection.indexOf('/**', close + 2)\n\t\t\tconst endOfGap = opener < 0 ? line.source.length : opener\n\t\t\tconst whitespace = line.source.slice(close + 2, endOfGap).trim() === ''\n\t\t\tif (opener < 0) {\n\t\t\t\tpending = eligible && whitespace ? normalizeComment(span.join('\\n')) : undefined\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\tspan = []\n\t\t\tcursor = opener\n\t\t} else {\n\t\t\tif (first < 0) continue\n\t\t\teligible = line.source.slice(0, first).trim() === ''\n\t\t\tspan = []\n\t\t\tcursor = first\n\t\t}\n\n\t\twhile (cursor < projection.length) {\n\t\t\tconst close = projection.indexOf('*/', cursor + 2)\n\t\t\tconst end = close < 0 ? projection.length : close + 2\n\t\t\tspan.push(projection.slice(cursor, end))\n\n\t\t\tif (close < 0) {\n\t\t\t\tblock = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tconst opener = projection.indexOf('/**', close + 2)\n\t\t\tconst endOfGap = opener < 0 ? line.source.length : opener\n\t\t\tconst whitespace = line.source.slice(close + 2, endOfGap).trim() === ''\n\t\t\tif (opener < 0) {\n\t\t\t\tpending = eligible && whitespace ? normalizeComment(span.join('\\n')) : undefined\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\tspan = []\n\t\t\tcursor = opener\n\t\t}\n\t}\n\n\treturn comments\n}\n\n/**\n * Selects the next physical record after an eligible genuine JSDoc whose final\n * authoritative span carries an `@example` tag opening a line at its first non-blank column —\n * the {@link extractSourceComments} walk filtered to the blocks that carry one. Title\n * text is allowed, and {@link maskFences} keeps a fenced body's own lines out of the search.\n *\n * @param lines - Aligned physical source-line records\n * @returns The immediately following candidate lines, in source order\n *\n * @example\n * ```ts\n * extractExampleLines(extractSourceLines('/**' + ' @example *' + '/\\nexport function walk() {}'))\n * // the `export function walk() {}` SourceLine\n * ```\n */\nexport function extractExampleLines(lines: readonly SourceLine[]): readonly SourceLine[] {\n\treturn extractSourceComments(lines)\n\t\t.filter((comment) => /^[ \\t]*@example(?=[ \\t]|$)/m.test(maskFences(comment.text)))\n\t\t.map((comment) => comment.line)\n}\n\n/**\n * Collects the description paragraph of every documented physical record — a doc block's\n * text before its first block tag, in {@link normalizeSummary}'s compared form — keyed by the\n * record it documents. A record whose block carries no description contributes no entry, so\n * an absent summary stays absent rather than becoming an empty string.\n *\n * @param lines - Aligned physical source-line records\n * @returns One entry per documented record carrying a description paragraph\n *\n * @example\n * ```ts\n * collectSummaries(extractSourceLines('/**' + ' Walks. *' + '/\\nexport function walk() {}')).size // 1\n * ```\n */\nexport function collectSummaries(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string> {\n\tconst summaries = new Map<SourceLine, string>()\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\tconst tag = maskFences(comment.text).search(/^[ \\t]*@\\w/m)\n\t\tconst summary = normalizeSummary(tag < 0 ? comment.text : comment.text.slice(0, tag))\n\t\tif (summary.length > 0) summaries.set(comment.line, summary)\n\t}\n\n\treturn summaries\n}\n\n/**\n * Extracts the aligned physical records of a declaration's body, read inside an owner head this\n * function supplies, so a callable member in the body carries the `Owner.member` key\n * {@link collectKeys} reports for it, and that head's own record opens the projection. A body\n * read on its own carries no head, and the member grammar attaches a member to the head\n * enclosing it.\n *\n * @remarks\n * The supplied head is an `export interface` line, so the projection opens with that head's own\n * record and every body line follows it in order. A column-zero `}` among the body lines closes\n * the supplied head and leaves every later member unkeyed; a body {@link extractDeclaration}\n * returns carries none, because that reader ends a body at the first one.\n *\n * @param lines - A declaration's body lines\n * @returns The supplied head's record, then one record per body line\n *\n * @example\n * ```ts\n * extractBodyLines(['\\twalk(): void'])[1]?.code // '\\twalk(): void'\n * ```\n */\nexport function extractBodyLines(lines: readonly string[]): readonly SourceLine[] {\n\treturn extractSourceLines(['export interface Owner {', ...lines].join('\\n'))\n}\n\n/**\n * Collects the compared key of every physical record a key names — a {@link computeSymbolKey}\n * symbol key for a column-zero `export` declaration head, an `Owner.member` key for a one-tab\n * callable member inside one — keyed by the record itself. The owner closes at the first\n * column-zero `}` or at a column-zero `export` declaration carrying another keyword, and a\n * record no key names contributes no entry.\n *\n * @remarks\n * This is the package's one key grammar, and each keyed reader projects its own part back out of\n * it: {@link extractExports} splits a declaration key at its one space,\n * {@link extractMemberMethods} and {@link extractExampleMethods} split a member key at its dot,\n * and {@link locateComment} matches a caller's key against the whole map. A change to the head\n * shape or to the member shape reaches every one of them at once.\n *\n * An owner opens at a column-zero `export class`, `export abstract class`, or `export interface`\n * head and closes at the\n * first column-zero `}`, so a member declared past that brace keys nothing. A column-zero `export` declaration carrying any other keyword closes the owner it follows,\n * because a member belongs to the head enclosing it. Reading runs over {@link extractSourceLines}'s\n * projection, so a head or\n * a member written inside a comment or a template literal keys nothing.\n *\n * @param lines - Aligned physical source-line records\n * @returns One entry per record a key names, in file order\n *\n * @example\n * ```ts\n * const keys = collectKeys(extractSourceLines('export class Widget {\\n\\twalk(): void\\n}'))\n * Array.from(keys.values()) // ['class Widget', 'Widget.walk']\n * ```\n */\nexport function collectKeys(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string> {\n\tconst keys = new Map<SourceLine, string>()\n\tlet owner: string | undefined\n\n\tfor (const line of lines) {\n\t\tconst head =\n\t\t\t/^export (?:async )?(?:abstract )?(function\\*?|class|const|interface|type) (\\w+)/.exec(\n\t\t\t\tline.code,\n\t\t\t)\n\t\tconst keyword = head?.[1]?.replace(/\\*$/, '')\n\t\tconst name = head?.[2]\n\t\tif (isNonEmptyString(keyword) && isNonEmptyString(name) && isExportKeyword(keyword)) {\n\t\t\tkeys.set(line, computeSymbolKey({ name, keyword }))\n\t\t\towner = keyword === 'class' || keyword === 'interface' ? name : undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (line.code === '}') {\n\t\t\towner = undefined\n\t\t\tcontinue\n\t\t}\n\t\tconst member = /^\\t(?:async )?\\*?(\\w+)\\??(?:<.*>)?\\(/.exec(line.code)?.[1]\n\t\tif (owner !== undefined && isNonEmptyString(member)) keys.set(line, `${owner}.${member}`)\n\t}\n\n\treturn keys\n}\n\n/**\n * Collects the `@example` blocks one doc block's unwrapped text carries, each named for the\n * declaration or member the block documents. The text after the tag becomes the block's\n * `title`; a body opening with a fence contributes that fence's language and its verbatim\n * body, and a body with no fence contributes its own trimmed text as the code.\n *\n * @param comment - One doc block's unwrapped text, as {@link normalizeComment} returns it\n * @param name - The declaration or member the block documents\n * @returns The block's `@example` entries, in block order\n *\n * @example\n * ```ts\n * collectExamples('@example Walking\\n```ts\\nwalk()\\n```', 'walk')\n * // [{ name: 'walk', title: 'Walking', code: 'walk()', language: 'ts' }]\n * ```\n */\nexport function collectExamples(comment: string, name: string): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst masked = maskFences(comment)\n\tconst tags = /^[ \\t]*@example(?=[ \\t]|$)[ \\t]*(.*)$/gm\n\n\tlet tag: RegExpExecArray | null\n\twhile ((tag = tags.exec(masked)) !== null) {\n\t\tconst title = (tag[1] ?? '').trim()\n\t\tconst start = tag.index + tag[0].length\n\t\tconst rest = comment.slice(start).replace(/^\\n/, '')\n\t\tconst next = masked\n\t\t\t.slice(start)\n\t\t\t.replace(/^\\n/, '')\n\t\t\t.search(/^[ \\t]*@\\w+/m)\n\t\tconst body = (next < 0 ? rest : rest.slice(0, next)).replace(/^\\n+/, '').replace(/\\n+$/, '')\n\t\tconst fence = /^```(\\S*)\\n([\\s\\S]*?)\\n?```/.exec(body)\n\t\tconst language = fence?.[1] ?? ''\n\t\tconst code = fence?.[2] ?? body\n\n\t\texamples.push({\n\t\t\tname,\n\t\t\t...(title.length === 0 ? {} : { title }),\n\t\t\tcode,\n\t\t\t...(language.length === 0 ? {} : { language }),\n\t\t})\n\t}\n\n\treturn examples\n}\n\n/**\n * Extracts the `@example` blocks carried by the exported declaration heads in one file's source\n * text, each named for the declaration its block documents. Shared adjacency comes from\n * {@link extractSourceComments} and each block is read by {@link collectExamples}; head\n * membership is the {@link collectKeys} key of the documented record under every keyword that\n * grammar admits at column zero, so comment and template payload cannot qualify and the head\n * grammar stays the one every reader here shares. A member key carries a dot and a head key\n * does not, so a member's block belongs to {@link extractExampleMethods} instead. A head\n * carrying several blocks contributes each.\n *\n * @param source - The file's source text\n * @returns The exported declaration heads' `@example` blocks, in file order, deduplicated by name and title\n *\n * @example\n * ```ts\n * const block = ['/**', ' * @example', ' * new Widget()', ' *' + '/', 'export class Widget {}', ''].join('\\n')\n * extractExamples(block) // [{ name: 'Widget', code: 'new Widget()' }]\n * extractExamples('export class Widget {}\\n') // []\n * ```\n */\nexport function extractExamples(source: string): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst keys = collectKeys(lines)\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\t// A head key is `${keyword} ${name}` and a member key is `Owner.member`, so the dot is\n\t\t// what separates them and the block's name is the text past the head's one space.\n\t\tconst key = keys.get(comment.line)\n\t\tif (key === undefined || key.includes('.')) continue\n\n\t\tconst name = key.slice(key.indexOf(' ') + 1)\n\t\tfor (const example of collectExamples(comment.text, name)) {\n\t\t\tconst entry = `${name}\\n${example.title ?? ''}`\n\t\t\tif (seen.has(entry)) continue\n\t\t\tseen.add(entry)\n\t\t\texamples.push(example)\n\t\t}\n\t}\n\n\treturn examples\n}\n\n/**\n * Extracts the `@example` blocks carried by the callable members of a declaration body (per\n * {@link collectKeys}' grammar, the same one {@link extractMemberMethods} reads), each named for\n * the member its block documents. Shared adjacency comes from {@link extractSourceComments} and\n * each block is read by {@link collectExamples}; member membership is the key\n * {@link extractBodyLines}'s projection gives the documented record.\n *\n * @param lines - A declaration's body lines\n * @returns The members' `@example` blocks, deduplicated by name and title and sorted by name\n *\n * @example\n * ```ts\n * extractExampleMethods(['\\t/**', '\\t * @example', '\\t * walk()', '\\t *' + '/', '\\twalk(): void'])\n * // [{ name: 'walk', code: 'walk()' }]\n * ```\n */\nexport function extractExampleMethods(lines: readonly string[]): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst seen = new Set<string>()\n\tconst projected = extractBodyLines(lines)\n\tconst keys = collectKeys(projected)\n\n\tfor (const comment of extractSourceComments(projected)) {\n\t\tconst key = keys.get(comment.line) ?? ''\n\t\tconst dot = key.indexOf('.')\n\t\tif (dot < 0) continue\n\n\t\tconst name = key.slice(dot + 1)\n\t\tfor (const example of collectExamples(comment.text, name)) {\n\t\t\tconst entry = `${name}\\n${example.title ?? ''}`\n\t\t\tif (seen.has(entry)) continue\n\t\t\tseen.add(entry)\n\t\t\texamples.push(example)\n\t\t}\n\t}\n\n\treturn examples.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n}\n\n/**\n * Extracts every fenced code block anywhere in the guide document. A full AST walk\n * includes fences nested inside blockquotes and lists, and the same walk carries each\n * fence's nearest preceding heading as its `title` — the key an `@example` block pairs on.\n * A heading's text is flattened, so a title written with a code span pairs with a plain\n * `@example` title.\n *\n * @param document - The parsed guide document\n * @returns Every fence's language, verbatim code, and title, in document order\n *\n * @example\n * ```ts\n * extractFences(document) // [{ language: 'ts', code: \"import { X } from './x.js'\\nX()\" }]\n * ```\n */\nexport function extractFences(document: MarkdownDocument): readonly GuideFence[] {\n\treturn Array.from(collectFences(document).values())\n}\n\n/**\n * Collects each fenced code block keyed by its own node, paired with the {@link GuideFence}\n * {@link extractFences} reports for it — the node-addressed form a rewrite needs, so a caller\n * that located a fence by title can read that node's source region back from the parser. The map\n * iterates in document order and a node keys itself, so a repeated identical fence keeps its own\n * entry.\n *\n * @param document - The parsed guide document\n * @returns One entry per fenced code block, in document order\n *\n * @example\n * ```ts\n * Array.from(collectFences(document).values()) // [{ language: 'ts', code: 'walk()' }]\n * ```\n */\nexport function collectFences(document: MarkdownDocument): ReadonlyMap<CodeBlockNode, GuideFence> {\n\tconst fences = new Map<CodeBlockNode, GuideFence>()\n\tlet title = ''\n\n\tfor (const node of walkNodes(document)) {\n\t\tif (isHeadingNode(node)) {\n\t\t\ttitle = flattenText(node).trim()\n\t\t\tcontinue\n\t\t}\n\t\tif (isCodeBlockNode(node)) {\n\t\t\tfences.set(node, {\n\t\t\t\tlanguage: node.lang,\n\t\t\t\tcode: node.code,\n\t\t\t\t...(title.length === 0 ? {} : { title }),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn fences\n}\n\n/**\n * Extracts the guide's tagline — the text of the blockquote following the document's H1,\n * with every code span kept as a code span and whitespace collapsed. A heading before the\n * blockquote ends the window, so a blockquote elsewhere in the document is not the tagline.\n *\n * @param document - The parsed guide document\n * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading\n *\n * @example\n * ```ts\n * extractTagline(document) // 'A pure, I/O-free guides-parity toolkit'\n * ```\n */\nexport function extractTagline(document: MarkdownDocument): string | undefined {\n\tlet opened = false\n\n\tfor (const block of document.children) {\n\t\tif (isHeadingNode(block)) {\n\t\t\tif (opened) return undefined\n\t\t\topened = block.level === 1\n\t\t\tcontinue\n\t\t}\n\t\tif (!opened || !isBlockquoteNode(block)) continue\n\n\t\tconst text = normalizeSummary(\n\t\t\tblock.children\n\t\t\t\t.filter(isParagraphNode)\n\t\t\t\t.map((paragraph) => extractCellText(paragraph.children))\n\t\t\t\t.join(' '),\n\t\t)\n\t\treturn text.length === 0 ? undefined : text\n\t}\n\n\treturn undefined\n}\n\n/**\n * Computes the drift between one compared key's guide text and source text. A pair agrees\n * only when both sides carry the same text, and every other state is a drift: guide text\n * alone reports the guide's side, source text alone reports the source's, and neither side\n * carrying text reports the key by itself. A side carrying no text is absent from the result,\n * so a documented symbol with no doc block reports as a drift naming the guide's text alone,\n * and a row a table has no `Summary` column for against a declaration with no doc block\n * reports as `{ key }`.\n *\n * @param key - The compared pair's key\n * @param category - The compared site the drift came from\n * @param guide - The guide's text there, or `undefined` when it carries none\n * @param source - The source's text there, or `undefined` when it carries none\n * @returns The drift, or `undefined` when both sides carry the same text\n *\n * @example\n * ```ts\n * computeDrift('function walk', 'summary', 'Walks the tree.', 'Walks a tree.')\n * // { key: 'function walk', category: 'summary', guide: 'Walks the tree.', source: 'Walks a tree.' }\n * ```\n */\nexport function computeDrift(\n\tkey: string,\n\tcategory: Drift['category'],\n\tguide: string | undefined,\n\tsource: string | undefined,\n): Drift | undefined {\n\tif (guide !== undefined && guide === source) return undefined\n\treturn {\n\t\tkey,\n\t\tcategory,\n\t\t...(guide === undefined ? {} : { guide }),\n\t\t...(source === undefined ? {} : { source }),\n\t}\n}\n\n/**\n * Compares documented and declared membership exactly after sorting copies, preserving duplicates.\n *\n * @param spec - The guide inventory key the finding belongs to\n * @param name - The declaration whose membership is compared\n * @param documented - The documented member names\n * @param declared - The declared member names\n * @returns The membership finding, or `undefined` when the sorted populations match\n *\n * @example Compare declaration membership\n * ```ts\n * import { compareMembership } from '@orkestrel/guide'\n *\n * compareMembership('guides/widget.md', 'WidgetInterface', ['open'], ['open']) // undefined\n * ```\n */\nexport function compareMembership(\n\tspec: string,\n\tname: string,\n\tdocumented: readonly string[],\n\tdeclared: readonly string[],\n): ParityFinding | undefined {\n\tconst left = [...documented].sort()\n\tconst right = [...declared].sort()\n\tif (JSON.stringify(left) === JSON.stringify(right)) return undefined\n\treturn {\n\t\tspec,\n\t\ttext: `${spec} ${name} documents ${JSON.stringify(left)} and declares ${JSON.stringify(right)}.`,\n\t}\n}\n\n/**\n * Computes a category-separated identity for a guide finding.\n *\n * @param spec - The guide inventory key the drift belongs to\n * @param drift - The categorized disagreement\n * @returns The inventory key, category, and compared key separated by line feeds\n *\n * @example Identify categorized drift\n * ```ts\n * import { identifyDrift } from '@orkestrel/guide'\n *\n * identifyDrift('guides/widget.md', { category: 'summary', key: 'function open' })\n * // 'guides/widget.md\\nsummary\\nfunction open'\n * ```\n */\nexport function identifyDrift(spec: string, drift: Drift): string {\n\treturn `${spec}\\n${drift.category}\\n${drift.key}`\n}\n\n/**\n * Formats present parity text as a JSON string and absent text as `absent`.\n *\n * @param value - The compared side's text, or `undefined` when absent\n * @returns The developer-facing side text\n *\n * @example Format a parity side\n * ```ts\n * import { formatSide } from '@orkestrel/guide'\n *\n * formatSide('Walks.') // '\"Walks.\"'\n * formatSide(undefined) // 'absent'\n * ```\n */\nexport function formatSide(value: string | undefined): string {\n\treturn value === undefined ? 'absent' : JSON.stringify(value)\n}\n\n/**\n * Formats a categorized drift with its guide and source sides.\n *\n * @param drift - The categorized disagreement to format\n * @returns The complete developer-facing drift text\n *\n * @example Format categorized drift\n * ```ts\n * import { formatDrift } from '@orkestrel/guide'\n *\n * formatDrift({ category: 'summary', key: 'function walk', guide: 'Walks.', source: 'Walks a tree.' })\n * // 'summary function walk: guide \"Walks.\" source \"Walks a tree.\"'\n * ```\n */\nexport function formatDrift(drift: Drift): string {\n\treturn `${drift.category} ${drift.key}: guide ${formatSide(drift.guide)} source ${formatSide(drift.source)}`\n}\n\n/**\n * Finds every disagreement between a guide and the source it documents, naming both sites:\n * each `## Surface` row against its declaration's description paragraph, each `## Methods`\n * row against its member's, and the first titled guide fence of a heading against the\n * `@example` block of the same title. An example's compared text is its language on the first\n * line and its body beneath, so a fence that names another language drifts on its own.\n *\n * @remarks\n * Only a pair present on both sides is compared, so a symbol, a member, or a title one side\n * lacks entirely is left to the bijection checks that own it and is never reported twice.\n * {@link computeDrift} rules each compared pair, so a pair whose sides carry different text, a\n * pair where one side carries none, and a pair where neither side carries text are all drift.\n * The pairing is per title across the whole document, not per heading: the first fence a title\n * reaches is the compared one, and every later fence of that title is outside the comparison,\n * whether it sits under the same heading or under a second heading of the same text.\n *\n * @param guide - The parsed guide\n * @param source - The reflected source the guide documents\n * @returns One entry per disagreement: Surface rows, then Methods rows, then examples\n *\n * @example\n * ```ts\n * findDrift(guide, source) // [{ key: 'function walk', category: 'summary', guide: 'Walks.', source: 'Walks a tree.' }]\n * ```\n */\nexport function findDrift(guide: GuideInterface, source: SourceInterface): readonly Drift[] {\n\tconst drifts: Drift[] = []\n\tconst declared = new Map(source.surface().map((symbol) => [computeSymbolKey(symbol), symbol]))\n\n\tfor (const symbol of guide.surface()) {\n\t\tconst key = computeSymbolKey(symbol)\n\t\tconst match = declared.get(key)\n\t\tif (match === undefined) continue\n\t\tconst drift = computeDrift(key, 'summary', symbol.summary, match.summary)\n\t\tif (drift !== undefined) drifts.push(drift)\n\t}\n\n\tfor (const group of guide.methods()) {\n\t\tconst members = new Map(source.methods(group.interface).map((entry) => [entry.name, entry]))\n\t\tfor (const entry of group.methods) {\n\t\t\tconst member = members.get(entry.name)\n\t\t\tif (member === undefined) continue\n\t\t\tconst drift = computeDrift(\n\t\t\t\t`${group.interface}.${entry.name}`,\n\t\t\t\t'summary',\n\t\t\t\tentry.summary,\n\t\t\t\tmember.summary,\n\t\t\t)\n\t\t\tif (drift !== undefined) drifts.push(drift)\n\t\t}\n\t}\n\n\tconst examples = collectTitles(guide, source)\n\tconst compared = new Set<string>()\n\tfor (const fence of guide.fences()) {\n\t\tif (fence.title === undefined || compared.has(fence.title)) continue\n\t\tcompared.add(fence.title)\n\t\tconst example = examples.get(fence.title)\n\t\tif (example === undefined) continue\n\t\tconst drift = computeDrift(\n\t\t\tfence.title,\n\t\t\t'example',\n\t\t\t`${fence.language ?? ''}\\n${fence.code}`,\n\t\t\t`${example.language ?? ''}\\n${example.code}`,\n\t\t)\n\t\tif (drift !== undefined) drifts.push(drift)\n\t}\n\n\treturn drifts\n}\n\n/**\n * Collects the titled `@example` blocks a guide's documented surface reaches — the module's\n * exported declaration heads, plus the own members of every documented `class` and `interface` —\n * keyed by title, the first block of a title answering for it.\n *\n * @param guide - The parsed guide naming the documented declarations\n * @param source - The reflected source to read the blocks from\n * @returns One entry per distinct `@example` title\n *\n * @example\n * ```ts\n * collectTitles(guide, source).get('Walk a tree') // { name: 'walk', title: 'Walk a tree', code: 'walk()' }\n * ```\n */\nexport function collectTitles(\n\tguide: GuideInterface,\n\tsource: SourceInterface,\n): ReadonlyMap<string, SourceExample> {\n\tconst titled = new Map<string, SourceExample>()\n\tconst owners = guide\n\t\t.surface()\n\t\t.filter((symbol) => symbol.keyword === 'class' || symbol.keyword === 'interface')\n\tconst examples = [\n\t\t...source.examples(),\n\t\t...owners.flatMap((symbol) => source.examples(symbol.name)),\n\t]\n\n\tfor (const example of examples) {\n\t\tif (example.title === undefined || titled.has(example.title)) continue\n\t\ttitled.set(example.title, example)\n\t}\n\n\treturn titled\n}\n\n/**\n * Builds a copy of `table` with one cell's inline content rebuilt from `text` through\n * {@link buildCell}. Every other cell keeps its own nodes, so a rewrite touches the one cell it\n * names and the header and the alignment row travel unchanged.\n *\n * @param table - The table to copy\n * @param row - The index of the row to rewrite within {@link TableNode.rows}\n * @param column - The index of the cell to rewrite within that row\n * @param text - The cell's new compared text\n * @returns The rewritten table\n *\n * @example\n * ```ts\n * buildTable(table, 0, 2, 'Walks the tree.').rows[0]?.[2] // [{ element: 'text', value: 'Walks the tree.' }]\n * ```\n */\nexport function buildTable(table: TableNode, row: number, column: number, text: string): TableNode {\n\treturn {\n\t\telement: 'table',\n\t\theader: table.header,\n\t\trows: table.rows.map((cells, index) =>\n\t\t\tindex === row\n\t\t\t\t? cells.map((cell, position) => (position === column ? buildCell(text) : cell))\n\t\t\t\t: cells,\n\t\t),\n\t\talign: table.align,\n\t}\n}\n\n/**\n * Builds the fenced code block one `@example` block renders as — its code inside a fence\n * carrying its language, and an untagged fence when the block names none.\n *\n * @param example - The block to render\n * @returns The fence node\n *\n * @example\n * ```ts\n * buildFence({ name: 'walk', code: 'walk()', language: 'ts' }) // { element: 'codeBlock', code: 'walk()', lang: 'ts' }\n * ```\n */\nexport function buildFence(example: SourceExample): CodeBlockNode {\n\treturn {\n\t\telement: 'codeBlock',\n\t\tcode: example.code,\n\t\t...(example.language === undefined ? {} : { lang: example.language }),\n\t}\n}\n\n/**\n * Splices `replacement` into `source` over the region `span` addresses, and returns the result.\n * The text before the region and the text after it travel byte for byte, so a rewrite that\n * addresses one node's region changes nothing else in the document.\n *\n * @param source - The text to rewrite\n * @param span - The half-open region to replace: the region `MarkdownInterface.span` reports\n * for a markdown node, or the one {@link locateComment} reports for a doc block\n * @param replacement - The text to write over that region\n * @returns The rewritten text\n *\n * @example\n * ```ts\n * spliceSpan('one two three', { start: 4, end: 7 }, 'TWO') // 'one TWO three'\n * ```\n */\nexport function spliceSpan(source: string, span: MarkdownSpan, replacement: string): string {\n\treturn source.slice(0, span.start) + replacement + source.slice(span.end)\n}\n\n/**\n * Renders a `## Surface` table from the symbols a source declares — a `Name`, {@link KIND}, and\n * {@link SUMMARY} table with one row per symbol, the name as a code span, the keyword as its\n * text, and the summary through {@link buildCell}. A symbol carrying no summary renders an empty\n * cell, which {@link extractSurface} reads back as an absent summary.\n *\n * @remarks\n * The render carries no `## Surface` heading, because a guide documents its surface in several\n * tables under their own sub-headings and one of them is what this function produces. Reading the\n * render back therefore parses it under that heading. `renderMarkdown` pads every cell to one\n * space, so the render is not the committed column-aligned bytes; the checkout's formatter\n * re-aligns the table and the reader compares parsed entries rather than bytes.\n *\n * @param symbols - The symbols to document, in row order\n * @returns The table's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderSurface([{ name: 'walk', keyword: 'function', summary: 'Walks the tree.' }])\n * // '| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks the tree. |'\n * ```\n */\nexport function renderSurface(symbols: readonly SurfaceSymbol[]): string {\n\treturn renderMarkdown({\n\t\telement: 'table',\n\t\theader: [\n\t\t\t[{ element: 'text', value: 'Name' }],\n\t\t\t[{ element: 'text', value: KIND }],\n\t\t\t[{ element: 'text', value: SUMMARY }],\n\t\t],\n\t\trows: symbols.map((symbol) => [\n\t\t\t[{ element: 'codeSpan', value: symbol.name }],\n\t\t\t[{ element: 'text', value: symbol.keyword }],\n\t\t\tbuildCell(symbol.summary ?? ''),\n\t\t]),\n\t\talign: [null, null, null],\n\t})\n}\n\n/**\n * Renders one `## Methods` group — the `####` heading naming the interface as a code span, then\n * a `Name` and {@link SUMMARY} table with one row per documented member. A member carrying no\n * summary renders an empty cell, which {@link extractMethods} reads back as an absent summary.\n *\n * @remarks\n * The render carries no `## Methods` heading, for the reason {@link renderSurface} states:\n * a guide documents one group per interface under that one section heading.\n *\n * @param group - The interface and its members\n * @returns The heading and table's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderMethods({ interface: 'WidgetInterface', methods: [{ name: 'walk', summary: 'Walks.' }] })\n * // '#### `WidgetInterface`\\n\\n| Name | Summary |\\n| --- | --- |\\n| `walk` | Walks. |'\n * ```\n */\nexport function renderMethods(group: MethodGroup): string {\n\treturn renderMarkdown({\n\t\telement: 'document',\n\t\tchildren: [\n\t\t\t{ element: 'heading', level: 4, children: [{ element: 'codeSpan', value: group.interface }] },\n\t\t\t{\n\t\t\t\telement: 'table',\n\t\t\t\theader: [[{ element: 'text', value: 'Name' }], [{ element: 'text', value: SUMMARY }]],\n\t\t\t\trows: group.methods.map((entry) => [\n\t\t\t\t\t[{ element: 'codeSpan', value: entry.name }],\n\t\t\t\t\tbuildCell(entry.summary ?? ''),\n\t\t\t\t]),\n\t\t\t\talign: [null, null],\n\t\t\t},\n\t\t],\n\t})\n}\n\n/**\n * Renders one `@example` block as the guide fence it pairs with — an H3 heading carrying the\n * block's title, then a fence carrying its language and its code. An untitled block renders the\n * fence alone, because a fence pairs on its nearest preceding heading and an untitled block\n * claims none.\n *\n * @remarks\n * The title renders as literal text rather than markdown, so a title carrying backticks or\n * emphasis reads back through {@link extractFences} as the text the `@example` tag carried.\n * The heading level is 3 because a guide documents its examples one level under a `##` section;\n * {@link extractFences} pairs on the nearest preceding heading of any level, so the level is\n * presentation rather than pairing.\n *\n * @param example - The block to render\n * @returns The heading and fence's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderExample({ name: 'walk', title: 'Walk a tree', code: 'walk()', language: 'ts' })\n * // an H3 heading of 'Walk a tree', then a fence tagged `ts` carrying `walk()`\n * ```\n */\nexport function renderExample(example: SourceExample): string {\n\tconst fence = buildFence(example)\n\treturn renderMarkdown({\n\t\telement: 'document',\n\t\tchildren:\n\t\t\texample.title === undefined\n\t\t\t\t? [fence]\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telement: 'heading',\n\t\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\t\tchildren: [{ element: 'text', value: example.title }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfence,\n\t\t\t\t\t],\n\t})\n}\n\n/**\n * Replaces one compared cell in a guide's text and returns the whole guide back. `key` names the\n * row the way {@link findDrift} names it — a {@link computeSymbolKey} key for a `## Surface` row,\n * an `Owner.member` key for a `## Methods` row — and the row's {@link SUMMARY} cell becomes\n * `summary`. Only the table's own source region is rewritten, so every byte outside it travels\n * unchanged; a key reaching no cell returns `undefined`, and a row already carrying the summary\n * returns the guide byte for byte.\n *\n * @remarks\n * A row the key does not reach, a table carrying no {@link SUMMARY} column, and a document whose\n * parse recorded no region for the table are each a miss, and a miss returns `undefined` rather\n * than throwing, so a caller reports the key it could not place — the one meaning `undefined`\n * carries in every replacer here. A row already carrying `summary` returns the guide byte for\n * byte, because a rewrite would re-pad the whole table for no change; that identity reads both\n * sides through {@link normalizeSummary}, so a caller passing text the compared form still moves\n * is a fixed point on the second run rather than a row rewritten forever. The rewritten table\n * renders one-space padded whatever padding it carried, so the checkout's formatter re-aligns it.\n *\n * @param guide - The guide's markdown source\n * @param key - The compared key naming the row\n * @param summary - The row's new compared text\n * @returns The guide's text with that cell replaced, or `undefined` when the key reaches no cell\n *\n * @example\n * ```ts\n * replaceCell('## Surface\\n\\n| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks. |', 'function walk', 'Walks a tree.')\n * // '## Surface\\n\\n| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks a tree. |'\n * ```\n */\nexport function replaceCell(guide: string, key: string, summary: string): string | undefined {\n\tconst markdown = createMarkdown(guide)\n\tconst document = markdown.document\n\tlet located: TableNode | undefined\n\tlet index = -1\n\n\tfor (const block of selectSectionBlocks(document, SURFACE)) {\n\t\tif (located !== undefined || !isTableNode(block)) continue\n\t\tfor (let row = 0; row < block.rows.length && located === undefined; row += 1) {\n\t\t\tconst symbol = extractRowSymbol(block, row)\n\t\t\tif (symbol === undefined || computeSymbolKey(symbol) !== key) continue\n\t\t\tlocated = block\n\t\t\tindex = row\n\t\t}\n\t}\n\n\tfor (const [table, owner] of collectGroups(document)) {\n\t\tif (located !== undefined) break\n\t\tfor (let row = 0; row < table.rows.length && located === undefined; row += 1) {\n\t\t\tconst entry = extractRowEntry(table, row)\n\t\t\tif (entry === undefined || `${owner}.${entry.name}` !== key) continue\n\t\t\tlocated = table\n\t\t\tindex = row\n\t\t}\n\t}\n\n\tif (located === undefined) return undefined\n\tconst column = findColumnIndex(located, SUMMARY)\n\tif (column === undefined) return undefined\n\tif ((extractRowSummary(located, index) ?? '') === normalizeSummary(summary)) return guide\n\n\tconst span = markdown.span(located)\n\tif (span === undefined) return undefined\n\treturn spliceSpan(guide, span, renderMarkdown(buildTable(located, index, column, summary)))\n}\n\n/**\n * Replaces one titled fence in a guide's text and returns the whole guide back. The first fence\n * carrying `title` — the pairing {@link findDrift} compares on — takes `example`'s language and\n * code. Only the fence's own source region is rewritten, so every byte outside it travels\n * unchanged; a title no fence carries returns `undefined`, and a fence already carrying that\n * body returns the guide byte for byte.\n *\n * @remarks\n * A title no fence carries and a document whose parse recorded no region for the fence are each a\n * miss, and a miss returns `undefined` rather than throwing — the one meaning `undefined` carries\n * in every replacer here. A fence already carrying that language and code returns the guide\n * byte for byte. A later fence of the same title is outside the pairing and is never rewritten,\n * which is the rule {@link findDrift} compares under.\n *\n * @param guide - The guide's markdown source\n * @param title - The heading text the fence pairs on\n * @param example - The block whose language and code the fence takes\n * @returns The guide's text with that fence replaced, or `undefined` when no fence carries the title\n *\n * @example\n * ```ts\n * replaceFence(guide, 'Walk', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })\n * // the guide's text with the fence under its `### Walk` heading carrying `walk()`\n * ```\n */\nexport function replaceFence(\n\tguide: string,\n\ttitle: string,\n\texample: SourceExample,\n): string | undefined {\n\tconst markdown = createMarkdown(guide)\n\tlet located: CodeBlockNode | undefined\n\tlet current: GuideFence | undefined\n\n\tfor (const [node, fence] of collectFences(markdown.document)) {\n\t\tif (located !== undefined || fence.title !== title) continue\n\t\tlocated = node\n\t\tcurrent = fence\n\t}\n\n\tif (located === undefined || current === undefined) return undefined\n\tif (current.code === example.code && current.language === example.language) return guide\n\n\tconst span = markdown.span(located)\n\tif (span === undefined) return undefined\n\treturn spliceSpan(guide, span, renderMarkdown(buildFence(example)))\n}\n\n/**\n * Replaces one doc block's description paragraph with `summary` and returns the whole block back.\n * The paragraph is the block's text before its first block tag, and it re-wraps inside `width`;\n * the blank line before the first tag, every tag line, the block's indentation, and its\n * continuation markers all survive. A block already carrying the summary returns byte for byte,\n * and a text that is no doc block and a summary carrying no word each return `undefined`.\n *\n * @remarks\n * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a\n * caller reports the block it could not rewrite. Text that opens with no\n * `/**` is no doc block: a single-star `/*` comment reaches this function only by a caller's\n * mistake, and reshaping it into a doc block would be a silent edit. A `summary` carrying no word\n * names no paragraph to write, and deleting the block's description on that argument would erase\n * documentation on the strength of an absent value — a caller with nothing to write writes\n * nothing.\n *\n * A block already carrying `summary` returns byte for byte, which is what keeps a propagation\n * that finds no drift from rewriting the file: a doc block's own wrapping is not recoverable from\n * its text, so re-wrapping an unchanged paragraph would move most blocks this package's source\n * carries. That identity reads both sides through {@link normalizeSummary}, and it holds for a\n * block carrying no tag as much as for a block carrying several. A block written on one physical\n * line stays on one line while `summary` still fits inside `width`, and expands otherwise.\n *\n * `width` counts characters from the line's first, a tab counting as one, so a wrapped line reads\n * `${indent} * ${text}` and never passes that count. A caller whose formatter measures a tab as\n * more than one column passes a smaller width rather than taking the default.\n *\n * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file\n * @param summary - The block's new description paragraph\n * @param width - The character budget a re-wrapped line stays inside. Default: {@link WRAP_WIDTH}\n * @returns The block's raw text with that paragraph replaced, or `undefined` for a text that is\n * no doc block and for a `summary` carrying no word\n *\n * @example\n * ```ts\n * replaceSummary('/**' + ' Walks. *' + '/', 'Walks a tree.') // '/**' + ' Walks a tree. *' + '/'\n * ```\n */\nexport function replaceSummary(\n\tcomment: string,\n\tsummary: string,\n\twidth: number = WRAP_WIDTH,\n): string | undefined {\n\tif (!/^[ \\t]*\\/\\*\\*/.test(comment)) return undefined\n\tconst content = unwrapComment(comment)\n\tconst indent = /^[ \\t]*/.exec(comment)?.[0] ?? ''\n\tconst wrapped = wrapText(summary, width - indent.length - 3)\n\tif (wrapped.length === 0) return undefined\n\n\tconst masked = maskFences(content.join('\\n')).split('\\n')\n\tlet tag = -1\n\tfor (let index = 0; index < masked.length && tag < 0; index += 1) {\n\t\tif (/^[ \\t]*@\\w/.test(masked[index] ?? '')) tag = index\n\t}\n\n\tconst described = content.slice(0, tag < 0 ? content.length : tag).join('\\n')\n\tif (normalizeSummary(described) === normalizeSummary(summary)) return comment\n\n\tconst tail = tag < 0 ? [] : content.slice(tag)\n\tif (tail.length === 0 && wrapped.length === 1 && content.length === 1) {\n\t\tconst single = `${indent}/** ${wrapped[0] ?? ''} */`\n\t\tif (single.length <= width) return single\n\t}\n\n\tconst lines = [...wrapped]\n\tif (tail.length > 0) lines.push('')\n\treturn buildComment([...lines, ...tail], indent)\n}\n\n/**\n * Replaces the body of one titled `@example` tag in a doc block's raw text and returns the whole\n * block back. The tag carrying `example`'s title takes a fence of its language and its code;\n * every other tag, the description paragraph, the block's indentation, and its continuation\n * markers all survive. A text that is no doc block, a title no tag carries, and a language or\n * code the emitted three-backtick fence cannot enclose or the doc block cannot hold each return\n * `undefined`.\n *\n * @remarks\n * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a\n * caller reports the block it could not rewrite. Text that opens with no\n * `/**` is no doc block, for the reason {@link replaceSummary} states. A block carrying no\n * `@example` tag of that title has nowhere to write, so an untitled tag and a tag carrying\n * another title are each left alone, and an `example` naming no title misses a block whose tags\n * all carry one. Code carrying a run of three or more backticks is a body the emitted fence\n * cannot enclose: the fence is three backticks, {@link maskFences} ends a body at the first line\n * opening a run at least as long, and {@link collectExamples} reads to the first such run\n * whatever column it sits at, so writing that body would truncate it and turn a following\n * `@`-line into a tag. A language or code carrying the doc-comment terminator is a body the\n * block itself cannot hold: the terminator closes the block where it lands and the file stops\n * parsing there. Refusing keeps the rewrite total over the bodies it can spell.\n *\n * A tag already carrying that language and code returns byte for byte. {@link maskFences} keeps\n * the current body's own lines out of the tag search, so a fenced body carrying a tag-shaped line\n * does not end the body early. The body ends at its last line carrying text, so the blank line\n * separating it from the next tag survives.\n *\n * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file\n * @param example - The block whose language and code the tag's body takes\n * @returns The block's raw text with that body replaced, or `undefined` for a text that is no\n * doc block, for a title no `@example` tag carries, and for a language or code the emitted\n * fence cannot enclose or the doc block cannot hold — a body carrying the doc-comment terminator\n *\n * @example\n * ```ts\n * replaceExample('/**' + '\\n * @example Walk\\n * old()\\n *' + '/', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })\n * // the same block, its `@example Walk` body now a fence tagged `ts` carrying `walk()`\n * ```\n */\nexport function replaceExample(comment: string, example: SourceExample): string | undefined {\n\tif (!/^[ \\t]*\\/\\*\\*/.test(comment)) return undefined\n\tconst spelled = [example.language ?? '', ...example.code.split('\\n')]\n\tif (spelled.some((line) => line.includes('```') || line.includes('*/'))) return undefined\n\tconst content = unwrapComment(comment)\n\tconst masked = maskFences(content.join('\\n')).split('\\n')\n\tconst title = example.title ?? ''\n\tlet start = -1\n\n\tfor (let index = 0; index < masked.length && start < 0; index += 1) {\n\t\tconst tag = /^[ \\t]*@example(?=[ \\t]|$)[ \\t]*(.*)$/.exec(masked[index] ?? '')\n\t\tif (tag !== null && (tag[1] ?? '').trim() === title) start = index\n\t}\n\tif (start < 0) return undefined\n\n\tconst current = collectExamples(content.join('\\n'), example.name).find(\n\t\t(entry) => (entry.title ?? '') === title,\n\t)\n\tif (\n\t\tcurrent !== undefined &&\n\t\tcurrent.code === example.code &&\n\t\tcurrent.language === example.language\n\t) {\n\t\treturn comment\n\t}\n\n\tlet end = content.length\n\tfor (let index = start + 1; index < masked.length && end === content.length; index += 1) {\n\t\tif (/^[ \\t]*@\\w/.test(masked[index] ?? '')) end = index\n\t}\n\twhile (end > start + 1 && (content[end - 1] ?? '').length === 0) end -= 1\n\n\tconst indent = /^[ \\t]*/.exec(comment)?.[0] ?? ''\n\tconst body = [`\\`\\`\\`${example.language ?? ''}`, ...example.code.split('\\n'), '```']\n\treturn buildComment([...content.slice(0, start + 1), ...body, ...content.slice(end)], indent)\n}\n\n/**\n * Locates the doc block a compared key attaches to inside one file's text and returns the block's\n * own character region, so a caller can `slice` the block, rewrite it through\n * {@link replaceSummary} or {@link replaceExample}, and write the result back through\n * {@link spliceSpan}. `key` names the pair the way {@link findDrift} names it — a\n * {@link computeSymbolKey} key for a declaration, an `Owner.member` key for an interface or class\n * member; the region covers the block's own indentation, and no block carrying the key returns\n * `undefined`.\n *\n * @remarks\n * Attachment is {@link extractSourceComments}'s, not a second reading of the file: that walk\n * pairs each eligible block with the physical record it documents, and this function keeps the\n * record {@link collectKeys} gives `key`. The keys are that one grammar's — the map\n * {@link extractExports} and {@link extractMemberMethods} each read their own part out of — so\n * this function runs no head pattern, no member pattern, and no owner-close rule of its own, and\n * a change to any of them reaches the locator too. Every block {@link collectSummaries} reports\n * a summary for is reachable by its key, and a block carrying only block tags is reachable too although it carries no summary.\n * A block it misses is one the comparison never had: a block a blank line separates from its\n * declaration attaches to the blank line, and a block written inside a template literal or a\n * string is no genuine span at all. The first block whose record carries the key answers for it,\n * as the first declaration of a name does everywhere else.\n *\n * The region runs from the start of the opener's line, the block's indentation included, to the\n * character past its closing marker — the raw text {@link replaceSummary} and\n * {@link replaceExample} each document as the span \"as it sits in the file\", so a caller slices,\n * rewrites, and splices with no adjustment and the rewrite keeps the indentation it found. A\n * block that source material precedes on its own line starts at the opener instead. The region\n * is read off the aligned JSDoc projection rather than searched for in the text, so an opener\n * written inside a string never yields one, and line offsets come from\n * {@link extractSourceLines}'s own records under its stated LF-or-CRLF terminator rule, so a\n * CRLF file reports the offsets its own bytes carry.\n *\n * @param text - One file's whole source text\n * @param key - The compared key naming the declaration or the member\n * @returns The block's half-open character region, or `undefined` when no block carries the key\n *\n * @example\n * ```ts\n * const text = '/**' + ' Walks. *' + '/\\nexport function walk(): void {}\\n'\n * locateComment(text, 'function walk') // { start: 0, end: 13 }\n * ```\n */\nexport function locateComment(text: string, key: string): MarkdownSpan | undefined {\n\tconst lines = extractSourceLines(text)\n\tconst keys = collectKeys(lines)\n\tconst offsets: number[] = []\n\tconst positions = new Map<SourceLine, number>()\n\tlet offset = 0\n\n\tfor (let index = 0; index < lines.length; index += 1) {\n\t\tconst line = lines[index]\n\t\tif (line === undefined) continue\n\t\toffsets.push(offset)\n\t\tpositions.set(line, index)\n\t\tconst after = offset + line.source.length\n\t\toffset = after + (text.startsWith('\\r\\n', after) ? 2 : 1)\n\t}\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\tif (keys.get(comment.line) !== key) continue\n\t\tconst close = (positions.get(comment.line) ?? 0) - 1\n\t\tconst closing = lines[close]?.jsdoc\n\t\tconst end = closing === undefined ? -1 : closing.lastIndexOf('*/')\n\t\tif (end < 0) continue\n\n\t\tlet first = close\n\t\twhile (first > 0 && lines[first - 1]?.jsdoc !== undefined) first -= 1\n\n\t\t// The run's spans are read forward, because an opener written inside a span — an\n\t\t// `@example` quoting one — is body text rather than a second block, and a backward\n\t\t// search would stop at it. The authoritative span is the last one the run opens.\n\t\tlet inside = false\n\t\tlet line = -1\n\t\tlet column = -1\n\t\tfor (let index = first; index <= close; index += 1) {\n\t\t\tconst projection = lines[index]?.jsdoc ?? ''\n\t\t\tlet cursor = 0\n\t\t\twhile (cursor < projection.length) {\n\t\t\t\tconst at = projection.indexOf(inside ? '*/' : '/**', cursor)\n\t\t\t\tif (at < 0) break\n\t\t\t\tif (!inside) {\n\t\t\t\t\tline = index\n\t\t\t\t\tcolumn = at\n\t\t\t\t}\n\t\t\t\tcursor = at + (inside ? 2 : 3)\n\t\t\t\tinside = !inside\n\t\t\t}\n\t\t}\n\t\tif (line < 0) continue\n\n\t\tconst source = lines[line]?.source ?? ''\n\t\tconst start = source.slice(0, column).trim() === '' ? 0 : column\n\t\treturn { start: (offsets[line] ?? 0) + start, end: (offsets[close] ?? 0) + end + 2 }\n\t}\n\n\treturn undefined\n}\n","import type { GuideFence, GuideInterface, MethodGroup, SurfaceSymbol } from './types.js'\nimport { createMarkdown, flattenText, isHeadingNode } from '@orkestrel/markdown'\nimport {\n\textractFences,\n\textractLinks,\n\textractMethods,\n\textractSurface,\n\textractTagline,\n\textractTests,\n\textractUnnamed,\n} from './helpers.js'\n\n/**\n * Presents a pure, structured view over one parsed guide — the documented\n * projections (`sections` / `tagline` / `surface` / `methods` / `unnamed` / `links` /\n * `tests` / `fences`) are extracted once at construction and cached.\n *\n * @remarks\n * Parses `source` once through `@orkestrel/markdown` and never touches the\n * filesystem — `Guide` reads only the markdown text it is given and records\n * nothing about where the guide came from. Every accessor returns the same\n * cached, readonly array on every call.\n *\n * @example\n * ```ts\n * import { Guide } from '@orkestrel/guide'\n *\n * const guide = new Guide('## Surface\\n\\n| Name | Kind |\\n| --- | --- |\\n| `X` | class |')\n * guide.surface() // [{ name: 'X', keyword: 'class' }]\n * ```\n */\nexport class Guide implements GuideInterface {\n\treadonly #sections: readonly string[]\n\treadonly #tagline: string | undefined\n\treadonly #surface: readonly SurfaceSymbol[]\n\treadonly #methods: readonly MethodGroup[]\n\treadonly #unnamed: readonly string[]\n\treadonly #links: readonly string[]\n\treadonly #tests: readonly string[]\n\treadonly #fences: readonly GuideFence[]\n\n\tconstructor(source: string) {\n\t\tconst document = createMarkdown(source).document\n\n\t\tthis.#sections = document.children\n\t\t\t.filter(isHeadingNode)\n\t\t\t.filter((heading) => heading.level === 2)\n\t\t\t.map((heading) => flattenText(heading).trim())\n\t\tthis.#tagline = extractTagline(document)\n\t\tthis.#surface = extractSurface(document)\n\t\tthis.#methods = extractMethods(document)\n\t\tthis.#unnamed = extractUnnamed(document)\n\t\tthis.#links = extractLinks(document)\n\t\tthis.#tests = extractTests(document)\n\t\tthis.#fences = extractFences(document)\n\t}\n\n\tsections(): readonly string[] {\n\t\treturn this.#sections\n\t}\n\n\ttagline(): string | undefined {\n\t\treturn this.#tagline\n\t}\n\n\tsurface(): readonly SurfaceSymbol[] {\n\t\treturn this.#surface\n\t}\n\n\tmethods(): readonly MethodGroup[] {\n\t\treturn this.#methods\n\t}\n\n\tunnamed(): readonly string[] {\n\t\treturn this.#unnamed\n\t}\n\n\tlinks(): readonly string[] {\n\t\treturn this.#links\n\t}\n\n\ttests(): readonly string[] {\n\t\treturn this.#tests\n\t}\n\n\tfences(): readonly GuideFence[] {\n\t\treturn this.#fences\n\t}\n}\n","import type {\n\tDeclaration,\n\tDeclarationKeyword,\n\tMethodEntry,\n\tSourceExample,\n\tSourceInterface,\n\tSourceOptions,\n\tSurfaceSymbol,\n} from '../types.js'\nimport {\n\tcollectDeclarations,\n\tcomputeSymbolKey,\n\textractExampleMethods,\n\textractExamples,\n\textractExports,\n\textractHidden,\n\textractMemberMethods,\n\textractSourceLines,\n\thasCanonicalSegments,\n\tnormalizeDirectories,\n\tresolveLink,\n\tresolvePath,\n\tselectModuleKeys,\n} from '../helpers.js'\n\n/**\n * Reflects, as a pure `SourceInterface`, a module scope's intentional direct declarations,\n * conventional barrel-reachable surface, and member methods over a consumer-supplied file\n * inventory, using text-only line scanners rather than the TypeScript compiler API or the\n * filesystem. `Source` never touches disk:\n * the consumer gathers the inventory however their environment allows\n * (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) and\n * passes it in as `files`.\n *\n * @remarks\n * Conventional barrel traversal recurses through both\n * exact workspace-root `index.ts` and nested `/index.ts` targets. `'.'` is the\n * canonical workspace-root module, module spellings normalize once at\n * construction, and exact opaque inventory keys are never rewritten; keys with\n * empty, `.` or `..` segments stay outside both initial and resolved barrel\n * inventory entrances after relative-row reduction; canonical parent hops\n * remain valid. `methods` resolves a declaration's members through its\n * `extends` chain within the same module scope, keeping the keyword it started\n * from; a base the scope does not declare contributes nothing. One declaration\n * answers for a name: the first file in sorted key order that declares the head\n * supplies its members and its bases, and a second file declaring the same name\n * adds nothing. Every reading derives once per instance from the immutable\n * inventory and is reused — the scope's declaration map on the first `methods`\n * or `examples` lookup, then each name's members and each example collection\n * under the name asked for — so a reader asking twice reads the files once and\n * receives the same records, and a second instance over the same inventory\n * derives the same readings of its own. Source projection preserves columns\n * without widening direct/hidden column-zero heads. Literal ECMAScript Unicode\n * identifiers participate in bounded slash-state recognition without escape\n * decoding. Regex recognition is bounded: slash after bare `}` is division, so\n * a post-brace regex statement requires an explicit `;`. General semicolonless\n * declaration/ASI classification is also outside the finite projector, so a\n * slash-leading statement after such a declaration requires an explicit `;`.\n *\n * @example\n * ```ts\n * import { Source } from '@orkestrel/guide'\n *\n * const source = new Source({\n * \tfiles: {\n * \t\t'src/core/index.ts': \"export * from './Guide.js'\\nexport * from './types.js'\\n\",\n * \t\t'src/core/Guide.ts': 'export class Guide {}\\n',\n * \t\t'src/core/types.ts': 'export interface GuideInterface {\\n\\tsections(): void\\n}\\n',\n * \t},\n * \tmodule: 'src/core',\n * })\n * source.exports() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]\n * source.surface() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]\n * source.methods('GuideInterface') // [{ name: 'sections' }]\n * source.exists('src/core/Guide.ts') // true\n * ```\n */\nexport class Source implements SourceInterface {\n\treadonly #files: Readonly<Record<string, string>>\n\treadonly #directories: readonly string[]\n\treadonly #methods = new Map<string, readonly MethodEntry[]>()\n\treadonly #examples = new Map<string | undefined, readonly SourceExample[]>()\n\t#exports: readonly SurfaceSymbol[] | undefined\n\t#surface: readonly SurfaceSymbol[] | undefined\n\t#hidden: readonly SurfaceSymbol[] | undefined\n\t#declarations: ReadonlyMap<string, Declaration> | undefined\n\n\tconstructor(options: SourceOptions) {\n\t\tthis.#files = options.files\n\t\tthis.#directories = normalizeDirectories(options.module)\n\t}\n\n\t// The module's exports are computed once on first access and cached —\n\t// every subsequent call reuses the same scan of an immutable inventory.\n\texports(): readonly SurfaceSymbol[] {\n\t\tif (this.#exports === undefined) this.#exports = this.#scanSymbols(extractExports)\n\t\treturn this.#exports\n\t}\n\n\t// The conventional barrel surface is computed once on first access and\n\t// cached independently from the intentional direct-declaration inventory.\n\tsurface(): readonly SurfaceSymbol[] {\n\t\tif (this.#surface === undefined) this.#surface = this.#scanSurface()\n\t\treturn this.#surface\n\t}\n\n\t// A name's members are computed once per instance and cached under that name, so a\n\t// reader asking twice resolves one `extends` chain rather than two.\n\tmethods(name: string): readonly MethodEntry[] {\n\t\tconst cached = this.#methods.get(name)\n\t\tif (cached !== undefined) return cached\n\n\t\tconst members = this.#scanMethods(name)\n\t\tthis.#methods.set(name, members)\n\t\treturn members\n\t}\n\n\texists(relative: string): boolean {\n\t\tconst keys = Object.keys(this.#files)\n\t\treturn keys.some((key) => key === relative || key.startsWith(`${relative}/`))\n\t}\n\n\t// The module's hidden declarations are computed once on first access and\n\t// cached — mirrors `exports()`'s caching.\n\thidden(): readonly SurfaceSymbol[] {\n\t\tif (this.#hidden === undefined) this.#hidden = this.#scanSymbols(extractHidden)\n\t\treturn this.#hidden\n\t}\n\n\t// Each reading is computed once per instance and cached under the name it was asked\n\t// for, the module-wide collection under the absent name.\n\texamples(): readonly SourceExample[]\n\texamples(name: string): readonly SourceExample[]\n\texamples(name?: string): readonly SourceExample[] {\n\t\tconst cached = this.#examples.get(name)\n\t\tif (cached !== undefined) return cached\n\n\t\tconst examples = name === undefined ? this.#scanExamples() : this.#exampleMembers(name)\n\t\tthis.#examples.set(name, examples)\n\t\treturn examples\n\t}\n\n\t// The interface shape answers first for a name both shapes declare; a class's members\n\t// arrive without the `constructor` no guide documents.\n\t#scanMethods(name: string): readonly MethodEntry[] {\n\t\tconst declared = this.#members('interface', name, new Set<string>())\n\t\tif (declared !== undefined) return declared\n\n\t\tconst inherited = this.#members('class', name, new Set<string>())\n\t\treturn inherited === undefined ? [] : inherited.filter((entry) => entry.name !== 'constructor')\n\t}\n\n\t// The union of exported declaration heads' `@example` blocks across the module's\n\t// files, deduped by name and title in first-seen order — mirrors `#scanSymbols`,\n\t// but over the `@example` scanner rather than a `SurfaceSymbol` one.\n\t#scanExamples(): readonly SourceExample[] {\n\t\tconst examples: SourceExample[] = []\n\t\tconst seen = new Set<string>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const example of extractExamples(text)) {\n\t\t\t\tconst identity = `${example.name}\\n${example.title ?? ''}`\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\texamples.push(example)\n\t\t\t}\n\t\t}\n\n\t\treturn examples\n\t}\n\n\t// The graph closure of each selected directory's conventional root barrel,\n\t// deduped with the same identity and ordering as the direct export scan.\n\t#scanSurface(): readonly SurfaceSymbol[] {\n\t\tconst symbols: SurfaceSymbol[] = []\n\t\tconst seen = new Set<string>()\n\t\tconst visited = new Set<string>()\n\n\t\tfor (const directory of this.#directories) {\n\t\t\tthis.#collectSurface(resolvePath(directory, 'index.ts'), visited, symbols, seen)\n\t\t}\n\n\t\treturn symbols.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n\t}\n\n\t// Traverse one exact canonical index inventory key. Only complete\n\t// conventional relative `.js` star rows whose reduced targets are canonical\n\t// enter the graph; every other line is outside the reflected population and\n\t// remains validation-owned by policy and builds.\n\t#collectSurface(\n\t\tindex: string,\n\t\tvisited: Set<string>,\n\t\tsymbols: SurfaceSymbol[],\n\t\tseen: Set<string>,\n\t): void {\n\t\tif (!hasCanonicalSegments(index)) return\n\t\tif (visited.has(index)) return\n\t\tvisited.add(index)\n\n\t\tconst source = this.#files[index]\n\t\tif (source === undefined) return\n\n\t\tfor (const line of extractSourceLines(source)) {\n\t\t\tconst row = line.code.match(\n\t\t\t\t/^\\s*export\\s+\\*\\s+from\\s+(?:'(\\.\\.?\\/[^']+\\.js)'|\"(\\.\\.?\\/[^\"]+\\.js)\")\\s*;?\\s*(?:\\/\\/.*)?$/,\n\t\t\t)\n\t\t\tconst target = row?.[1] ?? row?.[2]\n\t\t\tif (target === undefined) continue\n\n\t\t\tconst path = resolveLink(index, `${target.slice(0, -3)}.ts`)\n\t\t\tif (!hasCanonicalSegments(path)) continue\n\t\t\tif (path === 'index.ts' || path.endsWith('/index.ts')) {\n\t\t\t\tthis.#collectSurface(path, visited, symbols, seen)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (visited.has(path)) continue\n\t\t\tvisited.add(path)\n\n\t\t\tconst text = this.#files[path]\n\t\t\tif (text === undefined) continue\n\t\t\tfor (const symbol of extractExports(text)) {\n\t\t\t\tconst identity = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t}\n\t}\n\n\t// The `@example` blocks of the interface-or-class declaration body named\n\t// `name`, unioning both shapes (an implementer may carry its own `@example` a\n\t// documented interface member does not, or vice versa). The interface's own\n\t// block answers first for a member both shapes document.\n\t#exampleMembers(name: string): readonly SourceExample[] {\n\t\tconst members = new Map<string, SourceExample>()\n\n\t\tfor (const example of [\n\t\t\t...extractExampleMethods(this.#locate('interface', name)?.body ?? []),\n\t\t\t...extractExampleMethods(this.#locate('class', name)?.body ?? []),\n\t\t]) {\n\t\t\tconst identity = `${example.name}\\n${example.title ?? ''}`\n\t\t\tif (members.has(identity)) continue\n\t\t\tmembers.set(identity, example)\n\t\t}\n\n\t\treturn Array.from(members.values()).sort((a, b) =>\n\t\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t\t)\n\t}\n\n\t// The pure union-and-dedupe-and-sort composition behind `exports()` and\n\t// `hidden()` — kept as a private method because it orchestrates a scanner\n\t// across every file of the module scope rather than being a self-contained\n\t// leaf.\n\t#scanSymbols(scan: (source: string) => readonly SurfaceSymbol[]): readonly SurfaceSymbol[] {\n\t\tconst symbols: SurfaceSymbol[] = []\n\t\tconst seen = new Set<string>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const symbol of scan(text)) {\n\t\t\t\tconst identity = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t}\n\n\t\treturn symbols.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n\t}\n\n\t// The declared members of the `keyword` declaration named `name` unioned with\n\t// those of every declaration it extends, each carrying its own doc block's\n\t// description paragraph. `undefined` states one fact only — the module scope\n\t// declares no such head — which is what sends `methods()` on to the class\n\t// shape; a name already on the visit path is declared and returns an empty\n\t// union, so a cycle and a diamond each collapse to one visit. A base the scope\n\t// does not declare contributes nothing, and a member the declaration itself\n\t// documents answers ahead of the base it overrides.\n\t#members(\n\t\tkeyword: DeclarationKeyword,\n\t\tname: string,\n\t\tvisited: Set<string>,\n\t): readonly MethodEntry[] | undefined {\n\t\tif (visited.has(name)) return []\n\t\tvisited.add(name)\n\n\t\tconst declaration = this.#locate(keyword, name)\n\t\tif (declaration === undefined) return undefined\n\n\t\tconst methods = new Map<string, MethodEntry>()\n\t\tfor (const entry of extractMemberMethods(declaration.body)) methods.set(entry.name, entry)\n\t\tfor (const base of declaration.bases) {\n\t\t\tfor (const member of this.#members(keyword, base, visited) ?? []) {\n\t\t\t\tif (!methods.has(member.name)) methods.set(member.name, member)\n\t\t\t}\n\t\t}\n\n\t\treturn Array.from(methods.values()).sort((a, b) =>\n\t\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t\t)\n\t}\n\n\t// The one declaration that answers for `name`, read from the scope's declaration map,\n\t// which is collected once on first lookup and reused by every later one.\n\t#locate(keyword: DeclarationKeyword, name: string): Declaration | undefined {\n\t\tif (this.#declarations === undefined) this.#declarations = this.#scanDeclarations()\n\t\treturn this.#declarations.get(`${keyword} ${name}`)\n\t}\n\n\t// The scope's declarations, keyed `${keyword} ${name}` — one `collectDeclarations`\n\t// pass per file in sorted key order, so a scope reads each file once however many\n\t// names it resolves. The first file whose located head has a body or bases answers\n\t// for a key, its body and bases read together, so a later file declaring the same\n\t// name contributes nothing. A located head with neither a body nor bases does not\n\t// declare; the scan continues past it to a later file or leaves the key unanswered.\n\t#scanDeclarations(): ReadonlyMap<string, Declaration> {\n\t\tconst declarations = new Map<string, Declaration>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const [identity, declaration] of collectDeclarations(text)) {\n\t\t\t\tif (declarations.has(identity)) continue\n\t\t\t\tif (declaration.body.length === 0 && declaration.bases.length === 0) continue\n\t\t\t\tdeclarations.set(identity, declaration)\n\t\t\t}\n\t\t}\n\n\t\treturn declarations\n\t}\n}\n","import type { SourceInterface, SourceManagerInterface, SourceManagerOptions } from '../types.js'\nimport { computeModuleKey } from '../helpers.js'\nimport { Source } from './Source.js'\n\n/**\n * Resolves a consumer-owned import-specifier policy into pure source views and\n * caches those views by module, so aliases for one module share one entity.\n * Unmapped specifiers remain foreign to the consumer and return `undefined`.\n * `sources()` enumerates the same shared views, one per distinct module the\n * policy maps.\n *\n * @example\n * ```ts\n * import { SourceManager } from '@orkestrel/guide'\n *\n * const sources = new SourceManager({\n * \tfiles: { 'src/core/index.ts': \"export * from './types.js'\" },\n * \tmodules: { '@scope/package': 'src/core' },\n * })\n * sources.source('@scope/package')?.surface()\n * sources.sources() // [the same shared view]\n * ```\n */\nexport class SourceManager implements SourceManagerInterface {\n\treadonly #files: Readonly<Record<string, string>>\n\treadonly #modules: SourceManagerOptions['modules']\n\treadonly #sources = new Map<string, SourceInterface>()\n\n\tconstructor(options: SourceManagerOptions) {\n\t\tthis.#files = options.files\n\t\tthis.#modules = options.modules\n\t}\n\n\tsource(specifier: string): SourceInterface | undefined {\n\t\tif (!Object.hasOwn(this.#modules, specifier)) return undefined\n\t\tconst module = this.#modules[specifier]\n\t\tif (module === undefined) return undefined\n\n\t\tconst key = computeModuleKey(module)\n\t\tconst existing = this.#sources.get(key)\n\t\tif (existing !== undefined) return existing\n\n\t\tconst source = new Source({ files: this.#files, module })\n\t\tthis.#sources.set(key, source)\n\t\treturn source\n\t}\n\n\tsources(): readonly SourceInterface[] {\n\t\tconst views: SourceInterface[] = []\n\t\tconst seen = new Set<SourceInterface>()\n\n\t\tfor (const specifier of Object.keys(this.#modules)) {\n\t\t\tconst view = this.source(specifier)\n\t\t\tif (view === undefined || seen.has(view)) continue\n\t\t\tseen.add(view)\n\t\t\tviews.push(view)\n\t\t}\n\n\t\treturn views\n\t}\n}\n","import type { MarkdownSpan } from '@orkestrel/markdown'\nimport type {\n\tDrift,\n\tManifestEntry,\n\tParityExampleResult,\n\tParityFinding,\n\tParityInterface,\n\tParityOptions,\n\tParityResult,\n\tParityRewriteResult,\n\tParityRow,\n\tSourceExample,\n} from './types.js'\nimport { isNonEmptyString } from '@orkestrel/contract'\nimport {\n\tcollectExamples,\n\tcollectTitles,\n\tcompareMembership,\n\tcomputeSymbolKey,\n\textractFenceImports,\n\tfindDrift,\n\tfindMissing,\n\tfindMissingSymbols,\n\tfindUnexampled,\n\tfindUnlisted,\n\tformatDrift,\n\tformatSide,\n\thasBehaviouralSurface,\n\tidentifyDrift,\n\tisExternalLink,\n\tlocateComment,\n\tnormalizeDirectories,\n\tnormalizeComment,\n\treplaceCell,\n\treplaceExample,\n\treplaceFence,\n\treplaceSummary,\n\tresolveLink,\n\tselectModuleKeys,\n\tspliceSpan,\n} from './helpers.js'\nimport { METHODS, SURFACE, TESTS } from './constants.js'\nimport { Guide } from './Guide.js'\nimport { Source } from './sources/Source.js'\nimport { SourceManager } from './sources/SourceManager.js'\n\n/**\n * Composes generic guide-parity inspection and explicit in-memory rewrites over a caller inventory.\n */\nexport class Parity implements ParityInterface {\n\treadonly #options: ParityOptions\n\treadonly #rows: readonly ParityRow[]\n\n\tconstructor(options: ParityOptions) {\n\t\tthis.#options = {\n\t\t\tfiles: { ...options.files },\n\t\t\tentries: options.entries.map((entry) => ({ ...entry })),\n\t\t\tmodules: { ...options.modules },\n\t\t\tlanguages: [...options.languages],\n\t\t\tlanguage: options.language,\n\t\t\t...(options.pitch === undefined ? {} : { pitch: { ...options.pitch } }),\n\t\t}\n\t\tthis.#rows = this.#createRows(this.#options.files)\n\t}\n\n\trows(): readonly ParityRow[] {\n\t\treturn this.#rows\n\t}\n\n\tinspect(): ParityResult {\n\t\tconst input: ParityFinding[] = []\n\t\tconst sections: ParityFinding[] = []\n\t\tconst surface: ParityFinding[] = []\n\t\tconst methods: ParityFinding[] = []\n\t\tconst declarations: ParityFinding[] = []\n\t\tconst links: ParityFinding[] = []\n\t\tconst tests: ParityFinding[] = []\n\t\tconst fences: ParityFinding[] = []\n\t\tconst exampleFences: ParityFinding[] = []\n\t\tconst exampleFunctions: ParityFinding[] = []\n\t\tconst exampleMethods: ParityFinding[] = []\n\t\tconst exampleTitles: ParityFinding[] = []\n\t\tconst examples: ParityExampleResult = {\n\t\t\tfences: exampleFences,\n\t\t\tfunctions: exampleFunctions,\n\t\t\tmethods: exampleMethods,\n\t\t\ttitles: exampleTitles,\n\t\t}\n\t\tconst imports: ParityFinding[] = []\n\t\tconst drift: ParityFinding[] = []\n\t\tconst pitch: ParityFinding[] = []\n\n\t\tthis.#inspectInput(input)\n\t\tfor (const row of this.#rows) {\n\t\t\tthis.#inspectSections(row, sections)\n\t\t\tthis.#inspectSurface(row, surface)\n\t\t\tthis.#inspectMethods(row, methods)\n\t\t\tthis.#inspectDeclarations(row, declarations)\n\t\t\tthis.#inspectLinks(row, links, tests)\n\t\t\tthis.#inspectFences(row, fences)\n\t\t\tthis.#inspectExamples(row, exampleFences, exampleFunctions, exampleMethods, exampleTitles)\n\t\t\tthis.#inspectImports(row, imports)\n\t\t\tthis.#inspectDrift(row, drift)\n\t\t}\n\t\tthis.#inspectPitch(pitch)\n\n\t\treturn {\n\t\t\tinput,\n\t\t\tsections,\n\t\t\tsurface,\n\t\t\tmethods,\n\t\t\tdeclarations,\n\t\t\tlinks,\n\t\t\ttests,\n\t\t\tfences,\n\t\t\texamples,\n\t\t\timports,\n\t\t\tdrift,\n\t\t\tpitch,\n\t\t}\n\t}\n\n\tdocument(): ParityRewriteResult {\n\t\treturn this.#rewrite((row, drift, files) => this.#rewriteGuide(row, drift, files))\n\t}\n\n\tannotate(): ParityRewriteResult {\n\t\treturn this.#rewrite((row, drift, files) => this.#rewriteSource(row, drift, files))\n\t}\n\n\t#rewrite(\n\t\tapply: (row: ParityRow, drift: Drift, files: Map<string, string>) => string | undefined,\n\t): ParityRewriteResult {\n\t\tconst files = new Map(Object.entries(this.#options.files))\n\t\tconst reasons = new Map<string, string>()\n\t\tconst requested = new Set<string>()\n\n\t\tfor (const row of this.#rows) {\n\t\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\t\tconst identity = identifyDrift(row.entry.spec, drift)\n\t\t\t\trequested.add(identity)\n\t\t\t\tconst reason = apply(row, drift, files)\n\t\t\t\tif (reason !== undefined) reasons.set(identity, reason)\n\t\t\t}\n\t\t}\n\n\t\tconst inventory = Object.fromEntries(files)\n\t\tconst remaining: ParityFinding[] = []\n\t\tconst result = new Parity({ ...this.#options, files: inventory })\n\t\tremaining.push(...result.inspect().input)\n\t\tfor (const row of result.rows()) {\n\t\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\t\tconst identity = identifyDrift(row.entry.spec, drift)\n\t\t\t\tif (!requested.has(identity)) continue\n\t\t\t\tremaining.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${formatDrift(drift)}; ${reasons.get(identity) ?? 'the requested destination still disagrees'}`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst changes = Array.from(files.entries())\n\t\t\t.filter(([path, content]) => this.#options.files[path] !== content)\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\t\t.map(([path, content]) => ({ path, content }))\n\t\treturn { changes, findings: remaining }\n\t}\n\n\t#createRows(files: Readonly<Record<string, string>>): readonly ParityRow[] {\n\t\tconst rows: ParityRow[] = []\n\t\tfor (const entry of this.#options.entries) {\n\t\t\tconst text = files[entry.spec]\n\t\t\tif (text === undefined) continue\n\t\t\trows.push({\n\t\t\t\tentry,\n\t\t\t\tguide: new Guide(text),\n\t\t\t\tsource: new Source({ files, module: entry.source }),\n\t\t\t})\n\t\t}\n\t\treturn rows\n\t}\n\n\t#inspectInput(findings: ParityFinding[]): void {\n\t\tif (this.#options.entries.length === 0) {\n\t\t\tfindings.push({ text: 'The manifest has no guide entries.' })\n\t\t}\n\t\tfor (const entry of this.#options.entries) {\n\t\t\tif (this.#options.files[entry.spec] !== undefined) continue\n\t\t\tfindings.push({ spec: entry.spec, text: `${entry.spec} is absent from the inventory.` })\n\t\t}\n\t}\n\n\t#inspectSections(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst sections = row.guide.sections()\n\t\tfor (const heading of [SURFACE, METHODS, TESTS]) {\n\t\t\tif (sections.includes(heading)) continue\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no ## ${heading} section.`,\n\t\t\t})\n\t\t}\n\t\tif (row.guide.methods().length === 0 && hasBehaviouralSurface(row.source)) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no documented method groups.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectSurface(row: ParityRow, findings: ParityFinding[]): void {\n\t\tif (row.guide.surface().length === 0) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} has no documented surface.` })\n\t\t}\n\t\tfor (const unnamed of row.guide.unnamed()) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has an unnamed row: ${unnamed}`,\n\t\t\t})\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.exports(), row.source.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} does not re-export ${key}.` })\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.surface(), row.source.exports())) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} barrel exposes no direct ${key}.`,\n\t\t\t})\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.surface(), row.guide.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} does not document ${key}.` })\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.guide.surface(), row.source.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} documents no barrel ${key}.` })\n\t\t}\n\t\tfor (const symbol of row.source.hidden()) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} source hides ${computeSymbolKey(symbol)}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectMethods(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const group of row.guide.methods()) {\n\t\t\tconst documented = group.methods.map((entry) => entry.name)\n\t\t\tconst declared = row.source.methods(group.interface).map((entry) => entry.name)\n\t\t\tif (documented.length === 0) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} ${group.interface} has no documented methods.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tfor (const name of findMissing(declared, documented)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} does not document ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tfor (const name of findMissing(documented, declared)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} documents no source ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tif (entity === group.interface) continue\n\t\t\tfor (const name of findMissing(\n\t\t\t\trow.source.methods(entity).map((entry) => entry.name),\n\t\t\t\tdocumented,\n\t\t\t)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} ${entity}.${name} is outside the ${group.interface} contract.`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t#inspectDeclarations(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst groups = row.guide.methods()\n\t\tconst documented = groups.map((group) => group.interface)\n\t\tconst declared = new Set(row.source.surface().map((symbol) => symbol.name))\n\n\t\tfor (const group of groups) {\n\t\t\tconst finding = compareMembership(\n\t\t\t\trow.entry.spec,\n\t\t\t\tgroup.interface,\n\t\t\t\tgroup.methods.map((entry) => entry.name),\n\t\t\t\trow.source.methods(group.interface).map((entry) => entry.name),\n\t\t\t)\n\t\t\tif (finding !== undefined) findings.push(finding)\n\t\t}\n\n\t\tfor (const symbol of row.source.surface()) {\n\t\t\tif (symbol.keyword !== 'interface' && symbol.keyword !== 'class') continue\n\t\t\tconst members = row.source.methods(symbol.name).map((entry) => entry.name)\n\t\t\tif (members.length === 0) continue\n\t\t\tconst contract = `${symbol.name}Interface`\n\t\t\tconst implementing = symbol.keyword === 'class' && declared.has(contract)\n\t\t\tif (implementing) {\n\t\t\t\tconst finding = compareMembership(\n\t\t\t\t\trow.entry.spec,\n\t\t\t\t\tsymbol.name,\n\t\t\t\t\trow.source.methods(contract).map((entry) => entry.name),\n\t\t\t\t\tmembers,\n\t\t\t\t)\n\t\t\t\tif (finding !== undefined) findings.push(finding)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (documented.includes(symbol.name)) continue\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} ${symbol.name} declares members and carries no method table.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectLinks(row: ParityRow, links: ParityFinding[], tests: ParityFinding[]): void {\n\t\tif (row.guide.links().length === 0) {\n\t\t\tlinks.push({ spec: row.entry.spec, text: `${row.entry.spec} has no links.` })\n\t\t}\n\t\tfor (const href of row.guide.links()) {\n\t\t\tif (isExternalLink(href)) continue\n\t\t\tconst path = resolveLink(row.entry.spec, href)\n\t\t\tif (row.source.exists(path)) continue\n\t\t\tlinks.push({ spec: row.entry.spec, text: `${row.entry.spec} has a broken link: ${href}.` })\n\t\t}\n\t\tif (row.guide.tests().length === 0) {\n\t\t\ttests.push({ spec: row.entry.spec, text: `${row.entry.spec} has no test links.` })\n\t\t}\n\t\tfor (const href of row.guide.tests()) {\n\t\t\tconst path = resolveLink(row.entry.spec, href)\n\t\t\tif (row.source.exists(path)) continue\n\t\t\ttests.push({ spec: row.entry.spec, text: `${row.entry.spec} has a missing test: ${href}.` })\n\t\t}\n\t}\n\n\t#inspectFences(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const fence of findUnlisted(row.guide.fences(), this.#options.languages)) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has an unlisted fence language under ${fence.title ?? 'no heading'}: ${fence.language ?? 'absent'}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectExamples(\n\t\trow: ParityRow,\n\t\tfencesFindings: ParityFinding[],\n\t\tfunctionFindings: ParityFinding[],\n\t\tmethodFindings: ParityFinding[],\n\t\ttitleFindings: ParityFinding[],\n\t): void {\n\t\tconst fences = row.guide\n\t\t\t.fences()\n\t\t\t.filter((fence) => fence.language === this.#options.language)\n\t\t\t.map((fence) => fence.code)\n\t\tif (fences.length === 0) {\n\t\t\tfencesFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no ${this.#options.language} example fence.`,\n\t\t\t})\n\t\t}\n\t\tconst functions = row.guide\n\t\t\t.surface()\n\t\t\t.filter((symbol) => symbol.keyword === 'function')\n\t\t\t.map((symbol) => symbol.name)\n\t\tfor (const name of findUnexampled(\n\t\t\tfunctions,\n\t\t\tfences,\n\t\t\trow.source.examples().map((example) => example.name),\n\t\t)) {\n\t\t\tfunctionFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no example for ${name}.`,\n\t\t\t})\n\t\t}\n\n\t\tfor (const group of row.guide.methods()) {\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tconst examples = row.source.examples(group.interface).map((example) => example.name)\n\t\t\tif (entity !== group.interface) {\n\t\t\t\texamples.push(...row.source.examples(entity).map((example) => example.name))\n\t\t\t}\n\t\t\tfor (const name of findUnexampled(\n\t\t\t\tgroup.methods.map((entry) => entry.name),\n\t\t\t\tfences,\n\t\t\t\texamples,\n\t\t\t)) {\n\t\t\t\tmethodFindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} has no example for ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst guide = row.guide\n\t\t\t.fences()\n\t\t\t.map((fence) => fence.title)\n\t\t\t.filter(isNonEmptyString)\n\t\tconst source = row.source\n\t\t\t.examples()\n\t\t\t.map((example) => example.title)\n\t\t\t.filter(isNonEmptyString)\n\t\tif (!guide.some((title) => source.includes(title))) {\n\t\t\ttitleFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no top-level example-title pair: guide ${JSON.stringify(guide)} source ${JSON.stringify(source)}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectImports(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst sources = new SourceManager({\n\t\t\tfiles: this.#options.files,\n\t\t\tmodules: this.#options.modules,\n\t\t})\n\t\tlet compared = false\n\t\tfor (const fence of row.guide.fences()) {\n\t\t\tif (fence.language !== this.#options.language) continue\n\t\t\tfor (const imported of extractFenceImports(fence.code)) {\n\t\t\t\tconst source = sources.source(imported.specifier)\n\t\t\t\tif (source === undefined) continue\n\t\t\t\tcompared = true\n\t\t\t\tconst surface = source.surface().map((symbol) => symbol.name)\n\t\t\t\tfor (const name of findMissing(imported.names, surface)) {\n\t\t\t\t\tfindings.push({\n\t\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\t\ttext: `${row.entry.spec} imports missing ${name} from ${imported.specifier}.`,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!compared) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} has no mapped self import.` })\n\t\t}\n\t}\n\n\t#inspectDrift(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: formatDrift(drift) })\n\t\t}\n\t}\n\n\t#inspectPitch(findings: ParityFinding[]): void {\n\t\tconst pitch = this.#options.pitch\n\t\tif (pitch === undefined) return\n\t\tconst readme = this.#options.files[pitch.readme]\n\t\tconst spec = this.#options.files[pitch.spec]\n\t\tif (readme === undefined) {\n\t\t\tfindings.push({ spec: pitch.readme, text: `${pitch.readme} is absent from the inventory.` })\n\t\t\treturn\n\t\t}\n\t\tif (spec === undefined) {\n\t\t\tfindings.push({ spec: pitch.spec, text: `${pitch.spec} is absent from the inventory.` })\n\t\t\treturn\n\t\t}\n\t\tconst left = new Guide(readme).tagline()\n\t\tconst right = new Guide(spec).tagline()\n\t\tif (left !== undefined && left === right) return\n\t\tfindings.push({\n\t\t\tspec: pitch.spec,\n\t\t\ttext: `${pitch.spec} pitch: README ${formatSide(left)} guide ${formatSide(right)}.`,\n\t\t})\n\t}\n\n\t#rewriteGuide(row: ParityRow, drift: Drift, files: Map<string, string>): string | undefined {\n\t\tif (drift.source === undefined) return 'source authority is absent'\n\t\tconst current = files.get(row.entry.spec)\n\t\tif (current === undefined) return 'the guide inventory text is absent'\n\n\t\tif (drift.category === 'summary') {\n\t\t\tconst replacement = replaceCell(current, drift.key, drift.source)\n\t\t\tif (replacement === undefined)\n\t\t\t\treturn 'the guide summary cell or its provenance is unavailable'\n\t\t\tfiles.set(row.entry.spec, replacement)\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst example = collectTitles(row.guide, row.source).get(drift.key)\n\t\tif (example === undefined) return 'the paired source example is unavailable'\n\t\tconst replacement = replaceFence(current, drift.key, example)\n\t\tif (replacement === undefined) return 'the titled guide fence or its provenance is unavailable'\n\t\tfiles.set(row.entry.spec, replacement)\n\t\treturn undefined\n\t}\n\n\t#rewriteSource(row: ParityRow, drift: Drift, files: Map<string, string>): string | undefined {\n\t\tif (drift.guide === undefined) return 'guide authority is absent'\n\t\tif (drift.category === 'summary') {\n\t\t\tconst located = this.#locateSource(row.entry, drift.key, files)\n\t\t\tif (located === undefined) return 'the source doc block or its provenance is unavailable'\n\t\t\tconst comment = located.text.slice(located.span.start, located.span.end)\n\t\t\tconst replacement = replaceSummary(comment, drift.guide)\n\t\t\tif (replacement === undefined) return 'the source summary cannot be represented safely'\n\t\t\tfiles.set(located.path, spliceSpan(located.text, located.span, replacement))\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst fence = row.guide.fences().find((entry) => entry.title === drift.key)\n\t\tconst located = this.#locateExample(row, drift.key, files)\n\t\tif (fence === undefined || located === undefined) {\n\t\t\treturn 'the paired source example or its provenance is unavailable'\n\t\t}\n\t\tconst comment = located.text.slice(located.span.start, located.span.end)\n\t\tconst example: SourceExample = {\n\t\t\tname: located.example.name,\n\t\t\ttitle: drift.key,\n\t\t\tcode: fence.code,\n\t\t\t...(fence.language === undefined ? {} : { language: fence.language }),\n\t\t}\n\t\tconst replacement = replaceExample(comment, example)\n\t\tif (replacement === undefined) return 'the guide example cannot be represented safely'\n\t\tfiles.set(located.path, spliceSpan(located.text, located.span, replacement))\n\t\treturn undefined\n\t}\n\n\t#locateSource(\n\t\tentry: ManifestEntry,\n\t\tkey: string,\n\t\tfiles: ReadonlyMap<string, string>,\n\t): { readonly path: string; readonly text: string; readonly span: MarkdownSpan } | undefined {\n\t\tconst inventory = Object.fromEntries(files)\n\t\tfor (const path of selectModuleKeys(inventory, normalizeDirectories(entry.source))) {\n\t\t\tconst text = files.get(path)\n\t\t\tif (text === undefined) continue\n\t\t\tconst span = locateComment(text, key)\n\t\t\tif (span !== undefined) return { path, text, span }\n\t\t}\n\t\treturn undefined\n\t}\n\n\t#locateExample(\n\t\trow: ParityRow,\n\t\ttitle: string,\n\t\tfiles: ReadonlyMap<string, string>,\n\t):\n\t\t| {\n\t\t\t\treadonly path: string\n\t\t\t\treadonly text: string\n\t\t\t\treadonly span: MarkdownSpan\n\t\t\t\treadonly example: SourceExample\n\t\t }\n\t\t| undefined {\n\t\tconst target = collectTitles(row.guide, row.source).get(title)\n\t\tif (target === undefined) return undefined\n\t\tconst keys: string[] = []\n\t\tfor (const symbol of row.source.exports()) {\n\t\t\tif (symbol.name === target.name) keys.push(computeSymbolKey(symbol))\n\t\t}\n\t\tfor (const owner of row.guide.surface()) {\n\t\t\tif (owner.keyword !== 'class' && owner.keyword !== 'interface') continue\n\t\t\tconst matched = row.source\n\t\t\t\t.examples(owner.name)\n\t\t\t\t.some((example) => example.name === target.name && example.title === title)\n\t\t\tif (matched) keys.push(`${owner.name}.${target.name}`)\n\t\t}\n\n\t\tconst inventory = Object.fromEntries(files)\n\t\tfor (const path of selectModuleKeys(inventory, normalizeDirectories(row.entry.source))) {\n\t\t\tconst text = files.get(path)\n\t\t\tif (text === undefined) continue\n\t\t\tlet selected: { readonly span: MarkdownSpan; readonly example: SourceExample } | undefined\n\t\t\tfor (const key of keys) {\n\t\t\t\tconst span = locateComment(text, key)\n\t\t\t\tif (span === undefined) continue\n\t\t\t\tconst comment = normalizeComment(text.slice(span.start, span.end))\n\t\t\t\tconst example = collectExamples(comment, target.name).find((entry) => entry.title === title)\n\t\t\t\tif (example === undefined) continue\n\t\t\t\tif (selected === undefined || span.start < selected.span.start) selected = { span, example }\n\t\t\t}\n\t\t\tif (selected !== undefined) return { path, text, ...selected }\n\t\t}\n\t\treturn undefined\n\t}\n}\n","import type { ManifestEntry } from './types.js'\nimport { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { isEmptyString, isNonEmptyArray } from '@orkestrel/contract'\nimport { MANIFEST } from './constants.js'\nimport {\n\textractCellLinks,\n\tnormalizeDirectories,\n\tresolvePath,\n\tselectSectionBlocks,\n} from './helpers.js'\n\n/**\n * Parses a `## By concept` manifest table into its {@link ManifestEntry} rows —\n * each row's Concept cell (flattened text), Spec / Tests cells (a single link\n * href, resolved against `directory`), and Source cell (every link href,\n * resolved against `directory`; Source links canonicalize through\n * {@link normalizeDirectories}, one directory collapses to a `string`, and several become\n * a `readonly string[]`). A row missing a concept, spec link, tests link, or\n * source link is skipped as malformed.\n *\n * @param markdown - The manifest markdown source, for example the content of `guides/README.md`\n * @param directory - The root-relative directory containing the manifest\n * @returns The manifest's entries, in row order\n *\n * @example\n * ```ts\n * parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]\n * ```\n */\nexport function parseManifest(markdown: string, directory: string): readonly ManifestEntry[] {\n\tconst document = createMarkdown(markdown).document\n\tconst entries: ManifestEntry[] = []\n\n\tfor (const block of selectSectionBlocks(document, MANIFEST)) {\n\t\tif (!isTableNode(block)) continue\n\n\t\tfor (const row of block.rows) {\n\t\t\tconst conceptCell = row[0]\n\t\t\tconst specCell = row[1]\n\t\t\tconst sourceCell = row[2]\n\t\t\tconst testsCell = row[3]\n\t\t\tif (\n\t\t\t\tconceptCell === undefined ||\n\t\t\t\tspecCell === undefined ||\n\t\t\t\tsourceCell === undefined ||\n\t\t\t\ttestsCell === undefined\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst concept = flattenText({ element: 'paragraph', children: conceptCell }).trim()\n\t\t\tif (isEmptyString(concept)) continue\n\n\t\t\tconst specHref = extractCellLinks(specCell)[0]\n\t\t\tconst testsHref = extractCellLinks(testsCell)[0]\n\t\t\tif (specHref === undefined || testsHref === undefined) continue\n\n\t\t\tconst sourceHrefs = normalizeDirectories(\n\t\t\t\textractCellLinks(sourceCell).map((href) => resolvePath(directory, href)),\n\t\t\t)\n\t\t\tif (!isNonEmptyArray<string>(sourceHrefs)) continue\n\t\t\tconst [firstSource] = sourceHrefs\n\t\t\tconst source = sourceHrefs.length === 1 ? firstSource : sourceHrefs\n\n\t\t\tentries.push({\n\t\t\t\tconcept,\n\t\t\t\tspec: resolvePath(directory, specHref),\n\t\t\t\tsource,\n\t\t\t\ttests: resolvePath(directory, testsHref),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn entries\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '../core/types.js'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { Parity } from '../core/Parity.js'\nimport { parseManifest } from '../core/parsers.js'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport {\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t#createOptions(): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\treturn {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst options = this.#createOptions()\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions()\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions()\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;AACA,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;AAG5B,IAAa,cAAc;;;;;;;;;;;;;;ACM3B,SAAgB,mBAAmB,SAAgC;CAClE,MAAM,OAAO,QAAQ;CAErB,OAAO,GADQ,SAAS,KAAA,KAAa,QAAQ,KAAK,WAAW,IAAI,IAAI,KAAK,GAAG,KAAK,KAC/D,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAgB,mBAAmB,QAA0B;CAC5D,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,cAAc,QAAQ,IAAI,QAAQ,aAAa;CACrD,MAAM,kBAAkB,QAAQ,IAAI,QAAQ,iBAAiB;CAC7D,IAAI,CAAC,QAAQ,WAAW,KAAK,CAAC,QA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mC;EACxC,MAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ;GACzC,MAAM,KAAK;GACX,QAAQ,QAAQ,KAAK,OAAO,gBAAgB;GAC5C,SAAS;GACT,WAAW;GACX,OAAO;GACP,OAAO;EACR,CAAC;EACD,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,oCAAoC;EAC3E,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;EACzC,IAAI,CAAC,WAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;EACxF,IAAI;GACH,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;GACzC,IAAI,CAAC,WAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;GACxF,OAAO,mBAAmB,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;EACjE,UAAU;GACT,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC;EACtC;CACD;CAEA,OAAO,MAAoB;EAC1B,MAAM,UAAU,QAAQ;EACxB,MAAM,UAAU,SAAS,OAAO,IAAI,OAAO,SAAS,SAAS,EAAE,IAAI;EACnE,IAAI,CAAC,eAAe,OAAO,KAAK,UAAU,MACzC,QAAQ,WAAW;CAErB;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/core/constants.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts","../../../src/core/Guide.ts","../../../src/core/sources/Source.ts","../../../src/core/sources/SourceManager.ts","../../../src/core/Parity.ts","../../../src/core/parsers.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n","import type { ManifestEntry, ParityFinding } from '../core/types.js'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n","import type { ParityDirection } from '../core/types.js'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n","/**\n * Lists the declaration keywords a documented or exported symbol carries, in the order the\n * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and\n * `surfaceSymbolShape` all derive from.\n *\n * @remarks\n * One frozen list feeds the type, the guard, and the shape, so a keyword cannot be admitted by one\n * and refused by another. Comment and template payload is excluded before reflection, and `enum`\n * is outside this population rather than forbidden by general package policy.\n */\nexport const EXPORT_KEYWORDS = Object.freeze([\n\t'type',\n\t'interface',\n\t'const',\n\t'function',\n\t'class',\n] satisfies ReadonlyArray<'type' | 'interface' | 'const' | 'function' | 'class'>)\n\n/**\n * Lists the compared sites a {@link Drift} can describe.\n */\nexport const DRIFT_CATEGORIES = Object.freeze(['summary', 'example'] satisfies ReadonlyArray<\n\t'summary' | 'example'\n>)\n\n/**\n * Names the `## Surface` heading text a guide's documented exports section is keyed on.\n */\nexport const SURFACE: string = 'Surface'\n\n/**\n * Names the `## Methods` heading text a guide's documented interface-methods section is keyed on.\n */\nexport const METHODS: string = 'Methods'\n\n/**\n * Names the `## Tests` heading text a guide's documented test-link section is keyed on.\n */\nexport const TESTS: string = 'Tests'\n\n/**\n * Names the header text of the column a `## Surface` table's declaration keyword is read from.\n */\nexport const KIND: string = 'Kind'\n\n/**\n * Names the header text of the column a `## Surface` or `## Methods` table's compared\n * description paragraph is read from.\n */\nexport const SUMMARY: string = 'Summary'\n\n/**\n * Names the `## By concept` heading text the manifest's run-map table is keyed on.\n */\nexport const MANIFEST: string = 'By concept'\n\n/**\n * Holds the default character budget a rewritten doc block's description paragraph wraps\n * inside — the greatest number of characters a re-wrapped line may carry, counted from the\n * line's first character with a tab counting as one, so a wrapped line reads\n * `${indent} * ${text}` and never passes that count.\n *\n * @remarks\n * The budget counts characters, not rendered columns. A block indented with tabs therefore\n * measures each tab as one character, and a formatter that renders a tab wider reads the same\n * line as longer; a caller whose formatter measures differently passes its own width instead of\n * taking this default. A doc block's own wrapping is not recoverable from its text either — the\n * blocks this package's own source carries are hand-wrapped, and no single greedy width\n * reproduces them — so a rewrite cannot infer a per-block width and falls back to this budget.\n */\nexport const WRAP_WIDTH: number = 100\n\n/**\n * Lists the link `href` schemes a guides-parity link check skips as external — a link\n * with one of these prefixes (or a bare `#` anchor, handled separately in\n * `isExternalLink`) is never resolved against the filesystem.\n */\nexport const EXTERNAL_SCHEMES: readonly string[] = Object.freeze([\n\t'http:',\n\t'https:',\n\t'mailto:',\n\t'tel:',\n])\n","import type { Guard } from '@orkestrel/contract'\nimport type {\n\tDrift,\n\tDriftCategory,\n\tExportKeyword,\n\tManifestEntry,\n\tMethodEntry,\n\tMethodGroup,\n\tSourceExample,\n\tSurfaceSymbol,\n} from './types.js'\nimport { arrayOf, isString, literalOf, recordOf, unionOf } from '@orkestrel/contract'\nimport { DRIFT_CATEGORIES, EXPORT_KEYWORDS } from './constants.js'\n\n// AGENTS.md § Design laws: guards are total. Every guard here validates an arbitrary\n// `unknown` value crossing an untrusted boundary (parsed guide/manifest data)\n// against a data type's full shape, composed from @orkestrel/contract\n// combinators and hoisted as module-level values (compiled once, not per call).\n\n/**\n * Checks whether `value` is one of the documented {@link ExportKeyword}\n * literals — the guard behind extracting a Surface table's `Kind` cell into a\n * typed symbol.\n *\n * @param value - The candidate value\n * @returns True if `value` is a valid {@link ExportKeyword}; false otherwise\n *\n * @example\n * ```ts\n * isExportKeyword('class') // true\n * isExportKeyword('enum') // false\n * ```\n */\nexport const isExportKeyword: Guard<ExportKeyword> = literalOf(EXPORT_KEYWORDS)\n\n/** Checks whether `value` names a supported drift category. */\nexport const isDriftCategory: Guard<DriftCategory> = literalOf(DRIFT_CATEGORIES)\n\n/**\n * Checks whether `value` is a well-formed {@link SurfaceSymbol} — a `name`\n * string paired with a valid {@link ExportKeyword}, and an optional `summary`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link SurfaceSymbol}; false otherwise\n *\n * @example\n * ```ts\n * isSurfaceSymbol({ name: 'Markdown', keyword: 'class' }) // true\n * isSurfaceSymbol({ name: 'Markdown', keyword: 'enum' }) // false\n * ```\n */\nexport const isSurfaceSymbol: Guard<SurfaceSymbol> = recordOf(\n\t{\n\t\tname: isString,\n\t\tkeyword: isExportKeyword,\n\t\tsummary: isString,\n\t},\n\t['summary'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link MethodEntry} — a `name` string with an\n * optional `summary`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link MethodEntry}; false otherwise\n *\n * @example\n * ```ts\n * isMethodEntry({ name: 'walk' }) // true\n * isMethodEntry({ name: 1 }) // false\n * ```\n */\nexport const isMethodEntry: Guard<MethodEntry> = recordOf(\n\t{\n\t\tname: isString,\n\t\tsummary: isString,\n\t},\n\t['summary'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link SourceExample} — a `name` and `code`\n * string with an optional `title` and `language`.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link SourceExample}; false otherwise\n *\n * @example\n * ```ts\n * isSourceExample({ name: 'walk', code: 'walk()' }) // true\n * isSourceExample({ name: 'walk' }) // false\n * ```\n */\nexport const isSourceExample: Guard<SourceExample> = recordOf(\n\t{\n\t\tname: isString,\n\t\ttitle: isString,\n\t\tcode: isString,\n\t\tlanguage: isString,\n\t},\n\t['title', 'language'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link Drift} — a compared `key` with an optional\n * `guide` and `source` text.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link Drift}; false otherwise\n *\n * @example\n * ```ts\n * isDrift({ key: 'class Widget', category: 'summary', guide: 'A widget.' }) // true\n * isDrift({ guide: 'A widget.' }) // false\n * ```\n */\nexport const isDrift: Guard<Drift> = recordOf(\n\t{\n\t\tkey: isString,\n\t\tcategory: isDriftCategory,\n\t\tguide: isString,\n\t\tsource: isString,\n\t},\n\t['guide', 'source'],\n)\n\n/**\n * Checks whether `value` is a well-formed {@link MethodGroup} — a backticked\n * `interface` name paired with its documented {@link MethodEntry} rows.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link MethodGroup}; false otherwise\n *\n * @example\n * ```ts\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }) // true\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false\n * ```\n */\nexport const isMethodGroup: Guard<MethodGroup> = recordOf({\n\tinterface: isString,\n\tmethods: arrayOf(isMethodEntry),\n})\n\n/**\n * Checks whether `value` is a well-formed {@link ManifestEntry} — a\n * `## By concept` manifest row, its `source` accepting either a single directory\n * or several.\n *\n * @param value - The value to test\n * @returns True if `value` is a well-formed {@link ManifestEntry}; false otherwise\n *\n * @example\n * ```ts\n * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * isManifestEntry({ concept: 1 }) // false\n * ```\n */\nexport const isManifestEntry: Guard<ManifestEntry> = recordOf({\n\tconcept: isString,\n\tspec: isString,\n\tsource: unionOf(isString, arrayOf(isString)),\n\ttests: isString,\n})\n","import type {\n\tBlockNode,\n\tCodeBlockNode,\n\tInlineNode,\n\tMarkdownDocument,\n\tMarkdownSpan,\n\tTableNode,\n} from '@orkestrel/markdown'\nimport type {\n\tDeclaration,\n\tDeclarationHead,\n\tDeclarationKeyword,\n\tDrift,\n\tFenceImport,\n\tGuideFence,\n\tGuideInterface,\n\tGuideModule,\n\tMethodEntry,\n\tMethodGroup,\n\tParityFinding,\n\tSourceComment,\n\tSourceExample,\n\tSourceInterface,\n\tSourceLine,\n\tSurfaceSymbol,\n} from './types.js'\nimport {\n\tcoalesceText,\n\tcreateMarkdown,\n\tflattenText,\n\tisBlockquoteNode,\n\tisCodeBlockNode,\n\tisCodeSpanNode,\n\tisEmphasisNode,\n\tisHeadingNode,\n\tisImageNode,\n\tisLinkNode,\n\tisParagraphNode,\n\tisTableNode,\n\trenderMarkdown,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport { isNonEmptyString, isString } from '@orkestrel/contract'\nimport {\n\tEXTERNAL_SCHEMES,\n\tKIND,\n\tMETHODS,\n\tSUMMARY,\n\tSURFACE,\n\tTESTS,\n\tWRAP_WIDTH,\n} from './constants.js'\nimport { isExportKeyword } from './validators.js'\n\n/**\n * Extracts aligned physical source-line records in one character traversal.\n * Real line and block comments and complete template tokens become spaces in\n * {@link SourceLine.code}, while ordinary code, quoted strings, and recognized\n * regex literals retain their columns. Genuine JSDoc opened from reflection\n * code is retained span by span at its exact physical column in\n * {@link SourceLine.jsdoc}; faux openers in comments and templates are\n * excluded. Membership remains each consumer's separate anchored grammar.\n *\n * @remarks\n * Regex recognition is a bounded lexical goal rather than TypeScript parser\n * grammar. Literal ECMAScript Unicode identifiers participate in slash-state\n * recognition, including private identifiers, without decoding escaped\n * identifier spellings. Slash after bare `}` is division, and a post-brace\n * regex statement requires an explicit `;`. General semicolonless\n * declaration/ASI classification is outside this finite projector, so callers\n * place an explicit `;` before a slash-leading statement after such a\n * declaration.\n *\n * @param source - The TypeScript source text to project\n * @returns One aligned terminator-free record per LF or CRLF physical line, including the final line\n *\n * @example Project source into physical code lines\n * ```ts\n * import { extractSourceLines } from '@orkestrel/guide'\n *\n * extractSourceLines('export const visible = true // note\\n')\n * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }]\n * // … one record per remaining line\n * ```\n */\nexport function extractSourceLines(source: string): readonly SourceLine[] {\n\tconst lines: SourceLine[] = []\n\tlet characters: string[] = []\n\tlet jsdocCharacters: string[] = []\n\tconst identifier = /#?[$_\\p{ID_Start}][$_\\u200C\\u200D\\p{ID_Continue}]*/uy\n\tconst templates: number[] = []\n\tconst parentheses: Array<{ role: string; phase: string; binding: boolean }> = []\n\tlet start = 0\n\tlet mode = 'code'\n\tlet escaped = false\n\tlet regexClass = false\n\tlet operandExpected = true\n\tlet memberExpected = false\n\tlet pendingRole: string | undefined\n\tlet restricted: string | undefined\n\tlet separated = false\n\tlet blockTemplate = false\n\tlet lineTemplate = false\n\tlet jsdoc = false\n\tlet jsdocPresent = false\n\n\tfor (let offset = 0; offset < source.length; offset += 1) {\n\t\tconst character = source[offset]\n\t\tif (character === undefined) continue\n\t\tconst next = source[offset + 1]\n\t\tconst crlf = character === '\\r' && next === '\\n'\n\t\tif (character === '\\n' || crlf) {\n\t\t\tconst code = characters.join('')\n\t\t\tconst present = jsdocPresent || jsdoc\n\t\t\tlines.push({\n\t\t\t\tsource: source.slice(start, offset),\n\t\t\t\tcode,\n\t\t\t\tjsdoc: present ? jsdocCharacters.join('').padEnd(code.length, ' ') : undefined,\n\t\t\t})\n\t\t\tcharacters = []\n\t\t\tjsdocCharacters = []\n\t\t\tjsdocPresent = jsdoc\n\t\t\tif (mode !== 'template') separated = true\n\t\t\tif (restricted !== undefined) {\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = undefined\n\t\t\t}\n\t\t\tif (crlf) offset += 1\n\t\t\tstart = offset + 1\n\n\t\t\tif (mode === 'line') mode = lineTemplate ? 'templateCode' : 'code'\n\t\t\telse if (mode === 'regex') {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = true\n\t\t\t\tregexClass = false\n\t\t\t} else if (mode === 'templateLine' || mode === 'templateRegex') {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = true\n\t\t\t\tregexClass = false\n\t\t\t} else if (mode === 'single' || mode === 'double') {\n\t\t\t\tif (!escaped) {\n\t\t\t\t\tmode = 'code'\n\t\t\t\t\toperandExpected = true\n\t\t\t\t}\n\t\t\t} else if (mode === 'templateSingle' || mode === 'templateDouble') {\n\t\t\t\tif (!escaped) {\n\t\t\t\t\tmode = 'templateCode'\n\t\t\t\t\toperandExpected = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tescaped = false\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'line' || mode === 'templateLine') {\n\t\t\tcharacters.push(' ')\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'block' || mode === 'templateBlock') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (jsdoc) jsdocCharacters.push(character)\n\t\t\tif (character === '*' && next === '/') {\n\t\t\t\tcharacters.push(' ')\n\t\t\t\tif (jsdoc) {\n\t\t\t\t\tjsdocCharacters.push('/')\n\t\t\t\t\tjsdoc = false\n\t\t\t\t}\n\t\t\t\toffset += 1\n\t\t\t\tmode = blockTemplate ? 'templateCode' : 'code'\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'single' || mode === 'double') {\n\t\t\tcharacters.push(character)\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ((mode === 'single' && character === \"'\") || (mode === 'double' && character === '\"')) {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'regex') {\n\t\t\tcharacters.push(character)\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '[') regexClass = true\n\t\t\telse if (character === ']') regexClass = false\n\t\t\telse if (character === '/' && !regexClass) {\n\t\t\t\tmode = 'code'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'templateSingle' || mode === 'templateDouble') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (\n\t\t\t\t(mode === 'templateSingle' && character === \"'\") ||\n\t\t\t\t(mode === 'templateDouble' && character === '\"')\n\t\t\t) {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'templateRegex') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '[') regexClass = true\n\t\t\telse if (character === ']') regexClass = false\n\t\t\telse if (character === '/' && !regexClass) {\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (mode === 'template') {\n\t\t\tcharacters.push(' ')\n\t\t\tif (escaped) {\n\t\t\t\tescaped = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\') {\n\t\t\t\tescaped = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '$' && next === '{') {\n\t\t\t\tcharacters.push(' ')\n\t\t\t\toffset += 1\n\t\t\t\tconst index = templates.length - 1\n\t\t\t\tif (index >= 0) templates[index] = 1\n\t\t\t\tmode = 'templateCode'\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '`') {\n\t\t\t\ttemplates.pop()\n\t\t\t\tmode = templates.length === 0 ? 'code' : 'templateCode'\n\t\t\t\toperandExpected = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst templateCode = mode === 'templateCode'\n\t\tif (character === '/' && next === '/') {\n\t\t\tcharacters.push(' ', ' ')\n\t\t\toffset += 1\n\t\t\tlineTemplate = templateCode\n\t\t\tmode = templateCode ? 'templateLine' : 'line'\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '/' && next === '*') {\n\t\t\tcharacters.push(' ', ' ')\n\t\t\tif (!templateCode && source[offset + 2] === '*') {\n\t\t\t\tconst column = offset - start\n\t\t\t\tconst width = jsdocCharacters.join('').length\n\t\t\t\tjsdocCharacters.push(' '.repeat(column - width), '/', '*')\n\t\t\t\tjsdoc = true\n\t\t\t\tjsdocPresent = true\n\t\t\t}\n\t\t\toffset += 1\n\t\t\tblockTemplate = templateCode\n\t\t\tmode = templateCode ? 'templateBlock' : 'block'\n\t\t\tcontinue\n\t\t}\n\n\t\tif (character === \"'\") {\n\t\t\tcharacters.push(templateCode ? ' ' : character)\n\t\t\tmode = templateCode ? 'templateSingle' : 'single'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '\"') {\n\t\t\tcharacters.push(templateCode ? ' ' : character)\n\t\t\tmode = templateCode ? 'templateDouble' : 'double'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '`') {\n\t\t\tcharacters.push(' ')\n\t\t\ttemplates.push(0)\n\t\t\tmode = 'template'\n\t\t\tescaped = false\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tconst visible = templateCode ? ' ' : character\n\t\tif (character === '/' && next === '=' && !operandExpected) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '=')\n\t\t\toffset += 1\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '/') {\n\t\t\tcharacters.push(visible)\n\t\t\tif (operandExpected) {\n\t\t\t\tmode = templateCode ? 'templateRegex' : 'regex'\n\t\t\t\tescaped = false\n\t\t\t\tregexClass = false\n\t\t\t} else {\n\t\t\t\toperandExpected = true\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t}\n\t\t\tseparated = false\n\t\t\trestricted = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tidentifier.lastIndex = offset\n\t\tconst identifierMatch = identifier.exec(source)\n\t\tif (identifierMatch !== null) {\n\t\t\tconst token = identifierMatch[0]\n\t\t\tcharacters.push(templateCode ? ' '.repeat(token.length) : token)\n\t\t\tif (token.startsWith('#')) {\n\t\t\t\toperandExpected = false\n\t\t\t\tmemberExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = undefined\n\t\t\t\tseparated = false\n\t\t\t\toffset += token.length - 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tconst label = restricted === 'label'\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tif (memberExpected) {\n\t\t\t\tmemberExpected = false\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t} else if (label) {\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t\trestricted = 'complete'\n\t\t\t} else if (/^(?:if|while|with)$/.test(token)) {\n\t\t\t\tpendingRole = 'statement'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'for') {\n\t\t\t\tpendingRole = 'for'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'export') {\n\t\t\t\tpendingRole = 'export'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'default' && pendingRole === 'export') {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:switch|catch)$/.test(token)) {\n\t\t\t\tpendingRole = 'block'\n\t\t\t\toperandExpected = true\n\t\t\t} else if (token === 'await' && pendingRole === 'for') {\n\t\t\t\toperandExpected = true\n\t\t\t} else if (\n\t\t\t\t/^(?:return|throw|case|delete|void|typeof|new|await|yield|else|do|extends)$/.test(token)\n\t\t\t) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:in|instanceof)$/.test(token)) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = true\n\t\t\t} else if (/^(?:break|continue)$/.test(token)) {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = false\n\t\t\t\trestricted = 'label'\n\t\t\t} else if (token === 'debugger') {\n\t\t\t\tpendingRole = undefined\n\t\t\t\toperandExpected = false\n\t\t\t\trestricted = 'complete'\n\t\t\t} else if (\n\t\t\t\ttoken === 'of' &&\n\t\t\t\tframe?.role === 'for' &&\n\t\t\t\tframe.phase === 'left' &&\n\t\t\t\t!frame.binding &&\n\t\t\t\t!operandExpected\n\t\t\t) {\n\t\t\t\tframe.phase = 'right'\n\t\t\t\toperandExpected = true\n\t\t\t\tpendingRole = undefined\n\t\t\t} else if (\n\t\t\t\t/^(?:const|let|var)$/.test(token) &&\n\t\t\t\tframe?.role === 'for' &&\n\t\t\t\tframe.phase === 'left'\n\t\t\t) {\n\t\t\t\tframe.binding = true\n\t\t\t\toperandExpected = true\n\t\t\t\tpendingRole = undefined\n\t\t\t} else {\n\t\t\t\tif (frame?.binding === true) frame.binding = false\n\t\t\t\toperandExpected = false\n\t\t\t\tpendingRole = undefined\n\t\t\t}\n\t\t\toffset += token.length - 1\n\t\t\tcontinue\n\t\t}\n\t\tif (/[0-9]/.test(character)) {\n\t\t\tlet end = offset + 1\n\t\t\twhile (end < source.length) {\n\t\t\t\tconst part = source[end]\n\t\t\t\tif (part === undefined || !/[A-Za-z0-9_$.]/.test(part)) break\n\t\t\t\tend += 1\n\t\t\t}\n\t\t\tconst token = source.slice(offset, end)\n\t\t\tcharacters.push(templateCode ? ' '.repeat(token.length) : token)\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\toffset = end - 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif (\n\t\t\t(character === '!' && next === '=' && source[offset + 2] === '=') ||\n\t\t\t(character === '=' && next === '=' && source[offset + 2] === '=')\n\t\t) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : source.slice(offset + 1, offset + 3))\n\t\t\toffset += 2\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif ((character === '!' || character === '=') && next === '=') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '=')\n\t\t\toffset += 1\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif ((character === '+' && next === '+') || (character === '-' && next === '-')) {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : next)\n\t\t\toffset += 1\n\t\t\tif (separated) operandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '.' && next === '.' && source[offset + 2] === '.') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '..')\n\t\t\toffset += 2\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '?' && next === '.') {\n\t\t\tcharacters.push(visible, templateCode ? ' ' : '.')\n\t\t\toffset += 1\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = true\n\t\t\tpendingRole = undefined\n\t\t\trestricted = undefined\n\t\t\tseparated = false\n\t\t\tcontinue\n\t\t}\n\n\t\tcharacters.push(visible)\n\t\tif (/\\s/.test(character)) continue\n\t\tseparated = false\n\t\trestricted = undefined\n\t\tif (character === '(') {\n\t\t\tparentheses.push({ role: pendingRole ?? 'plain', phase: 'left', binding: false })\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ')') {\n\t\t\tconst frame = parentheses.pop()\n\t\t\toperandExpected = frame?.role === 'statement' || frame?.role === 'for'\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ';') {\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tif (frame?.role === 'for' && frame.phase === 'left') frame.phase = 'classic'\n\t\t\toperandExpected = true\n\t\t\tmemberExpected = false\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === '.') {\n\t\t\toperandExpected = false\n\t\t\tmemberExpected = true\n\t\t\tpendingRole = undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (character === ']' || character === '}') {\n\t\t\tconst frame = parentheses[parentheses.length - 1]\n\t\t\tif (frame?.role === 'for' && frame.phase === 'left' && frame.binding) {\n\t\t\t\tframe.binding = false\n\t\t\t}\n\t\t}\n\t\tif (character === ']') operandExpected = false\n\t\telse if (character === '}') {\n\t\t\tconst index = templates.length - 1\n\t\t\tconst depth = templates[index]\n\t\t\tif (templateCode && index >= 0 && depth !== undefined) {\n\t\t\t\ttemplates[index] = depth - 1\n\t\t\t\tif (depth === 1) mode = 'template'\n\t\t\t}\n\t\t\toperandExpected = false\n\t\t} else if (character === '{') {\n\t\t\tconst index = templates.length - 1\n\t\t\tconst depth = templates[index]\n\t\t\tif (templateCode && index >= 0 && depth !== undefined) templates[index] = depth + 1\n\t\t\toperandExpected = true\n\t\t} else if (character !== '!') operandExpected = true\n\t\tmemberExpected = false\n\t\tpendingRole = undefined\n\t}\n\n\tconst code = characters.join('')\n\tconst present = jsdocPresent || jsdoc\n\tlines.push({\n\t\tsource: source.slice(start),\n\t\tcode,\n\t\tjsdoc: present ? jsdocCharacters.join('').padEnd(code.length, ' ') : undefined,\n\t})\n\treturn lines\n}\n\n/**\n * Checks whether an opaque inventory key contains only canonical slash-separated\n * segments. Empty, `.` and `..` segments are rejected without rewriting the\n * key; ordinary dotfile segments remain valid.\n *\n * @param key - The opaque inventory key to inspect\n * @returns True if every segment is canonical; false otherwise\n *\n * @example\n * ```ts\n * hasCanonicalSegments('src/.hidden.ts') // true\n * hasCanonicalSegments('src/../alias.ts') // false\n * ```\n */\nexport function hasCanonicalSegments(key: string): boolean {\n\treturn key.split('/').every((segment) => segment !== '' && segment !== '.' && segment !== '..')\n}\n\n/**\n * Normalizes a module scope to its canonical directory list. `'.'` represents\n * workspace root; empty, trailing, and dot-segment spellings reduce through\n * {@link resolvePath}, and duplicates are removed in first-seen order.\n *\n * @param module - The module scope to normalize\n * @returns The directory list `module` denotes\n *\n * @example\n * ```ts\n * normalizeDirectories('src/core') // ['src/core']\n * normalizeDirectories(['src/core', 'src/browser']) // ['src/core', 'src/browser']\n * ```\n */\nexport function normalizeDirectories(module: GuideModule): readonly string[] {\n\tconst directories: string[] = []\n\tconst seen = new Set<string>()\n\tfor (const value of isString(module) ? [module] : module) {\n\t\tconst directory = resolvePath('.', value)\n\t\tif (seen.has(directory)) continue\n\t\tseen.add(directory)\n\t\tdirectories.push(directory)\n\t}\n\treturn directories\n}\n\n/**\n * Computes the stable cache key for a {@link GuideModule}. Directories normalize before\n * joining, so equivalent module spellings share one key. The NUL separator\n * cannot occur in filesystem-backed canonical-segment inventory keys, so no\n * directory boundary can collide with directory text.\n *\n * @param module - The module scope to key\n * @returns The normalized directories joined by NUL\n *\n * @example\n * ```ts\n * computeModuleKey(['src/core', 'src/browser']) // 'src/core\\0src/browser'\n * ```\n */\nexport function computeModuleKey(module: GuideModule): string {\n\treturn normalizeDirectories(module).join('\\0')\n}\n\n/**\n * Selects the exact opaque file-inventory keys belonging under any canonical\n * {@link GuideModule} directory, sorted. `'.'` selects canonical root-relative\n * keys without accepting `/`, `./`, or `../` aliases. Every selected exact\n * `index.ts` and every `.test.ts` key is excluded independent of scope order.\n *\n * @param files - The workspace file inventory, root-relative path → file text\n * @param module - The module scope to filter to\n * @returns The scope's file keys, root-relative and sorted\n *\n * @example\n * ```ts\n * selectModuleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']\n * ```\n */\nexport function selectModuleKeys(\n\tfiles: Readonly<Record<string, string>>,\n\tmodule: GuideModule,\n): readonly string[] {\n\tconst dirs = normalizeDirectories(module)\n\tconst indexes = new Set(dirs.map((directory) => resolvePath(directory, 'index.ts')))\n\tconst keys: string[] = []\n\n\tfor (const key of Object.keys(files)) {\n\t\tif (!hasCanonicalSegments(key)) continue\n\t\tif (!key.endsWith('.ts')) continue\n\t\tif (key.endsWith('.test.ts')) continue\n\t\tif (\n\t\t\t!dirs.some((directory) => directory === '.' || key.startsWith(`${directory}/`)) ||\n\t\t\tindexes.has(key)\n\t\t) {\n\t\t\tcontinue\n\t\t}\n\n\t\tkeys.push(key)\n\t}\n\n\treturn keys.sort()\n}\n\n/**\n * Computes the bijection key for a surface symbol — `${keyword} ${name}` — so a symbol-set\n * comparison diffs (name, keyword) pairs rather than names alone.\n *\n * @param symbol - The symbol to key\n * @returns The `${keyword} ${name}` key\n *\n * @example\n * ```ts\n * computeSymbolKey({ name: 'Markdown', keyword: 'class' }) // 'class Markdown'\n * ```\n */\nexport function computeSymbolKey(symbol: SurfaceSymbol): string {\n\treturn `${symbol.keyword} ${symbol.name}`\n}\n\n/**\n * Finds the names present in `names` but absent from `source` — the set-difference\n * behind a both-directions bijection assertion.\n *\n * @param names - The candidate names\n * @param source - The names to compare against\n * @returns The names in `names` that are not in `source`\n *\n * @example\n * ```ts\n * findMissing(['a', 'b'], ['a']) // ['b']\n * ```\n */\nexport function findMissing(\n\tnames: readonly string[],\n\tsource: readonly string[],\n): readonly string[] {\n\tconst existing = new Set(source)\n\treturn names.filter((name) => !existing.has(name))\n}\n\n/**\n * Finds the fences whose language is absent from the caller's listed languages.\n * Untagged fences are always returned because they have no language to list.\n *\n * @param fences - The guide fences to check\n * @param languages - The listed language tags\n * @returns The unlisted fences in input order\n *\n * @example\n * ```ts\n * findUnlisted([{ language: 'typescript', code: 'walk()' }], ['ts'])\n * // [{ language: 'typescript', code: 'walk()' }]\n * ```\n */\nexport function findUnlisted(\n\tfences: readonly GuideFence[],\n\tlanguages: readonly string[],\n): readonly GuideFence[] {\n\tconst listed = new Set(languages)\n\treturn fences.filter((fence) => fence.language === undefined || !listed.has(fence.language))\n}\n\n/**\n * Finds the symbol-key set-difference between two symbol lists — `symbols` present but\n * absent from `source`, compared by {@link computeSymbolKey} so a symbol can drift in\n * neither name nor keyword.\n *\n * @param symbols - The candidate symbols\n * @param source - The symbols to compare against\n * @returns The symbol keys in `symbols` that are not in `source`\n *\n * @example\n * ```ts\n * findMissingSymbols([{ name: 'X', keyword: 'class' }], []) // ['class X']\n * ```\n */\nexport function findMissingSymbols(\n\tsymbols: readonly SurfaceSymbol[],\n\tsource: readonly SurfaceSymbol[],\n): readonly string[] {\n\treturn findMissing(symbols.map(computeSymbolKey), source.map(computeSymbolKey))\n}\n\n/**\n * Checks whether a source declares at least one behavioural member — a `class` or `interface`\n * in its surface that carries a call-signature member — so a guide owes a `## Methods` group only\n * where the source has one to document.\n *\n * @param source - The reflected source under parity\n * @returns True if a surface `class` or `interface` declares a member; false otherwise\n *\n * @example\n * ```ts\n * hasBehaviouralSurface(createSource({ files: { 'src/types.ts': 'export interface Widget { render(): void }' }, module: 'src' })) // true\n * hasBehaviouralSurface(createSource({ files: { 'src/constants.ts': 'export const NAMES = Object.freeze({})' }, module: 'src' })) // false\n * ```\n */\nexport function hasBehaviouralSurface(source: SourceInterface): boolean {\n\treturn source\n\t\t.surface()\n\t\t.some(\n\t\t\t(symbol) =>\n\t\t\t\t(symbol.keyword === 'class' || symbol.keyword === 'interface') &&\n\t\t\t\tsource.methods(symbol.name).length > 0,\n\t\t)\n}\n\n/**\n * Finds the names in `names` that have no example — a fence containing the name at a\n * word boundary in `fences`, or a membership in `examples`, both count as\n * \"has an example\"; presence-only, fence and JSDoc content are never checked.\n *\n * @param names - The candidate symbol/member names to check\n * @param fences - The guide's ```ts Patterns fence bodies to search\n * @param examples - The names already known to carry an `@example` JSDoc block\n * @returns The names in `names` with no fence mention and no `@example`\n *\n * @example\n * ```ts\n * findUnexampled(['walk', 'fold'], ['walk()'], []) // ['fold']\n * findUnexampled(['walk'], [], ['walk']) // []\n * ```\n */\nexport function findUnexampled(\n\tnames: readonly string[],\n\tfences: readonly string[],\n\texamples: readonly string[],\n): readonly string[] {\n\tconst exampled = new Set(examples)\n\treturn names.filter((name) => {\n\t\tif (exampled.has(name)) return false\n\t\tconst boundary = new RegExp(`\\\\b${escapeRegExp(name)}\\\\b`)\n\t\treturn !fences.some((fence) => boundary.test(fence))\n\t})\n}\n\n/**\n * Parses a fence's brace `import` statements into per-specifier imported identifier names —\n * `import type`, mixed multiline braces, and `x as y` aliases all count, each alias resolved to\n * the exported name `x` because that is the name the checked barrel surface must hold. Brace\n * bindings only: a default, namespace, side-effect, or mixed `import Default, { named }`\n * statement is not surfaced.\n *\n * @param fence - A ```ts Patterns fence's verbatim body text\n * @returns One entry per `import ... from 'specifier'` statement, in fence order\n *\n * @example\n * ```ts\n * extractFenceImports(\"import { a, b as c } from 'x'\\n\") // [{ specifier: 'x', names: ['a', 'b'] }]\n * ```\n */\nexport function extractFenceImports(fence: string): readonly FenceImport[] {\n\tconst results: FenceImport[] = []\n\tconst pattern = /import\\s+(?:type\\s+)?\\{([^}]*)\\}\\s*from\\s*['\"]([^'\"]+)['\"]/gs\n\n\tlet match: RegExpExecArray | null\n\twhile ((match = pattern.exec(fence)) !== null) {\n\t\tconst body = match[1]\n\t\tconst specifier = match[2]\n\t\tif (body === undefined || specifier === undefined) continue\n\n\t\tconst names = body\n\t\t\t.split(',')\n\t\t\t.map((part) => part.trim())\n\t\t\t.filter((part) => part.length > 0)\n\t\t\t.map((part) => part.replace(/^type\\s+/, ''))\n\t\t\t.map((part) => {\n\t\t\t\tconst asMatch = part.match(/^(\\w+)\\s+as\\s+\\w+$/)\n\t\t\t\treturn asMatch?.[1] ?? part\n\t\t\t})\n\t\t\t.filter((part) => /^\\w+$/.test(part))\n\n\t\tresults.push({ specifier, names })\n\t}\n\n\treturn results\n}\n\n/**\n * Checks whether a guides-parity link check skips a link `href` — an external\n * scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.\n *\n * @param href - The link destination\n * @returns True if a link check leaves the href unresolved against the filesystem; false otherwise\n *\n * @example\n * ```ts\n * isExternalLink('https://example.com') // true\n * isExternalLink('../helpers.ts') // false\n * ```\n */\nexport function isExternalLink(href: string): boolean {\n\tif (href.startsWith('#')) return true\n\treturn EXTERNAL_SCHEMES.some((scheme) => href.startsWith(scheme))\n}\n\n/**\n * Resolves a relative `target` from a root-relative `directory`, normalizing\n * forward-slash dot segments without filesystem or extension inference. A\n * parent pops only a retained real component; every excess leading parent is\n * preserved.\n *\n * @param directory - The root-relative directory to resolve from\n * @param target - The relative target to resolve\n * @returns The normalized path, or `'.'` when no segment remains, retaining every excess parent\n *\n * @example\n * ```ts\n * resolvePath('guides/src', '../../src/core/helpers.ts') // 'src/core/helpers.ts'\n * resolvePath('.', '../../outside.ts') // '../../outside.ts'\n * ```\n */\nexport function resolvePath(directory: string, target: string): string {\n\tconst combined = `${directory}/${target}`\n\tconst segments: string[] = []\n\n\tfor (const segment of combined.split('/')) {\n\t\tif (segment === '' || segment === '.') continue\n\t\tif (segment === '..') {\n\t\t\tconst previous = segments[segments.length - 1]\n\t\t\tif (previous !== undefined && previous !== '..') segments.pop()\n\t\t\telse segments.push(segment)\n\t\t\tcontinue\n\t\t}\n\t\tsegments.push(segment)\n\t}\n\n\treturn segments.length === 0 ? '.' : segments.join('/')\n}\n\n/**\n * Resolves a relative `target` from the directory containing a root-relative\n * declaring `file`. A slashless file belongs to the workspace root; path\n * reduction is delegated to {@link resolvePath}.\n *\n * @param file - The root-relative declaring file\n * @param target - The relative link destination to resolve\n * @returns The normalized path, retaining every excess leading parent\n *\n * @example\n * ```ts\n * resolveLink('guides/src/guide.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'\n * resolveLink('index.ts', './root.ts') // 'root.ts'\n * ```\n */\nexport function resolveLink(file: string, target: string): string {\n\tconst index = file.lastIndexOf('/')\n\tconst directory = index < 0 ? '.' : file.slice(0, index)\n\treturn resolvePath(directory, target)\n}\n\n/**\n * Finds the first code-span value by descending an inline node list, following\n * into `emphasis` / `link` / `image` children — the extraction rule behind a\n * Surface or Methods table row's first-column identifier.\n *\n * @param nodes - The inline nodes to search\n * @returns The first code span's literal text, or `undefined` when none is found\n *\n * @example\n * ```ts\n * findFirstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'\n * ```\n */\nexport function findFirstCode(nodes: readonly InlineNode[]): string | undefined {\n\tfor (const node of nodes) {\n\t\tif (isCodeSpanNode(node)) return node.value\n\t\tif (isEmphasisNode(node) || isLinkNode(node) || isImageNode(node)) {\n\t\t\tconst value = findFirstCode(node.children)\n\t\t\tif (value !== undefined) return value\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Extracts the link hrefs within one table cell's inline content, in walk order.\n *\n * @param cell - The cell's inline nodes\n * @returns The cell's link hrefs, in walk order\n *\n * @example\n * ```ts\n * extractCellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']\n * ```\n */\nexport function extractCellLinks(cell: readonly InlineNode[]): readonly string[] {\n\tconst links: string[] = []\n\tfor (const node of walkNodes({ element: 'paragraph', children: cell })) {\n\t\tif (isLinkNode(node)) links.push(node.href)\n\t}\n\treturn links\n}\n\n/**\n * Returns the identifier prefix of a code-span text — everything before its first `<`,\n * trimmed. Guide cells and headings may annotate a generic-parameterized name\n * (`MarkdownHandler<TNode, T>`) for readability, but the bijection key is the\n * bare identifier the source scanner captures, so both sides must normalize\n * the same way.\n *\n * @param code - A code span's literal text\n * @returns The identifier prefix, or an empty string when `code` is empty\n *\n * @example\n * ```ts\n * normalizeIdentifier('MarkdownHandler<TNode, T>') // 'MarkdownHandler'\n * normalizeIdentifier('fold') // 'fold'\n * ```\n */\nexport function normalizeIdentifier(code: string): string {\n\tconst index = code.indexOf('<')\n\treturn (index < 0 ? code : code.slice(0, index)).trim()\n}\n\n/**\n * Extracts compared inline content — the text of a table cell or candidate entity heading\n * flattened with every code span kept as a code span, so `` `Widget` `` reads the same wherever\n * the parity reader compares it. Emphasis drops to its text, a link drops to its text, an image\n * drops to its alternative text, and the markdown parser has already unescaped `\\|`.\n *\n * @param cell - The inline nodes to flatten\n * @returns The compared text, code spans included\n *\n * @example\n * ```ts\n * extractCellText([{ element: 'codeSpan', value: 'Widget' }]) // '`Widget`'\n * ```\n */\nexport function extractCellText(cell: readonly InlineNode[]): string {\n\tlet text = ''\n\tfor (const node of cell) {\n\t\tif (isCodeSpanNode(node)) text += `\\`${node.value}\\``\n\t\telse if (isEmphasisNode(node) || isLinkNode(node) || isImageNode(node)) {\n\t\t\ttext += extractCellText(node.children)\n\t\t} else text += flattenText(node)\n\t}\n\treturn text\n}\n\n/**\n * Builds one table cell's inline content from its compared text — the inverse of\n * {@link extractCellText}. A single-backtick run whose text carries no inner backtick and\n * neither a leading nor a trailing space becomes a code span; every other character, a backtick\n * included, becomes literal text, which `renderMarkdown` escapes so the rendered cell parses back\n * to the text this function was given.\n *\n * @remarks\n * The compared form spells every code span with one backtick per side, because\n * {@link extractCellText} emits `` `${value}` `` whatever delimiter the source used. A run this\n * function refuses is therefore a run no parsed cell produced, and emitting it as text is what\n * keeps the projection total: reading the rendered cell back through {@link extractCellText}\n * returns the text, so a rendered row and a hand-written row compare the same. A code span whose\n * own text carries a backtick or a boundary space is outside the compared form's fidelity in\n * either direction, and this function writes it as text rather than guessing a delimiter.\n *\n * @param text - The cell's compared text, as {@link extractCellText} returns it\n * @returns The cell's inline nodes, in text order\n *\n * @example\n * ```ts\n * buildCell('Holds a `Widget`.')\n * // [{ element: 'text', value: 'Holds a ' }, { element: 'codeSpan', value: 'Widget' }, { element: 'text', value: '.' }]\n * ```\n */\nexport function buildCell(text: string): readonly InlineNode[] {\n\tconst nodes: InlineNode[] = []\n\tconst spans = /`([^`]+)`/g\n\tlet cursor = 0\n\tlet span: RegExpExecArray | null\n\n\twhile ((span = spans.exec(text)) !== null) {\n\t\tconst value = span[1]\n\t\tif (value === undefined) continue\n\t\tif (span.index > cursor) nodes.push({ element: 'text', value: text.slice(cursor, span.index) })\n\t\tif (value.trim() === value) nodes.push({ element: 'codeSpan', value })\n\t\telse nodes.push({ element: 'text', value: span[0] })\n\t\tcursor = span.index + span[0].length\n\t}\n\tif (cursor < text.length) nodes.push({ element: 'text', value: text.slice(cursor) })\n\n\treturn coalesceText(nodes)\n}\n\n/**\n * Finds the index of the column whose header text is `header` so a table's columns survive\n * reordering. The match is exact and case-sensitive — a table without that exact header\n * contributes nothing to the projection reading it, so a `## Surface` table with no\n * {@link SUMMARY} column leaves every row's summary absent and {@link findDrift} reports each\n * of those rows, never agreement.\n *\n * @param table - The table to inspect\n * @param header - The exact header text to locate, for example `Kind`\n * @returns The column's index, or `undefined` when the table has no such header\n *\n * @example\n * ```ts\n * findColumnIndex(table, 'Kind') // 1, or undefined\n * ```\n */\nexport function findColumnIndex(table: TableNode, header: string): number | undefined {\n\tfor (let index = 0; index < table.header.length; index += 1) {\n\t\tconst cell = table.header[index]\n\t\tif (\n\t\t\tcell !== undefined &&\n\t\t\tflattenText({ element: 'paragraph', children: cell }).trim() === header\n\t\t) {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Extracts the module-scope exports declared in one file's source text — the declaration keys\n * {@link collectKeys} reports, each split back into the keyword and name that built it, deduped by\n * (keyword, name).\n *\n * @remarks\n * That one grammar matches `export (async)? (function(\\*)?|class|const|interface|type) Name`; a\n * generator export (`export function* walk`) keys as the `function` keyword, its trailing `*`\n * stripped before the {@link ExportKeyword} check. Scanning uses {@link extractSourceLines}, so\n * comment and template payload is excluded while its uninterrupted column-zero head remains\n * required; preserved columns do not grant membership to leading/interrupted comment forms. The\n * population is exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is outside\n * this reflection contract, not forbidden by general package policy.\n *\n * @param source - The file's source text\n * @returns The file's exported symbols, in file order\n *\n * @example\n * ```ts\n * extractExports('export class Markdown {}\\n') // [{ name: 'Markdown', keyword: 'class' }]\n * extractExports('export function* walk() {}\\n') // [{ name: 'walk', keyword: 'function' }]\n * ```\n */\nexport function extractExports(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst summaries = collectSummaries(lines)\n\tconst keys = collectKeys(lines)\n\n\tfor (const line of lines) {\n\t\tconst key = keys.get(line)\n\t\tif (key === undefined || seen.has(key)) continue\n\n\t\t// A declaration key is `${keyword} ${name}`, so its one space splits it back into the pair\n\t\t// that built it. A member key carries no space, so its keyword reads empty and the keyword\n\t\t// guard drops it here — no second head pattern excludes it.\n\t\tconst space = key.indexOf(' ')\n\t\tconst keyword = key.slice(0, Math.max(space, 0))\n\t\tif (!isExportKeyword(keyword)) continue\n\n\t\tseen.add(key)\n\t\tconst name = key.slice(space + 1)\n\t\tconst summary = summaries.get(line)\n\t\tsymbols.push({ name, keyword, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Extracts the module-scope declarations lacking the `export` keyword in one file's source text —\n * the mirror image of {@link extractExports}'s grammar, anchored the same way (column 0, so an\n * indented inner declaration never matches).\n *\n * @remarks\n * Scans only the {@link ExportKeyword} keywords (`function` / `class` / `const` / `interface` /\n * `type`) — a module-scope `let` or `var` is outside this scanner's declaration-keyword grammar\n * and out of this check's contract. Scanning uses {@link extractSourceLines}, so comment and\n * template payload is excluded while its uninterrupted column-zero head remains required;\n * preserved columns do not widen membership. `enum` is likewise outside this reflection\n * population, not forbidden by general package policy.\n *\n * @param source - The file's source text\n * @returns The file's hidden (non-exported) symbols, in file order\n *\n * @example\n * ```ts\n * extractHidden('function secretHelper() {}\\n') // [{ name: 'secretHelper', keyword: 'function' }]\n * extractHidden('export class X {}\\n') // []\n * ```\n */\nexport function extractHidden(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst summaries = collectSummaries(lines)\n\n\tfor (const line of lines) {\n\t\tif (line.code.startsWith('export ')) continue\n\t\tconst match = line.code.match(/^(?:async )?(function\\*?|class|const|interface|type) (\\w+)/)\n\t\tconst rawKeyword = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst keyword = rawKeyword === undefined ? undefined : rawKeyword.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(keyword) || !isNonEmptyString(name) || !isExportKeyword(keyword)) continue\n\n\t\tconst key = `${keyword} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tconst summary = summaries.get(line)\n\t\tsymbols.push({ name, keyword, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Joins the declaration head starting at `start` into one space-separated\n * line, consuming lines until the first that opens a body: one that ends with\n * `{`, or one that closes an empty body with `{}` or `{ }`.\n *\n * @remarks\n * A line ending with `{}` closes an empty body only when every angle, round,\n * and square bracket the head opened outside quoted text has closed; inside\n * one, `{}` is a type or an argument, and an arrow's `=>` closes nothing. A\n * head that reaches the next column-zero `export` line opens no body.\n *\n * @param lines - The file's source lines\n * @param start - The index of the head's first line\n * @returns The joined head, or `undefined` when no line opens a body\n *\n * @example\n * ```ts\n * joinHead(['export class X {'], 0) // { text: 'export class X {', end: 0 }\n * joinHead(['export interface Y extends X {}'], 0) // { text: 'export interface Y extends X {}', end: 0 }\n * ```\n */\nexport function joinHead(lines: readonly string[], start: number): DeclarationHead | undefined {\n\tconst parts: string[] = []\n\n\tfor (let index = start; index < lines.length; index += 1) {\n\t\tconst line = lines[index]\n\t\tif (line === undefined) break\n\t\tconst text = line.trimEnd()\n\t\t// A wrapped head never continues on an exported declaration, so reaching one means no body opened.\n\t\tif (index > start && text.startsWith('export ')) return undefined\n\t\tparts.push(index === start ? text : text.trimStart())\n\t\tif (text.endsWith('{')) return { text: parts.join(' '), end: index }\n\t\tconst bare = parts.join(' ').replace(/'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/g, '')\n\t\tconst closed =\n\t\t\t(bare.match(/</g)?.length ?? 0) <= (bare.match(/(?<!=)>/g)?.length ?? 0) &&\n\t\t\t(bare.match(/\\(/g)?.length ?? 0) <= (bare.match(/\\)/g)?.length ?? 0) &&\n\t\t\t(bare.match(/\\[/g)?.length ?? 0) <= (bare.match(/\\]/g)?.length ?? 0)\n\t\tif (closed && /\\{\\s*\\}$/.test(text)) return { text: parts.join(' '), end: index }\n\t}\n\n\treturn undefined\n}\n\n/**\n * Escapes every regex metacharacter in a literal string so it reads as text\n * inside a larger `RegExp` source rather than as syntax.\n *\n * @remarks\n * A caller-supplied name reaches a `RegExp` through this: {@link\n * findUnexampled} splices it into a word-boundary search, so a name carrying\n * `$`, `(`, `[`, or `.` matches that character literally instead of throwing or\n * matching text it does not name. Pure and total; never throws.\n *\n * @param value - The literal string to escape\n * @returns `value` with every regex metacharacter backslash-escaped\n *\n * @example\n * ```ts\n * escapeRegExp('A.B') // 'A\\\\.B'\n * new RegExp(`^${escapeRegExp('A.B')}$`).test('AxB') // false\n * ```\n */\nexport function escapeRegExp(value: string): string {\n\treturn value.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n}\n\n/**\n * Collects every `export class` / `export interface` declaration one file's source text declares,\n * each keyed `${keyword} ${name}` and carrying the body lines and the base identifiers read from\n * its own head, so a body and a heritage clause always come from the same declaration.\n *\n * @remarks\n * The whole file is projected once through {@link extractSourceLines} and every head is read from\n * that one projection, so a scope resolving many names reads each file once rather than once per\n * name. A head is a column-zero `export class` / `export interface` line, an oxfmt-wrapped\n * signature joined through {@link joinHead}, with an optional generic parameter list and an\n * optional heritage clause between the identifier and the opening `{`; the identifier is the head's\n * own run up to that list or clause, so it enters the key as literal text and no name reaches a\n * `RegExp`. Body lines are the raw source between the head and the first projected column-zero `}`,\n * keeping JSDoc evidence intact; a head whose last line closes its own body with `{}` or `{ }`\n * records an empty body. Every balanced `<...>` span is removed from the head before its\n * `extends` clause is read, so a `T extends Base` type parameter is never a base and `Base<T>`\n * reads as `Base`; a class's `implements` clause and everything after it is excluded, and a\n * qualified base such as `namespace.Base` is returned verbatim. The first head of a key that opens\n * a column-zero close answers for that key: a head that opens none records nothing, and a later\n * head of a key already collected adds nothing unless the earlier head recorded neither a body\n * nor bases, which declares nothing as {@link Source} reads it, so the later head replaces it.\n *\n * @param source - The file's source text to read\n * @returns One entry per collected declaration, keyed `${keyword} ${name}`\n *\n * @example\n * ```ts\n * collectDeclarations('export interface X extends Y {\\n\\twalk(): void\\n}\\n').get('interface X')\n * // { body: ['\\twalk(): void'], bases: ['Y'] }\n * ```\n */\nexport function collectDeclarations(source: string): ReadonlyMap<string, Declaration> {\n\tconst declarations = new Map<string, Declaration>()\n\tconst opener = /^export (?:class|interface) /\n\tconst grammar = /^export (class|interface) ([^\\s<]+)(?:<.*>)?(?: .*)? \\{(?:\\s*\\})?$/\n\tconst lines = extractSourceLines(source)\n\tconst projected = lines.map((line) => line.code)\n\n\tfor (let index = 0; index < projected.length; index += 1) {\n\t\tconst line = projected[index]\n\t\tif (line === undefined || !opener.test(line)) continue\n\n\t\tconst head = joinHead(projected, index)\n\t\tif (head === undefined) continue\n\t\tconst declared = grammar.exec(head.text)\n\t\tconst keyword = declared?.[1]\n\t\tconst name = declared?.[2]\n\t\tif (keyword === undefined || name === undefined) continue\n\n\t\tconst key = `${keyword} ${name}`\n\t\tconst known = declarations.get(key)\n\t\t// A head with neither a body nor bases declares nothing, as Source reads it, so a later head answers.\n\t\tif (known !== undefined && (known.body.length > 0 || known.bases.length > 0)) continue\n\n\t\tlet depth = 0\n\t\tlet flat = ''\n\t\tfor (const character of head.text.slice(`export ${key}`.length, head.text.lastIndexOf('{'))) {\n\t\t\tif (character === '<') depth += 1\n\t\t\telse if (character === '>') depth = Math.max(0, depth - 1)\n\t\t\telse if (depth === 0) flat += character\n\t\t}\n\t\tconst clause = flat.replace(/\\bimplements\\b[\\s\\S]*$/, '').match(/\\bextends\\b([\\s\\S]*)$/)?.[1]\n\t\tconst bases =\n\t\t\tclause === undefined\n\t\t\t\t? []\n\t\t\t\t: clause\n\t\t\t\t\t\t.split(',')\n\t\t\t\t\t\t.map((base) => base.trim())\n\t\t\t\t\t\t.filter(isNonEmptyString)\n\n\t\t// joinHead ends a head on `}` only where its line closes an empty body, so no close follows it.\n\t\tif (head.text.endsWith('}')) {\n\t\t\tdeclarations.set(key, { body: [], bases })\n\t\t\tcontinue\n\t\t}\n\n\t\tfor (let close = head.end + 1; close < projected.length; close += 1) {\n\t\t\tif (projected[close] !== '}') continue\n\t\t\tdeclarations.set(key, {\n\t\t\t\tbody: lines.slice(head.end + 1, close).map((record) => record.source),\n\t\t\t\tbases,\n\t\t\t})\n\t\t\tbreak\n\t\t}\n\n\t\t// An unterminated body records nothing — keep scanning in case a later head closes.\n\t}\n\n\treturn declarations\n}\n\n/**\n * Locates the named `export class` / `export interface` declaration in one file's source text\n * and returns its body lines and its base identifiers read from that one head, so a body and a\n * heritage clause always come from the same declaration, or `undefined` when the file declares\n * no such head.\n *\n * @remarks\n * The one named lookup over {@link collectDeclarations}, which owns the head grammar, the body\n * window, and the base reading. This lookup spells the map's `${keyword} ${name}` key for its\n * caller, so a consumer reading one name never writes that convention itself. `name` is compared\n * as literal text against the identifier the head itself carries, so a metacharacter in `name`\n * names that character rather than matching text it does not name. Every call collects the whole\n * file afresh: a consumer reading many names from one file calls {@link collectDeclarations} once\n * and reads the map, and {@link Source} holds one such map per module scope.\n *\n * @param source - The file's source text to search\n * @param keyword - Whether to look for a `class` or an `interface`\n * @param name - The declaration's identifier\n * @returns Its body and bases, or `undefined` when `source` declares no such head\n *\n * @example\n * ```ts\n * extractDeclaration('export interface X extends Y {\\n\\twalk(): void\\n}\\n', 'interface', 'X')\n * // { body: ['\\twalk(): void'], bases: ['Y'] }\n * ```\n */\nexport function extractDeclaration(\n\tsource: string,\n\tkeyword: DeclarationKeyword,\n\tname: string,\n): Declaration | undefined {\n\treturn collectDeclarations(source).get(`${keyword} ${name}`)\n}\n\n/**\n * Selects the member lines declaring a callable member: plain, `async`, generator\n * (`*`), and optional (`records?(`) methods all count; getters, setters,\n * `static` members, and `#` privates never do (their keyword or `#` breaks\n * the `name(` shape). The grammar is {@link collectKeys}'s, read once over\n * {@link extractBodyLines}'s projection of the body, so commented method-like payload never\n * becomes eligible and each member keys to the owner head that projection supplies. Each member\n * carries its own doc block's description paragraph, read through {@link collectSummaries}; the\n * first declaration of a name answers for it.\n *\n * @param lines - A declaration's body lines\n * @returns The declared members, deduplicated by name and sorted by name\n *\n * @example\n * ```ts\n * extractMemberMethods(['\\tmap(): void', '\\tfilter(): void']) // [{ name: 'filter' }, { name: 'map' }]\n * ```\n */\nexport function extractMemberMethods(lines: readonly string[]): readonly MethodEntry[] {\n\tconst methods = new Map<string, MethodEntry>()\n\tconst projected = extractBodyLines(lines)\n\tconst summaries = collectSummaries(projected)\n\tconst keys = collectKeys(projected)\n\n\tfor (const line of projected) {\n\t\t// A member key is `${owner}.${member}`, so its dot splits the member name back out and a\n\t\t// declaration key, which carries none, drops out here.\n\t\tconst key = keys.get(line) ?? ''\n\t\tconst dot = key.indexOf('.')\n\t\tif (dot < 0) continue\n\n\t\tconst name = key.slice(dot + 1)\n\t\tif (methods.has(name)) continue\n\t\tconst summary = summaries.get(line)\n\t\tmethods.set(name, { name, ...(summary === undefined ? {} : { summary }) })\n\t}\n\n\treturn Array.from(methods.values()).sort((a, b) =>\n\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t)\n}\n\n/**\n * Selects the block nodes under the named `##` heading, up to the next `##`-or-higher\n * heading (or the document's end) — the section-scoping window `extractSurface` /\n * `extractMethods` walk over.\n *\n * @param document - The parsed guide document\n * @param heading - The `##` heading text to scope to, for example `Surface`\n * @returns The blocks belonging to that section, in document order\n *\n * @example\n * ```ts\n * selectSectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`\n * ```\n */\nexport function selectSectionBlocks(\n\tdocument: MarkdownDocument,\n\theading: string,\n): readonly BlockNode[] {\n\tconst blocks: BlockNode[] = []\n\tlet active = false\n\n\tfor (const block of document.children) {\n\t\tif (isHeadingNode(block) && block.level <= 2) {\n\t\t\tif (block.level === 2 && flattenText(block).trim() === heading) {\n\t\t\t\tactive = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (active) break\n\t\t}\n\n\t\tif (active) blocks.push(block)\n\t}\n\n\treturn blocks\n}\n\n/**\n * Extracts one `## Surface` table row's symbol — its column 0 code span as the name, its\n * {@link KIND} column as the keyword, and its {@link SUMMARY} column as the compared summary\n * when the table has that column. A row with no code-span name and a row whose `Kind` text is\n * no {@link ExportKeyword} have no symbol to key, so each returns `undefined`.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's symbol, or `undefined` when the row keys none\n *\n * @example\n * ```ts\n * extractRowSymbol(table, 0) // { name: 'walk', keyword: 'function', summary: 'Walks the tree.' }\n * ```\n */\nexport function extractRowSymbol(table: TableNode, row: number): SurfaceSymbol | undefined {\n\tconst cells = table.rows[row]\n\tif (cells === undefined) return undefined\n\n\tconst nameCell = cells[0]\n\tconst rawName = nameCell === undefined ? undefined : findFirstCode(nameCell)\n\tconst name = rawName === undefined ? undefined : normalizeIdentifier(rawName)\n\tif (name === undefined) return undefined\n\n\tconst column = findColumnIndex(table, KIND)\n\tconst kindCell = column === undefined ? undefined : cells[column]\n\tconst keyword =\n\t\tkindCell === undefined ? '' : flattenText({ element: 'paragraph', children: kindCell }).trim()\n\tif (!isExportKeyword(keyword)) return undefined\n\n\tconst summary = extractRowSummary(table, row)\n\treturn { name, keyword, ...(summary === undefined ? {} : { summary }) }\n}\n\n/**\n * Extracts one `## Methods` table row's entry — its column 0 code span as the name and its\n * {@link SUMMARY} column as the compared summary when the table has that column. A row with no\n * code-span name has no member to key, so it returns `undefined`.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's entry, or `undefined` when the row keys none\n *\n * @example\n * ```ts\n * extractRowEntry(table, 0) // { name: 'walk', summary: 'Walks the tree.' }\n * ```\n */\nexport function extractRowEntry(table: TableNode, row: number): MethodEntry | undefined {\n\tconst cells = table.rows[row]\n\tif (cells === undefined) return undefined\n\n\tconst cell = cells[0]\n\tconst rawName = cell === undefined ? undefined : findFirstCode(cell)\n\tconst name = rawName === undefined ? undefined : normalizeIdentifier(rawName)\n\tif (name === undefined) return undefined\n\n\tconst summary = extractRowSummary(table, row)\n\treturn { name, ...(summary === undefined ? {} : { summary }) }\n}\n\n/**\n * Extracts one row's compared summary — its {@link SUMMARY} column read through\n * {@link extractCellText} and {@link normalizeSummary}. A table with no such column and a row\n * whose cell is empty each carry no summary and return `undefined` rather than an empty string,\n * so {@link findDrift} reports the absence.\n *\n * @param table - The table to read\n * @param row - The index of the row within {@link TableNode.rows}\n * @returns The row's compared summary, or `undefined` when it carries none\n *\n * @example\n * ```ts\n * extractRowSummary(table, 0) // 'Walks the tree.'\n * ```\n */\nexport function extractRowSummary(table: TableNode, row: number): string | undefined {\n\tconst described = findColumnIndex(table, SUMMARY)\n\tconst cells = table.rows[row]\n\tconst cell = described === undefined || cells === undefined ? undefined : cells[described]\n\tconst summary = cell === undefined ? '' : normalizeSummary(extractCellText(cell))\n\treturn summary.length === 0 ? undefined : summary\n}\n\n/**\n * Extracts every `## Surface` identifier the guide documents — each table row's column 0\n * code span (the name) paired with its `Kind` column (located by header text), unioned with every\n * H3 entity heading whose trimmed compared inline content is exactly its backticked code-span\n * name, deduped by {@link computeSymbolKey}. A row with no code-span name has no name to key a\n * symbol on, so this reader skips it and {@link extractUnnamed} reports it; a row with an\n * unrecognized `Kind` text is skipped. A row also carries its {@link SUMMARY} column's compared\n * text when the table has that column; a table without it leaves every row's summary absent,\n * which {@link findDrift} reports.\n *\n * @remarks\n * The heading boundary compares {@link extractCellText} with the raw value from\n * {@link findFirstCode} before {@link normalizeIdentifier} strips a generic annotation.\n * Surrounding spaces, emphasis, and links preserve that identity. This reader refuses a heading\n * carrying any other visible text or an additional code span. Entries retain encounter order, and\n * the first-seen name + keyword wins: a genuine heading before its table row keeps the heading's\n * summary-less class entry, while a table row before that heading keeps its `Summary`.\n *\n * @param document - The parsed guide document\n * @returns The documented surface, in encounter order\n *\n * @example\n * ```ts\n * extractSurface(document) // [{ name: 'Markdown', keyword: 'class' }, ...]\n * ```\n */\nexport function extractSurface(document: MarkdownDocument): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const block of selectSectionBlocks(document, SURFACE)) {\n\t\tif (isTableNode(block)) {\n\t\t\tfor (let row = 0; row < block.rows.length; row += 1) {\n\t\t\t\tconst symbol = extractRowSymbol(block, row)\n\t\t\t\tif (symbol === undefined) continue\n\t\t\t\tconst key = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(key)) continue\n\t\t\t\tseen.add(key)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isHeadingNode(block) && block.level === 3) {\n\t\t\tconst rawName = findFirstCode(block.children)\n\t\t\tif (rawName === undefined || extractCellText(block.children).trim() !== `\\`${rawName}\\``) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst name = normalizeIdentifier(rawName)\n\t\t\tconst symbol: SurfaceSymbol = { name, keyword: 'class' }\n\t\t\tconst key = computeSymbolKey(symbol)\n\t\t\tif (seen.has(key)) continue\n\t\t\tseen.add(key)\n\t\t\tsymbols.push(symbol)\n\t\t}\n\t}\n\n\treturn symbols\n}\n\n/**\n * Extracts one {@link MethodGroup} per documented behavioral interface in `## Methods` —\n * an H4 with a code span sets the current interface, and the table immediately\n * following becomes its documented methods. A row with no code-span name has no name to key a\n * member on, so this reader skips it and {@link extractUnnamed} reports it. Each row carries its\n * {@link SUMMARY} column's compared text when the table has that column.\n *\n * @param document - The parsed guide document\n * @returns The documented method groups, in document order\n *\n * @example\n * ```ts\n * extractMethods(document) // [{ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }]\n * ```\n */\nexport function extractMethods(document: MarkdownDocument): readonly MethodGroup[] {\n\tconst groups: MethodGroup[] = []\n\n\tfor (const [table, name] of collectGroups(document)) {\n\t\tconst methods: MethodEntry[] = []\n\t\tfor (let row = 0; row < table.rows.length; row += 1) {\n\t\t\tconst entry = extractRowEntry(table, row)\n\t\t\tif (entry !== undefined) methods.push(entry)\n\t\t}\n\t\tgroups.push({ interface: name, methods })\n\t}\n\n\treturn groups\n}\n\n/**\n * Collects each `## Methods` table keyed to the interface its `####` heading names — an H4\n * carrying a code span sets the current interface and the table immediately following claims it,\n * so a heading with no table and a table with no heading before it contribute nothing. The map\n * iterates in document order and a node keys itself, so a repeated identical table keeps its own\n * entry.\n *\n * @param document - The parsed guide document\n * @returns One entry per documented `## Methods` table, in document order\n *\n * @example\n * ```ts\n * collectGroups(document).values().next().value // 'GuideInterface'\n * ```\n */\nexport function collectGroups(document: MarkdownDocument): ReadonlyMap<TableNode, string> {\n\tconst groups = new Map<TableNode, string>()\n\tlet current: string | undefined\n\n\tfor (const block of selectSectionBlocks(document, METHODS)) {\n\t\tif (isHeadingNode(block) && block.level === 4) {\n\t\t\tconst rawInterface = findFirstCode(block.children)\n\t\t\tcurrent = rawInterface === undefined ? undefined : normalizeIdentifier(rawInterface)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isTableNode(block) && current !== undefined) {\n\t\t\tgroups.set(block, current)\n\t\t\tcurrent = undefined\n\t\t}\n\t}\n\n\treturn groups\n}\n\n/**\n * Extracts every `## Surface` or `## Methods` table row whose first cell carries no code span.\n * {@link extractSurface} and {@link extractMethods} skip such a row, because a row with no\n * name gives them nothing to key a symbol or a member on, and this projection is what reports\n * the skip. Each entry is the row's cells read through {@link extractCellText} and joined\n * by ` | `, so a reader can locate the row in the guide; the `## Surface` rows come first,\n * then the `## Methods` rows, each in document order. {@link GuideInterface.unnamed} caches it.\n *\n * @param document - The parsed guide document\n * @returns One entry per row carrying no code-span name\n *\n * @example\n * ```ts\n * extractUnnamed(document) // ['Widget | class | Represents a widget.']\n * ```\n */\nexport function extractUnnamed(document: MarkdownDocument): readonly string[] {\n\tconst unnamed: string[] = []\n\n\tfor (const heading of [SURFACE, METHODS]) {\n\t\tfor (const block of selectSectionBlocks(document, heading)) {\n\t\t\tif (!isTableNode(block)) continue\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst cell = row[0]\n\t\t\t\tif (cell !== undefined && findFirstCode(cell) !== undefined) continue\n\t\t\t\tunnamed.push(row.map((content) => extractCellText(content)).join(' | '))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn unnamed\n}\n\n/**\n * Extracts every link href in the guide document, including table cells — a full,\n * depth-first walk of the whole AST.\n *\n * @param document - The parsed guide document\n * @returns Every link's href, in walk order\n *\n * @example\n * ```ts\n * extractLinks(document) // ['../../src/core/helpers.ts', 'https://example.com']\n * ```\n */\nexport function extractLinks(document: MarkdownDocument): readonly string[] {\n\tconst links: string[] = []\n\tfor (const node of walkNodes(document)) {\n\t\tif (isLinkNode(node)) links.push(node.href)\n\t}\n\treturn links\n}\n\n/**\n * Extracts the relative test links declared under `## Tests` — every link href found\n * within that section only.\n *\n * @param document - The parsed guide document\n * @returns The `## Tests` section's link hrefs, in walk order\n *\n * @example\n * ```ts\n * extractTests(document) // ['../../tests/src/core/Markdown.test.ts', ...]\n * ```\n */\nexport function extractTests(document: MarkdownDocument): readonly string[] {\n\tconst links: string[] = []\n\tfor (const block of selectSectionBlocks(document, TESTS)) {\n\t\tfor (const node of walkNodes(block)) {\n\t\t\tif (isLinkNode(node)) links.push(node.href)\n\t\t}\n\t}\n\treturn links\n}\n\n/**\n * Returns the canonical body of one genuine JSDoc span — the `/**` opener, the closing\n * marker, each line's continuation marker, and the block's leading indentation removed,\n * with per-line trailing whitespace trimmed and the surrounding blank lines dropped. A\n * line's own indentation beyond the marker is kept, so an `@example` fence body keeps the\n * shape it was written in.\n *\n * @param comment - One complete genuine JSDoc span's raw text\n * @returns The span's unwrapped body\n *\n * @example\n * ```ts\n * normalizeComment('/**' + ' Creates a widget. *' + '/') // 'Creates a widget.'\n * ```\n */\nexport function normalizeComment(comment: string): string {\n\treturn unwrapComment(comment).join('\\n').replace(/^\\n+/, '').replace(/\\n+$/, '')\n}\n\n/**\n * Unwraps one genuine JSDoc span into one content line per physical line — the `/**` opener,\n * the closing marker, each line's continuation marker, and per-line trailing whitespace removed,\n * with a line's own indentation past the marker kept. The result is aligned with\n * `comment.split('\\n')`, so an index found in it addresses the same physical line of the span it\n * was built from, which is what lets a rewrite keep every line it does not replace.\n * {@link normalizeComment} is this projection joined and trimmed at its ends.\n *\n * @param comment - One complete genuine JSDoc span's raw text\n * @returns One content line per physical line of the span\n *\n * @example\n * ```ts\n * unwrapComment('/**' + '\\n * Walks.\\n *' + '/') // ['', 'Walks.', '']\n * ```\n */\nexport function unwrapComment(comment: string): readonly string[] {\n\tconst body = /^[ \\t]*\\/\\*([\\s\\S]*?)\\*\\/[ \\t]*$/.exec(comment)?.[1] ?? comment\n\treturn body.split('\\n').map((line) => line.replace(/^[ \\t]*\\*[ \\t]?/, '').replace(/[ \\t]+$/, ''))\n}\n\n/**\n * Returns the canonical compared form of a description paragraph. `{@link Target}` and\n * `{@link Target | label}` become the code token of the target text, or of the label where one is\n * written; a target's module part — the inline import form `import('./module.js').` and TSDoc's\n * package-qualified form `@scope/pkg#` — is dropped first. Every run of whitespace, including a\n * collapsed continuation marker and a line break, becomes one space, the ends trim, and a code\n * span keeps its delimiters while its own boundary whitespace goes. The guide's side and the\n * source's side read through this one form.\n *\n * @remarks\n * The clauses land in a fixed order, because each one decides what the next one sees. Every\n * single-backtick code span — one backtick per side, no inner backtick, no adjacent backtick —\n * is located first, so a delimiter the `{@link}` expansion inserts afterwards is never mistaken\n * for an authored one. The expansion then runs outside those spans\n * only, so a `{@link}` written inside a code span stays literal on both sides. Whitespace\n * collapses next, which is what makes a span wrapped across two physical lines comparable at\n * all. The boundary trim runs last, inside each located span: the markdown parser strips one\n * space from each end of a code span it reads, and this trim is the symmetric rule that meets\n * it, so `` ` | ` ``, `` ` |` ``, and `` `|` `` all reach `` `|` `` from either side. A span\n * whose content is all whitespace keeps one space, because a parser strips nothing from that\n * one.\n *\n * A target's module part is the inline import form `import('./module.js').` or TSDoc's\n * package-qualified form `@scope/pkg#`, and the expansion drops it, so a cross-file link and the\n * code token a guide cell documents it with reach the same text. A package qualifier carries `@`\n * or `/`; text before a `#` carrying neither is JSDoc's member reference, so `{@link Owner#member}`\n * and `{@link #member}` travel whole and a guide cell documents each as written. An unscoped\n * package name is spelled like an owner, so `{@link pkg#Name}` travels whole too — write the\n * scoped or the path form where a cell must drop the package. Everything after a module part\n * travels: `Owner.member` keeps its owner, and a dotted target no module part precedes is\n * untouched. A label is text rather than a target, so `{@link Target | label}` renders its label\n * whole.\n *\n * A code span delimited by more than one backtick is outside the compared form's representable\n * set and travels untouched, as does a code span whose own text carries a backtick: the form\n * spells every span with one backtick per side, so neither can be written back. A summary that\n * needs one of those constructs takes another shape: name the construct in prose rather than\n * expecting the comparison to converge it.\n *\n * @param text - A doc block's description paragraph, or a guide cell's flattened text\n * @returns The compared form of that text\n *\n * @example\n * ```ts\n * normalizeSummary('Creates a\\n{@link Widget}.') // 'Creates a `Widget`.'\n * normalizeSummary(\"Reads {@link import('./widgets.js').Widget}.\") // 'Reads `Widget`.'\n * normalizeSummary('Reads {@link @scope/widgets#Widget}.') // 'Reads `Widget`.'\n * normalizeSummary('Reads {@link Widget#render}.') // 'Reads `Widget#render`.'\n * normalizeSummary('cells joined by ` | `.') // 'cells joined by `|`.'\n * ```\n */\nexport function normalizeSummary(text: string): string {\n\tconst parts = text.split(/((?<!`)`[^`]+`(?!`))/)\n\tlet normalized = ''\n\n\tfor (let index = 0; index < parts.length; index += 1) {\n\t\tconst part = parts[index] ?? ''\n\t\tif (index % 2 === 0) {\n\t\t\tnormalized += part\n\t\t\t\t.replace(/\\{@link\\s+[^}|]*\\|\\s*([^}]*?)\\s*\\}/g, '`$1`')\n\t\t\t\t.replace(/\\{@link\\s+(?:import\\([^)]*\\)\\.|[^}|#\\s]*[@/][^}|#\\s]*#)?([^}|]*?)\\s*\\}/g, '`$1`')\n\t\t\tcontinue\n\t\t}\n\t\tconst value = part.slice(1, -1).replace(/\\s+/g, ' ').trim()\n\t\tnormalized += `\\`${value.length === 0 ? ' ' : value}\\``\n\t}\n\n\treturn normalized.replace(/\\s+/g, ' ').trim()\n}\n\n/**\n * Wraps one paragraph into greedy lines no longer than `width` characters. Every run of\n * whitespace separates words, and a word longer than `width` takes its own line rather than\n * being split, so a long code token or URL survives the wrap intact.\n *\n * @param text - The paragraph to wrap\n * @param width - The greatest length a returned line may reach\n * @returns The wrapped lines, in order, or an empty list when `text` carries no word\n *\n * @example\n * ```ts\n * wrapText('one two three', 8) // ['one two', 'three']\n * ```\n */\nexport function wrapText(text: string, width: number): readonly string[] {\n\tconst lines: string[] = []\n\tlet current = ''\n\n\tfor (const word of text.split(/\\s+/)) {\n\t\tif (word.length === 0) continue\n\t\tif (current.length === 0) current = word\n\t\telse if (current.length + 1 + word.length <= width) current += ` ${word}`\n\t\telse {\n\t\t\tlines.push(current)\n\t\t\tcurrent = word\n\t\t}\n\t}\n\tif (current.length > 0) lines.push(current)\n\n\treturn lines\n}\n\n/**\n * Builds one genuine JSDoc span from its content lines — the inverse of {@link unwrapComment}.\n * Each line is emitted at `indent` behind a continuation marker, an empty line as the bare\n * marker so no line carries trailing whitespace, and the leading and trailing empty lines are\n * dropped because the opener and the closer take those physical lines.\n *\n * @param lines - The span's content lines, as {@link unwrapComment} returns them\n * @param indent - The whitespace the span opens at\n * @returns The span's raw text, opener and closer included\n *\n * @example\n * ```ts\n * buildComment(['Walks.'], '') // '/**\\n * Walks.\\n *' + '/'\n * ```\n */\nexport function buildComment(lines: readonly string[], indent: string): string {\n\tconst content = [...lines]\n\twhile (content[0] === '') content.shift()\n\twhile (content[content.length - 1] === '') content.pop()\n\n\tconst raw = [`${indent}/**`]\n\tfor (const line of content) raw.push(line.length === 0 ? `${indent} *` : `${indent} * ${line}`)\n\traw.push(`${indent} */`)\n\n\treturn raw.join('\\n')\n}\n\n/**\n * Returns one doc block's unwrapped text with every fenced body replaced by aligned spaces,\n * so a tag search reads the block's structure and never its example code. A line opening with\n * three or more backticks or tildes opens a body, the first line opening with a run of the same\n * character at least as long closes it, an unclosed body runs to the end, and the marker lines\n * themselves stay. The projection preserves every line and every column, so an index found in\n * it addresses the same character of the text it was built from.\n *\n * @param text - One doc block's unwrapped text, as {@link normalizeComment} returns it\n * @returns The same text with each fenced body's characters replaced by spaces\n *\n * @example\n * ```ts\n * maskFences('@example\\n~~~\\n@decorator()\\n~~~').split('\\n')[2] // ' '\n * ```\n */\nexport function maskFences(text: string): string {\n\tconst masked: string[] = []\n\tlet marker: string | undefined\n\n\tfor (const line of text.split('\\n')) {\n\t\tconst fence = /^[ \\t]*(`{3,}|~{3,})/.exec(line)?.[1]\n\t\tif (marker === undefined) {\n\t\t\tmasked.push(line)\n\t\t\tmarker = fence\n\t\t\tcontinue\n\t\t}\n\t\tconst closing = fence !== undefined && fence.startsWith(marker)\n\t\tmasked.push(closing ? line : ' '.repeat(line.length))\n\t\tif (closing) marker = undefined\n\t}\n\n\treturn masked.join('\\n')\n}\n\n/**\n * Extracts every eligible genuine JSDoc block paired with the physical record it documents.\n *\n * @remarks\n * An opener is eligible only when it is the first non-whitespace source material of its record; a\n * leading whitespace-separated span chain is last-span authoritative; intervening source material\n * severs association, while a leading JSDoc on the next record replaces pending state. Any other\n * next physical record is returned once and consumes it. This parser walks aligned records without\n * rescanning source syntax or applying declaration/member grammar, and every reader of a doc\n * block's text — the description paragraph, the `@example` blocks, the member summaries — reads it\n * through this one walk.\n *\n * @param lines - Aligned physical source-line records\n * @returns One record per documented physical line, in source order\n *\n * @example\n * ```ts\n * extractSourceComments(extractSourceLines('/**' + ' Walks. *' + '/\\nexport function walk() {}'))\n * // [{ text: 'Walks.', line: the `export function walk() {}` SourceLine }]\n * ```\n */\nexport function extractSourceComments(lines: readonly SourceLine[]): readonly SourceComment[] {\n\tconst comments: SourceComment[] = []\n\tlet block = false\n\tlet eligible = false\n\tlet span: string[] = []\n\tlet pending: string | undefined\n\n\tfor (const line of lines) {\n\t\tconst projection = line.jsdoc\n\t\tconst first = projection?.indexOf('/**') ?? -1\n\n\t\tif (pending !== undefined) {\n\t\t\tif (!block && first >= 0 && line.source.slice(0, first).trim() === '') pending = undefined\n\t\t\telse {\n\t\t\t\tcomments.push({ text: pending, line })\n\t\t\t\tpending = undefined\n\t\t\t}\n\t\t}\n\n\t\tif (projection === undefined) continue\n\n\t\tlet cursor = 0\n\t\tif (block) {\n\t\t\tconst close = projection.indexOf('*/')\n\t\t\tconst end = close < 0 ? projection.length : close + 2\n\t\t\tspan.push(projection.slice(0, end))\n\t\t\tif (close < 0) continue\n\n\t\t\tblock = false\n\t\t\tconst opener = projection.indexOf('/**', close + 2)\n\t\t\tconst endOfGap = opener < 0 ? line.source.length : opener\n\t\t\tconst whitespace = line.source.slice(close + 2, endOfGap).trim() === ''\n\t\t\tif (opener < 0) {\n\t\t\t\tpending = eligible && whitespace ? normalizeComment(span.join('\\n')) : undefined\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\tspan = []\n\t\t\tcursor = opener\n\t\t} else {\n\t\t\tif (first < 0) continue\n\t\t\teligible = line.source.slice(0, first).trim() === ''\n\t\t\tspan = []\n\t\t\tcursor = first\n\t\t}\n\n\t\twhile (cursor < projection.length) {\n\t\t\tconst close = projection.indexOf('*/', cursor + 2)\n\t\t\tconst end = close < 0 ? projection.length : close + 2\n\t\t\tspan.push(projection.slice(cursor, end))\n\n\t\t\tif (close < 0) {\n\t\t\t\tblock = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tconst opener = projection.indexOf('/**', close + 2)\n\t\t\tconst endOfGap = opener < 0 ? line.source.length : opener\n\t\t\tconst whitespace = line.source.slice(close + 2, endOfGap).trim() === ''\n\t\t\tif (opener < 0) {\n\t\t\t\tpending = eligible && whitespace ? normalizeComment(span.join('\\n')) : undefined\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\tspan = []\n\t\t\tcursor = opener\n\t\t}\n\t}\n\n\treturn comments\n}\n\n/**\n * Selects the next physical record after an eligible genuine JSDoc whose final\n * authoritative span carries an `@example` tag opening a line at its first non-blank column —\n * the {@link extractSourceComments} walk filtered to the blocks that carry one. Title\n * text is allowed, and {@link maskFences} keeps a fenced body's own lines out of the search.\n *\n * @param lines - Aligned physical source-line records\n * @returns The immediately following candidate lines, in source order\n *\n * @example\n * ```ts\n * extractExampleLines(extractSourceLines('/**' + ' @example *' + '/\\nexport function walk() {}'))\n * // the `export function walk() {}` SourceLine\n * ```\n */\nexport function extractExampleLines(lines: readonly SourceLine[]): readonly SourceLine[] {\n\treturn extractSourceComments(lines)\n\t\t.filter((comment) => /^[ \\t]*@example(?=[ \\t]|$)/m.test(maskFences(comment.text)))\n\t\t.map((comment) => comment.line)\n}\n\n/**\n * Collects the description paragraph of every documented physical record — a doc block's\n * text before its first block tag, in {@link normalizeSummary}'s compared form — keyed by the\n * record it documents. A record whose block carries no description contributes no entry, so\n * an absent summary stays absent rather than becoming an empty string.\n *\n * @param lines - Aligned physical source-line records\n * @returns One entry per documented record carrying a description paragraph\n *\n * @example\n * ```ts\n * collectSummaries(extractSourceLines('/**' + ' Walks. *' + '/\\nexport function walk() {}')).size // 1\n * ```\n */\nexport function collectSummaries(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string> {\n\tconst summaries = new Map<SourceLine, string>()\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\tconst tag = maskFences(comment.text).search(/^[ \\t]*@\\w/m)\n\t\tconst summary = normalizeSummary(tag < 0 ? comment.text : comment.text.slice(0, tag))\n\t\tif (summary.length > 0) summaries.set(comment.line, summary)\n\t}\n\n\treturn summaries\n}\n\n/**\n * Extracts the aligned physical records of a declaration's body, read inside an owner head this\n * function supplies, so a callable member in the body carries the `Owner.member` key\n * {@link collectKeys} reports for it, and that head's own record opens the projection. A body\n * read on its own carries no head, and the member grammar attaches a member to the head\n * enclosing it.\n *\n * @remarks\n * The supplied head is an `export interface` line, so the projection opens with that head's own\n * record and every body line follows it in order. A column-zero `}` among the body lines closes\n * the supplied head and leaves every later member unkeyed; a body {@link extractDeclaration}\n * returns carries none, because that reader ends a body at the first one.\n *\n * @param lines - A declaration's body lines\n * @returns The supplied head's record, then one record per body line\n *\n * @example\n * ```ts\n * extractBodyLines(['\\twalk(): void'])[1]?.code // '\\twalk(): void'\n * ```\n */\nexport function extractBodyLines(lines: readonly string[]): readonly SourceLine[] {\n\treturn extractSourceLines(['export interface Owner {', ...lines].join('\\n'))\n}\n\n/**\n * Collects the compared key of every physical record a key names — a {@link computeSymbolKey}\n * symbol key for a column-zero `export` declaration head, an `Owner.member` key for a one-tab\n * callable member inside one — keyed by the record itself. The owner closes at the first\n * column-zero `}` or at a column-zero `export` declaration carrying another keyword, and a\n * record no key names contributes no entry.\n *\n * @remarks\n * This is the package's one key grammar, and each keyed reader projects its own part back out of\n * it: {@link extractExports} splits a declaration key at its one space,\n * {@link extractMemberMethods} and {@link extractExampleMethods} split a member key at its dot,\n * and {@link locateComment} matches a caller's key against the whole map. A change to the head\n * shape or to the member shape reaches every one of them at once.\n *\n * An owner opens at a column-zero `export class`, `export abstract class`, or `export interface`\n * head and closes at the\n * first column-zero `}`, so a member declared past that brace keys nothing. A column-zero `export` declaration carrying any other keyword closes the owner it follows,\n * because a member belongs to the head enclosing it. Reading runs over {@link extractSourceLines}'s\n * projection, so a head or\n * a member written inside a comment or a template literal keys nothing.\n *\n * @param lines - Aligned physical source-line records\n * @returns One entry per record a key names, in file order\n *\n * @example\n * ```ts\n * const keys = collectKeys(extractSourceLines('export class Widget {\\n\\twalk(): void\\n}'))\n * Array.from(keys.values()) // ['class Widget', 'Widget.walk']\n * ```\n */\nexport function collectKeys(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string> {\n\tconst keys = new Map<SourceLine, string>()\n\tlet owner: string | undefined\n\n\tfor (const line of lines) {\n\t\tconst head =\n\t\t\t/^export (?:async )?(?:abstract )?(function\\*?|class|const|interface|type) (\\w+)/.exec(\n\t\t\t\tline.code,\n\t\t\t)\n\t\tconst keyword = head?.[1]?.replace(/\\*$/, '')\n\t\tconst name = head?.[2]\n\t\tif (isNonEmptyString(keyword) && isNonEmptyString(name) && isExportKeyword(keyword)) {\n\t\t\tkeys.set(line, computeSymbolKey({ name, keyword }))\n\t\t\towner = keyword === 'class' || keyword === 'interface' ? name : undefined\n\t\t\tcontinue\n\t\t}\n\t\tif (line.code === '}') {\n\t\t\towner = undefined\n\t\t\tcontinue\n\t\t}\n\t\tconst member = /^\\t(?:async )?\\*?(\\w+)\\??(?:<.*>)?\\(/.exec(line.code)?.[1]\n\t\tif (owner !== undefined && isNonEmptyString(member)) keys.set(line, `${owner}.${member}`)\n\t}\n\n\treturn keys\n}\n\n/**\n * Collects the `@example` blocks one doc block's unwrapped text carries, each named for the\n * declaration or member the block documents. The text after the tag becomes the block's\n * `title`; a body opening with a fence contributes that fence's language and its verbatim\n * body, and a body with no fence contributes its own trimmed text as the code.\n *\n * @param comment - One doc block's unwrapped text, as {@link normalizeComment} returns it\n * @param name - The declaration or member the block documents\n * @returns The block's `@example` entries, in block order\n *\n * @example\n * ```ts\n * collectExamples('@example Walking\\n```ts\\nwalk()\\n```', 'walk')\n * // [{ name: 'walk', title: 'Walking', code: 'walk()', language: 'ts' }]\n * ```\n */\nexport function collectExamples(comment: string, name: string): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst masked = maskFences(comment)\n\tconst tags = /^[ \\t]*@example(?=[ \\t]|$)[ \\t]*(.*)$/gm\n\n\tlet tag: RegExpExecArray | null\n\twhile ((tag = tags.exec(masked)) !== null) {\n\t\tconst title = (tag[1] ?? '').trim()\n\t\tconst start = tag.index + tag[0].length\n\t\tconst rest = comment.slice(start).replace(/^\\n/, '')\n\t\tconst next = masked\n\t\t\t.slice(start)\n\t\t\t.replace(/^\\n/, '')\n\t\t\t.search(/^[ \\t]*@\\w+/m)\n\t\tconst body = (next < 0 ? rest : rest.slice(0, next)).replace(/^\\n+/, '').replace(/\\n+$/, '')\n\t\tconst fence = /^```(\\S*)\\n([\\s\\S]*?)\\n?```/.exec(body)\n\t\tconst language = fence?.[1] ?? ''\n\t\tconst code = fence?.[2] ?? body\n\n\t\texamples.push({\n\t\t\tname,\n\t\t\t...(title.length === 0 ? {} : { title }),\n\t\t\tcode,\n\t\t\t...(language.length === 0 ? {} : { language }),\n\t\t})\n\t}\n\n\treturn examples\n}\n\n/**\n * Extracts the `@example` blocks carried by the exported declaration heads in one file's source\n * text, each named for the declaration its block documents. Shared adjacency comes from\n * {@link extractSourceComments} and each block is read by {@link collectExamples}; head\n * membership is the {@link collectKeys} key of the documented record under every keyword that\n * grammar admits at column zero, so comment and template payload cannot qualify and the head\n * grammar stays the one every reader here shares. A member key carries a dot and a head key\n * does not, so a member's block belongs to {@link extractExampleMethods} instead. A head\n * carrying several blocks contributes each.\n *\n * @param source - The file's source text\n * @returns The exported declaration heads' `@example` blocks, in file order, deduplicated by name and title\n *\n * @example\n * ```ts\n * const block = ['/**', ' * @example', ' * new Widget()', ' *' + '/', 'export class Widget {}', ''].join('\\n')\n * extractExamples(block) // [{ name: 'Widget', code: 'new Widget()' }]\n * extractExamples('export class Widget {}\\n') // []\n * ```\n */\nexport function extractExamples(source: string): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst seen = new Set<string>()\n\tconst lines = extractSourceLines(source)\n\tconst keys = collectKeys(lines)\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\t// A head key is `${keyword} ${name}` and a member key is `Owner.member`, so the dot is\n\t\t// what separates them and the block's name is the text past the head's one space.\n\t\tconst key = keys.get(comment.line)\n\t\tif (key === undefined || key.includes('.')) continue\n\n\t\tconst name = key.slice(key.indexOf(' ') + 1)\n\t\tfor (const example of collectExamples(comment.text, name)) {\n\t\t\tconst entry = `${name}\\n${example.title ?? ''}`\n\t\t\tif (seen.has(entry)) continue\n\t\t\tseen.add(entry)\n\t\t\texamples.push(example)\n\t\t}\n\t}\n\n\treturn examples\n}\n\n/**\n * Extracts the `@example` blocks carried by the callable members of a declaration body (per\n * {@link collectKeys}' grammar, the same one {@link extractMemberMethods} reads), each named for\n * the member its block documents. Shared adjacency comes from {@link extractSourceComments} and\n * each block is read by {@link collectExamples}; member membership is the key\n * {@link extractBodyLines}'s projection gives the documented record.\n *\n * @param lines - A declaration's body lines\n * @returns The members' `@example` blocks, deduplicated by name and title and sorted by name\n *\n * @example\n * ```ts\n * extractExampleMethods(['\\t/**', '\\t * @example', '\\t * walk()', '\\t *' + '/', '\\twalk(): void'])\n * // [{ name: 'walk', code: 'walk()' }]\n * ```\n */\nexport function extractExampleMethods(lines: readonly string[]): readonly SourceExample[] {\n\tconst examples: SourceExample[] = []\n\tconst seen = new Set<string>()\n\tconst projected = extractBodyLines(lines)\n\tconst keys = collectKeys(projected)\n\n\tfor (const comment of extractSourceComments(projected)) {\n\t\tconst key = keys.get(comment.line) ?? ''\n\t\tconst dot = key.indexOf('.')\n\t\tif (dot < 0) continue\n\n\t\tconst name = key.slice(dot + 1)\n\t\tfor (const example of collectExamples(comment.text, name)) {\n\t\t\tconst entry = `${name}\\n${example.title ?? ''}`\n\t\t\tif (seen.has(entry)) continue\n\t\t\tseen.add(entry)\n\t\t\texamples.push(example)\n\t\t}\n\t}\n\n\treturn examples.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n}\n\n/**\n * Extracts every fenced code block anywhere in the guide document. A full AST walk\n * includes fences nested inside blockquotes and lists, and the same walk carries each\n * fence's nearest preceding heading as its `title` — the key an `@example` block pairs on.\n * A heading's text is flattened, so a title written with a code span pairs with a plain\n * `@example` title.\n *\n * @param document - The parsed guide document\n * @returns Every fence's language, verbatim code, and title, in document order\n *\n * @example\n * ```ts\n * extractFences(document) // [{ language: 'ts', code: \"import { X } from './x.js'\\nX()\" }]\n * ```\n */\nexport function extractFences(document: MarkdownDocument): readonly GuideFence[] {\n\treturn Array.from(collectFences(document).values())\n}\n\n/**\n * Collects each fenced code block keyed by its own node, paired with the {@link GuideFence}\n * {@link extractFences} reports for it — the node-addressed form a rewrite needs, so a caller\n * that located a fence by title can read that node's source region back from the parser. The map\n * iterates in document order and a node keys itself, so a repeated identical fence keeps its own\n * entry.\n *\n * @param document - The parsed guide document\n * @returns One entry per fenced code block, in document order\n *\n * @example\n * ```ts\n * Array.from(collectFences(document).values()) // [{ language: 'ts', code: 'walk()' }]\n * ```\n */\nexport function collectFences(document: MarkdownDocument): ReadonlyMap<CodeBlockNode, GuideFence> {\n\tconst fences = new Map<CodeBlockNode, GuideFence>()\n\tlet title = ''\n\n\tfor (const node of walkNodes(document)) {\n\t\tif (isHeadingNode(node)) {\n\t\t\ttitle = flattenText(node).trim()\n\t\t\tcontinue\n\t\t}\n\t\tif (isCodeBlockNode(node)) {\n\t\t\tfences.set(node, {\n\t\t\t\tlanguage: node.lang,\n\t\t\t\tcode: node.code,\n\t\t\t\t...(title.length === 0 ? {} : { title }),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn fences\n}\n\n/**\n * Extracts the guide's tagline — the text of the blockquote following the document's H1,\n * with every code span kept as a code span and whitespace collapsed. A heading before the\n * blockquote ends the window, so a blockquote elsewhere in the document is not the tagline.\n *\n * @param document - The parsed guide document\n * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading\n *\n * @example\n * ```ts\n * extractTagline(document) // 'A pure, I/O-free guides-parity toolkit'\n * ```\n */\nexport function extractTagline(document: MarkdownDocument): string | undefined {\n\tlet opened = false\n\n\tfor (const block of document.children) {\n\t\tif (isHeadingNode(block)) {\n\t\t\tif (opened) return undefined\n\t\t\topened = block.level === 1\n\t\t\tcontinue\n\t\t}\n\t\tif (!opened || !isBlockquoteNode(block)) continue\n\n\t\tconst text = normalizeSummary(\n\t\t\tblock.children\n\t\t\t\t.filter(isParagraphNode)\n\t\t\t\t.map((paragraph) => extractCellText(paragraph.children))\n\t\t\t\t.join(' '),\n\t\t)\n\t\treturn text.length === 0 ? undefined : text\n\t}\n\n\treturn undefined\n}\n\n/**\n * Computes the drift between one compared key's guide text and source text. A pair agrees\n * only when both sides carry the same text, and every other state is a drift: guide text\n * alone reports the guide's side, source text alone reports the source's, and neither side\n * carrying text reports the key by itself. A side carrying no text is absent from the result,\n * so a documented symbol with no doc block reports as a drift naming the guide's text alone,\n * and a row a table has no `Summary` column for against a declaration with no doc block\n * reports as `{ key }`.\n *\n * @param key - The compared pair's key\n * @param category - The compared site the drift came from\n * @param guide - The guide's text there, or `undefined` when it carries none\n * @param source - The source's text there, or `undefined` when it carries none\n * @returns The drift, or `undefined` when both sides carry the same text\n *\n * @example\n * ```ts\n * computeDrift('function walk', 'summary', 'Walks the tree.', 'Walks a tree.')\n * // { key: 'function walk', category: 'summary', guide: 'Walks the tree.', source: 'Walks a tree.' }\n * ```\n */\nexport function computeDrift(\n\tkey: string,\n\tcategory: Drift['category'],\n\tguide: string | undefined,\n\tsource: string | undefined,\n): Drift | undefined {\n\tif (guide !== undefined && guide === source) return undefined\n\treturn {\n\t\tkey,\n\t\tcategory,\n\t\t...(guide === undefined ? {} : { guide }),\n\t\t...(source === undefined ? {} : { source }),\n\t}\n}\n\n/**\n * Compares documented and declared membership exactly after sorting copies, preserving duplicates.\n *\n * @param spec - The guide inventory key the finding belongs to\n * @param name - The declaration whose membership is compared\n * @param documented - The documented member names\n * @param declared - The declared member names\n * @returns The membership finding, or `undefined` when the sorted populations match\n *\n * @example Compare declaration membership\n * ```ts\n * import { compareMembership } from '@orkestrel/guide'\n *\n * compareMembership('guides/widget.md', 'WidgetInterface', ['open'], ['open']) // undefined\n * ```\n */\nexport function compareMembership(\n\tspec: string,\n\tname: string,\n\tdocumented: readonly string[],\n\tdeclared: readonly string[],\n): ParityFinding | undefined {\n\tconst left = [...documented].sort()\n\tconst right = [...declared].sort()\n\tif (JSON.stringify(left) === JSON.stringify(right)) return undefined\n\treturn {\n\t\tspec,\n\t\ttext: `${spec} ${name} documents ${JSON.stringify(left)} and declares ${JSON.stringify(right)}.`,\n\t}\n}\n\n/**\n * Computes a category-separated identity for a guide finding.\n *\n * @param spec - The guide inventory key the drift belongs to\n * @param drift - The categorized disagreement\n * @returns The inventory key, category, and compared key separated by line feeds\n *\n * @example Identify categorized drift\n * ```ts\n * import { identifyDrift } from '@orkestrel/guide'\n *\n * identifyDrift('guides/widget.md', { category: 'summary', key: 'function open' })\n * // 'guides/widget.md\\nsummary\\nfunction open'\n * ```\n */\nexport function identifyDrift(spec: string, drift: Drift): string {\n\treturn `${spec}\\n${drift.category}\\n${drift.key}`\n}\n\n/**\n * Formats present parity text as a JSON string and absent text as `absent`.\n *\n * @param value - The compared side's text, or `undefined` when absent\n * @returns The developer-facing side text\n *\n * @example Format a parity side\n * ```ts\n * import { formatSide } from '@orkestrel/guide'\n *\n * formatSide('Walks.') // '\"Walks.\"'\n * formatSide(undefined) // 'absent'\n * ```\n */\nexport function formatSide(value: string | undefined): string {\n\treturn value === undefined ? 'absent' : JSON.stringify(value)\n}\n\n/**\n * Formats a categorized drift with its guide and source sides.\n *\n * @param drift - The categorized disagreement to format\n * @returns The complete developer-facing drift text\n *\n * @example Format categorized drift\n * ```ts\n * import { formatDrift } from '@orkestrel/guide'\n *\n * formatDrift({ category: 'summary', key: 'function walk', guide: 'Walks.', source: 'Walks a tree.' })\n * // 'summary function walk: guide \"Walks.\" source \"Walks a tree.\"'\n * ```\n */\nexport function formatDrift(drift: Drift): string {\n\treturn `${drift.category} ${drift.key}: guide ${formatSide(drift.guide)} source ${formatSide(drift.source)}`\n}\n\n/**\n * Finds every disagreement between a guide and the source it documents, naming both sites:\n * each `## Surface` row against its declaration's description paragraph, each `## Methods`\n * row against its member's, and the first titled guide fence of a heading against the\n * `@example` block of the same title. An example's compared text is its language on the first\n * line and its body beneath, so a fence that names another language drifts on its own.\n *\n * @remarks\n * Only a pair present on both sides is compared, so a symbol, a member, or a title one side\n * lacks entirely is left to the bijection checks that own it and is never reported twice.\n * {@link computeDrift} rules each compared pair, so a pair whose sides carry different text, a\n * pair where one side carries none, and a pair where neither side carries text are all drift.\n * The pairing is per title across the whole document, not per heading: the first fence a title\n * reaches is the compared one, and every later fence of that title is outside the comparison,\n * whether it sits under the same heading or under a second heading of the same text.\n *\n * @param guide - The parsed guide\n * @param source - The reflected source the guide documents\n * @returns One entry per disagreement: Surface rows, then Methods rows, then examples\n *\n * @example\n * ```ts\n * findDrift(guide, source) // [{ key: 'function walk', category: 'summary', guide: 'Walks.', source: 'Walks a tree.' }]\n * ```\n */\nexport function findDrift(guide: GuideInterface, source: SourceInterface): readonly Drift[] {\n\tconst drifts: Drift[] = []\n\tconst declared = new Map(source.surface().map((symbol) => [computeSymbolKey(symbol), symbol]))\n\n\tfor (const symbol of guide.surface()) {\n\t\tconst key = computeSymbolKey(symbol)\n\t\tconst match = declared.get(key)\n\t\tif (match === undefined) continue\n\t\tconst drift = computeDrift(key, 'summary', symbol.summary, match.summary)\n\t\tif (drift !== undefined) drifts.push(drift)\n\t}\n\n\tfor (const group of guide.methods()) {\n\t\tconst members = new Map(source.methods(group.interface).map((entry) => [entry.name, entry]))\n\t\tfor (const entry of group.methods) {\n\t\t\tconst member = members.get(entry.name)\n\t\t\tif (member === undefined) continue\n\t\t\tconst drift = computeDrift(\n\t\t\t\t`${group.interface}.${entry.name}`,\n\t\t\t\t'summary',\n\t\t\t\tentry.summary,\n\t\t\t\tmember.summary,\n\t\t\t)\n\t\t\tif (drift !== undefined) drifts.push(drift)\n\t\t}\n\t}\n\n\tconst examples = collectTitles(guide, source)\n\tconst compared = new Set<string>()\n\tfor (const fence of guide.fences()) {\n\t\tif (fence.title === undefined || compared.has(fence.title)) continue\n\t\tcompared.add(fence.title)\n\t\tconst example = examples.get(fence.title)\n\t\tif (example === undefined) continue\n\t\tconst drift = computeDrift(\n\t\t\tfence.title,\n\t\t\t'example',\n\t\t\t`${fence.language ?? ''}\\n${fence.code}`,\n\t\t\t`${example.language ?? ''}\\n${example.code}`,\n\t\t)\n\t\tif (drift !== undefined) drifts.push(drift)\n\t}\n\n\treturn drifts\n}\n\n/**\n * Collects the titled `@example` blocks a guide's documented surface reaches — the module's\n * exported declaration heads, plus the own members of every documented `class` and `interface` —\n * keyed by title, the first block of a title answering for it.\n *\n * @param guide - The parsed guide naming the documented declarations\n * @param source - The reflected source to read the blocks from\n * @returns One entry per distinct `@example` title\n *\n * @example\n * ```ts\n * collectTitles(guide, source).get('Walk a tree') // { name: 'walk', title: 'Walk a tree', code: 'walk()' }\n * ```\n */\nexport function collectTitles(\n\tguide: GuideInterface,\n\tsource: SourceInterface,\n): ReadonlyMap<string, SourceExample> {\n\tconst titled = new Map<string, SourceExample>()\n\tconst owners = guide\n\t\t.surface()\n\t\t.filter((symbol) => symbol.keyword === 'class' || symbol.keyword === 'interface')\n\tconst examples = [\n\t\t...source.examples(),\n\t\t...owners.flatMap((symbol) => source.examples(symbol.name)),\n\t]\n\n\tfor (const example of examples) {\n\t\tif (example.title === undefined || titled.has(example.title)) continue\n\t\ttitled.set(example.title, example)\n\t}\n\n\treturn titled\n}\n\n/**\n * Builds a copy of `table` with one cell's inline content rebuilt from `text` through\n * {@link buildCell}. Every other cell keeps its own nodes, so a rewrite touches the one cell it\n * names and the header and the alignment row travel unchanged.\n *\n * @param table - The table to copy\n * @param row - The index of the row to rewrite within {@link TableNode.rows}\n * @param column - The index of the cell to rewrite within that row\n * @param text - The cell's new compared text\n * @returns The rewritten table\n *\n * @example\n * ```ts\n * buildTable(table, 0, 2, 'Walks the tree.').rows[0]?.[2] // [{ element: 'text', value: 'Walks the tree.' }]\n * ```\n */\nexport function buildTable(table: TableNode, row: number, column: number, text: string): TableNode {\n\treturn {\n\t\telement: 'table',\n\t\theader: table.header,\n\t\trows: table.rows.map((cells, index) =>\n\t\t\tindex === row\n\t\t\t\t? cells.map((cell, position) => (position === column ? buildCell(text) : cell))\n\t\t\t\t: cells,\n\t\t),\n\t\talign: table.align,\n\t}\n}\n\n/**\n * Builds the fenced code block one `@example` block renders as — its code inside a fence\n * carrying its language, and an untagged fence when the block names none.\n *\n * @param example - The block to render\n * @returns The fence node\n *\n * @example\n * ```ts\n * buildFence({ name: 'walk', code: 'walk()', language: 'ts' }) // { element: 'codeBlock', code: 'walk()', lang: 'ts' }\n * ```\n */\nexport function buildFence(example: SourceExample): CodeBlockNode {\n\treturn {\n\t\telement: 'codeBlock',\n\t\tcode: example.code,\n\t\t...(example.language === undefined ? {} : { lang: example.language }),\n\t}\n}\n\n/**\n * Splices `replacement` into `source` over the region `span` addresses, and returns the result.\n * The text before the region and the text after it travel byte for byte, so a rewrite that\n * addresses one node's region changes nothing else in the document.\n *\n * @param source - The text to rewrite\n * @param span - The half-open region to replace: the region `MarkdownInterface.span` reports\n * for a markdown node, or the one {@link locateComment} reports for a doc block\n * @param replacement - The text to write over that region\n * @returns The rewritten text\n *\n * @example\n * ```ts\n * spliceSpan('one two three', { start: 4, end: 7 }, 'TWO') // 'one TWO three'\n * ```\n */\nexport function spliceSpan(source: string, span: MarkdownSpan, replacement: string): string {\n\treturn source.slice(0, span.start) + replacement + source.slice(span.end)\n}\n\n/**\n * Renders a `## Surface` table from the symbols a source declares — a `Name`, {@link KIND}, and\n * {@link SUMMARY} table with one row per symbol, the name as a code span, the keyword as its\n * text, and the summary through {@link buildCell}. A symbol carrying no summary renders an empty\n * cell, which {@link extractSurface} reads back as an absent summary.\n *\n * @remarks\n * The render carries no `## Surface` heading, because a guide documents its surface in several\n * tables under their own sub-headings and one of them is what this function produces. Reading the\n * render back therefore parses it under that heading. `renderMarkdown` pads every cell to one\n * space, so the render is not the committed column-aligned bytes; the checkout's formatter\n * re-aligns the table and the reader compares parsed entries rather than bytes.\n *\n * @param symbols - The symbols to document, in row order\n * @returns The table's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderSurface([{ name: 'walk', keyword: 'function', summary: 'Walks the tree.' }])\n * // '| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks the tree. |'\n * ```\n */\nexport function renderSurface(symbols: readonly SurfaceSymbol[]): string {\n\treturn renderMarkdown({\n\t\telement: 'table',\n\t\theader: [\n\t\t\t[{ element: 'text', value: 'Name' }],\n\t\t\t[{ element: 'text', value: KIND }],\n\t\t\t[{ element: 'text', value: SUMMARY }],\n\t\t],\n\t\trows: symbols.map((symbol) => [\n\t\t\t[{ element: 'codeSpan', value: symbol.name }],\n\t\t\t[{ element: 'text', value: symbol.keyword }],\n\t\t\tbuildCell(symbol.summary ?? ''),\n\t\t]),\n\t\talign: [null, null, null],\n\t})\n}\n\n/**\n * Renders one `## Methods` group — the `####` heading naming the interface as a code span, then\n * a `Name` and {@link SUMMARY} table with one row per documented member. A member carrying no\n * summary renders an empty cell, which {@link extractMethods} reads back as an absent summary.\n *\n * @remarks\n * The render carries no `## Methods` heading, for the reason {@link renderSurface} states:\n * a guide documents one group per interface under that one section heading.\n *\n * @param group - The interface and its members\n * @returns The heading and table's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderMethods({ interface: 'WidgetInterface', methods: [{ name: 'walk', summary: 'Walks.' }] })\n * // '#### `WidgetInterface`\\n\\n| Name | Summary |\\n| --- | --- |\\n| `walk` | Walks. |'\n * ```\n */\nexport function renderMethods(group: MethodGroup): string {\n\treturn renderMarkdown({\n\t\telement: 'document',\n\t\tchildren: [\n\t\t\t{ element: 'heading', level: 4, children: [{ element: 'codeSpan', value: group.interface }] },\n\t\t\t{\n\t\t\t\telement: 'table',\n\t\t\t\theader: [[{ element: 'text', value: 'Name' }], [{ element: 'text', value: SUMMARY }]],\n\t\t\t\trows: group.methods.map((entry) => [\n\t\t\t\t\t[{ element: 'codeSpan', value: entry.name }],\n\t\t\t\t\tbuildCell(entry.summary ?? ''),\n\t\t\t\t]),\n\t\t\t\talign: [null, null],\n\t\t\t},\n\t\t],\n\t})\n}\n\n/**\n * Renders one `@example` block as the guide fence it pairs with — an H3 heading carrying the\n * block's title, then a fence carrying its language and its code. An untitled block renders the\n * fence alone, because a fence pairs on its nearest preceding heading and an untitled block\n * claims none.\n *\n * @remarks\n * The title renders as literal text rather than markdown, so a title carrying backticks or\n * emphasis reads back through {@link extractFences} as the text the `@example` tag carried.\n * The heading level is 3 because a guide documents its examples one level under a `##` section;\n * {@link extractFences} pairs on the nearest preceding heading of any level, so the level is\n * presentation rather than pairing.\n *\n * @param example - The block to render\n * @returns The heading and fence's markdown source, with no trailing newline\n *\n * @example\n * ```ts\n * renderExample({ name: 'walk', title: 'Walk a tree', code: 'walk()', language: 'ts' })\n * // an H3 heading of 'Walk a tree', then a fence tagged `ts` carrying `walk()`\n * ```\n */\nexport function renderExample(example: SourceExample): string {\n\tconst fence = buildFence(example)\n\treturn renderMarkdown({\n\t\telement: 'document',\n\t\tchildren:\n\t\t\texample.title === undefined\n\t\t\t\t? [fence]\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telement: 'heading',\n\t\t\t\t\t\t\tlevel: 3,\n\t\t\t\t\t\t\tchildren: [{ element: 'text', value: example.title }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfence,\n\t\t\t\t\t],\n\t})\n}\n\n/**\n * Replaces one compared cell in a guide's text and returns the whole guide back. `key` names the\n * row the way {@link findDrift} names it — a {@link computeSymbolKey} key for a `## Surface` row,\n * an `Owner.member` key for a `## Methods` row — and the row's {@link SUMMARY} cell becomes\n * `summary`. Only the table's own source region is rewritten, so every byte outside it travels\n * unchanged; a key reaching no cell returns `undefined`, and a row already carrying the summary\n * returns the guide byte for byte.\n *\n * @remarks\n * A row the key does not reach, a table carrying no {@link SUMMARY} column, and a document whose\n * parse recorded no region for the table are each a miss, and a miss returns `undefined` rather\n * than throwing, so a caller reports the key it could not place — the one meaning `undefined`\n * carries in every replacer here. A row already carrying `summary` returns the guide byte for\n * byte, because a rewrite would re-pad the whole table for no change; that identity reads both\n * sides through {@link normalizeSummary}, so a caller passing text the compared form still moves\n * is a fixed point on the second run rather than a row rewritten forever. The rewritten table\n * renders one-space padded whatever padding it carried, so the checkout's formatter re-aligns it.\n *\n * @param guide - The guide's markdown source\n * @param key - The compared key naming the row\n * @param summary - The row's new compared text\n * @returns The guide's text with that cell replaced, or `undefined` when the key reaches no cell\n *\n * @example\n * ```ts\n * replaceCell('## Surface\\n\\n| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks. |', 'function walk', 'Walks a tree.')\n * // '## Surface\\n\\n| Name | Kind | Summary |\\n| --- | --- | --- |\\n| `walk` | function | Walks a tree. |'\n * ```\n */\nexport function replaceCell(guide: string, key: string, summary: string): string | undefined {\n\tconst markdown = createMarkdown(guide)\n\tconst document = markdown.document\n\tlet located: TableNode | undefined\n\tlet index = -1\n\n\tfor (const block of selectSectionBlocks(document, SURFACE)) {\n\t\tif (located !== undefined || !isTableNode(block)) continue\n\t\tfor (let row = 0; row < block.rows.length && located === undefined; row += 1) {\n\t\t\tconst symbol = extractRowSymbol(block, row)\n\t\t\tif (symbol === undefined || computeSymbolKey(symbol) !== key) continue\n\t\t\tlocated = block\n\t\t\tindex = row\n\t\t}\n\t}\n\n\tfor (const [table, owner] of collectGroups(document)) {\n\t\tif (located !== undefined) break\n\t\tfor (let row = 0; row < table.rows.length && located === undefined; row += 1) {\n\t\t\tconst entry = extractRowEntry(table, row)\n\t\t\tif (entry === undefined || `${owner}.${entry.name}` !== key) continue\n\t\t\tlocated = table\n\t\t\tindex = row\n\t\t}\n\t}\n\n\tif (located === undefined) return undefined\n\tconst column = findColumnIndex(located, SUMMARY)\n\tif (column === undefined) return undefined\n\tif ((extractRowSummary(located, index) ?? '') === normalizeSummary(summary)) return guide\n\n\tconst span = markdown.span(located)\n\tif (span === undefined) return undefined\n\treturn spliceSpan(guide, span, renderMarkdown(buildTable(located, index, column, summary)))\n}\n\n/**\n * Replaces one titled fence in a guide's text and returns the whole guide back. The first fence\n * carrying `title` — the pairing {@link findDrift} compares on — takes `example`'s language and\n * code. Only the fence's own source region is rewritten, so every byte outside it travels\n * unchanged; a title no fence carries returns `undefined`, and a fence already carrying that\n * body returns the guide byte for byte.\n *\n * @remarks\n * A title no fence carries and a document whose parse recorded no region for the fence are each a\n * miss, and a miss returns `undefined` rather than throwing — the one meaning `undefined` carries\n * in every replacer here. A fence already carrying that language and code returns the guide\n * byte for byte. A later fence of the same title is outside the pairing and is never rewritten,\n * which is the rule {@link findDrift} compares under.\n *\n * @param guide - The guide's markdown source\n * @param title - The heading text the fence pairs on\n * @param example - The block whose language and code the fence takes\n * @returns The guide's text with that fence replaced, or `undefined` when no fence carries the title\n *\n * @example\n * ```ts\n * replaceFence(guide, 'Walk', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })\n * // the guide's text with the fence under its `### Walk` heading carrying `walk()`\n * ```\n */\nexport function replaceFence(\n\tguide: string,\n\ttitle: string,\n\texample: SourceExample,\n): string | undefined {\n\tconst markdown = createMarkdown(guide)\n\tlet located: CodeBlockNode | undefined\n\tlet current: GuideFence | undefined\n\n\tfor (const [node, fence] of collectFences(markdown.document)) {\n\t\tif (located !== undefined || fence.title !== title) continue\n\t\tlocated = node\n\t\tcurrent = fence\n\t}\n\n\tif (located === undefined || current === undefined) return undefined\n\tif (current.code === example.code && current.language === example.language) return guide\n\n\tconst span = markdown.span(located)\n\tif (span === undefined) return undefined\n\treturn spliceSpan(guide, span, renderMarkdown(buildFence(example)))\n}\n\n/**\n * Replaces one doc block's description paragraph with `summary` and returns the whole block back.\n * The paragraph is the block's text before its first block tag, and it re-wraps inside `width`;\n * the blank line before the first tag, every tag line, the block's indentation, and its\n * continuation markers all survive. A block already carrying the summary returns byte for byte,\n * and a text that is no doc block and a summary carrying no word each return `undefined`.\n *\n * @remarks\n * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a\n * caller reports the block it could not rewrite. Text that opens with no\n * `/**` is no doc block: a single-star `/*` comment reaches this function only by a caller's\n * mistake, and reshaping it into a doc block would be a silent edit. A `summary` carrying no word\n * names no paragraph to write, and deleting the block's description on that argument would erase\n * documentation on the strength of an absent value — a caller with nothing to write writes\n * nothing.\n *\n * A block already carrying `summary` returns byte for byte, which is what keeps a propagation\n * that finds no drift from rewriting the file: a doc block's own wrapping is not recoverable from\n * its text, so re-wrapping an unchanged paragraph would move most blocks this package's source\n * carries. That identity reads both sides through {@link normalizeSummary}, and it holds for a\n * block carrying no tag as much as for a block carrying several. A block written on one physical\n * line stays on one line while `summary` still fits inside `width`, and expands otherwise.\n *\n * `width` counts characters from the line's first, a tab counting as one, so a wrapped line reads\n * `${indent} * ${text}` and never passes that count. A caller whose formatter measures a tab as\n * more than one column passes a smaller width rather than taking the default.\n *\n * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file\n * @param summary - The block's new description paragraph\n * @param width - The character budget a re-wrapped line stays inside. Default: {@link WRAP_WIDTH}\n * @returns The block's raw text with that paragraph replaced, or `undefined` for a text that is\n * no doc block and for a `summary` carrying no word\n *\n * @example\n * ```ts\n * replaceSummary('/**' + ' Walks. *' + '/', 'Walks a tree.') // '/**' + ' Walks a tree. *' + '/'\n * ```\n */\nexport function replaceSummary(\n\tcomment: string,\n\tsummary: string,\n\twidth: number = WRAP_WIDTH,\n): string | undefined {\n\tif (!/^[ \\t]*\\/\\*\\*/.test(comment)) return undefined\n\tconst content = unwrapComment(comment)\n\tconst indent = /^[ \\t]*/.exec(comment)?.[0] ?? ''\n\tconst wrapped = wrapText(summary, width - indent.length - 3)\n\tif (wrapped.length === 0) return undefined\n\n\tconst masked = maskFences(content.join('\\n')).split('\\n')\n\tlet tag = -1\n\tfor (let index = 0; index < masked.length && tag < 0; index += 1) {\n\t\tif (/^[ \\t]*@\\w/.test(masked[index] ?? '')) tag = index\n\t}\n\n\tconst described = content.slice(0, tag < 0 ? content.length : tag).join('\\n')\n\tif (normalizeSummary(described) === normalizeSummary(summary)) return comment\n\n\tconst tail = tag < 0 ? [] : content.slice(tag)\n\tif (tail.length === 0 && wrapped.length === 1 && content.length === 1) {\n\t\tconst single = `${indent}/** ${wrapped[0] ?? ''} */`\n\t\tif (single.length <= width) return single\n\t}\n\n\tconst lines = [...wrapped]\n\tif (tail.length > 0) lines.push('')\n\treturn buildComment([...lines, ...tail], indent)\n}\n\n/**\n * Replaces the body of one titled `@example` tag in a doc block's raw text and returns the whole\n * block back. The tag carrying `example`'s title takes a fence of its language and its code;\n * every other tag, the description paragraph, the block's indentation, and its continuation\n * markers all survive. A text that is no doc block, a title no tag carries, and a language or\n * code the emitted three-backtick fence cannot enclose or the doc block cannot hold each return\n * `undefined`.\n *\n * @remarks\n * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a\n * caller reports the block it could not rewrite. Text that opens with no\n * `/**` is no doc block, for the reason {@link replaceSummary} states. A block carrying no\n * `@example` tag of that title has nowhere to write, so an untitled tag and a tag carrying\n * another title are each left alone, and an `example` naming no title misses a block whose tags\n * all carry one. Code carrying a run of three or more backticks is a body the emitted fence\n * cannot enclose: the fence is three backticks, {@link maskFences} ends a body at the first line\n * opening a run at least as long, and {@link collectExamples} reads to the first such run\n * whatever column it sits at, so writing that body would truncate it and turn a following\n * `@`-line into a tag. A language or code carrying the doc-comment terminator is a body the\n * block itself cannot hold: the terminator closes the block where it lands and the file stops\n * parsing there. Refusing keeps the rewrite total over the bodies it can spell.\n *\n * A tag already carrying that language and code returns byte for byte. {@link maskFences} keeps\n * the current body's own lines out of the tag search, so a fenced body carrying a tag-shaped line\n * does not end the body early. The body ends at its last line carrying text, so the blank line\n * separating it from the next tag survives.\n *\n * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file\n * @param example - The block whose language and code the tag's body takes\n * @returns The block's raw text with that body replaced, or `undefined` for a text that is no\n * doc block, for a title no `@example` tag carries, and for a language or code the emitted\n * fence cannot enclose or the doc block cannot hold — a body carrying the doc-comment terminator\n *\n * @example\n * ```ts\n * replaceExample('/**' + '\\n * @example Walk\\n * old()\\n *' + '/', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })\n * // the same block, its `@example Walk` body now a fence tagged `ts` carrying `walk()`\n * ```\n */\nexport function replaceExample(comment: string, example: SourceExample): string | undefined {\n\tif (!/^[ \\t]*\\/\\*\\*/.test(comment)) return undefined\n\tconst spelled = [example.language ?? '', ...example.code.split('\\n')]\n\tif (spelled.some((line) => line.includes('```') || line.includes('*/'))) return undefined\n\tconst content = unwrapComment(comment)\n\tconst masked = maskFences(content.join('\\n')).split('\\n')\n\tconst title = example.title ?? ''\n\tlet start = -1\n\n\tfor (let index = 0; index < masked.length && start < 0; index += 1) {\n\t\tconst tag = /^[ \\t]*@example(?=[ \\t]|$)[ \\t]*(.*)$/.exec(masked[index] ?? '')\n\t\tif (tag !== null && (tag[1] ?? '').trim() === title) start = index\n\t}\n\tif (start < 0) return undefined\n\n\tconst current = collectExamples(content.join('\\n'), example.name).find(\n\t\t(entry) => (entry.title ?? '') === title,\n\t)\n\tif (\n\t\tcurrent !== undefined &&\n\t\tcurrent.code === example.code &&\n\t\tcurrent.language === example.language\n\t) {\n\t\treturn comment\n\t}\n\n\tlet end = content.length\n\tfor (let index = start + 1; index < masked.length && end === content.length; index += 1) {\n\t\tif (/^[ \\t]*@\\w/.test(masked[index] ?? '')) end = index\n\t}\n\twhile (end > start + 1 && (content[end - 1] ?? '').length === 0) end -= 1\n\n\tconst indent = /^[ \\t]*/.exec(comment)?.[0] ?? ''\n\tconst body = [`\\`\\`\\`${example.language ?? ''}`, ...example.code.split('\\n'), '```']\n\treturn buildComment([...content.slice(0, start + 1), ...body, ...content.slice(end)], indent)\n}\n\n/**\n * Locates the doc block a compared key attaches to inside one file's text and returns the block's\n * own character region, so a caller can `slice` the block, rewrite it through\n * {@link replaceSummary} or {@link replaceExample}, and write the result back through\n * {@link spliceSpan}. `key` names the pair the way {@link findDrift} names it — a\n * {@link computeSymbolKey} key for a declaration, an `Owner.member` key for an interface or class\n * member; the region covers the block's own indentation, and no block carrying the key returns\n * `undefined`.\n *\n * @remarks\n * Attachment is {@link extractSourceComments}'s, not a second reading of the file: that walk\n * pairs each eligible block with the physical record it documents, and this function keeps the\n * record {@link collectKeys} gives `key`. The keys are that one grammar's — the map\n * {@link extractExports} and {@link extractMemberMethods} each read their own part out of — so\n * this function runs no head pattern, no member pattern, and no owner-close rule of its own, and\n * a change to any of them reaches the locator too. Every block {@link collectSummaries} reports\n * a summary for is reachable by its key, and a block carrying only block tags is reachable too although it carries no summary.\n * A block it misses is one the comparison never had: a block a blank line separates from its\n * declaration attaches to the blank line, and a block written inside a template literal or a\n * string is no genuine span at all. The first block whose record carries the key answers for it,\n * as the first declaration of a name does everywhere else.\n *\n * The region runs from the start of the opener's line, the block's indentation included, to the\n * character past its closing marker — the raw text {@link replaceSummary} and\n * {@link replaceExample} each document as the span \"as it sits in the file\", so a caller slices,\n * rewrites, and splices with no adjustment and the rewrite keeps the indentation it found. A\n * block that source material precedes on its own line starts at the opener instead. The region\n * is read off the aligned JSDoc projection rather than searched for in the text, so an opener\n * written inside a string never yields one, and line offsets come from\n * {@link extractSourceLines}'s own records under its stated LF-or-CRLF terminator rule, so a\n * CRLF file reports the offsets its own bytes carry.\n *\n * @param text - One file's whole source text\n * @param key - The compared key naming the declaration or the member\n * @returns The block's half-open character region, or `undefined` when no block carries the key\n *\n * @example\n * ```ts\n * const text = '/**' + ' Walks. *' + '/\\nexport function walk(): void {}\\n'\n * locateComment(text, 'function walk') // { start: 0, end: 13 }\n * ```\n */\nexport function locateComment(text: string, key: string): MarkdownSpan | undefined {\n\tconst lines = extractSourceLines(text)\n\tconst keys = collectKeys(lines)\n\tconst offsets: number[] = []\n\tconst positions = new Map<SourceLine, number>()\n\tlet offset = 0\n\n\tfor (let index = 0; index < lines.length; index += 1) {\n\t\tconst line = lines[index]\n\t\tif (line === undefined) continue\n\t\toffsets.push(offset)\n\t\tpositions.set(line, index)\n\t\tconst after = offset + line.source.length\n\t\toffset = after + (text.startsWith('\\r\\n', after) ? 2 : 1)\n\t}\n\n\tfor (const comment of extractSourceComments(lines)) {\n\t\tif (keys.get(comment.line) !== key) continue\n\t\tconst close = (positions.get(comment.line) ?? 0) - 1\n\t\tconst closing = lines[close]?.jsdoc\n\t\tconst end = closing === undefined ? -1 : closing.lastIndexOf('*/')\n\t\tif (end < 0) continue\n\n\t\tlet first = close\n\t\twhile (first > 0 && lines[first - 1]?.jsdoc !== undefined) first -= 1\n\n\t\t// The run's spans are read forward, because an opener written inside a span — an\n\t\t// `@example` quoting one — is body text rather than a second block, and a backward\n\t\t// search would stop at it. The authoritative span is the last one the run opens.\n\t\tlet inside = false\n\t\tlet line = -1\n\t\tlet column = -1\n\t\tfor (let index = first; index <= close; index += 1) {\n\t\t\tconst projection = lines[index]?.jsdoc ?? ''\n\t\t\tlet cursor = 0\n\t\t\twhile (cursor < projection.length) {\n\t\t\t\tconst at = projection.indexOf(inside ? '*/' : '/**', cursor)\n\t\t\t\tif (at < 0) break\n\t\t\t\tif (!inside) {\n\t\t\t\t\tline = index\n\t\t\t\t\tcolumn = at\n\t\t\t\t}\n\t\t\t\tcursor = at + (inside ? 2 : 3)\n\t\t\t\tinside = !inside\n\t\t\t}\n\t\t}\n\t\tif (line < 0) continue\n\n\t\tconst source = lines[line]?.source ?? ''\n\t\tconst start = source.slice(0, column).trim() === '' ? 0 : column\n\t\treturn { start: (offsets[line] ?? 0) + start, end: (offsets[close] ?? 0) + end + 2 }\n\t}\n\n\treturn undefined\n}\n","import type { GuideFence, GuideInterface, MethodGroup, SurfaceSymbol } from './types.js'\nimport { createMarkdown, flattenText, isHeadingNode } from '@orkestrel/markdown'\nimport {\n\textractFences,\n\textractLinks,\n\textractMethods,\n\textractSurface,\n\textractTagline,\n\textractTests,\n\textractUnnamed,\n} from './helpers.js'\n\n/**\n * Presents a pure, structured view over one parsed guide — the documented\n * projections (`sections` / `tagline` / `surface` / `methods` / `unnamed` / `links` /\n * `tests` / `fences`) are extracted once at construction and cached.\n *\n * @remarks\n * Parses `source` once through `@orkestrel/markdown` and never touches the\n * filesystem — `Guide` reads only the markdown text it is given and records\n * nothing about where the guide came from. Every accessor returns the same\n * cached, readonly array on every call.\n *\n * @example\n * ```ts\n * import { Guide } from '@orkestrel/guide'\n *\n * const guide = new Guide('## Surface\\n\\n| Name | Kind |\\n| --- | --- |\\n| `X` | class |')\n * guide.surface() // [{ name: 'X', keyword: 'class' }]\n * ```\n */\nexport class Guide implements GuideInterface {\n\treadonly #sections: readonly string[]\n\treadonly #tagline: string | undefined\n\treadonly #surface: readonly SurfaceSymbol[]\n\treadonly #methods: readonly MethodGroup[]\n\treadonly #unnamed: readonly string[]\n\treadonly #links: readonly string[]\n\treadonly #tests: readonly string[]\n\treadonly #fences: readonly GuideFence[]\n\n\tconstructor(source: string) {\n\t\tconst document = createMarkdown(source).document\n\n\t\tthis.#sections = document.children\n\t\t\t.filter(isHeadingNode)\n\t\t\t.filter((heading) => heading.level === 2)\n\t\t\t.map((heading) => flattenText(heading).trim())\n\t\tthis.#tagline = extractTagline(document)\n\t\tthis.#surface = extractSurface(document)\n\t\tthis.#methods = extractMethods(document)\n\t\tthis.#unnamed = extractUnnamed(document)\n\t\tthis.#links = extractLinks(document)\n\t\tthis.#tests = extractTests(document)\n\t\tthis.#fences = extractFences(document)\n\t}\n\n\tsections(): readonly string[] {\n\t\treturn this.#sections\n\t}\n\n\ttagline(): string | undefined {\n\t\treturn this.#tagline\n\t}\n\n\tsurface(): readonly SurfaceSymbol[] {\n\t\treturn this.#surface\n\t}\n\n\tmethods(): readonly MethodGroup[] {\n\t\treturn this.#methods\n\t}\n\n\tunnamed(): readonly string[] {\n\t\treturn this.#unnamed\n\t}\n\n\tlinks(): readonly string[] {\n\t\treturn this.#links\n\t}\n\n\ttests(): readonly string[] {\n\t\treturn this.#tests\n\t}\n\n\tfences(): readonly GuideFence[] {\n\t\treturn this.#fences\n\t}\n}\n","import type {\n\tDeclaration,\n\tDeclarationKeyword,\n\tMethodEntry,\n\tSourceExample,\n\tSourceInterface,\n\tSourceOptions,\n\tSurfaceSymbol,\n} from '../types.js'\nimport {\n\tcollectDeclarations,\n\tcomputeSymbolKey,\n\textractExampleMethods,\n\textractExamples,\n\textractExports,\n\textractHidden,\n\textractMemberMethods,\n\textractSourceLines,\n\thasCanonicalSegments,\n\tnormalizeDirectories,\n\tresolveLink,\n\tresolvePath,\n\tselectModuleKeys,\n} from '../helpers.js'\n\n/**\n * Reflects, as a pure `SourceInterface`, a module scope's intentional direct declarations,\n * conventional barrel-reachable surface, and member methods over a consumer-supplied file\n * inventory, using text-only line scanners rather than the TypeScript compiler API or the\n * filesystem. `Source` never touches disk:\n * the consumer gathers the inventory however their environment allows\n * (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) and\n * passes it in as `files`.\n *\n * @remarks\n * Conventional barrel traversal recurses through both\n * exact workspace-root `index.ts` and nested `/index.ts` targets. `'.'` is the\n * canonical workspace-root module, module spellings normalize once at\n * construction, and exact opaque inventory keys are never rewritten; keys with\n * empty, `.` or `..` segments stay outside both initial and resolved barrel\n * inventory entrances after relative-row reduction; canonical parent hops\n * remain valid. `methods` resolves a declaration's members through its\n * `extends` chain within the same module scope, keeping the keyword it started\n * from; a base the scope does not declare contributes nothing. One declaration\n * answers under each keyword: the first file in sorted key order that declares\n * the head supplies its members and its bases, and a second file declaring the\n * same name under that keyword adds nothing. The interface answers for a name,\n * and the class when no interface declares it; one file declaring the name as\n * both shapes, a TypeScript declaration merge, answers with both, own members\n * ahead of inherited ones and the interface's own first. Every reading derives once per instance from the immutable\n * inventory and is reused — the scope's declaration map on the first `methods`\n * or `examples` lookup, then each name's members and each example collection\n * under the name asked for — so a reader asking twice reads the files once and\n * receives the same records, and a second instance over the same inventory\n * derives the same readings of its own. Source projection preserves columns\n * without widening direct/hidden column-zero heads. Literal ECMAScript Unicode\n * identifiers participate in bounded slash-state recognition without escape\n * decoding. Regex recognition is bounded: slash after bare `}` is division, so\n * a post-brace regex statement requires an explicit `;`. General semicolonless\n * declaration/ASI classification is also outside the finite projector, so a\n * slash-leading statement after such a declaration requires an explicit `;`.\n *\n * @example\n * ```ts\n * import { Source } from '@orkestrel/guide'\n *\n * const source = new Source({\n * \tfiles: {\n * \t\t'src/core/index.ts': \"export * from './Guide.js'\\nexport * from './types.js'\\n\",\n * \t\t'src/core/Guide.ts': 'export class Guide {}\\n',\n * \t\t'src/core/types.ts': 'export interface GuideInterface {\\n\\tsections(): void\\n}\\n',\n * \t},\n * \tmodule: 'src/core',\n * })\n * source.exports() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]\n * source.surface() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]\n * source.methods('GuideInterface') // [{ name: 'sections' }]\n * source.exists('src/core/Guide.ts') // true\n * ```\n */\nexport class Source implements SourceInterface {\n\treadonly #files: Readonly<Record<string, string>>\n\treadonly #directories: readonly string[]\n\treadonly #methods = new Map<string, readonly MethodEntry[]>()\n\treadonly #examples = new Map<string | undefined, readonly SourceExample[]>()\n\t#exports: readonly SurfaceSymbol[] | undefined\n\t#surface: readonly SurfaceSymbol[] | undefined\n\t#hidden: readonly SurfaceSymbol[] | undefined\n\t#declarations: ReadonlyMap<string, Declaration> | undefined\n\treadonly #origins = new Map<string, string>()\n\n\tconstructor(options: SourceOptions) {\n\t\tthis.#files = options.files\n\t\tthis.#directories = normalizeDirectories(options.module)\n\t}\n\n\t// The module's exports are computed once on first access and cached —\n\t// every subsequent call reuses the same scan of an immutable inventory.\n\texports(): readonly SurfaceSymbol[] {\n\t\tif (this.#exports === undefined) this.#exports = this.#scanSymbols(extractExports)\n\t\treturn this.#exports\n\t}\n\n\t// The conventional barrel surface is computed once on first access and\n\t// cached independently from the intentional direct-declaration inventory.\n\tsurface(): readonly SurfaceSymbol[] {\n\t\tif (this.#surface === undefined) this.#surface = this.#scanSurface()\n\t\treturn this.#surface\n\t}\n\n\t// A name's members are computed once per instance and cached under that name, so a\n\t// reader asking twice resolves one `extends` chain rather than two.\n\tmethods(name: string): readonly MethodEntry[] {\n\t\tconst cached = this.#methods.get(name)\n\t\tif (cached !== undefined) return cached\n\n\t\tconst members = this.#scanMethods(name)\n\t\tthis.#methods.set(name, members)\n\t\treturn members\n\t}\n\n\texists(relative: string): boolean {\n\t\tconst keys = Object.keys(this.#files)\n\t\treturn keys.some((key) => key === relative || key.startsWith(`${relative}/`))\n\t}\n\n\t// The module's hidden declarations are computed once on first access and\n\t// cached — mirrors `exports()`'s caching.\n\thidden(): readonly SurfaceSymbol[] {\n\t\tif (this.#hidden === undefined) this.#hidden = this.#scanSymbols(extractHidden)\n\t\treturn this.#hidden\n\t}\n\n\t// Each reading is computed once per instance and cached under the name it was asked\n\t// for, the module-wide collection under the absent name.\n\texamples(): readonly SourceExample[]\n\texamples(name: string): readonly SourceExample[]\n\texamples(name?: string): readonly SourceExample[] {\n\t\tconst cached = this.#examples.get(name)\n\t\tif (cached !== undefined) return cached\n\n\t\tconst examples = name === undefined ? this.#scanExamples() : this.#exampleMembers(name)\n\t\tthis.#examples.set(name, examples)\n\t\treturn examples\n\t}\n\n\t// TypeScript merges a class and an interface only inside one module, so one file declaring a\n\t// name as both shapes answers with both member sets: each shape's own members ahead of\n\t// inherited ones, the interface's own first, as in `#exampleMembers`. Shapes from two files are\n\t// separate declarations, so the interface answers and the class answers only when no interface\n\t// declares the name. A class's members arrive without the `constructor` no guide documents.\n\t#scanMethods(name: string): readonly MethodEntry[] {\n\t\tconst fromInterface = this.#members('interface', name, new Set<string>())\n\t\tconst fromClass = this.#members('class', name, new Set<string>())?.filter(\n\t\t\t(entry) => entry.name !== 'constructor',\n\t\t)\n\t\tconst origin = this.#origin('interface', name)\n\t\tif (origin === undefined || origin !== this.#origin('class', name))\n\t\t\treturn fromInterface ?? fromClass ?? []\n\n\t\tconst methods = new Map<string, MethodEntry>()\n\t\tfor (const entry of [\n\t\t\t...extractMemberMethods(this.#locate('interface', name)?.body ?? []),\n\t\t\t...extractMemberMethods(this.#locate('class', name)?.body ?? []),\n\t\t\t...(fromInterface ?? []),\n\t\t\t...(fromClass ?? []),\n\t\t])\n\t\t\tif (entry.name !== 'constructor' && !methods.has(entry.name)) methods.set(entry.name, entry)\n\n\t\treturn Array.from(methods.values()).sort((a, b) =>\n\t\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t\t)\n\t}\n\n\t// The union of exported declaration heads' `@example` blocks across the module's\n\t// files, deduped by name and title in first-seen order — mirrors `#scanSymbols`,\n\t// but over the `@example` scanner rather than a `SurfaceSymbol` one.\n\t#scanExamples(): readonly SourceExample[] {\n\t\tconst examples: SourceExample[] = []\n\t\tconst seen = new Set<string>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const example of extractExamples(text)) {\n\t\t\t\tconst identity = `${example.name}\\n${example.title ?? ''}`\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\texamples.push(example)\n\t\t\t}\n\t\t}\n\n\t\treturn examples\n\t}\n\n\t// The graph closure of each selected directory's conventional root barrel,\n\t// deduped with the same identity and ordering as the direct export scan.\n\t#scanSurface(): readonly SurfaceSymbol[] {\n\t\tconst symbols: SurfaceSymbol[] = []\n\t\tconst seen = new Set<string>()\n\t\tconst visited = new Set<string>()\n\n\t\tfor (const directory of this.#directories) {\n\t\t\tthis.#collectSurface(resolvePath(directory, 'index.ts'), visited, symbols, seen)\n\t\t}\n\n\t\treturn symbols.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n\t}\n\n\t// Traverse one exact canonical index inventory key. Only complete\n\t// conventional relative `.js` star rows whose reduced targets are canonical\n\t// enter the graph; every other line is outside the reflected population and\n\t// remains validation-owned by policy and builds.\n\t#collectSurface(\n\t\tindex: string,\n\t\tvisited: Set<string>,\n\t\tsymbols: SurfaceSymbol[],\n\t\tseen: Set<string>,\n\t): void {\n\t\tif (!hasCanonicalSegments(index)) return\n\t\tif (visited.has(index)) return\n\t\tvisited.add(index)\n\n\t\tconst source = this.#files[index]\n\t\tif (source === undefined) return\n\n\t\tfor (const line of extractSourceLines(source)) {\n\t\t\tconst row = line.code.match(\n\t\t\t\t/^\\s*export\\s+\\*\\s+from\\s+(?:'(\\.\\.?\\/[^']+\\.js)'|\"(\\.\\.?\\/[^\"]+\\.js)\")\\s*;?\\s*(?:\\/\\/.*)?$/,\n\t\t\t)\n\t\t\tconst target = row?.[1] ?? row?.[2]\n\t\t\tif (target === undefined) continue\n\n\t\t\tconst path = resolveLink(index, `${target.slice(0, -3)}.ts`)\n\t\t\tif (!hasCanonicalSegments(path)) continue\n\t\t\tif (path === 'index.ts' || path.endsWith('/index.ts')) {\n\t\t\t\tthis.#collectSurface(path, visited, symbols, seen)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (visited.has(path)) continue\n\t\t\tvisited.add(path)\n\n\t\t\tconst text = this.#files[path]\n\t\t\tif (text === undefined) continue\n\t\t\tfor (const symbol of extractExports(text)) {\n\t\t\t\tconst identity = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t}\n\t}\n\n\t// The `@example` blocks of the interface-or-class declaration body named\n\t// `name`, unioning both shapes (an implementer may carry its own `@example` a\n\t// documented interface member does not, or vice versa). The interface's own\n\t// block answers first for a member both shapes document.\n\t#exampleMembers(name: string): readonly SourceExample[] {\n\t\tconst members = new Map<string, SourceExample>()\n\n\t\tfor (const example of [\n\t\t\t...extractExampleMethods(this.#locate('interface', name)?.body ?? []),\n\t\t\t...extractExampleMethods(this.#locate('class', name)?.body ?? []),\n\t\t]) {\n\t\t\tconst identity = `${example.name}\\n${example.title ?? ''}`\n\t\t\tif (members.has(identity)) continue\n\t\t\tmembers.set(identity, example)\n\t\t}\n\n\t\treturn Array.from(members.values()).sort((a, b) =>\n\t\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t\t)\n\t}\n\n\t// The pure union-and-dedupe-and-sort composition behind `exports()` and\n\t// `hidden()` — kept as a private method because it orchestrates a scanner\n\t// across every file of the module scope rather than being a self-contained\n\t// leaf.\n\t#scanSymbols(scan: (source: string) => readonly SurfaceSymbol[]): readonly SurfaceSymbol[] {\n\t\tconst symbols: SurfaceSymbol[] = []\n\t\tconst seen = new Set<string>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const symbol of scan(text)) {\n\t\t\t\tconst identity = computeSymbolKey(symbol)\n\t\t\t\tif (seen.has(identity)) continue\n\t\t\t\tseen.add(identity)\n\t\t\t\tsymbols.push(symbol)\n\t\t\t}\n\t\t}\n\n\t\treturn symbols.sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1))\n\t}\n\n\t// The declared members of the `keyword` declaration named `name` unioned with\n\t// those of every declaration it extends, each carrying its own doc block's\n\t// description paragraph. `undefined` states one fact only — the module scope\n\t// declares no such head — which is what sends `methods()` on to the class\n\t// shape; a name already on the visit path is declared and returns an empty\n\t// union, so a cycle and a diamond each collapse to one visit. A base the scope\n\t// does not declare contributes nothing, and a member the declaration itself\n\t// documents answers ahead of the base it overrides.\n\t#members(\n\t\tkeyword: DeclarationKeyword,\n\t\tname: string,\n\t\tvisited: Set<string>,\n\t): readonly MethodEntry[] | undefined {\n\t\tif (visited.has(name)) return []\n\t\tvisited.add(name)\n\n\t\tconst declaration = this.#locate(keyword, name)\n\t\tif (declaration === undefined) return undefined\n\n\t\tconst methods = new Map<string, MethodEntry>()\n\t\tfor (const entry of extractMemberMethods(declaration.body)) methods.set(entry.name, entry)\n\t\tfor (const base of declaration.bases) {\n\t\t\tfor (const member of this.#members(keyword, base, visited) ?? []) {\n\t\t\t\tif (!methods.has(member.name)) methods.set(member.name, member)\n\t\t\t}\n\t\t}\n\n\t\treturn Array.from(methods.values()).sort((a, b) =>\n\t\t\ta.name === b.name ? 0 : a.name < b.name ? -1 : 1,\n\t\t)\n\t}\n\n\t// The one declaration that answers for `name`, read from the scope's declaration map,\n\t// which is collected once on first lookup and reused by every later one.\n\t#locate(keyword: DeclarationKeyword, name: string): Declaration | undefined {\n\t\tif (this.#declarations === undefined) this.#declarations = this.#scanDeclarations()\n\t\treturn this.#declarations.get(`${keyword} ${name}`)\n\t}\n\n\t// The inventory key of the file whose head answers for `name` under `keyword`, recorded by\n\t// the same scan as the declaration map.\n\t#origin(keyword: DeclarationKeyword, name: string): string | undefined {\n\t\treturn this.#locate(keyword, name) === undefined\n\t\t\t? undefined\n\t\t\t: this.#origins.get(`${keyword} ${name}`)\n\t}\n\n\t// The scope's declarations, keyed `${keyword} ${name}` — one `collectDeclarations`\n\t// pass per file in sorted key order, so a scope reads each file once however many\n\t// names it resolves. The first file whose located head has a body or bases answers\n\t// for a key, its body and bases read together, so a later file declaring the same\n\t// name contributes nothing. A located head with neither a body nor bases does not\n\t// declare; the scan continues past it to a later file or leaves the key unanswered.\n\t#scanDeclarations(): ReadonlyMap<string, Declaration> {\n\t\tconst declarations = new Map<string, Declaration>()\n\n\t\tfor (const key of selectModuleKeys(this.#files, this.#directories)) {\n\t\t\tconst text = this.#files[key]\n\t\t\tif (text === undefined) continue\n\n\t\t\tfor (const [identity, declaration] of collectDeclarations(text)) {\n\t\t\t\tif (declarations.has(identity)) continue\n\t\t\t\tif (declaration.body.length === 0 && declaration.bases.length === 0) continue\n\t\t\t\tdeclarations.set(identity, declaration)\n\t\t\t\tthis.#origins.set(identity, key)\n\t\t\t}\n\t\t}\n\n\t\treturn declarations\n\t}\n}\n","import type { SourceInterface, SourceManagerInterface, SourceManagerOptions } from '../types.js'\nimport { computeModuleKey } from '../helpers.js'\nimport { Source } from './Source.js'\n\n/**\n * Resolves a consumer-owned import-specifier policy into pure source views and\n * caches those views by module, so aliases for one module share one entity.\n * Unmapped specifiers remain foreign to the consumer and return `undefined`.\n * `sources()` enumerates the same shared views, one per distinct module the\n * policy maps.\n *\n * @example\n * ```ts\n * import { SourceManager } from '@orkestrel/guide'\n *\n * const sources = new SourceManager({\n * \tfiles: { 'src/core/index.ts': \"export * from './types.js'\" },\n * \tmodules: { '@scope/package': 'src/core' },\n * })\n * sources.source('@scope/package')?.surface()\n * sources.sources() // [the same shared view]\n * ```\n */\nexport class SourceManager implements SourceManagerInterface {\n\treadonly #files: Readonly<Record<string, string>>\n\treadonly #modules: SourceManagerOptions['modules']\n\treadonly #sources = new Map<string, SourceInterface>()\n\n\tconstructor(options: SourceManagerOptions) {\n\t\tthis.#files = options.files\n\t\tthis.#modules = options.modules\n\t}\n\n\tsource(specifier: string): SourceInterface | undefined {\n\t\tif (!Object.hasOwn(this.#modules, specifier)) return undefined\n\t\tconst module = this.#modules[specifier]\n\t\tif (module === undefined) return undefined\n\n\t\tconst key = computeModuleKey(module)\n\t\tconst existing = this.#sources.get(key)\n\t\tif (existing !== undefined) return existing\n\n\t\tconst source = new Source({ files: this.#files, module })\n\t\tthis.#sources.set(key, source)\n\t\treturn source\n\t}\n\n\tsources(): readonly SourceInterface[] {\n\t\tconst views: SourceInterface[] = []\n\t\tconst seen = new Set<SourceInterface>()\n\n\t\tfor (const specifier of Object.keys(this.#modules)) {\n\t\t\tconst view = this.source(specifier)\n\t\t\tif (view === undefined || seen.has(view)) continue\n\t\t\tseen.add(view)\n\t\t\tviews.push(view)\n\t\t}\n\n\t\treturn views\n\t}\n}\n","import type { MarkdownSpan } from '@orkestrel/markdown'\nimport type {\n\tDrift,\n\tManifestEntry,\n\tParityExampleResult,\n\tParityFinding,\n\tParityInterface,\n\tParityOptions,\n\tParityResult,\n\tParityRewriteResult,\n\tParityRow,\n\tSourceExample,\n} from './types.js'\nimport { isNonEmptyString } from '@orkestrel/contract'\nimport {\n\tcollectExamples,\n\tcollectTitles,\n\tcompareMembership,\n\tcomputeSymbolKey,\n\textractFenceImports,\n\tfindDrift,\n\tfindMissing,\n\tfindMissingSymbols,\n\tfindUnexampled,\n\tfindUnlisted,\n\tformatDrift,\n\tformatSide,\n\thasBehaviouralSurface,\n\tidentifyDrift,\n\tisExternalLink,\n\tlocateComment,\n\tnormalizeDirectories,\n\tnormalizeComment,\n\treplaceCell,\n\treplaceExample,\n\treplaceFence,\n\treplaceSummary,\n\tresolveLink,\n\tselectModuleKeys,\n\tspliceSpan,\n} from './helpers.js'\nimport { METHODS, SURFACE, TESTS } from './constants.js'\nimport { Guide } from './Guide.js'\nimport { Source } from './sources/Source.js'\nimport { SourceManager } from './sources/SourceManager.js'\n\n/**\n * Composes generic guide-parity inspection and explicit in-memory rewrites over a caller inventory.\n */\nexport class Parity implements ParityInterface {\n\treadonly #options: ParityOptions\n\treadonly #rows: readonly ParityRow[]\n\n\tconstructor(options: ParityOptions) {\n\t\tthis.#options = {\n\t\t\tfiles: { ...options.files },\n\t\t\tentries: options.entries.map((entry) => ({ ...entry })),\n\t\t\tmodules: { ...options.modules },\n\t\t\tlanguages: [...options.languages],\n\t\t\tlanguage: options.language,\n\t\t\t...(options.pitch === undefined ? {} : { pitch: { ...options.pitch } }),\n\t\t}\n\t\tthis.#rows = this.#createRows(this.#options.files)\n\t}\n\n\trows(): readonly ParityRow[] {\n\t\treturn this.#rows\n\t}\n\n\tinspect(): ParityResult {\n\t\tconst input: ParityFinding[] = []\n\t\tconst sections: ParityFinding[] = []\n\t\tconst surface: ParityFinding[] = []\n\t\tconst methods: ParityFinding[] = []\n\t\tconst declarations: ParityFinding[] = []\n\t\tconst links: ParityFinding[] = []\n\t\tconst tests: ParityFinding[] = []\n\t\tconst fences: ParityFinding[] = []\n\t\tconst exampleFences: ParityFinding[] = []\n\t\tconst exampleFunctions: ParityFinding[] = []\n\t\tconst exampleMethods: ParityFinding[] = []\n\t\tconst exampleTitles: ParityFinding[] = []\n\t\tconst examples: ParityExampleResult = {\n\t\t\tfences: exampleFences,\n\t\t\tfunctions: exampleFunctions,\n\t\t\tmethods: exampleMethods,\n\t\t\ttitles: exampleTitles,\n\t\t}\n\t\tconst imports: ParityFinding[] = []\n\t\tconst drift: ParityFinding[] = []\n\t\tconst pitch: ParityFinding[] = []\n\n\t\tthis.#inspectInput(input)\n\t\tfor (const row of this.#rows) {\n\t\t\tthis.#inspectSections(row, sections)\n\t\t\tthis.#inspectSurface(row, surface)\n\t\t\tthis.#inspectMethods(row, methods)\n\t\t\tthis.#inspectDeclarations(row, declarations)\n\t\t\tthis.#inspectLinks(row, links, tests)\n\t\t\tthis.#inspectFences(row, fences)\n\t\t\tthis.#inspectExamples(row, exampleFences, exampleFunctions, exampleMethods, exampleTitles)\n\t\t\tthis.#inspectImports(row, imports)\n\t\t\tthis.#inspectDrift(row, drift)\n\t\t}\n\t\tthis.#inspectPitch(pitch)\n\n\t\treturn {\n\t\t\tinput,\n\t\t\tsections,\n\t\t\tsurface,\n\t\t\tmethods,\n\t\t\tdeclarations,\n\t\t\tlinks,\n\t\t\ttests,\n\t\t\tfences,\n\t\t\texamples,\n\t\t\timports,\n\t\t\tdrift,\n\t\t\tpitch,\n\t\t}\n\t}\n\n\tdocument(): ParityRewriteResult {\n\t\treturn this.#rewrite((row, drift, files) => this.#rewriteGuide(row, drift, files))\n\t}\n\n\tannotate(): ParityRewriteResult {\n\t\treturn this.#rewrite((row, drift, files) => this.#rewriteSource(row, drift, files))\n\t}\n\n\t#rewrite(\n\t\tapply: (row: ParityRow, drift: Drift, files: Map<string, string>) => string | undefined,\n\t): ParityRewriteResult {\n\t\tconst files = new Map(Object.entries(this.#options.files))\n\t\tconst reasons = new Map<string, string>()\n\t\tconst requested = new Set<string>()\n\n\t\tfor (const row of this.#rows) {\n\t\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\t\tconst identity = identifyDrift(row.entry.spec, drift)\n\t\t\t\trequested.add(identity)\n\t\t\t\tconst reason = apply(row, drift, files)\n\t\t\t\tif (reason !== undefined) reasons.set(identity, reason)\n\t\t\t}\n\t\t}\n\n\t\tconst inventory = Object.fromEntries(files)\n\t\tconst remaining: ParityFinding[] = []\n\t\tconst result = new Parity({ ...this.#options, files: inventory })\n\t\tremaining.push(...result.inspect().input)\n\t\tfor (const row of result.rows()) {\n\t\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\t\tconst identity = identifyDrift(row.entry.spec, drift)\n\t\t\t\tif (!requested.has(identity)) continue\n\t\t\t\tremaining.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${formatDrift(drift)}; ${reasons.get(identity) ?? 'the requested destination still disagrees'}`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst changes = Array.from(files.entries())\n\t\t\t.filter(([path, content]) => this.#options.files[path] !== content)\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\t\t.map(([path, content]) => ({ path, content }))\n\t\treturn { changes, findings: remaining }\n\t}\n\n\t#createRows(files: Readonly<Record<string, string>>): readonly ParityRow[] {\n\t\tconst rows: ParityRow[] = []\n\t\tfor (const entry of this.#options.entries) {\n\t\t\tconst text = files[entry.spec]\n\t\t\tif (text === undefined) continue\n\t\t\trows.push({\n\t\t\t\tentry,\n\t\t\t\tguide: new Guide(text),\n\t\t\t\tsource: new Source({ files, module: entry.source }),\n\t\t\t})\n\t\t}\n\t\treturn rows\n\t}\n\n\t#inspectInput(findings: ParityFinding[]): void {\n\t\tif (this.#options.entries.length === 0) {\n\t\t\tfindings.push({ text: 'The manifest has no guide entries.' })\n\t\t}\n\t\tfor (const entry of this.#options.entries) {\n\t\t\tif (this.#options.files[entry.spec] !== undefined) continue\n\t\t\tfindings.push({ spec: entry.spec, text: `${entry.spec} is absent from the inventory.` })\n\t\t}\n\t}\n\n\t#inspectSections(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst sections = row.guide.sections()\n\t\tfor (const heading of [SURFACE, METHODS, TESTS]) {\n\t\t\tif (sections.includes(heading)) continue\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no ## ${heading} section.`,\n\t\t\t})\n\t\t}\n\t\tif (row.guide.methods().length === 0 && hasBehaviouralSurface(row.source)) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no documented method groups.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectSurface(row: ParityRow, findings: ParityFinding[]): void {\n\t\tif (row.guide.surface().length === 0) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} has no documented surface.` })\n\t\t}\n\t\tfor (const unnamed of row.guide.unnamed()) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has an unnamed row: ${unnamed}`,\n\t\t\t})\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.exports(), row.source.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} does not re-export ${key}.` })\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.surface(), row.source.exports())) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} barrel exposes no direct ${key}.`,\n\t\t\t})\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.source.surface(), row.guide.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} does not document ${key}.` })\n\t\t}\n\t\tfor (const key of findMissingSymbols(row.guide.surface(), row.source.surface())) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} documents no barrel ${key}.` })\n\t\t}\n\t\tfor (const symbol of row.source.hidden()) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} source hides ${computeSymbolKey(symbol)}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectMethods(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const group of row.guide.methods()) {\n\t\t\tconst documented = group.methods.map((entry) => entry.name)\n\t\t\tconst declared = row.source.methods(group.interface).map((entry) => entry.name)\n\t\t\tif (documented.length === 0) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} ${group.interface} has no documented methods.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tfor (const name of findMissing(declared, documented)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} does not document ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tfor (const name of findMissing(documented, declared)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} documents no source ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tif (entity === group.interface) continue\n\t\t\tfor (const name of findMissing(\n\t\t\t\trow.source.methods(entity).map((entry) => entry.name),\n\t\t\t\tdocumented,\n\t\t\t)) {\n\t\t\t\tfindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} ${entity}.${name} is outside the ${group.interface} contract.`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t#inspectDeclarations(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst groups = row.guide.methods()\n\t\tconst documented = groups.map((group) => group.interface)\n\t\tconst declared = new Set(row.source.surface().map((symbol) => symbol.name))\n\t\tconst classes = new Set(\n\t\t\trow.source\n\t\t\t\t.surface()\n\t\t\t\t.filter((symbol) => symbol.keyword === 'class')\n\t\t\t\t.map((symbol) => symbol.name),\n\t\t)\n\n\t\tfor (const group of groups) {\n\t\t\tconst finding = compareMembership(\n\t\t\t\trow.entry.spec,\n\t\t\t\tgroup.interface,\n\t\t\t\tgroup.methods.map((entry) => entry.name),\n\t\t\t\trow.source.methods(group.interface).map((entry) => entry.name),\n\t\t\t)\n\t\t\tif (finding !== undefined) findings.push(finding)\n\t\t}\n\n\t\tfor (const symbol of row.source.surface()) {\n\t\t\tif (symbol.keyword !== 'interface' && symbol.keyword !== 'class') continue\n\t\t\t// A barrel exports a class and an interface of one name only as a declaration merge,\n\t\t\t// because two modules exporting the name would conflict, so the class answers for it.\n\t\t\tif (symbol.keyword === 'interface' && classes.has(symbol.name)) continue\n\t\t\tconst members = row.source.methods(symbol.name).map((entry) => entry.name)\n\t\t\tif (members.length === 0) continue\n\t\t\tconst contract = `${symbol.name}Interface`\n\t\t\tconst implementing = symbol.keyword === 'class' && declared.has(contract)\n\t\t\tif (implementing) {\n\t\t\t\tconst finding = compareMembership(\n\t\t\t\t\trow.entry.spec,\n\t\t\t\t\tsymbol.name,\n\t\t\t\t\trow.source.methods(contract).map((entry) => entry.name),\n\t\t\t\t\tmembers,\n\t\t\t\t)\n\t\t\t\tif (finding !== undefined) findings.push(finding)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (documented.includes(symbol.name)) continue\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} ${symbol.name} declares members and carries no method table.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectLinks(row: ParityRow, links: ParityFinding[], tests: ParityFinding[]): void {\n\t\tif (row.guide.links().length === 0) {\n\t\t\tlinks.push({ spec: row.entry.spec, text: `${row.entry.spec} has no links.` })\n\t\t}\n\t\tfor (const href of row.guide.links()) {\n\t\t\tif (isExternalLink(href)) continue\n\t\t\tconst path = resolveLink(row.entry.spec, href)\n\t\t\tif (row.source.exists(path)) continue\n\t\t\tlinks.push({ spec: row.entry.spec, text: `${row.entry.spec} has a broken link: ${href}.` })\n\t\t}\n\t\tif (row.guide.tests().length === 0) {\n\t\t\ttests.push({ spec: row.entry.spec, text: `${row.entry.spec} has no test links.` })\n\t\t}\n\t\tfor (const href of row.guide.tests()) {\n\t\t\tconst path = resolveLink(row.entry.spec, href)\n\t\t\tif (row.source.exists(path)) continue\n\t\t\ttests.push({ spec: row.entry.spec, text: `${row.entry.spec} has a missing test: ${href}.` })\n\t\t}\n\t}\n\n\t#inspectFences(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const fence of findUnlisted(row.guide.fences(), this.#options.languages)) {\n\t\t\tfindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has an unlisted fence language under ${fence.title ?? 'no heading'}: ${fence.language ?? 'absent'}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectExamples(\n\t\trow: ParityRow,\n\t\tfencesFindings: ParityFinding[],\n\t\tfunctionFindings: ParityFinding[],\n\t\tmethodFindings: ParityFinding[],\n\t\ttitleFindings: ParityFinding[],\n\t): void {\n\t\tconst fences = row.guide\n\t\t\t.fences()\n\t\t\t.filter((fence) => fence.language === this.#options.language)\n\t\t\t.map((fence) => fence.code)\n\t\tif (fences.length === 0) {\n\t\t\tfencesFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no ${this.#options.language} example fence.`,\n\t\t\t})\n\t\t}\n\t\tconst functions = row.guide\n\t\t\t.surface()\n\t\t\t.filter((symbol) => symbol.keyword === 'function')\n\t\t\t.map((symbol) => symbol.name)\n\t\tfor (const name of findUnexampled(\n\t\t\tfunctions,\n\t\t\tfences,\n\t\t\trow.source.examples().map((example) => example.name),\n\t\t)) {\n\t\t\tfunctionFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no example for ${name}.`,\n\t\t\t})\n\t\t}\n\n\t\tfor (const group of row.guide.methods()) {\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tconst examples = row.source.examples(group.interface).map((example) => example.name)\n\t\t\tif (entity !== group.interface) {\n\t\t\t\texamples.push(...row.source.examples(entity).map((example) => example.name))\n\t\t\t}\n\t\t\tfor (const name of findUnexampled(\n\t\t\t\tgroup.methods.map((entry) => entry.name),\n\t\t\t\tfences,\n\t\t\t\texamples,\n\t\t\t)) {\n\t\t\t\tmethodFindings.push({\n\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\ttext: `${row.entry.spec} has no example for ${group.interface}.${name}.`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst guide = row.guide\n\t\t\t.fences()\n\t\t\t.map((fence) => fence.title)\n\t\t\t.filter(isNonEmptyString)\n\t\tconst source = row.source\n\t\t\t.examples()\n\t\t\t.map((example) => example.title)\n\t\t\t.filter(isNonEmptyString)\n\t\tif (!guide.some((title) => source.includes(title))) {\n\t\t\ttitleFindings.push({\n\t\t\t\tspec: row.entry.spec,\n\t\t\t\ttext: `${row.entry.spec} has no top-level example-title pair: guide ${JSON.stringify(guide)} source ${JSON.stringify(source)}.`,\n\t\t\t})\n\t\t}\n\t}\n\n\t#inspectImports(row: ParityRow, findings: ParityFinding[]): void {\n\t\tconst sources = new SourceManager({\n\t\t\tfiles: this.#options.files,\n\t\t\tmodules: this.#options.modules,\n\t\t})\n\t\tlet compared = false\n\t\tfor (const fence of row.guide.fences()) {\n\t\t\tif (fence.language !== this.#options.language) continue\n\t\t\tfor (const imported of extractFenceImports(fence.code)) {\n\t\t\t\tconst source = sources.source(imported.specifier)\n\t\t\t\tif (source === undefined) continue\n\t\t\t\tcompared = true\n\t\t\t\tconst surface = source.surface().map((symbol) => symbol.name)\n\t\t\t\tfor (const name of findMissing(imported.names, surface)) {\n\t\t\t\t\tfindings.push({\n\t\t\t\t\t\tspec: row.entry.spec,\n\t\t\t\t\t\ttext: `${row.entry.spec} imports missing ${name} from ${imported.specifier}.`,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!compared) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: `${row.entry.spec} has no mapped self import.` })\n\t\t}\n\t}\n\n\t#inspectDrift(row: ParityRow, findings: ParityFinding[]): void {\n\t\tfor (const drift of findDrift(row.guide, row.source)) {\n\t\t\tfindings.push({ spec: row.entry.spec, text: formatDrift(drift) })\n\t\t}\n\t}\n\n\t#inspectPitch(findings: ParityFinding[]): void {\n\t\tconst pitch = this.#options.pitch\n\t\tif (pitch === undefined) return\n\t\tconst readme = this.#options.files[pitch.readme]\n\t\tconst spec = this.#options.files[pitch.spec]\n\t\tif (readme === undefined) {\n\t\t\tfindings.push({ spec: pitch.readme, text: `${pitch.readme} is absent from the inventory.` })\n\t\t\treturn\n\t\t}\n\t\tif (spec === undefined) {\n\t\t\tfindings.push({ spec: pitch.spec, text: `${pitch.spec} is absent from the inventory.` })\n\t\t\treturn\n\t\t}\n\t\tconst left = new Guide(readme).tagline()\n\t\tconst right = new Guide(spec).tagline()\n\t\tif (left !== undefined && left === right) return\n\t\tfindings.push({\n\t\t\tspec: pitch.spec,\n\t\t\ttext: `${pitch.spec} pitch: README ${formatSide(left)} guide ${formatSide(right)}.`,\n\t\t})\n\t}\n\n\t#rewriteGuide(row: ParityRow, drift: Drift, files: Map<string, string>): string | undefined {\n\t\tif (drift.source === undefined) return 'source authority is absent'\n\t\tconst current = files.get(row.entry.spec)\n\t\tif (current === undefined) return 'the guide inventory text is absent'\n\n\t\tif (drift.category === 'summary') {\n\t\t\tconst replacement = replaceCell(current, drift.key, drift.source)\n\t\t\tif (replacement === undefined)\n\t\t\t\treturn 'the guide summary cell or its provenance is unavailable'\n\t\t\tfiles.set(row.entry.spec, replacement)\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst example = collectTitles(row.guide, row.source).get(drift.key)\n\t\tif (example === undefined) return 'the paired source example is unavailable'\n\t\tconst replacement = replaceFence(current, drift.key, example)\n\t\tif (replacement === undefined) return 'the titled guide fence or its provenance is unavailable'\n\t\tfiles.set(row.entry.spec, replacement)\n\t\treturn undefined\n\t}\n\n\t#rewriteSource(row: ParityRow, drift: Drift, files: Map<string, string>): string | undefined {\n\t\tif (drift.guide === undefined) return 'guide authority is absent'\n\t\tif (drift.category === 'summary') {\n\t\t\tconst located = this.#locateSource(row.entry, drift.key, files)\n\t\t\tif (located === undefined) return 'the source doc block or its provenance is unavailable'\n\t\t\tconst comment = located.text.slice(located.span.start, located.span.end)\n\t\t\tconst replacement = replaceSummary(comment, drift.guide)\n\t\t\tif (replacement === undefined) return 'the source summary cannot be represented safely'\n\t\t\tfiles.set(located.path, spliceSpan(located.text, located.span, replacement))\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst fence = row.guide.fences().find((entry) => entry.title === drift.key)\n\t\tconst located = this.#locateExample(row, drift.key, files)\n\t\tif (fence === undefined || located === undefined) {\n\t\t\treturn 'the paired source example or its provenance is unavailable'\n\t\t}\n\t\tconst comment = located.text.slice(located.span.start, located.span.end)\n\t\tconst example: SourceExample = {\n\t\t\tname: located.example.name,\n\t\t\ttitle: drift.key,\n\t\t\tcode: fence.code,\n\t\t\t...(fence.language === undefined ? {} : { language: fence.language }),\n\t\t}\n\t\tconst replacement = replaceExample(comment, example)\n\t\tif (replacement === undefined) return 'the guide example cannot be represented safely'\n\t\tfiles.set(located.path, spliceSpan(located.text, located.span, replacement))\n\t\treturn undefined\n\t}\n\n\t#locateSource(\n\t\tentry: ManifestEntry,\n\t\tkey: string,\n\t\tfiles: ReadonlyMap<string, string>,\n\t): { readonly path: string; readonly text: string; readonly span: MarkdownSpan } | undefined {\n\t\tconst inventory = Object.fromEntries(files)\n\t\tfor (const path of selectModuleKeys(inventory, normalizeDirectories(entry.source))) {\n\t\t\tconst text = files.get(path)\n\t\t\tif (text === undefined) continue\n\t\t\tconst span = locateComment(text, key)\n\t\t\tif (span !== undefined) return { path, text, span }\n\t\t}\n\t\treturn undefined\n\t}\n\n\t#locateExample(\n\t\trow: ParityRow,\n\t\ttitle: string,\n\t\tfiles: ReadonlyMap<string, string>,\n\t):\n\t\t| {\n\t\t\t\treadonly path: string\n\t\t\t\treadonly text: string\n\t\t\t\treadonly span: MarkdownSpan\n\t\t\t\treadonly example: SourceExample\n\t\t }\n\t\t| undefined {\n\t\tconst target = collectTitles(row.guide, row.source).get(title)\n\t\tif (target === undefined) return undefined\n\t\tconst keys: string[] = []\n\t\tfor (const symbol of row.source.exports()) {\n\t\t\tif (symbol.name === target.name) keys.push(computeSymbolKey(symbol))\n\t\t}\n\t\tfor (const owner of row.guide.surface()) {\n\t\t\tif (owner.keyword !== 'class' && owner.keyword !== 'interface') continue\n\t\t\tconst matched = row.source\n\t\t\t\t.examples(owner.name)\n\t\t\t\t.some((example) => example.name === target.name && example.title === title)\n\t\t\tif (matched) keys.push(`${owner.name}.${target.name}`)\n\t\t}\n\n\t\tconst inventory = Object.fromEntries(files)\n\t\tfor (const path of selectModuleKeys(inventory, normalizeDirectories(row.entry.source))) {\n\t\t\tconst text = files.get(path)\n\t\t\tif (text === undefined) continue\n\t\t\tlet selected: { readonly span: MarkdownSpan; readonly example: SourceExample } | undefined\n\t\t\tfor (const key of keys) {\n\t\t\t\tconst span = locateComment(text, key)\n\t\t\t\tif (span === undefined) continue\n\t\t\t\tconst comment = normalizeComment(text.slice(span.start, span.end))\n\t\t\t\tconst example = collectExamples(comment, target.name).find((entry) => entry.title === title)\n\t\t\t\tif (example === undefined) continue\n\t\t\t\tif (selected === undefined || span.start < selected.span.start) selected = { span, example }\n\t\t\t}\n\t\t\tif (selected !== undefined) return { path, text, ...selected }\n\t\t}\n\t\treturn undefined\n\t}\n}\n","import type { ManifestEntry } from './types.js'\nimport { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { isEmptyString, isNonEmptyArray } from '@orkestrel/contract'\nimport { MANIFEST } from './constants.js'\nimport {\n\textractCellLinks,\n\tnormalizeDirectories,\n\tresolvePath,\n\tselectSectionBlocks,\n} from './helpers.js'\n\n/**\n * Parses a `## By concept` manifest table into its {@link ManifestEntry} rows —\n * each row's Concept cell (flattened text), Spec / Tests cells (a single link\n * href, resolved against `directory`), and Source cell (every link href,\n * resolved against `directory`; Source links canonicalize through\n * {@link normalizeDirectories}, one directory collapses to a `string`, and several become\n * a `readonly string[]`). A row missing a concept, spec link, tests link, or\n * source link is skipped as malformed.\n *\n * @param markdown - The manifest markdown source, for example the content of `guides/README.md`\n * @param directory - The root-relative directory containing the manifest\n * @returns The manifest's entries, in row order\n *\n * @example\n * ```ts\n * parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]\n * ```\n */\nexport function parseManifest(markdown: string, directory: string): readonly ManifestEntry[] {\n\tconst document = createMarkdown(markdown).document\n\tconst entries: ManifestEntry[] = []\n\n\tfor (const block of selectSectionBlocks(document, MANIFEST)) {\n\t\tif (!isTableNode(block)) continue\n\n\t\tfor (const row of block.rows) {\n\t\t\tconst conceptCell = row[0]\n\t\t\tconst specCell = row[1]\n\t\t\tconst sourceCell = row[2]\n\t\t\tconst testsCell = row[3]\n\t\t\tif (\n\t\t\t\tconceptCell === undefined ||\n\t\t\t\tspecCell === undefined ||\n\t\t\t\tsourceCell === undefined ||\n\t\t\t\ttestsCell === undefined\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst concept = flattenText({ element: 'paragraph', children: conceptCell }).trim()\n\t\t\tif (isEmptyString(concept)) continue\n\n\t\t\tconst specHref = extractCellLinks(specCell)[0]\n\t\t\tconst testsHref = extractCellLinks(testsCell)[0]\n\t\t\tif (specHref === undefined || testsHref === undefined) continue\n\n\t\t\tconst sourceHrefs = normalizeDirectories(\n\t\t\t\textractCellLinks(sourceCell).map((href) => resolvePath(directory, href)),\n\t\t\t)\n\t\t\tif (!isNonEmptyArray<string>(sourceHrefs)) continue\n\t\t\tconst [firstSource] = sourceHrefs\n\t\t\tconst source = sourceHrefs.length === 1 ? firstSource : sourceHrefs\n\n\t\t\tentries.push({\n\t\t\t\tconcept,\n\t\t\t\tspec: resolvePath(directory, specHref),\n\t\t\t\tsource,\n\t\t\t\ttests: resolvePath(directory, testsHref),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn entries\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '../core/types.js'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { Parity } from '../core/Parity.js'\nimport { parseManifest } from '../core/parsers.js'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport {\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t#createOptions(): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\treturn {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst options = this.#createOptions()\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions()\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions()\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;AACA,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;AAG5B,IAAa,cAAc;;;;;;;;;;;;;;ACM3B,SAAgB,mBAAmB,SAAgC;CAClE,MAAM,OAAO,QAAQ;CAErB,OAAO,GADQ,SAAS,KAAA,KAAa,QAAQ,KAAK,WAAW,IAAI,IAAI,KAAK,GAAG,KAAK,KAC/D,QAAQ;AAC5B;;;;;;;;;;;;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