@orkestrel/guide 0.0.24 → 0.0.25

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,23 +1,9 @@
1
- /**
2
- * Lists the declaration keywords a documented or exported symbol carries, in the order the
3
- * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and
4
- * `surfaceSymbolShape` all derive from.
5
- *
6
- * @remarks
7
- * One frozen list feeds the type, the guard, and the shape, so a keyword cannot be admitted by one
8
- * and refused by another. Comment and template payload is excluded before reflection, and `enum`
9
- * is outside this population rather than forbidden by general package policy.
10
- */
11
- declare const EXPORT_KEYWORDS: readonly ("function" | "type" | "interface" | "const" | "class")[];
12
-
13
- /**
14
- * Represents the declaration keyword a documented / exported symbol carries — the reflected
15
- * `type`, `interface`, `const`, `function`, and `class` heads, derived from
16
- * {@link EXPORT_KEYWORDS} so the type, the guard, and the shape name one
17
- * population. Comment/template payload is excluded before reflection.
18
- * `enum` is outside this population, not forbidden by general package policy.
19
- */
20
- declare type ExportKeyword = (typeof EXPORT_KEYWORDS)[number];
1
+ import type { GuideModule } from '@orkestrel/guide';
2
+ import type { ManifestEntry } from '@orkestrel/guide';
3
+ import type { ParityDirection } from '@orkestrel/guide';
4
+ import type { ParityFinding } from '@orkestrel/guide';
5
+ import type { ParityResult } from '@orkestrel/guide';
6
+ import type { ParityRow } from '@orkestrel/guide';
21
7
 
