@orkestrel/guide 0.0.17 → 0.0.19

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.
@@ -1,15 +1,282 @@
1
1
  import { ArrayShape } from '@orkestrel/contract';
2
- import { BlockNode } from '@orkestrel/markdown';
3
- import { ContractInterface } from '@orkestrel/contract';
4
- import { Guard } from '@orkestrel/contract';
5
- import { InlineNode } from '@orkestrel/markdown';
2
+ import type { BlockNode } from '@orkestrel/markdown';
3
+ import type { CodeBlockNode } from '@orkestrel/markdown';
4
+ import type { ContractInterface } from '@orkestrel/contract';
5
+ import type { Guard } from '@orkestrel/contract';
6
+ import type { InlineNode } from '@orkestrel/markdown';
6
7
  import { LiteralShape } from '@orkestrel/contract';
7
- import { MarkdownDocument } from '@orkestrel/markdown';
8
+ import type { MarkdownDocument } from '@orkestrel/markdown';
9
+ import type { MarkdownSpan } from '@orkestrel/markdown';
8
10
  import { ObjectShape } from '@orkestrel/contract';
11
+ import { OptionalShape } from '@orkestrel/contract';
9
12
  import { StringShape } from '@orkestrel/contract';
10
- import { TableNode } from '@orkestrel/markdown';
13
+ import type { TableNode } from '@orkestrel/markdown';
11
14
  import { UnionShape } from '@orkestrel/contract';
12
15
 
16
+ /**
17
+ * Builds one table cell's inline content from its compared text — the inverse of
18
+ * {@link extractCellText}. A single-backtick run whose text carries no inner backtick and
19
+ * neither a leading nor a trailing space becomes a code span; every other character, a backtick
20
+ * included, becomes literal text, which `renderMarkdown` escapes so the rendered cell parses back
21
+ * to the text this function was given.
22
+ *
23
+ * @remarks
24
+ * The compared form spells every code span with one backtick per side, because
25
+ * {@link extractCellText} emits `` `${value}` `` whatever delimiter the source used. A run this
26
+ * function refuses is therefore a run no parsed cell produced, and emitting it as text is what
27
+ * keeps the projection total: reading the rendered cell back through {@link extractCellText}
28
+ * returns the text, so a rendered row and a hand-written row compare the same. A code span whose
29
+ * own text carries a backtick or a boundary space is outside the compared form's fidelity in
30
+ * either direction, and this function writes it as text rather than guessing a delimiter.
31
+ *
32
+ * @param text - The cell's compared text, as {@link extractCellText} returns it
33
+ * @returns The cell's inline nodes, in text order
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * buildCell('Holds a `Widget`.')
38
+ * // [{ element: 'text', value: 'Holds a ' }, { element: 'codeSpan', value: 'Widget' }, { element: 'text', value: '.' }]
39
+ * ```
40
+ */
41
+ export declare function buildCell(text: string): readonly InlineNode[];
42
+
43
+ /**
44
+ * Builds one genuine JSDoc span from its content lines — the inverse of {@link unwrapComment}.
45
+ * Each line is emitted at `indent` behind a continuation marker, an empty line as the bare
46
+ * marker so no line carries trailing whitespace, and the leading and trailing empty lines are
47
+ * dropped because the opener and the closer take those physical lines.
48
+ *
49
+ * @param lines - The span's content lines, as {@link unwrapComment} returns them
50
+ * @param indent - The whitespace the span opens at
51
+ * @returns The span's raw text, opener and closer included
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * buildComment(['Walks.'], '') // '/**\n * Walks.\n *' + '/'
56
+ * ```
57
+ */
58
+ export declare function buildComment(lines: readonly string[], indent: string): string;
59
+
60
+ /**
61
+ * Builds the fenced code block one `@example` block renders as — its code inside a fence
62
+ * carrying its language, and an untagged fence when the block names none.
63
+ *
64
+ * @param example - The block to render
65
+ * @returns The fence node
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * buildFence({ name: 'walk', code: 'walk()', language: 'ts' }) // { element: 'codeBlock', code: 'walk()', lang: 'ts' }
70
+ * ```
71
+ */
72
+ export declare function buildFence(example: SourceExample): CodeBlockNode;
73
+
74
+ /**
75
+ * Builds a copy of `table` with one cell's inline content rebuilt from `text` through
76
+ * {@link buildCell}. Every other cell keeps its own nodes, so a rewrite touches the one cell it
77
+ * names and the header and the alignment row travel unchanged.
78
+ *
79
+ * @param table - The table to copy
80
+ * @param row - The index of the row to rewrite within {@link TableNode.rows}
81
+ * @param column - The index of the cell to rewrite within that row
82
+ * @param text - The cell's new compared text
83
+ * @returns The rewritten table
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * buildTable(table, 0, 2, 'Walks the tree.').rows[0]?.[2] // [{ element: 'text', value: 'Walks the tree.' }]
88
+ * ```
89
+ */
90
+ export declare function buildTable(table: TableNode, row: number, column: number, text: string): TableNode;
91
+
92
+ /**
93
+ * Collects every `export class` / `export interface` declaration one file's source text declares,
94
+ * each keyed `${keyword} ${name}` and carrying the body lines and the base identifiers read from
95
+ * its own head, so a body and a heritage clause always come from the same declaration.
96
+ *
97
+ * @remarks
98
+ * The whole file is projected once through {@link extractSourceLines} and every head is read from
99
+ * that one projection, so a scope resolving many names reads each file once rather than once per
100
+ * name. A head is a column-zero `export class` / `export interface` line, an oxfmt-wrapped
101
+ * signature joined through {@link joinHead}, with an optional generic parameter list and an
102
+ * optional heritage clause between the identifier and the opening `{`; the identifier is the head's
103
+ * own run up to that list or clause, so it enters the key as literal text and no name reaches a
104
+ * `RegExp`. Body lines are the raw source between the head and the first projected column-zero `}`,
105
+ * keeping JSDoc evidence intact. Every balanced `<...>` span is removed from the head before its
106
+ * `extends` clause is read, so a `T extends Base` type parameter is never a base and `Base<T>`
107
+ * reads as `Base`; a class's `implements` clause and everything after it is excluded, and a
108
+ * qualified base such as `namespace.Base` is returned verbatim. The first head of a key that opens
109
+ * a column-zero close answers for that key: a head that opens none records nothing, and a later
110
+ * head of a key already collected adds nothing.
111
+ *
112
+ * @param source - The file's source text to read
113
+ * @returns One entry per collected declaration, keyed `${keyword} ${name}`
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * collectDeclarations('export interface X extends Y {\n\twalk(): void\n}\n').get('interface X')
118
+ * // { body: ['\twalk(): void'], bases: ['Y'] }
119
+ * ```
120
+ */
121
+ export declare function collectDeclarations(source: string): ReadonlyMap<string, Declaration>;
122
+
123
+ /**
124
+ * Collects the `@example` blocks one doc block's unwrapped text carries, each named for the
125
+ * declaration or member the block documents. The text after the tag becomes the block's
126
+ * `title`; a body opening with a fence contributes that fence's language and its verbatim
127
+ * body, and a body with no fence contributes its own trimmed text as the code.
128
+ *
129
+ * @param comment - One doc block's unwrapped text, as {@link normalizeComment} returns it
130
+ * @param name - The declaration or member the block documents
131
+ * @returns The block's `@example` entries, in block order
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * collectExamples('@example Walking\n```ts\nwalk()\n```', 'walk')
136
+ * // [{ name: 'walk', title: 'Walking', code: 'walk()', language: 'ts' }]
137
+ * ```
138
+ */
139
+ export declare function collectExamples(comment: string, name: string): readonly SourceExample[];
140
+
141
+ /**
142
+ * Collects each fenced code block keyed by its own node, paired with the {@link GuideFence}
143
+ * {@link extractFences} reports for it — the node-addressed form a rewrite needs, so a caller
144
+ * that located a fence by title can read that node's source region back from the parser. The map
145
+ * iterates in document order and a node keys itself, so a repeated identical fence keeps its own
146
+ * entry.
147
+ *
148
+ * @param document - The parsed guide document
149
+ * @returns One entry per fenced code block, in document order
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * Array.from(collectFences(document).values()) // [{ language: 'ts', code: 'walk()' }]
154
+ * ```
155
+ */
156
+ export declare function collectFences(document: MarkdownDocument): ReadonlyMap<CodeBlockNode, GuideFence>;
157
+
158
+ /**
159
+ * Collects each `## Methods` table keyed to the interface its `####` heading names — an H4
160
+ * carrying a code span sets the current interface and the table immediately following claims it,
161
+ * so a heading with no table and a table with no heading before it contribute nothing. The map
162
+ * iterates in document order and a node keys itself, so a repeated identical table keeps its own
163
+ * entry.
164
+ *
165
+ * @param document - The parsed guide document
166
+ * @returns One entry per documented `## Methods` table, in document order
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * collectGroups(document).values().next().value // 'GuideInterface'
171
+ * ```
172
+ */
173
+ export declare function collectGroups(document: MarkdownDocument): ReadonlyMap<TableNode, string>;
174
+
175
+ /**
176
+ * Collects the compared key of every physical record a key names — a {@link computeSymbolKey}
177
+ * symbol key for a column-zero `export` declaration head, an `Owner.member` key for a one-tab
178
+ * callable member inside one — keyed by the record itself. The owner closes at the first
179
+ * column-zero `}` or at a column-zero `export` declaration carrying another keyword, and a
180
+ * record no key names contributes no entry.
181
+ *
182
+ * @remarks
183
+ * This is the package's one key grammar, and each keyed reader projects its own part back out of
184
+ * it: {@link extractExports} splits a declaration key at its one space,
185
+ * {@link extractMemberMethods} and {@link extractExampleMethods} split a member key at its dot,
186
+ * and {@link locateComment} matches a caller's key against the whole map. A change to the head
187
+ * shape or to the member shape reaches every one of them at once.
188
+ *
189
+ * An owner opens at a column-zero `export class`, `export abstract class`, or `export interface`
190
+ * head and closes at the
191
+ * first column-zero `}`, so a member declared past that brace keys nothing. A column-zero `export` declaration carrying any other keyword closes the owner it follows,
192
+ * because a member belongs to the head enclosing it. Reading runs over {@link extractSourceLines}'s
193
+ * projection, so a head or
194
+ * a member written inside a comment or a template literal keys nothing.
195
+ *
196
+ * @param lines - Aligned physical source-line records
197
+ * @returns One entry per record a key names, in file order
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const keys = collectKeys(extractSourceLines('export class Widget {\n\twalk(): void\n}'))
202
+ * Array.from(keys.values()) // ['class Widget', 'Widget.walk']
203
+ * ```
204
+ */
205
+ export declare function collectKeys(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string>;
206
+
207
+ /**
208
+ * Collects the description paragraph of every documented physical record — a doc block's
209
+ * text before its first block tag, in {@link normalizeSummary}'s compared form — keyed by the
210
+ * record it documents. A record whose block carries no description contributes no entry, so
211
+ * an absent summary stays absent rather than becoming an empty string.
212
+ *
213
+ * @param lines - Aligned physical source-line records
214
+ * @returns One entry per documented record carrying a description paragraph
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * collectSummaries(extractSourceLines('/**' + ' Walks. *' + '/\nexport function walk() {}')).size // 1
219
+ * ```
220
+ */
221
+ export declare function collectSummaries(lines: readonly SourceLine[]): ReadonlyMap<SourceLine, string>;
222
+
223
+ /**
224
+ * Collects the titled `@example` blocks a guide's documented surface reaches — the module's
225
+ * exported declaration heads, plus the own members of every documented `class` and `interface` —
226
+ * keyed by title, the first block of a title answering for it.
227
+ *
228
+ * @param guide - The parsed guide naming the documented declarations
229
+ * @param source - The reflected source to read the blocks from
230
+ * @returns One entry per distinct `@example` title
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * collectTitles(guide, source).get('Walk a tree') // { name: 'walk', title: 'Walk a tree', code: 'walk()' }
235
+ * ```
236
+ */
237
+ export declare function collectTitles(guide: GuideInterface, source: SourceInterface): ReadonlyMap<string, SourceExample>;
238
+
239
+ /**
240
+ * Compares documented and declared membership exactly after sorting copies, preserving duplicates.
241
+ *
242
+ * @param spec - The guide inventory key the finding belongs to
243
+ * @param name - The declaration whose membership is compared
244
+ * @param documented - The documented member names
245
+ * @param declared - The declared member names
246
+ * @returns The membership finding, or `undefined` when the sorted populations match
247
+ *
248
+ * @example Compare declaration membership
249
+ * ```ts
250
+ * import { compareMembership } from '@orkestrel/guide'
251
+ *
252
+ * compareMembership('guides/widget.md', 'WidgetInterface', ['open'], ['open']) // undefined
253
+ * ```
254
+ */
255
+ export declare function compareMembership(spec: string, name: string, documented: readonly string[], declared: readonly string[]): ParityFinding | undefined;
256
+
257
+ /**
258
+ * Computes the drift between one compared key's guide text and source text. A pair agrees
259
+ * only when both sides carry the same text, and every other state is a drift: guide text
260
+ * alone reports the guide's side, source text alone reports the source's, and neither side
261
+ * carrying text reports the key by itself. A side carrying no text is absent from the result,
262
+ * so a documented symbol with no doc block reports as a drift naming the guide's text alone,
263
+ * and a row a table has no `Summary` column for against a declaration with no doc block
264
+ * reports as `{ key }`.
265
+ *
266
+ * @param key - The compared pair's key
267
+ * @param category - The compared site the drift came from
268
+ * @param guide - The guide's text there, or `undefined` when it carries none
269
+ * @param source - The source's text there, or `undefined` when it carries none
270
+ * @returns The drift, or `undefined` when both sides carry the same text
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * computeDrift('function walk', 'summary', 'Walks the tree.', 'Walks a tree.')
275
+ * // { key: 'function walk', category: 'summary', guide: 'Walks the tree.', source: 'Walks a tree.' }
276
+ * ```
277
+ */
278
+ export declare function computeDrift(key: string, category: Drift['category'], guide: string | undefined, source: string | undefined): Drift | undefined;
279
+
13
280
  /**
14
281
  * Computes the stable cache key for a {@link GuideModule}. Directories normalize before
15
282
  * joining, so equivalent module spellings share one key. The NUL separator
@@ -27,8 +294,8 @@ import { UnionShape } from '@orkestrel/contract';
27
294
  export declare function computeModuleKey(module: GuideModule): string;
28
295
 
29
296
  /**
30
- * Computes the bijection key for a surface symbol — its keyword and name combined — so a
31
- * symbol-set comparison diffs (name, keyword) pairs rather than names alone.
297
+ * Computes the bijection key for a surface symbol — `${keyword} ${name}` — so a symbol-set
298
+ * comparison diffs (name, keyword) pairs rather than names alone.
32
299
  *
33
300
  * @param symbol - The symbol to key
34
301
  * @returns The `${keyword} ${name}` key
@@ -40,6 +307,23 @@ export declare function computeModuleKey(module: GuideModule): string;
40
307
  */
41
308
  export declare function computeSymbolKey(symbol: SurfaceSymbol): string;
42
309
 
310
+ /**
311
+ * Compiles the {@link driftShape} into a {@link ContractInterface} for
312
+ * {@link Drift} — a guard, coercing parser, JSON Schema, and seeded
313
+ * generator from one shape declaration (AGENTS.md § Design laws).
314
+ *
315
+ * @returns A `Drift` contract bundling `schema` / `is` / `parse` / `generate`
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { createDriftContract } from '@orkestrel/guide'
320
+ *
321
+ * const drift = createDriftContract()
322
+ * drift.is({ key: 'class Widget', category: 'summary', guide: 'A widget.' }) // true
323
+ * ```
324
+ */
325
+ export declare function createDriftContract(): ContractInterface<Drift>;
326
+
43
327
  /**
44
328
  * Creates a structured {@link GuideInterface} view over one guide's markdown
45
329
  * source — parses once and caches its `sections` / `surface` / `methods` /
@@ -48,12 +332,13 @@ export declare function computeSymbolKey(symbol: SurfaceSymbol): string;
48
332
  * @param source - The guide's markdown source text
49
333
  * @returns A working {@link GuideInterface}
50
334
  *
51
- * @example
335
+ * @example Construct a Guide from markdown text
52
336
  * ```ts
53
337
  * import { createGuide } from '@orkestrel/guide'
54
338
  *
55
339
  * const guide = createGuide('## Surface\n\n| Name | Kind |\n| --- | --- |\n| `X` | class |')
56
340
  * guide.surface() // [{ name: 'X', keyword: 'class' }]
341
+ * guide.sections() // ['Surface']
57
342
  * ```
58
343
  */
59
344
  export declare function createGuide(source: string): GuideInterface;
@@ -75,6 +360,23 @@ export declare function createGuide(source: string): GuideInterface;
75
360
  */
76
361
  export declare function createManifestEntryContract(): ContractInterface<ManifestEntry>;
77
362
 
363
+ /**
364
+ * Compiles the {@link methodEntryShape} into a {@link ContractInterface} for
365
+ * {@link MethodEntry} — a guard, coercing parser, JSON Schema, and seeded
366
+ * generator from one shape declaration (AGENTS.md § Design laws).
367
+ *
368
+ * @returns A `MethodEntry` contract bundling `schema` / `is` / `parse` / `generate`
369
+ *
370
+ * @example
371
+ * ```ts
372
+ * import { createMethodEntryContract } from '@orkestrel/guide'
373
+ *
374
+ * const methodEntry = createMethodEntryContract()
375
+ * methodEntry.is({ name: 'walk' }) // true
376
+ * ```
377
+ */
378
+ export declare function createMethodEntryContract(): ContractInterface<MethodEntry>;
379
+
78
380
  /**
79
381
  * Compiles the {@link methodGroupShape} into a {@link ContractInterface} for
80
382
  * {@link MethodGroup} — a guard, coercing parser, JSON Schema, and seeded
@@ -87,7 +389,7 @@ export declare function createManifestEntryContract(): ContractInterface<Manifes
87
389
  * import { createMethodGroupContract } from '@orkestrel/guide'
88
390
  *
89
391
  * const methodGroup = createMethodGroupContract()
90
- * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
392
+ * methodGroup.is({ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }) // true
91
393
  * ```
92
394
  */
93
395
  export declare function createMethodGroupContract(): ContractInterface<MethodGroup>;
@@ -99,19 +401,44 @@ export declare function createMethodGroupContract(): ContractInterface<MethodGro
99
401
  * @param options - The file inventory and module scope to reflect
100
402
  * @returns A `SourceInterface` reflecting the given module scope
101
403
  *
102
- * @example
404
+ * @example Construct a Source from an inline files record
103
405
  * ```ts
104
406
  * import { createSource } from '@orkestrel/guide'
105
407
  *
106
408
  * const source = createSource({
107
- * files: { 'src/core/Guide.ts': 'export class Guide {}\n' },
409
+ * files: {
410
+ * 'src/core/index.ts': "export * from './Guide.js'\nexport * from './types.js'\n",
411
+ * 'src/core/Guide.ts': 'export class Guide {}\n',
412
+ * 'src/core/types.ts': 'export interface GuideInterface {\n\tsections(): void\n}\n',
413
+ * },
108
414
  * module: 'src/core',
109
415
  * })
110
- * source.exports() // [{ name: 'Guide', keyword: 'class' }]
416
+ * source.exports() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
417
+ * source.surface() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
418
+ * source.methods('GuideInterface') // [{ name: 'sections' }]
419
+ * source.exists('src/core/Guide.ts') // true
420
+ * source.exists('src/core') // true — a directory any inventory key sits beneath
111
421
  * ```
112
422
  */
113
423
  export declare function createSource(options: SourceOptions): SourceInterface;
114
424
 
425
+ /**
426
+ * Compiles the {@link sourceExampleShape} into a {@link ContractInterface} for
427
+ * {@link SourceExample} — a guard, coercing parser, JSON Schema, and seeded
428
+ * generator from one shape declaration (AGENTS.md § Design laws).
429
+ *
430
+ * @returns A `SourceExample` contract bundling `schema` / `is` / `parse` / `generate`
431
+ *
432
+ * @example
433
+ * ```ts
434
+ * import { createSourceExampleContract } from '@orkestrel/guide'
435
+ *
436
+ * const sourceExample = createSourceExampleContract()
437
+ * sourceExample.is({ name: 'walk', code: 'walk()' }) // true
438
+ * ```
439
+ */
440
+ export declare function createSourceExampleContract(): ContractInterface<SourceExample>;
441
+
115
442
  /**
116
443
  * Creates a {@link SourceManagerInterface} that resolves the consumer's local
117
444
  * import specifiers and shares one source view per module.
@@ -119,15 +446,22 @@ export declare function createSource(options: SourceOptions): SourceInterface;
119
446
  * @param options - The shared file inventory and specifier-to-module policy
120
447
  * @returns A source manager over the supplied policy
121
448
  *
122
- * @example
449
+ * @example Resolve a fence's import specifier to the right Source
123
450
  * ```ts
124
451
  * import { createSourceManager } from '@orkestrel/guide'
125
452
  *
126
453
  * const sources = createSourceManager({
127
- * files: { 'src/core/index.ts': "export * from './types.js'" },
128
- * modules: { '@scope/package': 'src/core' },
454
+ * files: {
455
+ * 'src/core/index.ts': "export * from './Guide.js'\n",
456
+ * 'src/core/Guide.ts': 'export class Guide {}\n',
457
+ * },
458
+ * modules: { '@scope/package': 'src/core', '@scope/package/core': 'src/core' },
129
459
  * })
130
- * sources.source('@scope/package')?.surface()
460
+ *
461
+ * sources.source('@scope/package')?.surface() // [{ name: 'Guide', keyword: 'class' }]
462
+ * sources.source('node:fs') // undefined — a foreign import, which a fence check skips
463
+ * sources.source('@scope/package') === sources.source('@scope/package/core') // true
464
+ * sources.sources() // [the one shared view both specifiers name]
131
465
  * ```
132
466
  */
133
467
  export declare function createSourceManager(options: SourceManagerOptions): SourceManagerInterface;
@@ -153,7 +487,7 @@ export declare function createSurfaceSymbolContract(): ContractInterface<Surface
153
487
  * Represents one located `export class` / `export interface` declaration — the body lines
154
488
  * and the base identifiers read from the same head, so a consumer never pairs
155
489
  * one declaration's body with another declaration's heritage (see
156
- * {@link extractDeclaration}).
490
+ * {@link collectDeclarations}).
157
491
  */
