@g3nomaly/analyze 0.0.0-stage → 0.1.1

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.
Files changed (133) hide show
  1. package/LICENSE +95 -0
  2. package/README.md +76 -2
  3. package/dist/THIRD_PARTY_LICENSES.txt +1904 -0
  4. package/dist/api/bundle-builder.d.ts +94 -0
  5. package/dist/api/bundle-cache.d.ts +73 -0
  6. package/dist/api/bundle-loader.d.ts +65 -0
  7. package/dist/api/create-docs.d.ts +91 -0
  8. package/dist/api/embedding.d.ts +41 -0
  9. package/dist/api/errors.d.ts +35 -0
  10. package/dist/api/list.d.ts +106 -0
  11. package/dist/api/options.d.ts +74 -0
  12. package/dist/api/refs.d.ts +136 -0
  13. package/dist/api/scan.d.ts +56 -0
  14. package/dist/api/search.d.ts +132 -0
  15. package/dist/api/services.d.ts +15 -0
  16. package/dist/api/show.d.ts +100 -0
  17. package/dist/api/site-reader.d.ts +19 -0
  18. package/dist/api/site-writer.d.ts +43 -0
  19. package/dist/api/source.d.ts +57 -0
  20. package/dist/api/target.d.ts +12 -0
  21. package/dist/api/template.d.ts +5 -0
  22. package/dist/assets/tree-sitter-c-sharp.wasm +0 -0
  23. package/dist/assets/tree-sitter-c.wasm +0 -0
  24. package/dist/assets/tree-sitter-cpp.wasm +0 -0
  25. package/dist/assets/tree-sitter-go.wasm +0 -0
  26. package/dist/assets/tree-sitter-java.wasm +0 -0
  27. package/dist/assets/tree-sitter-javascript.wasm +0 -0
  28. package/dist/assets/tree-sitter-kotlin.wasm +0 -0
  29. package/dist/assets/tree-sitter-php.wasm +0 -0
  30. package/dist/assets/tree-sitter-python.wasm +0 -0
  31. package/dist/assets/tree-sitter-ruby.wasm +0 -0
  32. package/dist/assets/tree-sitter-rust.wasm +0 -0
  33. package/dist/assets/tree-sitter-scala.wasm +0 -0
  34. package/dist/assets/tree-sitter-tsx.wasm +0 -0
  35. package/dist/assets/tree-sitter-typescript.wasm +0 -0
  36. package/dist/assets/vectors.bin +0 -0
  37. package/dist/assets/vocab.txt +33731 -0
  38. package/dist/cli.js +9317 -0
  39. package/dist/embeddings/abbreviations.d.ts +7 -0
  40. package/dist/embeddings/index-builder.d.ts +12 -0
  41. package/dist/embeddings/index.d.ts +10 -0
  42. package/dist/embeddings/model.d.ts +126 -0
  43. package/dist/embeddings/searcher.d.ts +84 -0
  44. package/dist/embeddings/vectors.d.ts +77 -0
  45. package/dist/embeddings/words.d.ts +46 -0
  46. package/dist/index.d.ts +9 -0
  47. package/dist/index.js +8747 -0
  48. package/dist/model/index.d.ts +788 -0
  49. package/dist/model/registry.d.ts +687 -0
  50. package/dist/query/graph.d.ts +123 -0
  51. package/dist/query/index.d.ts +4 -0
  52. package/dist/query/name-search.d.ts +65 -0
  53. package/dist/query/semantic.d.ts +38 -0
  54. package/dist/query/text.d.ts +22 -0
  55. package/dist/retrieval/describe.d.ts +33 -0
  56. package/dist/retrieval/filter.d.ts +36 -0
  57. package/dist/retrieval/index.d.ts +7 -0
  58. package/dist/retrieval/markdown.d.ts +17 -0
  59. package/dist/retrieval/report.d.ts +291 -0
  60. package/dist/retrieval/resolve.d.ts +31 -0
  61. package/dist/retrieval/retriever.d.ts +105 -0
  62. package/dist/retrieval/summary.d.ts +27 -0
  63. package/dist/scanner/code/doc/clean.d.ts +36 -0
  64. package/dist/scanner/code/doc/index.d.ts +12 -0
  65. package/dist/scanner/code/doc/markdown.d.ts +8 -0
  66. package/dist/scanner/code/doc/python.d.ts +8 -0
  67. package/dist/scanner/code/doc/tagged.d.ts +19 -0
  68. package/dist/scanner/code/doc/types.d.ts +33 -0
  69. package/dist/scanner/code/doc/xml.d.ts +8 -0
  70. package/dist/scanner/code/example.d.ts +57 -0
  71. package/dist/scanner/code/extract.d.ts +113 -0
  72. package/dist/scanner/code/grammar.d.ts +44 -0
  73. package/dist/scanner/code/language.d.ts +183 -0
  74. package/dist/scanner/code/languages/c-family.d.ts +5 -0
  75. package/dist/scanner/code/languages/csharp.d.ts +3 -0
  76. package/dist/scanner/code/languages/ecmascript.d.ts +7 -0
  77. package/dist/scanner/code/languages/go.d.ts +3 -0
  78. package/dist/scanner/code/languages/index.d.ts +33 -0
  79. package/dist/scanner/code/languages/java.d.ts +3 -0
  80. package/dist/scanner/code/languages/kotlin.d.ts +3 -0
  81. package/dist/scanner/code/languages/php.d.ts +3 -0
  82. package/dist/scanner/code/languages/python.d.ts +3 -0
  83. package/dist/scanner/code/languages/ruby.d.ts +3 -0
  84. package/dist/scanner/code/languages/rust.d.ts +3 -0
  85. package/dist/scanner/code/languages/scala.d.ts +3 -0
  86. package/dist/scanner/code/languages/shared.d.ts +36 -0
  87. package/dist/scanner/code/planner.d.ts +107 -0
  88. package/dist/scanner/code/symbols.d.ts +134 -0
  89. package/dist/scanner/code/types.d.ts +126 -0
  90. package/dist/scanner/config.d.ts +42 -0
  91. package/dist/scanner/content.d.ts +73 -0
  92. package/dist/scanner/decisions/parse.d.ts +37 -0
  93. package/dist/scanner/decisions/planner.d.ts +42 -0
  94. package/dist/scanner/docs.d.ts +69 -0
  95. package/dist/scanner/files.d.ts +85 -0
  96. package/dist/scanner/glossary/parse.d.ts +40 -0
  97. package/dist/scanner/glossary/planner.d.ts +49 -0
  98. package/dist/scanner/glossary/terms.d.ts +116 -0
  99. package/dist/scanner/graph/builder.d.ts +114 -0
  100. package/dist/scanner/highlight.d.ts +54 -0
  101. package/dist/scanner/ignore.d.ts +25 -0
  102. package/dist/scanner/index.d.ts +43 -0
  103. package/dist/scanner/markdown/frontmatter.d.ts +24 -0
  104. package/dist/scanner/markdown/links.d.ts +60 -0
  105. package/dist/scanner/markdown/outline.d.ts +35 -0
  106. package/dist/scanner/markdown/renderer.d.ts +63 -0
  107. package/dist/scanner/openapi/planner.d.ts +96 -0
  108. package/dist/scanner/packages.d.ts +28 -0
  109. package/dist/scanner/reporter.d.ts +10 -0
  110. package/dist/scanner/scanner.d.ts +66 -0
  111. package/dist/scanner/schema/definitions.d.ts +79 -0
  112. package/dist/scanner/schema/describe.d.ts +105 -0
  113. package/dist/scanner/schema/planner.d.ts +49 -0
  114. package/dist/scanner/schema/registry.d.ts +68 -0
  115. package/dist/scanner/skills/classify.d.ts +21 -0
  116. package/dist/scanner/skills/layout.d.ts +46 -0
  117. package/dist/scanner/skills/planner.d.ts +61 -0
  118. package/dist/scanner/specs.d.ts +56 -0
  119. package/dist/scanner/sql/catalog.d.ts +98 -0
  120. package/dist/scanner/sql/cursor.d.ts +112 -0
  121. package/dist/scanner/sql/database.d.ts +51 -0
  122. package/dist/scanner/sql/parse.d.ts +122 -0
  123. package/dist/scanner/sql/planner.d.ts +69 -0
  124. package/dist/scanner/sql/query.d.ts +73 -0
  125. package/dist/scanner/sql/registry.d.ts +63 -0
  126. package/dist/scanner/sql/source.d.ts +10 -0
  127. package/dist/scanner/sql/statements.d.ts +42 -0
  128. package/dist/scanner/sql/tokens.d.ts +51 -0
  129. package/dist/scanner/tasks/layout.d.ts +52 -0
  130. package/dist/scanner/tasks/planner.d.ts +130 -0
  131. package/dist/scanner/tasks/schema.d.ts +88 -0
  132. package/dist/scanner/text.d.ts +14 -0
  133. package/package.json +104 -4
