@g3nomaly/analyze 0.1.3 → 0.1.5

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 (40) hide show
  1. package/README.md +42 -18
  2. package/dist/THIRD_PARTY_LICENSES.txt +4 -4
  3. package/dist/api/bundle-cache.d.ts +3 -1
  4. package/dist/api/graph.d.ts +131 -0
  5. package/dist/api/list.d.ts +2 -0
  6. package/dist/api/options.d.ts +2 -1
  7. package/dist/api/refs.d.ts +6 -2
  8. package/dist/api/scan.d.ts +8 -1
  9. package/dist/api/search.d.ts +5 -2
  10. package/dist/api/services.d.ts +1 -1
  11. package/dist/api/show.d.ts +2 -0
  12. package/dist/cli.js +1677 -596
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +1592 -556
  15. package/dist/model/index.d.ts +26 -0
  16. package/dist/model/registry.d.ts +24 -0
  17. package/dist/query/graph-view.d.ts +105 -0
  18. package/dist/query/graph.d.ts +22 -0
  19. package/dist/query/index.d.ts +3 -2
  20. package/dist/query/name-search.d.ts +1 -1
  21. package/dist/query/semantic.d.ts +10 -0
  22. package/dist/retrieval/filter.d.ts +4 -1
  23. package/dist/retrieval/graph-export.d.ts +82 -0
  24. package/dist/retrieval/index.d.ts +1 -0
  25. package/dist/retrieval/retriever.d.ts +21 -2
  26. package/dist/scanner/code/calls.d.ts +136 -0
  27. package/dist/scanner/code/extract.d.ts +10 -2
  28. package/dist/scanner/code/imports.d.ts +147 -0
  29. package/dist/scanner/code/language.d.ts +14 -0
  30. package/dist/scanner/code/planner.d.ts +16 -4
  31. package/dist/scanner/code/symbols.d.ts +19 -3
  32. package/dist/scanner/code/types.d.ts +76 -17
  33. package/dist/scanner/graph/builder.d.ts +14 -3
  34. package/dist/scanner/graph/communities.d.ts +17 -0
  35. package/dist/scanner/ignore.d.ts +5 -7
  36. package/dist/scanner/index.d.ts +4 -1
  37. package/dist/scanner/markdown/outline.d.ts +2 -0
  38. package/dist/scanner/packages.d.ts +6 -0
  39. package/dist/scanner/scanner.d.ts +2 -2
  40. package/package.json +3 -3
package/README.md CHANGED
@@ -11,26 +11,26 @@ cd ~/code/my-repo
11
11
  bunx @g3nomaly/analyze create_docs
