@g3nomaly/analyze 0.1.0 → 0.1.2
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/README.md +10 -5
- package/dist/api/bundle-builder.d.ts +29 -10
- package/dist/api/bundle-cache.d.ts +7 -4
- package/dist/api/bundle-loader.d.ts +10 -3
- package/dist/api/create-docs.d.ts +33 -14
- package/dist/api/embedding.d.ts +16 -7
- package/dist/api/errors.d.ts +13 -6
- package/dist/api/list.d.ts +20 -20
- package/dist/api/options.d.ts +18 -22
- package/dist/api/refs.d.ts +24 -21
- package/dist/api/scan.d.ts +24 -12
- package/dist/api/search.d.ts +27 -21
- package/dist/api/services.d.ts +9 -1
- package/dist/api/show.d.ts +15 -19
- package/dist/api/site-reader.d.ts +11 -3
- package/dist/api/site-writer.d.ts +30 -7
- package/dist/api/source.d.ts +23 -12
- package/dist/api/target.d.ts +2 -0
- package/dist/cli.js +670 -238
- package/dist/embeddings/index-builder.d.ts +3 -1
- package/dist/embeddings/model.d.ts +26 -13
- package/dist/embeddings/searcher.d.ts +24 -7
- package/dist/embeddings/vectors.d.ts +3 -1
- package/dist/embeddings/words.d.ts +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +647 -229
- package/dist/model/index.d.ts +416 -188
- package/dist/model/registry.d.ts +204 -11
- package/dist/query/graph.d.ts +83 -26
- package/dist/query/name-search.d.ts +39 -21
- package/dist/query/semantic.d.ts +11 -3
- package/dist/retrieval/describe.d.ts +11 -4
- package/dist/retrieval/filter.d.ts +27 -8
- package/dist/retrieval/index.d.ts +1 -1
- package/dist/retrieval/markdown.d.ts +3 -2
- package/dist/retrieval/report.d.ts +147 -70
- package/dist/retrieval/resolve.d.ts +11 -7
- package/dist/retrieval/retriever.d.ts +34 -23
- package/dist/retrieval/summary.d.ts +6 -3
- package/dist/scanner/code/doc/clean.d.ts +31 -5
- package/dist/scanner/code/doc/index.d.ts +7 -1
- package/dist/scanner/code/doc/markdown.d.ts +6 -1
- package/dist/scanner/code/doc/python.d.ts +6 -1
- package/dist/scanner/code/doc/tagged.d.ts +13 -4
- package/dist/scanner/code/doc/types.d.ts +16 -5
- package/dist/scanner/code/doc/xml.d.ts +6 -1
- package/dist/scanner/code/example.d.ts +31 -10
- package/dist/scanner/code/extract.d.ts +56 -21
- package/dist/scanner/code/grammar.d.ts +20 -5
- package/dist/scanner/code/language.d.ts +100 -66
- package/dist/scanner/code/languages/index.d.ts +21 -7
- package/dist/scanner/code/languages/shared.d.ts +23 -4
- package/dist/scanner/code/planner.d.ts +50 -14
- package/dist/scanner/code/symbols.d.ts +86 -20
- package/dist/scanner/code/types.d.ts +48 -15
- package/dist/scanner/config.d.ts +42 -0
- package/dist/scanner/content.d.ts +49 -14
- package/dist/scanner/decisions/parse.d.ts +20 -11
- package/dist/scanner/decisions/planner.d.ts +20 -8
- package/dist/scanner/docs.d.ts +36 -19
- package/dist/scanner/files.d.ts +44 -19
- package/dist/scanner/glossary/parse.d.ts +17 -7
- package/dist/scanner/glossary/planner.d.ts +15 -8
- package/dist/scanner/glossary/terms.d.ts +57 -27
- package/dist/scanner/graph/builder.d.ts +80 -21
- package/dist/scanner/highlight.d.ts +32 -9
- package/dist/scanner/ignore.d.ts +25 -0
- package/dist/scanner/index.d.ts +5 -2
- package/dist/scanner/markdown/frontmatter.d.ts +18 -3
- package/dist/scanner/markdown/links.d.ts +19 -9
- package/dist/scanner/markdown/outline.d.ts +13 -5
- package/dist/scanner/markdown/renderer.d.ts +32 -13
- package/dist/scanner/openapi/planner.d.ts +20 -8
- package/dist/scanner/packages.d.ts +28 -0
- package/dist/scanner/reporter.d.ts +5 -2
- package/dist/scanner/scanner.d.ts +21 -7
- package/dist/scanner/schema/definitions.d.ts +18 -8
- package/dist/scanner/schema/describe.d.ts +44 -18
- package/dist/scanner/schema/planner.d.ts +6 -3
- package/dist/scanner/schema/registry.d.ts +23 -16
- package/dist/scanner/skills/classify.d.ts +2 -1
- package/dist/scanner/skills/layout.d.ts +27 -9
- package/dist/scanner/skills/planner.d.ts +19 -4
- package/dist/scanner/specs.d.ts +8 -2
- package/dist/scanner/sql/catalog.d.ts +21 -7
- package/dist/scanner/sql/cursor.d.ts +9 -4
- package/dist/scanner/sql/database.d.ts +6 -3
- package/dist/scanner/sql/parse.d.ts +62 -27
- package/dist/scanner/sql/planner.d.ts +6 -2
- package/dist/scanner/sql/query.d.ts +34 -21
- package/dist/scanner/sql/registry.d.ts +24 -10
- package/dist/scanner/sql/source.d.ts +1 -0
- package/dist/scanner/sql/statements.d.ts +9 -3
- package/dist/scanner/sql/tokens.d.ts +25 -12
- package/dist/scanner/tasks/layout.d.ts +22 -10
- package/dist/scanner/tasks/planner.d.ts +64 -9
- package/package.json +2 -2
package/dist/model/registry.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ export declare const NodeGroupSchema: z.ZodMiniEnum<{
|
|
|
22
22
|
export type NodeGroup = z.infer<typeof NodeGroupSchema>;
|
|
23
23
|
/** What the registry states about one node kind. */
|
|
24
24
|
export declare const NodeKindSpecSchema: z.ZodMiniObject<{
|
|
25
|
+
label: z.ZodMiniString<string>;
|
|
26
|
+
description: z.ZodMiniString<string>;
|
|
27
|
+
member: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export type NodeKindSpec = z.infer<typeof NodeKindSpecSchema>;
|
|
30
|
+
export declare const NodeTypeSpecSchema: z.ZodMiniObject<{
|
|
31
|
+
kind: z.ZodMiniString<string>;
|
|
25
32
|
group: z.ZodMiniEnum<{
|
|
26
33
|
entry: "entry";
|
|
27
34
|
file: "file";
|
|
@@ -40,7 +47,7 @@ export declare const NodeKindSpecSchema: z.ZodMiniObject<{
|
|
|
40
47
|
described: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
|
|
41
48
|
}, z.core.$strict>;
|
|
42
49
|
/** The parsed spec of one node kind, with defaults filled in. */
|
|
43
|
-
export type
|
|
50
|
+
export type NodeTypeSpec = z.infer<typeof NodeTypeSpecSchema>;
|
|
44
51
|
/** What the registry states about one top-level section. */
|
|
45
52
|
export declare const SectionSpecSchema: z.ZodMiniObject<{
|
|
46
53
|
label: z.ZodMiniString<string>;
|
|
@@ -73,15 +80,15 @@ export type RelationKindSpec = z.infer<typeof RelationKindSpecSchema>;
|
|
|
73
80
|
export declare const SECTION_REGISTRY: {
|
|
74
81
|
readonly skills: {
|
|
75
82
|
readonly label: 'Skills';
|
|
76
|
-
readonly description: 'Every `SKILL.md` and the files beside it.';
|
|
83
|
+
readonly description: 'Every `SKILL.md` inside the directory of an AI tool, such as `.claude`, and the files beside it.';
|
|
77
84
|
};
|
|
78
85
|
readonly docs: {
|
|
79
86
|
readonly label: 'Docs';
|
|
80
|
-
readonly description: 'Markdown
|
|
87
|
+
readonly description: 'Markdown files.';
|
|
81
88
|
};
|
|
82
89
|
readonly code: {
|
|
83
90
|
readonly label: 'Code';
|
|
84
|
-
readonly description: 'Source files with their classes and functions.';
|
|
91
|
+
readonly description: 'Source files with their classes and functions, and JSON, TOML and YAML files, OpenAPI documents and JSON Schemas among them.';
|
|
85
92
|
};
|
|
86
93
|
readonly database: {
|
|
87
94
|
readonly label: 'Database';
|
|
@@ -92,99 +99,237 @@ export declare const SECTION_REGISTRY: {
|
|
|
92
99
|
readonly description: 'Plans, their phases and their tasks, as task-manager keeps them.';
|
|
93
100
|
};
|
|
94
101
|
};
|
|
95
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Every node kind, in the order filters and legends list them. Each node type of `NODE_TYPE_REGISTRY` belongs to one.
|
|
104
|
+
* A `member` kind is found by search and filters, which return the node it belongs to instead.
|
|
105
|
+
*/
|
|
96
106
|
export declare const NODE_KIND_REGISTRY: {
|
|
107
|
+
readonly folder: {
|
|
108
|
+
readonly label: 'folder';
|
|
109
|
+
readonly description: 'A directory of the repository.';
|
|
110
|
+
};
|
|
111
|
+
readonly package: {
|
|
112
|
+
readonly label: 'package';
|
|
113
|
+
readonly description: 'A directory with a package manifest: an app, a library or a workspace.';
|
|
114
|
+
};
|
|
115
|
+
readonly file: {
|
|
116
|
+
readonly label: 'file';
|
|
117
|
+
readonly description: 'A file: source code, markdown, JSON, TOML, YAML, a skill, a schema, SQL and the rest.';
|
|
118
|
+
};
|
|
119
|
+
readonly namespace: {
|
|
120
|
+
readonly label: 'namespace';
|
|
121
|
+
readonly description: 'A namespace or a module.';
|
|
122
|
+
};
|
|
123
|
+
readonly class: {
|
|
124
|
+
readonly label: 'class';
|
|
125
|
+
readonly description: 'A class.';
|
|
126
|
+
};
|
|
127
|
+
readonly interface: {
|
|
128
|
+
readonly label: 'interface';
|
|
129
|
+
readonly description: 'An interface or a protocol.';
|
|
130
|
+
};
|
|
131
|
+
readonly struct: {
|
|
132
|
+
readonly label: 'struct';
|
|
133
|
+
readonly description: 'A struct or a record.';
|
|
134
|
+
};
|
|
135
|
+
readonly enum: {
|
|
136
|
+
readonly label: 'enum';
|
|
137
|
+
readonly description: 'An enumeration.';
|
|
138
|
+
};
|
|
139
|
+
readonly trait: {
|
|
140
|
+
readonly label: 'trait';
|
|
141
|
+
readonly description: 'A trait or a mixin.';
|
|
142
|
+
};
|
|
143
|
+
readonly type: {
|
|
144
|
+
readonly label: 'type';
|
|
145
|
+
readonly description: 'A type alias.';
|
|
146
|
+
};
|
|
147
|
+
readonly function: {
|
|
148
|
+
readonly label: 'function';
|
|
149
|
+
readonly description: 'A function or a method.';
|
|
150
|
+
};
|
|
151
|
+
readonly term: {
|
|
152
|
+
readonly label: 'term';
|
|
153
|
+
readonly description: 'A word of the project and what it means.';
|
|
154
|
+
};
|
|
155
|
+
readonly decision: {
|
|
156
|
+
readonly label: 'decision';
|
|
157
|
+
readonly description: 'A choice that is costly to undo, with its reason.';
|
|
158
|
+
};
|
|
159
|
+
readonly table: {
|
|
160
|
+
readonly label: 'table';
|
|
161
|
+
readonly description: 'A table of a SQL schema.';
|
|
162
|
+
};
|
|
163
|
+
readonly query: {
|
|
164
|
+
readonly label: 'query';
|
|
165
|
+
readonly description: 'An entry of a SQL query catalog.';
|
|
166
|
+
};
|
|
167
|
+
readonly plan: {
|
|
168
|
+
readonly label: 'plan';
|
|
169
|
+
readonly description: 'A plan of the task tree.';
|
|
170
|
+
};
|
|
171
|
+
readonly phase: {
|
|
172
|
+
readonly label: 'phase';
|
|
173
|
+
readonly description: 'A phase of a plan.';
|
|
174
|
+
};
|
|
175
|
+
readonly task: {
|
|
176
|
+
readonly label: 'task';
|
|
177
|
+
readonly description: 'One unit of work of a phase, with its status.';
|
|
178
|
+
};
|
|
179
|
+
readonly operation: {
|
|
180
|
+
readonly label: 'operation';
|
|
181
|
+
readonly description: 'A method on a path of an API. Found by search, which returns its file.';
|
|
182
|
+
readonly member: true;
|
|
183
|
+
};
|
|
184
|
+
readonly definition: {
|
|
185
|
+
readonly label: 'definition';
|
|
186
|
+
readonly description: 'A named JSON Schema. Found by search, which returns its file.';
|
|
187
|
+
readonly member: true;
|
|
188
|
+
};
|
|
189
|
+
readonly parameter: {
|
|
190
|
+
readonly label: 'parameter';
|
|
191
|
+
readonly description: 'A parameter of a function, an operation or a query. Found by search, which returns its owner.';
|
|
192
|
+
readonly member: true;
|
|
193
|
+
};
|
|
194
|
+
readonly field: {
|
|
195
|
+
readonly label: 'field';
|
|
196
|
+
readonly description: 'A field of a type, a property, a column or a result column. Found by search, which returns its owner.';
|
|
197
|
+
readonly member: true;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Every node type, in the order the site lists them. A node type decides how the scanner reads a node and how
|
|
202
|
+
* its page renders; `kind` names the node kind it belongs to, which is what queries, filters and the graph use.
|
|
203
|
+
*/
|
|
204
|
+
export declare const NODE_TYPE_REGISTRY: {
|
|
97
205
|
readonly section: {
|
|
206
|
+
readonly kind: 'folder';
|
|
98
207
|
readonly group: 'section';
|
|
99
208
|
readonly label: 'section';
|
|
100
209
|
readonly description: 'A top-level group of the site.';
|
|
101
210
|
};
|
|
102
211
|
readonly folder: {
|
|
212
|
+
readonly kind: 'folder';
|
|
103
213
|
readonly group: 'folder';
|
|
104
214
|
readonly label: 'folder';
|
|
105
215
|
readonly description: 'A directory of the repository.';
|
|
106
216
|
};
|
|
217
|
+
readonly package: {
|
|
218
|
+
readonly kind: 'package';
|
|
219
|
+
readonly group: 'folder';
|
|
220
|
+
readonly label: 'package';
|
|
221
|
+
readonly description: 'A directory with a package manifest: an app, a library or a workspace.';
|
|
222
|
+
};
|
|
107
223
|
readonly skill: {
|
|
224
|
+
readonly kind: 'file';
|
|
108
225
|
readonly group: 'file';
|
|
109
226
|
readonly label: 'skill';
|
|
110
227
|
readonly description: 'A `SKILL.md`. The other files of its directory belong to it.';
|
|
111
228
|
};
|
|
112
229
|
readonly reference: {
|
|
230
|
+
readonly kind: 'file';
|
|
113
231
|
readonly group: 'file';
|
|
114
232
|
readonly label: 'reference';
|
|
115
233
|
readonly description: 'A markdown file of a skill.';
|
|
116
234
|
};
|
|
117
235
|
readonly agent: {
|
|
236
|
+
readonly kind: 'file';
|
|
118
237
|
readonly group: 'file';
|
|
119
238
|
readonly label: 'agent';
|
|
120
239
|
readonly description: 'A file in the `agents/` directory of a skill.';
|
|
121
240
|
};
|
|
122
241
|
readonly hook: {
|
|
242
|
+
readonly kind: 'file';
|
|
123
243
|
readonly group: 'file';
|
|
124
244
|
readonly label: 'hook';
|
|
125
245
|
readonly description: 'A file in the `hooks/` directory of a skill.';
|
|
126
246
|
};
|
|
127
247
|
readonly schema: {
|
|
248
|
+
readonly kind: 'file';
|
|
128
249
|
readonly group: 'file';
|
|
129
250
|
readonly label: 'schema';
|
|
130
251
|
readonly description: 'A JSON Schema, or a schema file of a skill.';
|
|
131
252
|
};
|
|
132
253
|
readonly asset: {
|
|
254
|
+
readonly kind: 'file';
|
|
133
255
|
readonly group: 'file';
|
|
134
256
|
readonly label: 'file';
|
|
135
257
|
readonly description: 'Any other file of a skill.';
|
|
136
258
|
};
|
|
137
259
|
readonly document: {
|
|
260
|
+
readonly kind: 'file';
|
|
138
261
|
readonly group: 'file';
|
|
139
262
|
readonly label: 'document';
|
|
140
263
|
readonly description: 'A markdown file.';
|
|
141
264
|
};
|
|
142
265
|
readonly json: {
|
|
266
|
+
readonly kind: 'file';
|
|
143
267
|
readonly group: 'file';
|
|
144
268
|
readonly label: 'JSON';
|
|
145
269
|
readonly description: 'A JSON file.';
|
|
146
270
|
};
|
|
271
|
+
readonly toml: {
|
|
272
|
+
readonly kind: 'file';
|
|
273
|
+
readonly group: 'file';
|
|
274
|
+
readonly label: 'TOML';
|
|
275
|
+
readonly description: 'A TOML file.';
|
|
276
|
+
};
|
|
277
|
+
readonly yaml: {
|
|
278
|
+
readonly kind: 'file';
|
|
279
|
+
readonly group: 'file';
|
|
280
|
+
readonly label: 'YAML';
|
|
281
|
+
readonly description: 'A YAML file.';
|
|
282
|
+
};
|
|
147
283
|
readonly glossary: {
|
|
284
|
+
readonly kind: 'file';
|
|
148
285
|
readonly group: 'file';
|
|
149
286
|
readonly label: 'glossary';
|
|
150
287
|
readonly description: 'A `glossary.md`. Its terms are its entries.';
|
|
151
288
|
};
|
|
152
289
|
readonly decisions: {
|
|
290
|
+
readonly kind: 'file';
|
|
153
291
|
readonly group: 'file';
|
|
154
292
|
readonly label: 'decisions';
|
|
155
293
|
readonly description: 'A `decisions.md`. Its decisions are its entries.';
|
|
156
294
|
};
|
|
157
295
|
readonly api: {
|
|
296
|
+
readonly kind: 'file';
|
|
158
297
|
readonly group: 'file';
|
|
159
298
|
readonly label: 'API';
|
|
160
299
|
readonly description: 'An OpenAPI document. Its operations and definitions are its entries.';
|
|
161
300
|
};
|
|
162
301
|
readonly database: {
|
|
302
|
+
readonly kind: 'file';
|
|
163
303
|
readonly group: 'file';
|
|
164
304
|
readonly label: 'database';
|
|
165
305
|
readonly description: 'A `.sql` file that creates tables. Its tables are its entries.';
|
|
166
306
|
};
|
|
167
307
|
readonly catalog: {
|
|
308
|
+
readonly kind: 'file';
|
|
168
309
|
readonly group: 'file';
|
|
169
310
|
readonly label: 'catalog';
|
|
170
311
|
readonly description: 'A directory of `.sql` files that create no table. Its queries are its entries.';
|
|
171
312
|
};
|
|
172
313
|
readonly plan: {
|
|
314
|
+
readonly kind: 'plan';
|
|
173
315
|
readonly group: 'file';
|
|
174
316
|
readonly label: 'plan';
|
|
175
317
|
readonly description: 'A plan of the task tree. Its phases are its children.';
|
|
176
318
|
};
|
|
177
319
|
readonly phase: {
|
|
320
|
+
readonly kind: 'phase';
|
|
178
321
|
readonly group: 'file';
|
|
179
322
|
readonly label: 'phase';
|
|
180
323
|
readonly description: 'A phase of a plan. Its tasks are its entries.';
|
|
181
324
|
};
|
|
182
325
|
readonly source: {
|
|
326
|
+
readonly kind: 'file';
|
|
183
327
|
readonly group: 'source';
|
|
184
328
|
readonly label: 'code';
|
|
185
329
|
readonly description: 'A source file. Its classes and functions are its entries.';
|
|
186
330
|
};
|
|
187
331
|
readonly namespace: {
|
|
332
|
+
readonly kind: 'namespace';
|
|
188
333
|
readonly group: 'symbol';
|
|
189
334
|
readonly label: 'namespace';
|
|
190
335
|
readonly description: 'A namespace or a module.';
|
|
@@ -192,6 +337,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
192
337
|
readonly container: true;
|
|
193
338
|
};
|
|
194
339
|
readonly class: {
|
|
340
|
+
readonly kind: 'class';
|
|
195
341
|
readonly group: 'symbol';
|
|
196
342
|
readonly label: 'class';
|
|
197
343
|
readonly description: 'A class.';
|
|
@@ -200,6 +346,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
200
346
|
readonly container: true;
|
|
201
347
|
};
|
|
202
348
|
readonly interface: {
|
|
349
|
+
readonly kind: 'interface';
|
|
203
350
|
readonly group: 'symbol';
|
|
204
351
|
readonly label: 'interface';
|
|
205
352
|
readonly description: 'An interface or a protocol.';
|
|
@@ -208,6 +355,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
208
355
|
readonly container: true;
|
|
209
356
|
};
|
|
210
357
|
readonly struct: {
|
|
358
|
+
readonly kind: 'struct';
|
|
211
359
|
readonly group: 'symbol';
|
|
212
360
|
readonly label: 'struct';
|
|
213
361
|
readonly description: 'A struct or a record.';
|
|
@@ -216,6 +364,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
216
364
|
readonly container: true;
|
|
217
365
|
};
|
|
218
366
|
readonly enum: {
|
|
367
|
+
readonly kind: 'enum';
|
|
219
368
|
readonly group: 'symbol';
|
|
220
369
|
readonly label: 'enum';
|
|
221
370
|
readonly description: 'An enumeration.';
|
|
@@ -224,6 +373,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
224
373
|
readonly container: true;
|
|
225
374
|
};
|
|
226
375
|
readonly trait: {
|
|
376
|
+
readonly kind: 'trait';
|
|
227
377
|
readonly group: 'symbol';
|
|
228
378
|
readonly label: 'trait';
|
|
229
379
|
readonly description: 'A trait or a mixin.';
|
|
@@ -232,6 +382,7 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
232
382
|
readonly container: true;
|
|
233
383
|
};
|
|
234
384
|
readonly type: {
|
|
385
|
+
readonly kind: 'type';
|
|
235
386
|
readonly group: 'symbol';
|
|
236
387
|
readonly label: 'type';
|
|
237
388
|
readonly description: 'A type alias.';
|
|
@@ -240,65 +391,76 @@ export declare const NODE_KIND_REGISTRY: {
|
|
|
240
391
|
readonly container: true;
|
|
241
392
|
};
|
|
242
393
|
readonly function: {
|
|
394
|
+
readonly kind: 'function';
|
|
243
395
|
readonly group: 'symbol';
|
|
244
396
|
readonly label: 'function';
|
|
245
397
|
readonly description: 'A function.';
|
|
246
398
|
readonly letter: 'F';
|
|
247
399
|
};
|
|
248
400
|
readonly method: {
|
|
401
|
+
readonly kind: 'function';
|
|
249
402
|
readonly group: 'symbol';
|
|
250
403
|
readonly label: 'method';
|
|
251
404
|
readonly description: 'A method of a type.';
|
|
252
405
|
readonly letter: 'M';
|
|
253
406
|
};
|
|
254
407
|
readonly term: {
|
|
408
|
+
readonly kind: 'term';
|
|
255
409
|
readonly group: 'entry';
|
|
256
410
|
readonly label: 'term';
|
|
257
411
|
readonly description: 'A word of the project and what it means.';
|
|
258
412
|
readonly prose: true;
|
|
259
413
|
};
|
|
260
414
|
readonly decision: {
|
|
415
|
+
readonly kind: 'decision';
|
|
261
416
|
readonly group: 'entry';
|
|
262
417
|
readonly label: 'decision';
|
|
263
418
|
readonly description: 'A choice that is costly to undo, with its reason.';
|
|
264
419
|
readonly prose: true;
|
|
265
420
|
};
|
|
266
421
|
readonly operation: {
|
|
422
|
+
readonly kind: 'operation';
|
|
267
423
|
readonly group: 'entry';
|
|
268
424
|
readonly label: 'operation';
|
|
269
425
|
readonly description: 'A method on a path of an API.';
|
|
270
426
|
readonly described: true;
|
|
271
427
|
};
|
|
272
428
|
readonly definition: {
|
|
429
|
+
readonly kind: 'definition';
|
|
273
430
|
readonly group: 'entry';
|
|
274
431
|
readonly label: 'definition';
|
|
275
432
|
readonly description: 'A named JSON Schema.';
|
|
276
433
|
readonly described: true;
|
|
277
434
|
};
|
|
278
435
|
readonly table: {
|
|
436
|
+
readonly kind: 'table';
|
|
279
437
|
readonly group: 'entry';
|
|
280
438
|
readonly label: 'table';
|
|
281
439
|
readonly description: 'A table of a SQL schema.';
|
|
282
440
|
readonly described: true;
|
|
283
441
|
};
|
|
284
442
|
readonly query: {
|
|
443
|
+
readonly kind: 'query';
|
|
285
444
|
readonly group: 'entry';
|
|
286
445
|
readonly label: 'query';
|
|
287
446
|
readonly description: 'An entry of a SQL query catalog.';
|
|
288
447
|
readonly described: true;
|
|
289
448
|
};
|
|
290
449
|
readonly task: {
|
|
450
|
+
readonly kind: 'task';
|
|
291
451
|
readonly group: 'entry';
|
|
292
452
|
readonly label: 'task';
|
|
293
453
|
readonly description: 'One unit of work of a phase, with its status.';
|
|
294
454
|
readonly prose: true;
|
|
295
455
|
};
|
|
296
456
|
readonly parameter: {
|
|
457
|
+
readonly kind: 'parameter';
|
|
297
458
|
readonly group: 'member';
|
|
298
459
|
readonly label: 'parameter';
|
|
299
460
|
readonly description: 'A parameter of a function, an operation or a query.';
|
|
300
461
|
};
|
|
301
462
|
readonly field: {
|
|
463
|
+
readonly kind: 'field';
|
|
302
464
|
readonly group: 'member';
|
|
303
465
|
readonly label: 'field';
|
|
304
466
|
readonly description: 'A field of a type, a property, a column or a result column.';
|
|
@@ -460,7 +622,9 @@ export declare const RELATION_KIND_REGISTRY: {
|
|
|
460
622
|
};
|
|
461
623
|
/** Slug of a top-level section, such as `code`. */
|
|
462
624
|
export type Section = keyof typeof SECTION_REGISTRY;
|
|
463
|
-
/**
|
|
625
|
+
/** Type of a node, such as `method`, `api` or `table`. Decides how the scanner reads it and how its page renders. */
|
|
626
|
+
export type NodeType = keyof typeof NODE_TYPE_REGISTRY;
|
|
627
|
+
/** Kind of a node, such as `function`, `file` or `table`. What queries, filters and the graph use. */
|
|
464
628
|
export type NodeKind = keyof typeof NODE_KIND_REGISTRY;
|
|
465
629
|
/** Name of a relation family, such as `typing`. */
|
|
466
630
|
export type RelationFamily = keyof typeof RELATION_FAMILY_REGISTRY;
|
|
@@ -468,8 +632,12 @@ export type RelationFamily = keyof typeof RELATION_FAMILY_REGISTRY;
|
|
|
468
632
|
export type EdgeKind = keyof typeof RELATION_KIND_REGISTRY;
|
|
469
633
|
/** The node kinds whose group is one of `G`. */
|
|
470
634
|
export type KindsIn<G extends NodeGroup> = {
|
|
471
|
-
[K in
|
|
472
|
-
}[
|
|
635
|
+
[K in NodeType]: (typeof NODE_TYPE_REGISTRY)[K]['group'] extends G ? K : never;
|
|
636
|
+
}[NodeType];
|
|
637
|
+
/** Every node kind with its parsed spec. */
|
|
638
|
+
export declare const NODE_TYPES: Readonly<Record<NodeType, NodeTypeSpec & {
|
|
639
|
+
kind: NodeKind;
|
|
640
|
+
}>>;
|
|
473
641
|
/** Every node kind with its parsed spec. */
|
|
474
642
|
export declare const NODE_KINDS: Readonly<Record<NodeKind, NodeKindSpec>>;
|
|
475
643
|
/** Every section with its parsed spec. */
|
|
@@ -482,13 +650,38 @@ export declare const RELATION_KINDS: Readonly<Record<EdgeKind, RelationKindSpec
|
|
|
482
650
|
}>>;
|
|
483
651
|
/** The sections, in display order. */
|
|
484
652
|
export declare const SECTIONS: readonly Section[];
|
|
653
|
+
/** Every node type, in registry order. */
|
|
654
|
+
export declare const ALL_NODE_TYPES: readonly NodeType[];
|
|
485
655
|
/** Every node kind, in registry order. */
|
|
486
656
|
export declare const ALL_NODE_KINDS: readonly NodeKind[];
|
|
657
|
+
/**
|
|
658
|
+
* @brief Names the node kind a node type belongs to.
|
|
659
|
+
*
|
|
660
|
+
* @param type - Type of a node, such as `method`.
|
|
661
|
+
* @returns Its kind, such as `function`.
|
|
662
|
+
*/
|
|
663
|
+
export declare function kindOf(type: NodeType): NodeKind;
|
|
664
|
+
/**
|
|
665
|
+
* @brief Tells whether a node kind is a member kind: found by search and filters, which return the node it belongs to.
|
|
666
|
+
*
|
|
667
|
+
* @param kind - Kind of a node, such as `field`.
|
|
668
|
+
*/
|
|
669
|
+
export declare function isMemberKind(kind: NodeKind): boolean;
|
|
487
670
|
/** Every relation kind, in registry order. */
|
|
488
671
|
export declare const EDGE_KINDS: readonly EdgeKind[];
|
|
489
672
|
/** Every relation family, in legend order. */
|
|
490
673
|
export declare const RELATION_FAMILY_NAMES: readonly RelationFamily[];
|
|
491
|
-
/**
|
|
674
|
+
/**
|
|
675
|
+
* Lists the node kinds whose group is one of `groups`, in registry order.
|
|
676
|
+
*
|
|
677
|
+
* @param groups - Groups to keep, such as `symbol` or `entry`.
|
|
678
|
+
* @returns The kinds of those groups.
|
|
679
|
+
*/
|
|
492
680
|
export declare function kindsIn<G extends NodeGroup>(...groups: readonly G[]): readonly KindsIn<G>[];
|
|
493
|
-
/**
|
|
494
|
-
|
|
681
|
+
/**
|
|
682
|
+
* Lists the node kinds for which a flag of the registry is set.
|
|
683
|
+
*
|
|
684
|
+
* @param flag - Flag of the node kind spec to test.
|
|
685
|
+
* @returns The kinds whose flag is set.
|
|
686
|
+
*/
|
|
687
|
+
export declare function kindsWith(flag: 'typeLike' | 'container' | 'described'): ReadonlySet<NodeType>;
|
package/dist/query/graph.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { type BundleMeta, type DocsBundle, type Edge, type GraphNode, type
|
|
2
|
-
/** Tells whether a kind is a row of its entry (`parameter` or `field`) rather than a page or entry of its own. */
|
|
3
|
-
export declare function isDeclarationKind(kind: NodeKind): kind is 'parameter' | 'field';
|
|
1
|
+
import { type BundleMeta, type DocsBundle, type Edge, type GraphNode, type NodeType, type NodeRef, type Route, type Section, type SemanticIndex } from '../model';
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
3
|
+
* Tells whether a kind is a row of its entry (`parameter` or `field`) rather than a page or entry of its own.
|
|
4
|
+
*
|
|
5
|
+
* @param kind - Kind of a node, such as `parameter`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isDeclarationKind(kind: NodeType): kind is 'parameter' | 'field';
|
|
8
|
+
/**
|
|
9
|
+
* @brief The bundle as a graph the app can walk: children, routes and edges in both
|
|
6
10
|
* directions. Built once at startup.
|
|
7
11
|
*
|
|
8
12
|
* Holds the bundle's nodes and meta, the semantic index, and lookup tables
|
|
@@ -10,57 +14,110 @@ export declare function isDeclarationKind(kind: NodeKind): kind is 'parameter' |
|
|
|
10
14
|
* entries by `path#hash`, and edges by source and by target. `web/main.tsx`
|
|
11
15
|
* creates it from the embedded bundle and `api/source.ts` from a loaded one.
|
|
12
16
|
* The web app, `retrieval/` and the search functions in `query/` read it.
|
|
17
|
+
*
|
|
18
|
+
* Create one with `new Graph(bundle)`.
|
|
19
|
+
*
|
|
20
|
+
* @property meta - Title, generation time and generator of the bundle.
|
|
21
|
+
* @property semantic - The embedding model and node vectors for search by meaning, when the bundle has them.
|
|
22
|
+
* @property sections - The sections of the bundle, in display order. Some bundles lack `database`, so a walk over every section goes through this list.
|
|
13
23
|
*/
|
|
14
24
|
export declare class Graph {
|
|
15
25
|
readonly meta: BundleMeta;
|
|
16
|
-
/** The embedding model and node vectors for search by meaning, when the page has them. */
|
|
17
26
|
readonly semantic: SemanticIndex | undefined;
|
|
18
27
|
private readonly nodes;
|
|
19
28
|
private readonly childRefs;
|
|
20
29
|
private readonly routes;
|
|
21
|
-
/** Route path to the page it shows. */
|
|
22
30
|
private readonly pages;
|
|
23
|
-
/** `path#hash` to the entry it names: a symbol, a term or a decision. */
|
|
24
31
|
private readonly anchors;
|
|
25
32
|
private readonly outgoing;
|
|
26
33
|
private readonly incoming;
|
|
27
|
-
/**
|
|
28
|
-
* The sections of the bundle, in display order. A bundle that an older
|
|
29
|
-
* version wrote has no `database` section, so a walk over every section
|
|
30
|
-
* goes through this list.
|
|
31
|
-
*/
|
|
32
34
|
readonly sections: readonly {
|
|
33
35
|
readonly slug: Section;
|
|
34
36
|
readonly node: NodeRef;
|
|
35
37
|
}[];
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Indexes the nodes and edges of a bundle.
|
|
40
|
+
*
|
|
41
|
+
* @param bundle - Bundle to index, from the embedded data or a loaded file.
|
|
42
|
+
*/
|
|
37
43
|
constructor(bundle: DocsBundle);
|
|
38
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Returns the node at `ref`, and throws when there is none.
|
|
46
|
+
*
|
|
47
|
+
* @param ref - Index of the node in the bundle.
|
|
48
|
+
*/
|
|
39
49
|
node(ref: NodeRef): GraphNode;
|
|
40
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Returns the children of a node in display order.
|
|
52
|
+
*
|
|
53
|
+
* @param ref - Index of the parent node.
|
|
54
|
+
*/
|
|
41
55
|
children(ref: NodeRef): readonly NodeRef[];
|
|
42
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* From the section down to the parent of `ref`.
|
|
58
|
+
*
|
|
59
|
+
* @param ref - Index of the node.
|
|
60
|
+
*/
|
|
43
61
|
ancestors(ref: NodeRef): NodeRef[];
|
|
44
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Returns the route of the page that shows a node, and throws when there is no node at `ref`.
|
|
64
|
+
*
|
|
65
|
+
* @param ref - Index of the node.
|
|
66
|
+
* @returns The route of the page, with the hash of the entry when the node is one.
|
|
67
|
+
*/
|
|
45
68
|
route(ref: NodeRef): Route;
|
|
46
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The node a location shows: the entry `hash` names on the page at `path`, else that page.
|
|
71
|
+
*
|
|
72
|
+
* @param path - Page path, with or without leading and trailing slashes, such as `code/src/app.ts`.
|
|
73
|
+
* @param hash - Anchor of an entry on that page, such as `symbol:App.run`, without `#`.
|
|
74
|
+
* @returns The node, or `undefined` when the location names none.
|
|
75
|
+
*/
|
|
47
76
|
at(path: string, hash?: string): NodeRef | undefined;
|
|
48
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Returns the root node of a section, and throws when the bundle lacks it.
|
|
79
|
+
*
|
|
80
|
+
* @param slug - Section slug, such as `code`.
|
|
81
|
+
*/
|
|
49
82
|
section(slug: Section): NodeRef;
|
|
50
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* The section a node is in.
|
|
85
|
+
*
|
|
86
|
+
* @param ref - Index of the node.
|
|
87
|
+
* @returns Index of the section node, or `ref` itself when it is a section.
|
|
88
|
+
*/
|
|
51
89
|
sectionOf(ref: NodeRef): NodeRef;
|
|
52
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Every node below `ref`, depth first, in display order.
|
|
92
|
+
*
|
|
93
|
+
* @param ref - Index of the node whose descendants are listed.
|
|
94
|
+
*/
|
|
53
95
|
descendants(ref: NodeRef): Generator<NodeRef>;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Number of nodes below `ref` whose kind is one of `kinds`.
|
|
98
|
+
*
|
|
99
|
+
* @param ref - Index of the node whose descendants are counted.
|
|
100
|
+
* @param kinds - Kinds to count, such as `table` or `field`.
|
|
101
|
+
*/
|
|
102
|
+
count(ref: NodeRef, kinds: ReadonlySet<NodeType>): number;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the edges that start at a node.
|
|
105
|
+
*
|
|
106
|
+
* @param ref - Index of the source node.
|
|
107
|
+
*/
|
|
57
108
|
edgesFrom(ref: NodeRef): readonly Edge[];
|
|
58
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Returns the edges that end at a node.
|
|
111
|
+
*
|
|
112
|
+
* @param ref - Index of the target node.
|
|
113
|
+
*/
|
|
59
114
|
edgesTo(ref: NodeRef): readonly Edge[];
|
|
60
115
|
/**
|
|
61
|
-
* Name of a node as other places refer to it: `Class.method` for a symbol,
|
|
116
|
+
* @brief Name of a node as other places refer to it: `Class.method` for a symbol,
|
|
62
117
|
* `Class.method(parameter)` for a parameter, `table.column` for a column,
|
|
63
118
|
* `query(:placeholder)` for a placeholder of a query, the file path for a page.
|
|
119
|
+
*
|
|
120
|
+
* @param ref - Index of the node.
|
|
64
121
|
*/
|
|
65
122
|
qualifiedName(ref: NodeRef): string;
|
|
66
123
|
}
|