@orkestrel/guide 0.0.8 → 0.0.9

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` projections.
29
+ * `links` / `tests` / `patterns` projections.
30
30
  *
31
31
  * @param source - The guide's markdown source text
32
32
  * @returns A working {@link GuideInterface}
@@ -50,7 +50,7 @@ export declare function createGuide(source: string): GuideInterface;
50
50
  *
51
51
  * @example
52
52
  * ```ts
53
- * import { createManifestEntryContract } from '@orkestrel/guide/core'
53
+ * import { createManifestEntryContract } from '@orkestrel/guide'
54
54
  *
55
55
  * const manifestEntry = createManifestEntryContract()
56
56
  * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
@@ -67,7 +67,7 @@ export declare function createManifestEntryContract(): ContractInterface<Manifes
67
67
  *
68
68
  * @example
69
69
  * ```ts
70
- * import { createMethodGroupContract } from '@orkestrel/guide/core'
70
+ * import { createMethodGroupContract } from '@orkestrel/guide'
71
71
  *
72
72
  * const methodGroup = createMethodGroupContract()
73
73
  * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
@@ -104,7 +104,7 @@ export declare function createSource(options: SourceOptions): SourceInterface;
104
104
  *
105
105
  * @example
106
106
  * ```ts
107
- * import { createSurfaceSymbolContract } from '@orkestrel/guide/core'
107
+ * import { createSurfaceSymbolContract } from '@orkestrel/guide'
108
108
  *
109
109
  * const surfaceSymbol = createSurfaceSymbolContract()
110
110
  * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
@@ -114,8 +114,9 @@ export declare function createSurfaceSymbolContract(): ContractInterface<Surface
114
114
 
115
115
  /**
116
116
  * The body lines of the named `export class` / `export interface` declaration
117
- * within one file's source text — everything between the head's opening `{`
118
- * and the column-0 closing `}`.
117
+ * within one file's source text — everything between a projected real head and
118
+ * projected column-0 closing `}`. Structural eligibility is projected while the
119
+ * corresponding returned body lines remain raw for JSDoc evidence.
119
120
  *
120
121
  * @param source - The file's source text to search
121
122
  * @param keyword - Whether to look for a `class` or an `interface`
@@ -143,8 +144,10 @@ export declare interface DeclarationHead {
143
144
 
144
145
  /**
145
146
  * The callable-member names in a declaration body (per {@link memberMethods}'
146
- * grammar) whose immediately preceding JSDoc block, within the same body,
147
- * carries `@example` — the member-level mirror of {@link examplesFrom}.
147
+ * grammar) whose immediately preceding eligible genuine JSDoc block, within
148
+ * the same body, carries `@example`. Shared adjacency comes from
149
+ * {@link extractExampleLines}; member membership is matched against aligned
150
+ * projected code.
148
151
  *
149
152
  * @param lines - A declaration's body lines
150
153
  * @returns The exemplified member names, deduped and sorted
@@ -158,9 +161,9 @@ export declare function exampleMethods(lines: readonly string[]): readonly strin
158
161
 
159
162
  /**
160
163
  * The exported functions in one file's source text whose immediately preceding
161
- * JSDoc block carries `@example` — walked line by line, tracking the current
162
- * comment block; the block resets on any non-comment, non-export line so an
163
- * `@example` never attaches to a declaration it does not directly precede.
164
+ * eligible genuine JSDoc block carries `@example`. Shared adjacency comes from
165
+ * {@link extractExampleLines}; exported-function membership is matched against
166
+ * the aligned code projection, so comment and template payload cannot qualify.
164
167
  *
165
168
  * @param source - The file's source text
166
169
  * @returns The exported function names with an `@example`, in file order
@@ -175,8 +178,10 @@ export declare function exampleMethods(lines: readonly string[]): readonly strin
175
178
  export declare function examplesFrom(source: string): readonly string[];
176
179
 
177
180
  /**
178
- * The declaration kind a documented / exported symbol carries — the half of the
179
- * bijection key (alongside its name) a `## Surface` table's `Kind` column encodes.
181
+ * The declaration kind a documented / exported symbol carries — exactly the
182
+ * five reflected `type`, `interface`, `const`, `function`, and `class` heads.
183
+ * Comment/template payload is excluded before reflection. `enum` is outside
184
+ * this population, not forbidden by general package policy.
180
185
  */
