@orkestrel/guide 0.0.4 → 0.0.6
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.
- package/dist/src/core/index.d.cts +904 -9
- package/dist/src/core/index.d.ts +904 -9
- package/package.json +18 -13
- package/dist/src/core/Guide.d.ts +0 -30
- package/dist/src/core/Source.d.ts +0 -35
- package/dist/src/core/constants.d.ts +0 -22
- package/dist/src/core/factories.d.ts +0 -86
- package/dist/src/core/helpers.d.ts +0 -196
- package/dist/src/core/parsers.d.ts +0 -218
- package/dist/src/core/shapers.d.ts +0 -54
- package/dist/src/core/types.d.ts +0 -148
- package/dist/src/core/validators.d.ts +0 -58
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ObjectShape, StringShape, LiteralShape, ArrayShape, UnionShape } from '@orkestrel/contract';
|
|
2
|
-
/**
|
|
3
|
-
* The shape of a {@link SurfaceSymbol} — a documented / exported symbol's
|
|
4
|
-
* `name` paired with its {@link ExportKind}.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { createContract } from '@orkestrel/contract'
|
|
9
|
-
* import { surfaceSymbolShape } from '@orkestrel/guide/core'
|
|
10
|
-
*
|
|
11
|
-
* const surfaceSymbol = createContract(surfaceSymbolShape)
|
|
12
|
-
* surfaceSymbol.is({ name: 'Markdown', kind: 'class' }) // true
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare const surfaceSymbolShape: ObjectShape<{
|
|
16
|
-
name: StringShape;
|
|
17
|
-
kind: LiteralShape<readonly ["type", "interface", "const", "function", "class"]>;
|
|
18
|
-
}, false>;
|
|
19
|
-
/**
|
|
20
|
-
* The shape of a {@link MethodGroup} — a backticked `interface` name paired
|
|
21
|
-
* with its documented `methods`.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* import { createContract } from '@orkestrel/contract'
|
|
26
|
-
* import { methodGroupShape } from '@orkestrel/guide/core'
|
|
27
|
-
*
|
|
28
|
-
* const methodGroup = createContract(methodGroupShape)
|
|
29
|
-
* methodGroup.is({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare const methodGroupShape: ObjectShape<{
|
|
33
|
-
interface: StringShape;
|
|
34
|
-
methods: ArrayShape<StringShape>;
|
|
35
|
-
}, false>;
|
|
36
|
-
/**
|
|
37
|
-
* The shape of a {@link ManifestEntry} — one `## By concept` manifest row,
|
|
38
|
-
* `source` accepting either a single directory or several.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* import { createContract } from '@orkestrel/contract'
|
|
43
|
-
* import { manifestEntryShape } from '@orkestrel/guide/core'
|
|
44
|
-
*
|
|
45
|
-
* const manifestEntry = createContract(manifestEntryShape)
|
|
46
|
-
* manifestEntry.is({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare const manifestEntryShape: ObjectShape<{
|
|
50
|
-
concept: StringShape;
|
|
51
|
-
spec: StringShape;
|
|
52
|
-
source: UnionShape<[ StringShape, ArrayShape<StringShape>]>;
|
|
53
|
-
tests: StringShape;
|
|
54
|
-
}, false>;
|
package/dist/src/core/types.d.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The declaration kind a documented / exported symbol carries — the half of the
|
|
3
|
-
* bijection key (alongside its name) a `## Surface` table's `Kind` column encodes.
|
|
4
|
-
*/
|
|
5
|
-
export type ExportKind = 'type' | 'interface' | 'const' | 'function' | 'class';
|
|
6
|
-
/**
|
|
7
|
-
* One documented / exported symbol — its identifier plus its declaration kind.
|
|
8
|
-
*/
|
|
9
|
-
export interface SurfaceSymbol {
|
|
10
|
-
/** Its identifier. */
|
|
11
|
-
readonly name: string;
|
|
12
|
-
/** Its declaration kind — half of the bijection key alongside {@link name}. */
|
|
13
|
-
readonly kind: ExportKind;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* The source scope a guide's manifest entry covers — one module directory, or
|
|
17
|
-
* several when a layer guide spans multiple source directories (a core module
|
|
18
|
-
* plus its backend implementations).
|
|
19
|
-
*/
|
|
20
|
-
export type GuideModule = string | readonly string[];
|
|
21
|
-
/**
|
|
22
|
-
* One `## By concept` manifest row — a single guides-parity check target, paths
|
|
23
|
-
* normalized to workspace root.
|
|
24
|
-
*/
|
|
25
|
-
export interface ManifestEntry {
|
|
26
|
-
/** The concept name — the row's first cell, flattened. */
|
|
27
|
-
readonly concept: string;
|
|
28
|
-
/** The guide `.md` this entry documents, root-relative. */
|
|
29
|
-
readonly spec: string;
|
|
30
|
-
/** The source directory (or directories) the guide documents. */
|
|
31
|
-
readonly source: GuideModule;
|
|
32
|
-
/** The tests directory the guide's `## Tests` links resolve against. */
|
|
33
|
-
readonly tests: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* One `#### \`Interface\`` block in a guide's `## Methods` section — the
|
|
37
|
-
* documented member names of one behavioral interface.
|
|
38
|
-
*/
|
|
39
|
-
export interface MethodGroup {
|
|
40
|
-
/** The backticked interface name. */
|
|
41
|
-
readonly interface: string;
|
|
42
|
-
/** Its documented Method-cell identifiers, in table order. */
|
|
43
|
-
readonly methods: readonly string[];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The structured, pure view of one parsed guide — every projection extracted and
|
|
47
|
-
* cached once at construction (see {@link createGuide}).
|
|
48
|
-
*/
|
|
49
|
-
export interface GuideInterface {
|
|
50
|
-
/** The `##` heading names, in document order — the non-vacuousness guard for section presence. */
|
|
51
|
-
sections(): readonly string[];
|
|
52
|
-
/** Every `## Surface` identifier + kind — table rows union backticked entity headings. */
|
|
53
|
-
surface(): readonly SurfaceSymbol[];
|
|
54
|
-
/** One {@link MethodGroup} per documented behavioral interface in `## Methods`. */
|
|
55
|
-
methods(): readonly MethodGroup[];
|
|
56
|
-
/**
|
|
57
|
-
* Every link href in the guide, including table cells.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* guide.links() // ['../../src/core/helpers.ts']
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
links(): readonly string[];
|
|
65
|
-
/**
|
|
66
|
-
* The relative test links declared under `## Tests`.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* guide.tests() // ['../../tests/src/core/Guide.test.ts']
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
tests(): readonly string[];
|
|
74
|
-
/**
|
|
75
|
-
* Every fenced `ts` code block's body text, whole document.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* guide.patterns() // ["import { createGuide } from '@orkestrel/guide'"]
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
patterns(): readonly string[];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* The reflected source truth a guide's documented surface is checked against —
|
|
86
|
-
* a pure view over a consumer-supplied file inventory (see {@link Source}).
|
|
87
|
-
*/
|
|
88
|
-
export interface SourceInterface {
|
|
89
|
-
/** Every module-scope export, including type-only, by (name, kind). */
|
|
90
|
-
exports(): readonly SurfaceSymbol[];
|
|
91
|
-
/** The call-signature members of the `class` / `interface` named `name`. */
|
|
92
|
-
methods(name: string): readonly string[];
|
|
93
|
-
/** Whether a workspace-root-relative path exists in the inventory. */
|
|
94
|
-
exists(relative: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Every module-scope declaration LACKING the `export` keyword (AGENTS §5's
|
|
97
|
-
* export-discipline reflection) — empty on a conforming module.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```ts
|
|
101
|
-
* source.hidden() // []
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
hidden(): readonly SurfaceSymbol[];
|
|
105
|
-
/**
|
|
106
|
-
* The names of every exported function whose preceding JSDoc carries `@example`.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* source.examples() // ['createGuide', 'createSource']
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
examples(): readonly string[];
|
|
114
|
-
/**
|
|
115
|
-
* The members of the `class` / `interface` named `name` whose preceding JSDoc,
|
|
116
|
-
* within the declaration body, carries `@example`.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* source.examples('GuideInterface') // ['links', 'tests', 'patterns']
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
examples(name: string): readonly string[];
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* The construction input for a {@link Source} — a consumer-supplied file
|
|
127
|
-
* inventory (root-relative path → file text) plus the module scope to
|
|
128
|
-
* reflect. The consumer gathers `files` however their environment allows
|
|
129
|
-
* (`node:fs` in a Node script, `import.meta.glob` in a browser/vitest run) —
|
|
130
|
-
* `Source` itself never touches disk.
|
|
131
|
-
*/
|
|
132
|
-
export interface SourceOptions {
|
|
133
|
-
/** The workspace's file inventory, root-relative path → file text. */
|
|
134
|
-
readonly files: Readonly<Record<string, string>>;
|
|
135
|
-
/** The source directory (or directories) this guide documents, root-relative. */
|
|
136
|
-
readonly module: GuideModule;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* A declaration head joined into a single line, plus the index of the line
|
|
140
|
-
* carrying its opening `{` — how a head that oxfmt wrapped across lines
|
|
141
|
-
* (printWidth 100) is matched as if it were written on one.
|
|
142
|
-
*/
|
|
143
|
-
export interface DeclarationHead {
|
|
144
|
-
/** The joined, space-separated head text. */
|
|
145
|
-
readonly text: string;
|
|
146
|
-
/** The index (within the source `lines`) of the line ending in `{`. */
|
|
147
|
-
readonly end: number;
|
|
148
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Guard } from '@orkestrel/contract';
|
|
2
|
-
import { ExportKind, ManifestEntry, MethodGroup, SurfaceSymbol } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Whether `value` is one of the five documented {@link ExportKind} literals — the
|
|
5
|
-
* guard behind extracting a Surface table's `Kind` cell into a typed symbol.
|
|
6
|
-
*
|
|
7
|
-
* @param value - The candidate value
|
|
8
|
-
* @returns `true` when `value` is a valid {@link ExportKind}
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* isExportKind('class') // true
|
|
13
|
-
* isExportKind('enum') // false
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare const isExportKind: Guard<ExportKind>;
|
|
17
|
-
/**
|
|
18
|
-
* Whether `value` is a well-formed {@link SurfaceSymbol} — a `name` string
|
|
19
|
-
* paired with a valid {@link ExportKind}.
|
|
20
|
-
*
|
|
21
|
-
* @param value - The value to test
|
|
22
|
-
* @returns `true` when `value` is a well-formed {@link SurfaceSymbol}
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* isSurfaceSymbol({ name: 'Markdown', kind: 'class' }) // true
|
|
27
|
-
* isSurfaceSymbol({ name: 'Markdown', kind: 'enum' }) // false
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare const isSurfaceSymbol: Guard<SurfaceSymbol>;
|
|
31
|
-
/**
|
|
32
|
-
* Whether `value` is a well-formed {@link MethodGroup} — a backticked
|
|
33
|
-
* `interface` name paired with its documented `methods`.
|
|
34
|
-
*
|
|
35
|
-
* @param value - The value to test
|
|
36
|
-
* @returns `true` when `value` is a well-formed {@link MethodGroup}
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* isMethodGroup({ interface: 'MarkdownInterface', methods: ['walk'] }) // true
|
|
41
|
-
* isMethodGroup({ interface: 'MarkdownInterface', methods: [1] }) // false
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare const isMethodGroup: Guard<MethodGroup>;
|
|
45
|
-
/**
|
|
46
|
-
* Whether `value` is a well-formed {@link ManifestEntry} — a `## By concept`
|
|
47
|
-
* manifest row, its `source` accepting either a single directory or several.
|
|
48
|
-
*
|
|
49
|
-
* @param value - The value to test
|
|
50
|
-
* @returns `true` when `value` is a well-formed {@link ManifestEntry}
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* isManifestEntry({ concept: 'Markdown', spec: 'guides/src/markdown.md', source: 'src/core', tests: 'tests/src/core' }) // true
|
|
55
|
-
* isManifestEntry({ concept: 1 }) // false
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const isManifestEntry: Guard<ManifestEntry>;
|