@orkestrel/guide 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ export declare function cellLinks(cell: readonly InlineNode[]): readonly string[
26
26
  /**
27
27
  * Create a structured {@link GuideInterface} view over one guide's markdown
28
28
  * source — parses once and caches its `sections` / `surface` / `methods` /
29
- * `links` / `tests` / `patterns` projections.
29
+ * `links` / `tests` / `fences` projections.
30
30
  *
31
31
  * @param source - The guide's markdown source text
32
32
  * @returns A working {@link GuideInterface}
@@ -95,6 +95,26 @@ export declare function createMethodGroupContract(): ContractInterface<MethodGro
95
95
  */
96
96
  export declare function createSource(options: SourceOptions): SourceInterface;
97
97
 
98
+ /**
99
+ * Create a {@link SourceManagerInterface} that resolves the consumer's local
100
+ * import specifiers and shares one source view per module.
101
+ *
102
+ * @param options - The shared file inventory and specifier-to-module policy
103
+ * @returns A source manager over the supplied policy
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * import { createSourceManager } from '@orkestrel/guide'
108
+ *
109
+ * const sources = createSourceManager({
110
+ * files: { 'src/core/index.ts': "export * from './types.js'" },
111
+ * modules: { '@scope/package': 'src/core' },
112
+ * })
113
+ * sources.source('@scope/package')?.surface()
114
+ * ```
115
+ */
116
+ export declare function createSourceManager(options: SourceManagerOptions): SourceManagerInterface;
117
+
98
118
  /**
99
119
  * Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for
100
120
  * {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded
@@ -235,6 +255,20 @@ export declare const EXTERNAL_SCHEMES: readonly string[];
235
255
  */
236
256
  export declare function extractExampleLines(lines: readonly SourceLine[]): readonly SourceLine[];
237
257
 
258
+ /**
259
+ * Every fenced code block anywhere in the guide document. A full AST walk
260
+ * includes fences nested inside blockquotes and lists.
261
+ *
262
+ * @param document - The parsed guide document
263
+ * @returns Every fence's language and verbatim code, in document order
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * extractFences(document) // [{ language: 'ts', code: "import { X } from './x.js'\nX()" }]
268
+ * ```
269
+ */
270
+ export declare function extractFences(document: MarkdownDocument): readonly GuideFence[];
271
+
238
272
  /**
239
273
  * Every link href in the guide document, including table cells — a full,
240
274
  * depth-first walk of the whole AST.
@@ -264,20 +298,6 @@ export declare function extractLinks(document: MarkdownDocument): readonly strin
264
298
  */
265
299
  export declare function extractMethods(document: MarkdownDocument): readonly MethodGroup[];
266
300
 
267
- /**
268
- * Every ```ts fenced code block's body text anywhere in the guide document —
269
- * a full AST walk so a fence nested inside a blockquote or list still counts.
270
- *
271
- * @param document - The parsed guide document
272
- * @returns Every `ts`-lang fence's verbatim code, in walk order
273
- *
274
- * @example
275
- * ```ts
276
- * extractPatterns(document) // ["import { X } from './x.js'\nX()"]
277
- * ```
278
- */
279
- export declare function extractPatterns(document: MarkdownDocument): readonly string[];
280
-
281
301
  /**
282
302
  * Extract aligned physical source-line records in one character traversal.
283
303
  * Real line and block comments and complete template tokens become spaces in
@@ -353,10 +373,10 @@ export declare function extractTests(document: MarkdownDocument): readonly strin
353
373
  * fenceImports("import { a, b as c } from 'x'\n") // [{ specifier: 'x', names: ['a', 'b'] }]
354
374
  * ```
355
375
  */
356
- export declare function fenceImports(fence: string): readonly {
376
+ export declare function fenceImports(fence: string): ReadonlyArray<{
357
377
  specifier: string;
358
378
  names: readonly string[];
359
- }[];
379
+ }>;
360
380
 
361
381
  /**
362
382
  * The names present in `names` but absent from `source` — the set-difference
@@ -391,6 +411,22 @@ export declare function findMissing(names: readonly string[], source: readonly s
391
411
  */
392
412
  export declare function findUnexampled(names: readonly string[], fences: readonly string[], examples: readonly string[]): readonly string[];
393
413
 
414
+ /**
415
+ * The fences whose language is absent from the caller's listed languages.
416
+ * Untagged fences are always returned because they have no language to list.
417
+ *
418
+ * @param fences - The guide fences to check
419
+ * @param languages - The listed language tags
420
+ * @returns The unlisted fences in input order
421
+ *
422
+ * @example
423
+ * ```ts
424
+ * findUnlisted([{ language: 'typescript', code: 'walk()' }], ['ts'])
425
+ * // [{ language: 'typescript', code: 'walk()' }]
426
+ * ```
427
+ */
428
+ export declare function findUnlisted(fences: readonly GuideFence[], languages: readonly string[]): readonly GuideFence[];
429
+
394
430
  /**
395
431
  * The first code-span value found by descending an inline node list, following
396
432
  * into `emphasis` / `link` / `image` children — the extraction rule behind a
@@ -409,7 +445,7 @@ export declare function firstCode(nodes: readonly InlineNode[]): string | undefi
409
445
  /**
410
446
  * A stateful, structured view over one parsed guide — the six documented
411
447
  * projections (`sections` / `surface` / `methods` / `links` / `tests` /
412
- * `patterns`) are extracted once at construction and cached.
448
+ * `fences`) are extracted once at construction and cached.
413
449
  *
414
450
  * @remarks
415
451
  * Pure: parses `source` once via `@orkestrel/markdown` and never touches the
@@ -433,7 +469,15 @@ export declare class Guide implements GuideInterface {
433
469
  methods(): readonly MethodGroup[];
434
470
  links(): readonly string[];
435
471
  tests(): readonly string[];
436
- patterns(): readonly string[];
472
+ fences(): readonly GuideFence[];
473
+ }
474
+
475
+ /** One fenced code block projected from a guide document. */
476
+ export declare interface GuideFence {
477
+ /** The info-string language tag, or `undefined` when the fence is untagged. */
478
+ readonly language: string | undefined;
479
+ /** The fence's verbatim code body. */
480
+ readonly code: string;
437
481
  }
438
482
 
439
483
  /**
@@ -466,14 +510,15 @@ export declare interface GuideInterface {
466
510
  */
467
511
  tests(): readonly string[];
468
512
  /**
469
- * Every fenced `ts` code block's body text, whole document.
513
+ * Every fenced code block in the whole document, in document order — no
514
+ * language filter, so a consumer decides which languages its checks read.
470
515
  *
471
516
  * @example
472
517
  * ```ts
473
- * guide.patterns() // ["import { createGuide } from '@orkestrel/guide'"]
518
+ * guide.fences() // [{ language: 'ts', code: "import { createGuide } from '@orkestrel/guide'" }]
474
519
  * ```
475
520
  */
476
- patterns(): readonly string[];
521
+ fences(): readonly GuideFence[];
477
522
  }
