@orkestrel/guide 0.0.11 → 0.0.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orkestrel/guide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Guides-parity test helpers — prove a package's guides are in bijection with the code they document: surface and methods bijection, link integrity, and non-vacuous extraction, built on @orkestrel/markdown. Part of the @orkestrel line.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bijection",
|
|
@@ -67,12 +67,13 @@
|
|
|
67
67
|
"prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@orkestrel/contract": "^0.0.
|
|
71
|
-
"@orkestrel/markdown": "^0.0.
|
|
70
|
+
"@orkestrel/contract": "^0.0.12",
|
|
71
|
+
"@orkestrel/markdown": "^0.0.9"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@microsoft/api-extractor": "^7.58.12",
|
|
75
|
-
"@orkestrel/scaffold": "^0.0.
|
|
75
|
+
"@orkestrel/scaffold": "^0.0.38",
|
|
76
|
+
"@orkestrel/test": "^0.0.6",
|
|
76
77
|
"@types/node": "^26.1.2",
|
|
77
78
|
"@vitest/browser-playwright": "^4.1.10",
|
|
78
79
|
"oxfmt": "^0.62.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["#sections","#surface","#methods","#links","#tests","#fences","#files","#directories","#exports","#scanSymbols","#surface","#scanSurface","#declarationBody","#hidden","#examples","#scanExamples","#exampleMembers","#collectSurface","#files","#modules","#sources"],"sources":["../../../src/core/constants.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts","../../../src/core/parsers.ts","../../../src/core/shapers.ts","../../../src/core/Guide.ts","../../../src/core/sources/Source.ts","../../../src/core/sources/SourceManager.ts","../../../src/core/factories.ts"],"sourcesContent":["/**\n * The `## Surface` heading text a guide's documented exports section is keyed on.\n */\nexport const SURFACE: string = 'Surface'\n\n/**\n * The `## Methods` heading text a guide's documented interface-methods section is keyed on.\n */\nexport const METHODS: string = 'Methods'\n\n/**\n * The `## Tests` heading text a guide's documented test-link section is keyed on.\n */\nexport const TESTS: string = 'Tests'\n\n/**\n * The `## By concept` heading text the manifest's run-map table is keyed on.\n */\nexport const MANIFEST: string = 'By concept'\n\n/**\n * 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 { ExportKind, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js'\nimport { arrayOf, isString, literalOf, recordOf, unionOf } from '@orkestrel/contract'\n\n// AGENTS section 14: 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 * Whether `value` is one of the five documented {@link ExportKind} literals — the\n * guard behind extracting a Surface table's `Kind` cell into a typed symbol.\n *\n * @param value - The candidate value\n * @returns `true` when `value` is a valid {@link ExportKind}\n *\n * @example\n * ```ts\n * isExportKind('class') // true\n * isExportKind('enum') // false\n * ```\n */\nexport const isExportKind: Guard<ExportKind> = literalOf(\n\t'type',\n\t'interface',\n\t'const',\n\t'function',\n\t'class',\n)\n\n/**\n * Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string\n * paired with a valid {@link ExportKind}.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link SurfaceSymbol}\n *\n * @example\n * ```ts\n * isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true\n * isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false\n * ```\n */\nexport const isSurfaceSymbol: Guard<SurfaceSymbol> = recordOf({\n\tname: isString,\n\tkind: isExportKind,\n})\n\n/**\n * Whether `value` is a well-formed {@link MethodGroup} — a backticked\n * `interface` name paired with its documented `methods`.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link MethodGroup}\n *\n * @example\n * ```ts\n * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false\n * ```\n */\nexport const isMethodGroup: Guard<MethodGroup> = recordOf({\n\tinterface: isString,\n\tmethods: arrayOf(isString),\n})\n\n/**\n * Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`\n * manifest row, its `source` accepting either a single directory or several.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link ManifestEntry}\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 { BlockNode, InlineNode, MarkdownDocument, TableNode } from '@orkestrel/markdown'\nimport {\n\tflattenText,\n\tisCodeBlockNode,\n\tisCodeSpanNode,\n\tisEmphasisNode,\n\tisHeadingNode,\n\tisImageNode,\n\tisLinkNode,\n\tisTableNode,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport { isNonEmptyString } from '@orkestrel/contract'\nimport type {\n\tDeclarationHead,\n\tGuideFence,\n\tGuideModule,\n\tMethodGroup,\n\tSourceLine,\n\tSurfaceSymbol,\n} from './types.js'\nimport { EXTERNAL_SCHEMES, METHODS, SURFACE, TESTS } from './constants.js'\nimport { isExportKind } from './validators.js'\n\n/**\n * Extract 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\n * ```ts\n * extractSourceLines('export const visible = true // note\\n')\n * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }, ...]\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 * 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` when every segment is canonical\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 * A module scope normalized 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 typeof module === 'string' ? [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 * 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 * moduleKey(['src/core', 'src/browser']) // 'src/core\\0src/browser'\n * ```\n */\nexport function moduleKey(module: GuideModule): string {\n\treturn normalizeDirectories(module).join('\\0')\n}\n\n/**\n * 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 * The bijection key for a surface symbol — its kind and name combined — so a\n * symbol-set comparison diffs (name, kind) pairs rather than names alone.\n *\n * @param symbol - The symbol to key\n * @returns The `${kind} ${name}` key\n *\n * @example\n * ```ts\n * symbolKey({ name: 'Markdown', kind: 'class' }) // 'class Markdown'\n * ```\n */\nexport function symbolKey(symbol: SurfaceSymbol): string {\n\treturn `${symbol.kind} ${symbol.name}`\n}\n\n/**\n * 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 * 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 * The symbol-key set-difference between two symbol lists — `symbols` present but\n * absent from `source`, compared by {@link symbolKey} so a symbol can drift in\n * neither name nor kind.\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 * missingSymbols([{ name: 'X', kind: 'class' }], []) // ['class X']\n * ```\n */\nexport function missingSymbols(\n\tsymbols: readonly SurfaceSymbol[],\n\tsource: readonly SurfaceSymbol[],\n): readonly string[] {\n\treturn findMissing(symbols.map(symbolKey), source.map(symbolKey))\n}\n\n/**\n * 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${name}\\\\b`)\n\t\treturn !fences.some((fence) => boundary.test(fence))\n\t})\n}\n\n/**\n * Parse a fence's `import` statements into per-specifier imported identifier\n * names — handles `import type`, mixed multiline braces, and `x as y` aliases\n * (resolved to the local name `x`... the ORIGINAL exported name, since it is\n * the export that must exist in the checked public/barrel surface).\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 * fenceImports(\"import { a, b as c } from 'x'\\n\") // [{ specifier: 'x', names: ['a', 'b'] }]\n * ```\n */\nexport function fenceImports(\n\tfence: string,\n): ReadonlyArray<{ specifier: string; names: readonly string[] }> {\n\tconst results: Array<{ specifier: string; names: readonly string[] }> = []\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 * Whether a link `href` should be skipped by the guides-parity link checks — an\n * external scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.\n *\n * @param href - The link destination\n * @returns `true` when the link should not be resolved against the filesystem\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 * Resolve 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 * Resolve 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 * The first code-span value found 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 * firstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'\n * ```\n */\nexport function firstCode(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 = firstCode(node.children)\n\t\t\tif (value !== undefined) return value\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * The link hrefs found within one table cell's inline content.\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 * cellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']\n * ```\n */\nexport function cellLinks(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 * 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 * identifierOf('MarkdownHandler<TNode, T>') // 'MarkdownHandler'\n * identifierOf('fold') // 'fold'\n * ```\n */\nexport function identifierOf(code: string): string {\n\tconst index = code.indexOf('<')\n\treturn (index < 0 ? code : code.slice(0, index)).trim()\n}\n\n/**\n * The index of a table's `Kind` column, found by its header text so it survives\n * column reordering. The match is exact and case-sensitive (`'Kind'`) — a table\n * without that exact header contributes no symbols to the surface it feeds.\n *\n * @param table - The table to inspect\n * @returns The `Kind` column's index, or `undefined` when the table has no `Kind` header\n *\n * @example\n * ```ts\n * kindIndex(table) // 1, or undefined\n * ```\n */\nexport function kindIndex(table: TableNode): 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() === 'Kind'\n\t\t) {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * The module-scope exports declared in one file's source text — matches\n * `export (async)? (function(\\*)?|class|const|interface|type) Name`, deduped\n * by (kind, name). A generator export (`export function* walk`) scans as kind\n * `function` — its trailing `*` is stripped before the {@link ExportKind} check.\n * Scanning uses {@link extractSourceLines}, so comment and template payload is\n * excluded while its uninterrupted column-zero head remains required; preserved\n * columns do not grant membership to leading/interrupted comment forms. The population is\n * exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is\n * outside 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 * exportsFrom('export class Markdown {}\\n') // [{ name: 'Markdown', kind: 'class' }]\n * exportsFrom('export function* walk() {}\\n') // [{ name: 'walk', kind: 'function' }]\n * ```\n */\nexport function exportsFrom(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractSourceLines(source)) {\n\t\tconst match = line.code.match(\n\t\t\t/^export (?:async )?(function\\*?|class|const|interface|type) (\\w+)/,\n\t\t)\n\t\tconst rawKind = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst kind = rawKind === undefined ? undefined : rawKind.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(kind) || !isNonEmptyString(name) || !isExportKind(kind)) continue\n\n\t\tconst key = `${kind} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tsymbols.push({ name, kind })\n\t}\n\n\treturn symbols\n}\n\n/**\n * The module-scope declarations LACKING the `export` keyword in one file's\n * source text — the mirror image of {@link exportsFrom}'s grammar, anchored\n * the same way (column 0, so an indented inner declaration never matches).\n * Scans only the five {@link ExportKind} keywords (`function` / `class` /\n * `const` / `interface` / `type`) — a module-scope `let` or `var` is a\n * different violation class (AGENTS §1 bans `var`; a bare `let` is not a\n * declaration kind this scanner's five-kind grammar covers) and is out of\n * this check's contract. Scanning uses {@link extractSourceLines}, so comment\n * and template payload is excluded while its uninterrupted column-zero head\n * remains required; preserved columns do not widen membership. `enum` is likewise outside this reflection population, not\n * 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 * hiddenFrom('function secretHelper() {}\\n') // [{ name: 'secretHelper', kind: 'function' }]\n * hiddenFrom('export class X {}\\n') // []\n * ```\n */\nexport function hiddenFrom(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractSourceLines(source)) {\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 rawKind = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst kind = rawKind === undefined ? undefined : rawKind.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(kind) || !isNonEmptyString(name) || !isExportKind(kind)) continue\n\n\t\tconst key = `${kind} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tsymbols.push({ name, kind })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Join the declaration head starting at `start` into one space-separated\n * line, consuming lines until the first that ends with `{`.\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 * ```\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\tparts.push(index === start ? line.trimEnd() : line.trim())\n\t\tif (line.trimEnd().endsWith('{')) return { text: parts.join(' '), end: index }\n\t}\n\n\treturn undefined\n}\n\n/**\n * The body lines of the named `export class` / `export interface` declaration\n * within one file's source text — everything between a projected real head and\n * projected column-0 closing `}`. Structural eligibility is projected while the\n * corresponding returned body lines remain raw for JSDoc evidence.\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 The declaration's body lines, or an empty array when `source` does not declare it\n *\n * @example\n * ```ts\n * declarationBody('export interface X {\\n\\twalk(): void\\n}\\n', 'interface', 'X') // ['\\twalk(): void']\n * ```\n */\nexport function declarationBody(\n\tsource: string,\n\tkeyword: 'class' | 'interface',\n\tname: string,\n): readonly string[] {\n\tconst opener = `export ${keyword} ${name}`\n\tconst declaration = new RegExp(`^export ${keyword} ${name}(?:<.*>)?(?: .*)? \\\\{$`)\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 || !line.startsWith(opener)) continue\n\n\t\tconst head = joinHead(projected, index)\n\t\tif (head === undefined || !declaration.test(head.text)) continue\n\n\t\tfor (let close = head.end + 1; close < projected.length; close += 1) {\n\t\t\tif (projected[close] === '}') {\n\t\t\t\treturn lines.slice(head.end + 1, close).map((record) => record.source)\n\t\t\t}\n\t\t}\n\n\t\t// Unterminated body — keep scanning in case a later match succeeds.\n\t}\n\n\treturn []\n}\n\n/**\n * 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). Matching runs once over projected lines so commented\n * method-like payload never becomes eligible.\n *\n * @param lines - A declaration's body lines\n * @returns The declared method names, deduped and sorted\n *\n * @example\n * ```ts\n * memberMethods(['\\tmap(): void', '\\tfilter(): void']) // ['filter', 'map']\n * ```\n */\nexport function memberMethods(lines: readonly string[]): readonly string[] {\n\tconst methods: string[] = []\n\n\tfor (const line of extractSourceLines(lines.join('\\n'))) {\n\t\tconst method = line.code.match(/^\\t(?:async )?\\*?(\\w+)(<.*>)?\\??\\(/)\n\t\tif (method?.[1] !== undefined) methods.push(method[1])\n\t}\n\n\treturn Array.from(new Set(methods)).sort()\n}\n\n/**\n * 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 (e.g. `Surface`)\n * @returns The blocks belonging to that section, in document order\n *\n * @example\n * ```ts\n * sectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`\n * ```\n */\nexport function sectionBlocks(document: MarkdownDocument, heading: string): 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 * 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)\n * UNION every backticked H3 entity heading in the section\n * (`{name: <codeSpan>, kind: 'class'}`), deduped by {@link symbolKey}. A row with\n * no code-span name, or an unrecognized `Kind` text, is skipped.\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', kind: '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 sectionBlocks(document, SURFACE)) {\n\t\tif (isTableNode(block)) {\n\t\t\tconst column = kindIndex(block)\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst nameCell = row[0]\n\t\t\t\tconst rawName = nameCell === undefined ? undefined : firstCode(nameCell)\n\t\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\t\tif (name === undefined) continue\n\n\t\t\t\tconst kindCell = column === undefined ? undefined : row[column]\n\t\t\t\tconst kindText =\n\t\t\t\t\tkindCell === undefined\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: flattenText({ element: 'paragraph', children: kindCell }).trim()\n\t\t\t\tif (!isExportKind(kindText)) continue\n\n\t\t\t\tconst symbol: SurfaceSymbol = { name, kind: kindText }\n\t\t\t\tconst key = symbolKey(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 = firstCode(block.children)\n\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\tif (name === undefined) continue\n\t\t\tconst symbol: SurfaceSymbol = { name, kind: 'class' }\n\t\t\tconst key = symbolKey(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 * 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.\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: ['walk', ...] }]\n * ```\n */\nexport function extractMethods(document: MarkdownDocument): readonly MethodGroup[] {\n\tconst groups: MethodGroup[] = []\n\tlet current: string | undefined\n\n\tfor (const block of sectionBlocks(document, METHODS)) {\n\t\tif (isHeadingNode(block) && block.level === 4) {\n\t\t\tconst rawInterface = firstCode(block.children)\n\t\t\tcurrent = rawInterface === undefined ? undefined : identifierOf(rawInterface)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isTableNode(block) && current !== undefined) {\n\t\t\tconst methods: string[] = []\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst cell = row[0]\n\t\t\t\tconst rawName = cell === undefined ? undefined : firstCode(cell)\n\t\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\t\tif (name !== undefined) methods.push(name)\n\t\t\t}\n\t\t\tgroups.push({ interface: current, methods })\n\t\t\tcurrent = undefined\n\t\t}\n\t}\n\n\treturn groups\n}\n\n/**\n * 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 * 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 sectionBlocks(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 * Select the next physical record after an eligible genuine JSDoc whose final\n * authoritative span carries an exact block-position `@example` tag. Title\n * text is allowed. A leading whitespace-separated span chain is last-span\n * authoritative; intervening source material severs association, while a\n * leading JSDoc on the next record replaces pending state. Any other next\n * physical record is returned once and consumes it. This parser walks aligned\n * records without rescanning source syntax or applying declaration/member\n * grammar.\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\tconst examples: SourceLine[] = []\n\tlet block = false\n\tlet eligible = false\n\tlet example = false\n\tlet pending = false\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) {\n\t\t\tif (!block && first >= 0 && line.source.slice(0, first).trim() === '') pending = false\n\t\t\telse {\n\t\t\t\texamples.push(line)\n\t\t\t\tpending = false\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\tif (eligible && /^\\s*\\*?\\s*@example(?=\\s|\\*\\/|$)/.test(projection.slice(0, end))) {\n\t\t\t\texample = true\n\t\t\t}\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 && example && whitespace\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\texample = false\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\texample = false\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\tif (eligible && /^\\s*\\*?\\s*@example(?=\\s|\\*\\/|$)/.test(projection.slice(cursor + 3, end))) {\n\t\t\t\texample = true\n\t\t\t}\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 && example && whitespace\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\texample = false\n\t\t\tcursor = opener\n\t\t}\n\t}\n\n\treturn examples\n}\n\n/**\n * The exported functions in one file's source text whose immediately preceding\n * eligible genuine JSDoc block carries `@example`. Shared adjacency comes from\n * {@link extractExampleLines}; exported-function membership is matched against\n * the aligned code projection, so comment and template payload cannot qualify.\n *\n * @param source - The file's source text\n * @returns The exported function names with an `@example`, in file order\n *\n * @example\n * ```ts\n * const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\\n')\n * examplesFrom(block) // ['walk']\n * examplesFrom('export function walk() {}\\n') // []\n * ```\n */\nexport function examplesFrom(source: string): readonly string[] {\n\tconst names: string[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractExampleLines(extractSourceLines(source))) {\n\t\tconst match = line.code.match(/^export (?:async )?function\\*? (\\w+)/)\n\t\tconst name = match?.[1]\n\t\tif (isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tnames.push(name)\n\t\t}\n\t}\n\n\treturn names\n}\n\n/**\n * The callable-member names in a declaration body (per {@link memberMethods}'\n * grammar) whose immediately preceding eligible genuine JSDoc block, within\n * the same body, carries `@example`. Shared adjacency comes from\n * {@link extractExampleLines}; member membership is matched against aligned\n * projected code.\n *\n * @param lines - A declaration's body lines\n * @returns The exemplified member names, deduped and sorted\n *\n * @example\n * ```ts\n * exampleMethods(['\\t/**', '\\t * @example', '\\t *' + '/', '\\twalk(): void']) // ['walk']\n * ```\n */\nexport function exampleMethods(lines: readonly string[]): readonly string[] {\n\tconst methods: string[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractExampleLines(extractSourceLines(lines.join('\\n')))) {\n\t\tconst method = line.code.match(/^\\t(?:async )?\\*?(\\w+)(<.*>)?\\??\\(/)\n\t\tconst name = method?.[1]\n\t\tif (isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tmethods.push(name)\n\t\t}\n\t}\n\n\treturn Array.from(new Set(methods)).sort()\n}\n\n/**\n * Every fenced code block anywhere in the guide document. A full AST walk\n * includes fences nested inside blockquotes and lists.\n *\n * @param document - The parsed guide document\n * @returns Every fence's language and verbatim code, 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\tconst fences: GuideFence[] = []\n\tfor (const node of walkNodes(document)) {\n\t\tif (isCodeBlockNode(node)) fences.push({ language: node.lang, code: node.code })\n\t}\n\treturn fences\n}\n","import { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { isEmptyString, isNonEmptyArray } from '@orkestrel/contract'\nimport type { ManifestEntry } from './types.js'\nimport { MANIFEST } from './constants.js'\nimport { cellLinks, normalizeDirectories, resolvePath, sectionBlocks } from './helpers.js'\n\n/**\n * Parse 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 (e.g. `guides/README.md`'s content)\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 sectionBlocks(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 = cellLinks(specCell)[0]\n\t\t\tconst testsHref = cellLinks(testsCell)[0]\n\t\t\tif (specHref === undefined || testsHref === undefined) continue\n\n\t\t\tconst sourceHrefs = normalizeDirectories(\n\t\t\t\tcellLinks(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 { arrayShape, literalShape, objectShape, stringShape, unionShape } from '@orkestrel/contract'\n\n// AGENTS section 14 / 4.6.1: shapers are `ContractShape` VALUES, not functions\n// or types - a JSON-Schema blueprint the compilers (factories.ts) turn into a\n// guard / parser / schema / generator in lockstep. Every documented data type\n// here is non-recursive, so each shapes directly (no `lazyOf` gate needed).\n\n/**\n * The shape of a {@link SurfaceSymbol} — a documented / exported symbol's\n * `name` paired with its {@link ExportKind}.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { surfaceSymbolShape } from '@orkestrel/guide'\n *\n * const surfaceSymbol = createContract(surfaceSymbolShape)\n * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true\n * ```\n */\nexport const surfaceSymbolShape = objectShape({\n\tname: stringShape(),\n\tkind: literalShape(['type', 'interface', 'const', 'function', 'class']),\n})\n\n/**\n * The shape of a {@link MethodGroup} — a backticked `interface` name paired\n * with its documented `methods`.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { methodGroupShape } from '@orkestrel/guide'\n *\n * const methodGroup = createContract(methodGroupShape)\n * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * ```\n */\nexport const methodGroupShape = objectShape({\n\tinterface: stringShape(),\n\tmethods: arrayShape(stringShape()),\n})\n\n/**\n * The shape of a {@link ManifestEntry} — one `## By concept` manifest row,\n * `source` accepting either a single directory or several.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { manifestEntryShape } from '@orkestrel/guide'\n *\n * const manifestEntry = createContract(manifestEntryShape)\n * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * ```\n */\nexport const manifestEntryShape = objectShape({\n\tconcept: stringShape(),\n\tspec: stringShape(),\n\tsource: unionShape(stringShape(), arrayShape(stringShape())),\n\ttests: stringShape(),\n})\n","import { createMarkdown, flattenText, isHeadingNode } from '@orkestrel/markdown'\nimport type { GuideFence, GuideInterface, MethodGroup, SurfaceSymbol } from './types.js'\nimport {\n\textractFences,\n\textractLinks,\n\textractMethods,\n\textractSurface,\n\textractTests,\n} from './helpers.js'\n\n/**\n * A stateful, structured view over one parsed guide — the six documented\n * projections (`sections` / `surface` / `methods` / `links` / `tests` /\n * `fences`) are extracted once at construction and cached.\n *\n * @remarks\n * Pure: parses `source` once via `@orkestrel/markdown` and never touches the\n * filesystem — `Guide` has no notion of \"where\" the guide came from, only its\n * markdown text. Every accessor returns the same cached, readonly array on\n * 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', kind: 'class' }]\n * ```\n */\nexport class Guide implements GuideInterface {\n\treadonly #sections: readonly string[]\n\treadonly #surface: readonly SurfaceSymbol[]\n\treadonly #methods: readonly MethodGroup[]\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.#surface = extractSurface(document)\n\t\tthis.#methods = extractMethods(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\tsurface(): readonly SurfaceSymbol[] {\n\t\treturn this.#surface\n\t}\n\n\tmethods(): readonly MethodGroup[] {\n\t\treturn this.#methods\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 { SourceInterface, SourceOptions, SurfaceSymbol } from '../types.js'\nimport {\n\tdeclarationBody,\n\texampleMethods,\n\texamplesFrom,\n\texportsFrom,\n\textractSourceLines,\n\thasCanonicalSegments,\n\thiddenFrom,\n\tmemberMethods,\n\tnormalizeDirectories,\n\tresolveLink,\n\tresolvePath,\n\tselectModuleKeys,\n\tsymbolKey,\n} from '../helpers.js'\n\n/**\n * A pure `SourceInterface` — reflects a module scope's intentional direct\n * declarations, conventional barrel-reachable surface, and member methods over\n * a consumer-supplied file inventory, using text-only line scanners rather than\n * the TypeScript compiler API or the 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`. 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. Source projection preserves columns without widening\n * direct/hidden column-zero heads. Literal ECMAScript Unicode identifiers\n * participate in bounded slash-state recognition without escape decoding.\n * Regex recognition is bounded: slash after bare `}` is division, so a\n * 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', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]\n * source.surface() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]\n * source.methods('GuideInterface') // ['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\t#exports: readonly SurfaceSymbol[] | undefined\n\t#surface: readonly SurfaceSymbol[] | undefined\n\t#hidden: readonly SurfaceSymbol[] | undefined\n\t#examples: readonly string[] | 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(exportsFrom)\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\tmethods(name: string): readonly string[] {\n\t\tconst interfaceBody = this.#declarationBody('interface', name)\n\t\tif (interfaceBody.length > 0) return memberMethods(interfaceBody)\n\n\t\tconst classBody = this.#declarationBody('class', name)\n\t\treturn memberMethods(classBody).filter((method) => method !== 'constructor')\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(hiddenFrom)\n\t\treturn this.#hidden\n\t}\n\n\texamples(): readonly string[]\n\texamples(name: string): readonly string[]\n\texamples(name?: string): readonly string[] {\n\t\tif (name === undefined) {\n\t\t\tif (this.#examples === undefined) this.#examples = this.#scanExamples()\n\t\t\treturn this.#examples\n\t\t}\n\n\t\treturn this.#exampleMembers(name)\n\t}\n\n\t// The union of exported-function `@example` names across the module's\n\t// files, deduped in first-seen order — mirrors `#scanSymbols`, but over a\n\t// plain string scanner (`examplesFrom`) rather than a `SurfaceSymbol` one.\n\t#scanExamples(): readonly string[] {\n\t\tconst names: string[] = []\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 name of examplesFrom(text)) {\n\t\t\t\tif (seen.has(name)) continue\n\t\t\t\tseen.add(name)\n\t\t\t\tnames.push(name)\n\t\t\t}\n\t\t}\n\n\t\treturn names\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 exportsFrom(text)) {\n\t\t\t\tconst identity = symbolKey(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`-carrying members of the interface-or-class declaration\n\t// body named `name`, unioning both shapes (an implementer may carry its\n\t// own `@example` a documented interface member does not, or vice versa).\n\t#exampleMembers(name: string): readonly string[] {\n\t\tconst interfaceBody = this.#declarationBody('interface', name)\n\t\tconst classBody = this.#declarationBody('class', name)\n\t\tconst members = new Set<string>([\n\t\t\t...exampleMethods(interfaceBody),\n\t\t\t...exampleMethods(classBody),\n\t\t])\n\t\treturn Array.from(members).sort()\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 = symbolKey(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 first non-empty declaration body found across the module scope's\n\t// files, searched in sorted file order until one file declares `name`.\n\t#declarationBody(keyword: 'class' | 'interface', name: string): readonly string[] {\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\tconst body = declarationBody(text, keyword, name)\n\t\t\tif (body.length > 0) return body\n\t\t}\n\n\t\treturn []\n\t}\n}\n","import type { SourceInterface, SourceManagerInterface, SourceManagerOptions } from '../types.js'\nimport { moduleKey } 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 *\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 * ```\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 = moduleKey(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","import type { ContractInterface } from '@orkestrel/contract'\nimport type {\n\tGuideInterface,\n\tManifestEntry,\n\tMethodGroup,\n\tSourceInterface,\n\tSourceManagerInterface,\n\tSourceManagerOptions,\n\tSourceOptions,\n\tSurfaceSymbol,\n} from './types.js'\nimport { createContract } from '@orkestrel/contract'\nimport { Guide } from './Guide.js'\nimport { manifestEntryShape, methodGroupShape, surfaceSymbolShape } from './shapers.js'\nimport { Source } from './sources/Source.js'\nimport { SourceManager } from './sources/SourceManager.js'\n\n/**\n * Create a structured {@link GuideInterface} view over one guide's markdown\n * source — parses once and caches its `sections` / `surface` / `methods` /\n * `links` / `tests` / `fences` projections.\n *\n * @param source - The guide's markdown source text\n * @returns A working {@link GuideInterface}\n *\n * @example\n * ```ts\n * import { createGuide } from '@orkestrel/guide'\n *\n * const guide = createGuide('## Surface\\n\\n| Name | Kind |\\n| --- | --- |\\n| `X` | class |')\n * guide.surface() // [{ name: 'X', kind: 'class' }]\n * ```\n */\nexport function createGuide(source: string): GuideInterface {\n\treturn new Guide(source)\n}\n\n/**\n * Create a pure {@link SourceInterface} over a consumer-supplied file\n * inventory — see {@link Source}.\n *\n * @param options - The file inventory and module scope to reflect\n * @returns A `SourceInterface` reflecting the given module scope\n *\n * @example\n * ```ts\n * import { createSource } from '@orkestrel/guide'\n *\n * const source = createSource({\n * \tfiles: { 'src/core/Guide.ts': 'export class Guide {}\\n' },\n * \tmodule: 'src/core',\n * })\n * source.exports() // [{ name: 'Guide', kind: 'class' }]\n * ```\n */\nexport function createSource(options: SourceOptions): SourceInterface {\n\treturn new Source(options)\n}\n\n/**\n * Create a {@link SourceManagerInterface} that resolves the consumer's local\n * import specifiers and shares one source view per module.\n *\n * @param options - The shared file inventory and specifier-to-module policy\n * @returns A source manager over the supplied policy\n *\n * @example\n * ```ts\n * import { createSourceManager } from '@orkestrel/guide'\n *\n * const sources = createSourceManager({\n * \tfiles: { 'src/core/index.ts': \"export * from './types.js'\" },\n * \tmodules: { '@scope/package': 'src/core' },\n * })\n * sources.source('@scope/package')?.surface()\n * ```\n */\nexport function createSourceManager(options: SourceManagerOptions): SourceManagerInterface {\n\treturn new SourceManager(options)\n}\n\n/**\n * Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for\n * {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `SurfaceSymbol` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createSurfaceSymbolContract } from '@orkestrel/guide'\n *\n * const surfaceSymbol = createSurfaceSymbolContract()\n * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true\n * ```\n */\nexport function createSurfaceSymbolContract(): ContractInterface<SurfaceSymbol> {\n\treturn createContract(surfaceSymbolShape)\n}\n\n/**\n * Compile the {@link methodGroupShape} into a {@link ContractInterface} for\n * {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `MethodGroup` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createMethodGroupContract } from '@orkestrel/guide'\n *\n * const methodGroup = createMethodGroupContract()\n * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * ```\n */\nexport function createMethodGroupContract(): ContractInterface<MethodGroup> {\n\treturn createContract(methodGroupShape)\n}\n\n/**\n * Compile the {@link manifestEntryShape} into a {@link ContractInterface} for\n * {@link ManifestEntry} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `ManifestEntry` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createManifestEntryContract } from '@orkestrel/guide'\n *\n * const manifestEntry = createManifestEntryContract()\n * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * ```\n */\nexport function createManifestEntryContract(): ContractInterface<ManifestEntry> {\n\treturn createContract(manifestEntryShape)\n}\n"],"mappings":";;;;;;;AAGA,IAAa,UAAkB;;;;AAK/B,IAAa,UAAkB;;;;AAK/B,IAAa,QAAgB;;;;AAK7B,IAAa,WAAmB;;;;;;AAOhC,IAAa,mBAAsC,OAAO,OAAO;CAChE;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;ACRD,IAAa,gBAAA,GAAkC,oBAAA,UAAA,CAC9C,QACA,aACA,SACA,YACA,OACD;;;;;;;;;;;;;;AAeA,IAAa,mBAAA,GAAwC,oBAAA,SAAA,CAAS;CAC7D,MAAM,oBAAA;CACN,MAAM;AACP,CAAC;;;;;;;;;;;;;;AAeD,IAAa,iBAAA,GAAoC,oBAAA,SAAA,CAAS;CACzD,WAAW,oBAAA;CACX,UAAA,GAAS,oBAAA,QAAA,CAAQ,oBAAA,QAAQ;AAC1B,CAAC;;;;;;;;;;;;;;AAeD,IAAa,mBAAA,GAAwC,oBAAA,SAAA,CAAS;CAC7D,SAAS,oBAAA;CACT,MAAM,oBAAA;CACN,SAAA,GAAQ,oBAAA,QAAA,CAAQ,oBAAA,WAAA,GAAU,oBAAA,QAAA,CAAQ,oBAAA,QAAQ,CAAC;CAC3C,OAAO,oBAAA;AACR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChCD,SAAgB,mBAAmB,QAAuC;CACzE,MAAM,QAAsB,CAAC;CAC7B,IAA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S,IAAI,GAAG;EACtC,IAAI,aAAa,KAAA,GAAW,OAAO;EAEnC,MAAM,SAAS,IAAI,OAAO;GAAE,OAAO,KAAKF;GAAQ;EAAO,CAAC;EACxD,KAAKE,SAAS,IAAI,KAAK,MAAM;EAC7B,OAAO;CACR;AACD;;;;;;;;;;;;;;;;;;;ACVA,SAAgB,YAAY,QAAgC;CAC3D,OAAO,IAAI,MAAM,MAAM;AACxB;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,aAAa,SAAyC;CACrE,OAAO,IAAI,OAAO,OAAO;AAC1B;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,oBAAoB,SAAuD;CAC1F,OAAO,IAAI,cAAc,OAAO;AACjC;;;;;;;;;;;;;;;;AAiBA,SAAgB,8BAAgE;CAC/E,QAAA,GAAO,oBAAA,eAAA,CAAe,kBAAkB;AACzC;;;;;;;;;;;;;;;;AAiBA,SAAgB,4BAA4D;CAC3E,QAAA,GAAO,oBAAA,eAAA,CAAe,gBAAgB;AACvC;;;;;;;;;;;;;;;;AAiBA,SAAgB,8BAAgE;CAC/E,QAAA,GAAO,oBAAA,eAAA,CAAe,kBAAkB;AACzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["#sections","#surface","#methods","#links","#tests","#fences","#files","#directories","#exports","#scanSymbols","#surface","#scanSurface","#declarationBody","#hidden","#examples","#scanExamples","#exampleMembers","#collectSurface","#files","#modules","#sources"],"sources":["../../../src/core/constants.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts","../../../src/core/parsers.ts","../../../src/core/shapers.ts","../../../src/core/Guide.ts","../../../src/core/sources/Source.ts","../../../src/core/sources/SourceManager.ts","../../../src/core/factories.ts"],"sourcesContent":["/**\n * The `## Surface` heading text a guide's documented exports section is keyed on.\n */\nexport const SURFACE: string = 'Surface'\n\n/**\n * The `## Methods` heading text a guide's documented interface-methods section is keyed on.\n */\nexport const METHODS: string = 'Methods'\n\n/**\n * The `## Tests` heading text a guide's documented test-link section is keyed on.\n */\nexport const TESTS: string = 'Tests'\n\n/**\n * The `## By concept` heading text the manifest's run-map table is keyed on.\n */\nexport const MANIFEST: string = 'By concept'\n\n/**\n * 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 { ExportKind, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js'\nimport { arrayOf, isString, literalOf, recordOf, unionOf } from '@orkestrel/contract'\n\n// AGENTS section 14: 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 * Whether `value` is one of the five documented {@link ExportKind} literals — the\n * guard behind extracting a Surface table's `Kind` cell into a typed symbol.\n *\n * @param value - The candidate value\n * @returns `true` when `value` is a valid {@link ExportKind}\n *\n * @example\n * ```ts\n * isExportKind('class') // true\n * isExportKind('enum') // false\n * ```\n */\nexport const isExportKind: Guard<ExportKind> = literalOf(\n\t'type',\n\t'interface',\n\t'const',\n\t'function',\n\t'class',\n)\n\n/**\n * Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string\n * paired with a valid {@link ExportKind}.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link SurfaceSymbol}\n *\n * @example\n * ```ts\n * isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true\n * isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false\n * ```\n */\nexport const isSurfaceSymbol: Guard<SurfaceSymbol> = recordOf({\n\tname: isString,\n\tkind: isExportKind,\n})\n\n/**\n * Whether `value` is a well-formed {@link MethodGroup} — a backticked\n * `interface` name paired with its documented `methods`.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link MethodGroup}\n *\n * @example\n * ```ts\n * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false\n * ```\n */\nexport const isMethodGroup: Guard<MethodGroup> = recordOf({\n\tinterface: isString,\n\tmethods: arrayOf(isString),\n})\n\n/**\n * Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`\n * manifest row, its `source` accepting either a single directory or several.\n *\n * @param value - The value to test\n * @returns `true` when `value` is a well-formed {@link ManifestEntry}\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 { BlockNode, InlineNode, MarkdownDocument, TableNode } from '@orkestrel/markdown'\nimport {\n\tflattenText,\n\tisCodeBlockNode,\n\tisCodeSpanNode,\n\tisEmphasisNode,\n\tisHeadingNode,\n\tisImageNode,\n\tisLinkNode,\n\tisTableNode,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport { isNonEmptyString } from '@orkestrel/contract'\nimport type {\n\tDeclarationHead,\n\tGuideFence,\n\tGuideModule,\n\tMethodGroup,\n\tSourceLine,\n\tSurfaceSymbol,\n} from './types.js'\nimport { EXTERNAL_SCHEMES, METHODS, SURFACE, TESTS } from './constants.js'\nimport { isExportKind } from './validators.js'\n\n/**\n * Extract 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\n * ```ts\n * extractSourceLines('export const visible = true // note\\n')\n * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }, ...]\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 * 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` when every segment is canonical\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 * A module scope normalized 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 typeof module === 'string' ? [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 * 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 * moduleKey(['src/core', 'src/browser']) // 'src/core\\0src/browser'\n * ```\n */\nexport function moduleKey(module: GuideModule): string {\n\treturn normalizeDirectories(module).join('\\0')\n}\n\n/**\n * 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 * The bijection key for a surface symbol — its kind and name combined — so a\n * symbol-set comparison diffs (name, kind) pairs rather than names alone.\n *\n * @param symbol - The symbol to key\n * @returns The `${kind} ${name}` key\n *\n * @example\n * ```ts\n * symbolKey({ name: 'Markdown', kind: 'class' }) // 'class Markdown'\n * ```\n */\nexport function symbolKey(symbol: SurfaceSymbol): string {\n\treturn `${symbol.kind} ${symbol.name}`\n}\n\n/**\n * 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 * 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 * The symbol-key set-difference between two symbol lists — `symbols` present but\n * absent from `source`, compared by {@link symbolKey} so a symbol can drift in\n * neither name nor kind.\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 * missingSymbols([{ name: 'X', kind: 'class' }], []) // ['class X']\n * ```\n */\nexport function missingSymbols(\n\tsymbols: readonly SurfaceSymbol[],\n\tsource: readonly SurfaceSymbol[],\n): readonly string[] {\n\treturn findMissing(symbols.map(symbolKey), source.map(symbolKey))\n}\n\n/**\n * 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${name}\\\\b`)\n\t\treturn !fences.some((fence) => boundary.test(fence))\n\t})\n}\n\n/**\n * Parse a fence's `import` statements into per-specifier imported identifier\n * names — handles `import type`, mixed multiline braces, and `x as y` aliases\n * (resolved to the local name `x`... the ORIGINAL exported name, since it is\n * the export that must exist in the checked public/barrel surface).\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 * fenceImports(\"import { a, b as c } from 'x'\\n\") // [{ specifier: 'x', names: ['a', 'b'] }]\n * ```\n */\nexport function fenceImports(\n\tfence: string,\n): ReadonlyArray<{ specifier: string; names: readonly string[] }> {\n\tconst results: Array<{ specifier: string; names: readonly string[] }> = []\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 * Whether a link `href` should be skipped by the guides-parity link checks — an\n * external scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.\n *\n * @param href - The link destination\n * @returns `true` when the link should not be resolved against the filesystem\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 * Resolve 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 * Resolve 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 * The first code-span value found 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 * firstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'\n * ```\n */\nexport function firstCode(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 = firstCode(node.children)\n\t\t\tif (value !== undefined) return value\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * The link hrefs found within one table cell's inline content.\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 * cellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']\n * ```\n */\nexport function cellLinks(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 * 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 * identifierOf('MarkdownHandler<TNode, T>') // 'MarkdownHandler'\n * identifierOf('fold') // 'fold'\n * ```\n */\nexport function identifierOf(code: string): string {\n\tconst index = code.indexOf('<')\n\treturn (index < 0 ? code : code.slice(0, index)).trim()\n}\n\n/**\n * The index of a table's `Kind` column, found by its header text so it survives\n * column reordering. The match is exact and case-sensitive (`'Kind'`) — a table\n * without that exact header contributes no symbols to the surface it feeds.\n *\n * @param table - The table to inspect\n * @returns The `Kind` column's index, or `undefined` when the table has no `Kind` header\n *\n * @example\n * ```ts\n * kindIndex(table) // 1, or undefined\n * ```\n */\nexport function kindIndex(table: TableNode): 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() === 'Kind'\n\t\t) {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * The module-scope exports declared in one file's source text — matches\n * `export (async)? (function(\\*)?|class|const|interface|type) Name`, deduped\n * by (kind, name). A generator export (`export function* walk`) scans as kind\n * `function` — its trailing `*` is stripped before the {@link ExportKind} check.\n * Scanning uses {@link extractSourceLines}, so comment and template payload is\n * excluded while its uninterrupted column-zero head remains required; preserved\n * columns do not grant membership to leading/interrupted comment forms. The population is\n * exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is\n * outside 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 * exportsFrom('export class Markdown {}\\n') // [{ name: 'Markdown', kind: 'class' }]\n * exportsFrom('export function* walk() {}\\n') // [{ name: 'walk', kind: 'function' }]\n * ```\n */\nexport function exportsFrom(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractSourceLines(source)) {\n\t\tconst match = line.code.match(\n\t\t\t/^export (?:async )?(function\\*?|class|const|interface|type) (\\w+)/,\n\t\t)\n\t\tconst rawKind = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst kind = rawKind === undefined ? undefined : rawKind.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(kind) || !isNonEmptyString(name) || !isExportKind(kind)) continue\n\n\t\tconst key = `${kind} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tsymbols.push({ name, kind })\n\t}\n\n\treturn symbols\n}\n\n/**\n * The module-scope declarations LACKING the `export` keyword in one file's\n * source text — the mirror image of {@link exportsFrom}'s grammar, anchored\n * the same way (column 0, so an indented inner declaration never matches).\n * Scans only the five {@link ExportKind} keywords (`function` / `class` /\n * `const` / `interface` / `type`) — a module-scope `let` or `var` is a\n * different violation class (AGENTS §1 bans `var`; a bare `let` is not a\n * declaration kind this scanner's five-kind grammar covers) and is out of\n * this check's contract. Scanning uses {@link extractSourceLines}, so comment\n * and template payload is excluded while its uninterrupted column-zero head\n * remains required; preserved columns do not widen membership. `enum` is likewise outside this reflection population, not\n * 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 * hiddenFrom('function secretHelper() {}\\n') // [{ name: 'secretHelper', kind: 'function' }]\n * hiddenFrom('export class X {}\\n') // []\n * ```\n */\nexport function hiddenFrom(source: string): readonly SurfaceSymbol[] {\n\tconst symbols: SurfaceSymbol[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractSourceLines(source)) {\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 rawKind = match?.[1]\n\t\tconst name = match?.[2]\n\t\tconst kind = rawKind === undefined ? undefined : rawKind.replace(/\\*$/, '')\n\t\tif (!isNonEmptyString(kind) || !isNonEmptyString(name) || !isExportKind(kind)) continue\n\n\t\tconst key = `${kind} ${name}`\n\t\tif (seen.has(key)) continue\n\t\tseen.add(key)\n\t\tsymbols.push({ name, kind })\n\t}\n\n\treturn symbols\n}\n\n/**\n * Join the declaration head starting at `start` into one space-separated\n * line, consuming lines until the first that ends with `{`.\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 * ```\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\tparts.push(index === start ? line.trimEnd() : line.trim())\n\t\tif (line.trimEnd().endsWith('{')) return { text: parts.join(' '), end: index }\n\t}\n\n\treturn undefined\n}\n\n/**\n * The body lines of the named `export class` / `export interface` declaration\n * within one file's source text — everything between a projected real head and\n * projected column-0 closing `}`. Structural eligibility is projected while the\n * corresponding returned body lines remain raw for JSDoc evidence.\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 The declaration's body lines, or an empty array when `source` does not declare it\n *\n * @example\n * ```ts\n * declarationBody('export interface X {\\n\\twalk(): void\\n}\\n', 'interface', 'X') // ['\\twalk(): void']\n * ```\n */\nexport function declarationBody(\n\tsource: string,\n\tkeyword: 'class' | 'interface',\n\tname: string,\n): readonly string[] {\n\tconst opener = `export ${keyword} ${name}`\n\tconst declaration = new RegExp(`^export ${keyword} ${name}(?:<.*>)?(?: .*)? \\\\{$`)\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 || !line.startsWith(opener)) continue\n\n\t\tconst head = joinHead(projected, index)\n\t\tif (head === undefined || !declaration.test(head.text)) continue\n\n\t\tfor (let close = head.end + 1; close < projected.length; close += 1) {\n\t\t\tif (projected[close] === '}') {\n\t\t\t\treturn lines.slice(head.end + 1, close).map((record) => record.source)\n\t\t\t}\n\t\t}\n\n\t\t// Unterminated body — keep scanning in case a later match succeeds.\n\t}\n\n\treturn []\n}\n\n/**\n * 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). Matching runs once over projected lines so commented\n * method-like payload never becomes eligible.\n *\n * @param lines - A declaration's body lines\n * @returns The declared method names, deduped and sorted\n *\n * @example\n * ```ts\n * memberMethods(['\\tmap(): void', '\\tfilter(): void']) // ['filter', 'map']\n * ```\n */\nexport function memberMethods(lines: readonly string[]): readonly string[] {\n\tconst methods: string[] = []\n\n\tfor (const line of extractSourceLines(lines.join('\\n'))) {\n\t\tconst method = line.code.match(/^\\t(?:async )?\\*?(\\w+)(<.*>)?\\??\\(/)\n\t\tif (method?.[1] !== undefined) methods.push(method[1])\n\t}\n\n\treturn Array.from(new Set(methods)).sort()\n}\n\n/**\n * 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 (e.g. `Surface`)\n * @returns The blocks belonging to that section, in document order\n *\n * @example\n * ```ts\n * sectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`\n * ```\n */\nexport function sectionBlocks(document: MarkdownDocument, heading: string): 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 * 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)\n * UNION every backticked H3 entity heading in the section\n * (`{name: <codeSpan>, kind: 'class'}`), deduped by {@link symbolKey}. A row with\n * no code-span name, or an unrecognized `Kind` text, is skipped.\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', kind: '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 sectionBlocks(document, SURFACE)) {\n\t\tif (isTableNode(block)) {\n\t\t\tconst column = kindIndex(block)\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst nameCell = row[0]\n\t\t\t\tconst rawName = nameCell === undefined ? undefined : firstCode(nameCell)\n\t\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\t\tif (name === undefined) continue\n\n\t\t\t\tconst kindCell = column === undefined ? undefined : row[column]\n\t\t\t\tconst kindText =\n\t\t\t\t\tkindCell === undefined\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: flattenText({ element: 'paragraph', children: kindCell }).trim()\n\t\t\t\tif (!isExportKind(kindText)) continue\n\n\t\t\t\tconst symbol: SurfaceSymbol = { name, kind: kindText }\n\t\t\t\tconst key = symbolKey(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 = firstCode(block.children)\n\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\tif (name === undefined) continue\n\t\t\tconst symbol: SurfaceSymbol = { name, kind: 'class' }\n\t\t\tconst key = symbolKey(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 * 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.\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: ['walk', ...] }]\n * ```\n */\nexport function extractMethods(document: MarkdownDocument): readonly MethodGroup[] {\n\tconst groups: MethodGroup[] = []\n\tlet current: string | undefined\n\n\tfor (const block of sectionBlocks(document, METHODS)) {\n\t\tif (isHeadingNode(block) && block.level === 4) {\n\t\t\tconst rawInterface = firstCode(block.children)\n\t\t\tcurrent = rawInterface === undefined ? undefined : identifierOf(rawInterface)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isTableNode(block) && current !== undefined) {\n\t\t\tconst methods: string[] = []\n\t\t\tfor (const row of block.rows) {\n\t\t\t\tconst cell = row[0]\n\t\t\t\tconst rawName = cell === undefined ? undefined : firstCode(cell)\n\t\t\t\tconst name = rawName === undefined ? undefined : identifierOf(rawName)\n\t\t\t\tif (name !== undefined) methods.push(name)\n\t\t\t}\n\t\t\tgroups.push({ interface: current, methods })\n\t\t\tcurrent = undefined\n\t\t}\n\t}\n\n\treturn groups\n}\n\n/**\n * 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 * 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 sectionBlocks(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 * Select the next physical record after an eligible genuine JSDoc whose final\n * authoritative span carries an exact block-position `@example` tag. Title\n * text is allowed. A leading whitespace-separated span chain is last-span\n * authoritative; intervening source material severs association, while a\n * leading JSDoc on the next record replaces pending state. Any other next\n * physical record is returned once and consumes it. This parser walks aligned\n * records without rescanning source syntax or applying declaration/member\n * grammar.\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\tconst examples: SourceLine[] = []\n\tlet block = false\n\tlet eligible = false\n\tlet example = false\n\tlet pending = false\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) {\n\t\t\tif (!block && first >= 0 && line.source.slice(0, first).trim() === '') pending = false\n\t\t\telse {\n\t\t\t\texamples.push(line)\n\t\t\t\tpending = false\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\tif (eligible && /^\\s*\\*?\\s*@example(?=\\s|\\*\\/|$)/.test(projection.slice(0, end))) {\n\t\t\t\texample = true\n\t\t\t}\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 && example && whitespace\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\texample = false\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\texample = false\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\tif (eligible && /^\\s*\\*?\\s*@example(?=\\s|\\*\\/|$)/.test(projection.slice(cursor + 3, end))) {\n\t\t\t\texample = true\n\t\t\t}\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 && example && whitespace\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\teligible = eligible && whitespace\n\t\t\texample = false\n\t\t\tcursor = opener\n\t\t}\n\t}\n\n\treturn examples\n}\n\n/**\n * The exported functions in one file's source text whose immediately preceding\n * eligible genuine JSDoc block carries `@example`. Shared adjacency comes from\n * {@link extractExampleLines}; exported-function membership is matched against\n * the aligned code projection, so comment and template payload cannot qualify.\n *\n * @param source - The file's source text\n * @returns The exported function names with an `@example`, in file order\n *\n * @example\n * ```ts\n * const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\\n')\n * examplesFrom(block) // ['walk']\n * examplesFrom('export function walk() {}\\n') // []\n * ```\n */\nexport function examplesFrom(source: string): readonly string[] {\n\tconst names: string[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractExampleLines(extractSourceLines(source))) {\n\t\tconst match = line.code.match(/^export (?:async )?function\\*? (\\w+)/)\n\t\tconst name = match?.[1]\n\t\tif (isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tnames.push(name)\n\t\t}\n\t}\n\n\treturn names\n}\n\n/**\n * The callable-member names in a declaration body (per {@link memberMethods}'\n * grammar) whose immediately preceding eligible genuine JSDoc block, within\n * the same body, carries `@example`. Shared adjacency comes from\n * {@link extractExampleLines}; member membership is matched against aligned\n * projected code.\n *\n * @param lines - A declaration's body lines\n * @returns The exemplified member names, deduped and sorted\n *\n * @example\n * ```ts\n * exampleMethods(['\\t/**', '\\t * @example', '\\t *' + '/', '\\twalk(): void']) // ['walk']\n * ```\n */\nexport function exampleMethods(lines: readonly string[]): readonly string[] {\n\tconst methods: string[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const line of extractExampleLines(extractSourceLines(lines.join('\\n')))) {\n\t\tconst method = line.code.match(/^\\t(?:async )?\\*?(\\w+)(<.*>)?\\??\\(/)\n\t\tconst name = method?.[1]\n\t\tif (isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tmethods.push(name)\n\t\t}\n\t}\n\n\treturn Array.from(new Set(methods)).sort()\n}\n\n/**\n * Every fenced code block anywhere in the guide document. A full AST walk\n * includes fences nested inside blockquotes and lists.\n *\n * @param document - The parsed guide document\n * @returns Every fence's language and verbatim code, 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\tconst fences: GuideFence[] = []\n\tfor (const node of walkNodes(document)) {\n\t\tif (isCodeBlockNode(node)) fences.push({ language: node.lang, code: node.code })\n\t}\n\treturn fences\n}\n","import { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { isEmptyString, isNonEmptyArray } from '@orkestrel/contract'\nimport type { ManifestEntry } from './types.js'\nimport { MANIFEST } from './constants.js'\nimport { cellLinks, normalizeDirectories, resolvePath, sectionBlocks } from './helpers.js'\n\n/**\n * Parse 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 (e.g. `guides/README.md`'s content)\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 sectionBlocks(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 = cellLinks(specCell)[0]\n\t\t\tconst testsHref = cellLinks(testsCell)[0]\n\t\t\tif (specHref === undefined || testsHref === undefined) continue\n\n\t\t\tconst sourceHrefs = normalizeDirectories(\n\t\t\t\tcellLinks(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 { arrayShape, literalShape, objectShape, stringShape, unionShape } from '@orkestrel/contract'\n\n// AGENTS section 14 / 4.6.1: shapers are `ContractShape` VALUES, not functions\n// or types - a JSON-Schema blueprint the compilers (factories.ts) turn into a\n// guard / parser / schema / generator in lockstep. Every documented data type\n// here is non-recursive, so each shapes directly (no `lazyOf` gate needed).\n\n/**\n * The shape of a {@link SurfaceSymbol} — a documented / exported symbol's\n * `name` paired with its {@link ExportKind}.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { surfaceSymbolShape } from '@orkestrel/guide'\n *\n * const surfaceSymbol = createContract(surfaceSymbolShape)\n * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true\n * ```\n */\nexport const surfaceSymbolShape = objectShape({\n\tname: stringShape(),\n\tkind: literalShape(['type', 'interface', 'const', 'function', 'class']),\n})\n\n/**\n * The shape of a {@link MethodGroup} — a backticked `interface` name paired\n * with its documented `methods`.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { methodGroupShape } from '@orkestrel/guide'\n *\n * const methodGroup = createContract(methodGroupShape)\n * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * ```\n */\nexport const methodGroupShape = objectShape({\n\tinterface: stringShape(),\n\tmethods: arrayShape(stringShape()),\n})\n\n/**\n * The shape of a {@link ManifestEntry} — one `## By concept` manifest row,\n * `source` accepting either a single directory or several.\n *\n * @example\n * ```ts\n * import { createContract } from '@orkestrel/contract'\n * import { manifestEntryShape } from '@orkestrel/guide'\n *\n * const manifestEntry = createContract(manifestEntryShape)\n * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * ```\n */\nexport const manifestEntryShape = objectShape({\n\tconcept: stringShape(),\n\tspec: stringShape(),\n\tsource: unionShape(stringShape(), arrayShape(stringShape())),\n\ttests: stringShape(),\n})\n","import { createMarkdown, flattenText, isHeadingNode } from '@orkestrel/markdown'\nimport type { GuideFence, GuideInterface, MethodGroup, SurfaceSymbol } from './types.js'\nimport {\n\textractFences,\n\textractLinks,\n\textractMethods,\n\textractSurface,\n\textractTests,\n} from './helpers.js'\n\n/**\n * A stateful, structured view over one parsed guide — the six documented\n * projections (`sections` / `surface` / `methods` / `links` / `tests` /\n * `fences`) are extracted once at construction and cached.\n *\n * @remarks\n * Pure: parses `source` once via `@orkestrel/markdown` and never touches the\n * filesystem — `Guide` has no notion of \"where\" the guide came from, only its\n * markdown text. Every accessor returns the same cached, readonly array on\n * 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', kind: 'class' }]\n * ```\n */\nexport class Guide implements GuideInterface {\n\treadonly #sections: readonly string[]\n\treadonly #surface: readonly SurfaceSymbol[]\n\treadonly #methods: readonly MethodGroup[]\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.#surface = extractSurface(document)\n\t\tthis.#methods = extractMethods(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\tsurface(): readonly SurfaceSymbol[] {\n\t\treturn this.#surface\n\t}\n\n\tmethods(): readonly MethodGroup[] {\n\t\treturn this.#methods\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 { SourceInterface, SourceOptions, SurfaceSymbol } from '../types.js'\nimport {\n\tdeclarationBody,\n\texampleMethods,\n\texamplesFrom,\n\texportsFrom,\n\textractSourceLines,\n\thasCanonicalSegments,\n\thiddenFrom,\n\tmemberMethods,\n\tnormalizeDirectories,\n\tresolveLink,\n\tresolvePath,\n\tselectModuleKeys,\n\tsymbolKey,\n} from '../helpers.js'\n\n/**\n * A pure `SourceInterface` — reflects a module scope's intentional direct\n * declarations, conventional barrel-reachable surface, and member methods over\n * a consumer-supplied file inventory, using text-only line scanners rather than\n * the TypeScript compiler API or the 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`. 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. Source projection preserves columns without widening\n * direct/hidden column-zero heads. Literal ECMAScript Unicode identifiers\n * participate in bounded slash-state recognition without escape decoding.\n * Regex recognition is bounded: slash after bare `}` is division, so a\n * 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', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]\n * source.surface() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]\n * source.methods('GuideInterface') // ['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\t#exports: readonly SurfaceSymbol[] | undefined\n\t#surface: readonly SurfaceSymbol[] | undefined\n\t#hidden: readonly SurfaceSymbol[] | undefined\n\t#examples: readonly string[] | 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(exportsFrom)\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\tmethods(name: string): readonly string[] {\n\t\tconst interfaceBody = this.#declarationBody('interface', name)\n\t\tif (interfaceBody.length > 0) return memberMethods(interfaceBody)\n\n\t\tconst classBody = this.#declarationBody('class', name)\n\t\treturn memberMethods(classBody).filter((method) => method !== 'constructor')\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(hiddenFrom)\n\t\treturn this.#hidden\n\t}\n\n\texamples(): readonly string[]\n\texamples(name: string): readonly string[]\n\texamples(name?: string): readonly string[] {\n\t\tif (name === undefined) {\n\t\t\tif (this.#examples === undefined) this.#examples = this.#scanExamples()\n\t\t\treturn this.#examples\n\t\t}\n\n\t\treturn this.#exampleMembers(name)\n\t}\n\n\t// The union of exported-function `@example` names across the module's\n\t// files, deduped in first-seen order — mirrors `#scanSymbols`, but over a\n\t// plain string scanner (`examplesFrom`) rather than a `SurfaceSymbol` one.\n\t#scanExamples(): readonly string[] {\n\t\tconst names: string[] = []\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 name of examplesFrom(text)) {\n\t\t\t\tif (seen.has(name)) continue\n\t\t\t\tseen.add(name)\n\t\t\t\tnames.push(name)\n\t\t\t}\n\t\t}\n\n\t\treturn names\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 exportsFrom(text)) {\n\t\t\t\tconst identity = symbolKey(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`-carrying members of the interface-or-class declaration\n\t// body named `name`, unioning both shapes (an implementer may carry its\n\t// own `@example` a documented interface member does not, or vice versa).\n\t#exampleMembers(name: string): readonly string[] {\n\t\tconst interfaceBody = this.#declarationBody('interface', name)\n\t\tconst classBody = this.#declarationBody('class', name)\n\t\tconst members = new Set<string>([\n\t\t\t...exampleMethods(interfaceBody),\n\t\t\t...exampleMethods(classBody),\n\t\t])\n\t\treturn Array.from(members).sort()\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 = symbolKey(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 first non-empty declaration body found across the module scope's\n\t// files, searched in sorted file order until one file declares `name`.\n\t#declarationBody(keyword: 'class' | 'interface', name: string): readonly string[] {\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\tconst body = declarationBody(text, keyword, name)\n\t\t\tif (body.length > 0) return body\n\t\t}\n\n\t\treturn []\n\t}\n}\n","import type { SourceInterface, SourceManagerInterface, SourceManagerOptions } from '../types.js'\nimport { moduleKey } 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 *\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 * ```\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 = moduleKey(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","import type { ContractInterface } from '@orkestrel/contract'\nimport type {\n\tGuideInterface,\n\tManifestEntry,\n\tMethodGroup,\n\tSourceInterface,\n\tSourceManagerInterface,\n\tSourceManagerOptions,\n\tSourceOptions,\n\tSurfaceSymbol,\n} from './types.js'\nimport { createContract } from '@orkestrel/contract'\nimport { Guide } from './Guide.js'\nimport { manifestEntryShape, methodGroupShape, surfaceSymbolShape } from './shapers.js'\nimport { Source } from './sources/Source.js'\nimport { SourceManager } from './sources/SourceManager.js'\n\n/**\n * Create a structured {@link GuideInterface} view over one guide's markdown\n * source — parses once and caches its `sections` / `surface` / `methods` /\n * `links` / `tests` / `fences` projections.\n *\n * @param source - The guide's markdown source text\n * @returns A working {@link GuideInterface}\n *\n * @example\n * ```ts\n * import { createGuide } from '@orkestrel/guide'\n *\n * const guide = createGuide('## Surface\\n\\n| Name | Kind |\\n| --- | --- |\\n| `X` | class |')\n * guide.surface() // [{ name: 'X', kind: 'class' }]\n * ```\n */\nexport function createGuide(source: string): GuideInterface {\n\treturn new Guide(source)\n}\n\n/**\n * Create a pure {@link SourceInterface} over a consumer-supplied file\n * inventory — see {@link Source}.\n *\n * @param options - The file inventory and module scope to reflect\n * @returns A `SourceInterface` reflecting the given module scope\n *\n * @example\n * ```ts\n * import { createSource } from '@orkestrel/guide'\n *\n * const source = createSource({\n * \tfiles: { 'src/core/Guide.ts': 'export class Guide {}\\n' },\n * \tmodule: 'src/core',\n * })\n * source.exports() // [{ name: 'Guide', kind: 'class' }]\n * ```\n */\nexport function createSource(options: SourceOptions): SourceInterface {\n\treturn new Source(options)\n}\n\n/**\n * Create a {@link SourceManagerInterface} that resolves the consumer's local\n * import specifiers and shares one source view per module.\n *\n * @param options - The shared file inventory and specifier-to-module policy\n * @returns A source manager over the supplied policy\n *\n * @example\n * ```ts\n * import { createSourceManager } from '@orkestrel/guide'\n *\n * const sources = createSourceManager({\n * \tfiles: { 'src/core/index.ts': \"export * from './types.js'\" },\n * \tmodules: { '@scope/package': 'src/core' },\n * })\n * sources.source('@scope/package')?.surface()\n * ```\n */\nexport function createSourceManager(options: SourceManagerOptions): SourceManagerInterface {\n\treturn new SourceManager(options)\n}\n\n/**\n * Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for\n * {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `SurfaceSymbol` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createSurfaceSymbolContract } from '@orkestrel/guide'\n *\n * const surfaceSymbol = createSurfaceSymbolContract()\n * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true\n * ```\n */\nexport function createSurfaceSymbolContract(): ContractInterface<SurfaceSymbol> {\n\treturn createContract(surfaceSymbolShape)\n}\n\n/**\n * Compile the {@link methodGroupShape} into a {@link ContractInterface} for\n * {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `MethodGroup` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createMethodGroupContract } from '@orkestrel/guide'\n *\n * const methodGroup = createMethodGroupContract()\n * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true\n * ```\n */\nexport function createMethodGroupContract(): ContractInterface<MethodGroup> {\n\treturn createContract(methodGroupShape)\n}\n\n/**\n * Compile the {@link manifestEntryShape} into a {@link ContractInterface} for\n * {@link ManifestEntry} — a guard, coercing parser, JSON Schema, and seeded\n * generator from one shape declaration (AGENTS §14).\n *\n * @returns A `ManifestEntry` contract bundling `schema` / `is` / `parse` / `generate`\n *\n * @example\n * ```ts\n * import { createManifestEntryContract } from '@orkestrel/guide'\n *\n * const manifestEntry = createManifestEntryContract()\n * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true\n * ```\n */\nexport function createManifestEntryContract(): ContractInterface<ManifestEntry> {\n\treturn createContract(manifestEntryShape)\n}\n"],"mappings":";;;;;;AAGA,IAAa,UAAkB;;;;AAK/B,IAAa,UAAkB;;;;AAK/B,IAAa,QAAgB;;;;AAK7B,IAAa,WAAmB;;;;;;AAOhC,IAAa,mBAAsC,OAAO,OAAO;CAChE;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;ACRD,IAAa,eAAkC,UAC9C,QACA,aACA,SACA,YACA,OACD;;;;;;;;;;;;;;AAeA,IAAa,kBAAwC,SAAS;CAC7D,MAAM;CACN,MAAM;AACP,CAAC;;;;;;;;;;;;;;AAeD,IAAa,gBAAoC,SAAS;CACzD,WAAW;CACX,SAAS,QAAQ,QAAQ;AAC1B,CAAC;;;;;;;;;;;;;;AAeD,IAAa,kBAAwC,SAAS;CAC7D,SAAS;CACT,MAAM;CACN,QAAQ,QAAQ,UAAU,QAAQ,QAAQ,CAAC;CAC3C,OAAO;AACR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChCD,SAAgB,mBAAmB,QAAuC;CACzE,MAAM,QAAsB,CAAC;CAC7B,IAAI,aAAuB,CAAC;CAC5B,IAAI,kBAA4B,CAAC;CACjC,MAAM,aAAa;CACnB,MAAM,YAAsB,CAAC;CAC7B,MAAM,cAAwE,CAAC;CAC/E,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,IAAI,UAAU;CACd,IAAI,aAAa;CACjB,IAAI,kBAAkB;CACtB,IAAI,iBAAiB;CACrB,IAAI;CACJ,IAAI;CACJ,IAAI,YAAY;CAChB,IAAI,gBAAgB;CACpB,IAAI,eAAe;CACnB,IAAI,QAAQ;CACZ,IAAI,eAAe;CAEnB,KAAK,IAAI,SAAS,GAAG,SAAS,OAAO,QAAQ,UAAU,GAAG;EACzD,MAAM,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