22
8
  /**
23
9
  * Formats one finding with its guide prefix when needed.
@@ -154,131 +140,6 @@ export declare interface GuideCommandOptions {
154
140
  readonly runner: GuideRunnerFunction;
155
141
  }
156
142
 
157
- /**
158
- * Represents one fenced code block projected from a guide document — its `language` is the
159
- * fence's info-string tag and is absent when the fence is untagged, and its `title` is the
160
- * flattened text of its nearest preceding heading.
161
- */
162
- declare interface GuideFence {
163
- /** Holds the info-string language tag, or `undefined` when the fence is untagged. */
164
- readonly language: string | undefined;
165
- /** Holds the fence's verbatim code body. */
166
- readonly code: string;
167
- /**
168
- * Holds the flattened text of the fence's nearest preceding heading, which pairs the fence
169
- * with the `@example` block carrying that title; absent when no heading precedes it.
170
- */
171
- readonly title?: string;
172
- }
173
-
174
- /**
175
- * Represents the structured, pure view of one parsed guide — every projection extracted and
176
- * cached once at construction (see {@link createGuide}).
177
- */
178
- declare interface GuideInterface {
179
- /**
180
- * Lists the `##` heading names, in document order — the non-vacuousness guard for
181
- * section presence.
182
- *
183
- * @returns The document's `##` heading names, in document order
184
- */
185
- sections(): readonly string[];
186
- /**
187
- * Returns the text of the blockquote following the document's H1 — the guide's tagline, or
188
- * `undefined` when a heading intervenes first.
189
- *
190
- * @returns The tagline, or `undefined` when no blockquote follows an H1 before the next heading
191
- *
192
- * @example Read a guide's tagline
193
- * ```ts
194
- * import { createGuide } from '@orkestrel/guide'
195
- *
196
- * const guide = createGuide('# Widget\n\n> A widget toolkit.\n\n## Surface\n')
197
- * guide.tagline() // 'A widget toolkit.'
198
- * ```
199
- */
200
- tagline(): string | undefined;
201
- /**
202
- * Lists every `## Surface` identifier + keyword — table rows union H3 entity headings whose
203
- * trimmed compared inline content is exactly their backticked code-span name. Each row carries
204
- * its `Summary` cell, located by header text, when the table has that column.
205
- *
206
- * @remarks
207
- * Entries retain encounter order, and the first-seen name + keyword wins. A genuine entity
208
- * heading before its matching class row keeps the heading's summary-less entry; a table row
209
- * before that heading keeps its `Summary`.
210
- *
211
- * @returns The documented surface symbols, in encounter order
212
- */
213
- surface(): readonly SurfaceSymbol[];
214
- /**
215
- * Returns one {@link MethodGroup} per documented behavioral interface in `## Methods`, each
216
- * row carrying its `Summary` cell.
217
- *
218
- * @returns One group per documented behavioral interface, in document order
219
- */
220
- methods(): readonly MethodGroup[];
221
- /**
222
- * Lists every `## Surface` or `## Methods` row whose first cell carries no code span — the
223
- * rows {@link surface} and {@link methods} skip for want of a name, each entry being the
224
- * row's cells joined by ` | `. Such a row reaches neither projection, so no bijection check
225
- * can report it and this one names it instead. The `## Surface` rows come first, then the
226
- * `## Methods` rows, each in document order.
227
- *
228
- * @returns One entry per row carrying no code-span name, in document order
229
- *
230
- * @example
231
- * ```ts
232
- * guide.unnamed() // ['Widget | class | Represents a widget.']
233
- * ```
234
- */
235
- unnamed(): readonly string[];
236
- /**
237
- * Lists every link href in the guide, including table cells.
238
- *
239
- * @returns Every link href in the guide, in walk order
240
- *
241
- * @example
242
- * ```ts
243
- * guide.links() // ['../../src/core/helpers.ts']
244
- * ```
245
- */
246
- links(): readonly string[];
247
- /**
248
- * Lists the relative test links declared under `## Tests`.
249
- *
250
- * @returns The `## Tests` section's link hrefs, in walk order
251
- *
252
- * @example
253
- * ```ts
254
- * guide.tests() // ['../../tests/src/core/Guide.test.ts']
255
- * ```
256
- */
257
- tests(): readonly string[];
258
- /**
259
- * Lists every fenced code block in the whole document, tagged or not, each carrying its
260
- * nearest preceding heading as `title` — no language filter, so a consumer decides which
261
- * languages its checks read.
262
- *
263
- * @returns Every fence's language, verbatim code, and nearest preceding heading title, in document order
264
- *
265
- * @example
266
- * ```ts
267
- * guide.fences() // [{ language: 'ts', code: "import { createGuide } from '@orkestrel/guide'" }]
268
- * ```
269
- */
270
- fences(): readonly GuideFence[];
271
- }
272
-
273
- /**
274
- * Represents the source scope a guide's manifest entry covers — one module directory, or
275
- * several when a layer guide spans multiple source directories (a core module
276
- * plus its backend implementations). `'.'` is the canonical workspace-root
277
- * directory; empty, trailing-slash, and dot-segment spellings canonicalize to
278
- * the same value before reflection.
279
- */
280
- declare type GuideModule = string | readonly string[];
281
-
282
143
  /**
283
144
  * Reads a workspace inventory through the consumer's host reader.
284
145
  *
@@ -319,21 +180,6 @@ export declare interface GuideRunnerOptions {
319
180
  readonly watch: false;
320
181
  }
321
182
 
322
- /**
323
- * Represents one `## By concept` manifest row — a single guides-parity check target, paths
324
- * normalized to workspace root.
325
- */
326
- declare interface ManifestEntry {
327
- /** Holds the concept name — the row's first cell, flattened. */
328
- readonly concept: string;
329
- /** Names the guide `.md` this entry documents, root-relative. */
330
- readonly spec: string;
331
- /** Names the source directory (or directories) the guide documents. */
332
- readonly source: GuideModule;
333
- /** Names the tests directory the guide's `## Tests` links resolve against. */
334
- readonly tests: string;
335
- }
336
-
337
183
  /**
338
184
  * Reads an owned foreign result view and accepts passed modules without unhandled errors.
339
185
  *
@@ -347,99 +193,6 @@ declare interface ManifestEntry {
347
193
  */
348
194
  export declare function matchesGuideResult(result: unknown): boolean;
349
195
 