478
523
 
479
524
  /**
@@ -755,6 +800,22 @@ export declare const METHODS: string;
755
800
  */
756
801
  export declare function missingSymbols(symbols: readonly SurfaceSymbol[], source: readonly SurfaceSymbol[]): readonly string[];
757
802
 
803
+ /**
804
+ * The stable cache key for a {@link GuideModule}. Directories normalize before
805
+ * joining, so equivalent module spellings share one key. The NUL separator
806
+ * cannot occur in filesystem-backed canonical-segment inventory keys, so no
807
+ * directory boundary can collide with directory text.
808
+ *
809
+ * @param module - The module scope to key
810
+ * @returns The normalized directories joined by NUL
811
+ *
812
+ * @example
813
+ * ```ts
814
+ * moduleKey(['src/core', 'src/browser']) // 'src/core\0src/browser'
815
+ * ```
816
+ */
817
+ export declare function moduleKey(module: GuideModule): string;
818
+
758
819
  /**
759
820
  * A module scope normalized to its canonical directory list. `'.'` represents
760
821
  * workspace root; empty, trailing, and dot-segment spellings reduce through
@@ -1009,7 +1070,7 @@ export declare interface SourceInterface {
1009
1070
  *
1010
1071
  * @example
1011
1072
  * ```ts
1012
- * source.examples('GuideInterface') // ['links', 'tests', 'patterns']
1073
+ * source.examples('GuideInterface') // ['fences', 'links', 'tests']
1013
1074
  * ```
1014
1075
  */
