@g3nomaly/analyze 0.0.0-stage → 0.1.0

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 (130) hide show
  1. package/LICENSE +95 -0
  2. package/README.md +71 -2
  3. package/dist/THIRD_PARTY_LICENSES.txt +1904 -0
  4. package/dist/api/bundle-builder.d.ts +75 -0
  5. package/dist/api/bundle-cache.d.ts +70 -0
  6. package/dist/api/bundle-loader.d.ts +58 -0
  7. package/dist/api/create-docs.d.ts +72 -0
  8. package/dist/api/embedding.d.ts +32 -0
  9. package/dist/api/errors.d.ts +28 -0
  10. package/dist/api/list.d.ts +106 -0
  11. package/dist/api/options.d.ts +78 -0
  12. package/dist/api/refs.d.ts +133 -0
  13. package/dist/api/scan.d.ts +44 -0
  14. package/dist/api/search.d.ts +126 -0
  15. package/dist/api/services.d.ts +7 -0
  16. package/dist/api/show.d.ts +104 -0
  17. package/dist/api/site-reader.d.ts +11 -0
  18. package/dist/api/site-writer.d.ts +20 -0
  19. package/dist/api/source.d.ts +46 -0
  20. package/dist/api/target.d.ts +10 -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 +8885 -0
  39. package/dist/embeddings/abbreviations.d.ts +7 -0
  40. package/dist/embeddings/index-builder.d.ts +10 -0
  41. package/dist/embeddings/index.d.ts +10 -0
  42. package/dist/embeddings/model.d.ts +113 -0
  43. package/dist/embeddings/searcher.d.ts +67 -0
  44. package/dist/embeddings/vectors.d.ts +75 -0
  45. package/dist/embeddings/words.d.ts +42 -0
  46. package/dist/index.d.ts +9 -0
  47. package/dist/index.js +8329 -0
  48. package/dist/model/index.d.ts +560 -0
  49. package/dist/model/registry.d.ts +494 -0
  50. package/dist/query/graph.d.ts +66 -0
  51. package/dist/query/index.d.ts +4 -0
  52. package/dist/query/name-search.d.ts +47 -0
  53. package/dist/query/semantic.d.ts +30 -0
  54. package/dist/query/text.d.ts +22 -0
  55. package/dist/retrieval/describe.d.ts +26 -0
  56. package/dist/retrieval/filter.d.ts +17 -0
  57. package/dist/retrieval/index.d.ts +7 -0
  58. package/dist/retrieval/markdown.d.ts +16 -0
  59. package/dist/retrieval/report.d.ts +214 -0
  60. package/dist/retrieval/resolve.d.ts +27 -0
  61. package/dist/retrieval/retriever.d.ts +94 -0
  62. package/dist/retrieval/summary.d.ts +24 -0
  63. package/dist/scanner/code/doc/clean.d.ts +10 -0
  64. package/dist/scanner/code/doc/index.d.ts +6 -0
  65. package/dist/scanner/code/doc/markdown.d.ts +3 -0
  66. package/dist/scanner/code/doc/python.d.ts +3 -0
  67. package/dist/scanner/code/doc/tagged.d.ts +10 -0
  68. package/dist/scanner/code/doc/types.d.ts +22 -0
  69. package/dist/scanner/code/doc/xml.d.ts +3 -0
  70. package/dist/scanner/code/example.d.ts +36 -0
  71. package/dist/scanner/code/extract.d.ts +78 -0
  72. package/dist/scanner/code/grammar.d.ts +29 -0
  73. package/dist/scanner/code/language.d.ts +149 -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 +19 -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 +17 -0
  87. package/dist/scanner/code/planner.d.ts +71 -0
  88. package/dist/scanner/code/symbols.d.ts +68 -0
  89. package/dist/scanner/code/types.d.ts +93 -0
  90. package/dist/scanner/content.d.ts +38 -0
  91. package/dist/scanner/decisions/parse.d.ts +28 -0
  92. package/dist/scanner/decisions/planner.d.ts +30 -0
  93. package/dist/scanner/docs.d.ts +52 -0
  94. package/dist/scanner/files.d.ts +60 -0
  95. package/dist/scanner/glossary/parse.d.ts +30 -0
  96. package/dist/scanner/glossary/planner.d.ts +42 -0
  97. package/dist/scanner/glossary/terms.d.ts +86 -0
  98. package/dist/scanner/graph/builder.d.ts +55 -0
  99. package/dist/scanner/highlight.d.ts +31 -0
  100. package/dist/scanner/index.d.ts +40 -0
  101. package/dist/scanner/markdown/frontmatter.d.ts +9 -0
  102. package/dist/scanner/markdown/links.d.ts +50 -0
  103. package/dist/scanner/markdown/outline.d.ts +27 -0
  104. package/dist/scanner/markdown/renderer.d.ts +44 -0
  105. package/dist/scanner/openapi/planner.d.ts +84 -0
  106. package/dist/scanner/reporter.d.ts +7 -0
  107. package/dist/scanner/scanner.d.ts +52 -0
  108. package/dist/scanner/schema/definitions.d.ts +69 -0
  109. package/dist/scanner/schema/describe.d.ts +79 -0
  110. package/dist/scanner/schema/planner.d.ts +46 -0
  111. package/dist/scanner/schema/registry.d.ts +61 -0
  112. package/dist/scanner/skills/classify.d.ts +20 -0
  113. package/dist/scanner/skills/layout.d.ts +28 -0
  114. package/dist/scanner/skills/planner.d.ts +46 -0
  115. package/dist/scanner/specs.d.ts +50 -0
  116. package/dist/scanner/sql/catalog.d.ts +84 -0
  117. package/dist/scanner/sql/cursor.d.ts +107 -0
  118. package/dist/scanner/sql/database.d.ts +48 -0
  119. package/dist/scanner/sql/parse.d.ts +87 -0
  120. package/dist/scanner/sql/planner.d.ts +65 -0
  121. package/dist/scanner/sql/query.d.ts +60 -0
  122. package/dist/scanner/sql/registry.d.ts +49 -0
  123. package/dist/scanner/sql/source.d.ts +9 -0
  124. package/dist/scanner/sql/statements.d.ts +36 -0
  125. package/dist/scanner/sql/tokens.d.ts +38 -0
  126. package/dist/scanner/tasks/layout.d.ts +40 -0
  127. package/dist/scanner/tasks/planner.d.ts +75 -0
  128. package/dist/scanner/tasks/schema.d.ts +88 -0
  129. package/dist/scanner/text.d.ts +14 -0
  130. package/package.json +104 -4
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ /** What decides the content of a scan. */
3
+ export interface ScanOptions {
4
+ /** Absolute path of the repository to document. */
5
+ readonly repo: string;
6
+ /** Absolute skill directories. Empty means: find every `SKILL.md` in the repository. */
7
+ readonly skillDirs: readonly string[];
8
+ /** Absolute docs directories. Empty means: every markdown, JSON and YAML file in the repository. */
9
+ readonly docDirs: readonly string[];
10
+ readonly excludes: readonly string[];
11
+ /** Whether the bundle gets the embedding model and search by meaning. */
12
+ readonly embeddings: boolean;
13
+ }
14
+ /** The options that choose what to scan, as a caller passes them. Relative paths resolve against the working directory. */
15
+ export declare const scanShape: {
16
+ /** Repository to read. Default: the working directory. */
17
+ repo: z.ZodOptional<z.ZodString>;
18
+ /** Read skills from these directories instead of the repository. */
19
+ skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
20
+ /** Read docs from these directories instead of the repository. */
21
+ docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
22
+ /** Glob patterns of paths to skip, such as `src/legacy/**`. */
23
+ excludes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
24
+ /** `false` leaves out search by meaning. Default: `true`. */
25
+ embeddings: z.ZodOptional<z.ZodBoolean>;
26
+ };
27
+ /** The scan options after validation, before defaults. */
28
+ export type ScanFields = z.output<z.ZodObject<typeof scanShape>>;
29
+ /** Fills in the defaults of validated scan options and makes their paths absolute against the working directory. */
30
+ export declare function scanOf(fields: ScanFields): ScanOptions;
31
+ /**
32
+ * Names the site file of a repository. `createDocs` writes it, and nothing else outside the cache.
33
+ *
34
+ * @param repo - Absolute path of the repository.
35
+ * @returns `<repo>/analyze_out/index.html`.
36
+ */
37
+ export declare function siteFileOf(repo: string): string;
38
+ /**
39
+ * Names the directory where the retrieval functions keep the scans of a repository.
40
+ *
41
+ * @param repo - Absolute path of the repository.
42
+ * @returns `<repo>/analyze_out/cache`.
43
+ */
44
+ export declare function cacheDirOf(repo: string): string;
@@ -0,0 +1,126 @@
1
+ import { z } from 'zod';
2
+ import { type NodeFilter, type Retriever, type SearchHit, type SearchMode } from '../retrieval';
3
+ /** Most hits of a search without a limit. */
4
+ export declare const DEFAULT_SEARCH_LIMIT = 10;
5
+ declare const searchSchema: z.ZodPipe<z.ZodObject<{
6
+ onWarning: z.ZodOptional<z.ZodCustom<import("./options").WarningHandler, import("./options").WarningHandler>>;
7
+ kinds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
8
+ agent: "agent";
9
+ api: "api";
10
+ asset: "asset";
11
+ catalog: "catalog";
12
+ class: "class";
13
+ database: "database";
14
+ decision: "decision";
15
+ decisions: "decisions";
16
+ definition: "definition";
17
+ document: "document";
18
+ enum: "enum";
19
+ field: "field";
20
+ folder: "folder";
21
+ function: "function";
22
+ glossary: "glossary";
23
+ hook: "hook";
24
+ interface: "interface";
25
+ json: "json";
26
+ method: "method";
27
+ namespace: "namespace";
28
+ operation: "operation";
29
+ parameter: "parameter";
30
+ phase: "phase";
31
+ plan: "plan";
32
+ query: "query";
33
+ reference: "reference";
34
+ schema: "schema";
35
+ section: "section";
36
+ skill: "skill";
37
+ source: "source";
38
+ struct: "struct";
39
+ table: "table";
40
+ task: "task";
41
+ term: "term";
42
+ trait: "trait";
43
+ type: "type";
44
+ }>>>>;
45
+ section: z.ZodOptional<z.ZodEnum<{
46
+ code: "code";
47
+ database: "database";
48
+ docs: "docs";
49
+ skills: "skills";
50
+ tasks: "tasks";
51
+ }>>;
52
+ repo: z.ZodOptional<z.ZodString>;
53
+ skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
54
+ docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
55
+ excludes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
56
+ embeddings: z.ZodOptional<z.ZodBoolean>;
57
+ from: z.ZodOptional<z.ZodString>;
58
+ cache: z.ZodOptional<z.ZodBoolean>;
59
+ query: z.ZodString;
60
+ by: z.ZodOptional<z.ZodEnum<{
61
+ both: "both";
62
+ meaning: "meaning";
63
+ name: "name";
64
+ }>>;
65
+ limit: z.ZodOptional<z.ZodNumber>;
66
+ }, z.core.$strict>, z.ZodTransform<{
67
+ source: import("./source").BundleSource;
68
+ reporter: import("../scanner").Reporter;
69
+ request: {
70
+ query: string;
71
+ mode: "both" | "meaning" | "name";
72
+ limit: number;
73
+ filter: NodeFilter;
74
+ };
75
+ }, {
76
+ onWarning?: import("./options").WarningHandler | undefined;
77
+ kinds?: readonly ("agent" | "api" | "asset" | "catalog" | "class" | "database" | "decision" | "decisions" | "definition" | "document" | "enum" | "field" | "folder" | "function" | "glossary" | "hook" | "interface" | "json" | "method" | "namespace" | "operation" | "parameter" | "phase" | "plan" | "query" | "reference" | "schema" | "section" | "skill" | "source" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
78
+ section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
79
+ repo?: string | undefined;
80
+ skillDirs?: readonly string[] | undefined;
81
+ docDirs?: readonly string[] | undefined;
82
+ excludes?: readonly string[] | undefined;
83
+ embeddings?: boolean | undefined;
84
+ from?: string | undefined;
85
+ cache?: boolean | undefined;
86
+ query: string;
87
+ by?: "both" | "meaning" | "name" | undefined;
88
+ limit?: number | undefined;
89
+ }>>;
90
+ /** Options of `search`: the words, how to match them, and the bundle to search. */
91
+ export type SearchOptions = z.input<typeof searchSchema>;
92
+ /** One search on a loaded bundle. */
93
+ export interface SearchRequest {
94
+ readonly query: string;
95
+ readonly mode: SearchMode;
96
+ readonly limit: number;
97
+ readonly filter: NodeFilter;
98
+ }
99
+ /** What `search` finds. The CLI prints it with `search --json`. */
100
+ export interface SearchResult {
101
+ readonly query: string;
102
+ readonly mode: SearchMode;
103
+ /** Name of the embedding model of the bundle. `null` when the bundle has none. */
104
+ readonly model: string | null;
105
+ /** Hits, best first. */
106
+ readonly hits: readonly SearchHit[];
107
+ }
108
+ /**
109
+ * Searches a loaded bundle.
110
+ *
111
+ * @param request - The words, the mode, the limit and the filter.
112
+ * @returns The hits, best first.
113
+ * @throws {QueryError} When the search is by meaning and the bundle has no embeddings.
114
+ */
115
+ export declare function searchIn(retriever: Retriever, request: SearchRequest): SearchResult;
116
+ /**
117
+ * Finds pages and entries by their words and by meaning.
118
+ *
119
+ * @param options - The words, how to match them, and the repository or site to search.
120
+ * @returns The hits, best first.
121
+ * @throws {OptionsError} When the options are not valid.
122
+ * @throws {SourceError} When the repository or the site cannot be read.
123
+ * @throws {QueryError} When the search is by meaning and the bundle has no embeddings.
124
+ */
125
+ export declare function search(options: SearchOptions): Promise<SearchResult>;
126
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type Reporter } from '../scanner';
2
+ import { BundleBuilder } from './bundle-builder';
3
+ import type { ScanOptions } from './scan';
4
+ /** Name and version of the tool, recorded in every bundle it builds. */
5
+ export declare const GENERATOR: string;
6
+ /** Wires the services that scan one repository into a builder, which hands warnings of the scan to `reporter`. */
7
+ export declare function createBuilder(scan: ScanOptions, reporter: Reporter): BundleBuilder;
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ import type { NodeFilter, NodeReport, Retriever } from '../retrieval';
3
+ declare const showSchema: z.ZodPipe<z.ZodObject<{
4
+ onWarning: z.ZodOptional<z.ZodCustom<import("./options").WarningHandler, import("./options").WarningHandler>>;
5
+ kinds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
6
+ agent: "agent";
7
+ api: "api";
8
+ asset: "asset";
9
+ catalog: "catalog";
10
+ class: "class";
11
+ database: "database";
12
+ decision: "decision";
13
+ decisions: "decisions";
14
+ definition: "definition";
15
+ document: "document";
16
+ enum: "enum";
17
+ field: "field";
18
+ folder: "folder";
19
+ function: "function";
20
+ glossary: "glossary";
21
+ hook: "hook";
22
+ interface: "interface";
23
+ json: "json";
24
+ method: "method";
25
+ namespace: "namespace";
26
+ operation: "operation";
27
+ parameter: "parameter";
28
+ phase: "phase";
29
+ plan: "plan";
30
+ query: "query";
31
+ reference: "reference";
32
+ schema: "schema";
33
+ section: "section";
34
+ skill: "skill";
35
+ source: "source";
36
+ struct: "struct";
37
+ table: "table";
38
+ task: "task";
39
+ term: "term";
40
+ trait: "trait";
41
+ type: "type";
42
+ }>>>>;
43
+ section: z.ZodOptional<z.ZodEnum<{
44
+ code: "code";
45
+ database: "database";
46
+ docs: "docs";
47
+ skills: "skills";
48
+ tasks: "tasks";
49
+ }>>;
50
+ repo: z.ZodOptional<z.ZodString>;
51
+ skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
52
+ docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
53
+ excludes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
54
+ embeddings: z.ZodOptional<z.ZodBoolean>;
55
+ from: z.ZodOptional<z.ZodString>;
56
+ cache: z.ZodOptional<z.ZodBoolean>;
57
+ target: z.ZodString;
58
+ }, z.core.$strict>, z.ZodTransform<{
59
+ source: import("./source").BundleSource;
60
+ reporter: import("../scanner").Reporter;
61
+ request: {
62
+ target: string;
63
+ filter: NodeFilter;
64
+ };
65
+ }, {
66
+ onWarning?: import("./options").WarningHandler | undefined;
67
+ kinds?: readonly ("agent" | "api" | "asset" | "catalog" | "class" | "database" | "decision" | "decisions" | "definition" | "document" | "enum" | "field" | "folder" | "function" | "glossary" | "hook" | "interface" | "json" | "method" | "namespace" | "operation" | "parameter" | "phase" | "plan" | "query" | "reference" | "schema" | "section" | "skill" | "source" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
68
+ section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
69
+ repo?: string | undefined;
70
+ skillDirs?: readonly string[] | undefined;
71
+ docDirs?: readonly string[] | undefined;
72
+ excludes?: readonly string[] | undefined;
73
+ embeddings?: boolean | undefined;
74
+ from?: string | undefined;
75
+ cache?: boolean | undefined;
76
+ target: string;
77
+ }>>;
78
+ /** Options of `show`: the node, and the bundle to read it from. */
79
+ export type ShowOptions = z.input<typeof showSchema>;
80
+ /** One `show` on a loaded bundle. */
81
+ export interface ShowRequest {
82
+ /** Id, path or name of the node. */
83
+ readonly target: string;
84
+ readonly filter: NodeFilter;
85
+ }
86
+ /**
87
+ * Describes one node of a loaded bundle.
88
+ *
89
+ * @param request - The node and the filter that narrows a name.
90
+ * @returns The report of the node: text, parameters, references.
91
+ * @throws {QueryError} When no node fits the target, or several do.
92
+ */
93
+ export declare function showIn(retriever: Retriever, request: ShowRequest): NodeReport;
94
+ /**
95
+ * Describes one page or entry: text, parameters, references.
96
+ *
97
+ * @param options - The node, and the repository or site to read it from.
98
+ * @returns The report of the node. The CLI prints it with `show --json`.
99
+ * @throws {OptionsError} When the options are not valid.
100
+ * @throws {SourceError} When the repository or the site cannot be read.
101
+ * @throws {QueryError} When no node fits the target, or several do.
102
+ */
103
+ export declare function show(options: ShowOptions): Promise<NodeReport>;
104
+ export {};
@@ -0,0 +1,11 @@
1
+ import { type DocsBundle } from '../model';
2
+ /** Checks that parsed JSON has the parts of a bundle that queries read: `meta`, `nodes` and `edges`. */
3
+ export declare function isBundle(value: unknown): value is DocsBundle;
4
+ /**
5
+ * Reads the bundle back out of a site that `createDocs` wrote. The inverse
6
+ * of `HtmlSiteWriter.render`.
7
+ *
8
+ * @param path - Path of the file, only for the error message.
9
+ * @throws {SourceError} When the file is no analyze site.
10
+ */
11
+ export declare function readSite(html: string, path: string): DocsBundle;
@@ -0,0 +1,20 @@
1
+ import { type DocsBundle } from '../model';
2
+ /** Writes a bundle as a documentation site. */
3
+ export interface SiteWriter {
4
+ /** Writes the site for `bundle` to `path` and returns its size in bytes. */
5
+ write(path: string, bundle: DocsBundle): Promise<number>;
6
+ }
7
+ /**
8
+ * Fills the prebuilt single-file app with a bundle: the title into `<title>`, the bundle as JSON into the data
9
+ * `<script>` element. Holds the template. `createDocs` creates one with `TEMPLATE_HTML` from `src/api/template.ts`;
10
+ * `readSite` reads the result back.
11
+ */
12
+ export declare class HtmlSiteWriter implements SiteWriter {
13
+ private readonly template;
14
+ /** Creates a writer for a template that holds the title and data placeholders once each. */
15
+ constructor(template: string);
16
+ /** Returns the template with the escaped title and the bundle as script-safe JSON in place of the placeholders. */
17
+ render(bundle: DocsBundle): string;
18
+ /** Writes the rendered site to `path`, creating its directory, and returns its size in bytes. */
19
+ write(path: string, bundle: DocsBundle): Promise<number>;
20
+ }
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { Retriever } from '../retrieval';
3
+ import type { Reporter } from '../scanner';
4
+ import { type ScanOptions } from './scan';
5
+ /** Where a query gets its bundle. */
6
+ export type BundleSource =
7
+ /** An HTML file that `createDocs` wrote. */
8
+ {
9
+ readonly kind: 'site';
10
+ readonly file: string;
11
+ }
12
+ /** A scan of the repository. With `cache`, its result is kept in `analyze_out/cache` of the repository. */
13
+ | {
14
+ readonly kind: 'scan';
15
+ readonly scan: ScanOptions;
16
+ readonly cache: boolean;
17
+ };
18
+ /** The options that choose the bundle a query reads, as a caller passes them. */
19
+ export declare const sourceShape: {
20
+ repo: z.ZodOptional<z.ZodString>;
21
+ skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
22
+ docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
23
+ excludes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
24
+ embeddings: z.ZodOptional<z.ZodBoolean>;
25
+ /** An HTML file that `createDocs` wrote, read in place of the repository. Excludes the scan options. */
26
+ from: z.ZodOptional<z.ZodString>;
27
+ /** `false` scans the repository again even when no file changed. Default: `true`. */
28
+ cache: z.ZodOptional<z.ZodBoolean>;
29
+ };
30
+ /** The source options after validation. */
31
+ type SourceFields = z.output<z.ZodObject<typeof sourceShape>>;
32
+ /** Adds an issue to the schema's refinement context for every scan option that comes with `from`. */
33
+ export declare function checkSource(fields: SourceFields, context: z.RefinementCtx): void;
34
+ /**
35
+ * Turns validated source options, checked by `checkSource`, into a bundle source.
36
+ *
37
+ * @returns The site file to read, with an absolute path, or the scan to run.
38
+ */
39
+ export declare function sourceOf(fields: SourceFields): BundleSource;
40
+ /**
41
+ * Loads the bundle of a source and opens it for queries, handing warnings of the load to `reporter`.
42
+ *
43
+ * @throws {SourceError} When the site file or the repository cannot be read.
44
+ */
45
+ export declare function openRetriever(source: BundleSource, reporter: Reporter): Promise<Retriever>;
46
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { NodeRef } from '../model';
2
+ import type { NodeFilter, Retriever } from '../retrieval';
3
+ /**
4
+ * Finds the one node a caller means.
5
+ *
6
+ * @param target - An id, a path or a name.
7
+ * @param filter - Narrows the nodes that count.
8
+ * @throws {QueryError} When no node fits, or several do. The message lists the candidates with their ids.
9
+ */
10
+ export declare function nodeOf(retriever: Retriever, target: string, filter: NodeFilter): NodeRef;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The web app as one HTML file, with placeholders for the title and the bundle. `HtmlSiteWriter` fills them in.
3
+ * Bun types every `.html` import as a page bundle. With `type: 'text'` the import is the file content.
4
+ */
5
+ export declare const TEMPLATE_HTML: string;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file