12
12
  ```
13
13
 
14
- This writes `analyze_out/index.html` in the repository, and the query commands keep their scan cache in `analyze_out/` as well. Add it to `.gitignore`. The one other file analyze writes is `.analyzeignore`, once, when the repository has none.
14
+ This writes `analyze_out/index.html` in the repository, and the query commands keep their scan cache in `analyze_out/` as well. analyze puts a `.gitignore` holding `*` in `analyze_out/`, so git skips the directory. It writes nothing else in the repository.
15
15
 
16
16
  ## What it skips
17
17
 
18
- `.analyzeignore` at the repository root lists what the scan skips, on top of `.gitignore`, with the same patterns: `name/` skips a directory anywhere, `/name` only at the root, `*.ext` a file anywhere. analyze creates it with `node_modules/`, `dist/`, `build/`, `out/`, `target/`, `vendor/`, `coverage/`, `data/` and the like when it is absent. Edit it to change what is skipped. `--exclude` adds patterns for one run.
18
+ On top of `.gitignore`, the scan skips `node_modules/`, `dist/`, `build/`, `out/`, `target/`, `vendor/`, `coverage/`, `data/`, `fixtures/`, `__tmp__/`, `__pycache__/`, virtual environments, minified files, `.d.ts` files and npm lock files. To change that list, add a `.analyzeignore` at the repository root. It replaces the built-in list and takes the patterns of `.gitignore`: `name/` skips a directory anywhere, `/name` only at the root, `*.ext` a file anywhere. analyze never writes this file. `--exclude` adds patterns for one run.
19
19
 
20
20
  `analyze` needs [Bun](https://bun.sh) 1.2.21 or newer.
21
21
 
22
22
  ## What it reads
23
23
 
24
- | Section | Read from |
25
- |---|---|
26
- | Skills | Every `SKILL.md` inside the directory of an AI tool (`.claude`, `.codex`, `.cursor`, `.gemini`, `.agents`, `.windsurf`, `.opencode`) and the files beside it. A `SKILL.md` elsewhere is a doc |
27
- | Docs | Markdown. `glossary.md` is read as terms, `decisions.md` as decisions |
28
- | Code | Classes and functions in 13 languages through tree-sitter, with their doc comments. JSON, TOML and YAML files, OpenAPI documents and JSON Schemas among them |
29
- | Database | `.sql` files. A file that creates tables becomes a schema diagram, any other a query catalog. No database is ever opened |
30
- | Tasks | The plans, phases and tasks that task-manager keeps, in `skills.settings.filetreeRoot` of `.g3n.config.json` (default `docs/task-manager`) |
31
- | Packages | A directory with a `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pom.xml`, `build.gradle`, `composer.json`, `.csproj`, `.gemspec` or `Gemfile` is shown as a package: an app, a library or a workspace |
24
+ | Section | Read from |
25
+ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | Skills | Every `SKILL.md` inside the directory of an AI tool (`.claude`, `.codex`, `.cursor`, `.gemini`, `.agents`, `.windsurf`, `.opencode`) and the files beside it. A `SKILL.md` elsewhere is a doc |
27
+ | Docs | Markdown. `glossary.md` is read as terms, `decisions.md` as decisions, in any case. Any other markdown file is a document, whatever its folder |
28
+ | Code | Classes and functions in 13 languages through tree-sitter, with their doc comments. JSON, TOML and YAML files, OpenAPI documents and JSON Schemas among them |
29
+ | Database | `.sql` files. A file that creates tables becomes a schema diagram, any other a query catalog. No database is ever opened |
30
+ | Tasks | The plans, phases and tasks that task-manager keeps, in `skills.settings.filetreeRoot` of `.g3n.config.json` (default `docs/task-manager`) |
31
+ | Packages | A directory with a `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pom.xml`, `build.gradle`, `composer.json`, `.csproj`, `.gemspec`, `Gemfile`, `vcpkg.json` or `CMakeLists.txt` is shown as a package: an app, a library or a workspace. A `CMakeLists.txt` counts when it calls `project(`, builds a library or an executable (`add_library`, `add_executable`, or a macro whose name holds `library` or `executable`), or sits beside an `include/` folder. In a `src/`, `test/`, `tests/`, `cmake/` or `examples/` directory only `project(` counts, so `libs/<lib>/src/CMakeLists.txt` stays part of `libs/<lib>` |
32
32
 
33
- Every page, entry, parameter and field is a node of one graph. Edges connect a type to where it is used, a term to the text that uses it, a decision to the code it affects, a table to its foreign keys and queries, and a task to the code, docs and decisions it names and to the tasks it depends on. One registry in `src/model/registry.ts` defines every kind of node and edge.
33
+ Every page, entry, parameter and field is a node of one graph. Edges connect a type to where it is used, a source file to the files it includes or imports, a function to the functions it calls, a term to the text that uses it, a decision to the code it affects, a table to its foreign keys and queries, and a task to the code, docs and decisions it names and to the tasks it depends on. One registry in `src/model/registry.ts` defines every kind of node and edge.
34
34
 
35
35
  ## Querying
36
36
 
@@ -39,24 +39,48 @@ g3n-analyze search how are routes chosen # by words and by meaning
39
39
  g3n-analyze show choose_route # one page or entry in full
40
40
  g3n-analyze refs Sailing --kind term # what it links to, and what links to it
41
41
  g3n-analyze list --kind task # every task with its status
42
+ g3n-analyze graph --level packages --json # which package uses which, as nodes and edges
43
+ g3n-analyze list --community 3 # every page and entry of one community
42
44
  g3n-analyze show TASK-002 --json # a task, as JSON
43
45
  ```
44
46
 
45
- Output is markdown, or JSON with `--json`. `--from analyze_out/index.html` queries a built site without the repository. `g3n-analyze --help` lists every option, node kind, section and edge kind.
47
+ When nothing matches, `search` lists up to three weak matches by meaning instead, under a note and with `weak: true` in the JSON. Rewording the query often finds a better one. Output is markdown, or JSON with `--json`. `--from analyze_out/index.html` queries a built site without the repository. `g3n-analyze --help` lists every option, node kind, section and edge kind.
48
+
49
+ `graph` exports the whole graph in one call. `--level` picks how much of it: `files`, `entries` and `all` are the levels of the graph page of the site, and `packages` and `communities` sum the edges between packages or communities. `--kind`, `--section`, `--community` and `--edge` narrow the nodes and edges. An edge of a node the level leaves out, such as a call at the `files` level, counts for the node that holds it, such as its file.
50
+
51
+ ### Communities
52
+
53
+ A **community** is a group of nodes that link to each other more than to the rest, such as the classes and functions of one feature. Each scan splits the graph once, with the Louvain method, over every page and entry; a parameter or field is in the community of its entry, and a folder or package is in none. The community is a value of the node: `graph --level communities` lists them with their ids, `--community <id>` narrows `list`, `search`, `show`, `refs` and `graph` to one, and every node of a `graph` export carries its id. On the graph page of the site, dots can be colored by community and one community can be shown on its own.
54
+
55
+ ### How code links
56
+
57
+ - **Imports**: C and C++ `#include`, JavaScript and TypeScript imports, and Python imports link to the file of the repository they name. An include resolves next to the including file, then against every file whose path ends with it, the closest winning. A TypeScript import resolves a relative path, a package of the repository by name (`@scope/core`), or a path alias (`@/lib/api`). A header or package from outside the repository links to nothing.
58
+ - **What a file sees**: in C, C++, JavaScript, TypeScript and Python, a file sees itself and the files it imports, directly or through other files. A type name or a call only links to a declaration in a file it sees, so a common name never links across the repository. In the other languages every file is seen, and a type name links to the closest declaration of that name.
59
+ - **Types**: a qualified C++ name such as `geo::Point` only links to a `Point` inside `geo`. A type declared in a C or C++ source file is seen only in that file.
60
+ - **Calls**: a call links when it names one function: by name, through a namespace or type (`geo::distance()`, `Timer.once()`), through `this` or `self`, or through a parameter or field whose declared type is known. A call through a local variable, a module alias such as `helpers.go()`, or any other expression links nowhere, since its type is unknown. A bare call inside a JavaScript, TypeScript or Python method never means a method of its own class. A C++ method declared in a header and defined in a source file is called at its declaration.
46
61
 
47
62
  ## From hooks
48
63
 
49
64
  The same queries are a typed library API. A function never prints. Warnings go to `onWarning`, and errors are thrown as `OptionsError`, `QueryError` or `SourceError`.
50
65
 
51
66
  ```ts
52
- import { refs, search, show } from '@g3nomaly/analyze';
53
-
54
- const hits = await search({ repo: '/home/me/app', query: 'route price', limit: 5 });
55
- const task = await show({ repo: '/home/me/app', target: 'TASK-002' });
56
- const callers = await refs({ repo: '/home/me/app', target: 'choose_route', incoming: true, edges: ['names'] });
67
+ import { refs, search, show } from "@g3nomaly/analyze";
68
+
69
+ const hits = await search({
70
+ repo: "/home/me/app",
71
+ query: "route price",
72
+ limit: 5,
73
+ });
74
+ const task = await show({ repo: "/home/me/app", target: "TASK-002" });
75
+ const callers = await refs({
76
+ repo: "/home/me/app",
77
+ target: "choose_route",
78
+ incoming: true,
79
+ edges: ["names"],
80
+ });
57
81
  ```
58
82
 
59
- `createDocs`, `search`, `show`, `refs` and `list` take the options of the CLI as fields.
83
+ `createDocs`, `search`, `show`, `refs`, `list` and `graph` take the options of the CLI as fields.
60
84
 
61
85
  ## Development
62
86
 
@@ -1691,11 +1691,11 @@ Embedding model
1691
1691
 
1692
1692
  `vectors.bin` and `vocab.txt` are a table with one vector per word. `scripts/distill_word_table.py` computed it from the files below. `manifest.json` holds their SHA-256.
1693
1693
 
1694
- | Source | Used for | License |
1695
- |---|---|---|
1694
+ | Source | Used for | License |
1695
+ | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------- |
1696
1696
  | [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) by the Sentence Transformers authors | The vector of each word, and the whole words of its vocabulary as the first part of the word list | Apache-2.0 |
1697
- | [potion-base-8M](https://huggingface.co/minishlab/potion-base-8M) by MinishLab | How much each word counts: the length of its row | MIT |
1698
- | [potion-code-16M-v2](https://huggingface.co/minishlab/potion-code-16M-v2) by MinishLab | `code-words.txt`: the 12,000 most frequent words of its vocabulary that the first list lacks | MIT |
1697
+ | [potion-base-8M](https://huggingface.co/minishlab/potion-base-8M) by MinishLab | How much each word counts: the length of its row | MIT |
1698
+ | [potion-code-16M-v2](https://huggingface.co/minishlab/potion-code-16M-v2) by MinishLab | `code-words.txt`: the 12,000 most frequent words of its vocabulary that the first list lacks | MIT |
1699
1699
 
1700
1700
  The model files were taken from the npm packages `@lat.md/embed-minilm-fp16@0.1.0` (a 16-bit copy of all-MiniLM-L6-v2), `counterparts-model-potion@0.1.0` and `zvec-grep-potion-code-16m-v2-model@0.1.0`. analyze ships none of them, only the table.
1701
1701
 
@@ -48,14 +48,16 @@ export declare function fingerprintOf(sources: ScanSources): Promise<string>;
48
48
  */
49
49
  export declare class FileBundleCache implements BundleCache {
50
50
  private readonly directory;
51
+ private readonly prepare;
51
52
  private readonly file;
52
53
  /**
53
54
  * Creates the cache of one scan.
54
55
  *
55
56
  * @param directory - Cache directory. Created on the first write.
56
57
  * @param key - Name of the entry, from `cacheKey`.
58
+ * @param prepare - Runs before each write, before the cache directory is created, such as `prepareOutputDir` of the repository.
57
59
  */
58
- constructor(directory: string, key: string);
60
+ constructor(directory: string, key: string, prepare?: () => Promise<void>);
59
61
  /**
60
62
  * Reads the entry when its first line is the fingerprint.
61
63
  *
@@ -0,0 +1,131 @@
1
+ import { z } from 'zod';
2
+ import { type EdgeKind } from '../model';
3
+ import { type ExportLevel, type GraphExport, type NodeFilter, type Retriever } from '../retrieval';
4
+ /** The level `graph` exports when the caller names none. */
5
+ export declare const DEFAULT_EXPORT_LEVEL: ExportLevel;
6
+ /**
7
+ * Schema of the `graph` options.
8
+ *
9
+ * @property level - How much of the bundle to export. Default: `files`.
10
+ * @property edges - Only edges of these kinds. Empty or absent keeps every kind.
11
+ */
12
+ declare const graphSchema: z.ZodPipe<z.ZodObject<{
13
+ onWarning: z.ZodOptional<z.ZodCustom<import("./options").WarningHandler, import("./options").WarningHandler>>;
14
+ kinds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
15
+ class: "class";
16
+ decision: "decision";
17
+ definition: "definition";
18
+ enum: "enum";
19
+ field: "field";
20
+ file: "file";
21
+ folder: "folder";
22
+ function: "function";
23
+ interface: "interface";
24
+ namespace: "namespace";
25
+ operation: "operation";
26
+ package: "package";
27
+ parameter: "parameter";
28
+ phase: "phase";
29
+ plan: "plan";
30
+ query: "query";
31
+ struct: "struct";
32
+ table: "table";
33
+ task: "task";
34
+ term: "term";
35
+ trait: "trait";
36
+ type: "type";
37
+ }>>>>;
38
+ section: z.ZodOptional<z.ZodEnum<{
39
+ code: "code";
40
+ database: "database";
41
+ docs: "docs";
42
+ skills: "skills";
43
+ tasks: "tasks";
44
+ }>>;
45
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
46
+ repo: z.ZodOptional<z.ZodString>;
47
+ skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
48
+ docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
49
+ excludes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
50
+ embeddings: z.ZodOptional<z.ZodBoolean>;
51
+ from: z.ZodOptional<z.ZodString>;
52
+ cache: z.ZodOptional<z.ZodBoolean>;
53
+ level: z.ZodOptional<z.ZodEnum<{
54
+ all: "all";
55
+ communities: "communities";
56
+ entries: "entries";
57
+ files: "files";
58
+ packages: "packages";
59
+ }>>;
60
+ edges: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
61
+ affects: "affects";
62
+ calls: "calls";
63
+ depends: "depends";
64
+ extends: "extends";
65
+ imports: "imports";
66
+ mentions: "mentions";
67
+ names: "names";
68
+ reads: "reads";
69
+ references: "references";
70
+ returns: "returns";
71
+ throws: "throws";
72
+ type: "type";
73
+ uses: "uses";
74
+ writes: "writes";
75
+ }>>>>;
76
+ }, z.core.$strict>, z.ZodTransform<{
77
+ source: import("./source").BundleSource;
78
+ reporter: import("../scanner").Reporter;
79
+ request: {
80
+ level: "all" | "communities" | "entries" | "files" | "packages";
81
+ filter: NodeFilter;
82
+ edges: readonly ("affects" | "calls" | "depends" | "extends" | "imports" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[];
83
+ };
84
+ }, {
85
+ onWarning?: import("./options").WarningHandler | undefined;
86
+ kinds?: readonly ("class" | "decision" | "definition" | "enum" | "field" | "file" | "folder" | "function" | "interface" | "namespace" | "operation" | "package" | "parameter" | "phase" | "plan" | "query" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
87
+ section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
88
+ communities?: readonly number[] | undefined;
89
+ repo?: string | undefined;
90
+ skillDirs?: readonly string[] | undefined;
91
+ docDirs?: readonly string[] | undefined;
92
+ excludes?: readonly string[] | undefined;
93
+ embeddings?: boolean | undefined;
94
+ from?: string | undefined;
95
+ cache?: boolean | undefined;
96
+ level?: "all" | "communities" | "entries" | "files" | "packages" | undefined;
97
+ edges?: readonly ("affects" | "calls" | "depends" | "extends" | "imports" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[] | undefined;
98
+ }>>;
99
+ /** Options of `graph`: the level, the nodes and edges to keep, and the bundle to read. */
100
+ export type GraphOptions = z.input<typeof graphSchema>;
101
+ /**
102
+ * One `graph` on a loaded bundle.
103
+ *
104
+ * @property level - How much of the bundle to export.
105
+ * @property filter - Kinds and section of the nodes to keep.
106
+ * @property edges - Edge kinds to keep. Empty keeps every kind.
107
+ */
108
+ export interface GraphRequest {
109
+ readonly level: ExportLevel;
110
+ readonly filter: NodeFilter;
111
+ readonly edges: readonly EdgeKind[];
112
+ }
113
+ /**
114
+ * Exports one level of a loaded bundle.
115
+ *
116
+ * @param retriever - The loaded bundle to export.
117
+ * @param request - The level and what to keep.
118
+ * @returns The nodes and edges of the level. The CLI prints it with `graph --json`.
119
+ */
120
+ export declare function graphIn(retriever: Retriever, request: GraphRequest): GraphExport;
121
+ /**
122
+ * Exports the nodes and edges of a repository or a site in one call, at one level: packages, files, entries or all.
123
+ *
124
+ * @param options - The level, the kinds, section and edge kinds to keep, and the repository or site to read.
125
+ * Default: the files of the working directory with every edge.
126
+ * @returns The nodes and edges of the level.
127
+ * @throws {OptionsError} When the options are not valid.
128
+ * @throws {SourceError} When the repository or the site cannot be read.
129
+ */
130
+ export declare function graph(options?: GraphOptions): Promise<GraphExport>;
131
+ export {};
@@ -38,6 +38,7 @@ declare const listSchema: z.ZodPipe<z.ZodObject<{
38
38
  skills: "skills";
39
39
  tasks: "tasks";
40
40
  }>>;
41
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
41
42
  repo: z.ZodOptional<z.ZodString>;
42
43
  skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
43
44
  docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
@@ -57,6 +58,7 @@ declare const listSchema: z.ZodPipe<z.ZodObject<{
57
58
  onWarning?: import("./options").WarningHandler | undefined;
58
59
  kinds?: readonly ("class" | "decision" | "definition" | "enum" | "field" | "file" | "folder" | "function" | "interface" | "namespace" | "operation" | "package" | "parameter" | "phase" | "plan" | "query" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
59
60
  section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
61
+ communities?: readonly number[] | undefined;
60
62
  repo?: string | undefined;
61
63
  skillDirs?: readonly string[] | undefined;
62
64
  docDirs?: readonly string[] | undefined;
@@ -45,8 +45,9 @@ export declare const filterShape: {
45
45
  skills: "skills";
46
46
  tasks: "tasks";
47
47
  }>>;
48
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
48
49
  };
49
- /** The filter options after validation: `kinds` and `section`, both optional. */
50
+ /** The filter options after validation: `kinds`, `section` and `communities`, each optional. */
50
51
  type FilterFields = z.output<z.ZodObject<typeof filterShape>>;
51
52
  /**
52
53
  * Turns validated filter options into the filter the retriever takes.
@@ -41,6 +41,7 @@ declare const refsSchema: z.ZodPipe<z.ZodObject<{
41
41
  skills: "skills";
42
42
  tasks: "tasks";
43
43
  }>>;
44
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
44
45
  repo: z.ZodOptional<z.ZodString>;
45
46
  skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
46
47
  docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
@@ -53,8 +54,10 @@ declare const refsSchema: z.ZodPipe<z.ZodObject<{
53
54
  outgoing: z.ZodOptional<z.ZodBoolean>;
54
55
  edges: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
55
56
  affects: "affects";
57
+ calls: "calls";
56
58
  depends: "depends";
57
59
  extends: "extends";
60
+ imports: "imports";
58
61
  mentions: "mentions";
59
62
  names: "names";
60
63
  reads: "reads";
@@ -73,13 +76,14 @@ declare const refsSchema: z.ZodPipe<z.ZodObject<{
73
76
  filter: NodeFilter;
74
77
  references: {
75
78
  direction: "both" | "in" | "out";
76
- kinds: readonly ("affects" | "depends" | "extends" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[];
79
+ kinds: readonly ("affects" | "calls" | "depends" | "extends" | "imports" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[];
77
80
  };
78
81
  };
79
82
  }, {
80
83
  onWarning?: import("./options").WarningHandler | undefined;
81
84
  kinds?: readonly ("class" | "decision" | "definition" | "enum" | "field" | "file" | "folder" | "function" | "interface" | "namespace" | "operation" | "package" | "parameter" | "phase" | "plan" | "query" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
82
85
  section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
86
+ communities?: readonly number[] | undefined;
83
87
  repo?: string | undefined;
84
88
  skillDirs?: readonly string[] | undefined;
85
89
  docDirs?: readonly string[] | undefined;
@@ -90,7 +94,7 @@ declare const refsSchema: z.ZodPipe<z.ZodObject<{
90
94
  target: string;
91
95
  incoming?: boolean | undefined;
92
96
  outgoing?: boolean | undefined;
93
- edges?: readonly ("affects" | "depends" | "extends" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[] | undefined;
97
+ edges?: readonly ("affects" | "calls" | "depends" | "extends" | "imports" | "mentions" | "names" | "reads" | "references" | "returns" | "throws" | "type" | "uses" | "writes")[] | undefined;
94
98
  }>>;
95
99
  /** Options of `refs`: the node, which links to follow, and the bundle to read. */
96
100
  export type RefsOptions = z.input<typeof refsSchema>;
@@ -41,7 +41,7 @@ export type ScanFields = z.output<z.ZodObject<typeof scanShape>>;
41
41
  */
42
42
  export declare function scanOf(fields: ScanFields): ScanOptions;
43
43
  /**
44
- * Names the site file of a repository. `createDocs` writes it, and nothing else outside the cache.
44
+ * Names the site file of a repository. `createDocs` writes it, and outside the cache only the `.gitignore` of `analyze_out/`.
45
45
  *
46
46
  * @param repo - Absolute path of the repository.
47
47
  * @returns `<repo>/analyze_out/index.html`.
@@ -54,3 +54,10 @@ export declare function siteFileOf(repo: string): string;
54
54
  * @returns `<repo>/analyze_out/cache`.
55
55
  */
56
56
  export declare function cacheDirOf(repo: string): string;
57
+ /**
58
+ * @brief Creates `analyze_out/` in a repository, with a `.gitignore` that holds `*` so git skips everything
59
+ * analyze writes there. Leaves a `.gitignore` that is already there as it is.
60
+ *
61
+ * @param repo - Absolute path of the repository.
62
+ */
63
+ export declare function prepareOutputDir(repo: string): Promise<void>;
@@ -42,6 +42,7 @@ declare const searchSchema: z.ZodPipe<z.ZodObject<{
42
42
  skills: "skills";
43
43
  tasks: "tasks";
44
44
  }>>;
45
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
45
46
  repo: z.ZodOptional<z.ZodString>;
46
47
  skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
47
48
  docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
@@ -69,6 +70,7 @@ declare const searchSchema: z.ZodPipe<z.ZodObject<{
69
70
  onWarning?: import("./options").WarningHandler | undefined;
70
71
  kinds?: readonly ("class" | "decision" | "definition" | "enum" | "field" | "file" | "folder" | "function" | "interface" | "namespace" | "operation" | "package" | "parameter" | "phase" | "plan" | "query" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
71
72
  section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
73
+ communities?: readonly number[] | undefined;
72
74
  repo?: string | undefined;
73
75
  skillDirs?: readonly string[] | undefined;
74
76
  docDirs?: readonly string[] | undefined;
@@ -102,7 +104,7 @@ export interface SearchRequest {
102
104
  * @property query - The words searched for.
103
105
  * @property mode - How the words were matched.
104
106
  * @property model - Name of the embedding model of the bundle. `null` when the bundle has none.
105
- * @property hits - Hits, best first.
107
+ * @property hits - Hits, best first. When nothing matched, the few closest by meaning, each marked `weak`.
106
108
  */
107
109
  export interface SearchResult {
108
110
  readonly query: string;
@@ -111,7 +113,8 @@ export interface SearchResult {
111
113
  readonly hits: readonly SearchHit[];
112
114
  }
113
115
  /**
114
- * Searches a loaded bundle.
116
+ * @brief Searches a loaded bundle. When nothing clears the cut-off, it returns the few closest hits by meaning
117
+ * below it instead, each marked `weak`.
115
118
  *
116
119
  * @param retriever - The loaded bundle to search.
117
120
  * @param request - The words, the mode, the limit and the filter.
@@ -6,7 +6,7 @@ export declare const GENERATOR: string;
6
6
  /**
7
7
  * @brief Wires the services that scan one repository into a builder.
8
8
  *
9
- * Reads the `.analyzeignore` of the repository, creating it when absent, and skips its patterns and `scan.excludes`.
9
+ * Skips the patterns of the repository's `.analyzeignore`, or the built-in ones when it has none, and `scan.excludes`.
10
10
  *
11
11
  * @param scan - What to scan. Its `embeddings` flag decides whether the builder embeds the nodes.
12
12
  * @param reporter - Receives the warnings of the scan.
@@ -38,6 +38,7 @@ declare const showSchema: z.ZodPipe<z.ZodObject<{
38
38
  skills: "skills";
39
39
  tasks: "tasks";
40
40
  }>>;
41
+ communities: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
41
42
  repo: z.ZodOptional<z.ZodString>;
42
43
  skillDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
43
44
  docDirs: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
@@ -57,6 +58,7 @@ declare const showSchema: z.ZodPipe<z.ZodObject<{
57
58
  onWarning?: import("./options").WarningHandler | undefined;
58
59
  kinds?: readonly ("class" | "decision" | "definition" | "enum" | "field" | "file" | "folder" | "function" | "interface" | "namespace" | "operation" | "package" | "parameter" | "phase" | "plan" | "query" | "struct" | "table" | "task" | "term" | "trait" | "type")[] | undefined;
59
60
  section?: "code" | "database" | "docs" | "skills" | "tasks" | undefined;
61
+ communities?: readonly number[] | undefined;
60
62
  repo?: string | undefined;
61
63
  skillDirs?: readonly string[] | undefined;
62
64
  docDirs?: readonly string[] | undefined;