181
186
  export declare type ExportKind = 'type' | 'interface' | 'const' | 'function' | 'class';
182
187
 
@@ -185,6 +190,11 @@ export declare type ExportKind = 'type' | 'interface' | 'const' | 'function' | '
185
190
  * `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
186
191
  * by (kind, name). A generator export (`export function* walk`) scans as kind
187
192
  * `function` — its trailing `*` is stripped before the {@link ExportKind} check.
193
+ * Scanning uses {@link extractSourceLines}, so comment and template payload is
194
+ * excluded while its uninterrupted column-zero head remains required; preserved
195
+ * columns do not grant membership to leading/interrupted comment forms. The population is
196
+ * exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is
197
+ * outside this reflection contract, not forbidden by general package policy.
188
198
  *
189
199
  * @param source - The file's source text
190
200
  * @returns The file's exported symbols, in file order
@@ -204,6 +214,27 @@ export declare function exportsFrom(source: string): readonly SurfaceSymbol[];
204
214
  */
205
215
  export declare const EXTERNAL_SCHEMES: readonly string[];
206
216
 
217
+ /**
218
+ * Select the next physical record after an eligible genuine JSDoc whose final
219
+ * authoritative span carries an exact block-position `@example` tag. Title
220
+ * text is allowed. A leading whitespace-separated span chain is last-span
221
+ * authoritative; intervening source material severs association, while a
222
+ * leading JSDoc on the next record replaces pending state. Any other next
223
+ * physical record is returned once and consumes it. This parser walks aligned
224
+ * records without rescanning source syntax or applying declaration/member
225
+ * grammar.
226
+ *
227
+ * @param lines - Aligned physical source-line records
228
+ * @returns The immediately following candidate lines, in source order
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * extractExampleLines(extractSourceLines('/** @example *' + '/\nexport function walk() {}'))
233
+ * // the `export function walk() {}` SourceLine
234
+ * ```
235
+ */
236
+ export declare function extractExampleLines(lines: readonly SourceLine[]): readonly SourceLine[];
237
+
207
238
  /**
208
239
  * Every link href in the guide document, including table cells — a full,
209
240
  * depth-first walk of the whole AST.
@@ -247,6 +278,36 @@ export declare function extractMethods(document: MarkdownDocument): readonly Met
247
278
  */
248
279
  export declare function extractPatterns(document: MarkdownDocument): readonly string[];
249
280
 
