@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,1231 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _orkestrel_markdown = require("@orkestrel/markdown");
3
+ let _orkestrel_contract = require("@orkestrel/contract");
4
+ //#region src/core/constants.ts
5
+ /**
6
+ * The `## Surface` heading text a guide's documented exports section is keyed on.
7
+ */
8
+ var SURFACE = "Surface";
9
+ /**
10
+ * The `## Methods` heading text a guide's documented interface-methods section is keyed on.
11
+ */
12
+ var METHODS = "Methods";
13
+ /**
14
+ * The `## Tests` heading text a guide's documented test-link section is keyed on.
15
+ */
16
+ var TESTS = "Tests";
17
+ /**
18
+ * The `## By concept` heading text the manifest's run-map table is keyed on.
19
+ */
20
+ var MANIFEST = "By concept";
21
+ /**
22
+ * The link `href` schemes a guides-parity link check skips as external — a link
23
+ * with one of these prefixes (or a bare `#` anchor, handled separately in
24
+ * `isExternalLink`) is never resolved against the filesystem.
25
+ */
26
+ var EXTERNAL_SCHEMES = Object.freeze([
27
+ "http:",
28
+ "https:",
29
+ "mailto:",
30
+ "tel:"
31
+ ]);
32
+ //#endregion
33
+ //#region src/core/helpers.ts
34
+ /**
35
+ * A module scope normalized to its directory list — a single directory
36
+ * becomes a one-element list so every scanner walks the same shape.
37
+ *
38
+ * @param module - The module scope to normalize
39
+ * @returns The directory list `module` denotes
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * moduleDirs('src/core') // ['src/core']
44
+ * moduleDirs(['src/core', 'src/browser']) // ['src/core', 'src/browser']
45
+ * ```
46
+ */
47
+ function moduleDirs(module) {
48
+ return typeof module === "string" ? [module] : module;
49
+ }
50
+ /**
51
+ * The file inventory's keys belonging to a {@link GuideModule} scope, sorted —
52
+ * a key belongs when it starts with one of the scope's directories, ends in
53
+ * `.ts`, and is neither that directory's `index.ts` nor a `.test.ts` file.
54
+ *
55
+ * @param files - The workspace file inventory, root-relative path → file text
56
+ * @param module - The module scope to filter to
57
+ * @returns The scope's file keys, root-relative and sorted
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * moduleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']
62
+ * ```
63
+ */
64
+ function moduleKeys(files, module) {
65
+ const dirs = moduleDirs(module);
66
+ const keys = [];
67
+ for (const key of Object.keys(files)) {
68
+ if (!key.endsWith(".ts")) continue;
69
+ if (key.endsWith(".test.ts")) continue;
70
+ const dir = dirs.find((candidate) => key.startsWith(`${candidate}/`));
71
+ if (dir === void 0) continue;
72
+ if (key === `${dir}/index.ts`) continue;
73
+ keys.push(key);
74
+ }
75
+ return keys.sort();
76
+ }
77
+ /**
78
+ * The bijection key for a surface symbol — its kind and name combined — so a
79
+ * symbol-set comparison diffs (name, kind) pairs rather than names alone.
80
+ *
81
+ * @param symbol - The symbol to key
82
+ * @returns The `${kind} ${name}` key
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * symbolKey({ name: 'Markdown', kind: 'class' }) // 'class Markdown'
87
+ * ```
88
+ */
89
+ function symbolKey(symbol) {
90
+ return `${symbol.kind} ${symbol.name}`;
91
+ }
92
+ /**
93
+ * The names present in `names` but absent from `source` — the set-difference
94
+ * behind a both-directions bijection assertion.
95
+ *
96
+ * @param names - The candidate names
97
+ * @param source - The names to compare against
98
+ * @returns The names in `names` that are not in `source`
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * findMissing(['a', 'b'], ['a']) // ['b']
103
+ * ```
104
+ */
105
+ function findMissing(names, source) {
106
+ const existing = new Set(source);
107
+ return names.filter((name) => !existing.has(name));
108
+ }
109
+ /**
110
+ * The symbol-key set-difference between two symbol lists — `symbols` present but
111
+ * absent from `source`, compared by {@link symbolKey} so a symbol can drift in
112
+ * neither name nor kind.
113
+ *
114
+ * @param symbols - The candidate symbols
115
+ * @param source - The symbols to compare against
116
+ * @returns The symbol keys in `symbols` that are not in `source`
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * missingSymbols([{ name: 'X', kind: 'class' }], []) // ['class X']
121
+ * ```
122
+ */
123
+ function missingSymbols(symbols, source) {
124
+ return findMissing(symbols.map(symbolKey), source.map(symbolKey));
125
+ }
126
+ /**
127
+ * The names in `names` that have no example — a fence containing the name at a
128
+ * word boundary in `fences`, or a membership in `examples`, both count as
129
+ * "has an example"; presence-only, fence and JSDoc content are never checked.
130
+ *
131
+ * @param names - The candidate symbol/member names to check
132
+ * @param fences - The guide's ```ts Patterns fence bodies to search
133
+ * @param examples - The names already known to carry an `@example` JSDoc block
134
+ * @returns The names in `names` with no fence mention and no `@example`
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * findUnexampled(['walk', 'fold'], ['walk()'], []) // ['fold']
139
+ * findUnexampled(['walk'], [], ['walk']) // []
140
+ * ```
141
+ */
142
+ function findUnexampled(names, fences, examples) {
143
+ const exampled = new Set(examples);
144
+ return names.filter((name) => {
145
+ if (exampled.has(name)) return false;
146
+ const boundary = new RegExp(`\\b${name}\\b`);
147
+ return !fences.some((fence) => boundary.test(fence));
148
+ });
149
+ }
150
+ /**
151
+ * Parse a fence's `import` statements into per-specifier imported identifier
152
+ * names — handles `import type`, mixed multiline braces, and `x as y` aliases
153
+ * (resolved to the local name `x`... the ORIGINAL exported name, since it is
154
+ * the export that must exist in `source.exports()`).
155
+ *
156
+ * @param fence - A ```ts Patterns fence's verbatim body text
157
+ * @returns One entry per `import ... from 'specifier'` statement, in fence order
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * fenceImports("import { a, b as c } from 'x'\n") // [{ specifier: 'x', names: ['a', 'b'] }]
162
+ * ```
163
+ */
164
+ function fenceImports(fence) {
165
+ const results = [];
166
+ const pattern = /import\s+(?:type\s+)?\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/gs;
167
+ let match;
168
+ while ((match = pattern.exec(fence)) !== null) {
169
+ const body = match[1];
170
+ const specifier = match[2];
171
+ if (body === void 0 || specifier === void 0) continue;
172
+ const names = body.split(",").map((part) => part.trim()).filter((part) => part.length > 0).map((part) => part.replace(/^type\s+/, "")).map((part) => {
173
+ return part.match(/^(\w+)\s+as\s+\w+$/)?.[1] ?? part;
174
+ }).filter((part) => /^\w+$/.test(part));
175
+ results.push({
176
+ specifier,
177
+ names
178
+ });
179
+ }
180
+ return results;
181
+ }
182
+ /**
183
+ * Whether a link `href` should be skipped by the guides-parity link checks — an
184
+ * external scheme ({@link EXTERNAL_SCHEMES}) or a bare in-document `#` anchor.
185
+ *
186
+ * @param href - The link destination
187
+ * @returns `true` when the link should not be resolved against the filesystem
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * isExternalLink('https://example.com') // true
192
+ * isExternalLink('../helpers.ts') // false
193
+ * ```
194
+ */
195
+ function isExternalLink(href) {
196
+ if (href.startsWith("#")) return true;
197
+ return EXTERNAL_SCHEMES.some((scheme) => href.startsWith(scheme));
198
+ }
199
+ /**
200
+ * Resolve a relative link `target` against `from` and normalize the result — `from`
201
+ * is treated as a file (its directory is everything before the last `/`) when it
202
+ * carries a `/`, or as a bare directory itself when it does not; `.` segments drop
203
+ * and `..` segments pop the preceding component, purely (no `node:path`).
204
+ *
205
+ * @param from - The declaring guide path (a file) or manifest base (a directory)
206
+ * @param target - The relative link destination to resolve
207
+ * @returns The normalized, workspace-root-relative path
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * resolveLink('guides/src/markdown.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'
212
+ * resolveLink('guides', '../src/core') // 'src/core'
213
+ * ```
214
+ */
215
+ function resolveLink(from, target) {
216
+ const index = from.lastIndexOf("/");
217
+ const dir = index < 0 ? from : from.slice(0, index);
218
+ const combined = dir === "" ? target : `${dir}/${target}`;
219
+ const segments = [];
220
+ for (const segment of combined.split("/")) {
221
+ if (segment === "" || segment === ".") continue;
222
+ if (segment === "..") {
223
+ if (segments.length > 0) segments.pop();
224
+ else segments.push(segment);
225
+ continue;
226
+ }
227
+ segments.push(segment);
228
+ }
229
+ return segments.join("/");
230
+ }
231
+ /**
232
+ * The first code-span value found by descending an inline node list, following
233
+ * into `emphasis` / `link` children — the extraction rule behind a Surface or
234
+ * Methods table row's first-column identifier.
235
+ *
236
+ * @param nodes - The inline nodes to search
237
+ * @returns The first code span's literal text, or `undefined` when none is found
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * firstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'
242
+ * ```
243
+ */
244
+ function firstCode(nodes) {
245
+ for (const node of nodes) {
246
+ if ((0, _orkestrel_markdown.isCodeSpanNode)(node)) return node.value;
247
+ if ((0, _orkestrel_markdown.isEmphasisNode)(node) || (0, _orkestrel_markdown.isLinkNode)(node)) {
248
+ const value = firstCode(node.children);
249
+ if (value !== void 0) return value;
250
+ }
251
+ }
252
+ }
253
+ /**
254
+ * The link hrefs found within one table cell's inline content.
255
+ *
256
+ * @param cell - The cell's inline nodes
257
+ * @returns The cell's link hrefs, in walk order
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * cellLinks([{ element: 'link', href: 'x.ts', children: [] }]) // ['x.ts']
262
+ * ```
263
+ */
264
+ function cellLinks(cell) {
265
+ const links = [];
266
+ for (const node of (0, _orkestrel_markdown.walkNodes)({
267
+ element: "paragraph",
268
+ children: cell
269
+ })) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
270
+ return links;
271
+ }
272
+ /**
273
+ * The identifier prefix of a code-span text — everything before its first `<`,
274
+ * trimmed. Guide cells and headings may annotate a generic-parameterized name
275
+ * (`MarkdownHandler<TNode, T>`) for readability, but the bijection key is the
276
+ * bare identifier the source scanner captures, so both sides must normalize
277
+ * the same way.
278
+ *
279
+ * @param code - A code span's literal text
280
+ * @returns The identifier prefix, or an empty string when `code` is empty
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * identifierOf('MarkdownHandler<TNode, T>') // 'MarkdownHandler'
285
+ * identifierOf('fold') // 'fold'
286
+ * ```
287
+ */
288
+ function identifierOf(code) {
289
+ const index = code.indexOf("<");
290
+ return (index < 0 ? code : code.slice(0, index)).trim();
291
+ }
292
+ /**
293
+ * The index of a table's `Kind` column, found by its header text so it survives
294
+ * column reordering. The match is exact and case-sensitive (`'Kind'`) — a table
295
+ * without that exact header contributes no symbols to the surface it feeds.
296
+ *
297
+ * @param table - The table to inspect
298
+ * @returns The `Kind` column's index, or `undefined` when the table has no `Kind` header
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * kindIndex(table) // 1, or undefined
303
+ * ```
304
+ */
305
+ function kindIndex(table) {
306
+ for (let index = 0; index < table.header.length; index += 1) {
307
+ const cell = table.header[index];
308
+ if (cell !== void 0 && (0, _orkestrel_markdown.flattenText)({
309
+ element: "paragraph",
310
+ children: cell
311
+ }).trim() === "Kind") return index;
312
+ }
313
+ }
314
+ //#endregion
315
+ //#region src/core/validators.ts
316
+ /**
317
+ * Whether `value` is one of the five documented {@link ExportKind} literals — the
318
+ * guard behind extracting a Surface table's `Kind` cell into a typed symbol.
319
+ *
320
+ * @param value - The candidate value
321
+ * @returns `true` when `value` is a valid {@link ExportKind}
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * isExportKind('class') // true
326
+ * isExportKind('enum') // false
327
+ * ```
328
+ */
329
+ var isExportKind = (0, _orkestrel_contract.literalOf)("type", "interface", "const", "function", "class");
330
+ /**
331
+ * Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string
332
+ * paired with a valid {@link ExportKind}.
333
+ *
334
+ * @param value - The value to test
335
+ * @returns `true` when `value` is a well-formed {@link SurfaceSymbol}
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true
340
+ * isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false
341
+ * ```
342
+ */
343
+ var isSurfaceSymbol = (0, _orkestrel_contract.recordOf)({
344
+ name: _orkestrel_contract.isString,
345
+ kind: isExportKind
346
+ });
347
+ /**
348
+ * Whether `value` is a well-formed {@link MethodGroup} — a backticked
349
+ * `interface` name paired with its documented `methods`.
350
+ *
351
+ * @param value - The value to test
352
+ * @returns `true` when `value` is a well-formed {@link MethodGroup}
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
357
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
358
+ * ```
359
+ */
360
+ var isMethodGroup = (0, _orkestrel_contract.recordOf)({
361
+ interface: _orkestrel_contract.isString,
362
+ methods: (0, _orkestrel_contract.arrayOf)(_orkestrel_contract.isString)
363
+ });
364
+ /**
365
+ * Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`
366
+ * manifest row, its `source` accepting either a single directory or several.
367
+ *
368
+ * @param value - The value to test
369
+ * @returns `true` when `value` is a well-formed {@link ManifestEntry}
370
+ *
371
+ * @example
372
+ * ```ts
373
+ * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
374
+ * isManifestEntry({ concept: 1 }) // false
375
+ * ```
376
+ */
377
+ var isManifestEntry = (0, _orkestrel_contract.recordOf)({
378
+ concept: _orkestrel_contract.isString,
379
+ spec: _orkestrel_contract.isString,
380
+ source: (0, _orkestrel_contract.unionOf)(_orkestrel_contract.isString, (0, _orkestrel_contract.arrayOf)(_orkestrel_contract.isString)),
381
+ tests: _orkestrel_contract.isString
382
+ });
383
+ //#endregion
384
+ //#region src/core/parsers.ts
385
+ /**
386
+ * The module-scope exports declared in one file's source text — matches
387
+ * `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
388
+ * by (kind, name). A generator export (`export function* walk`) scans as kind
389
+ * `function` — its trailing `*` is stripped before the {@link ExportKind} check.
390
+ *
391
+ * @param source - The file's source text
392
+ * @returns The file's exported symbols, in file order
393
+ *
394
+ * @example
395
+ * ```ts
396
+ * exportsFrom('export class Markdown {}\n') // [{ name: 'Markdown', kind: 'class' }]
397
+ * exportsFrom('export function* walk() {}\n') // [{ name: 'walk', kind: 'function' }]
398
+ * ```
399
+ */
400
+ function exportsFrom(source) {
401
+ const symbols = [];
402
+ const seen = /* @__PURE__ */ new Set();
403
+ for (const line of source.split(/\r?\n/)) {
404
+ const match = line.match(/^export (?:async )?(function\*?|class|const|interface|type) (\w+)/);
405
+ const rawKind = match?.[1];
406
+ const name = match?.[2];
407
+ const kind = rawKind === void 0 ? void 0 : rawKind.replace(/\*$/, "");
408
+ if (!(0, _orkestrel_contract.isNonEmptyString)(kind) || !(0, _orkestrel_contract.isNonEmptyString)(name) || !isExportKind(kind)) continue;
409
+ const key = `${kind} ${name}`;
410
+ if (seen.has(key)) continue;
411
+ seen.add(key);
412
+ symbols.push({
413
+ name,
414
+ kind
415
+ });
416
+ }
417
+ return symbols;
418
+ }
419
+ /**
420
+ * The module-scope declarations LACKING the `export` keyword in one file's
421
+ * source text — the mirror image of {@link exportsFrom}'s grammar, anchored
422
+ * the same way (column 0, so an indented inner declaration never matches).
423
+ * Scans only the five {@link ExportKind} keywords (`function` / `class` /
424
+ * `const` / `interface` / `type`) — a module-scope `let` or `var` is a
425
+ * different violation class (AGENTS §1 bans `var`; a bare `let` is not a
426
+ * declaration kind this scanner's five-kind grammar covers) and is out of
427
+ * this check's contract.
428
+ *
429
+ * @param source - The file's source text
430
+ * @returns The file's hidden (non-exported) symbols, in file order
431
+ *
432
+ * @example
433
+ * ```ts
434
+ * hiddenFrom('function secretHelper() {}\n') // [{ name: 'secretHelper', kind: 'function' }]
435
+ * hiddenFrom('export class X {}\n') // []
436
+ * ```
437
+ */
438
+ function hiddenFrom(source) {
439
+ const symbols = [];
440
+ const seen = /* @__PURE__ */ new Set();
441
+ for (const line of source.split(/\r?\n/)) {
442
+ if (line.startsWith("export ")) continue;
443
+ const match = line.match(/^(?:async )?(function\*?|class|const|interface|type) (\w+)/);
444
+ const rawKind = match?.[1];
445
+ const name = match?.[2];
446
+ const kind = rawKind === void 0 ? void 0 : rawKind.replace(/\*$/, "");
447
+ if (!(0, _orkestrel_contract.isNonEmptyString)(kind) || !(0, _orkestrel_contract.isNonEmptyString)(name) || !isExportKind(kind)) continue;
448
+ const key = `${kind} ${name}`;
449
+ if (seen.has(key)) continue;
450
+ seen.add(key);
451
+ symbols.push({
452
+ name,
453
+ kind
454
+ });
455
+ }
456
+ return symbols;
457
+ }
458
+ /**
459
+ * Join the declaration head starting at `start` into one space-separated
460
+ * line, consuming lines until the first that ends with `{`.
461
+ *
462
+ * @param lines - The file's source lines
463
+ * @param start - The index of the head's first line
464
+ * @returns The joined head, or `undefined` when no line opens a body
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * joinHead(['export class X {'], 0) // { text: 'export class X {', end: 0 }
469
+ * ```
470
+ */
471
+ function joinHead(lines, start) {
472
+ const parts = [];
473
+ for (let index = start; index < lines.length; index += 1) {
474
+ const line = lines[index];
475
+ if (line === void 0) break;
476
+ parts.push(index === start ? line.trimEnd() : line.trim());
477
+ if (line.trimEnd().endsWith("{")) return {
478
+ text: parts.join(" "),
479
+ end: index
480
+ };
481
+ }
482
+ }
483
+ /**
484
+ * The body lines of the named `export class` / `export interface` declaration
485
+ * within one file's source text — everything between the head's opening `{`
486
+ * and the column-0 closing `}`.
487
+ *
488
+ * @param source - The file's source text to search
489
+ * @param keyword - Whether to look for a `class` or an `interface`
490
+ * @param name - The declaration's identifier
491
+ * @returns The declaration's body lines, or an empty array when `source` does not declare it
492
+ *
493
+ * @example
494
+ * ```ts
495
+ * declarationBody('export interface X {\n\twalk(): void\n}\n', 'interface', 'X') // ['\twalk(): void']
496
+ * ```
497
+ */
498
+ function declarationBody(source, keyword, name) {
499
+ const opener = `export ${keyword} ${name}`;
500
+ const declaration = new RegExp(`^export ${keyword} ${name}(?:<.*>)?(?: .*)? \\{$`);
501
+ const lines = source.split(/\r?\n/);
502
+ for (let index = 0; index < lines.length; index += 1) {
503
+ const line = lines[index];
504
+ if (line === void 0 || !line.startsWith(opener)) continue;
505
+ const head = joinHead(lines, index);
506
+ if (head === void 0 || !declaration.test(head.text)) continue;
507
+ const body = [];
508
+ for (const member of lines.slice(head.end + 1)) {
509
+ if (member === "}") return body;
510
+ body.push(member);
511
+ }
512
+ }
513
+ return [];
514
+ }
515
+ /**
516
+ * The member lines declaring a callable member: plain, `async`, generator
517
+ * (`*`), and optional (`records?(`) methods all count; getters, setters,
518
+ * `static` members, and `#` privates never do (their keyword or `#` breaks
519
+ * the `name(` shape).
520
+ *
521
+ * @param lines - A declaration's body lines
522
+ * @returns The declared method names, deduped and sorted
523
+ *
524
+ * @example
525
+ * ```ts
526
+ * memberMethods(['\tmap(): void', '\tfilter(): void']) // ['filter', 'map']
527
+ * ```
528
+ */
529
+ function memberMethods(lines) {
530
+ const methods = [];
531
+ for (const line of lines) {
532
+ const method = line.match(/^\t(?:async )?\*?(\w+)(<.*>)?\??\(/);
533
+ if (method?.[1] !== void 0) methods.push(method[1]);
534
+ }
535
+ return Array.from(new Set(methods)).sort();
536
+ }
537
+ /**
538
+ * The block nodes under the named `##` heading, up to the next `##`-or-higher
539
+ * heading (or the document's end) — the section-scoping window `extractSurface` /
540
+ * `extractMethods` walk over.
541
+ *
542
+ * @param document - The parsed guide document
543
+ * @param heading - The `##` heading text to scope to (e.g. `Surface`)
544
+ * @returns The blocks belonging to that section, in document order
545
+ *
546
+ * @example
547
+ * ```ts
548
+ * sectionBlocks(document, 'Surface') // the blocks between `## Surface` and the next `##`
549
+ * ```
550
+ */
551
+ function sectionBlocks(document, heading) {
552
+ const blocks = [];
553
+ let active = false;
554
+ for (const block of document.children) {
555
+ if ((0, _orkestrel_markdown.isHeadingNode)(block) && block.level <= 2) {
556
+ if (block.level === 2 && (0, _orkestrel_markdown.flattenText)(block).trim() === heading) {
557
+ active = true;
558
+ continue;
559
+ }
560
+ if (active) break;
561
+ }
562
+ if (active) blocks.push(block);
563
+ }
564
+ return blocks;
565
+ }
566
+ /**
567
+ * Every `## Surface` identifier the guide documents — each table row's column 0
568
+ * code span (the name) paired with its `Kind` column (located by header text)
569
+ * UNION every backticked H3 entity heading in the section
570
+ * (`{name: <codeSpan>, kind: 'class'}`), deduped by {@link symbolKey}. A row with
571
+ * no code-span name, or an unrecognized `Kind` text, is skipped.
572
+ *
573
+ * @param document - The parsed guide document
574
+ * @returns The documented surface, in encounter order
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * extractSurface(document) // [{ name: 'Markdown', kind: 'class' }, ...]
579
+ * ```
580
+ */
581
+ function extractSurface(document) {
582
+ const symbols = [];
583
+ const seen = /* @__PURE__ */ new Set();
584
+ for (const block of sectionBlocks(document, SURFACE)) {
585
+ if ((0, _orkestrel_markdown.isTableNode)(block)) {
586
+ const column = kindIndex(block);
587
+ for (const row of block.rows) {
588
+ const nameCell = row[0];
589
+ const rawName = nameCell === void 0 ? void 0 : firstCode(nameCell);
590
+ const name = rawName === void 0 ? void 0 : identifierOf(rawName);
591
+ if (name === void 0) continue;
592
+ const kindCell = column === void 0 ? void 0 : row[column];
593
+ const kindText = kindCell === void 0 ? "" : (0, _orkestrel_markdown.flattenText)({
594
+ element: "paragraph",
595
+ children: kindCell
596
+ }).trim();
597
+ if (!isExportKind(kindText)) continue;
598
+ const symbol = {
599
+ name,
600
+ kind: kindText
601
+ };
602
+ const key = symbolKey(symbol);
603
+ if (seen.has(key)) continue;
604
+ seen.add(key);
605
+ symbols.push(symbol);
606
+ }
607
+ continue;
608
+ }
609
+ if ((0, _orkestrel_markdown.isHeadingNode)(block) && block.level === 3) {
610
+ const rawName = firstCode(block.children);
611
+ const name = rawName === void 0 ? void 0 : identifierOf(rawName);
612
+ if (name === void 0) continue;
613
+ const symbol = {
614
+ name,
615
+ kind: "class"
616
+ };
617
+ const key = symbolKey(symbol);
618
+ if (seen.has(key)) continue;
619
+ seen.add(key);
620
+ symbols.push(symbol);
621
+ }
622
+ }
623
+ return symbols;
624
+ }
625
+ /**
626
+ * One {@link MethodGroup} per documented behavioral interface in `## Methods` —
627
+ * an H4 with a code span sets the current interface, and the table immediately
628
+ * following becomes its documented methods.
629
+ *
630
+ * @param document - The parsed guide document
631
+ * @returns The documented method groups, in document order
632
+ *
633
+ * @example
634
+ * ```ts
635
+ * extractMethods(document) // [{ interface: 'MarkdownInterface', methods: ['walk', ...] }]
636
+ * ```
637
+ */
638
+ function extractMethods(document) {
639
+ const groups = [];
640
+ let current;
641
+ for (const block of sectionBlocks(document, METHODS)) {
642
+ if ((0, _orkestrel_markdown.isHeadingNode)(block) && block.level === 4) {
643
+ const rawInterface = firstCode(block.children);
644
+ current = rawInterface === void 0 ? void 0 : identifierOf(rawInterface);
645
+ continue;
646
+ }
647
+ if ((0, _orkestrel_markdown.isTableNode)(block) && current !== void 0) {
648
+ const methods = [];
649
+ for (const row of block.rows) {
650
+ const cell = row[0];
651
+ const rawName = cell === void 0 ? void 0 : firstCode(cell);
652
+ const name = rawName === void 0 ? void 0 : identifierOf(rawName);
653
+ if (name !== void 0) methods.push(name);
654
+ }
655
+ groups.push({
656
+ interface: current,
657
+ methods
658
+ });
659
+ current = void 0;
660
+ }
661
+ }
662
+ return groups;
663
+ }
664
+ /**
665
+ * Every link href in the guide document, including table cells — a full,
666
+ * depth-first walk of the whole AST.
667
+ *
668
+ * @param document - The parsed guide document
669
+ * @returns Every link's href, in walk order
670
+ *
671
+ * @example
672
+ * ```ts
673
+ * extractLinks(document) // ['../../src/core/helpers.ts', 'https://example.com']
674
+ * ```
675
+ */
676
+ function extractLinks(document) {
677
+ const links = [];
678
+ for (const node of (0, _orkestrel_markdown.walkNodes)(document)) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
679
+ return links;
680
+ }
681
+ /**
682
+ * The relative test links declared under `## Tests` — every link href found
683
+ * within that section only.
684
+ *
685
+ * @param document - The parsed guide document
686
+ * @returns The `## Tests` section's link hrefs, in walk order
687
+ *
688
+ * @example
689
+ * ```ts
690
+ * extractTests(document) // ['../../tests/src/core/Markdown.test.ts', ...]
691
+ * ```
692
+ */
693
+ function extractTests(document) {
694
+ const links = [];
695
+ for (const block of sectionBlocks(document, TESTS)) for (const node of (0, _orkestrel_markdown.walkNodes)(block)) if ((0, _orkestrel_markdown.isLinkNode)(node)) links.push(node.href);
696
+ return links;
697
+ }
698
+ /**
699
+ * The exported functions in one file's source text whose immediately preceding
700
+ * JSDoc block carries `@example` — walked line by line, tracking the current
701
+ * comment block; the block resets on any non-comment, non-export line so an
702
+ * `@example` never attaches to a declaration it does not directly precede.
703
+ *
704
+ * @param source - The file's source text
705
+ * @returns The exported function names with an `@example`, in file order
706
+ *
707
+ * @example
708
+ * ```ts
709
+ * const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\n')
710
+ * examplesFrom(block) // ['walk']
711
+ * examplesFrom('export function walk() {}\n') // []
712
+ * ```
713
+ */
714
+ function examplesFrom(source) {
715
+ const names = [];
716
+ const seen = /* @__PURE__ */ new Set();
717
+ let inBlock = false;
718
+ let blockHasExample = false;
719
+ let pending = false;
720
+ for (const line of source.split(/\r?\n/)) {
721
+ const trimmed = line.trim();
722
+ if (!inBlock && trimmed.startsWith("/**")) {
723
+ inBlock = true;
724
+ blockHasExample = trimmed.includes("@example");
725
+ pending = false;
726
+ if (trimmed.length > 3 && trimmed.endsWith("*/")) {
727
+ inBlock = false;
728
+ pending = blockHasExample;
729
+ }
730
+ continue;
731
+ }
732
+ if (inBlock) {
733
+ if (trimmed.includes("@example")) blockHasExample = true;
734
+ if (trimmed.endsWith("*/")) {
735
+ inBlock = false;
736
+ pending = blockHasExample;
737
+ }
738
+ continue;
739
+ }
740
+ const name = line.match(/^export (?:async )?function\*? (\w+)/)?.[1];
741
+ if (pending && (0, _orkestrel_contract.isNonEmptyString)(name) && !seen.has(name)) {
742
+ seen.add(name);
743
+ names.push(name);
744
+ }
745
+ pending = false;
746
+ }
747
+ return names;
748
+ }
749
+ /**
750
+ * The callable-member names in a declaration body (per {@link memberMethods}'
751
+ * grammar) whose immediately preceding JSDoc block, within the same body,
752
+ * carries `@example` — the member-level mirror of {@link examplesFrom}.
753
+ *
754
+ * @param lines - A declaration's body lines
755
+ * @returns The exemplified member names, deduped and sorted
756
+ *
757
+ * @example
758
+ * ```ts
759
+ * exampleMethods(['\t/**', '\t * @example', '\t *' + '/', '\twalk(): void']) // ['walk']
760
+ * ```
761
+ */
762
+ function exampleMethods(lines) {
763
+ const methods = [];
764
+ const seen = /* @__PURE__ */ new Set();
765
+ let inBlock = false;
766
+ let blockHasExample = false;
767
+ let pending = false;
768
+ for (const line of lines) {
769
+ const trimmed = line.trim();
770
+ if (!inBlock && trimmed.startsWith("/**")) {
771
+ inBlock = true;
772
+ blockHasExample = trimmed.includes("@example");
773
+ pending = false;
774
+ if (trimmed.length > 3 && trimmed.endsWith("*/")) {
775
+ inBlock = false;
776
+ pending = blockHasExample;
777
+ }
778
+ continue;
779
+ }
780
+ if (inBlock) {
781
+ if (trimmed.includes("@example")) blockHasExample = true;
782
+ if (trimmed.endsWith("*/")) {
783
+ inBlock = false;
784
+ pending = blockHasExample;
785
+ }
786
+ continue;
787
+ }
788
+ const name = line.match(/^\t(?:async )?\*?(\w+)(<.*>)?\??\(/)?.[1];
789
+ if (pending && (0, _orkestrel_contract.isNonEmptyString)(name) && !seen.has(name)) {
790
+ seen.add(name);
791
+ methods.push(name);
792
+ }
793
+ pending = false;
794
+ }
795
+ return Array.from(new Set(methods)).sort();
796
+ }
797
+ /**
798
+ * Every ```ts fenced code block's body text anywhere in the guide document —
799
+ * a full AST walk so a fence nested inside a blockquote or list still counts.
800
+ *
801
+ * @param document - The parsed guide document
802
+ * @returns Every `ts`-lang fence's verbatim code, in walk order
803
+ *
804
+ * @example
805
+ * ```ts
806
+ * extractPatterns(document) // ["import { X } from './x.js'\nX()"]
807
+ * ```
808
+ */
809
+ function extractPatterns(document) {
810
+ const patterns = [];
811
+ for (const node of (0, _orkestrel_markdown.walkNodes)(document)) if ((0, _orkestrel_markdown.isCodeBlockNode)(node) && node.lang === "ts") patterns.push(node.code);
812
+ return patterns;
813
+ }
814
+ /**
815
+ * Parse a `## By concept` manifest table into its {@link ManifestEntry} rows —
816
+ * each row's Concept cell (flattened text), Spec / Tests cells (a single link
817
+ * href, resolved against `base`), and Source cell (every link href, resolved
818
+ * against `base`; one directory collapses to a `string`, several become a
819
+ * `readonly string[]`). A row missing a concept, spec link, tests link, or
820
+ * source link is skipped as malformed.
821
+ *
822
+ * @param markdown - The manifest markdown source (e.g. `guides/README.md`'s content)
823
+ * @param base - A single directory name relative to the workspace root that the manifest's
824
+ * links are resolved against (e.g. `'guides'`) — {@link resolveLink}'s arithmetic supports
825
+ * only one path segment, so a deeper or nested base is not supported
826
+ * @returns The manifest's entries, in row order
827
+ *
828
+ * @example
829
+ * ```ts
830
+ * parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]
831
+ * ```
832
+ */
833
+ function parseManifest(markdown, base) {
834
+ const document = (0, _orkestrel_markdown.createMarkdown)(markdown).document;
835
+ const entries = [];
836
+ for (const block of sectionBlocks(document, MANIFEST)) {
837
+ if (!(0, _orkestrel_markdown.isTableNode)(block)) continue;
838
+ for (const row of block.rows) {
839
+ const conceptCell = row[0];
840
+ const specCell = row[1];
841
+ const sourceCell = row[2];
842
+ const testsCell = row[3];
843
+ if (conceptCell === void 0 || specCell === void 0 || sourceCell === void 0 || testsCell === void 0) continue;
844
+ const concept = (0, _orkestrel_markdown.flattenText)({
845
+ element: "paragraph",
846
+ children: conceptCell
847
+ }).trim();
848
+ if ((0, _orkestrel_contract.isEmptyString)(concept)) continue;
849
+ const specHref = cellLinks(specCell)[0];
850
+ const testsHref = cellLinks(testsCell)[0];
851
+ if (specHref === void 0 || testsHref === void 0) continue;
852
+ const sourceHrefs = cellLinks(sourceCell).map((href) => resolveLink(base, href));
853
+ if (!(0, _orkestrel_contract.isNonEmptyArray)(sourceHrefs)) continue;
854
+ const [firstSource] = sourceHrefs;
855
+ const source = sourceHrefs.length === 1 ? firstSource : sourceHrefs;
856
+ entries.push({
857
+ concept,
858
+ spec: resolveLink(base, specHref),
859
+ source,
860
+ tests: resolveLink(base, testsHref)
861
+ });
862
+ }
863
+ }
864
+ return entries;
865
+ }
866
+ //#endregion
867
+ //#region src/core/shapers.ts
868
+ /**
869
+ * The shape of a {@link SurfaceSymbol} — a documented / exported symbol's
870
+ * `name` paired with its {@link ExportKind}.
871
+ *
872
+ * @example
873
+ * ```ts
874
+ * import { createContract } from '@orkestrel/contract'
875
+ * import { surfaceSymbolShape } from '@orkestrel/guide/core'
876
+ *
877
+ * const surfaceSymbol = createContract(surfaceSymbolShape)
878
+ * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
879
+ * ```
880
+ */
881
+ var surfaceSymbolShape = (0, _orkestrel_contract.objectShape)({
882
+ name: (0, _orkestrel_contract.stringShape)(),
883
+ kind: (0, _orkestrel_contract.literalShape)([
884
+ "type",
885
+ "interface",
886
+ "const",
887
+ "function",
888
+ "class"
889
+ ])
890
+ });
891
+ /**
892
+ * The shape of a {@link MethodGroup} — a backticked `interface` name paired
893
+ * with its documented `methods`.
894
+ *
895
+ * @example
896
+ * ```ts
897
+ * import { createContract } from '@orkestrel/contract'
898
+ * import { methodGroupShape } from '@orkestrel/guide/core'
899
+ *
900
+ * const methodGroup = createContract(methodGroupShape)
901
+ * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
902
+ * ```
903
+ */
904
+ var methodGroupShape = (0, _orkestrel_contract.objectShape)({
905
+ interface: (0, _orkestrel_contract.stringShape)(),
906
+ methods: (0, _orkestrel_contract.arrayShape)((0, _orkestrel_contract.stringShape)())
907
+ });
908
+ /**
909
+ * The shape of a {@link ManifestEntry} — one `## By concept` manifest row,
910
+ * `source` accepting either a single directory or several.
911
+ *
912
+ * @example
913
+ * ```ts
914
+ * import { createContract } from '@orkestrel/contract'
915
+ * import { manifestEntryShape } from '@orkestrel/guide/core'
916
+ *
917
+ * const manifestEntry = createContract(manifestEntryShape)
918
+ * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
919
+ * ```
920
+ */
921
+ var manifestEntryShape = (0, _orkestrel_contract.objectShape)({
922
+ concept: (0, _orkestrel_contract.stringShape)(),
923
+ spec: (0, _orkestrel_contract.stringShape)(),
924
+ source: (0, _orkestrel_contract.unionShape)((0, _orkestrel_contract.stringShape)(), (0, _orkestrel_contract.arrayShape)((0, _orkestrel_contract.stringShape)())),
925
+ tests: (0, _orkestrel_contract.stringShape)()
926
+ });
927
+ //#endregion
928
+ //#region src/core/Guide.ts
929
+ /**
930
+ * A stateful, structured view over one parsed guide — the five documented
931
+ * projections (`sections` / `surface` / `methods` / `links` / `tests`) are
932
+ * extracted once at construction and cached.
933
+ *
934
+ * @remarks
935
+ * Pure: parses `source` once via `@orkestrel/markdown` and never touches the
936
+ * filesystem — `Guide` has no notion of "where" the guide came from, only its
937
+ * markdown text. Every accessor returns the same cached, readonly array on
938
+ * every call.
939
+ *
940
+ * @example
941
+ * ```ts
942
+ * import { Guide } from '@orkestrel/guide/core'
943
+ *
944
+ * const guide = new Guide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
945
+ * guide.surface() // [{ name: 'X', kind: 'class' }]
946
+ * ```
947
+ */
948
+ var Guide = class {
949
+ #sections;
950
+ #surface;
951
+ #methods;
952
+ #links;
953
+ #tests;
954
+ #patterns;
955
+ constructor(source) {
956
+ const document = (0, _orkestrel_markdown.createMarkdown)(source).document;
957
+ this.#sections = document.children.filter(_orkestrel_markdown.isHeadingNode).filter((heading) => heading.level === 2).map((heading) => (0, _orkestrel_markdown.flattenText)(heading).trim());
958
+ this.#surface = extractSurface(document);
959
+ this.#methods = extractMethods(document);
960
+ this.#links = extractLinks(document);
961
+ this.#tests = extractTests(document);
962
+ this.#patterns = extractPatterns(document);
963
+ }
964
+ sections() {
965
+ return this.#sections;
966
+ }
967
+ surface() {
968
+ return this.#surface;
969
+ }
970
+ methods() {
971
+ return this.#methods;
972
+ }
973
+ links() {
974
+ return this.#links;
975
+ }
976
+ tests() {
977
+ return this.#tests;
978
+ }
979
+ patterns() {
980
+ return this.#patterns;
981
+ }
982
+ };
983
+ //#endregion
984
+ //#region src/core/Source.ts
985
+ /**
986
+ * A pure `SourceInterface` — reflects a module scope's exports and member
987
+ * methods over a consumer-supplied file inventory (AGENTS §22, `PROPOSAL.md`
988
+ * §7), using text-only line scanners rather than the TypeScript compiler API
989
+ * or the filesystem. `Source` never touches disk: the consumer gathers the
990
+ * inventory however their environment allows (`node:fs` in a Node script,
991
+ * `import.meta.glob` in a browser/vitest run) and passes it in as `files`.
992
+ *
993
+ * @example
994
+ * ```ts
995
+ * import { Source } from '@orkestrel/guide'
996
+ *
997
+ * const source = new Source({
998
+ * files: {
999
+ * 'src/core/Guide.ts': 'export class Guide {}\n',
1000
+ * 'src/core/types.ts': 'export interface GuideInterface {\n\tsections(): void\n}\n',
1001
+ * },
1002
+ * module: 'src/core',
1003
+ * })
1004
+ * source.exports() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]
1005
+ * source.methods('GuideInterface') // ['sections']
1006
+ * source.exists('src/core/Guide.ts') // true
1007
+ * ```
1008
+ */
1009
+ var Source = class {
1010
+ #files;
1011
+ #module;
1012
+ #exports;
1013
+ #hidden;
1014
+ #examples;
1015
+ constructor(options) {
1016
+ this.#files = options.files;
1017
+ this.#module = options.module;
1018
+ }
1019
+ exports() {
1020
+ if (this.#exports === void 0) this.#exports = this.#scanSymbols(exportsFrom);
1021
+ return this.#exports;
1022
+ }
1023
+ methods(name) {
1024
+ const interfaceBody = this.#declarationBody("interface", name);
1025
+ if (interfaceBody.length > 0) return memberMethods(interfaceBody);
1026
+ return memberMethods(this.#declarationBody("class", name)).filter((method) => method !== "constructor");
1027
+ }
1028
+ exists(relative) {
1029
+ return Object.keys(this.#files).some((key) => key === relative || key.startsWith(`${relative}/`));
1030
+ }
1031
+ hidden() {
1032
+ if (this.#hidden === void 0) this.#hidden = this.#scanSymbols(hiddenFrom);
1033
+ return this.#hidden;
1034
+ }
1035
+ examples(name) {
1036
+ if (name === void 0) {
1037
+ if (this.#examples === void 0) this.#examples = this.#scanExamples();
1038
+ return this.#examples;
1039
+ }
1040
+ return this.#exampleMembers(name);
1041
+ }
1042
+ #scanExamples() {
1043
+ const names = [];
1044
+ const seen = /* @__PURE__ */ new Set();
1045
+ for (const key of moduleKeys(this.#files, this.#module)) {
1046
+ const text = this.#files[key];
1047
+ if (text === void 0) continue;
1048
+ for (const name of examplesFrom(text)) {
1049
+ if (seen.has(name)) continue;
1050
+ seen.add(name);
1051
+ names.push(name);
1052
+ }
1053
+ }
1054
+ return names;
1055
+ }
1056
+ #exampleMembers(name) {
1057
+ const interfaceBody = this.#declarationBody("interface", name);
1058
+ const classBody = this.#declarationBody("class", name);
1059
+ const members = /* @__PURE__ */ new Set([...exampleMethods(interfaceBody), ...exampleMethods(classBody)]);
1060
+ return Array.from(members).sort();
1061
+ }
1062
+ #scanSymbols(scan) {
1063
+ const symbols = [];
1064
+ const seen = /* @__PURE__ */ new Set();
1065
+ for (const key of moduleKeys(this.#files, this.#module)) {
1066
+ const text = this.#files[key];
1067
+ if (text === void 0) continue;
1068
+ for (const symbol of scan(text)) {
1069
+ const identity = symbolKey(symbol);
1070
+ if (seen.has(identity)) continue;
1071
+ seen.add(identity);
1072
+ symbols.push(symbol);
1073
+ }
1074
+ }
1075
+ return symbols.sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1);
1076
+ }
1077
+ #declarationBody(keyword, name) {
1078
+ for (const key of moduleKeys(this.#files, this.#module)) {
1079
+ const text = this.#files[key];
1080
+ if (text === void 0) continue;
1081
+ const body = declarationBody(text, keyword, name);
1082
+ if (body.length > 0) return body;
1083
+ }
1084
+ return [];
1085
+ }
1086
+ };
1087
+ //#endregion
1088
+ //#region src/core/factories.ts
1089
+ /**
1090
+ * Create a structured {@link GuideInterface} view over one guide's markdown
1091
+ * source — parses once and caches its `sections` / `surface` / `methods` /
1092
+ * `links` / `tests` projections.
1093
+ *
1094
+ * @param source - The guide's markdown source text
1095
+ * @returns A working {@link GuideInterface}
1096
+ *
1097
+ * @example
1098
+ * ```ts
1099
+ * import { createGuide } from '@orkestrel/guide'
1100
+ *
1101
+ * const guide = createGuide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
1102
+ * guide.surface() // [{ name: 'X', kind: 'class' }]
1103
+ * ```
1104
+ */
1105
+ function createGuide(source) {
1106
+ return new Guide(source);
1107
+ }
1108
+ /**
1109
+ * Create a pure {@link SourceInterface} over a consumer-supplied file
1110
+ * inventory — see {@link Source}.
1111
+ *
1112
+ * @param options - The file inventory and module scope to reflect
1113
+ * @returns A `SourceInterface` reflecting the given module scope
1114
+ *
1115
+ * @example
1116
+ * ```ts
1117
+ * import { createSource } from '@orkestrel/guide'
1118
+ *
1119
+ * const source = createSource({
1120
+ * files: { 'src/core/Guide.ts': 'export class Guide {}\n' },
1121
+ * module: 'src/core',
1122
+ * })
1123
+ * source.exports() // [{ name: 'Guide', kind: 'class' }]
1124
+ * ```
1125
+ */
1126
+ function createSource(options) {
1127
+ return new Source(options);
1128
+ }
1129
+ /**
1130
+ * Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for
1131
+ * {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded
1132
+ * generator from one shape declaration (AGENTS §14).
1133
+ *
1134
+ * @returns A `SurfaceSymbol` contract bundling `schema` / `is` / `parse` / `generate`
1135
+ *
1136
+ * @example
1137
+ * ```ts
1138
+ * import { createSurfaceSymbolContract } from '@orkestrel/guide/core'
1139
+ *
1140
+ * const surfaceSymbol = createSurfaceSymbolContract()
1141
+ * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
1142
+ * ```
1143
+ */
1144
+ function createSurfaceSymbolContract() {
1145
+ return (0, _orkestrel_contract.createContract)(surfaceSymbolShape);
1146
+ }
1147
+ /**
1148
+ * Compile the {@link methodGroupShape} into a {@link ContractInterface} for
1149
+ * {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded
1150
+ * generator from one shape declaration (AGENTS §14).
1151
+ *
1152
+ * @returns A `MethodGroup` contract bundling `schema` / `is` / `parse` / `generate`
1153
+ *
1154
+ * @example
1155
+ * ```ts
1156
+ * import { createMethodGroupContract } from '@orkestrel/guide/core'
1157
+ *
1158
+ * const methodGroup = createMethodGroupContract()
1159
+ * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
1160
+ * ```
1161
+ */
1162
+ function createMethodGroupContract() {
1163
+ return (0, _orkestrel_contract.createContract)(methodGroupShape);
1164
+ }
1165
+ /**
1166
+ * Compile the {@link manifestEntryShape} into a {@link ContractInterface} for
1167
+ * {@link ManifestEntry} — a guard, coercing parser, JSON Schema, and seeded
1168
+ * generator from one shape declaration (AGENTS §14).
1169
+ *
1170
+ * @returns A `ManifestEntry` contract bundling `schema` / `is` / `parse` / `generate`
1171
+ *
1172
+ * @example
1173
+ * ```ts
1174
+ * import { createManifestEntryContract } from '@orkestrel/guide/core'
1175
+ *
1176
+ * const manifestEntry = createManifestEntryContract()
1177
+ * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
1178
+ * ```
1179
+ */
1180
+ function createManifestEntryContract() {
1181
+ return (0, _orkestrel_contract.createContract)(manifestEntryShape);
1182
+ }
1183
+ //#endregion
1184
+ exports.EXTERNAL_SCHEMES = EXTERNAL_SCHEMES;
1185
+ exports.Guide = Guide;
1186
+ exports.MANIFEST = MANIFEST;
1187
+ exports.METHODS = METHODS;
1188
+ exports.SURFACE = SURFACE;
1189
+ exports.Source = Source;
1190
+ exports.TESTS = TESTS;
1191
+ exports.cellLinks = cellLinks;
1192
+ exports.createGuide = createGuide;
1193
+ exports.createManifestEntryContract = createManifestEntryContract;
1194
+ exports.createMethodGroupContract = createMethodGroupContract;
1195
+ exports.createSource = createSource;
1196
+ exports.createSurfaceSymbolContract = createSurfaceSymbolContract;
1197
+ exports.declarationBody = declarationBody;
1198
+ exports.exampleMethods = exampleMethods;
1199
+ exports.examplesFrom = examplesFrom;
1200
+ exports.exportsFrom = exportsFrom;
1201
+ exports.extractLinks = extractLinks;
1202
+ exports.extractMethods = extractMethods;
1203
+ exports.extractPatterns = extractPatterns;
1204
+ exports.extractSurface = extractSurface;
1205
+ exports.extractTests = extractTests;
1206
+ exports.fenceImports = fenceImports;
1207
+ exports.findMissing = findMissing;
1208
+ exports.findUnexampled = findUnexampled;
1209
+ exports.firstCode = firstCode;
1210
+ exports.hiddenFrom = hiddenFrom;
1211
+ exports.identifierOf = identifierOf;
1212
+ exports.isExportKind = isExportKind;
1213
+ exports.isExternalLink = isExternalLink;
1214
+ exports.isManifestEntry = isManifestEntry;
1215
+ exports.isMethodGroup = isMethodGroup;
1216
+ exports.isSurfaceSymbol = isSurfaceSymbol;
1217
+ exports.joinHead = joinHead;
1218
+ exports.kindIndex = kindIndex;
1219
+ exports.manifestEntryShape = manifestEntryShape;
1220
+ exports.memberMethods = memberMethods;
1221
+ exports.methodGroupShape = methodGroupShape;
1222
+ exports.missingSymbols = missingSymbols;
1223
+ exports.moduleDirs = moduleDirs;
1224
+ exports.moduleKeys = moduleKeys;
1225
+ exports.parseManifest = parseManifest;
1226
+ exports.resolveLink = resolveLink;
1227
+ exports.sectionBlocks = sectionBlocks;
1228
+ exports.surfaceSymbolShape = surfaceSymbolShape;
1229
+ exports.symbolKey = symbolKey;
1230
+
1231
+ //# sourceMappingURL=index.cjs.map