1015
1076
  examples(name: string): readonly string[];
@@ -1030,6 +1091,50 @@ export declare interface SourceLine {
1030
1091
  readonly jsdoc: string | undefined;
1031
1092
  }
1032
1093
 
1094
+ /**
1095
+ * Resolves a consumer-owned import-specifier policy into pure source views and
1096
+ * caches those views by module, so aliases for one module share one entity.
1097
+ * Unmapped specifiers remain foreign to the consumer and return `undefined`.
1098
+ *
1099
+ * @example
1100
+ * ```ts
1101
+ * import { SourceManager } from '@orkestrel/guide'
1102
+ *
1103
+ * const sources = new SourceManager({
1104
+ * files: { 'src/core/index.ts': "export * from './types.js'" },
1105
+ * modules: { '@scope/package': 'src/core' },
1106
+ * })
1107
+ * sources.source('@scope/package')?.surface()
1108
+ * ```
1109
+ */
1110
+ export declare class SourceManager implements SourceManagerInterface {
1111
+ #private;
1112
+ constructor(options: SourceManagerOptions);
1113
+ source(specifier: string): SourceInterface | undefined;
1114
+ }
1115
+
1116
+ /** A specifier resolver that shares one {@link SourceInterface} per module. */
1117
+ export declare interface SourceManagerInterface {
1118
+ /**
1119
+ * Resolve a mapped specifier to its shared source view.
1120
+ *
1121
+ * @param specifier - The import specifier to resolve
1122
+ * @returns Its source view, or `undefined` when the specifier is not mapped
1123
+ */
1124
+ source(specifier: string): SourceInterface | undefined;
1125
+ }
1126
+
1127
+ /**
1128
+ * The construction input for a {@link SourceManager}: one shared file inventory
1129
+ * plus the consumer's specifier-to-module policy.
1130
+ */
1131
+ export declare interface SourceManagerOptions {
1132
+ /** The workspace's exact canonical-segment opaque inventory keys, root-relative path → text. */
1133
+ readonly files: Readonly<Record<string, string>>;
1134
+ /** Each local import specifier mapped to the source module it exposes. */
1135
+ readonly modules: Readonly<Record<string, GuideModule>>;
1136
+ }
1137
+
1033
1138
  /**
1034
1139
  * The construction input for a {@link Source} — a consumer-supplied file
1035
1140
  * inventory (root-relative path → file text) plus the module scope to
@@ -29,6 +29,75 @@ var EXTERNAL_SCHEMES = Object.freeze([
29
29
  "tel:"
30
30
  ]);
31
31
  //#endregion
32
+ //#region src/core/validators.ts
33
+ /**
34
+ * Whether `value` is one of the five documented {@link ExportKind} literals — the
35
+ * guard behind extracting a Surface table's `Kind` cell into a typed symbol.
36
+ *
37
+ * @param value - The candidate value
38
+ * @returns `true` when `value` is a valid {@link ExportKind}
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * isExportKind('class') // true
43
+ * isExportKind('enum') // false
44
+ * ```
45
+ */
46
+ var isExportKind = literalOf("type", "interface", "const", "function", "class");
47
+ /**
48
+ * Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string
49
+ * paired with a valid {@link ExportKind}.
50
+ *
51
+ * @param value - The value to test
52
+ * @returns `true` when `value` is a well-formed {@link SurfaceSymbol}
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true
57
+ * isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false
58
+ * ```
59
+ */
60
+ var isSurfaceSymbol = recordOf({
61
+ name: isString,
62
+ kind: isExportKind
63
+ });
64
+ /**
65
+ * Whether `value` is a well-formed {@link MethodGroup} — a backticked
66
+ * `interface` name paired with its documented `methods`.
67
+ *
68
+ * @param value - The value to test
69
+ * @returns `true` when `value` is a well-formed {@link MethodGroup}
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
74
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
75
+ * ```
76
+ */
77
+ var isMethodGroup = recordOf({
78
+ interface: isString,
79
+ methods: arrayOf(isString)
80
+ });
81
+ /**
82
+ * Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`
83
+ * manifest row, its `source` accepting either a single directory or several.
84
+ *
85
+ * @param value - The value to test
86
+ * @returns `true` when `value` is a well-formed {@link ManifestEntry}
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
91
+ * isManifestEntry({ concept: 1 }) // false
92
+ * ```
93
+ */
94
+ var isManifestEntry = recordOf({
95
+ concept: isString,
96
+ spec: isString,
97
+ source: unionOf(isString, arrayOf(isString)),
98
+ tests: isString
99
+ });
100
+ //#endregion
32
101
  //#region src/core/helpers.ts