281
+ /**
282
+ * Extract aligned physical source-line records in one character traversal.
283
+ * Real line and block comments and complete template tokens become spaces in
284
+ * {@link SourceLine.code}, while ordinary code, quoted strings, and recognized
285
+ * regex literals retain their columns. Genuine JSDoc opened from reflection
286
+ * code is retained span by span at its exact physical column in
287
+ * {@link SourceLine.jsdoc}; faux openers in comments and templates are
288
+ * excluded. Membership remains each consumer's separate anchored grammar.
289
+ *
290
+ * @remarks
291
+ * Regex recognition is a bounded lexical goal rather than TypeScript parser
292
+ * grammar. Literal ECMAScript Unicode identifiers participate in slash-state
293
+ * recognition, including private identifiers, without decoding escaped
294
+ * identifier spellings. Slash after bare `}` is division, and a post-brace
295
+ * regex statement requires an explicit `;`. General semicolonless
296
+ * declaration/ASI classification is outside this finite projector, so callers
297
+ * place an explicit `;` before a slash-leading statement after such a
298
+ * declaration.
299
+ *
300
+ * @param source - The TypeScript source text to project
301
+ * @returns One aligned terminator-free record per LF or CRLF physical line, including the final line
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * extractSourceLines('export const visible = true // note\n')
306
+ * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }, ...]
307
+ * ```
308
+ */
309
+ export declare function extractSourceLines(source: string): readonly SourceLine[];
310
+
250
311
  /**
251
312
  * Every `## Surface` identifier the guide documents — each table row's column 0
252
313
  * code span (the name) paired with its `Kind` column (located by header text)
@@ -282,7 +343,7 @@ export declare function extractTests(document: MarkdownDocument): readonly strin
282
343
  * Parse a fence's `import` statements into per-specifier imported identifier
283
344
  * names — handles `import type`, mixed multiline braces, and `x as y` aliases
284
345
  * (resolved to the local name `x`... the ORIGINAL exported name, since it is
285
- * the export that must exist in `source.exports()`).
346
+ * the export that must exist in the checked public/barrel surface).
286
347
  *
287
348
  * @param fence - A ```ts Patterns fence's verbatim body text
288
349
  * @returns One entry per `import ... from 'specifier'` statement, in fence order
@@ -346,9 +407,9 @@ export declare function findUnexampled(names: readonly string[], fences: readonl
346
407
  export declare function firstCode(nodes: readonly InlineNode[]): string | undefined;
347
408
 
348
409
  /**
349
- * A stateful, structured view over one parsed guide — the five documented
350
- * projections (`sections` / `surface` / `methods` / `links` / `tests`) are
351
- * extracted once at construction and cached.
410
+ * A stateful, structured view over one parsed guide — the six documented
411
+ * projections (`sections` / `surface` / `methods` / `links` / `tests` /
412
+ * `patterns`) are extracted once at construction and cached.
352
413
  *
353
414
  * @remarks
354
415
  * Pure: parses `source` once via `@orkestrel/markdown` and never touches the
@@ -358,7 +419,7 @@ export declare function firstCode(nodes: readonly InlineNode[]): string | undefi
358
419
  *
359
420
  * @example
360
421
  * ```ts
361
- * import { Guide } from '@orkestrel/guide/core'
422
+ * import { Guide } from '@orkestrel/guide'
362
423
  *
363
424
  * const guide = new Guide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
364
425
  * guide.surface() // [{ name: 'X', kind: 'class' }]
@@ -418,10 +479,28 @@ export declare interface GuideInterface {
418
479
  /**
419
480
  * The source scope a guide's manifest entry covers — one module directory, or
420
481
  * several when a layer guide spans multiple source directories (a core module
421
- * plus its backend implementations).
482
+ * plus its backend implementations). `'.'` is the canonical workspace-root
483
+ * directory; empty, trailing-slash, and dot-segment spellings canonicalize to
484
+ * the same value before reflection.
422
485
  */
423
486
  export declare type GuideModule = string | readonly string[];
424
487
 