158
492
  export declare interface Declaration {
159
493
  /** Holds the declaration's raw body lines, between the head and the column-zero closing `}`. */
@@ -175,22 +509,69 @@ export declare interface DeclarationHead {
175
509
  }
176
510
 
177
511
  /**
178
- * Represents which declaration head {@link extractDeclaration} and {@link Source} locate —
512
+ * Represents which declaration head {@link collectDeclarations} and {@link Source} locate —
179
513
  * a `class` or an `interface`. That pair is the subset of {@link ExportKeyword}
180
514
  * carrying a body whose members a guide's `## Methods` table documents.
181
515
  */
182
516
  export declare type DeclarationKeyword = 'class' | 'interface';
183
517
 
518
+ /**
519
+ * Represents one disagreement between a guide and the source it documents — the compared key
520
+ * with the text each side carries there, the side carrying no text omitted.
521
+ */
522
+ export declare interface Drift {
523
+ /** Names whether the disagreement belongs to a summary or a titled example. */
524
+ readonly category: DriftCategory;
525
+ /**
526
+ * Names the compared pair: a {@link computeSymbolKey} symbol key for a `## Surface` row, an
527
+ * `Owner.member` key for a `## Methods` row, or the shared title for an example.
528
+ */
529
+ readonly key: string;
530
+ /** Holds the guide's text, or is absent when the guide carries none there. */
531
+ readonly guide?: string;
532
+ /** Holds the source's text, or is absent when the source carries none there. */
533
+ readonly source?: string;
534
+ }
535
+
536
+ /**
537
+ * Lists the compared sites a {@link Drift} can describe.
538
+ */
539
+ export declare const DRIFT_CATEGORIES: readonly ("summary" | "example")[];
540
+
541
+ /**
542
+ * Represents the compared site one disagreement came from.
543
+ */
544
+ export declare type DriftCategory = (typeof DRIFT_CATEGORIES)[number];
545
+
546
+ /**
547
+ * Shapes a {@link Drift} — one disagreement's compared `key` with the optional text each
548
+ * side carries there.
549
+ *
550
+ * @example
551
+ * ```ts
552
+ * import { createContract } from '@orkestrel/contract'
553
+ * import { driftShape } from '@orkestrel/guide'
554
+ *
555
+ * const drift = createContract(driftShape)
556
+ * drift.is({ key: 'class Widget', category: 'summary', guide: 'A widget.' }) // true
557
+ * ```
558
+ */
559
+ export declare const driftShape: ObjectShape< {
560
+ key: StringShape;
561
+ category: LiteralShape<readonly ("summary" | "example")[]>;
562
+ guide: OptionalShape<StringShape>;
563
+ source: OptionalShape<StringShape>;
564
+ }, false>;
565
+
184
566
  /**
185
567
  * Escapes every regex metacharacter in a literal string so it reads as text
186
568
  * inside a larger `RegExp` source rather than as syntax.
187
569
  *
188
570
  * @remarks
189
- * Every caller-supplied name reaches a `RegExp` through this: {@link
190
- * extractDeclaration} splices it into the head grammar and {@link
191
- * findUnexampled} into a word-boundary search, so a name carrying `$`, `(`,
192
- * `[`, or `.` matches that character literally instead of throwing or matching
193
- * text it does not name. Pure and total; never throws.
571
+ * A caller-supplied name reaches a `RegExp` through this: {@link
572
+ * findUnexampled} splices it into a word-boundary search, so a name carrying
573
+ * `$`, `(`, `[`, or `.` matches that character literally instead of throwing or
574
+ * matching text it does not name. Pure and total; never throws.
194
575
  *
195
576
  * @param value - The literal string to escape
196
577
  * @returns `value` with every regex metacharacter backslash-escaped
@@ -204,17 +585,16 @@ export declare type DeclarationKeyword = 'class' | 'interface';
204
585
  export declare function escapeRegExp(value: string): string;
205
586
 
206
587
  /**
207
- * Lists the declaration keywords a documented or exported symbol carries, in
208
- * the order the reflection grammar names them.
588
+ * Lists the declaration keywords a documented or exported symbol carries, in the order the
589
+ * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and
590
+ * `surfaceSymbolShape` all derive from.
209
591
  *
210
592
  * @remarks
211
- * One frozen list feeds the `ExportKeyword` type, the `isExportKeyword` guard, and
212
- * `surfaceSymbolShape`, so a keyword cannot be admitted by one and refused by
213
- * another. Comment and template payload is excluded before reflection, and
214
- * `enum` is outside this population rather than forbidden by general package
215
- * policy.
593
+ * One frozen list feeds the type, the guard, and the shape, so a keyword cannot be admitted by one
594
+ * and refused by another. Comment and template payload is excluded before reflection, and `enum`
595
+ * is outside this population rather than forbidden by general package policy.
216
596
  */
217
- export declare const EXPORT_KEYWORDS: readonly ["type", "interface", "const", "function", "class"];
597
+ export declare const EXPORT_KEYWORDS: readonly ("function" | "type" | "interface" | "const" | "class")[];
218
598
 
219
599
  /**
220
600
  * Represents the declaration keyword a documented / exported symbol carries — the reflected
@@ -233,7 +613,30 @@ export declare type ExportKeyword = (typeof EXPORT_KEYWORDS)[number];
233
613
  export declare const EXTERNAL_SCHEMES: readonly string[];
234
614
 
235
615
  /**
236
- * Extracts the link hrefs within one table cell's inline content.
616
+ * Extracts the aligned physical records of a declaration's body, read inside an owner head this
617
+ * function supplies, so a callable member in the body carries the `Owner.member` key
618
+ * {@link collectKeys} reports for it, and that head's own record opens the projection. A body
619
+ * read on its own carries no head, and the member grammar attaches a member to the head
620
+ * enclosing it.
621
+ *
622
+ * @remarks
623
+ * The supplied head is an `export interface` line, so the projection opens with that head's own
624
+ * record and every body line follows it in order. A column-zero `}` among the body lines closes
625
+ * the supplied head and leaves every later member unkeyed; a body {@link extractDeclaration}
626
+ * returns carries none, because that reader ends a body at the first one.
627
+ *
628
+ * @param lines - A declaration's body lines
629
+ * @returns The supplied head's record, then one record per body line
630
+ *
631
+ * @example
632
+ * ```ts
633
+ * extractBodyLines(['\twalk(): void'])[1]?.code // '\twalk(): void'
634
+ * ```
635
+ */
636
+ export declare function extractBodyLines(lines: readonly string[]): readonly SourceLine[];
637
+
638
+ /**
639
+ * Extracts the link hrefs within one table cell's inline content, in walk order.
237
640
  *
238
641
  * @param cell - The cell's inline nodes
239
642
  * @returns The cell's link hrefs, in walk order
@@ -246,24 +649,35 @@ export declare const EXTERNAL_SCHEMES: readonly string[];
246
649
  export declare function extractCellLinks(cell: readonly InlineNode[]): readonly string[];
247
650
 
248
651
  /**
249
- * Locates the named `export class` / `export interface` declaration in one
250
- * file's source text and returns its body lines and its base identifiers read
251
- * from that one head, so a body and a heritage clause always come from the same
252
- * declaration.
652
+ * Extracts compared inline content — the text of a table cell or candidate entity heading
653
+ * flattened with every code span kept as a code span, so `` `Widget` `` reads the same wherever
654
+ * the parity reader compares it. Emphasis drops to its text, a link drops to its text, an image
655
+ * drops to its alternative text, and the markdown parser has already unescaped `\|`.
656
+ *
657
+ * @param cell - The inline nodes to flatten
658
+ * @returns The compared text, code spans included
659
+ *
660
+ * @example
661
+ * ```ts
662
+ * extractCellText([{ element: 'codeSpan', value: 'Widget' }]) // '`Widget`'
663
+ * ```
664
+ */
665
+ export declare function extractCellText(cell: readonly InlineNode[]): string;
666
+
667
+ /**
668
+ * Locates the named `export class` / `export interface` declaration in one file's source text
669
+ * and returns its body lines and its base identifiers read from that one head, so a body and a
670
+ * heritage clause always come from the same declaration, or `undefined` when the file declares
671
+ * no such head.
253
672
  *
254
673
  * @remarks
255
- * The head is matched on projected lines (column 0, an oxfmt-wrapped signature
256
- * joined through {@link joinHead}), with an optional generic parameter list and
257
- * an optional heritage clause between the identifier and the opening `{`; the
258
- * identifier matches exactly and is escaped through {@link escapeRegExp}, so a
259
- * metacharacter in `name` is literal text. The returned body lines are the raw
260
- * source between that head and the first projected column-zero `}`, keeping
261
- * JSDoc evidence intact. Every balanced `<...>` span is removed from the head
262
- * before its `extends` clause is read, so a `T extends Base` type parameter is
263
- * never a base and `Base<T>` reads as `Base`; a class's `implements` clause and
264
- * everything after it is excluded, and a qualified base such as
265
- * `namespace.Base` is returned verbatim. A head that opens no column-zero close
266
- * is skipped and the scan continues, so a later real declaration still answers.
674
+ * The one named lookup over {@link collectDeclarations}, which owns the head grammar, the body
675
+ * window, and the base reading. This lookup spells the map's `${keyword} ${name}` key for its
676
+ * caller, so a consumer reading one name never writes that convention itself. `name` is compared
677
+ * as literal text against the identifier the head itself carries, so a metacharacter in `name`
678
+ * names that character rather than matching text it does not name. Every call collects the whole
679
+ * file afresh: a consumer reading many names from one file calls {@link collectDeclarations} once
680
+ * and reads the map, and {@link Source} holds one such map per module scope.
267
681
  *
268
682
  * @param source - The file's source text to search
269
683
  * @param keyword - Whether to look for a `class` or an `interface`
@@ -280,71 +694,74 @@ export declare function extractDeclaration(source: string, keyword: DeclarationK
280
694
 
281
695
  /**
282
696
  * Selects the next physical record after an eligible genuine JSDoc whose final
283
- * authoritative span carries an exact block-position `@example` tag. Title
284
- * text is allowed. A leading whitespace-separated span chain is last-span
285
- * authoritative; intervening source material severs association, while a
286
- * leading JSDoc on the next record replaces pending state. Any other next
287
- * physical record is returned once and consumes it. This parser walks aligned
288
- * records without rescanning source syntax or applying declaration/member
289
- * grammar.
697
+ * authoritative span carries an `@example` tag opening a line at its first non-blank column —
698
+ * the {@link extractSourceComments} walk filtered to the blocks that carry one. Title
699
+ * text is allowed, and {@link maskFences} keeps a fenced body's own lines out of the search.
290
700
  *
291
701
  * @param lines - Aligned physical source-line records
292
702
  * @returns The immediately following candidate lines, in source order
293
703
  *
294
704
  * @example
295
705
  * ```ts
296
- * extractExampleLines(extractSourceLines('/** @example *' + '/\nexport function walk() {}'))
706
+ * extractExampleLines(extractSourceLines('/**' + ' @example *' + '/\nexport function walk() {}'))
297
707
  * // the `export function walk() {}` SourceLine
298
708
  * ```
299
709
  */
300
710
  export declare function extractExampleLines(lines: readonly SourceLine[]): readonly SourceLine[];
301
711
 
302
712
  /**
303
- * Extracts the callable-member names in a declaration body (per {@link extractMemberMethods}'
304
- * grammar) whose immediately preceding eligible genuine JSDoc block, within
305
- * the same body, carries `@example`. Shared adjacency comes from
306
- * {@link extractExampleLines}; member membership is matched against aligned
307
- * projected code.
713
+ * Extracts the `@example` blocks carried by the callable members of a declaration body (per
714
+ * {@link collectKeys}' grammar, the same one {@link extractMemberMethods} reads), each named for
715
+ * the member its block documents. Shared adjacency comes from {@link extractSourceComments} and
716
+ * each block is read by {@link collectExamples}; member membership is the key
717
+ * {@link extractBodyLines}'s projection gives the documented record.
308
718
  *
309
719
  * @param lines - A declaration's body lines
310
- * @returns The exemplified member names, deduped and sorted
720
+ * @returns The members' `@example` blocks, deduplicated by name and title and sorted by name
311
721
  *
312
722
  * @example
313
723
  * ```ts
314
- * extractExampleMethods(['\t/**', '\t * @example', '\t *' + '/', '\twalk(): void']) // ['walk']
724
+ * extractExampleMethods(['\t/**', '\t * @example', '\t * walk()', '\t *' + '/', '\twalk(): void'])
725
+ * // [{ name: 'walk', code: 'walk()' }]
315
726
  * ```
316
727
  */
317
- export declare function extractExampleMethods(lines: readonly string[]): readonly string[];
728
+ export declare function extractExampleMethods(lines: readonly string[]): readonly SourceExample[];
318
729
 
319
730
  /**
320
- * Extracts the exported functions in one file's source text whose immediately preceding
321
- * eligible genuine JSDoc block carries `@example`. Shared adjacency comes from
322
- * {@link extractExampleLines}; exported-function membership is matched against
323
- * the aligned code projection, so comment and template payload cannot qualify.
731
+ * Extracts the `@example` blocks carried by the exported declaration heads in one file's source
732
+ * text, each named for the declaration its block documents. Shared adjacency comes from
733
+ * {@link extractSourceComments} and each block is read by {@link collectExamples}; head
734
+ * membership is the {@link collectKeys} key of the documented record under every keyword that
735
+ * grammar admits at column zero, so comment and template payload cannot qualify and the head
736
+ * grammar stays the one every reader here shares. A member key carries a dot and a head key
737
+ * does not, so a member's block belongs to {@link extractExampleMethods} instead. A head
738
+ * carrying several blocks contributes each.
324
739
  *
325
740
  * @param source - The file's source text
326
- * @returns The exported function names with an `@example`, in file order
741
+ * @returns The exported declaration heads' `@example` blocks, in file order, deduplicated by name and title
327
742
  *
328
743
  * @example
329
744
  * ```ts
330
- * const block = ['/**', ' * @example', ' *' + '/', 'export function walk() {}', ''].join('\n')
331
- * extractExamples(block) // ['walk']
332
- * extractExamples('export function walk() {}\n') // []
745
+ * const block = ['/**', ' * @example', ' * new Widget()', ' *' + '/', 'export class Widget {}', ''].join('\n')
746
+ * extractExamples(block) // [{ name: 'Widget', code: 'new Widget()' }]
747
+ * extractExamples('export class Widget {}\n') // []
333
748
  * ```
334
749
  */
335
- export declare function extractExamples(source: string): readonly string[];
750
+ export declare function extractExamples(source: string): readonly SourceExample[];
336
751
 
337
752
  /**
338
- * Extracts the module-scope exports declared in one file's source text — matches
339
- * `export (async)? (function(\*)?|class|const|interface|type) Name`, deduped
340
- * by (keyword, name). A generator export (`export function* walk`) scans as the
341
- * `function` keyword — its trailing `*` is stripped before the
342
- * {@link ExportKeyword} check.
343
- * Scanning uses {@link extractSourceLines}, so comment and template payload is
344
- * excluded while its uninterrupted column-zero head remains required; preserved
345
- * columns do not grant membership to leading/interrupted comment forms. The population is
346
- * exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is
347
- * outside this reflection contract, not forbidden by general package policy.
753
+ * Extracts the module-scope exports declared in one file's source text — the declaration keys
754
+ * {@link collectKeys} reports, each split back into the keyword and name that built it, deduped by
755
+ * (keyword, name).
756
+ *
757
+ * @remarks
758
+ * That one grammar matches `export (async)? (function(\*)?|class|const|interface|type) Name`; a
759
+ * generator export (`export function* walk`) keys as the `function` keyword, its trailing `*`
760
+ * stripped before the {@link ExportKeyword} check. Scanning uses {@link extractSourceLines}, so
761
+ * comment and template payload is excluded while its uninterrupted column-zero head remains
762
+ * required; preserved columns do not grant membership to leading/interrupted comment forms. The
763
+ * population is exactly `type`, `interface`, `const`, `function`, and `class`; `enum` is outside
764
+ * this reflection contract, not forbidden by general package policy.
348
765
  *
349
766
  * @param source - The file's source text
350
767
  * @returns The file's exported symbols, in file order
@@ -358,10 +775,11 @@ export declare function extractExamples(source: string): readonly string[];
358
775
  export declare function extractExports(source: string): readonly SurfaceSymbol[];
359
776
 
360
777
  /**
361
- * Parses a fence's `import` statements into per-specifier imported identifier
362
- * names — handles `import type`, mixed multiline braces, and `x as y` aliases,
363
- * resolving each alias to the exported name `x` because that is the name the
364
- * checked barrel surface must hold.
778
+ * Parses a fence's brace `import` statements into per-specifier imported identifier names —
779
+ * `import type`, mixed multiline braces, and `x as y` aliases all count, each alias resolved to
780
+ * the exported name `x` because that is the name the checked barrel surface must hold. Brace
781
+ * bindings only: a default, namespace, side-effect, or mixed `import Default, { named }`
782
+ * statement is not surfaced.
365
783
  *
366
784
  * @param fence - A ```ts Patterns fence's verbatim body text
367
785
  * @returns One entry per `import ... from 'specifier'` statement, in fence order
@@ -375,10 +793,13 @@ export declare function extractFenceImports(fence: string): readonly FenceImport
375
793
 
376
794
  /**
377
795
  * Extracts every fenced code block anywhere in the guide document. A full AST walk
378
- * includes fences nested inside blockquotes and lists.
796
+ * includes fences nested inside blockquotes and lists, and the same walk carries each
797
+ * fence's nearest preceding heading as its `title` — the key an `@example` block pairs on.
798
+ * A heading's text is flattened, so a title written with a code span pairs with a plain
799
+ * `@example` title.
379
800
  *
380
801
  * @param document - The parsed guide document
381
- * @returns Every fence's language and verbatim code, in document order
802
+ * @returns Every fence's language, verbatim code, and title, in document order
382
803
  *
383
804
  * @example
384
805
  * ```ts
@@ -388,16 +809,17 @@ export declare function extractFenceImports(fence: string): readonly FenceImport
388
809
  export declare function extractFences(document: MarkdownDocument): readonly GuideFence[];
389
810
 
390
811
  /**
391
- * Extracts the module-scope declarations lacking the `export` keyword in one file's
392
- * source text — the mirror image of {@link extractExports}'s grammar, anchored
393
- * the same way (column 0, so an indented inner declaration never matches).
394
- * Scans only the {@link ExportKeyword} keywords (`function` / `class` /
395
- * `const` / `interface` / `type`) — a module-scope `let` or `var` is outside
396
- * this scanner's declaration-keyword grammar and out of this check's contract.
397
- * Scanning uses {@link extractSourceLines}, so comment
398
- * and template payload is excluded while its uninterrupted column-zero head
399
- * remains required; preserved columns do not widen membership. `enum` is likewise outside this reflection population, not
400
- * forbidden by general package policy.
812
+ * Extracts the module-scope declarations lacking the `export` keyword in one file's source text —
813
+ * the mirror image of {@link extractExports}'s grammar, anchored the same way (column 0, so an
814
+ * indented inner declaration never matches).
815
+ *
816
+ * @remarks
817
+ * Scans only the {@link ExportKeyword} keywords (`function` / `class` / `const` / `interface` /
818
+ * `type`) — a module-scope `let` or `var` is outside this scanner's declaration-keyword grammar
819
+ * and out of this check's contract. Scanning uses {@link extractSourceLines}, so comment and
820
+ * template payload is excluded while its uninterrupted column-zero head remains required;
821
+ * preserved columns do not widen membership. `enum` is likewise outside this reflection
822
+ * population, not forbidden by general package policy.
401
823
  *
402
824
  * @param source - The file's source text
403
825
  * @returns The file's hidden (non-exported) symbols, in file order
@@ -428,34 +850,112 @@ export declare function extractLinks(document: MarkdownDocument): readonly strin
428
850
  * Selects the member lines declaring a callable member: plain, `async`, generator
429
851
  * (`*`), and optional (`records?(`) methods all count; getters, setters,
430
852
  * `static` members, and `#` privates never do (their keyword or `#` breaks
431
- * the `name(` shape). Matching runs once over projected lines so commented
432
- * method-like payload never becomes eligible.
853
+ * the `name(` shape). The grammar is {@link collectKeys}'s, read once over
854
+ * {@link extractBodyLines}'s projection of the body, so commented method-like payload never
855
+ * becomes eligible and each member keys to the owner head that projection supplies. Each member
856
+ * carries its own doc block's description paragraph, read through {@link collectSummaries}; the
857
+ * first declaration of a name answers for it.
433
858
  *
434
859
  * @param lines - A declaration's body lines
435
- * @returns The declared method names, deduped and sorted
860
+ * @returns The declared members, deduplicated by name and sorted by name
436
861
  *
437
862
  * @example
438
863
  * ```ts
439
- * extractMemberMethods(['\tmap(): void', '\tfilter(): void']) // ['filter', 'map']
864
+ * extractMemberMethods(['\tmap(): void', '\tfilter(): void']) // [{ name: 'filter' }, { name: 'map' }]
440
865
  * ```
441
866
  */
442
- export declare function extractMemberMethods(lines: readonly string[]): readonly string[];
867
+ export declare function extractMemberMethods(lines: readonly string[]): readonly MethodEntry[];
443
868
 
444
869
  /**
445
870
  * Extracts one {@link MethodGroup} per documented behavioral interface in `## Methods` —
446
871
  * an H4 with a code span sets the current interface, and the table immediately
447
- * following becomes its documented methods.
872
+ * following becomes its documented methods. A row with no code-span name has no name to key a
873
+ * member on, so this reader skips it and {@link extractUnnamed} reports it. Each row carries its
874
+ * {@link SUMMARY} column's compared text when the table has that column.
448
875
  *
449
876
  * @param document - The parsed guide document
450
877
  * @returns The documented method groups, in document order
451
878
  *
452
879
  * @example
453
880
  * ```ts
454
- * extractMethods(document) // [{ interface: 'MarkdownInterface', methods: ['walk', ...] }]
881
+ * extractMethods(document) // [{ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }]
455
882
  * ```
456
883
  */
457
884
  export declare function extractMethods(document: MarkdownDocument): readonly MethodGroup[];
458
885
 
886
+ /**
887
+ * Extracts one `## Methods` table row's entry — its column 0 code span as the name and its
888
+ * {@link SUMMARY} column as the compared summary when the table has that column. A row with no
889
+ * code-span name has no member to key, so it returns `undefined`.
890
+ *
891
+ * @param table - The table to read
892
+ * @param row - The index of the row within {@link TableNode.rows}
893
+ * @returns The row's entry, or `undefined` when the row keys none
894
+ *
895
+ * @example
896
+ * ```ts
897
+ * extractRowEntry(table, 0) // { name: 'walk', summary: 'Walks the tree.' }
898
+ * ```
899
+ */
900
+ export declare function extractRowEntry(table: TableNode, row: number): MethodEntry | undefined;
901
+
902
+ /**
903
+ * Extracts one row's compared summary — its {@link SUMMARY} column read through
904
+ * {@link extractCellText} and {@link normalizeSummary}. A table with no such column and a row
905
+ * whose cell is empty each carry no summary and return `undefined` rather than an empty string,
906
+ * so {@link findDrift} reports the absence.
907
+ *
908
+ * @param table - The table to read
909
+ * @param row - The index of the row within {@link TableNode.rows}
910
+ * @returns The row's compared summary, or `undefined` when it carries none
911
+ *
912
+ * @example
913
+ * ```ts
914
+ * extractRowSummary(table, 0) // 'Walks the tree.'
915
+ * ```
916
+ */
917
+ export declare function extractRowSummary(table: TableNode, row: number): string | undefined;
918
+
919
+ /**
920
+ * Extracts one `## Surface` table row's symbol — its column 0 code span as the name, its
921
+ * {@link KIND} column as the keyword, and its {@link SUMMARY} column as the compared summary
922
+ * when the table has that column. A row with no code-span name and a row whose `Kind` text is
923
+ * no {@link ExportKeyword} have no symbol to key, so each returns `undefined`.
924
+ *
925
+ * @param table - The table to read
926
+ * @param row - The index of the row within {@link TableNode.rows}
927
+ * @returns The row's symbol, or `undefined` when the row keys none
928
+ *
929
+ * @example
930
+ * ```ts
931
+ * extractRowSymbol(table, 0) // { name: 'walk', keyword: 'function', summary: 'Walks the tree.' }
932
+ * ```
933
+ */
934
+ export declare function extractRowSymbol(table: TableNode, row: number): SurfaceSymbol | undefined;
935
+
936
+ /**
937
+ * Extracts every eligible genuine JSDoc block paired with the physical record it documents.
938
+ *
939
+ * @remarks
940
+ * An opener is eligible only when it is the first non-whitespace source material of its record; a
941
+ * leading whitespace-separated span chain is last-span authoritative; intervening source material
942
+ * severs association, while a leading JSDoc on the next record replaces pending state. Any other
943
+ * next physical record is returned once and consumes it. This parser walks aligned records without
944
+ * rescanning source syntax or applying declaration/member grammar, and every reader of a doc
945
+ * block's text — the description paragraph, the `@example` blocks, the member summaries — reads it
946
+ * through this one walk.
947
+ *
948
+ * @param lines - Aligned physical source-line records
949
+ * @returns One record per documented physical line, in source order
950
+ *
951
+ * @example
952
+ * ```ts
953
+ * extractSourceComments(extractSourceLines('/**' + ' Walks. *' + '/\nexport function walk() {}'))
954
+ * // [{ text: 'Walks.', line: the `export function walk() {}` SourceLine }]
955
+ * ```
956
+ */
957
+ export declare function extractSourceComments(lines: readonly SourceLine[]): readonly SourceComment[];
958
+
459
959
  /**
460
960
  * Extracts aligned physical source-line records in one character traversal.
461
961
  * Real line and block comments and complete template tokens become spaces in
@@ -478,20 +978,34 @@ export declare function extractMethods(document: MarkdownDocument): readonly Met
478
978
  * @param source - The TypeScript source text to project
479
979
  * @returns One aligned terminator-free record per LF or CRLF physical line, including the final line
480
980
  *
481
- * @example
981
+ * @example Project source into physical code lines
482
982
  * ```ts
983
+ * import { extractSourceLines } from '@orkestrel/guide'
984
+ *
483
985
  * extractSourceLines('export const visible = true // note\n')
484
- * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }, ...]
986
+ * // [{ source: 'export const visible = true // note', code: 'export const visible = true ', jsdoc: undefined }]
987
+ * // … one record per remaining line
485
988
  * ```
486
989
  */
487
990
  export declare function extractSourceLines(source: string): readonly SourceLine[];
488
991
 
489
992
  /**
490
993
  * Extracts every `## Surface` identifier the guide documents — each table row's column 0
491
- * code span (the name) paired with its `Kind` column (located by header text)
492
- * unioned with every backticked H3 entity heading in the section
493
- * (`{name: <codeSpan>, keyword: 'class'}`), deduped by {@link computeSymbolKey}. A row with
494
- * no code-span name, or an unrecognized `Kind` text, is skipped.
994
+ * code span (the name) paired with its `Kind` column (located by header text), unioned with every
995
+ * H3 entity heading whose trimmed compared inline content is exactly its backticked code-span
996
+ * name, deduped by {@link computeSymbolKey}. A row with no code-span name has no name to key a
997
+ * symbol on, so this reader skips it and {@link extractUnnamed} reports it; a row with an
998
+ * unrecognized `Kind` text is skipped. A row also carries its {@link SUMMARY} column's compared
999
+ * text when the table has that column; a table without it leaves every row's summary absent,
1000
+ * which {@link findDrift} reports.
1001
+ *
1002
+ * @remarks
1003
+ * The heading boundary compares {@link extractCellText} with the raw value from
1004
+ * {@link findFirstCode} before {@link normalizeIdentifier} strips a generic annotation.
1005
+ * Surrounding spaces, emphasis, and links preserve that identity. This reader refuses a heading
1006
+ * carrying any other visible text or an additional code span. Entries retain encounter order, and
1007
+ * the first-seen name + keyword wins: a genuine heading before its table row keeps the heading's
1008
+ * summary-less class entry, while a table row before that heading keeps its `Summary`.
495
1009
  *
496
1010
  * @param document - The parsed guide document
497
1011
  * @returns The documented surface, in encounter order
@@ -503,6 +1017,21 @@ export declare function extractSourceLines(source: string): readonly SourceLine[
503
1017
  */
504
1018
  export declare function extractSurface(document: MarkdownDocument): readonly SurfaceSymbol[];
505
1019
 
1020
+ /**
1021
+ * Extracts the guide's tagline — the text of the blockquote following the document's H1,
1022
+ * with every code span kept as a code span and whitespace collapsed. A heading before the
1023
+ * blockquote ends the window, so a blockquote elsewhere in the document is not the tagline.
1024
+ *
1025
+ * @param document - The parsed guide document
1026
+ * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading
1027
+ *
1028
+ * @example
1029
+ * ```ts
1030
+ * extractTagline(document) // 'A pure, I/O-free guides-parity toolkit'
1031
+ * ```
1032
+ */
1033
+ export declare function extractTagline(document: MarkdownDocument): string | undefined;
1034
+
506
1035
  /**
507
1036
  * Extracts the relative test links declared under `## Tests` — every link href found
508
1037
  * within that section only.
@@ -517,6 +1046,24 @@ export declare function extractSurface(document: MarkdownDocument): readonly Sur
517
1046
  */
518
1047
  export declare function extractTests(document: MarkdownDocument): readonly string[];
519
1048
 
1049
+ /**
1050
+ * Extracts every `## Surface` or `## Methods` table row whose first cell carries no code span.
1051
+ * {@link extractSurface} and {@link extractMethods} skip such a row, because a row with no
1052
+ * name gives them nothing to key a symbol or a member on, and this projection is what reports
1053
+ * the skip. Each entry is the row's cells read through {@link extractCellText} and joined
1054
+ * by ` | `, so a reader can locate the row in the guide; the `## Surface` rows come first,
1055
+ * then the `## Methods` rows, each in document order. {@link GuideInterface.unnamed} caches it.
1056
+ *
1057
+ * @param document - The parsed guide document
1058
+ * @returns One entry per row carrying no code-span name
1059
+ *
1060
+ * @example
1061
+ * ```ts
1062
+ * extractUnnamed(document) // ['Widget | class | Represents a widget.']
1063
+ * ```
1064
+ */
1065
+ export declare function extractUnnamed(document: MarkdownDocument): readonly string[];
1066
+
520
1067
  /**
521
1068
  * Represents one brace `import` statement projected from a guide fence — its specifier
522
1069
  * paired with the exported names it binds.
@@ -529,34 +1076,64 @@ export declare interface FenceImport {
529
1076
  }
530
1077
 
531
1078
  /**
532
- * Finds the first code-span value by descending an inline node list, following
533
- * into `emphasis` / `link` / `image` children — the extraction rule behind a
534
- * Surface or Methods table row's first-column identifier.
1079
+ * Finds the index of the column whose header text is `header` so a table's columns survive
1080
+ * reordering. The match is exact and case-sensitive — a table without that exact header
1081
+ * contributes nothing to the projection reading it, so a `## Surface` table with no
1082
+ * {@link SUMMARY} column leaves every row's summary absent and {@link findDrift} reports each
1083
+ * of those rows, never agreement.
535
1084
  *
536
- * @param nodes - The inline nodes to search
537
- * @returns The first code span's literal text, or `undefined` when none is found
1085
+ * @param table - The table to inspect
1086
+ * @param header - The exact header text to locate, for example `Kind`
1087
+ * @returns The column's index, or `undefined` when the table has no such header
538
1088
  *
539
1089
  * @example
540
1090
  * ```ts
541
- * findFirstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'
1091
+ * findColumnIndex(table, 'Kind') // 1, or undefined
542
1092
  * ```
543
1093
  */
544
- export declare function findFirstCode(nodes: readonly InlineNode[]): string | undefined;
1094
+ export declare function findColumnIndex(table: TableNode, header: string): number | undefined;
545
1095
 
546
1096
  /**
547
- * Finds the index of a table's `Kind` column by its header text so it survives
548
- * column reordering. The match is exact and case-sensitive (`'Kind'`) — a table
549
- * without that exact header contributes no symbols to the surface it feeds.
1097
+ * Finds every disagreement between a guide and the source it documents, naming both sites:
1098
+ * each `## Surface` row against its declaration's description paragraph, each `## Methods`
1099
+ * row against its member's, and the first titled guide fence of a heading against the
1100
+ * `@example` block of the same title. An example's compared text is its language on the first
1101
+ * line and its body beneath, so a fence that names another language drifts on its own.
550
1102
  *
551
- * @param table - The table to inspect
552
- * @returns The `Kind` column's index, or `undefined` when the table has no `Kind` header
1103
+ * @remarks
1104
+ * Only a pair present on both sides is compared, so a symbol, a member, or a title one side
1105
+ * lacks entirely is left to the bijection checks that own it and is never reported twice.
1106
+ * {@link computeDrift} rules each compared pair, so a pair whose sides carry different text, a
1107
+ * pair where one side carries none, and a pair where neither side carries text are all drift.
1108
+ * The pairing is per title across the whole document, not per heading: the first fence a title
1109
+ * reaches is the compared one, and every later fence of that title is outside the comparison,
1110
+ * whether it sits under the same heading or under a second heading of the same text.
1111
+ *
1112
+ * @param guide - The parsed guide
1113
+ * @param source - The reflected source the guide documents
1114
+ * @returns One entry per disagreement: Surface rows, then Methods rows, then examples
553
1115
  *
554
1116
  * @example
555
1117
  * ```ts
556
- * findKindIndex(table) // 1, or undefined
1118
+ * findDrift(guide, source) // [{ key: 'function walk', category: 'summary', guide: 'Walks.', source: 'Walks a tree.' }]
557
1119
  * ```
558
1120
  */
559
- export declare function findKindIndex(table: TableNode): number | undefined;
1121
+ export declare function findDrift(guide: GuideInterface, source: SourceInterface): readonly Drift[];
1122
+
1123
+ /**
1124
+ * Finds the first code-span value by descending an inline node list, following
1125
+ * into `emphasis` / `link` / `image` children — the extraction rule behind a
1126
+ * Surface or Methods table row's first-column identifier.
1127
+ *
1128
+ * @param nodes - The inline nodes to search
1129
+ * @returns The first code span's literal text, or `undefined` when none is found
1130
+ *
1131
+ * @example
1132
+ * ```ts
1133
+ * findFirstCode([{ element: 'codeSpan', value: 'Markdown' }]) // 'Markdown'
1134
+ * ```
1135
+ */
1136
+ export declare function findFirstCode(nodes: readonly InlineNode[]): string | undefined;
560
1137
 
561
1138
  /**
562
1139
  * Finds the names present in `names` but absent from `source` — the set-difference
@@ -623,10 +1200,42 @@ export declare function findUnexampled(names: readonly string[], fences: readonl
623
1200
  */
624
1201
  export declare function findUnlisted(fences: readonly GuideFence[], languages: readonly string[]): readonly GuideFence[];
625
1202
 
1203
+ /**
1204
+ * Formats a categorized drift with its guide and source sides.
1205
+ *
1206
+ * @param drift - The categorized disagreement to format
1207
+ * @returns The complete developer-facing drift text
1208
+ *
1209
+ * @example Format categorized drift
1210
+ * ```ts
1211
+ * import { formatDrift } from '@orkestrel/guide'
1212
+ *
1213
+ * formatDrift({ category: 'summary', key: 'function walk', guide: 'Walks.', source: 'Walks a tree.' })
1214
+ * // 'summary function walk: guide "Walks." source "Walks a tree."'
1215
+ * ```
1216
+ */
1217
+ export declare function formatDrift(drift: Drift): string;
1218
+
1219
+ /**
1220
+ * Formats present parity text as a JSON string and absent text as `absent`.
1221
+ *
1222
+ * @param value - The compared side's text, or `undefined` when absent
1223
+ * @returns The developer-facing side text
1224
+ *
1225
+ * @example Format a parity side
1226
+ * ```ts
1227
+ * import { formatSide } from '@orkestrel/guide'
1228
+ *
1229
+ * formatSide('Walks.') // '"Walks."'
1230
+ * formatSide(undefined) // 'absent'
1231
+ * ```
1232
+ */
1233
+ export declare function formatSide(value: string | undefined): string;
1234
+
626
1235
  /**
627
1236
  * Presents a pure, structured view over one parsed guide — the documented
628
- * projections (`sections` / `surface` / `methods` / `links` / `tests` /
629
- * `fences`) are extracted once at construction and cached.
1237
+ * projections (`sections` / `tagline` / `surface` / `methods` / `unnamed` / `links` /
1238
+ * `tests` / `fences`) are extracted once at construction and cached.
630
1239
  *
631
1240
  * @remarks
632
1241
  * Parses `source` once through `@orkestrel/markdown` and never touches the
@@ -646,19 +1255,30 @@ export declare class Guide implements GuideInterface {
646
1255
  #private;
647
1256
  constructor(source: string);
648
1257
  sections(): readonly string[];
1258
+ tagline(): string | undefined;
649
1259
  surface(): readonly SurfaceSymbol[];
650
1260
  methods(): readonly MethodGroup[];
1261
+ unnamed(): readonly string[];
651
1262
  links(): readonly string[];
652
1263
  tests(): readonly string[];
653
1264
  fences(): readonly GuideFence[];
654
1265
  }
655
1266
 
656
- /** Represents one fenced code block projected from a guide document. */
1267
+ /**
1268
+ * Represents one fenced code block projected from a guide document — its `language` is the
1269
+ * fence's info-string tag and is absent when the fence is untagged, and its `title` is the
1270
+ * flattened text of its nearest preceding heading.
1271
+ */
657
1272
  export declare interface GuideFence {
658
1273
  /** Holds the info-string language tag, or `undefined` when the fence is untagged. */
659
1274
  readonly language: string | undefined;
660
1275
  /** Holds the fence's verbatim code body. */
661
1276
  readonly code: string;
1277
+ /**
1278
+ * Holds the flattened text of the fence's nearest preceding heading, which pairs the fence
1279
+ * with the `@example` block carrying that title; absent when no heading precedes it.
1280
+ */
1281
+ readonly title?: string;
662
1282
  }
663
1283
 
664
1284
  /**
@@ -674,17 +1294,55 @@ export declare interface GuideInterface {
674
1294
  */
675
1295
  sections(): readonly string[];
676
1296
  /**
677
- * Lists every `## Surface` identifier + keyword — table rows union backticked entity headings.
1297
+ * Returns the text of the blockquote following the document's H1 — the guide's tagline, or
1298
+ * `undefined` when a heading intervenes first.
1299
+ *
1300
+ * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading
1301
+ *
1302
+ * @example Read a guide's tagline
1303
+ * ```ts
1304
+ * import { createGuide } from '@orkestrel/guide'
1305
+ *
1306
+ * const guide = createGuide('# Widget\n\n> A widget toolkit.\n\n## Surface\n')
1307
+ * guide.tagline() // 'A widget toolkit.'
1308
+ * ```
1309
+ */
1310
+ tagline(): string | undefined;
1311
+ /**
1312
+ * Lists every `## Surface` identifier + keyword — table rows union H3 entity headings whose
1313
+ * trimmed compared inline content is exactly their backticked code-span name. Each row carries
1314
+ * its `Summary` cell, located by header text, when the table has that column.
1315
+ *
1316
+ * @remarks
1317
+ * Entries retain encounter order, and the first-seen name + keyword wins. A genuine entity
1318
+ * heading before its matching class row keeps the heading's summary-less entry; a table row
1319
+ * before that heading keeps its `Summary`.
678
1320
  *
679
1321
  * @returns The documented surface symbols, in encounter order
680
1322
  */
681
1323
  surface(): readonly SurfaceSymbol[];
682
1324
  /**
683
- * Returns one {@link MethodGroup} per documented behavioral interface in `## Methods`.
1325
+ * Returns one {@link MethodGroup} per documented behavioral interface in `## Methods`, each
1326
+ * row carrying its `Summary` cell.
684
1327
  *
685
1328
  * @returns One group per documented behavioral interface, in document order
686
1329
  */
687
1330
  methods(): readonly MethodGroup[];
1331
+ /**
1332
+ * Lists every `## Surface` or `## Methods` row whose first cell carries no code span — the
1333
+ * rows {@link surface} and {@link methods} skip for want of a name, each entry being the
1334
+ * row's cells joined by ` | `. Such a row reaches neither projection, so no bijection check
1335
+ * can report it and this one names it instead. The `## Surface` rows come first, then the
1336
+ * `## Methods` rows, each in document order.
1337
+ *
1338
+ * @returns One entry per row carrying no code-span name, in document order
1339
+ *
1340
+ * @example
1341
+ * ```ts
1342
+ * guide.unnamed() // ['Widget | class | Represents a widget.']
1343
+ * ```
1344
+ */
1345
+ unnamed(): readonly string[];
688
1346
  /**
689
1347
  * Lists every link href in the guide, including table cells.
690
1348
  *
@@ -708,10 +1366,11 @@ export declare interface GuideInterface {
708
1366
  */
709
1367
  tests(): readonly string[];
710
1368
  /**
711
- * Lists every fenced code block in the whole document, in document order — no
712
- * language filter, so a consumer decides which languages its checks read.
1369
+ * Lists every fenced code block in the whole document, tagged or not, each carrying its
1370
+ * nearest preceding heading as `title` — no language filter, so a consumer decides which
1371
+ * languages its checks read.
713
1372
  *
714
- * @returns Every fence's language and verbatim code, in document order
1373
+ * @returns Every fence's language, verbatim code, and nearest preceding heading title, in document order
715
1374
  *
716
1375
  * @example
717
1376
  * ```ts
@@ -746,6 +1405,41 @@ export declare type GuideModule = string | readonly string[];
746
1405
  */
747
1406
  export declare function hasCanonicalSegments(key: string): boolean;
748
1407
 
1408
+ /**
1409
+ * Computes a category-separated identity for a guide finding.
1410
+ *
1411
+ * @param spec - The guide inventory key the drift belongs to
1412
+ * @param drift - The categorized disagreement
1413
+ * @returns The inventory key, category, and compared key separated by line feeds
1414
+ *
1415
+ * @example Identify categorized drift
1416
+ * ```ts
1417
+ * import { identifyDrift } from '@orkestrel/guide'
1418
+ *
1419
+ * identifyDrift('guides/widget.md', { category: 'summary', key: 'function open' })
1420
+ * // 'guides/widget.md\nsummary\nfunction open'
1421
+ * ```
1422
+ */
1423
+ export declare function identifyDrift(spec: string, drift: Drift): string;
1424
+
1425
+ /**
1426
+ * Checks whether `value` is a well-formed {@link Drift} — a compared `key` with an optional
1427
+ * `guide` and `source` text.
1428
+ *
1429
+ * @param value - The value to test
1430
+ * @returns True if `value` is a well-formed {@link Drift}; false otherwise
1431
+ *
1432
+ * @example
1433
+ * ```ts
1434
+ * isDrift({ key: 'class Widget', category: 'summary', guide: 'A widget.' }) // true
1435
+ * isDrift({ guide: 'A widget.' }) // false
1436
+ * ```
1437
+ */
1438
+ export declare const isDrift: Guard<Drift>;
1439
+
1440
+ /** Checks whether `value` names a supported drift category. */
1441
+ export declare const isDriftCategory: Guard<DriftCategory>;
1442
+
749
1443
  /**
750
1444
  * Checks whether `value` is one of the documented {@link ExportKeyword}
751
1445
  * literals — the guard behind extracting a Surface table's `Kind` cell into a
@@ -783,34 +1477,64 @@ export declare function isExternalLink(href: string): boolean;
783
1477
  * or several.
784
1478
  *
785
1479
  * @param value - The value to test
786
- * @returns True if `value` is a well-formed {@link ManifestEntry}; false otherwise
1480
+ * @returns True if `value` is a well-formed {@link ManifestEntry}; false otherwise
1481
+ *
1482
+ * @example
1483
+ * ```ts
1484
+ * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
1485
+ * isManifestEntry({ concept: 1 }) // false
1486
+ * ```
1487
+ */
1488
+ export declare const isManifestEntry: Guard<ManifestEntry>;
1489
+
1490
+ /**
1491
+ * Checks whether `value` is a well-formed {@link MethodEntry} — a `name` string with an
1492
+ * optional `summary`.
1493
+ *
1494
+ * @param value - The value to test
1495
+ * @returns True if `value` is a well-formed {@link MethodEntry}; false otherwise
787
1496
  *
788
1497
  * @example
789
1498
  * ```ts
790
- * isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
791
- * isManifestEntry({ concept: 1 }) // false
1499
+ * isMethodEntry({ name: 'walk' }) // true
1500
+ * isMethodEntry({ name: 1 }) // false
792
1501
  * ```
793
1502
  */
794
- export declare const isManifestEntry: Guard<ManifestEntry>;
1503
+ export declare const isMethodEntry: Guard<MethodEntry>;
795
1504
 
796
1505
  /**
797
1506
  * Checks whether `value` is a well-formed {@link MethodGroup} — a backticked
798
- * `interface` name paired with its documented `methods`.
1507
+ * `interface` name paired with its documented {@link MethodEntry} rows.
799
1508
  *
800
1509
  * @param value - The value to test
801
1510
  * @returns True if `value` is a well-formed {@link MethodGroup}; false otherwise
802
1511
  *
803
1512
  * @example
804
1513
  * ```ts
805
- * isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
806
- * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
1514
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: [{ name: 'walk' }] }) // true
1515
+ * isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
807
1516
  * ```
808
1517
  */
809
1518
  export declare const isMethodGroup: Guard<MethodGroup>;
810
1519
 
1520
+ /**
1521
+ * Checks whether `value` is a well-formed {@link SourceExample} — a `name` and `code`
1522
+ * string with an optional `title` and `language`.
1523
+ *
1524
+ * @param value - The value to test
1525
+ * @returns True if `value` is a well-formed {@link SourceExample}; false otherwise
1526
+ *
1527
+ * @example
1528
+ * ```ts
1529
+ * isSourceExample({ name: 'walk', code: 'walk()' }) // true
1530
+ * isSourceExample({ name: 'walk' }) // false
1531
+ * ```
1532
+ */
1533
+ export declare const isSourceExample: Guard<SourceExample>;
1534
+
811
1535
  /**
812
1536
  * Checks whether `value` is a well-formed {@link SurfaceSymbol} — a `name`
813
- * string paired with a valid {@link ExportKeyword}.
1537
+ * string paired with a valid {@link ExportKeyword}, and an optional `summary`.
814
1538
  *
815
1539
  * @param value - The value to test
816
1540
  * @returns True if `value` is a well-formed {@link SurfaceSymbol}; false otherwise
@@ -838,6 +1562,55 @@ export declare const isSurfaceSymbol: Guard<SurfaceSymbol>;
838
1562
  */
839
1563
  export declare function joinHead(lines: readonly string[], start: number): DeclarationHead | undefined;
840
1564
 
1565
+ /**
1566
+ * Names the header text of the column a `## Surface` table's declaration keyword is read from.
1567
+ */
1568
+ export declare const KIND: string;
1569
+
1570
+ /**
1571
+ * Locates the doc block a compared key attaches to inside one file's text and returns the block's
1572
+ * own character region, so a caller can `slice` the block, rewrite it through
1573
+ * {@link replaceSummary} or {@link replaceExample}, and write the result back through
1574
+ * {@link spliceSpan}. `key` names the pair the way {@link findDrift} names it — a
1575
+ * {@link computeSymbolKey} key for a declaration, an `Owner.member` key for an interface or class
1576
+ * member; the region covers the block's own indentation, and no block carrying the key returns
1577
+ * `undefined`.
1578
+ *
1579
+ * @remarks
1580
+ * Attachment is {@link extractSourceComments}'s, not a second reading of the file: that walk
1581
+ * pairs each eligible block with the physical record it documents, and this function keeps the
1582
+ * record {@link collectKeys} gives `key`. The keys are that one grammar's — the map
1583
+ * {@link extractExports} and {@link extractMemberMethods} each read their own part out of — so
1584
+ * this function runs no head pattern, no member pattern, and no owner-close rule of its own, and
1585
+ * a change to any of them reaches the locator too. Every block {@link collectSummaries} reports
1586
+ * a summary for is reachable by its key, and a block carrying only block tags is reachable too although it carries no summary.
1587
+ * A block it misses is one the comparison never had: a block a blank line separates from its
1588
+ * declaration attaches to the blank line, and a block written inside a template literal or a
1589
+ * string is no genuine span at all. The first block whose record carries the key answers for it,
1590
+ * as the first declaration of a name does everywhere else.
1591
+ *
1592
+ * The region runs from the start of the opener's line, the block's indentation included, to the
1593
+ * character past its closing marker — the raw text {@link replaceSummary} and
1594
+ * {@link replaceExample} each document as the span "as it sits in the file", so a caller slices,
1595
+ * rewrites, and splices with no adjustment and the rewrite keeps the indentation it found. A
1596
+ * block that source material precedes on its own line starts at the opener instead. The region
1597
+ * is read off the aligned JSDoc projection rather than searched for in the text, so an opener
1598
+ * written inside a string never yields one, and line offsets come from
1599
+ * {@link extractSourceLines}'s own records under its stated LF-or-CRLF terminator rule, so a
1600
+ * CRLF file reports the offsets its own bytes carry.
1601
+ *
1602
+ * @param text - One file's whole source text
1603
+ * @param key - The compared key naming the declaration or the member
1604
+ * @returns The block's half-open character region, or `undefined` when no block carries the key
1605
+ *
1606
+ * @example
1607
+ * ```ts
1608
+ * const text = '/**' + ' Walks. *' + '/\nexport function walk(): void {}\n'
1609
+ * locateComment(text, 'function walk') // { start: 0, end: 13 }
1610
+ * ```
1611
+ */
1612
+ export declare function locateComment(text: string, key: string): MarkdownSpan | undefined;
1613
+
841
1614
  /**
842
1615
  * Names the `## By concept` heading text the manifest's run-map table is keyed on.
843
1616
  */
@@ -871,22 +1644,69 @@ export declare interface ManifestEntry {
871
1644
  * manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
872
1645
  * ```
873
1646
  */
874
- export declare const manifestEntryShape: ObjectShape<{
875
- concept: StringShape;
876
- spec: StringShape;
877
- source: UnionShape<readonly [ StringShape, ArrayShape<StringShape>]>;
878
- tests: StringShape;
1647
+ export declare const manifestEntryShape: ObjectShape< {
1648
+ concept: StringShape;
1649
+ spec: StringShape;
1650
+ source: UnionShape<readonly [StringShape, ArrayShape<StringShape>]>;
1651
+ tests: StringShape;
1652
+ }, false>;
1653
+
1654
+ /**
1655
+ * Returns one doc block's unwrapped text with every fenced body replaced by aligned spaces,
1656
+ * so a tag search reads the block's structure and never its example code. A line opening with
1657
+ * three or more backticks or tildes opens a body, the first line opening with a run of the same
1658
+ * character at least as long closes it, an unclosed body runs to the end, and the marker lines
1659
+ * themselves stay. The projection preserves every line and every column, so an index found in
1660
+ * it addresses the same character of the text it was built from.
1661
+ *
1662
+ * @param text - One doc block's unwrapped text, as {@link normalizeComment} returns it
1663
+ * @returns The same text with each fenced body's characters replaced by spaces
1664
+ *
1665
+ * @example
1666
+ * ```ts
1667
+ * maskFences('@example\n~~~\n@decorator()\n~~~').split('\n')[2] // ' '
1668
+ * ```
1669
+ */
1670
+ export declare function maskFences(text: string): string;
1671
+
1672
+ /**
1673
+ * Represents one documented method — its identifier plus the description paragraph the guide's
1674
+ * `Summary` cell and the member's doc block are compared on.
1675
+ */
1676
+ export declare interface MethodEntry {
1677
+ /** Holds the method's identifier. */
1678
+ readonly name: string;
1679
+ /** Holds the normalized description paragraph this side carries, or is absent when it carries none. */
1680
+ readonly summary?: string;
1681
+ }
1682
+
1683
+ /**
1684
+ * Shapes a {@link MethodEntry} — one documented method's `name` paired with its optional
1685
+ * compared `summary`.
1686
+ *
1687
+ * @example
1688
+ * ```ts
1689
+ * import { createContract } from '@orkestrel/contract'
1690
+ * import { methodEntryShape } from '@orkestrel/guide'
1691
+ *
1692
+ * const methodEntry = createContract(methodEntryShape)
1693
+ * methodEntry.is({ name: 'walk' }) // true
1694
+ * ```
1695
+ */
1696
+ export declare const methodEntryShape: ObjectShape< {
1697
+ name: StringShape;
1698
+ summary: OptionalShape<StringShape>;
879
1699
  }, false>;
880
1700
 
881
1701
  /**
882
- * Represents one `#### \`Interface\`` block in a guide's `## Methods` section — the
883
- * documented member names of one behavioral interface.
1702
+ * Represents one behavioral interface a guide's `## Methods` section documents — the H4
1703
+ * heading naming that interface as a code span, and the member entries its table lists.
884
1704
  */
885
1705
  export declare interface MethodGroup {
886
1706
  /** Holds the backticked interface name. */
887
1707
  readonly interface: string;
888
- /** Lists the group's documented Method-cell identifiers, in table order. */
889
- readonly methods: readonly string[];
1708
+ /** Lists the group's documented Method-cell entries, in table order. */
1709
+ readonly methods: readonly MethodEntry[];
890
1710
  }
891
1711
 
892
1712
  /**
@@ -902,9 +1722,12 @@ export declare interface MethodGroup {
902
1722
  * methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
903
1723
  * ```
904
1724
  */
905
- export declare const methodGroupShape: ObjectShape<{
906
- interface: StringShape;
907
- methods: ArrayShape<StringShape>;
1725
+ export declare const methodGroupShape: ObjectShape< {
1726
+ interface: StringShape;
1727
+ methods: ArrayShape<ObjectShape< {
1728
+ name: StringShape;
1729
+ summary: OptionalShape<StringShape>;
1730
+ }, false>>;
908
1731
  }, false>;
909
1732
 
910
1733
  /**
@@ -912,6 +1735,23 @@ export declare const methodGroupShape: ObjectShape<{
912
1735
  */
913
1736
  export declare const METHODS: string;
914
1737
 
1738
+ /**
1739
+ * Returns the canonical body of one genuine JSDoc span — the `/**` opener, the closing
1740
+ * marker, each line's continuation marker, and the block's leading indentation removed,
1741
+ * with per-line trailing whitespace trimmed and the surrounding blank lines dropped. A
1742
+ * line's own indentation beyond the marker is kept, so an `@example` fence body keeps the
1743
+ * shape it was written in.
1744
+ *
1745
+ * @param comment - One complete genuine JSDoc span's raw text
1746
+ * @returns The span's unwrapped body
1747
+ *
1748
+ * @example
1749
+ * ```ts
1750
+ * normalizeComment('/**' + ' Creates a widget. *' + '/') // 'Creates a widget.'
1751
+ * ```
1752
+ */
1753
+ export declare function normalizeComment(comment: string): string;
1754
+
915
1755
  /**
916
1756
  * Normalizes a module scope to its canonical directory list. `'.'` represents
917
1757
  * workspace root; empty, trailing, and dot-segment spellings reduce through
@@ -946,6 +1786,220 @@ export declare function normalizeDirectories(module: GuideModule): readonly stri
946
1786
  */
947
1787
  export declare function normalizeIdentifier(code: string): string;
948
1788
 
1789
+ /**
1790
+ * Returns the canonical compared form of a description paragraph. `{@link Target}` and
1791
+ * `{@link Target | label}` become the code token of the target text, or of the label where one is
1792
+ * written; a target's module part — the inline import form `import('./module.js').` and TSDoc's
1793
+ * package-qualified form `@scope/pkg#` — is dropped first. Every run of whitespace, including a
1794
+ * collapsed continuation marker and a line break, becomes one space, the ends trim, and a code
1795
+ * span keeps its delimiters while its own boundary whitespace goes. The guide's side and the
1796
+ * source's side read through this one form.
1797
+ *
1798
+ * @remarks
1799
+ * The clauses land in a fixed order, because each one decides what the next one sees. Every
1800
+ * single-backtick code span — one backtick per side, no inner backtick, no adjacent backtick —
1801
+ * is located first, so a delimiter the `{@link}` expansion inserts afterwards is never mistaken
1802
+ * for an authored one. The expansion then runs outside those spans
1803
+ * only, so a `{@link}` written inside a code span stays literal on both sides. Whitespace
1804
+ * collapses next, which is what makes a span wrapped across two physical lines comparable at
1805
+ * all. The boundary trim runs last, inside each located span: the markdown parser strips one
1806
+ * space from each end of a code span it reads, and this trim is the symmetric rule that meets
1807
+ * it, so `` ` | ` ``, `` ` |` ``, and `` `|` `` all reach `` `|` `` from either side. A span
1808
+ * whose content is all whitespace keeps one space, because a parser strips nothing from that
1809
+ * one.
1810
+ *
1811
+ * A target's module part is the inline import form `import('./module.js').` or TSDoc's
1812
+ * package-qualified form `@scope/pkg#`, and the expansion drops it, so a cross-file link and the
1813
+ * code token a guide cell documents it with reach the same text. A package qualifier carries `@`
1814
+ * or `/`; text before a `#` carrying neither is JSDoc's member reference, so `{@link Owner#member}`
1815
+ * and `{@link #member}` travel whole and a guide cell documents each as written. An unscoped
1816
+ * package name is spelled like an owner, so `{@link pkg#Name}` travels whole too — write the
1817
+ * scoped or the path form where a cell must drop the package. Everything after a module part
1818
+ * travels: `Owner.member` keeps its owner, and a dotted target no module part precedes is
1819
+ * untouched. A label is text rather than a target, so `{@link Target | label}` renders its label
1820
+ * whole.
1821
+ *
1822
+ * A code span delimited by more than one backtick is outside the compared form's representable
1823
+ * set and travels untouched, as does a code span whose own text carries a backtick: the form
1824
+ * spells every span with one backtick per side, so neither can be written back. A summary that
1825
+ * needs one of those constructs takes another shape: name the construct in prose rather than
1826
+ * expecting the comparison to converge it.
1827
+ *
1828
+ * @param text - A doc block's description paragraph, or a guide cell's flattened text
1829
+ * @returns The compared form of that text
1830
+ *
1831
+ * @example
1832
+ * ```ts
1833
+ * normalizeSummary('Creates a\n{@link Widget}.') // 'Creates a `Widget`.'
1834
+ * normalizeSummary("Reads {@link import('./widgets.js').Widget}.") // 'Reads `Widget`.'
1835
+ * normalizeSummary('Reads {@link @scope/widgets#Widget}.') // 'Reads `Widget`.'
1836
+ * normalizeSummary('Reads {@link Widget#render}.') // 'Reads `Widget#render`.'
1837
+ * normalizeSummary('cells joined by ` | `.') // 'cells joined by `|`.'
1838
+ * ```
1839
+ */
1840
+ export declare function normalizeSummary(text: string): string;
1841
+
1842
+ /**
1843
+ * Composes generic guide-parity inspection and explicit in-memory rewrites over a caller inventory.
1844
+ */
1845
+ export declare class Parity implements ParityInterface {
1846
+ #private;
1847
+ constructor(options: ParityOptions);
1848
+ rows(): readonly ParityRow[];
1849
+ inspect(): ParityResult;
1850
+ document(): ParityRewriteResult;
1851
+ annotate(): ParityRewriteResult;
1852
+ }
1853
+
1854
+ /**
1855
+ * Represents a changed inventory text returned by a parity rewrite.
1856
+ */
1857
+ export declare interface ParityChange {
1858
+ /** Names the changed root-relative inventory path. */
1859
+ readonly path: string;
1860
+ /** Holds the accumulated replacement text for the path. */
1861
+ readonly content: string;
1862
+ }
1863
+
1864
+ /**
1865
+ * Represents the destination an explicit parity rewrite updates.
1866
+ */
1867
+ export declare type ParityDirection = 'guide' | 'source';
1868
+
1869
+ /**
1870
+ * Groups executable-example findings by their independent evidence populations.
1871
+ */
1872
+ export declare interface ParityExampleResult {
1873
+ /** Lists findings for absence of a fence in the configured example language. */
1874
+ readonly fences: readonly ParityFinding[];
1875
+ /** Lists documented functions without example evidence. */
1876
+ readonly functions: readonly ParityFinding[];
1877
+ /** Lists documented methods without example evidence. */
1878
+ readonly methods: readonly ParityFinding[];
1879
+ /** Lists missing top-level guide/source title intersections. */
1880
+ readonly titles: readonly ParityFinding[];
1881
+ }
1882
+
1883
+ /**
1884
+ * Represents a preformatted guides-parity finding.
1885
+ */
1886
+ export declare interface ParityFinding {
1887
+ /** Names the guide or inventory key the finding belongs to. */
1888
+ readonly spec?: string;
1889
+ /** Holds the complete developer-facing finding text. */
1890
+ readonly text: string;
1891
+ }
1892
+
1893
+ /**
1894
+ * Represents a pure guides-parity composition over caller-supplied inventory.
1895
+ */
1896
+ export declare interface ParityInterface {
1897
+ /**
1898
+ * Lists the manifest rows whose guide text is present, joined to parsed guide and source views.
1899
+ *
1900
+ * @returns The shared readonly row views
1901
+ */
1902
+ rows(): readonly ParityRow[];
1903
+ /**
1904
+ * Inspects the configured inventory and groups generic parity findings.
1905
+ *
1906
+ * @returns The grouped parity report
1907
+ */
1908
+ inspect(): ParityResult;
1909
+ /**
1910
+ * Updates guide summaries and titled examples from source authority without touching disk.
1911
+ *
1912
+ * @returns The changed texts and unresolved requested rewrites
1913
+ */
1914
+ document(): ParityRewriteResult;
1915
+ /**
1916
+ * Updates source doc-block summaries and examples from guide authority without touching disk.
1917
+ *
1918
+ * @returns The changed texts and unresolved requested rewrites
1919
+ */
1920
+ annotate(): ParityRewriteResult;
1921
+ }
1922
+
1923
+ /**
1924
+ * Represents the pure inputs that configure a guides-parity composition.
1925
+ */
1926
+ export declare interface ParityOptions {
1927
+ /** Holds the workspace's root-relative path-to-text inventory. */
1928
+ readonly files: Readonly<Record<string, string>>;
1929
+ /** Lists the concept-manifest rows to inspect. */
1930
+ readonly entries: readonly ManifestEntry[];
1931
+ /** Maps each self import specifier to the source scope it exposes. */
1932
+ readonly modules: Readonly<Record<string, GuideModule>>;
1933
+ /** Lists every fence language the package admits. */
1934
+ readonly languages: readonly string[];
1935
+ /** Names the fence language inspected for examples and self imports. */
1936
+ readonly language: string;
1937
+ /** Names the optional README and guide tagline pair. */
1938
+ readonly pitch?: ParityPitch;
1939
+ }
1940
+
1941
+ /**
1942
+ * Names the inventory keys paired for README pitch parity.
1943
+ */
1944
+ export declare interface ParityPitch {
1945
+ /** Names the README inventory key. */
1946
+ readonly readme: string;
1947
+ /** Names the guide inventory key whose tagline the README pitch must match. */
1948
+ readonly spec: string;
1949
+ }
1950
+
1951
+ /**
1952
+ * Groups independently assertable guides-parity findings by subject.
1953
+ */
1954
+ export declare interface ParityResult {
1955
+ /** Lists missing or unusable manifest inputs. */
1956
+ readonly input: readonly ParityFinding[];
1957
+ /** Lists required-section and documented method-group population findings. */
1958
+ readonly sections: readonly ParityFinding[];
1959
+ /** Lists documented-surface and barrel-surface findings. */
1960
+ readonly surface: readonly ParityFinding[];
1961
+ /** Lists behavioral-interface and implementing-class findings. */
1962
+ readonly methods: readonly ParityFinding[];
1963
+ /** Lists documented-group and source-driven behavioral declaration findings. */
1964
+ readonly declarations: readonly ParityFinding[];
1965
+ /** Lists unresolved relative guide links. */
1966
+ readonly links: readonly ParityFinding[];
1967
+ /** Lists missing or vacant documented test links. */
1968
+ readonly tests: readonly ParityFinding[];
1969
+ /** Lists unadmitted fence languages. */
1970
+ readonly fences: readonly ParityFinding[];
1971
+ /** Groups executable-example findings by evidence population. */
1972
+ readonly examples: ParityExampleResult;
1973
+ /** Lists mapped self imports that do not resolve to public exports. */
1974
+ readonly imports: readonly ParityFinding[];
1975
+ /** Lists categorized summary and titled-example disagreements. */
1976
+ readonly drift: readonly ParityFinding[];
1977
+ /** Lists README pitch and guide-tagline disagreements. */
1978
+ readonly pitch: readonly ParityFinding[];
1979
+ }
1980
+
1981
+ /**
1982
+ * Represents the changed texts and unresolved findings from an explicit rewrite.
1983
+ */
1984
+ export declare interface ParityRewriteResult {
1985
+ /** Lists only texts that differ from the input inventory. */
1986
+ readonly changes: readonly ParityChange[];
1987
+ /** Lists requested rewrites that remain unresolved after accumulation. */
1988
+ readonly findings: readonly ParityFinding[];
1989
+ }
1990
+
1991
+ /**
1992
+ * Represents a manifest row joined to its parsed guide and reflected source.
1993
+ */
1994
+ export declare interface ParityRow {
1995
+ /** Holds the manifest row. */
1996
+ readonly entry: ManifestEntry;
1997
+ /** Holds the parsed guide view. */
1998
+ readonly guide: GuideInterface;
1999
+ /** Holds the reflected source view. */
2000
+ readonly source: SourceInterface;
2001
+ }
2002
+
949
2003
  /**
950
2004
  * Parses a `## By concept` manifest table into its {@link ManifestEntry} rows —
951
2005
  * each row's Concept cell (flattened text), Spec / Tests cells (a single link
@@ -966,6 +2020,213 @@ export declare function normalizeIdentifier(code: string): string;
966
2020
  */
967
2021
  export declare function parseManifest(markdown: string, directory: string): readonly ManifestEntry[];
968
2022
 
2023
+ /**
2024
+ * Renders one `@example` block as the guide fence it pairs with — an H3 heading carrying the
2025
+ * block's title, then a fence carrying its language and its code. An untitled block renders the
2026
+ * fence alone, because a fence pairs on its nearest preceding heading and an untitled block
2027
+ * claims none.
2028
+ *
2029
+ * @remarks
2030
+ * The title renders as literal text rather than markdown, so a title carrying backticks or
2031
+ * emphasis reads back through {@link extractFences} as the text the `@example` tag carried.
2032
+ * The heading level is 3 because a guide documents its examples one level under a `##` section;
2033
+ * {@link extractFences} pairs on the nearest preceding heading of any level, so the level is
2034
+ * presentation rather than pairing.
2035
+ *
2036
+ * @param example - The block to render
2037
+ * @returns The heading and fence's markdown source, with no trailing newline
2038
+ *
2039
+ * @example
2040
+ * ```ts
2041
+ * renderExample({ name: 'walk', title: 'Walk a tree', code: 'walk()', language: 'ts' })
2042
+ * // an H3 heading of 'Walk a tree', then a fence tagged `ts` carrying `walk()`
2043
+ * ```
2044
+ */
2045
+ export declare function renderExample(example: SourceExample): string;
2046
+
2047
+ /**
2048
+ * Renders one `## Methods` group — the `####` heading naming the interface as a code span, then
2049
+ * a `Name` and {@link SUMMARY} table with one row per documented member. A member carrying no
2050
+ * summary renders an empty cell, which {@link extractMethods} reads back as an absent summary.
2051
+ *
2052
+ * @remarks
2053
+ * The render carries no `## Methods` heading, for the reason {@link renderSurface} states:
2054
+ * a guide documents one group per interface under that one section heading.
2055
+ *
2056
+ * @param group - The interface and its members
2057
+ * @returns The heading and table's markdown source, with no trailing newline
2058
+ *
2059
+ * @example
2060
+ * ```ts
2061
+ * renderMethods({ interface: 'WidgetInterface', methods: [{ name: 'walk', summary: 'Walks.' }] })
2062
+ * // '#### `WidgetInterface`\n\n| Name | Summary |\n| --- | --- |\n| `walk` | Walks. |'
2063
+ * ```
2064
+ */
2065
+ export declare function renderMethods(group: MethodGroup): string;
2066
+
2067
+ /**
2068
+ * Renders a `## Surface` table from the symbols a source declares — a `Name`, {@link KIND}, and
2069
+ * {@link SUMMARY} table with one row per symbol, the name as a code span, the keyword as its
2070
+ * text, and the summary through {@link buildCell}. A symbol carrying no summary renders an empty
2071
+ * cell, which {@link extractSurface} reads back as an absent summary.
2072
+ *
2073
+ * @remarks
2074
+ * The render carries no `## Surface` heading, because a guide documents its surface in several
2075
+ * tables under their own sub-headings and one of them is what this function produces. Reading the
2076
+ * render back therefore parses it under that heading. `renderMarkdown` pads every cell to one
2077
+ * space, so the render is not the committed column-aligned bytes; the checkout's formatter
2078
+ * re-aligns the table and the reader compares parsed entries rather than bytes.
2079
+ *
2080
+ * @param symbols - The symbols to document, in row order
2081
+ * @returns The table's markdown source, with no trailing newline
2082
+ *
2083
+ * @example
2084
+ * ```ts
2085
+ * renderSurface([{ name: 'walk', keyword: 'function', summary: 'Walks the tree.' }])
2086
+ * // '| Name | Kind | Summary |\n| --- | --- | --- |\n| `walk` | function | Walks the tree. |'
2087
+ * ```
2088
+ */
2089
+ export declare function renderSurface(symbols: readonly SurfaceSymbol[]): string;
2090
+
2091
+ /**
2092
+ * Replaces one compared cell in a guide's text and returns the whole guide back. `key` names the
2093
+ * row the way {@link findDrift} names it — a {@link computeSymbolKey} key for a `## Surface` row,
2094
+ * an `Owner.member` key for a `## Methods` row — and the row's {@link SUMMARY} cell becomes
2095
+ * `summary`. Only the table's own source region is rewritten, so every byte outside it travels
2096
+ * unchanged; a key reaching no cell returns `undefined`, and a row already carrying the summary
2097
+ * returns the guide byte for byte.
2098
+ *
2099
+ * @remarks
2100
+ * A row the key does not reach, a table carrying no {@link SUMMARY} column, and a document whose
2101
+ * parse recorded no region for the table are each a miss, and a miss returns `undefined` rather
2102
+ * than throwing, so a caller reports the key it could not place — the one meaning `undefined`
2103
+ * carries in every replacer here. A row already carrying `summary` returns the guide byte for
2104
+ * byte, because a rewrite would re-pad the whole table for no change; that identity reads both
2105
+ * sides through {@link normalizeSummary}, so a caller passing text the compared form still moves
2106
+ * is a fixed point on the second run rather than a row rewritten forever. The rewritten table
2107
+ * renders one-space padded whatever padding it carried, so the checkout's formatter re-aligns it.
2108
+ *
2109
+ * @param guide - The guide's markdown source
2110
+ * @param key - The compared key naming the row
2111
+ * @param summary - The row's new compared text
2112
+ * @returns The guide's text with that cell replaced, or `undefined` when the key reaches no cell
2113
+ *
2114
+ * @example
2115
+ * ```ts
2116
+ * replaceCell('## Surface\n\n| Name | Kind | Summary |\n| --- | --- | --- |\n| `walk` | function | Walks. |', 'function walk', 'Walks a tree.')
2117
+ * // '## Surface\n\n| Name | Kind | Summary |\n| --- | --- | --- |\n| `walk` | function | Walks a tree. |'
2118
+ * ```
2119
+ */
2120
+ export declare function replaceCell(guide: string, key: string, summary: string): string | undefined;
2121
+
2122
+ /**
2123
+ * Replaces the body of one titled `@example` tag in a doc block's raw text and returns the whole
2124
+ * block back. The tag carrying `example`'s title takes a fence of its language and its code;
2125
+ * every other tag, the description paragraph, the block's indentation, and its continuation
2126
+ * markers all survive. A text that is no doc block, a title no tag carries, and a language or
2127
+ * code the emitted three-backtick fence cannot enclose or the doc block cannot hold each return
2128
+ * `undefined`.
2129
+ *
2130
+ * @remarks
2131
+ * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a
2132
+ * caller reports the block it could not rewrite. Text that opens with no
2133
+ * `/**` is no doc block, for the reason {@link replaceSummary} states. A block carrying no
2134
+ * `@example` tag of that title has nowhere to write, so an untitled tag and a tag carrying
2135
+ * another title are each left alone, and an `example` naming no title misses a block whose tags
2136
+ * all carry one. Code carrying a run of three or more backticks is a body the emitted fence
2137
+ * cannot enclose: the fence is three backticks, {@link maskFences} ends a body at the first line
2138
+ * opening a run at least as long, and {@link collectExamples} reads to the first such run
2139
+ * whatever column it sits at, so writing that body would truncate it and turn a following
2140
+ * `@`-line into a tag. A language or code carrying the doc-comment terminator is a body the
2141
+ * block itself cannot hold: the terminator closes the block where it lands and the file stops
2142
+ * parsing there. Refusing keeps the rewrite total over the bodies it can spell.
2143
+ *
2144
+ * A tag already carrying that language and code returns byte for byte. {@link maskFences} keeps
2145
+ * the current body's own lines out of the tag search, so a fenced body carrying a tag-shaped line
2146
+ * does not end the body early. The body ends at its last line carrying text, so the blank line
2147
+ * separating it from the next tag survives.
2148
+ *
2149
+ * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file
2150
+ * @param example - The block whose language and code the tag's body takes
2151
+ * @returns The block's raw text with that body replaced, or `undefined` for a text that is no
2152
+ * doc block, for a title no `@example` tag carries, and for a language or code the emitted
2153
+ * fence cannot enclose or the doc block cannot hold — a body carrying the doc-comment terminator
2154
+ *
2155
+ * @example
2156
+ * ```ts
2157
+ * replaceExample('/**' + '\n * @example Walk\n * old()\n *' + '/', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })
2158
+ * // the same block, its `@example Walk` body now a fence tagged `ts` carrying `walk()`
2159
+ * ```
2160
+ */
2161
+ export declare function replaceExample(comment: string, example: SourceExample): string | undefined;
2162
+
2163
+ /**
2164
+ * Replaces one titled fence in a guide's text and returns the whole guide back. The first fence
2165
+ * carrying `title` — the pairing {@link findDrift} compares on — takes `example`'s language and
2166
+ * code. Only the fence's own source region is rewritten, so every byte outside it travels
2167
+ * unchanged; a title no fence carries returns `undefined`, and a fence already carrying that
2168
+ * body returns the guide byte for byte.
2169
+ *
2170
+ * @remarks
2171
+ * A title no fence carries and a document whose parse recorded no region for the fence are each a
2172
+ * miss, and a miss returns `undefined` rather than throwing — the one meaning `undefined` carries
2173
+ * in every replacer here. A fence already carrying that language and code returns the guide
2174
+ * byte for byte. A later fence of the same title is outside the pairing and is never rewritten,
2175
+ * which is the rule {@link findDrift} compares under.
2176
+ *
2177
+ * @param guide - The guide's markdown source
2178
+ * @param title - The heading text the fence pairs on
2179
+ * @param example - The block whose language and code the fence takes
2180
+ * @returns The guide's text with that fence replaced, or `undefined` when no fence carries the title
2181
+ *
2182
+ * @example
2183
+ * ```ts
2184
+ * replaceFence(guide, 'Walk', { name: 'walk', title: 'Walk', code: 'walk()', language: 'ts' })
2185
+ * // the guide's text with the fence under its `### Walk` heading carrying `walk()`
2186
+ * ```
2187
+ */
2188
+ export declare function replaceFence(guide: string, title: string, example: SourceExample): string | undefined;
2189
+
2190
+ /**
2191
+ * Replaces one doc block's description paragraph with `summary` and returns the whole block back.
2192
+ * The paragraph is the block's text before its first block tag, and it re-wraps inside `width`;
2193
+ * the blank line before the first tag, every tag line, the block's indentation, and its
2194
+ * continuation markers all survive. A block already carrying the summary returns byte for byte,
2195
+ * and a text that is no doc block and a summary carrying no word each return `undefined`.
2196
+ *
2197
+ * @remarks
2198
+ * A miss returns `undefined`, the one meaning `undefined` carries in every replacer here, so a
2199
+ * caller reports the block it could not rewrite. Text that opens with no
2200
+ * `/**` is no doc block: a single-star `/*` comment reaches this function only by a caller's
2201
+ * mistake, and reshaping it into a doc block would be a silent edit. A `summary` carrying no word
2202
+ * names no paragraph to write, and deleting the block's description on that argument would erase
2203
+ * documentation on the strength of an absent value — a caller with nothing to write writes
2204
+ * nothing.
2205
+ *
2206
+ * A block already carrying `summary` returns byte for byte, which is what keeps a propagation
2207
+ * that finds no drift from rewriting the file: a doc block's own wrapping is not recoverable from
2208
+ * its text, so re-wrapping an unchanged paragraph would move most blocks this package's source
2209
+ * carries. That identity reads both sides through {@link normalizeSummary}, and it holds for a
2210
+ * block carrying no tag as much as for a block carrying several. A block written on one physical
2211
+ * line stays on one line while `summary` still fits inside `width`, and expands otherwise.
2212
+ *
2213
+ * `width` counts characters from the line's first, a tab counting as one, so a wrapped line reads
2214
+ * `${indent} * ${text}` and never passes that count. A caller whose formatter measures a tab as
2215
+ * more than one column passes a smaller width rather than taking the default.
2216
+ *
2217
+ * @param comment - One complete genuine JSDoc span's raw text, as it sits in the file
2218
+ * @param summary - The block's new description paragraph
2219
+ * @param width - The character budget a re-wrapped line stays inside. Default: {@link WRAP_WIDTH}
2220
+ * @returns The block's raw text with that paragraph replaced, or `undefined` for a text that is
2221
+ * no doc block and for a `summary` carrying no word
2222
+ *
2223
+ * @example
2224
+ * ```ts
2225
+ * replaceSummary('/**' + ' Walks. *' + '/', 'Walks a tree.') // '/**' + ' Walks a tree. *' + '/'
2226
+ * ```
2227
+ */
2228
+ export declare function replaceSummary(comment: string, summary: string, width?: number): string | undefined;
2229
+
969
2230
  /**
970
2231
  * Resolves a relative `target` from the directory containing a root-relative
971
2232
  * declaring `file`. A slashless file belongs to the workspace root; path
@@ -1041,7 +2302,10 @@ export declare function selectSectionBlocks(document: MarkdownDocument, heading:
1041
2302
  * filesystem. `Source` never touches disk:
1042
2303
  * the consumer gathers the inventory however their environment allows
1043
2304
  * (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) and
1044
- * passes it in as `files`. Conventional barrel traversal recurses through both
2305
+ * passes it in as `files`.
2306
+ *
2307
+ * @remarks
2308
+ * Conventional barrel traversal recurses through both
1045
2309
  * exact workspace-root `index.ts` and nested `/index.ts` targets. `'.'` is the
1046
2310
  * canonical workspace-root module, module spellings normalize once at
1047
2311
  * construction, and exact opaque inventory keys are never rewritten; keys with
@@ -1052,11 +2316,16 @@ export declare function selectSectionBlocks(document: MarkdownDocument, heading:
1052
2316
  * from; a base the scope does not declare contributes nothing. One declaration
1053
2317
  * answers for a name: the first file in sorted key order that declares the head
1054
2318
  * supplies its members and its bases, and a second file declaring the same name
1055
- * adds nothing. Source projection preserves columns without widening
1056
- * direct/hidden column-zero heads. Literal ECMAScript Unicode identifiers
1057
- * participate in bounded slash-state recognition without escape decoding.
1058
- * Regex recognition is bounded: slash after bare `}` is division, so a
1059
- * post-brace regex statement requires an explicit `;`. General semicolonless
2319
+ * adds nothing. Every reading derives once per instance from the immutable
2320
+ * inventory and is reused — the scope's declaration map on the first `methods`
2321
+ * or `examples` lookup, then each name's members and each example collection
2322
+ * under the name asked for — so a reader asking twice reads the files once and
2323
+ * receives the same records, and a second instance over the same inventory
2324
+ * derives the same readings of its own. Source projection preserves columns
2325
+ * without widening direct/hidden column-zero heads. Literal ECMAScript Unicode
2326
+ * identifiers participate in bounded slash-state recognition without escape
2327
+ * decoding. Regex recognition is bounded: slash after bare `}` is division, so
2328
+ * a post-brace regex statement requires an explicit `;`. General semicolonless
1060
2329
  * declaration/ASI classification is also outside the finite projector, so a
1061
2330
  * slash-leading statement after such a declaration requires an explicit `;`.
1062
2331
  *
@@ -1074,7 +2343,7 @@ export declare function selectSectionBlocks(document: MarkdownDocument, heading:
1074
2343
  * })
1075
2344
  * source.exports() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
1076
2345
  * source.surface() // [{ name: 'Guide', keyword: 'class' }, { name: 'GuideInterface', keyword: 'interface' }]
1077
- * source.methods('GuideInterface') // ['sections']
2346
+ * source.methods('GuideInterface') // [{ name: 'sections' }]
1078
2347
  * source.exists('src/core/Guide.ts') // true
1079
2348
  * ```
1080
2349
  */
@@ -1083,13 +2352,63 @@ export declare class Source implements SourceInterface {
1083
2352
  constructor(options: SourceOptions);
1084
2353
  exports(): readonly SurfaceSymbol[];
1085
2354
  surface(): readonly SurfaceSymbol[];
1086
- methods(name: string): readonly string[];
2355
+ methods(name: string): readonly MethodEntry[];
1087
2356
  exists(relative: string): boolean;
1088
2357
  hidden(): readonly SurfaceSymbol[];
1089
- examples(): readonly string[];
1090
- examples(name: string): readonly string[];
2358
+ examples(): readonly SourceExample[];
2359
+ examples(name: string): readonly SourceExample[];
2360
+ }
2361
+
2362
+ /**
2363
+ * Represents one eligible genuine JSDoc block paired with the physical record it documents —
2364
+ * the block's unwrapped body and the {@link SourceLine} that follows its chain.
2365
+ */
2366
+ export declare interface SourceComment {
2367
+ /**
2368
+ * Holds the authoritative span's unwrapped body: the `/**` opener, the closing marker, each
2369
+ * line's continuation marker, and the block's leading indentation removed, with per-line
2370
+ * trailing whitespace trimmed.
2371
+ */
2372
+ readonly text: string;
2373
+ /** Holds the physical record the block documents — the next record after its chain. */
2374
+ readonly line: SourceLine;
1091
2375
  }
1092
2376
 
2377
+ /**
2378
+ * Represents one `@example` block read from a doc comment — the declaration it documents, its
2379
+ * pairing title, its code, and its fence language.
2380
+ */
2381
+ export declare interface SourceExample {
2382
+ /** Names the declaration or member whose doc block carries the block. */
2383
+ readonly name: string;
2384
+ /** 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. */
2385
+ readonly title?: string;
2386
+ /** Holds the block's code — the body of its fence, or the whole block when it carries no fence. */
2387
+ readonly code: string;
2388
+ /** Holds the info-string language of the block's fence, or is absent when the block carries no fence. */
2389
+ readonly language?: string;
2390
+ }
2391
+
2392
+ /**
2393
+ * Shapes a {@link SourceExample} — one `@example` block's `name`, its optional pairing
2394
+ * `title`, its `code`, and its optional fence `language`.
2395
+ *
2396
+ * @example
2397
+ * ```ts
2398
+ * import { createContract } from '@orkestrel/contract'
2399
+ * import { sourceExampleShape } from '@orkestrel/guide'
2400
+ *
2401
+ * const sourceExample = createContract(sourceExampleShape)
2402
+ * sourceExample.is({ name: 'walk', code: 'walk()' }) // true
2403
+ * ```
2404
+ */
2405
+ export declare const sourceExampleShape: ObjectShape< {
2406
+ name: StringShape;
2407
+ title: OptionalShape<StringShape>;
2408
+ code: StringShape;
2409
+ language: OptionalShape<StringShape>;
2410
+ }, false>;
2411
+
1093
2412
  /**
1094
2413
  * Represents the reflected source truth a guide's documented surface is checked against —
1095
2414
  * a pure view over a consumer-supplied file inventory (see {@link Source}).
@@ -1097,16 +2416,16 @@ export declare class Source implements SourceInterface {
1097
2416
  export declare interface SourceInterface {
1098
2417
  /**
1099
2418
  * Lists every direct declaration in the selected module keys matching
1100
- * `export (async )?(function*?|class|const|interface|type) Name`, by
1101
- * (name, keyword). Module keys are `.ts` inventory keys under the selected
1102
- * directories, excluding each directory's exact root `index.ts` and every
1103
- * `*.test.ts` key. Inventory keys are exact opaque workspace-relative keys,
1104
- * must contain no empty, `.` or `..` segment, and are never normalized.
1105
- * Comment/template payload is excluded through a
1106
- * length-preserving projection, but membership still follows this consumer's
1107
- * uninterrupted column-zero declaration-head grammar. `enum`
1108
- * and other TypeScript export forms are outside this declaration-keyword
1109
- * reflection population, not forbidden by general package policy.
2419
+ * `export (async )?(function*?|class|const|interface|type) Name`, by (name, keyword).
2420
+ *
2421
+ * @remarks
2422
+ * Module keys are `.ts` inventory keys under the selected directories, excluding each directory's
2423
+ * exact root `index.ts` and every `*.test.ts` key. Inventory keys are exact opaque
2424
+ * workspace-relative keys, must contain no empty, `.` or `..` segment, and are never normalized.
2425
+ * Comment/template payload is excluded through a length-preserving projection, but membership
2426
+ * still follows this consumer's uninterrupted column-zero declaration-head grammar. `enum` and
2427
+ * other TypeScript export forms are outside this declaration-keyword reflection population, not
2428
+ * forbidden by general package policy.
1110
2429
  *
1111
2430
  * @returns The selected modules' direct declarations, deduplicated and sorted by name
1112
2431
  */
@@ -1152,8 +2471,9 @@ export declare interface SourceInterface {
1152
2471
  */
1153
2472
  surface(): readonly SurfaceSymbol[];
1154
2473
  /**
1155
- * Returns the call-signature members of the `class` / `interface` named `name`,
1156
- * unioned with the members of every declaration it extends.
2474
+ * Returns the call-signature members of the `class` / `interface` named `name`, unioned with
2475
+ * those of every declaration it extends within the module scope, each with its own doc
2476
+ * block's description paragraph. The first file declaring the name answers for it.
1157
2477
  *
1158
2478
  * @remarks
1159
2479
  * One declaration answers for `name`: the module scope's files are read in
@@ -1172,13 +2492,16 @@ export declare interface SourceInterface {
1172
2492
  * collapses a cycle and a diamond to a single visit.
1173
2493
  *
1174
2494
  * @param name - The declaration's identifier
1175
- * @returns Its declared and inherited method names, deduplicated and sorted, a class `constructor` excluded
2495
+ * @returns Its declared and inherited members, each with its doc block's description paragraph, deduplicated by name and sorted, a class `constructor` excluded
1176
2496
  */
1177
- methods(name: string): readonly string[];
2497
+ methods(name: string): readonly MethodEntry[];
1178
2498
  /**
1179
2499
  * Checks whether a workspace-root-relative path names a file or a directory present
1180
2500
  * in the inventory.
1181
2501
  *
2502
+ * @remarks
2503
+ * A directory counts so a guide's link to a directory resolves.
2504
+ *
1182
2505
  * @param relative - The workspace-root-relative path to look up
1183
2506
  * @returns True if the inventory holds that exact key or any key beneath it; false otherwise
1184
2507
  */
@@ -1201,26 +2524,30 @@ export declare interface SourceInterface {
1201
2524
  */
1202
2525
  hidden(): readonly SurfaceSymbol[];
1203
2526
  /**
1204
- * Lists the names of every exported function whose next-physical-record eligible
1205
- * genuine JSDoc chain ends in a span carrying an exact block-position
1206
- * `@example` tag. Title text is allowed; intervening material severs
1207
- * association.
2527
+ * Lists every `@example` block carried by an exported declaration head — a `type`,
2528
+ * `interface`, `const`, `function`, or `class` head at column zero — whose
2529
+ * next-physical-record eligible genuine JSDoc chain ends in a span holding an `@example` tag
2530
+ * opening a line at its first non-blank column. Each block carries its title, its fence
2531
+ * language, and its code; intervening material severs association. A member's block belongs
2532
+ * to the `name` overload instead.
1208
2533
  *
1209
- * @returns The exported function names carrying an `@example`, in first-seen order
2534
+ * @returns The exported declaration heads' `@example` blocks, in first-seen order
1210
2535
  *
1211
2536
  * @example
1212
2537
  * ```ts
1213
- * source.examples() // ['createGuide', 'createSource']
2538
+ * source.examples() // [{ name: 'createGuide', code: "createGuide('# Guide')" }]
1214
2539
  * ```
1215
2540
  */
1216
- examples(): readonly string[];
2541
+ examples(): readonly SourceExample[];
1217
2542
  /**
1218
- * Lists the members of the `class` / `interface` named `name` whose immediately
1219
- * preceding eligible genuine JSDoc chain, within the declaration body, ends
1220
- * in a span carrying an exact block-position `@example` tag. Title text is
1221
- * allowed; intervening material severs association. Declaration and callable
2543
+ * Lists every `@example` block carried by a member of the `class` / `interface` named
2544
+ * `name` whose immediately preceding eligible genuine JSDoc chain, within the declaration
2545
+ * body, ends in a span holding an `@example` tag opening a line at its first non-blank column.
2546
+ * Each block carries its title, its fence language, and its code; intervening material severs
2547
+ * association. Declaration and callable
1222
2548
  * member eligibility comes from aligned projected code while genuine JSDoc
1223
- * evidence retains its source columns.
2549
+ * evidence retains its source columns. The head's own block belongs to the
2550
+ * no-argument overload instead.
1224
2551
  *
1225
2552
  * @remarks
1226
2553
  * This overload reads only the named declaration's own body, in the first
@@ -1229,14 +2556,14 @@ export declare interface SourceInterface {
1229
2556
  * belongs to the base that declares it.
1230
2557
  *
1231
2558
  * @param name - The declaration's identifier
1232
- * @returns Its own members carrying an `@example`, deduplicated and sorted
2559
+ * @returns Its own members' `@example` blocks, deduplicated by name and title and sorted by name
1233
2560
  *
1234
2561
  * @example
1235
2562
  * ```ts
1236
- * source.examples('GuideInterface') // ['fences', 'links', 'tests']
2563
+ * source.examples('GuideInterface') // [{ name: 'fences', code: 'guide.fences()' }]
1237
2564
  * ```
1238
2565
  */
1239
- examples(name: string): readonly string[];
2566
+ examples(name: string): readonly SourceExample[];
1240
2567
  }
1241
2568
 
1242
2569
  /**
@@ -1280,10 +2607,14 @@ export declare class SourceManager implements SourceManagerInterface {
1280
2607
  sources(): readonly SourceInterface[];
1281
2608
  }
1282
2609
 
1283
- /** Represents a specifier resolver that shares one {@link SourceInterface} per module. */
2610
+ /**
2611
+ * Represents a specifier resolver that shares one {@link SourceInterface} per module and
2612
+ * enumerates those views.
2613
+ */
1284
2614
  export declare interface SourceManagerInterface {
1285
2615
  /**
1286
- * Resolves a mapped specifier to its shared source view.
2616
+ * Resolves a mapped specifier to the shared source view of the module it names, and returns
2617
+ * `undefined` when the policy does not map it — a foreign import.
1287
2618
  *
1288
2619
  * @param specifier - The import specifier to resolve
1289
2620
  * @returns Its source view, or `undefined` when the specifier is not mapped
@@ -1295,8 +2626,8 @@ export declare interface SourceManagerInterface {
1295
2626
  */
1296
2627
  source(specifier: string): SourceInterface | undefined;
1297
2628
  /**
1298
- * Lists every source view the policy maps, sharing the same per-module entities
1299
- * {@link source} returns.
2629
+ * Lists one shared source view per distinct module the policy maps, in first-seen specifier
2630
+ * order, sharing the same per-module entities {@link source} returns.
1300
2631
  *
1301
2632
  * @returns One shared source view per distinct module the policy maps, in first-seen specifier order
1302
2633
  *
@@ -1340,24 +2671,56 @@ export declare interface SourceOptions {
1340
2671
  readonly module: GuideModule;
1341
2672
  }
1342
2673
 
2674
+ /**
2675
+ * Splices `replacement` into `source` over the region `span` addresses, and returns the result.
2676
+ * The text before the region and the text after it travel byte for byte, so a rewrite that
2677
+ * addresses one node's region changes nothing else in the document.
2678
+ *
2679
+ * @param source - The text to rewrite
2680
+ * @param span - The half-open region to replace: the region `MarkdownInterface.span` reports
2681
+ * for a markdown node, or the one {@link locateComment} reports for a doc block
2682
+ * @param replacement - The text to write over that region
2683
+ * @returns The rewritten text
2684
+ *
2685
+ * @example
2686
+ * ```ts
2687
+ * spliceSpan('one two three', { start: 4, end: 7 }, 'TWO') // 'one TWO three'
2688
+ * ```
2689
+ */
2690
+ export declare function spliceSpan(source: string, span: MarkdownSpan, replacement: string): string;
2691
+
2692
+ /**
2693
+ * Names the header text of the column a `## Surface` or `## Methods` table's compared
2694
+ * description paragraph is read from.
2695
+ */
2696
+ export declare const SUMMARY: string;
2697
+
1343
2698
  /**
1344
2699
  * Names the `## Surface` heading text a guide's documented exports section is keyed on.
1345
2700
  */
1346
2701
  export declare const SURFACE: string;
1347
2702
 
1348
2703
  /**
1349
- * Represents one documented / exported symbol — its identifier plus its declaration keyword.
2704
+ * Represents one documented / exported symbol — its identifier, its declaration keyword, and
2705
+ * the description paragraph the guide and the doc block are compared on.
1350
2706
  */
1351
2707
  export declare interface SurfaceSymbol {
1352
2708
  /** Holds the symbol's identifier. */
1353
2709
  readonly name: string;
1354
2710
  /** Holds the symbol's declaration keyword — half of the bijection key alongside {@link name}. */
1355
2711
  readonly keyword: ExportKeyword;
2712
+ /**
2713
+ * Holds the normalized description paragraph this side carries — a guide table's `Summary`
2714
+ * cell, or a doc block's text before its first block tag — and is absent when this side
2715
+ * carries none. Optional, so a hand-built symbol stays valid; {@link computeSymbolKey} never
2716
+ * reads it.
2717
+ */
2718
+ readonly summary?: string;
1356
2719
  }
1357
2720
 
1358
2721
  /**
1359
2722
  * Shapes a {@link SurfaceSymbol} — a documented / exported symbol's `name`
1360
- * paired with its {@link ExportKeyword}.
2723
+ * paired with its {@link ExportKeyword} and its optional compared `summary`.
1361
2724
  *
1362
2725
  * @example
1363
2726
  * ```ts
@@ -1368,9 +2731,10 @@ export declare interface SurfaceSymbol {
1368
2731
  * surfaceSymbol.is({ name: 'Markdown', keyword: 'class' }) // true
1369
2732
  * ```
1370
2733
  */
1371
- export declare const surfaceSymbolShape: ObjectShape<{
1372
- name: StringShape;
1373
- keyword: LiteralShape<readonly ["type", "interface", "const", "function", "class"]>;
2734
+ export declare const surfaceSymbolShape: ObjectShape< {
2735
+ name: StringShape;
2736
+ keyword: LiteralShape<readonly ("function" | "type" | "interface" | "const" | "class")[]>;
2737
+ summary: OptionalShape<StringShape>;
1374
2738
  }, false>;
1375
2739
 
1376
2740
  /**
@@ -1378,4 +2742,54 @@ export declare const surfaceSymbolShape: ObjectShape<{
1378
2742
  */
1379
2743
  export declare const TESTS: string;
1380
2744
 
2745
+ /**
2746
+ * Unwraps one genuine JSDoc span into one content line per physical line — the `/**` opener,
2747
+ * the closing marker, each line's continuation marker, and per-line trailing whitespace removed,
2748
+ * with a line's own indentation past the marker kept. The result is aligned with
2749
+ * `comment.split('\n')`, so an index found in it addresses the same physical line of the span it
2750
+ * was built from, which is what lets a rewrite keep every line it does not replace.
2751
+ * {@link normalizeComment} is this projection joined and trimmed at its ends.
2752
+ *
2753
+ * @param comment - One complete genuine JSDoc span's raw text
2754
+ * @returns One content line per physical line of the span
2755
+ *
2756
+ * @example
2757
+ * ```ts
2758
+ * unwrapComment('/**' + '\n * Walks.\n *' + '/') // ['', 'Walks.', '']
2759
+ * ```
2760
+ */
2761
+ export declare function unwrapComment(comment: string): readonly string[];
2762
+
2763
+ /**
2764
+ * Holds the default character budget a rewritten doc block's description paragraph wraps
2765
+ * inside — the greatest number of characters a re-wrapped line may carry, counted from the
2766
+ * line's first character with a tab counting as one, so a wrapped line reads
2767
+ * `${indent} * ${text}` and never passes that count.
2768
+ *
2769
+ * @remarks
2770
+ * The budget counts characters, not rendered columns. A block indented with tabs therefore
2771
+ * measures each tab as one character, and a formatter that renders a tab wider reads the same
2772
+ * line as longer; a caller whose formatter measures differently passes its own width instead of
2773
+ * taking this default. A doc block's own wrapping is not recoverable from its text either — the
2774
+ * blocks this package's own source carries are hand-wrapped, and no single greedy width
2775
+ * reproduces them — so a rewrite cannot infer a per-block width and falls back to this budget.
2776
+ */
2777
+ export declare const WRAP_WIDTH: number;
2778
+
2779
+ /**
2780
+ * Wraps one paragraph into greedy lines no longer than `width` characters. Every run of
2781
+ * whitespace separates words, and a word longer than `width` takes its own line rather than
2782
+ * being split, so a long code token or URL survives the wrap intact.
2783
+ *
2784
+ * @param text - The paragraph to wrap
2785
+ * @param width - The greatest length a returned line may reach
2786
+ * @returns The wrapped lines, in order, or an empty list when `text` carries no word
2787
+ *
2788
+ * @example
2789
+ * ```ts
2790
+ * wrapText('one two three', 8) // ['one two', 'three']
2791
+ * ```
2792
+ */
2793
+ export declare function wrapText(text: string, width: number): readonly string[];
2794
+
1381
2795
  export { }