33
102
  /**
34
103
  * Extract aligned physical source-line records in one character traversal.
@@ -562,6 +631,23 @@ function normalizeDirectories(module) {
562
631
  return directories;
563
632
  }
564
633
  /**
634
+ * The stable cache key for a {@link GuideModule}. Directories normalize before
635
+ * joining, so equivalent module spellings share one key. The NUL separator
636
+ * cannot occur in filesystem-backed canonical-segment inventory keys, so no
637
+ * directory boundary can collide with directory text.
638
+ *
639
+ * @param module - The module scope to key
640
+ * @returns The normalized directories joined by NUL
641
+ *
642
+ * @example
643
+ * ```ts
644
+ * moduleKey(['src/core', 'src/browser']) // 'src/core\0src/browser'
645
+ * ```
646
+ */
647
+ function moduleKey(module) {
648
+ return normalizeDirectories(module).join("\0");
649
+ }
650
+ /**
565
651
  * The exact opaque file-inventory keys belonging under any canonical
566
652
  * {@link GuideModule} directory, sorted. `'.'` selects canonical root-relative
567
653
  * keys without accepting `/`, `./`, or `../` aliases. Every selected exact
@@ -622,6 +708,24 @@ function findMissing(names, source) {
622
708
  return names.filter((name) => !existing.has(name));
623
709
  }
624
710
  /**
711
+ * The fences whose language is absent from the caller's listed languages.
712
+ * Untagged fences are always returned because they have no language to list.
713
+ *
714
+ * @param fences - The guide fences to check
715
+ * @param languages - The listed language tags
716
+ * @returns The unlisted fences in input order
717
+ *
718
+ * @example
719
+ * ```ts
720
+ * findUnlisted([{ language: 'typescript', code: 'walk()' }], ['ts'])
721
+ * // [{ language: 'typescript', code: 'walk()' }]
722
+ * ```
723
+ */
724
+ function findUnlisted(fences, languages) {
725
+ const listed = new Set(languages);
726
+ return fences.filter((fence) => fence.language === void 0 || !listed.has(fence.language));
727
+ }
728
+ /**
625
729
  * The symbol-key set-difference between two symbol lists — `symbols` present but
626
730
  * absent from `source`, compared by {@link symbolKey} so a symbol can drift in
627
731
  * neither name nor kind.
@@ -844,77 +948,6 @@ function kindIndex(table) {
844
948
  }).trim() === "Kind") return index;
845
949
  }
846
950
  }
847
- //#endregion
848
- //#region src/core/validators.ts
849
- /**
850
- * Whether `value` is one of the five documented {@link ExportKind} literals — the
851
- * guard behind extracting a Surface table's `Kind` cell into a typed symbol.
852
- *
853
- * @param value - The candidate value
854
- * @returns `true` when `value` is a valid {@link ExportKind}
855
- *
856
- * @example
857
- * ```ts
858
- * isExportKind('class') // true
859
- * isExportKind('enum') // false
860
- * ```
861
- */
862
- var isExportKind = literalOf("type", "interface", "const", "function", "class");
863
- /**
864
- * Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string
865
- * paired with a valid {@link ExportKind}.
866
- *
867
- * @param value - The value to test
868
- * @returns `true` when `value` is a well-formed {@link SurfaceSymbol}
869
- *
870
- * @example
871
- * ```ts
872
- * isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true
873
- * isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false
874
- * ```
875
- */
876
- var isSurfaceSymbol = recordOf({
877
- name: isString,
878
- kind: isExportKind
879
- });
880
- /**
881
- * Whether `value` is a well-formed {@link MethodGroup} — a backticked
882
- * `interface` name paired with its documented `methods`.
883
- *
884
- * @param value - The value to test
885
- * @returns `true` when `value` is a well-formed {@link MethodGroup}
886
- *
887
- * @example
888
- * ```ts
889
- * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
890
- * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
891
- * ```
892
- */
893
- var isMethodGroup = recordOf({
894
- interface: isString,
895
- methods: arrayOf(isString)
896
- });
897
- /**
898
- * Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`
899
- * manifest row, its `source` accepting either a single directory or several.
900
- *
901
- * @param value - The value to test
902
- * @returns `true` when `value` is a well-formed {@link ManifestEntry}
903
- *
904
- * @example
905
- * ```ts
906
- * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
907
- * isManifestEntry({ concept: 1 }) // false
908
- * ```
909
- */
910
- var isManifestEntry = recordOf({
911
- concept: isString,
912
- spec: isString,
913
- source: unionOf(isString, arrayOf(isString)),
914
- tests: isString
915
- });
916
- //#endregion
917
- //#region src/core/parsers.ts
918
951
  /**
919
952
  * The module-scope exports declared in one file's source text — matches
920
953
  * `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
@@ -1372,22 +1405,27 @@ function exampleMethods(lines) {
1372
1405
  return Array.from(new Set(methods)).sort();
1373
1406
  }
1374
1407
  /**
1375
- * Every ```ts fenced code block's body text anywhere in the guide document —
1376
- * a full AST walk so a fence nested inside a blockquote or list still counts.
1408
+ * Every fenced code block anywhere in the guide document. A full AST walk
1409
+ * includes fences nested inside blockquotes and lists.
1377
1410
  *
1378
1411
  * @param document - The parsed guide document
1379
- * @returns Every `ts`-lang fence's verbatim code, in walk order
1412
+ * @returns Every fence's language and verbatim code, in document order
1380
1413
  *
1381
1414
  * @example
1382
1415
  * ```ts
1383
- * extractPatterns(document) // ["import { X } from './x.js'\nX()"]
1416
+ * extractFences(document) // [{ language: 'ts', code: "import { X } from './x.js'\nX()" }]
1384
1417
  * ```
1385
1418
  */