488
+ /**
489
+ * Whether an opaque inventory key contains only canonical slash-separated
490
+ * segments. Empty, `.` and `..` segments are rejected without rewriting the
491
+ * key; ordinary dotfile segments remain valid.
492
+ *
493
+ * @param key - The opaque inventory key to inspect
494
+ * @returns `true` when every segment is canonical
495
+ *
496
+ * @example
497
+ * ```ts
498
+ * hasCanonicalSegments('src/.hidden.ts') // true
499
+ * hasCanonicalSegments('src/../alias.ts') // false
500
+ * ```
501
+ */
502
+ export declare function hasCanonicalSegments(key: string): boolean;
503
+
425
504
  /**
426
505
  * The module-scope declarations LACKING the `export` keyword in one file's
427
506
  * source text — the mirror image of {@link exportsFrom}'s grammar, anchored
@@ -430,7 +509,10 @@ export declare type GuideModule = string | readonly string[];
430
509
  * `const` / `interface` / `type`) — a module-scope `let` or `var` is a
431
510
  * different violation class (AGENTS §1 bans `var`; a bare `let` is not a
432
511
  * declaration kind this scanner's five-kind grammar covers) and is out of
433
- * this check's contract.
512
+ * this check's contract. Scanning uses {@link extractSourceLines}, so comment
513
+ * and template payload is excluded while its uninterrupted column-zero head
514
+ * remains required; preserved columns do not widen membership. `enum` is likewise outside this reflection population, not
515
+ * forbidden by general package policy.
434
516
  *
435
517
  * @param source - The file's source text
436
518
  * @returns The file's hidden (non-exported) symbols, in file order
@@ -593,7 +675,7 @@ export declare interface ManifestEntry {
593
675
  * @example
594
676
  * ```ts
595
677
  * import { createContract } from '@orkestrel/contract'
596
- * import { manifestEntryShape } from '@orkestrel/guide/core'
678
+ * import { manifestEntryShape } from '@orkestrel/guide'
597
679
  *
598
680
  * const manifestEntry = createContract(manifestEntryShape)
599
681
  * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
@@ -610,7 +692,8 @@ export declare const manifestEntryShape: ObjectShape<{
610
692
  * The member lines declaring a callable member: plain, `async`, generator
611
693
  * (`*`), and optional (`records?(`) methods all count; getters, setters,
612
694
  * `static` members, and `#` privates never do (their keyword or `#` breaks
613
- * the `name(` shape).
695
+ * the `name(` shape). Matching runs once over projected lines so commented
696
+ * method-like payload never becomes eligible.
614
697
  *
615
698
  * @param lines - A declaration's body lines
616
699
  * @returns The declared method names, deduped and sorted
@@ -640,7 +723,7 @@ export declare interface MethodGroup {
640
723
  * @example
641
724
  * ```ts
642
725
  * import { createContract } from '@orkestrel/contract'
643
- * import { methodGroupShape } from '@orkestrel/guide/core'
726
+ * import { methodGroupShape } from '@orkestrel/guide'
644
727
  *
645
728
  * const methodGroup = createContract(methodGroupShape)
646
729
  * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
@@ -673,74 +756,75 @@ export declare const METHODS: string;
673
756
  export declare function missingSymbols(symbols: readonly SurfaceSymbol[], source: readonly SurfaceSymbol[]): readonly string[];
674
757
 
675
758
  /**
676
- * A module scope normalized to its directory list — a single directory
677
- * becomes a one-element list so every scanner walks the same shape.
759
+ * A module scope normalized to its canonical directory list. `'.'` represents
760
+ * workspace root; empty, trailing, and dot-segment spellings reduce through
761
+ * {@link resolvePath}, and duplicates are removed in first-seen order.
678
762
  *
679
763
  * @param module - The module scope to normalize
680
764
  * @returns The directory list `module` denotes
681
765
  *
682
766
  * @example
683
767
  * ```ts
684
- * moduleDirs('src/core') // ['src/core']
685
- * moduleDirs(['src/core', 'src/browser']) // ['src/core', 'src/browser']
768
+ * normalizeDirectories('src/core') // ['src/core']
769
+ * normalizeDirectories(['src/core', 'src/browser']) // ['src/core', 'src/browser']
686
770
  * ```
687
771
  */
688
- export declare function moduleDirs(module: GuideModule): readonly string[];
772
+ export declare function normalizeDirectories(module: GuideModule): readonly string[];
689
773
 
690
774
  /**
691
- * The file inventory's keys belonging to a {@link GuideModule} scope, sorted —
692
- * a key belongs when it starts with one of the scope's directories, ends in
693
- * `.ts`, and is neither that directory's `index.ts` nor a `.test.ts` file.
775
+ * Parse a `## By concept` manifest table into its {@link ManifestEntry} rows —
776
+ * each row's Concept cell (flattened text), Spec / Tests cells (a single link
777
+ * href, resolved against `directory`), and Source cell (every link href,
778
+ * resolved against `directory`; Source links canonicalize through
779
+ * {@link normalizeDirectories}, one directory collapses to a `string`, and several become
780
+ * a `readonly string[]`). A row missing a concept, spec link, tests link, or
781
+ * source link is skipped as malformed.
694
782
  *
695
- * @param files - The workspace file inventory, root-relative path → file text
696
- * @param module - The module scope to filter to
697
- * @returns The scope's file keys, root-relative and sorted
783
+ * @param markdown - The manifest markdown source (e.g. `guides/README.md`'s content)
784
+ * @param directory - The root-relative directory containing the manifest
785
+ * @returns The manifest's entries, in row order
698
786
  *
699
787
  * @example
700
788
  * ```ts
701
- * moduleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']
789
+ * parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]
702
790
  * ```
703
791
  */