@@ -0,0 +1,788 @@
1
+ import { type EdgeKind, type KindsIn, type NodeType, type Section } from './registry';
2
+ /** Index of a node in {@link DocsBundle.nodes}. */
3
+ export type NodeRef = number;
4
+ export { ALL_NODE_KINDS, ALL_NODE_TYPES, EDGE_KINDS, type EdgeKind, kindsIn, kindsWith, isMemberKind, kindOf, NODE_KINDS, NODE_TYPES, type NodeGroup, type NodeKind, type NodeKindSpec, type NodeType, type NodeTypeSpec, RELATION_FAMILIES, RELATION_FAMILY_NAMES, RELATION_KINDS, type RelationFamily, type RelationFamilySpec, type RelationKindSpec, SECTION_SPECS, SECTIONS, type Section, type SectionSpec, } from './registry';
5
+ /** Kinds of a declaration in code. */
6
+ export declare const SYMBOL_KINDS: readonly KindsIn<"symbol">[];
7
+ /** A kind of a declaration in code. */
8
+ export type SymbolKind = KindsIn<'symbol'>;
9
+ /** Kinds a type name can refer to. */
10
+ export declare const TYPE_KINDS: ReadonlySet<SymbolKind>;
11
+ /** Kinds that own member symbols. */
12
+ export declare const CONTAINER_KINDS: ReadonlySet<SymbolKind>;
13
+ /**
14
+ * Kinds of a file that has a page. See `NODE_TYPE_REGISTRY` for what each one is.
15
+ * A `glossary`, `decisions`, `schema`, `api`, `database` or `catalog` node has its entries as children.
16
+ */
17
+ export declare const FILE_KINDS: readonly KindsIn<"file">[];
18
+ /** A kind of a file that has a page. */
19
+ export type FileKind = KindsIn<'file'>;
20
+ /**
21
+ * Kinds shown as an **entry**: a block on the page of the file they are in,
22
+ * with an anchor of its own. Symbols are entries of a source file, terms of a
23
+ * glossary, decisions of a decision log, operations of an OpenAPI document,
24
+ * definitions of an OpenAPI document or a JSON Schema, tables of a database,
25
+ * queries of a query catalog.
26
+ */
27
+ export declare const ENTRY_KINDS: readonly KindsIn<"entry" | "symbol">[];
28
+ /** A kind shown as an entry. */
29
+ export type EntryKind = KindsIn<'symbol' | 'entry'>;
30
+ /** Kinds a node with an id can have: every kind but parameter and field. */
31
+ export declare const LISTED_KINDS: readonly KindsIn<"entry" | "file" | "folder" | "section" | "source" | "symbol">[];
32
+ /**
33
+ * Tells a symbol kind from the others.
34
+ *
35
+ * @param kind - Kind of a node, such as `class` or `function`.
36
+ */
37
+ export declare function isSymbolKind(kind: NodeType): kind is SymbolKind;
38
+ /**
39
+ * Tells the kind of a file with a page from the others.
40
+ *
41
+ * @param kind - Kind of a node, such as `skill` or `document`.
42
+ */
43
+ export declare function isFileKind(kind: NodeType): kind is FileKind;
44
+ /**
45
+ * Tells an entry kind, a symbol included, from the others.
46
+ *
47
+ * @param kind - Kind of a node, such as `term` or `table`.
48
+ */
49
+ export declare function isEntryKind(kind: NodeType): kind is EntryKind;
50
+ /**
51
+ * What every node states, whatever its kind.
52
+ *
53
+ * @property kind - Kind of the node, such as `class`, `table` or `parameter`.
54
+ * @property name - Shown in the tree: a file name, a symbol name, a parameter name.
55
+ * @property parent - The node this one belongs to. `null` for a section.
56
+ * @property slug - Segment of the node's route. Defaults to `name`.
57
+ */
58
+ interface NodeBase<K extends NodeType> {
59
+ readonly kind: K;
60
+ readonly name: string;
61
+ readonly parent: NodeRef | null;
62
+ readonly slug?: string;
63
+ }
64
+ /**
65
+ * One of the top-level groups.
66
+ *
67
+ * @property slug - Section slug, such as `code`.
68
+ */
69
+ export interface SectionNode extends NodeBase<'section'> {
70
+ readonly slug: Section;
71
+ }
72
+ /** A directory of the scanned repository. */
73
+ export type FolderNode = NodeBase<'folder'>;
74
+ /** What a package is: an `app` runs, a `library` is used by other packages, a `workspace` holds packages. */
75
+ export type PackageRole = 'app' | 'library' | 'workspace';
76
+ /**
77
+ * @brief A directory of the scanned repository with a package manifest, such as a `package.json` or a `Cargo.toml`.
78
+ *
79
+ * @property path - Display path of the directory, such as `packages/core`.
80
+ * @property packageName - Name the manifest gives, such as `@g3nomaly/core`, or the directory name when it gives none.
81
+ * @property manifest - Display path of the manifest, such as `packages/core/package.json`.
82
+ * @property version - Version the manifest gives, or `null`.
83
+ * @property description - Description the manifest gives, or `''`.
84
+ */
85
+ export interface PackageNode extends NodeBase<'package'> {
86
+ readonly path: string;
87
+ readonly packageName: string;
88
+ readonly role: PackageRole;
89
+ readonly manifest: string;
90
+ readonly version: string | null;
91
+ readonly description: string;
92
+ }
93
+ /**
94
+ * A heading of a markdown page, for its table of contents.
95
+ *
96
+ * @property id - Anchor of the heading.
97
+ * @property text - Heading text as plain text.
98
+ * @property depth - Heading level, such as `2` for `##`.
99
+ */
100
+ export interface Heading {
101
+ readonly id: string;
102
+ readonly text: string;
103
+ readonly depth: number;
104
+ }
105
+ /**
106
+ * @brief What a file looks like on its page.
107
+ *
108
+ * `markdown` holds the rendered HTML and the headings of the page, `text` a
109
+ * highlighted `<pre>` block (highlighted when the file is small enough),
110
+ * `image` a `data:` URI in `src`, and `omitted` the reason and size of a file
111
+ * that is left out.
112
+ */
113
+ export type FileContent = {
114
+ readonly format: 'markdown';
115
+ readonly html: string;
116
+ readonly headings: readonly Heading[];
117
+ } | {
118
+ readonly format: 'text';
119
+ readonly html: string;
120
+ } | {
121
+ readonly format: 'image';
122
+ readonly src: string;
123
+ } | {
124
+ readonly format: 'omitted';
125
+ readonly reason: 'binary' | 'large';
126
+ readonly bytes: number;
127
+ };
128
+ /**
129
+ * What every file with a page states.
130
+ *
131
+ * @property path - Path as it is on disk, relative to the scanned root. For a `catalog`, the path of its directory.
132
+ * @property title - Frontmatter `title` or `name`, else the first heading, else the file name.
133
+ * @property description - Frontmatter `description`, or `''`.
134
+ * @property content - What the file looks like on its page.
135
+ */
136
+ interface FileFacts {
137
+ readonly path: string;
138
+ readonly title: string;
139
+ readonly description: string;
140
+ readonly content: FileContent;
141
+ }
142
+ /**
143
+ * @brief A file shown as it is.
144
+ *
145
+ * A `skill` node is the skill's `SKILL.md`, and the skill's other files are its descendants.
146
+ * For a `glossary` or `decisions` node, `content` is the text around its entries, and the entries are its children.
147
+ * A `schema` node that is a JSON Schema has its definitions as children.
148
+ * A `catalog` node has no content of its own: its queries are its children.
149
+ */
150
+ export interface FileNode extends NodeBase<Exclude<FileKind, 'api' | 'database' | 'plan' | 'phase'>>, FileFacts {
151
+ }
152
+ /**
153
+ * A base URL an API is served from.
154
+ *
155
+ * @property url - Base URL as the document writes it.
156
+ * @property description - Plain text, or `''`.
157
+ */
158
+ export interface ApiServer {
159
+ readonly url: string;
160
+ readonly description: string;
161
+ }
162
+ /**
163
+ * A group of operations of an OpenAPI document.
164
+ *
165
+ * @property name - Name of the group.
166
+ * @property descriptionHtml - Description rendered as HTML.
167
+ */
168
+ export interface ApiTag {
169
+ readonly name: string;
170
+ readonly descriptionHtml: string;
171
+ }
172
+ /**
173
+ * @brief An OpenAPI document.
174
+ *
175
+ * Its operations and its schema definitions are its children. `title` is the
176
+ * title of the API, `description` its summary, and `content` its description.
177
+ *
178
+ * @property version - Version of the API, from `info.version`.
179
+ * @property specVersion - Version of the OpenAPI format the document is written in, such as `3.1.0`.
180
+ * @property servers - Base URLs the API is served from.
181
+ * @property tags - Tags the document declares, in its order. An operation can name a tag that is not listed here.
182
+ */
183
+ export interface ApiNode extends NodeBase<'api'>, FileFacts {
184
+ readonly version: string;
185
+ readonly specVersion: string;
186
+ readonly servers: readonly ApiServer[];
187
+ readonly tags: readonly ApiTag[];
188
+ }
189
+ /**
190
+ * A view or a trigger of a database schema.
191
+ *
192
+ * @property kind - `view` or `trigger`.
193
+ * @property name - Name of the view or the trigger.
194
+ * @property table - The table a trigger fires on. `''` for a view.
195
+ * @property line - Line of the file where it is created.
196
+ * @property descriptionHtml - Description rendered as HTML.
197
+ * @property sqlHtml - The highlighted statement that creates it.
198
+ */
199
+ export interface DatabaseObject {
200
+ readonly kind: 'view' | 'trigger';
201
+ readonly name: string;
202
+ readonly table: string;
203
+ readonly line: number;
204
+ readonly descriptionHtml: string;
205
+ readonly sqlHtml: string;
206
+ }
207
+ /**
208
+ * @brief A `.sql` file that creates tables.
209
+ *
210
+ * Its tables are its children. `content` is the comment that opens the file.
211
+ *
212
+ * @property objects - Views and triggers, in file order.
213
+ */
214
+ export interface DatabaseNode extends NodeBase<'database'>, FileFacts {
215
+ readonly objects: readonly DatabaseObject[];
216
+ }
217
+ /**
218
+ * A source file. Its symbols are its descendants.
219
+ *
220
+ * @property path - Path of the file, relative to the scanned root.
221
+ * @property language - Name of the language of the file.
222
+ * @property annotationLabel - What the language calls its annotations: `Decorators`, `Attributes` or `Annotations`.
223
+ * @property content - The file's text. Set for a skill's code, `null` in the code section.
224
+ */
225
+ export interface SourceNode extends NodeBase<'source'> {
226
+ readonly path: string;
227
+ readonly language: string;
228
+ readonly annotationLabel: string;
229
+ readonly content: FileContent | null;
230
+ }
231
+ /** `[start, end, target]`: the characters `start` to `end` of a text name the node `target`. */
232
+ export type TextLink = readonly [start: number, end: number, target: NodeRef];
233
+ /**
234
+ * Source text in which some spans name other nodes, such as `Promise<Booking>` with `Booking` linked.
235
+ *
236
+ * @property text - The text as written in the source.
237
+ * @property links - Spans of the text that name a node, in text order, not overlapping.
238
+ */
239
+ export interface LinkedText {
240
+ readonly text: string;
241
+ readonly links: readonly TextLink[];
242
+ }
243
+ /** Doc comment tags that are not folded into parameters, return value or fields. */
244
+ export type DocTagKind = 'throws' | 'deprecated' | 'see' | 'since' | 'other';
245
+ /**
246
+ * A tag of a doc comment, such as `@throws` or `@deprecated`.
247
+ *
248
+ * @property kind - Which tag it is: `throws`, `deprecated`, `see`, `since` or `other`.
249
+ * @property label - Original tag label, for example `typeParam`. Set when `kind` is `other`.
250
+ * @property subject - What the tag is about, such as the exception type of a `throws` tag, or `null`.
251
+ * @property html - Text of the tag as HTML.
252
+ */
253
+ export interface DocTag {
254
+ readonly kind: DocTagKind;
255
+ readonly label?: string;
256
+ readonly subject: LinkedText | null;
257
+ readonly html: string;
258
+ }
259
+ /**
260
+ * What a function returns: its type and the description of its doc comment.
261
+ *
262
+ * @property type - Return type, or `null` when none is known.
263
+ * @property descriptionHtml - Description of the return value as HTML.
264
+ */
265
+ export interface ReturnInfo {
266
+ readonly type: LinkedText | null;
267
+ readonly descriptionHtml: string;
268
+ }
269
+ /**
270
+ * A highlighted usage example of a symbol.
271
+ *
272
+ * @property html - The highlighted code.
273
+ * @property origin - `documented` comes from the doc comment, `generated` from the signature.
274
+ */
275
+ export interface SymbolExample {
276
+ readonly html: string;
277
+ readonly origin: 'documented' | 'generated';
278
+ }
279
+ /**
280
+ * A class, function or other definition. Its parameters, fields and member symbols are its children.
281
+ *
282
+ * @property anchor - Unique within the file and safe in a URL hash.
283
+ * @property line - Line of the file where the declaration starts.
284
+ * @property signatureHtml - Highlighted declaration head. Empty for a type the scanner inferred from its members.
285
+ * @property modifiers - Keywords in front of the declaration, such as `export`, `static` or `async`.
286
+ * @property annotations - Decorators, attributes and annotations, verbatim.
287
+ * @property descriptionHtml - Description rendered as HTML.
288
+ * @property returns - What the symbol returns, or `null`.
289
+ * @property tags - Doc comment tags that are not folded into parameters, return value or fields.
290
+ * @property example - Usage example, or `null`.
291
+ */
292
+ export interface SymbolNode extends NodeBase<SymbolKind> {
293
+ readonly anchor: string;
294
+ readonly line: number;
295
+ readonly signatureHtml: string;
296
+ readonly modifiers: readonly string[];
297
+ readonly annotations: readonly string[];
298
+ readonly descriptionHtml: string;
299
+ readonly returns: ReturnInfo | null;
300
+ readonly tags: readonly DocTag[];
301
+ readonly example: SymbolExample | null;
302
+ }
303
+ /** Where an operation of an API takes a parameter from. */
304
+ export type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
305
+ /**
306
+ * What parameters and fields share: a declaration from the signature, a description from the doc comment.
307
+ *
308
+ * @property type - Declared type, or `null`.
309
+ * @property defaultValue - Default value of a parameter, initializer of a field, value of an enum member. `null` when none.
310
+ * @property optional - Whether it may be left out.
311
+ * @property descriptionHtml - Description rendered as HTML.
312
+ * @property column - The table column a declaration of a query stands for: the column a
313
+ * parameter is compared with or stored in, the column a result column
314
+ * selects. Set when the statement shows one and the scan has that table.
315
+ */
316
+ interface Declaration {
317
+ readonly type: LinkedText | null;
318
+ readonly defaultValue: string | null;
319
+ readonly optional: boolean;
320
+ readonly descriptionHtml: string;
321
+ readonly column?: NodeRef;
322
+ }
323
+ /**
324
+ * @brief A parameter of a function, of a type's constructor, of an API operation or of a query.
325
+ *
326
+ * `name` carries a variadic marker, as in `...rest`, or the marker of a SQL placeholder, as in `:map_id`.
327
+ *
328
+ * @property location - Where an API operation takes it from. Set for a parameter of an API operation.
329
+ */
330
+ export interface ParameterNode extends NodeBase<'parameter'>, Declaration {
331
+ readonly location?: ParameterLocation;
332
+ }
333
+ /**
334
+ * @brief A field, property or enum member of a type, a property of a schema
335
+ * definition, a column of a table, or a column of the rows a query returns.
336
+ *
337
+ * @property annotations - Further facts about the field, verbatim: annotations in code, constraints
338
+ * of a property such as `format: date`, constraints of a column such as
339
+ * `UNIQUE`, the expression behind a result column such as `COUNT(*)`.
340
+ */
341
+ export interface FieldNode extends NodeBase<'field'>, Declaration {
342
+ readonly annotations: readonly string[];
343
+ }
344
+ /**
345
+ * One term of a glossary: a word of the project's language and what it means.
346
+ *
347
+ * @property anchor - Unique within the glossary and safe in a URL hash.
348
+ * @property group - Heading the glossary lists the term under, or `''`.
349
+ * @property definitionHtml - Definition rendered as HTML.
350
+ * @property avoid - Words the glossary tells writers to replace with this term.
351
+ */
352
+ export interface TermNode extends NodeBase<'term'> {
353
+ readonly anchor: string;
354
+ readonly group: string;
355
+ readonly definitionHtml: string;
356
+ readonly avoid: readonly string[];
357
+ }
358
+ /**
359
+ * One decision of a decision log: what was decided and why.
360
+ *
361
+ * @property anchor - Unique within the log and safe in a URL hash.
362
+ * @property id - Number or id in front of the title, such as `3` or `ADR-0003`. `''` when the title has none.
363
+ * @property status - As written in the log, such as `accepted` or `superseded by 7`. `''` when the decision states none.
364
+ * @property date - As written in the log. `''` when the decision states none.
365
+ * @property html - Text of the decision rendered as HTML.
366
+ */
367
+ export interface DecisionNode extends NodeBase<'decision'> {
368
+ readonly anchor: string;
369
+ readonly id: string;
370
+ readonly status: string;
371
+ readonly date: string;
372
+ readonly html: string;
373
+ }
374
+ /**
375
+ * One media type of a request body or a response, with the schema of its content.
376
+ *
377
+ * @property mediaType - Such as `application/json`.
378
+ * @property schema - The schema as a type expression, such as `Booking[]`. `null` when the document gives none.
379
+ */
380
+ export interface ApiContent {
381
+ readonly mediaType: string;
382
+ readonly schema: LinkedText | null;
383
+ }
384
+ /**
385
+ * The request body of an operation.
386
+ *
387
+ * @property required - Whether the body must be sent.
388
+ * @property descriptionHtml - Description rendered as HTML.
389
+ * @property content - Media types the body can have.
390
+ */
391
+ export interface ApiRequestBody {
392
+ readonly required: boolean;
393
+ readonly descriptionHtml: string;
394
+ readonly content: readonly ApiContent[];
395
+ }
396
+ /**
397
+ * One response of an operation.
398
+ *
399
+ * @property status - Status code or range as the document writes it: `200`, `4XX`, `default`.
400
+ * @property descriptionHtml - Description rendered as HTML.
401
+ * @property content - Media types of the response body.
402
+ */
403
+ export interface ApiResponse {
404
+ readonly status: string;
405
+ readonly descriptionHtml: string;
406
+ readonly content: readonly ApiContent[];
407
+ }
408
+ /**
409
+ * @brief One operation of an OpenAPI document: a method on a path, or a webhook.
410
+ *
411
+ * `name` is the method and the path, as in `GET /bookings/{id}`. Its
412
+ * parameters are its children.
413
+ *
414
+ * @property anchor - Unique within the document and safe in a URL hash.
415
+ * @property method - HTTP method in capitals.
416
+ * @property urlPath - Path template, such as `/bookings/{id}`. For a webhook, its name.
417
+ * @property operationId - `operationId` of the document, or `''`.
418
+ * @property tags - Tags the operation is listed under. A webhook without tags is listed under `Webhooks`.
419
+ * @property deprecated - Whether the document marks it deprecated.
420
+ * @property summary - One line of plain text, or `''`.
421
+ * @property descriptionHtml - Description rendered as HTML.
422
+ * @property requestBody - The request body, or `null`.
423
+ * @property responses - Responses, in the order of the document.
424
+ * @property security - The ways a caller can authenticate, each as the names of the security
425
+ * schemes it needs, joined with ` + `. Empty when the operation is open.
426
+ */
427
+ export interface OperationNode extends NodeBase<'operation'> {
428
+ readonly anchor: string;
429
+ readonly method: string;
430
+ readonly urlPath: string;
431
+ readonly operationId: string;
432
+ readonly tags: readonly string[];
433
+ readonly deprecated: boolean;
434
+ readonly summary: string;
435
+ readonly descriptionHtml: string;
436
+ readonly requestBody: ApiRequestBody | null;
437
+ readonly responses: readonly ApiResponse[];
438
+ readonly security: readonly string[];
439
+ }
440
+ /**
441
+ * @brief A named JSON Schema: the root schema of a file, an entry of its `$defs`, or
442
+ * an entry of `components.schemas` of an OpenAPI document.
443
+ *
444
+ * Its properties are its `field` children, nested ones under a dotted name such as `address.city`.
445
+ *
446
+ * @property anchor - Unique within the file and safe in a URL hash.
447
+ * @property type - What the schema allows, as a type expression: `object`, `string[]`, `Cat | Dog`. `null` when none is stated.
448
+ * @property descriptionHtml - Description rendered as HTML.
449
+ * @property constraints - Keywords that narrow the type, verbatim: `format: uuid`, `minimum: 0`.
450
+ * @property values - The values of an `enum` or a `const`, as JSON. Empty for every other schema.
451
+ * @property deprecated - Whether the document marks it deprecated.
452
+ */
453
+ export interface DefinitionNode extends NodeBase<'definition'> {
454
+ readonly anchor: string;
455
+ readonly type: LinkedText | null;
456
+ readonly descriptionHtml: string;
457
+ readonly constraints: readonly string[];
458
+ readonly values: readonly string[];
459
+ readonly deprecated: boolean;
460
+ }
461
+ /**
462
+ * A foreign key of a table.
463
+ *
464
+ * @property name - Name of the constraint, or `''`.
465
+ * @property columns - Columns of this table, in key order.
466
+ * @property table - Name of the referenced table, as the statement writes it.
467
+ * @property target - The referenced table, when the scan has it, else `null`.
468
+ * @property referencedColumns - Columns of the referenced table, in key order. Its primary key when the statement names none.
469
+ * @property onDelete - Action in capitals, such as `CASCADE` or `SET NULL`. `''` when the statement states none.
470
+ * @property onUpdate - Action on update, in the same form as `onDelete`.
471
+ */
472
+ export interface ForeignKey {
473
+ readonly name: string;
474
+ readonly columns: readonly string[];
475
+ readonly table: string;
476
+ readonly target: NodeRef | null;
477
+ readonly referencedColumns: readonly string[];
478
+ readonly onDelete: string;
479
+ readonly onUpdate: string;
480
+ }
481
+ /**
482
+ * An index on a table.
483
+ *
484
+ * @property name - Name of the index.
485
+ * @property columns - Indexed columns or expressions, in index order.
486
+ * @property unique - Whether the index is unique.
487
+ */
488
+ export interface TableIndex {
489
+ readonly name: string;
490
+ readonly columns: readonly string[];
491
+ readonly unique: boolean;
492
+ }
493
+ /**
494
+ * A table of a database schema. Its columns are its `field` children.
495
+ *
496
+ * @property anchor - Unique within the file and safe in a URL hash.
497
+ * @property line - Line of the file where the table is created.
498
+ * @property descriptionHtml - Description rendered as HTML.
499
+ * @property primaryKey - Columns of the primary key, in key order. Empty for a table without one.
500
+ * @property foreignKeys - Foreign keys of the table.
501
+ * @property indexes - Indexes on the table.
502
+ * @property constraints - Table constraints that are no key, verbatim: `UNIQUE (a, b)`, `CHECK (a < b)`.
503
+ * @property options - Table options in capitals: `WITHOUT ROWID`, `STRICT`, `VIRTUAL`.
504
+ */
505
+ export interface TableNode extends NodeBase<'table'> {
506
+ readonly anchor: string;
507
+ readonly line: number;
508
+ readonly descriptionHtml: string;
509
+ readonly primaryKey: readonly string[];
510
+ readonly foreignKeys: readonly ForeignKey[];
511
+ readonly indexes: readonly TableIndex[];
512
+ readonly constraints: readonly string[];
513
+ readonly options: readonly string[];
514
+ }
515
+ /**
516
+ * @brief What running an entry of a query catalog does.
517
+ *
518
+ * - `read`: it returns rows and changes nothing, as `SELECT` does.
519
+ * - `write`: it changes rows or the schema, as `INSERT`, `UPDATE`, `DELETE` and `CREATE INDEX` do.
520
+ * - `control`: it changes the state of the transaction or the connection, as `BEGIN`, `COMMIT` and `PRAGMA` do.
521
+ */
522
+ export type QueryEffect = 'read' | 'write' | 'control';
523
+ /**
524
+ * A table an entry of a query catalog names, and what it does with it.
525
+ *
526
+ * @property name - Name of the table, as the statement writes it.
527
+ * @property target - The table, when the scan has it, else `null`.
528
+ * @property access - Whether the entry reads or writes it.
529
+ */
530
+ export interface QueryTable {
531
+ readonly name: string;
532
+ readonly target: NodeRef | null;
533
+ readonly access: 'read' | 'write';
534
+ }
535
+ /**
536
+ * @brief One entry of a query catalog: the SQL of one `.sql` file, or of one named
537
+ * block of such a file.
538
+ *
539
+ * `name` is the name the code runs it by: the file name
540
+ * without `.sql`, or the name of the block. Its placeholders are its
541
+ * `parameter` children, and the columns of the rows it returns are its
542
+ * `field` children.
543
+ *
544
+ * @property anchor - Unique within the catalog and safe in a URL hash.
545
+ * @property sourcePath - Path of the file the entry is in, relative to the scanned root.
546
+ * @property line - Line of the file where the statement starts.
547
+ * @property effect - What running the entry does.
548
+ * @property verb - The keywords that open the statement, in capitals: `SELECT`, `INSERT`, `BEGIN IMMEDIATE`.
549
+ * @property descriptionHtml - The comment above the statement, as HTML. `''` for an entry without one.
550
+ * @property sqlHtml - The highlighted SQL, as the file writes it.
551
+ * @property tables - The tables the SQL names, each once per access, in the order they first appear.
552
+ */
553
+ export interface QueryNode extends NodeBase<'query'> {
554
+ readonly anchor: string;
555
+ readonly sourcePath: string;
556
+ readonly line: number;
557
+ readonly effect: QueryEffect;
558
+ readonly verb: string;
559
+ readonly descriptionHtml: string;
560
+ readonly sqlHtml: string;
561
+ readonly tables: readonly QueryTable[];
562
+ }
563
+ /** Where a plan, a phase or a task stands, in the order task-manager moves it through. */
564
+ export declare const TASK_STATUSES: readonly ['open', 'in-progress', 'in-review', 'completed', 'blocked'];
565
+ /** One of {@link TASK_STATUSES}. */
566
+ export type TaskStatus = (typeof TASK_STATUSES)[number];
567
+ /** How urgent a plan, a phase or a task is, most urgent first. */
568
+ export declare const TASK_PRIORITIES: readonly ['critical', 'high', 'medium', 'low'];
569
+ /** One of {@link TASK_PRIORITIES}. */
570
+ export type TaskPriority = (typeof TASK_PRIORITIES)[number];
571
+ /**
572
+ * What every plan, phase and task of the task tree states in its frontmatter.
573
+ *
574
+ * @property status - Where it stands.
575
+ * @property priority - How urgent it is.
576
+ * @property summary - One line of plain text.
577
+ * @property dependsOn - Names of the plans or phases, or ids of the tasks, this one waits for, as the file writes them.
578
+ */
579
+ interface TrackedFacts {
580
+ readonly status: TaskStatus;
581
+ readonly priority: TaskPriority;
582
+ readonly summary: string;
583
+ readonly dependsOn: readonly string[];
584
+ }
585
+ /**
586
+ * @brief A plan of the task tree: `<plan>/<plan>.md`.
587
+ *
588
+ * Its phases are its children, and the decision log of its `decisions/` folder when it has one.
589
+ * `name` is the plan's folder name, `title` its title.
590
+ */
591
+ export interface PlanNode extends NodeBase<'plan'>, FileFacts, TrackedFacts {
592
+ }
593
+ /**
594
+ * A phase of a plan: `<plan>/<phase>/<phase>.md`. Its tasks are its children.
595
+ *
596
+ * @property parallel - Whether its tasks can run side by side.
597
+ */
598
+ export interface PhaseNode extends NodeBase<'phase'>, FileFacts, TrackedFacts {
599
+ readonly parallel: boolean;
600
+ }
601
+ /**
602
+ * One task of a phase: `<phase>/tasks/<id>.md`, shown as an entry on the page of its phase. `name` is its title.
603
+ *
604
+ * @property anchor - Unique within the phase and safe in a URL hash.
605
+ * @property id - Such as `TASK-006`.
606
+ * @property sourcePath - Path of the task file, relative to the scanned root.
607
+ * @property package - The package the task changes, as the file names it.
608
+ * @property complexity - From 1 for small to 5 for large. `null` when the file states none.
609
+ * @property html - Description rendered as HTML.
610
+ */
611
+ export interface TaskNode extends NodeBase<'task'>, TrackedFacts {
612
+ readonly anchor: string;
613
+ readonly id: string;
614
+ readonly sourcePath: string;
615
+ readonly package: string;
616
+ readonly complexity: number | null;
617
+ readonly html: string;
618
+ }
619
+ /** A file node of any kind. */
620
+ export type AnyFileNode = FileNode | ApiNode | DatabaseNode | PlanNode | PhaseNode;
621
+ /** A node of any kind. */
622
+ export type GraphNode = SectionNode | FolderNode | PackageNode | AnyFileNode | SourceNode | SymbolNode | TermNode | DecisionNode | OperationNode | DefinitionNode | TableNode | QueryNode | TaskNode | ParameterNode | FieldNode;
623
+ /** An entry of any kind. */
624
+ export type EntryNode = SymbolNode | TermNode | DecisionNode | OperationNode | DefinitionNode | TableNode | QueryNode | TaskNode;
625
+ /**
626
+ * Tells a symbol node from the others.
627
+ *
628
+ * @param node - Node to test.
629
+ */
630
+ export declare function isSymbolNode(node: GraphNode): node is SymbolNode;
631
+ /**
632
+ * Tells an entry node, a symbol included, from the others.
633
+ *
634
+ * @param node - Node to test.
635
+ */
636
+ export declare function isEntryNode(node: GraphNode): node is EntryNode;
637
+ /**
638
+ * Tells a node of a file with a page from the others.
639
+ *
640
+ * @param node - Node to test.
641
+ */
642
+ export declare function isFileNode(node: GraphNode): node is AnyFileNode;
643
+ /** Kinds of an entry that is described in markdown and can have parameters or fields. */
644
+ export type DescribedNode = SymbolNode | OperationNode | DefinitionNode | TableNode | QueryNode;
645
+ /**
646
+ * Tells the entries with a `descriptionHtml` from the others.
647
+ *
648
+ * @param node - Node to test.
649
+ * @returns True for a symbol, an operation, a definition, a table and a query.
650
+ */
651
+ export declare function isDescribedNode(node: GraphNode): node is DescribedNode;
652
+ /** A relation other than `parent` between two nodes, such as a parameter that has a class as its type. */
653
+ export type Edge = readonly [from: NodeRef, kind: EdgeKind, to: NodeRef];
654
+ /**
655
+ * What the bundle says about its own making.
656
+ *
657
+ * @property title - Title of the site.
658
+ * @property generatedAt - ISO 8601 timestamp of the generation.
659
+ * @property generator - Name of the tool that made the bundle.
660
+ */
661
+ export interface BundleMeta {
662
+ readonly title: string;
663
+ readonly generatedAt: string;
664
+ readonly generator: string;
665
+ }
666
+ /** Version of the layout of {@link SemanticIndex}. A reader skips an index of another version. */
667
+ export declare const SEMANTIC_FORMAT = 3;
668
+ /**
669
+ * @brief What a reader needs to search by meaning: a small text embedding model,
670
+ * one vector per searchable node and the words of each node.
671
+ *
672
+ * An **embedding** is a list of numbers that stands for the meaning of a text.
673
+ * Texts with a similar meaning get similar numbers, so `vessel` is found by a search for `ship`.
674
+ *
675
+ * The model is a table with one vector per word. A contextual model computed
676
+ * each vector in advance, from the word on its own. The vector of a text is
677
+ * the mean of the vectors of its words, computed by the reader without a neural network.
678
+ *
679
+ * @property format - Layout version, `SEMANTIC_FORMAT`.
680
+ * @property model - Name of the embedding model, for display.
681
+ * @property dimensions - Length of every vector.
682
+ * @property vocabulary - The words of the model, joined with `\n`. The line number of a word is its row in `vocabularyVectors`.
683
+ * @property vocabularyVectors - Base64 of the model table: one row of `dimensions` values per word, each value in four bits.
684
+ * @property nodes - The nodes that have a vector, in the order of `nodeVectors`.
685
+ * @property nodeVectors - Base64 of signed bytes: one vector of length 1 per node, scaled to the range of a signed byte.
686
+ * @property words - Every word that carries meaning in the name or the text of a node, each once, joined with `\n`.
687
+ * @property nodeWords - For each node of `nodes`, the words of its name and the further words of
688
+ * its text, as line numbers in `words`. A one-word query is compared with
689
+ * these words, because the mean of a whole text hides a single word.
690
+ */
691
+ export interface SemanticIndex {
692
+ readonly format: typeof SEMANTIC_FORMAT;
693
+ readonly model: string;
694
+ readonly dimensions: number;
695
+ readonly vocabulary: string;
696
+ readonly vocabularyVectors: string;
697
+ readonly nodes: readonly NodeRef[];
698
+ readonly nodeVectors: string;
699
+ readonly words: string;
700
+ readonly nodeWords: readonly (readonly [name: readonly number[], text: readonly number[]])[];
701
+ }
702
+ /**
703
+ * @brief The data contract between the scanner and the web app: the CLI serializes
704
+ * one bundle into the generated HTML file, and the app reads it back.
705
+ *
706
+ * The bundle is a graph. A **node** is one thing the site shows: a folder, a
707
+ * skill, a document, a class, a parameter, a glossary term, an API operation,
708
+ * a database table, a query. `parent` puts every node in one tree, and that
709
+ * tree is the navigation. An **edge** is any other relation between two nodes,
710
+ * such as "this parameter has that class as its type".
711
+ *
712
+ * @property meta - What the bundle says about its making.
713
+ * @property nodes - Every node. A node comes after its parent, and siblings are in display order.
714
+ * @property edges - Relations other than `parent`.
715
+ * @property semantic - Index for search by meaning. Left out when the site was generated without embeddings.
716
+ */
717
+ export interface DocsBundle {
718
+ readonly meta: BundleMeta;
719
+ readonly nodes: readonly GraphNode[];
720
+ readonly edges: readonly Edge[];
721
+ readonly semantic?: SemanticIndex;
722
+ }
723
+ /**
724
+ * Where a node is shown: a page, and for an entry an anchor on that page.
725
+ *
726
+ * @property path - Slugs from the section down, joined with `/` and not URL-encoded: `code/src/app.ts`.
727
+ * @property hash - Anchor of the entry on that page, without `#`. Set for an entry only.
728
+ */
729
+ export interface Route {
730
+ readonly path: string;
731
+ readonly hash?: string;
732
+ }
733
+ /**
734
+ * The part of a node that decides its route.
735
+ *
736
+ * @property kind - Kind of the node.
737
+ * @property name - Name of the node.
738
+ * @property parent - The node this one belongs to, or `null` for a section.
739
+ * @property slug - Segment of the route. Defaults to `name`.
740
+ * @property anchor - Anchor of an entry, which its route turns into the hash.
741
+ */
742
+ export interface Routable {
743
+ readonly kind: NodeType;
744
+ readonly name: string;
745
+ readonly parent: NodeRef | null;
746
+ readonly slug?: string;
747
+ readonly anchor?: string;
748
+ }
749
+ /**
750
+ * @brief DOM id and URL hash of an entry on the page of its file.
751
+ *
752
+ * Examples: `symbol:App.run`, `term:lane`, `decision:3-use-hash-routes`,
753
+ * `table:Booking`, `query:list_bookings`. The kind is the prefix, so entry
754
+ * anchors never equal a heading anchor.
755
+ *
756
+ * @param kind - Kind of the entry, such as `symbol` or `term`.
757
+ * @param anchor - Anchor of the entry, unique within its file.
758
+ */
759
+ export declare function entryAnchor(kind: EntryKind, anchor: string): string;
760
+ /**
761
+ * @brief Route of a node.
762
+ *
763
+ * Sections, folders and files are pages. An entry is an anchor on the page of
764
+ * its file, and a parameter or field shares the route of its symbol. The
765
+ * scanner and the web app both use this function.
766
+ *
767
+ * @param nodes - Nodes the route is read from, usually the nodes of a bundle.
768
+ * @param ref - Index of the node in `nodes`.
769
+ * @returns The page path, and the hash for an entry.
770
+ */
771
+ export declare function routeOf(nodes: readonly Routable[], ref: NodeRef): Route;
772
+ /**
773
+ * Link to a route from inside the generated page: `#/code/src/app.ts#symbol:App.run`.
774
+ *
775
+ * @param route - Route to link to.
776
+ * @returns The hash link to the route.
777
+ */
778
+ export declare function hrefOf(route: Route): string;
779
+ /** Id of the `<script type="application/json">` element that holds the bundle. */
780
+ export declare const DATA_ELEMENT_ID = "analyze-data";
781
+ /** Id of the element the app mounts into. */
782
+ export declare const MOUNT_ELEMENT_ID = "analyze-root";
783
+ /** `localStorage` key of the reader's color mode. The template reads it before first paint. */
784
+ export declare const COLOR_MODE_STORAGE_KEY = "analyze:color-mode";
785
+ /** Template marker the CLI replaces with the serialized bundle. */
786
+ export declare const DATA_PLACEHOLDER = "__ANALYZE_DATA__";
787
+ /** Template marker the CLI replaces with the title of the site. */
788
+ export declare const TITLE_PLACEHOLDER = "__ANALYZE_TITLE__";