1386
- function extractPatterns(document) {
1387
- const patterns = [];
1388
- for (const node of walkNodes(document)) if (isCodeBlockNode(node) && node.lang === "ts") patterns.push(node.code);
1389
- return patterns;
1419
+ function extractFences(document) {
1420
+ const fences = [];
1421
+ for (const node of walkNodes(document)) if (isCodeBlockNode(node)) fences.push({
1422
+ language: node.lang,
1423
+ code: node.code
1424
+ });
1425
+ return fences;
1390
1426
  }
1427
+ //#endregion
1428
+ //#region src/core/parsers.ts
1391
1429
  /**
1392
1430
  * Parse a `## By concept` manifest table into its {@link ManifestEntry} rows —
1393
1431
  * each row's Concept cell (flattened text), Spec / Tests cells (a single link
@@ -1505,7 +1543,7 @@ var manifestEntryShape = objectShape({
1505
1543
  /**
1506
1544
  * A stateful, structured view over one parsed guide — the six documented
1507
1545
  * projections (`sections` / `surface` / `methods` / `links` / `tests` /
1508
- * `patterns`) are extracted once at construction and cached.
1546
+ * `fences`) are extracted once at construction and cached.
1509
1547
  *
1510
1548
  * @remarks
1511
1549
  * Pure: parses `source` once via `@orkestrel/markdown` and never touches the
@@ -1527,7 +1565,7 @@ var Guide = class {
1527
1565
  #methods;
1528
1566
  #links;
1529
1567
  #tests;
1530
- #patterns;
1568
+ #fences;
1531
1569
  constructor(source) {
1532
1570
  const document = createMarkdown(source).document;
1533
1571
  this.#sections = document.children.filter(isHeadingNode).filter((heading) => heading.level === 2).map((heading) => flattenText(heading).trim());
@@ -1535,7 +1573,7 @@ var Guide = class {
1535
1573
  this.#methods = extractMethods(document);
1536
1574
  this.#links = extractLinks(document);
1537
1575
  this.#tests = extractTests(document);
1538
- this.#patterns = extractPatterns(document);
1576
+ this.#fences = extractFences(document);
1539
1577
  }
1540
1578
  sections() {
1541
1579
  return this.#sections;
@@ -1552,12 +1590,12 @@ var Guide = class {
1552
1590
  tests() {
1553
1591
  return this.#tests;
1554
1592
  }
1555
- patterns() {
1556
- return this.#patterns;
1593
+ fences() {
1594
+ return this.#fences;
1557
1595
  }
1558
1596
  };
1559
1597
  //#endregion
1560
- //#region src/core/Source.ts
1598
+ //#region src/core/sources/Source.ts
1561
1599
  /**
1562
1600
  * A pure `SourceInterface` — reflects a module scope's intentional direct
1563
1601
  * declarations, conventional barrel-reachable surface, and member methods over
@@ -1716,11 +1754,52 @@ var Source = class {
1716
1754
  }
1717
1755
  };
1718
1756
  //#endregion
1757
+ //#region src/core/sources/SourceManager.ts
1758
+ /**
1759
+ * Resolves a consumer-owned import-specifier policy into pure source views and
1760
+ * caches those views by module, so aliases for one module share one entity.
1761
+ * Unmapped specifiers remain foreign to the consumer and return `undefined`.
1762
+ *
1763
+ * @example
1764
+ * ```ts
1765
+ * import { SourceManager } from '@orkestrel/guide'
1766
+ *
1767
+ * const sources = new SourceManager({
1768
+ * files: { 'src/core/index.ts': "export * from './types.js'" },
1769
+ * modules: { '@scope/package': 'src/core' },
1770
+ * })
1771
+ * sources.source('@scope/package')?.surface()
1772
+ * ```
1773
+ */
1774
+ var SourceManager = class {
1775
+ #files;
1776
+ #modules;
1777
+ #sources = /* @__PURE__ */ new Map();
1778
+ constructor(options) {
1779
+ this.#files = options.files;
1780
+ this.#modules = options.modules;
1781
+ }
1782
+ source(specifier) {
1783
+ if (!Object.hasOwn(this.#modules, specifier)) return void 0;
1784
+ const module = this.#modules[specifier];
1785
+ if (module === void 0) return void 0;
1786
+ const key = moduleKey(module);
1787
+ const existing = this.#sources.get(key);
1788
+ if (existing !== void 0) return existing;
1789
+ const source = new Source({
1790
+ files: this.#files,
1791
+ module
1792
+ });
1793
+ this.#sources.set(key, source);
1794
+ return source;
1795
+ }
1796
+ };
1797
+ //#endregion
1719
1798
  //#region src/core/factories.ts
1720
1799
  /**
1721
1800
  * Create a structured {@link GuideInterface} view over one guide's markdown
1722
1801
  * source — parses once and caches its `sections` / `surface` / `methods` /
1723
- * `links` / `tests` / `patterns` projections.
1802
+ * `links` / `tests` / `fences` projections.
1724
1803
  *
1725
1804
  * @param source - The guide's markdown source text
1726
1805
  * @returns A working {@link GuideInterface}
@@ -1758,6 +1837,27 @@ function createSource(options) {
1758
1837
  return new Source(options);
1759
1838
  }
1760
1839
  /**
1840
+ * Create a {@link SourceManagerInterface} that resolves the consumer's local
1841
+ * import specifiers and shares one source view per module.
1842
+ *
1843
+ * @param options - The shared file inventory and specifier-to-module policy
1844
+ * @returns A source manager over the supplied policy
1845
+ *
1846
+ * @example
1847
+ * ```ts
1848
+ * import { createSourceManager } from '@orkestrel/guide'
1849
+ *
1850
+ * const sources = createSourceManager({
1851
+ * files: { 'src/core/index.ts': "export * from './types.js'" },
1852
+ * modules: { '@scope/package': 'src/core' },
1853
+ * })
1854
+ * sources.source('@scope/package')?.surface()
1855
+ * ```
1856
+ */
1857
+ function createSourceManager(options) {
1858
+ return new SourceManager(options);
1859
+ }
1860
+ /**
1761
1861
  * Compile the {@link surfaceSymbolShape} into a {@link ContractInterface} for
1762
1862
  * {@link SurfaceSymbol} — a guard, coercing parser, JSON Schema, and seeded
1763
1863
  * generator from one shape declaration (AGENTS §14).
@@ -1812,6 +1912,6 @@ function createManifestEntryContract() {
1812
1912
  return createContract(manifestEntryShape);
1813
1913
  }
1814
1914
  //#endregion
1815
- export { EXTERNAL_SCHEMES, Guide, MANIFEST, METHODS, SURFACE, Source, TESTS, cellLinks, createGuide, createManifestEntryContract, createMethodGroupContract, createSource, createSurfaceSymbolContract, declarationBody, exampleMethods, examplesFrom, exportsFrom, extractExampleLines, extractLinks, extractMethods, extractPatterns, extractSourceLines, extractSurface, extractTests, fenceImports, findMissing, findUnexampled, firstCode, hasCanonicalSegments, hiddenFrom, identifierOf, isExportKind, isExternalLink, isManifestEntry, isMethodGroup, isSurfaceSymbol, joinHead, kindIndex, manifestEntryShape, memberMethods, methodGroupShape, missingSymbols, normalizeDirectories, parseManifest, resolveLink, resolvePath, sectionBlocks, selectModuleKeys, surfaceSymbolShape, symbolKey };
1915
+ export { EXTERNAL_SCHEMES, Guide, MANIFEST, METHODS, SURFACE, Source, SourceManager, TESTS, cellLinks, createGuide, createManifestEntryContract, createMethodGroupContract, createSource, createSourceManager, createSurfaceSymbolContract, declarationBody, exampleMethods, examplesFrom, exportsFrom, extractExampleLines, extractFences, extractLinks, extractMethods, extractSourceLines, extractSurface, extractTests, fenceImports, findMissing, findUnexampled, findUnlisted, firstCode, hasCanonicalSegments, hiddenFrom, identifierOf, isExportKind, isExternalLink, isManifestEntry, isMethodGroup, isSurfaceSymbol, joinHead, kindIndex, manifestEntryShape, memberMethods, methodGroupShape, missingSymbols, moduleKey, normalizeDirectories, parseManifest, resolveLink, resolvePath, sectionBlocks, selectModuleKeys, surfaceSymbolShape, symbolKey };
1816
1916
 
1817
1917
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orkestrel/guide",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Guides-parity test helpers — prove a package's guides are in bijection with the code they document: surface and methods bijection, link integrity, and non-vacuous extraction, built on @orkestrel/markdown. Part of the @orkestrel line.",
5
5
  "keywords": [
6
6
  "bijection",
@@ -55,10 +55,11 @@
55
55
  "format": "oxfmt --config .oxfmtrc.json --write .",
56
56
  "format:check": "oxfmt --config .oxfmtrc.json --check .",
57
57
  "lint:check": "oxlint --config .oxlintrc.json --deny-warnings .",
58
- "test": "npm run test:src && npm run test:policy && npm run test:guides",
58
+ "test": "npm run test:src && npm run test:policy && npm run test:config && npm run test:guides",
59
59
  "test:src": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
60
60
  "test:src:core": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
61
61
  "test:policy": "vitest run --config vite.config.ts --no-cache --reporter=dot --project policy",
62
+ "test:config": "vitest run --config vite.config.ts --no-cache --reporter=dot --project config",
62
63
  "test:guides": "vitest run --config vite.config.ts --reporter=dot --project guides",
63
64
  "build": "npm run clean && npm run build:src",
64
65
  "build:src": "npm run build:src:core",
@@ -66,13 +67,13 @@
66
67
  "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test"
67
68
  },
68
69
  "dependencies": {
69
- "@orkestrel/contract": "^0.0.11",
70
- "@orkestrel/markdown": "^0.0.8"
70
+ "@orkestrel/contract": "^0.0.12",
71
+ "@orkestrel/markdown": "^0.0.9"
71
72
  },
72
73
  "devDependencies": {
73
74
  "@microsoft/api-extractor": "^7.58.12",
74
- "@orkestrel/guide": "^0.0.9",
75
- "@orkestrel/scaffold": "^0.0.26",
75
+ "@orkestrel/scaffold": "^0.0.38",
76
+ "@orkestrel/test": "^0.0.6",
76
77
  "@types/node": "^26.1.2",
77
78
  "@vitest/browser-playwright": "^4.1.10",
78
79
  "oxfmt": "^0.62.0",