704
- export declare function moduleKeys(files: Readonly<Record<string, string>>, module: GuideModule): readonly string[];
792
+ export declare function parseManifest(markdown: string, directory: string): readonly ManifestEntry[];
705
793
 
706
794
  /**
707
- * Parse a `## By concept` manifest table into its {@link ManifestEntry} rows —
708
- * each row's Concept cell (flattened text), Spec / Tests cells (a single link
709
- * href, resolved against `base`), and Source cell (every link href, resolved
710
- * against `base`; one directory collapses to a `string`, several become a
711
- * `readonly string[]`). A row missing a concept, spec link, tests link, or
712
- * source link is skipped as malformed.
795
+ * Resolve a relative `target` from the directory containing a root-relative
796
+ * declaring `file`. A slashless file belongs to the workspace root; path
797
+ * reduction is delegated to {@link resolvePath}.
713
798
  *
714
- * @param markdown - The manifest markdown source (e.g. `guides/README.md`'s content)
715
- * @param base - A single directory name relative to the workspace root that the manifest's
716
- * links are resolved against (e.g. `'guides'`) — {@link resolveLink}'s arithmetic supports
717
- * only one path segment, so a deeper or nested base is not supported
718
- * @returns The manifest's entries, in row order
799
+ * @param file - The root-relative declaring file
800
+ * @param target - The relative link destination to resolve
801
+ * @returns The normalized path, retaining every excess leading parent
719
802
  *
720
803
  * @example
721
804
  * ```ts
722
- * parseManifest(readme, 'guides') // [{ concept: 'Markdown', spec: 'guides/src/markdown.md', ... }]
805
+ * resolveLink('guides/src/guide.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'
806
+ * resolveLink('index.ts', './root.ts') // 'root.ts'
723
807
  * ```
724
808
  */
725
- export declare function parseManifest(markdown: string, base: string): readonly ManifestEntry[];
809
+ export declare function resolveLink(file: string, target: string): string;
726
810
 
727
811
  /**
728
- * Resolve a relative link `target` against `from` and normalize the result — `from`
729
- * is treated as a file (its directory is everything before the last `/`) when it
730
- * carries a `/`, or as a bare directory itself when it does not; `.` segments drop
731
- * and `..` segments pop the preceding component, purely (no `node:path`).
812
+ * Resolve a relative `target` from a root-relative `directory`, normalizing
813
+ * forward-slash dot segments without filesystem or extension inference. A
814
+ * parent pops only a retained real component; every excess leading parent is
815
+ * preserved.
732
816
  *
733
- * @param from - The declaring guide path (a file) or manifest base (a directory)
734
- * @param target - The relative link destination to resolve
735
- * @returns The normalized, workspace-root-relative path
817
+ * @param directory - The root-relative directory to resolve from
818
+ * @param target - The relative target to resolve
819
+ * @returns The normalized path, or `'.'` when no segment remains, retaining every excess parent
736
820
  *
737
821
  * @example
738
822
  * ```ts
739
- * resolveLink('guides/src/markdown.md', '../../src/core/helpers.ts') // 'src/core/helpers.ts'
740
- * resolveLink('guides', '../src/core') // 'src/core'
823
+ * resolvePath('guides/src', '../../src/core/helpers.ts') // 'src/core/helpers.ts'
824
+ * resolvePath('.', '../../outside.ts') // '../../outside.ts'
741
825
  * ```
742
826
  */
743
- export declare function resolveLink(from: string, target: string): string;
827
+ export declare function resolvePath(directory: string, target: string): string;
744
828
 
