@orkestrel/guide 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["#sections","#surface","#methods","#links","#tests","#patterns","#files","#module","#exports","#scanSymbols","#declarationBody","#hidden","#examples","#scanExamples","#exampleMembers"],"sources":["../../../src/core/constants.ts","../../../src/core/helpers.ts","../../../src/core/validators.ts","../../../src/core/parsers.ts","../../../src/core/shapers.ts","../../../src/core/Guide.ts","../../../src/core/Source.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 { InlineNode, TableNode } from '@orkestrel/markdown'\nimport {\n\tflattenText,\n\tisCodeSpanNode,\n\tisEmphasisNode,\n\tisLinkNode,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport type { GuideModule, SurfaceSymbol } from './types.js'\nimport { EXTERNAL_SCHEMES } from './constants.js'\n\n/**\n * A module scope normalized to its directory list — a single directory\n * becomes a one-element list so every scanner walks the same shape.\n *\n * @param module - The module scope to normalize\n * @returns The directory list `module` denotes\n *\n * @example\n * ```ts\n * moduleDirs('src/core') // ['src/core']\n * moduleDirs(['src/core', 'src/browser']) // ['src/core', 'src/browser']\n * ```\n */\nexport function moduleDirs(module: GuideModule): readonly string[] {\n\treturn typeof module === 'string' ? [module] : module\n}\n\n/**\n * The file inventory's keys belonging to a {@link GuideModule} scope, sorted —\n * a key belongs when it starts with one of the scope's directories, ends in\n * `.ts`, and is neither that directory's `index.ts` nor a `.test.ts` file.\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 * moduleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']\n * ```\n */\nexport function moduleKeys(\n\tfiles: Readonly<Record<string, string>>,\n\tmodule: GuideModule,\n): readonly string[] {\n\tconst dirs = moduleDirs(module)\n\tconst keys: string[] = []\n\n\tfor (const key of Object.keys(files)) {\n\t\tif (!key.endsWith('.ts')) continue\n\t\tif (key.endsWith('.test.ts')) continue\n\n\t\tconst dir = dirs.find((candidate) => key.startsWith(`${candidate}/`))\n\t\tif (dir === undefined) continue\n\t\tif (key === `${dir}/index.ts`) continue\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 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 `source.exports()`).\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): readonly { specifier: string; names: readonly string[] }[] {\n\tconst results: { 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 link `target` against `from` and normalize the result — `from`\n * is treated as a file (its directory is everything before the last `/`) when it\n * carries a `/`, or as a bare directory itself when it does not; `.` segments drop\n * and `..` segments pop the preceding component, purely (no `node:path`).\n *\n * @param from - The declaring guide path (a file) or manifest base (a directory)\n * @param target - The relative link destination to resolve\n * @returns The normalized, workspace-root-relative path\n *\n * @example\n * ```ts\n * resolveLink('guides/src/markdown.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'\n * resolveLink('guides', '../src/core') // 'src/core'\n * ```\n */\nexport function resolveLink(from: string, target: string): string {\n\tconst index = from.lastIndexOf('/')\n\tconst dir = index < 0 ? from : from.slice(0, index)\n\tconst combined = dir === '' ? target : `${dir}/${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\tif (segments.length > 0) 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.join('/')\n}\n\n/**\n * The first code-span value found by descending an inline node list, following\n * into `emphasis` / `link` children — the extraction rule behind a Surface or\n * 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)) {\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","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, MarkdownDocument } from '@orkestrel/markdown'\nimport {\n\tcreateMarkdown,\n\tflattenText,\n\tisCodeBlockNode,\n\tisHeadingNode,\n\tisLinkNode,\n\tisTableNode,\n\twalkNodes,\n} from '@orkestrel/markdown'\nimport { isEmptyString, isNonEmptyArray, isNonEmptyString } from '@orkestrel/contract'\nimport type { DeclarationHead, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js'\nimport { MANIFEST, METHODS, SURFACE, TESTS } from './constants.js'\nimport { cellLinks, firstCode, identifierOf, kindIndex, resolveLink, symbolKey } from './helpers.js'\nimport { isExportKind } from './validators.js'\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 *\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 source.split(/\\r?\\n/)) {\n\t\tconst match = line.match(/^export (?: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 * 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.\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 source.split(/\\r?\\n/)) {\n\t\tif (line.startsWith('export ')) continue\n\t\tconst match = line.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 the head's opening `{`\n * and the column-0 closing `}`.\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 = source.split(/\\r?\\n/)\n\n\tfor (let index = 0; index < lines.length; index += 1) {\n\t\tconst line = lines[index]\n\t\tif (line === undefined || !line.startsWith(opener)) continue\n\n\t\tconst head = joinHead(lines, index)\n\t\tif (head === undefined || !declaration.test(head.text)) continue\n\n\t\tconst body: string[] = []\n\t\tfor (const member of lines.slice(head.end + 1)) {\n\t\t\tif (member === '}') return body\n\t\t\tbody.push(member)\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).\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 lines) {\n\t\tconst method = line.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 * The exported functions in one file's source text whose immediately preceding\n * JSDoc block carries `@example` — walked line by line, tracking the current\n * comment block; the block resets on any non-comment, non-export line so an\n * `@example` never attaches to a declaration it does not directly precede.\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\tlet inBlock = false\n\tlet blockHasExample = false\n\tlet pending = false\n\n\tfor (const line of source.split(/\\r?\\n/)) {\n\t\tconst trimmed = line.trim()\n\n\t\tif (!inBlock && trimmed.startsWith('/**')) {\n\t\t\tinBlock = true\n\t\t\tblockHasExample = trimmed.includes('@example')\n\t\t\tpending = false\n\t\t\tif (trimmed.length > 3 && trimmed.endsWith('*/')) {\n\t\t\t\tinBlock = false\n\t\t\t\tpending = blockHasExample\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (inBlock) {\n\t\t\tif (trimmed.includes('@example')) blockHasExample = true\n\t\t\tif (trimmed.endsWith('*/')) {\n\t\t\t\tinBlock = false\n\t\t\t\tpending = blockHasExample\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst match = line.match(/^export (?:async )?function\\*? (\\w+)/)\n\t\tconst name = match?.[1]\n\t\tif (pending && isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tnames.push(name)\n\t\t}\n\t\tpending = false\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 JSDoc block, within the same body,\n * carries `@example` — the member-level mirror of {@link examplesFrom}.\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\tlet inBlock = false\n\tlet blockHasExample = false\n\tlet pending = false\n\n\tfor (const line of lines) {\n\t\tconst trimmed = line.trim()\n\n\t\tif (!inBlock && trimmed.startsWith('/**')) {\n\t\t\tinBlock = true\n\t\t\tblockHasExample = trimmed.includes('@example')\n\t\t\tpending = false\n\t\t\tif (trimmed.length > 3 && trimmed.endsWith('*/')) {\n\t\t\t\tinBlock = false\n\t\t\t\tpending = blockHasExample\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (inBlock) {\n\t\t\tif (trimmed.includes('@example')) blockHasExample = true\n\t\t\tif (trimmed.endsWith('*/')) {\n\t\t\t\tinBlock = false\n\t\t\t\tpending = blockHasExample\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst method = line.match(/^\\t(?:async )?\\*?(\\w+)(<.*>)?\\??\\(/)\n\t\tconst name = method?.[1]\n\t\tif (pending && isNonEmptyString(name) && !seen.has(name)) {\n\t\t\tseen.add(name)\n\t\t\tmethods.push(name)\n\t\t}\n\t\tpending = false\n\t}\n\n\treturn Array.from(new Set(methods)).sort()\n}\n\n/**\n * Every ```ts fenced code block's body text anywhere in the guide document —\n * a full AST walk so a fence nested inside a blockquote or list still counts.\n *\n * @param document - The parsed guide document\n * @returns Every `ts`-lang fence's verbatim code, in walk order\n *\n * @example\n * ```ts\n * extractPatterns(document) // [\"import { X } from './x.js'\\nX()\"]\n * ```\n */\nexport function extractPatterns(document: MarkdownDocument): readonly string[] {\n\tconst patterns: string[] = []\n\tfor (const node of walkNodes(document)) {\n\t\tif (isCodeBlockNode(node) && node.lang === 'ts') patterns.push(node.code)\n\t}\n\treturn patterns\n}\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 `base`), and Source cell (every link href, resolved\n * against `base`; one directory collapses to a `string`, several become a\n * `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 base - A single directory name relative to the workspace root that the manifest's\n * links are resolved against (e.g. `'guides'`) — {@link resolveLink}'s arithmetic supports\n * only one path segment, so a deeper or nested base is not supported\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, base: 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 = cellLinks(sourceCell).map((href) => resolveLink(base, href))\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: resolveLink(base, specHref),\n\t\t\t\tsource,\n\t\t\t\ttests: resolveLink(base, 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/core'\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/core'\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/core'\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 { GuideInterface, MethodGroup, SurfaceSymbol } from './types.js'\nimport {\n\textractLinks,\n\textractMethods,\n\textractPatterns,\n\textractSurface,\n\textractTests,\n} from './parsers.js'\n\n/**\n * A stateful, structured view over one parsed guide — the five documented\n * projections (`sections` / `surface` / `methods` / `links` / `tests`) are\n * 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/core'\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 #patterns: readonly string[]\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.#patterns = extractPatterns(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\tpatterns(): readonly string[] {\n\t\treturn this.#patterns\n\t}\n}\n","import type { GuideModule, SourceInterface, SourceOptions, SurfaceSymbol } from './types.js'\nimport { moduleKeys, symbolKey } from './helpers.js'\nimport {\n\tdeclarationBody,\n\texampleMethods,\n\texamplesFrom,\n\texportsFrom,\n\thiddenFrom,\n\tmemberMethods,\n} from './parsers.js'\n\n/**\n * A pure `SourceInterface` — reflects a module scope's exports and member\n * methods over a consumer-supplied file inventory (AGENTS §22, `PROPOSAL.md`\n * §7), using text-only line scanners rather than the TypeScript compiler API\n * or the filesystem. `Source` never touches disk: the consumer gathers the\n * inventory however their environment allows (`node:fs` in a Node script,\n * `import.meta.glob` in a browser/vitest run) and passes it in as `files`.\n *\n * @example\n * ```ts\n * import { Source } from '@orkestrel/guide'\n *\n * const source = new Source({\n * \tfiles: {\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.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 #module: GuideModule\n\t#exports: 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.#module = 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\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 moduleKeys(this.#files, this.#module)) {\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 `@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 moduleKeys(this.#files, this.#module)) {\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 moduleKeys(this.#files, this.#module)) {\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 { ContractInterface } from '@orkestrel/contract'\nimport type {\n\tGuideInterface,\n\tManifestEntry,\n\tMethodGroup,\n\tSourceInterface,\n\tSourceOptions,\n\tSurfaceSymbol,\n} from './types.js'\nimport { createContract } from '@orkestrel/contract'\nimport { Guide } from './Guide.js'\nimport { Source } from './Source.js'\nimport { manifestEntryShape, methodGroupShape, surfaceSymbolShape } from './shapers.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` 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 * 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/core'\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/core'\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/core'\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;;;;;;;;;;;;;;;;ACND,SAAgB,WAAW,QAAwC;CAClE,OAAO,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI;AAChD;;;;;;;;;;;;;;;AAgBA,SAAgB,WACf,OACA,QACoB;CACpB,MAAM,OAAO,WAAW,MAAM;CAC9B,MAAM,OAAiB,CAAC;CAExB,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACrC,IAAI,CAAC,IAAI,SAAS,KAAK,GAAG;EAC1B,IAAI,IAAI,SAAS,UAAU,GAAG;EAE9B,MAAM,MAAM,KAAK,MAAM,cAA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B;AACzC;;;;;;;;;;;;;;;;AAiBA,SAAgB,4BAA4D;CAC3E,QAAA,GAAA,oBAAA,eAAA,CAAsB,gBAAgB;AACvC;;;;;;;;;;;;;;;;AAiBA,SAAgB,8BAAgE;CAC/E,QAAA,GAAA,oBAAA,eAAA,CAAsB,kBAAkB;AACzC"}
@@ -0,0 +1,9 @@
1
+ export type * from './types.js';
2
+ export * from './constants.js';
3
+ export * from './helpers.js';
4
+ export * from './parsers.js';
5
+ export * from './shapers.js';
6
+ export * from './validators.js';
7
+ export * from './Guide.js';
8
+ export * from './Source.js';
9
+ export * from './factories.js';
@@ -1,5 +1,5 @@
1
- import type { BlockNode, MarkdownDocument } from '@orkestrel/markdown';
2
- import type { DeclarationHead, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js';
1
+ import { BlockNode, MarkdownDocument } from '@orkestrel/markdown';
2
+ import { DeclarationHead, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js';
3
3
  /**
4
4
  * The module-scope exports declared in one file's source text — matches
5
5
  * `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
@@ -1,3 +1,4 @@
1
+ import { ObjectShape, StringShape, LiteralShape, ArrayShape, UnionShape } from '@orkestrel/contract';
1
2
  /**
2
3
  * The shape of a {@link SurfaceSymbol} — a documented / exported symbol's
3
4
  * `name` paired with its {@link ExportKind}.
@@ -11,10 +12,10 @@
11
12
  * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
12
13
  * ```
13
14
  */
14
- export declare const surfaceSymbolShape: import("@orkestrel/contract").ObjectShape<{
15
- name: import("@orkestrel/contract").StringShape;
16
- kind: import("@orkestrel/contract").LiteralShape<readonly ["type", "interface", "const", "function", "class"]>;
17
- }>;
15
+ export declare const surfaceSymbolShape: ObjectShape<{
16
+ name: StringShape;
17
+ kind: LiteralShape<readonly ["type", "interface", "const", "function", "class"]>;
18
+ }, false>;
18
19
  /**
19
20
  * The shape of a {@link MethodGroup} — a backticked `interface` name paired
20
21
  * with its documented `methods`.
@@ -28,10 +29,10 @@ export declare const surfaceSymbolShape: import("@orkestrel/contract").ObjectSha
28
29
  * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
29
30
  * ```
30
31
  */
31
- export declare const methodGroupShape: import("@orkestrel/contract").ObjectShape<{
32
- interface: import("@orkestrel/contract").StringShape;
33
- methods: import("@orkestrel/contract").ArrayShape<import("@orkestrel/contract").StringShape>;
34
- }>;
32
+ export declare const methodGroupShape: ObjectShape<{
33
+ interface: StringShape;
34
+ methods: ArrayShape<StringShape>;
35
+ }, false>;
35
36
  /**
36
37
  * The shape of a {@link ManifestEntry} — one `## By concept` manifest row,
37
38
  * `source` accepting either a single directory or several.
@@ -45,9 +46,9 @@ export declare const methodGroupShape: import("@orkestrel/contract").ObjectShape
45
46
  * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
46
47
  * ```
47
48
  */
48
- export declare const manifestEntryShape: import("@orkestrel/contract").ObjectShape<{
49
- concept: import("@orkestrel/contract").StringShape;
50
- spec: import("@orkestrel/contract").StringShape;
51
- source: import("@orkestrel/contract").UnionShape<[import("@orkestrel/contract").StringShape, import("@orkestrel/contract").ArrayShape<import("@orkestrel/contract").StringShape>]>;
52
- tests: import("@orkestrel/contract").StringShape;
53
- }>;
49
+ export declare const manifestEntryShape: ObjectShape<{
50
+ concept: StringShape;
51
+ spec: StringShape;
52
+ source: UnionShape<[ StringShape, ArrayShape<StringShape>]>;
53
+ tests: StringShape;
54
+ }, false>;
@@ -1,5 +1,5 @@
1
- import type { Guard } from '@orkestrel/contract';
2
- import type { ExportKind, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js';
1
+ import { Guard } from '@orkestrel/contract';
2
+ import { ExportKind, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js';
3
3
  /**
4
4
  * Whether `value` is one of the five documented {@link ExportKind} literals — the
5
5
  * guard behind extracting a Surface table's `Kind` cell into a typed symbol.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orkestrel/guide",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
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",
@@ -25,13 +25,19 @@
25
25
  ],
26
26
  "type": "module",
27
27
  "sideEffects": false,
28
- "main": "./dist/src/core/index.js",
28
+ "main": "./dist/src/core/index.cjs",
29
+ "module": "./dist/src/core/index.js",
29
30
  "types": "./dist/src/core/index.d.ts",
30
31
  "exports": {
31
32
  ".": {
32
- "types": "./dist/src/core/index.d.ts",
33
- "import": "./dist/src/core/index.js",
34
- "default": "./dist/src/core/index.js"
33
+ "import": {
34
+ "types": "./dist/src/core/index.d.ts",
35
+ "default": "./dist/src/core/index.js"
36
+ },
37
+ "require": {
38
+ "types": "./dist/src/core/index.d.cts",
39
+ "default": "./dist/src/core/index.cjs"
40
+ }
35
41
  },
36
42
  "./package.json": "./package.json"
37
43
  },
@@ -43,32 +49,35 @@
43
49
  "copy": "node -e \"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\"",
44
50
  "tmp:txt": "node -e \"const fs=require('node:fs'),p=require('node:path');function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory()){walk(f)}else if(!e.name.endsWith('.md')&&!e.name.endsWith('.txt')){const t=f+'.txt';if(!fs.existsSync(t)){fs.renameSync(f,t)}else{console.warn('Skipping '+f+' — target exists: '+t)}}}}try{walk('tmp')}catch(e){if(e.code!=='ENOENT')throw e}\"",
45
51
  "lint": "oxlint --config .oxlintrc.json --fix .",
46
- "check": "tsc --noEmit --project tsconfig.json",
52
+ "check": "tsc --noEmit --project tsconfig.json && npm run check:src",
47
53
  "check:src": "npm run check:src:core",
48
54
  "check:src:core": "tsc --noEmit -p configs/src/tsconfig.core.json",
49
55
  "format": "oxfmt --config .oxfmtrc.json --write .",
50
56
  "format:check": "oxfmt --config .oxfmtrc.json --check .",
51
57
  "lint:check": "oxlint --config .oxlintrc.json .",
52
58
  "test": "npm run test:src && npm run test:guides",
53
- "test:src": "vitest run --config vite.config.ts --reporter=dot --project src:core",
59
+ "test:src": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
60
+ "test:src:core": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
54
61
  "test:guides": "vitest run --config vite.config.ts --reporter=dot --project guides",
55
62
  "build": "npm run clean && npm run build:src",
56
- "build:src": "vite build --config configs/src/vite.core.config.ts && tsc -p configs/src/tsconfig.core.json",
57
- "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run check:src && npm run build && npm test"
63
+ "build:src": "npm run build:src:core",
64
+ "build:src:core": "vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts",
65
+ "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test"
58
66
  },
59
67
  "dependencies": {
60
- "@orkestrel/contract": "^0.0.1",
61
- "@orkestrel/markdown": "^0.0.1"
68
+ "@orkestrel/contract": "^0.0.3",
69
+ "@orkestrel/markdown": "^0.0.3"
62
70
  },
63
71
  "devDependencies": {
64
72
  "@types/node": "^26.1.1",
65
- "oxfmt": "^0.58.0",
66
- "oxlint": "^1.73.0",
73
+ "oxfmt": "^0.59.0",
74
+ "oxlint": "^1.74.0",
67
75
  "typescript": "^6.0.3",
68
- "vite": "^8.1.4",
76
+ "vite": "^8.1.5",
77
+ "vite-plugin-dts": "^5.0.3",
69
78
  "vitest": "^4.1.10"
70
79
  },
71
80
  "engines": {
72
- "node": ">=24"
81
+ "node": ">=22"
73
82
  }
74
83
  }