350
- /**
351
- * Represents one documented method — its identifier plus the description paragraph the guide's
352
- * `Summary` cell and the member's doc block are compared on.
353
- */
354
- declare interface MethodEntry {
355
- /** Holds the method's identifier. */
356
- readonly name: string;
357
- /** Holds the normalized description paragraph this side carries, or is absent when it carries none. */
358
- readonly summary?: string;
359
- }
360
-
361
- /**
362
- * Represents one behavioral interface a guide's `## Methods` section documents — the H4
363
- * heading naming that interface as a code span, and the member entries its table lists.
364
- */
365
- declare interface MethodGroup {
366
- /** Holds the backticked interface name. */
367
- readonly interface: string;
368
- /** Lists the group's documented Method-cell entries, in table order. */
369
- readonly methods: readonly MethodEntry[];
370
- }
371
-
372
- /**
373
- * Represents the destination an explicit parity rewrite updates.
374
- */
375
- declare type ParityDirection = 'guide' | 'source';
376
-
377
- /**
378
- * Groups executable-example findings by their independent evidence populations.
379
- */
380
- declare interface ParityExampleResult {
381
- /** Lists findings for absence of a fence in the configured example language. */
382
- readonly fences: readonly ParityFinding[];
383
- /** Lists documented functions without example evidence. */
384
- readonly functions: readonly ParityFinding[];
385
- /** Lists documented methods without example evidence. */
386
- readonly methods: readonly ParityFinding[];
387
- /** Lists missing top-level guide/source title intersections. */
388
- readonly titles: readonly ParityFinding[];
389
- }
390
-
391
- /**
392
- * Represents a preformatted guides-parity finding.
393
- */
394
- declare interface ParityFinding {
395
- /** Names the guide or inventory key the finding belongs to. */
396
- readonly spec?: string;
397
- /** Holds the complete developer-facing finding text. */
398
- readonly text: string;
399
- }
400
-
401
- /**
402
- * Groups independently assertable guides-parity findings by subject.
403
- */
404
- declare interface ParityResult {
405
- /** Lists missing or unusable manifest inputs. */
406
- readonly input: readonly ParityFinding[];
407
- /** Lists required-section and documented method-group population findings. */
408
- readonly sections: readonly ParityFinding[];
409
- /** Lists documented-surface and barrel-surface findings. */
410
- readonly surface: readonly ParityFinding[];
411
- /** Lists behavioral-interface and implementing-class findings. */
412
- readonly methods: readonly ParityFinding[];
413
- /** Lists documented-group and source-driven behavioral declaration findings. */
414
- readonly declarations: readonly ParityFinding[];
415
- /** Lists unresolved relative guide links. */
416
- readonly links: readonly ParityFinding[];
417
- /** Lists missing or vacant documented test links. */
418
- readonly tests: readonly ParityFinding[];
419
- /** Lists unadmitted fence languages. */
420
- readonly fences: readonly ParityFinding[];
421
- /** Groups executable-example findings by evidence population. */
422
- readonly examples: ParityExampleResult;
423
- /** Lists mapped self imports that do not resolve to public exports. */
424
- readonly imports: readonly ParityFinding[];
425
- /** Lists categorized summary and titled-example disagreements. */
426
- readonly drift: readonly ParityFinding[];
427
- /** Lists README pitch and guide-tagline disagreements. */
428
- readonly pitch: readonly ParityFinding[];
429
- }
430
-
431
- /**
432
- * Represents a manifest row joined to its parsed guide and reflected source.
433
- */
434
- declare interface ParityRow {
435
- /** Holds the manifest row. */
436
- readonly entry: ManifestEntry;
437
- /** Holds the parsed guide view. */
438
- readonly guide: GuideInterface;
439
- /** Holds the reflected source view. */
440
- readonly source: SourceInterface;
441
- }
442
-
443
196
  /**
444
197
  * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.
445
198
  *
@@ -493,198 +246,4 @@ export declare function resolveGuideRoot(root: URL | string): string;
493
246
  */
494
247
  export declare function selectGuidePitch(entries: readonly ManifestEntry[], name: string | undefined): string | undefined;
495
248
 