745
829
  /**
746
830
  * The block nodes under the named `##` heading, up to the next `##`-or-higher
@@ -759,12 +843,42 @@ export declare function resolveLink(from: string, target: string): string;
759
843
  export declare function sectionBlocks(document: MarkdownDocument, heading: string): readonly BlockNode[];
760
844
 
761
845
  /**
762
- * A pure `SourceInterface` — reflects a module scope's exports and member
763
- * methods over a consumer-supplied file inventory (AGENTS §22, `PROPOSAL.md`
764
- * §7), using text-only line scanners rather than the TypeScript compiler API
765
- * or the filesystem. `Source` never touches disk: the consumer gathers the
766
- * inventory however their environment allows (`node:fs` in a Node script,
767
- * `import.meta.glob` in a browser/vitest run) and passes it in as `files`.
846
+ * The exact opaque file-inventory keys belonging under any canonical
847
+ * {@link GuideModule} directory, sorted. `'.'` selects canonical root-relative
848
+ * keys without accepting `/`, `./`, or `../` aliases. Every selected exact
849
+ * `index.ts` and every `.test.ts` key is excluded independent of scope order.
850
+ *
851
+ * @param files - The workspace file inventory, root-relative path → file text
852
+ * @param module - The module scope to filter to
853
+ * @returns The scope's file keys, root-relative and sorted
854
+ *
855
+ * @example
856
+ * ```ts
857
+ * selectModuleKeys({ 'src/core/Guide.ts': '', 'src/core/index.ts': '' }, 'src/core') // ['src/core/Guide.ts']
858
+ * ```
859
+ */
860
+ export declare function selectModuleKeys(files: Readonly<Record<string, string>>, module: GuideModule): readonly string[];
861
+
862
+ /**
863
+ * A pure `SourceInterface` — reflects a module scope's intentional direct
864
+ * declarations, conventional barrel-reachable surface, and member methods over
865
+ * a consumer-supplied file inventory, using text-only line scanners rather than
866
+ * the TypeScript compiler API or the filesystem. `Source` never touches disk:
867
+ * the consumer gathers the inventory however their environment allows
868
+ * (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) and
869
+ * passes it in as `files`. Conventional barrel traversal recurses through both
870
+ * exact workspace-root `index.ts` and nested `/index.ts` targets. `'.'` is the
871
+ * canonical workspace-root module, module spellings normalize once at
872
+ * construction, and exact opaque inventory keys are never rewritten; keys with
873
+ * empty, `.` or `..` segments stay outside both initial and resolved barrel
874
+ * inventory entrances after relative-row reduction; canonical parent hops
875
+ * remain valid. Source projection preserves columns without widening
876
+ * direct/hidden column-zero heads. Literal ECMAScript Unicode identifiers
877
+ * participate in bounded slash-state recognition without escape decoding.
878
+ * Regex recognition is bounded: slash after bare `}` is division, so a
879
+ * post-brace regex statement requires an explicit `;`. General semicolonless
880
+ * declaration/ASI classification is also outside the finite projector, so a
881
+ * slash-leading statement after such a declaration requires an explicit `;`.
768
882
  *
769
883
  * @example
770
884
  * ```ts
@@ -772,12 +886,14 @@ export declare function sectionBlocks(document: MarkdownDocument, heading: strin
772
886
  *
773
887
  * const source = new Source({
774
888
  * files: {
889
+ * 'src/core/index.ts': "export * from './Guide.js'\nexport * from './types.js'\n",
775
890
  * 'src/core/Guide.ts': 'export class Guide {}\n',
776
891
  * 'src/core/types.ts': 'export interface GuideInterface {\n\tsections(): void\n}\n',
777
892
  * },
778
893
  * module: 'src/core',
779
894
  * })
780
895
  * source.exports() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]
896
+ * source.surface() // [{ name: 'Guide', kind: 'class' }, { name: 'GuideInterface', kind: 'interface' }]
781
897
  * source.methods('GuideInterface') // ['sections']
782
898
  * source.exists('src/core/Guide.ts') // true
783
899
  * ```
@@ -786,6 +902,7 @@ export declare class Source implements SourceInterface {
786
902
  #private;
787
903
  constructor(options: SourceOptions);
788
904
  exports(): readonly SurfaceSymbol[];
905
+ surface(): readonly SurfaceSymbol[];
789
906
  methods(name: string): readonly string[];
790
907
  exists(relative: string): boolean;
791
908
  hidden(): readonly SurfaceSymbol[];
@@ -798,15 +915,71 @@ export declare class Source implements SourceInterface {
798
915
  * a pure view over a consumer-supplied file inventory (see {@link Source}).
799
916
  */
