@orkestrel/guide 0.0.17 → 0.0.18

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,686 @@
1
+ /**
2
+ * Lists the declaration keywords a documented or exported symbol carries, in the order the
3
+ * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and
4
+ * `surfaceSymbolShape` all derive from.
5
+ *
6
+ * @remarks
7
+ * One frozen list feeds the type, the guard, and the shape, so a keyword cannot be admitted by one
8
+ * and refused by another. Comment and template payload is excluded before reflection, and `enum`
9
+ * is outside this population rather than forbidden by general package policy.
10
+ */
11
+ declare const EXPORT_KEYWORDS: readonly ("function" | "type" | "interface" | "const" | "class")[];
12
+
13
+ /**
14
+ * Represents the declaration keyword a documented / exported symbol carries — the reflected
15
+ * `type`, `interface`, `const`, `function`, and `class` heads, derived from
16
+ * {@link EXPORT_KEYWORDS} so the type, the guard, and the shape name one
17
+ * population. Comment/template payload is excluded before reflection.
18
+ * `enum` is outside this population, not forbidden by general package policy.
19
+ */
20
+ declare type ExportKeyword = (typeof EXPORT_KEYWORDS)[number];
21
+
22
+ /**
23
+ * Formats one finding with its guide prefix when needed.
24
+ *
25
+ * @param finding - The finding to format
26
+ * @returns The finding text with its spec prefix when the text does not already carry it
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })
31
+ * ```
32
+ */
33
+ export declare function formatGuideFinding(finding: ParityFinding): string;
34
+
35
+ /** Names the workspace-relative guide concept index. */
36
+ export declare const GUIDE_INDEX = "guides/README.md";
37
+
38
+ /** Names the package manifest read for native pitch selection. */
39
+ export declare const GUIDE_MANIFEST = "package.json";
40
+
41
+ /** Names the package README paired with its indexed guide pitch. */
42
+ export declare const GUIDE_README = "README.md";
43
+
44
+ /** Holds the native command usage text written for unsupported arguments. */
45
+ export declare const GUIDE_USAGE = "usage: npm run test:guides [-- --to guide|--to source]";
46
+
47
+ /**
48
+ * Drives native checking and explicit rewrites or registers package assertions in the guides
49
+ * worker.
50
+ *
51
+ * @param options - The workspace policy and direct host ports
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * import { GuideCommand } from '@orkestrel/guide/server'
56
+ * import { readInventory } from '@orkestrel/test/server'
57
+ * import { createVitest } from 'vitest/node'
58
+ *
59
+ * await new GuideCommand({
60
+ * root: new URL('../', import.meta.url),
61
+ * patterns: ['src/**\/*.ts', 'tests/**\/*.ts', 'guides/*.md', '*.md'],
62
+ * modules: { '@scope/widget': 'src/core' },
63
+ * languages: ['ts'],
64
+ * language: 'ts',
65
+ * reader: readInventory,
66
+ * runner: createVitest,
67
+ * }).execute(async ({ files, report, root, rows }) => {
68
+ * const { expect, it } = await import('vitest')
69
+ * it('checks the documented inventory', () => {
70
+ * expect(root.length).toBeGreaterThan(0)
71
+ * expect(Object.keys(files).length).toBeGreaterThan(0)
72
+ * expect(rows.length).toBeGreaterThan(0)
73
+ * expect(report.input).toEqual([])
74
+ * })
75
+ * })
76
+ * ```
77
+ */
78
+ export declare class GuideCommand implements GuideCommandInterface {
79
+ #private;
80
+ constructor(options: GuideCommandOptions);
81
+ /**
82
+ * Runs the native command or registers package assertions with fresh worker inventory and parity.
83
+ *
84
+ * @param register - The package-owned assertion registration callback
85
+ * @returns A promise that resolves after the selected command path finishes
86
+ * @throws When worker inventory reading or package assertion registration fails. Native failures
87
+ * are reported through stderr and process exit status before this promise resolves.
88
+ */
89
+ execute(register: GuideCommandHandler): Promise<void>;
90
+ }
91
+
92
+ /**
93
+ * Supplies fresh owned inventory, joined rows, and its generic parity result to package assertion
94
+ * setup.
95
+ */
96
+ export declare interface GuideCommandContext {
97
+ /** Holds the resolved native workspace root. */
98
+ readonly root: string;
99
+ /** Holds the owned root-relative, forward-slash path-to-text inventory. */
100
+ readonly files: Readonly<Record<string, string>>;
101
+ /** Lists the manifest rows joined to parsed guide and source views. */
102
+ readonly rows: readonly ParityRow[];
103
+ /** Holds the generic parity result over the same fresh inventory. */
104
+ readonly report: ParityResult;
105
+ }
106
+
107
+ /**
108
+ * Registers package assertions against the fresh worker context.
109
+ *
110
+ * @param context - The resolved root, owned inventory, joined rows, and parity result
111
+ * @returns A promise that resolves after assertion registration finishes
112
+ * @throws When package assertion registration fails
113
+ */
114
+ export declare type GuideCommandHandler = (context: GuideCommandContext) => Promise<void>;
115
+
116
+ /**
117
+ * Represents the server command's native and worker behavior.
118
+ */
119
+ export declare interface GuideCommandInterface {
120
+ /**
121
+ * Runs the native command or registers package assertions with fresh worker inventory and parity.
122
+ *
123
+ * @param register - The package-owned assertion registration callback
124
+ * @returns A promise that resolves after the selected command path finishes
125
+ * @throws When worker inventory reading or package assertion registration fails. Native failures
126
+ * are reported through stderr and process exit status before this promise resolves.
127
+ */
128
+ execute(register: GuideCommandHandler): Promise<void>;
129
+ }
130
+
131
+ /**
132
+ * Configures workspace policy and direct host ports for the reusable command.
133
+ */
134
+ export declare interface GuideCommandOptions {
135
+ /** Names the workspace root as a file URL or native path. */
136
+ readonly root: URL | string;
137
+ /** Lists the inventory globs the command expands from the workspace root. */
138
+ readonly patterns: readonly string[];
139
+ /** Maps each self import specifier to the source scope it exposes. */
140
+ readonly modules: Readonly<Record<string, GuideModule>>;
141
+ /** Lists every fence language the package admits. */
142
+ readonly languages: readonly string[];
143
+ /** Names the fence language inspected for examples and self imports. */
144
+ readonly language: string;
145
+ /**
146
+ * Supplies the host inventory reader directly. Native rewrite failures are reported through
147
+ * stderr and exit status; worker inventory failures reject `execute`.
148
+ */
149
+ readonly reader: GuideReadFunction;
150
+ /**
151
+ * Supplies the external guides-project runner factory directly. Creation, start, validation, and
152
+ * cleanup failures are reported through native stderr and exit status before `execute` resolves.
153
+ */
154
+ readonly runner: GuideRunnerFunction;
155
+ }
156
+
157
+ /**
158
+ * Represents one fenced code block projected from a guide document — its `language` is the
159
+ * fence's info-string tag and is absent when the fence is untagged, and its `title` is the
160
+ * flattened text of its nearest preceding heading.
161
+ */
162
+ declare interface GuideFence {
163
+ /** Holds the info-string language tag, or `undefined` when the fence is untagged. */
164
+ readonly language: string | undefined;
165
+ /** Holds the fence's verbatim code body. */
166
+ readonly code: string;
167
+ /**
168
+ * Holds the flattened text of the fence's nearest preceding heading, which pairs the fence
169
+ * with the `@example` block carrying that title; absent when no heading precedes it.
170
+ */
171
+ readonly title?: string;
172
+ }
173
+
174
+ /**
175
+ * Represents the structured, pure view of one parsed guide — every projection extracted and
176
+ * cached once at construction (see {@link createGuide}).
177
+ */
178
+ declare interface GuideInterface {
179
+ /**
180
+ * Lists the `##` heading names, in document order — the non-vacuousness guard for
181
+ * section presence.
182
+ *
183
+ * @returns The document's `##` heading names, in document order
184
+ */
185
+ sections(): readonly string[];
186
+ /**
187
+ * Returns the text of the blockquote following the document's H1 — the guide's tagline, or
188
+ * `undefined` when a heading intervenes first.
189
+ *
190
+ * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading
191
+ *
192
+ * @example Read a guide's tagline
193
+ * ```ts
194
+ * import { createGuide } from '@orkestrel/guide'
195
+ *
196
+ * const guide = createGuide('# Widget\n\n> A widget toolkit.\n\n## Surface\n')
197
+ * guide.tagline() // 'A widget toolkit.'
198
+ * ```
199
+ */
200
+ tagline(): string | undefined;
201
+ /**
202
+ * Lists every `## Surface` identifier + keyword — table rows union H3 entity headings whose
203
+ * trimmed compared inline content is exactly their backticked code-span name. Each row carries
204
+ * its `Summary` cell, located by header text, when the table has that column.
205
+ *
206
+ * @remarks
207
+ * Entries retain encounter order, and the first-seen name + keyword wins. A genuine entity
208
+ * heading before its matching class row keeps the heading's summary-less entry; a table row
209
+ * before that heading keeps its `Summary`.
210
+ *
211
+ * @returns The documented surface symbols, in encounter order
212
+ */
213
+ surface(): readonly SurfaceSymbol[];
214
+ /**
215
+ * Returns one {@link MethodGroup} per documented behavioral interface in `## Methods`, each
216
+ * row carrying its `Summary` cell.
217
+ *
218
+ * @returns One group per documented behavioral interface, in document order
219
+ */
220
+ methods(): readonly MethodGroup[];
221
+ /**
222
+ * Lists every `## Surface` or `## Methods` row whose first cell carries no code span — the
223
+ * rows {@link surface} and {@link methods} skip for want of a name, each entry being the
224
+ * row's cells joined by ` | `. Such a row reaches neither projection, so no bijection check
225
+ * can report it and this one names it instead. The `## Surface` rows come first, then the
226
+ * `## Methods` rows, each in document order.
227
+ *
228
+ * @returns One entry per row carrying no code-span name, in document order
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * guide.unnamed() // ['Widget | class | Represents a widget.']
233
+ * ```
234
+ */
235
+ unnamed(): readonly string[];
236
+ /**
237
+ * Lists every link href in the guide, including table cells.
238
+ *
239
+ * @returns Every link href in the guide, in walk order
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * guide.links() // ['../../src/core/helpers.ts']
244
+ * ```
245
+ */
246
+ links(): readonly string[];
247
+ /**
248
+ * Lists the relative test links declared under `## Tests`.
249
+ *
250
+ * @returns The `## Tests` section's link hrefs, in walk order
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * guide.tests() // ['../../tests/src/core/Guide.test.ts']
255
+ * ```
256
+ */
257
+ tests(): readonly string[];
258
+ /**
259
+ * Lists every fenced code block in the whole document, tagged or not, each carrying its
260
+ * nearest preceding heading as `title` — no language filter, so a consumer decides which
261
+ * languages its checks read.
262
+ *
263
+ * @returns Every fence's language, verbatim code, and nearest preceding heading title, in document order
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * guide.fences() // [{ language: 'ts', code: "import { createGuide } from '@orkestrel/guide'" }]
268
+ * ```
269
+ */
270
+ fences(): readonly GuideFence[];
271
+ }
272
+
273
+ /**
274
+ * Represents the source scope a guide's manifest entry covers — one module directory, or
275
+ * several when a layer guide spans multiple source directories (a core module
276
+ * plus its backend implementations). `'.'` is the canonical workspace-root
277
+ * directory; empty, trailing-slash, and dot-segment spellings canonicalize to
278
+ * the same value before reflection.
279
+ */
280
+ declare type GuideModule = string | readonly string[];
281
+
282
+ /**
283
+ * Reads a workspace inventory through the consumer's host reader.
284
+ *
285
+ * @param root - The workspace root as a file URL or native path
286
+ * @param targets - The root-relative files or directories to read
287
+ * @returns The root-relative, forward-slash path-to-text inventory
288
+ * @throws When the host cannot read a requested target. A native rewrite reports the error and
289
+ * raises the process exit status; a worker inventory error rejects `execute`.
290
+ */
291
+ export declare type GuideReadFunction = (root: URL | string, targets: readonly string[]) => Readonly<Record<string, string>>;
292
+
293
+ /**
294
+ * Creates a foreign guides-project runner whose consumed members Guide validates before use.
295
+ *
296
+ * @param mode - The fixed external runner mode
297
+ * @param options - The narrow guides-project options
298
+ * @returns The foreign runner value, whose consumed lifecycle members Guide validates
299
+ * @throws When runner creation fails. The native command reports the error and raises the process
300
+ * exit status before `execute` resolves.
301
+ */
302
+ export declare type GuideRunnerFunction = (mode: 'test', options: GuideRunnerOptions) => Promise<unknown>;
303
+
304
+ /**
305
+ * Defines the fixed guides-project runner invocation.
306
+ */
307
+ export declare interface GuideRunnerOptions {
308
+ /** Holds the resolved native workspace root. */
309
+ readonly root: string;
310
+ /** Names the resolved native Vite configuration path. */
311
+ readonly config: string;
312
+ /** Selects the guides project. */
313
+ readonly project: 'guides';
314
+ /** Selects the dot reporter. */
315
+ readonly reporters: 'dot';
316
+ /** Disables the external runner's cache. */
317
+ readonly cache: false;
318
+ /** Disables watch mode. */
319
+ readonly watch: false;
320
+ }
321
+
322
+ /**
323
+ * Represents one `## By concept` manifest row — a single guides-parity check target, paths
324
+ * normalized to workspace root.
325
+ */
326
+ declare interface ManifestEntry {
327
+ /** Holds the concept name — the row's first cell, flattened. */
328
+ readonly concept: string;
329
+ /** Names the guide `.md` this entry documents, root-relative. */
330
+ readonly spec: string;
331
+ /** Names the source directory (or directories) the guide documents. */
332
+ readonly source: GuideModule;
333
+ /** Names the tests directory the guide's `## Tests` links resolve against. */
334
+ readonly tests: string;
335
+ }
336
+
337
+ /**
338
+ * Reads an owned foreign result view and accepts passed modules without unhandled errors.
339
+ *
340
+ * @param result - The unknown external runner result to inspect
341
+ * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise
342
+ *
343
+ * @example
344
+ * ```ts
345
+ * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })
346
+ * ```
347
+ */
348
+ export declare function matchesGuideResult(result: unknown): boolean;
349
+
350
+ /**
351
+ * Represents one documented method — its identifier plus the description paragraph the guide's
352
+ * `Summary` cell and the member's doc block are compared on.
353
+ */
354
+ declare interface MethodEntry {
355
+ /** Holds the method's identifier. */
356
+ readonly name: string;
357
+ /** Holds the normalized description paragraph this side carries, or is absent when it carries none. */
358
+ readonly summary?: string;
359
+ }
360
+
361
+ /**
362
+ * Represents one behavioral interface a guide's `## Methods` section documents — the H4
363
+ * heading naming that interface as a code span, and the member entries its table lists.
364
+ */
365
+ declare interface MethodGroup {
366
+ /** Holds the backticked interface name. */
367
+ readonly interface: string;
368
+ /** Lists the group's documented Method-cell entries, in table order. */
369
+ readonly methods: readonly MethodEntry[];
370
+ }
371
+
372
+ /**
373
+ * Represents the destination an explicit parity rewrite updates.
374
+ */
375
+ declare type ParityDirection = 'guide' | 'source';
376
+
377
+ /**
378
+ * Groups executable-example findings by their independent evidence populations.
379
+ */
380
+ declare interface ParityExampleResult {
381
+ /** Lists findings for absence of a fence in the configured example language. */
382
+ readonly fences: readonly ParityFinding[];
383
+ /** Lists documented functions without example evidence. */
384
+ readonly functions: readonly ParityFinding[];
385
+ /** Lists documented methods without example evidence. */
386
+ readonly methods: readonly ParityFinding[];
387
+ /** Lists missing top-level guide/source title intersections. */
388
+ readonly titles: readonly ParityFinding[];
389
+ }
390
+
391
+ /**
392
+ * Represents a preformatted guides-parity finding.
393
+ */
394
+ declare interface ParityFinding {
395
+ /** Names the guide or inventory key the finding belongs to. */
396
+ readonly spec?: string;
397
+ /** Holds the complete developer-facing finding text. */
398
+ readonly text: string;
399
+ }
400
+
401
+ /**
402
+ * Groups independently assertable guides-parity findings by subject.
403
+ */
404
+ declare interface ParityResult {
405
+ /** Lists missing or unusable manifest inputs. */
406
+ readonly input: readonly ParityFinding[];
407
+ /** Lists required-section and documented method-group population findings. */
408
+ readonly sections: readonly ParityFinding[];
409
+ /** Lists documented-surface and barrel-surface findings. */
410
+ readonly surface: readonly ParityFinding[];
411
+ /** Lists behavioral-interface and implementing-class findings. */
412
+ readonly methods: readonly ParityFinding[];
413
+ /** Lists documented-group and source-driven behavioral declaration findings. */
414
+ readonly declarations: readonly ParityFinding[];
415
+ /** Lists unresolved relative guide links. */
416
+ readonly links: readonly ParityFinding[];
417
+ /** Lists missing or vacant documented test links. */
418
+ readonly tests: readonly ParityFinding[];
419
+ /** Lists unadmitted fence languages. */
420
+ readonly fences: readonly ParityFinding[];
421
+ /** Groups executable-example findings by evidence population. */
422
+ readonly examples: ParityExampleResult;
423
+ /** Lists mapped self imports that do not resolve to public exports. */
424
+ readonly imports: readonly ParityFinding[];
425
+ /** Lists categorized summary and titled-example disagreements. */
426
+ readonly drift: readonly ParityFinding[];
427
+ /** Lists README pitch and guide-tagline disagreements. */
428
+ readonly pitch: readonly ParityFinding[];
429
+ }
430
+
431
+ /**
432
+ * Represents a manifest row joined to its parsed guide and reflected source.
433
+ */
434
+ declare interface ParityRow {
435
+ /** Holds the manifest row. */
436
+ readonly entry: ManifestEntry;
437
+ /** Holds the parsed guide view. */
438
+ readonly guide: GuideInterface;
439
+ /** Holds the reflected source view. */
440
+ readonly source: SourceInterface;
441
+ }
442
+
443
+ /**
444
+ * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.
445
+ *
446
+ * @param args - The arguments after the native command entry
447
+ * @returns The requested destination, or `undefined` when the shape is unsupported
448
+ *
449
+ * @example
450
+ * ```ts
451
+ * parseGuideDirection(['--to', 'guide'])
452
+ * ```
453
+ */
454
+ export declare function parseGuideDirection(args: readonly string[]): ParityDirection | undefined;
455
+
456
+ /**
457
+ * Reads the bare package name from package manifest JSON.
458
+ *
459
+ * @param manifest - The package manifest JSON text
460
+ * @returns The name after its final scope separator, or `undefined` when no name is declared
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * parsePackageName('{"name":"@scope/widget"}')
465
+ * ```
466
+ */
467
+ export declare function parsePackageName(manifest: string): string | undefined;
468
+
469
+ /**
470
+ * Resolves a command root to a native absolute path.
471
+ *
472
+ * @param root - The workspace root as a file URL or native path
473
+ * @returns The native absolute workspace path
474
+ *
475
+ * @example
476
+ * ```ts
477
+ * resolveGuideRoot('/workspace')
478
+ * ```
479
+ */
480
+ export declare function resolveGuideRoot(root: URL | string): string;
481
+
482
+ /**
483
+ * Selects the indexed guide matching a package's bare name.
484
+ *
485
+ * @param entries - The concept-index entries to search
486
+ * @param name - The package's bare name, or `undefined` when none was parsed
487
+ * @returns The indexed own-guide path, or `undefined` when the index carries none
488
+ *
489
+ * @example
490
+ * ```ts
491
+ * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')
492
+ * ```
493
+ */
494
+ export declare function selectGuidePitch(entries: readonly ManifestEntry[], name: string | undefined): string | undefined;
495
+
496
+ /**
497
+ * Represents one `@example` block read from a doc comment — the declaration it documents, its
498
+ * pairing title, its code, and its fence language.
499
+ */
500
+ declare interface SourceExample {
501
+ /** Names the declaration or member whose doc block carries the block. */
502
+ readonly name: string;
503
+ /** Holds the text after the `@example` tag, which pairs the block with the guide fence under the heading of that text; absent when the tag carries none. */
504
+ readonly title?: string;
505
+ /** Holds the block's code — the body of its fence, or the whole block when it carries no fence. */
506
+ readonly code: string;
507
+ /** Holds the info-string language of the block's fence, or is absent when the block carries no fence. */
508
+ readonly language?: string;
509
+ }
510
+
511
+ /**
512
+ * Represents the reflected source truth a guide's documented surface is checked against —
513
+ * a pure view over a consumer-supplied file inventory (see {@link Source}).
514
+ */
515
+ declare interface SourceInterface {
516
+ /**
517
+ * Lists every direct declaration in the selected module keys matching
518
+ * `export (async )?(function*?|class|const|interface|type) Name`, by (name, keyword).
519
+ *
520
+ * @remarks
521
+ * Module keys are `.ts` inventory keys under the selected directories, excluding each directory's
522
+ * exact root `index.ts` and every `*.test.ts` key. Inventory keys are exact opaque
523
+ * workspace-relative keys, must contain no empty, `.` or `..` segment, and are never normalized.
524
+ * Comment/template payload is excluded through a length-preserving projection, but membership
525
+ * still follows this consumer's uninterrupted column-zero declaration-head grammar. `enum` and
526
+ * other TypeScript export forms are outside this declaration-keyword reflection population, not
527
+ * forbidden by general package policy.
528
+ *
529
+ * @returns The selected modules' direct declarations, deduplicated and sorted by name
530
+ */
531
+ exports(): readonly SurfaceSymbol[];
532
+ /**
533
+ * Lists every declaration reachable from each selected module's conventional root
534
+ * `index.ts` through complete relative `.js` `export *` rows. Unlike
535
+ * {@link exports}, this inventories barrel reachability rather than all
536
+ * intentional direct declarations under the selected directories.
537
+ *
538
+ * @remarks
539
+ * This pure projection reads only the consumer-supplied inventory. A row must
540
+ * be equivalent to `export * from './target.js'`: its target is relative and
541
+ * ends in `.js`; either quote, surrounding whitespace, an optional semicolon,
542
+ * and an optional trailing line comment are accepted; the inactive quote
543
+ * delimiter remains target data. Comment and template spans are masked while
544
+ * valid code before or after them remains eligible; markers inside quoted
545
+ * target text remain data. Regex recognition is a bounded lexical goal rather
546
+ * than TypeScript parser grammar: a slash immediately after bare `}` is treated
547
+ * as division, so a post-brace regex statement needs an explicit `;`. General
548
+ * semicolonless declaration/ASI classification is also outside the finite
549
+ * projector, so callers use an explicit `;` before a slash-leading statement
550
+ * after such a declaration. Only the
551
+ * terminal `.js` becomes `.ts`, and that
552
+ * exact resolved inventory key is used only when its segments are canonical.
553
+ * Initial barrel keys must likewise be canonical; relative parent rows that
554
+ * reduce to canonical keys remain valid. Exact workspace-root `index.ts` and
555
+ * nested targets ending `/index.ts` recurse as barrels, with a
556
+ * per-computation visited set terminating cycles; other targets contribute
557
+ * direct declarations from `extractExports()`. Missing roots, missing targets, and
558
+ * unsupported export forms contribute no symbols while valid siblings continue.
559
+ * Repository policy, typechecking, and builds own validation; this is not
560
+ * filesystem or TypeScript resolution. The result is deduplicated by
561
+ * `computeSymbolKey()`, retains same-name/different-keyword symbols, sorts by name,
562
+ * computes lazily, and caches the same readonly array instance.
563
+ *
564
+ * @returns The conventional barrel-reachable surface
565
+ *
566
+ * @example
567
+ * ```ts
568
+ * source.surface() // [{ name: 'Guide', keyword: 'class' }]
569
+ * ```
570
+ */
571
+ surface(): readonly SurfaceSymbol[];
572
+ /**
573
+ * Returns the call-signature members of the `class` / `interface` named `name`, unioned with
574
+ * those of every declaration it extends within the module scope, each with its own doc
575
+ * block's description paragraph. The first file declaring the name answers for it.
576
+ *
577
+ * @remarks
578
+ * One declaration answers for `name`: the module scope's files are read in
579
+ * sorted key order and the first one whose located head has a body or has
580
+ * bases supplies both the members and the bases, so a second file
581
+ * declaring the same name adds nothing; a head with neither a body nor
582
+ * bases does not count as declared, so an empty `export interface X {}`
583
+ * is skipped and resolution continues to a later file or falls through to
584
+ * a same-named class. Resolution reads that head's `extends` clause and follows it
585
+ * through this same module scope, keeping the keyword it started from: an
586
+ * `interface` chain resolves through interfaces and a `class` chain through
587
+ * classes, so a class's `implements` clause is outside the walk. A base the
588
+ * scope does not declare — imported from another package, written as a
589
+ * qualified name, or declared outside the selected directories —
590
+ * contributes no members and is not an error. One visited set per call
591
+ * collapses a cycle and a diamond to a single visit.
592
+ *
593
+ * @param name - The declaration's identifier
594
+ * @returns Its declared and inherited members, each with its doc block's description paragraph, deduplicated by name and sorted, a class `constructor` excluded
595
+ */
596
+ methods(name: string): readonly MethodEntry[];
597
+ /**
598
+ * Checks whether a workspace-root-relative path names a file or a directory present
599
+ * in the inventory.
600
+ *
601
+ * @remarks
602
+ * A directory counts so a guide's link to a directory resolves.
603
+ *
604
+ * @param relative - The workspace-root-relative path to look up
605
+ * @returns True if the inventory holds that exact key or any key beneath it; false otherwise
606
+ */
607
+ exists(relative: string): boolean;
608
+ /**
609
+ * Lists every module-scope declaration lacking the `export` keyword — the
610
+ * export-discipline reflection `.claude/rules/architecture.md` § Barrel exports
611
+ * states — across the same projected physical code lines and declaration
612
+ * keywords as {@link exports}. Comment/template payload and
613
+ * `enum` are outside this population; projection preserves physical columns
614
+ * but does not widen the uninterrupted column-zero declaration-head grammar.
615
+ * This does not forbid enums by general package policy. Empty on a conforming module.
616
+ *
617
+ * @returns The module scope's non-exported declarations, deduplicated and sorted by name
618
+ *
619
+ * @example
620
+ * ```ts
621
+ * source.hidden() // []
622
+ * ```
623
+ */
624
+ hidden(): readonly SurfaceSymbol[];
625
+ /**
626
+ * Lists every `@example` block carried by an exported declaration head — a `type`,
627
+ * `interface`, `const`, `function`, or `class` head at column zero — whose
628
+ * next-physical-record eligible genuine JSDoc chain ends in a span holding an `@example` tag
629
+ * opening a line at its first non-blank column. Each block carries its title, its fence
630
+ * language, and its code; intervening material severs association. A member's block belongs
631
+ * to the `name` overload instead.
632
+ *
633
+ * @returns The exported declaration heads' `@example` blocks, in first-seen order
634
+ *
635
+ * @example
636
+ * ```ts
637
+ * source.examples() // [{ name: 'createGuide', code: "createGuide('# Guide')" }]
638
+ * ```
639
+ */
640
+ examples(): readonly SourceExample[];
641
+ /**
642
+ * Lists every `@example` block carried by a member of the `class` / `interface` named
643
+ * `name` whose immediately preceding eligible genuine JSDoc chain, within the declaration
644
+ * body, ends in a span holding an `@example` tag opening a line at its first non-blank column.
645
+ * Each block carries its title, its fence language, and its code; intervening material severs
646
+ * association. Declaration and callable
647
+ * member eligibility comes from aligned projected code while genuine JSDoc
648
+ * evidence retains its source columns. The head's own block belongs to the
649
+ * no-argument overload instead.
650
+ *
651
+ * @remarks
652
+ * This overload reads only the named declaration's own body, in the first
653
+ * file that declares it, under each keyword. Unlike {@link methods}, the
654
+ * overload follows no `extends` clause, so an inherited member's `@example`
655
+ * belongs to the base that declares it.
656
+ *
657
+ * @param name - The declaration's identifier
658
+ * @returns Its own members' `@example` blocks, deduplicated by name and title and sorted by name
659
+ *
660
+ * @example
661
+ * ```ts
662
+ * source.examples('GuideInterface') // [{ name: 'fences', code: 'guide.fences()' }]
663
+ * ```
664
+ */
665
+ examples(name: string): readonly SourceExample[];
666
+ }
667
+
668
+ /**
669
+ * Represents one documented / exported symbol — its identifier, its declaration keyword, and
670
+ * the description paragraph the guide and the doc block are compared on.
671
+ */
672
+ declare interface SurfaceSymbol {
673
+ /** Holds the symbol's identifier. */
674
+ readonly name: string;
675
+ /** Holds the symbol's declaration keyword — half of the bijection key alongside {@link name}. */
676
+ readonly keyword: ExportKeyword;
677
+ /**
678
+ * Holds the normalized description paragraph this side carries — a guide table's `Summary`
679
+ * cell, or a doc block's text before its first block tag — and is absent when this side
680
+ * carries none. Optional, so a hand-built symbol stays valid; {@link computeSymbolKey} never
681
+ * reads it.
682
+ */
683
+ readonly summary?: string;
684
+ }
685
+
686
+ export { }