496
- /**
497
- * Represents one `@example` block read from a doc comment — the declaration it documents, its
498
- * pairing title, its code, and its fence language.
499
- */
500
- declare interface SourceExample {
501
- /** Names the declaration or member whose doc block carries the block. */
502
- readonly name: string;
503
- /** Holds the text after the `@example` tag, which pairs the block with the guide fence under the heading of that text; absent when the tag carries none. */
504
- readonly title?: string;
505
- /** Holds the block's code — the body of its fence, or the whole block when it carries no fence. */
506
- readonly code: string;
507
- /** Holds the info-string language of the block's fence, or is absent when the block carries no fence. */
508
- readonly language?: string;
509
- }
510
-
511
- /**
512
- * Represents the reflected source truth a guide's documented surface is checked against —
513
- * a pure view over a consumer-supplied file inventory (see {@link Source}).
514
- */
515
- declare interface SourceInterface {
516
- /**
517
- * Lists every direct declaration in the selected module keys matching
518
- * `export (async )?(function*?|class|const|interface|type) Name`, by (name, keyword).
519
- *
520
- * @remarks
521
- * Module keys are `.ts` inventory keys under the selected directories, excluding each directory's
522
- * exact root `index.ts` and every `*.test.ts` key. Inventory keys are exact opaque
523
- * workspace-relative keys, must contain no empty, `.` or `..` segment, and are never normalized.
524
- * Comment/template payload is excluded through a length-preserving projection, but membership
525
- * still follows this consumer's uninterrupted column-zero declaration-head grammar. `enum` and
526
- * other TypeScript export forms are outside this declaration-keyword reflection population, not
527
- * forbidden by general package policy.
528
- *
529
- * @returns The selected modules' direct declarations, deduplicated and sorted by name
530
- */
531
- exports(): readonly SurfaceSymbol[];
532
- /**
533
- * Lists every declaration reachable from each selected module's conventional root
534
- * `index.ts` through complete relative `.js` `export *` rows. Unlike
535
- * {@link exports}, this inventories barrel reachability rather than all
536
- * intentional direct declarations under the selected directories.
537
- *
538
- * @remarks
539
- * This pure projection reads only the consumer-supplied inventory. A row must
540
- * be equivalent to `export * from './target.js'`: its target is relative and
541
- * ends in `.js`; either quote, surrounding whitespace, an optional semicolon,
542
- * and an optional trailing line comment are accepted; the inactive quote
543
- * delimiter remains target data. Comment and template spans are masked while
544
- * valid code before or after them remains eligible; markers inside quoted
545
- * target text remain data. Regex recognition is a bounded lexical goal rather
546
- * than TypeScript parser grammar: a slash immediately after bare `}` is treated
547
- * as division, so a post-brace regex statement needs an explicit `;`. General
548
- * semicolonless declaration/ASI classification is also outside the finite
549
- * projector, so callers use an explicit `;` before a slash-leading statement
550
- * after such a declaration. Only the
551
- * terminal `.js` becomes `.ts`, and that
552
- * exact resolved inventory key is used only when its segments are canonical.
553
- * Initial barrel keys must likewise be canonical; relative parent rows that
554
- * reduce to canonical keys remain valid. Exact workspace-root `index.ts` and
555
- * nested targets ending `/index.ts` recurse as barrels, with a
556
- * per-computation visited set terminating cycles; other targets contribute
557
- * direct declarations from `extractExports()`. Missing roots, missing targets, and
558
- * unsupported export forms contribute no symbols while valid siblings continue.
559
- * Repository policy, typechecking, and builds own validation; this is not
560
- * filesystem or TypeScript resolution. The result is deduplicated by
561
- * `computeSymbolKey()`, retains same-name/different-keyword symbols, sorts by name,
562
- * computes lazily, and caches the same readonly array instance.
563
- *
564
- * @returns The conventional barrel-reachable surface
565
- *
566
- * @example
567
- * ```ts
568
- * source.surface() // [{ name: 'Guide', keyword: 'class' }]
569
- * ```
570
- */
571
- surface(): readonly SurfaceSymbol[];
572
- /**
573
- * Returns the call-signature members of the `class` / `interface` named `name`, unioned with
574
- * those of every declaration it extends within the module scope, each with its own doc
575
- * block's description paragraph. The first file declaring the name answers for it.
576
- *
577
- * @remarks
578
- * One declaration answers under each keyword: the module scope's files are
579
- * read in sorted key order and the first one whose located head has a body
580
- * or has bases supplies both the members and the bases, so a second file
581
- * declaring the same name under that keyword adds nothing; a head with
582
- * neither a body nor bases does not count as declared, so an empty
583
- * `export interface X {}` is skipped and resolution continues to a later
584
- * file. The interface answers for `name`, and the class answers when no
585
- * interface declares it. Where one file declares `name` as both an
586
- * interface and a class, which TypeScript merges into one type, both
587
- * answer: each shape's own members come ahead of inherited ones, the
588
- * interface's own first. Resolution reads each head's `extends` clause and follows it
589
- * through this same module scope, keeping the keyword it started from: an
590
- * `interface` chain resolves through interfaces and a `class` chain through
591
- * classes, so a class's `implements` clause is outside the walk. A base the
592
- * scope does not declare — imported from another package, written as a
593
- * qualified name, or declared outside the selected directories —
594
- * contributes no members and is not an error. One visited set per call
595
- * collapses a cycle and a diamond to a single visit.
596
- *
597
- * @param name - The declaration's identifier
598
- * @returns Its declared and inherited members, each with its doc block's description paragraph, deduplicated by name and sorted, a class `constructor` excluded
599
- */
600
- methods(name: string): readonly MethodEntry[];
601
- /**
602
- * Checks whether a workspace-root-relative path names a file or a directory present
603
- * in the inventory.
604
- *
605
- * @remarks
606
- * A directory counts so a guide's link to a directory resolves.
607
- *
608
- * @param relative - The workspace-root-relative path to look up
609
- * @returns True if the inventory holds that exact key or any key beneath it; false otherwise
610
- */
611
- exists(relative: string): boolean;
612
- /**
613
- * Lists every module-scope declaration lacking the `export` keyword — the
614
- * export-discipline reflection `.claude/rules/architecture.md` § Barrel exports
615
- * states — across the same projected physical code lines and declaration
616
- * keywords as {@link exports}. Comment/template payload and
617
- * `enum` are outside this population; projection preserves physical columns
618
- * but does not widen the uninterrupted column-zero declaration-head grammar.
619
- * This does not forbid enums by general package policy. Empty on a conforming module.
620
- *
621
- * @returns The module scope's non-exported declarations, deduplicated and sorted by name
622
- *
623
- * @example
624
- * ```ts
625
- * source.hidden() // []
626
- * ```
627
- */
628
- hidden(): readonly SurfaceSymbol[];
629
- /**
630
- * Lists every `@example` block carried by an exported declaration head — a `type`,
631
- * `interface`, `const`, `function`, or `class` head at column zero — whose
632
- * next-physical-record eligible genuine JSDoc chain ends in a span holding an `@example` tag
633
- * opening a line at its first non-blank column. Each block carries its title, its fence
634
- * language, and its code; intervening material severs association. A member's block belongs
635
- * to the `name` overload instead.
636
- *
637
- * @returns The exported declaration heads' `@example` blocks, in first-seen order
638
- *
639
- * @example
640
- * ```ts
641
- * source.examples() // [{ name: 'createGuide', code: "createGuide('# Guide')" }]
642
- * ```
643
- */
644
- examples(): readonly SourceExample[];
645
- /**
646
- * Lists every `@example` block carried by a member of the `class` / `interface` named
647
- * `name` whose immediately preceding eligible genuine JSDoc chain, within the declaration
648
- * body, ends in a span holding an `@example` tag opening a line at its first non-blank column.
649
- * Each block carries its title, its fence language, and its code; intervening material severs
650
- * association. Declaration and callable
651
- * member eligibility comes from aligned projected code while genuine JSDoc
652
- * evidence retains its source columns. The head's own block belongs to the
653
- * no-argument overload instead.
654
- *
655
- * @remarks
656
- * This overload reads only the named declaration's own body, in the first
657
- * file that declares it, under each keyword. Unlike {@link methods}, the
658
- * overload follows no `extends` clause, so an inherited member's `@example`
659
- * belongs to the base that declares it.
660
- *
661
- * @param name - The declaration's identifier
662
- * @returns Its own members' `@example` blocks, deduplicated by name and title and sorted by name
663
- *
664
- * @example
665
- * ```ts
666
- * source.examples('GuideInterface') // [{ name: 'fences', code: 'guide.fences()' }]
667
- * ```
668
- */
669
- examples(name: string): readonly SourceExample[];
670
- }
671
-
672
- /**
673
- * Represents one documented / exported symbol — its identifier, its declaration keyword, and
674
- * the description paragraph the guide and the doc block are compared on.
675
- */
676
- declare interface SurfaceSymbol {
677
- /** Holds the symbol's identifier. */
678
- readonly name: string;
679
- /** Holds the symbol's declaration keyword — half of the bijection key alongside {@link name}. */
680
- readonly keyword: ExportKeyword;
681
- /**
682
- * Holds the normalized description paragraph this side carries — a guide table's `Summary`
683
- * cell, or a doc block's text before its first block tag — and is absent when this side
684
- * carries none. Optional, so a hand-built symbol stays valid; {@link computeSymbolKey} never
685
- * reads it.
686
- */
687
- readonly summary?: string;
688
- }
689
-
690
249
  export { }