800
917
  export declare interface SourceInterface {
801
- /** Every module-scope export, including type-only, by (name, kind). */
918
+ /**
919
+ * Every direct declaration in the selected module keys matching
920
+ * `export (async )?(function*?|class|const|interface|type) Name`, by
921
+ * (name, kind). Module keys are `.ts` inventory keys under the selected
922
+ * directories, excluding each directory's exact root `index.ts` and every
923
+ * `*.test.ts` key. Inventory keys are exact opaque workspace-relative keys,
924
+ * must contain no empty, `.` or `..` segment, and are never normalized.
925
+ * Comment/template payload is excluded through a
926
+ * length-preserving projection, but membership still follows this consumer's
927
+ * uninterrupted column-zero declaration-head grammar. `enum`
928
+ * and other TypeScript export forms are outside this five-kind reflection
929
+ * population, not forbidden by general package policy.
930
+ */
802
931
  exports(): readonly SurfaceSymbol[];
932
+ /**
933
+ * Every declaration reachable from each selected module's conventional root
934
+ * `index.ts` through complete relative `.js` `export *` rows. Unlike
935
+ * {@link exports}, this inventories barrel reachability rather than all
936
+ * intentional direct declarations under the selected directories.
937
+ *
938
+ * @remarks
939
+ * This pure projection reads only the consumer-supplied inventory. A row must
940
+ * be equivalent to `export * from './target.js'`: its target is relative and
941
+ * ends in `.js`; either quote, surrounding whitespace, an optional semicolon,
942
+ * and an optional trailing line comment are accepted; the inactive quote
943
+ * delimiter remains target data. Comment and template spans are masked while
944
+ * valid code before or after them remains eligible; markers inside quoted
945
+ * target text remain data. Regex recognition is a bounded lexical goal rather
946
+ * than TypeScript parser grammar: a slash immediately after bare `}` is treated
947
+ * as division, so a post-brace regex statement needs an explicit `;`. General
948
+ * semicolonless declaration/ASI classification is also outside the finite
949
+ * projector, so callers use an explicit `;` before a slash-leading statement
950
+ * after such a declaration. Only the
951
+ * terminal `.js` becomes `.ts`, and that
952
+ * exact resolved inventory key is used only when its segments are canonical.
953
+ * Initial barrel keys must likewise be canonical; relative parent rows that
954
+ * reduce to canonical keys remain valid. Exact workspace-root `index.ts` and
955
+ * nested targets ending `/index.ts` recurse as barrels, with a
956
+ * per-computation visited set terminating cycles; other targets contribute
957
+ * direct declarations from `exportsFrom()`. Missing roots, missing targets, and
958
+ * unsupported export forms contribute no symbols while valid siblings continue.
959
+ * Repository policy, typechecking, and builds own validation; this is not
960
+ * filesystem or TypeScript resolution. The result is deduplicated by
961
+ * `symbolKey()`, retains same-name/different-kind symbols, sorts by name,
962
+ * computes lazily, and caches the same readonly array instance.
963
+ *
964
+ * @returns The conventional barrel-reachable surface
965
+ *
966
+ * @example
967
+ * ```ts
968
+ * source.surface() // [{ name: 'Guide', kind: 'class' }]
969
+ * ```
970
+ */
971
+ surface(): readonly SurfaceSymbol[];
803
972
  /** The call-signature members of the `class` / `interface` named `name`. */
804
973
  methods(name: string): readonly string[];
805
974
  /** Whether a workspace-root-relative path exists in the inventory. */
806
975
  exists(relative: string): boolean;
807
976
  /**
808
977
  * Every module-scope declaration LACKING the `export` keyword (AGENTS §5's
809
- * export-discipline reflection) — empty on a conforming module.
978
+ * export-discipline reflection) across the same projected physical code lines
979
+ * and five declaration kinds as {@link exports}. Comment/template payload and
980
+ * `enum` are outside this population; projection preserves physical columns
981
+ * but does not widen the uninterrupted column-zero declaration-head grammar.
982
+ * This does not forbid enums by general package policy. Empty on a conforming module.
810
983
  *
811
984
  * @example
812
985
  * ```ts
@@ -815,7 +988,10 @@ export declare interface SourceInterface {
815
988
  */
816
989
  hidden(): readonly SurfaceSymbol[];
817
990
  /**
818
- * The names of every exported function whose preceding JSDoc carries `@example`.
991
+ * The names of every exported function whose next-physical-record eligible
992
+ * genuine JSDoc chain ends in a span carrying an exact block-position
993
+ * `@example` tag. Title text is allowed; intervening material severs
994
+ * association.
819
995
  *
820
996
  * @example
821
997
  * ```ts
@@ -824,8 +1000,12 @@ export declare interface SourceInterface {
824
1000
  */
825
1001
  examples(): readonly string[];
826
1002
  /**
827
- * The members of the `class` / `interface` named `name` whose preceding JSDoc,
828
- * within the declaration body, carries `@example`.
1003
+ * The members of the `class` / `interface` named `name` whose immediately
1004
+ * preceding eligible genuine JSDoc chain, within the declaration body, ends
1005
+ * in a span carrying an exact block-position `@example` tag. Title text is
1006
+ * allowed; intervening material severs association. Declaration and callable
1007
+ * member eligibility comes from aligned projected code while genuine JSDoc
1008
+ * evidence retains its source columns.
829
1009
  *
830
1010
  * @example
831
1011
  * ```ts
@@ -835,6 +1015,21 @@ export declare interface SourceInterface {
835
1015
  examples(name: string): readonly string[];
836
1016
  }
837
1017
 
1018
+ /**
1019
+ * One terminator-free physical source line and its aligned reflection
1020
+ * projections. Every projection has the same length as {@link source}, and
1021
+ * every genuine JSDoc span retains its physical opener column; the final
1022
+ * physical line is present even when it is empty.
1023
+ */
1024
+ export declare interface SourceLine {
1025
+ /** The exact source characters, excluding the LF or CRLF terminator. */
1026
+ readonly source: string;
1027
+ /** Source code with comment and template spans replaced by aligned spaces. */
1028
+ readonly code: string;
1029
+ /** Every genuine JSDoc span at its exact source columns, or `undefined` when absent. */
1030
+ readonly jsdoc: string | undefined;
1031
+ }
1032
+
838
1033
  /**
839
1034
  * The construction input for a {@link Source} — a consumer-supplied file
840
1035
  * inventory (root-relative path → file text) plus the module scope to
@@ -843,9 +1038,9 @@ export declare interface SourceInterface {
843
1038
  * `Source` itself never touches disk.
844
1039
  */
845
1040
  export declare interface SourceOptions {
846
- /** The workspace's file inventory, root-relative path → file text. */
1041
+ /** The workspace's exact canonical-segment opaque inventory keys, root-relative path → text. */
847
1042
  readonly files: Readonly<Record<string, string>>;
848
- /** The source directory (or directories) this guide documents, root-relative. */
1043
+ /** The source directory (or directories) this guide documents; `'.'` is workspace root. */
849
1044
  readonly module: GuideModule;
850
1045
  }
851
1046
 
@@ -871,7 +1066,7 @@ export declare interface SurfaceSymbol {
871
1066
  * @example
872
1067
  * ```ts
873
1068
  * import { createContract } from '@orkestrel/contract'
874
- * import { surfaceSymbolShape } from '@orkestrel/guide/core'
1069
+ * import { surfaceSymbolShape } from '@orkestrel/guide'
875
1070
  *
876
1071
  * const surfaceSymbol = createContract(surfaceSymbolShape)
877
1072
  * surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true