@jafreck/lore 0.2.5 → 0.3.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 (89) hide show
  1. package/README.md +42 -23
  2. package/dist/cli.js +35 -99
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +24 -5
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +23 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/indexer/call-graph.d.ts +8 -4
  9. package/dist/indexer/call-graph.d.ts.map +1 -1
  10. package/dist/indexer/call-graph.js +150 -81
  11. package/dist/indexer/call-graph.js.map +1 -1
  12. package/dist/indexer/db.d.ts.map +1 -1
  13. package/dist/indexer/db.js +29 -3
  14. package/dist/indexer/db.js.map +1 -1
  15. package/dist/indexer/extractors/php.js +5 -1
  16. package/dist/indexer/extractors/php.js.map +1 -1
  17. package/dist/indexer/index.d.ts +27 -75
  18. package/dist/indexer/index.d.ts.map +1 -1
  19. package/dist/indexer/index.js +146 -904
  20. package/dist/indexer/index.js.map +1 -1
  21. package/dist/indexer/lsp/enrichment.d.ts +2 -0
  22. package/dist/indexer/lsp/enrichment.d.ts.map +1 -1
  23. package/dist/indexer/lsp/enrichment.js +67 -33
  24. package/dist/indexer/lsp/enrichment.js.map +1 -1
  25. package/dist/indexer/pipeline.d.ts +137 -0
  26. package/dist/indexer/pipeline.d.ts.map +1 -0
  27. package/dist/indexer/pipeline.js +84 -0
  28. package/dist/indexer/pipeline.js.map +1 -0
  29. package/dist/indexer/resolution-method.d.ts +40 -0
  30. package/dist/indexer/resolution-method.d.ts.map +1 -0
  31. package/dist/indexer/resolution-method.js +53 -0
  32. package/dist/indexer/resolution-method.js.map +1 -0
  33. package/dist/indexer/stages/dependency-api.d.ts +18 -0
  34. package/dist/indexer/stages/dependency-api.d.ts.map +1 -0
  35. package/dist/indexer/stages/dependency-api.js +174 -0
  36. package/dist/indexer/stages/dependency-api.js.map +1 -0
  37. package/dist/indexer/stages/docs-index.d.ts +20 -0
  38. package/dist/indexer/stages/docs-index.d.ts.map +1 -0
  39. package/dist/indexer/stages/docs-index.js +144 -0
  40. package/dist/indexer/stages/docs-index.js.map +1 -0
  41. package/dist/indexer/stages/embedding.d.ts +17 -0
  42. package/dist/indexer/stages/embedding.d.ts.map +1 -0
  43. package/dist/indexer/stages/embedding.js +217 -0
  44. package/dist/indexer/stages/embedding.js.map +1 -0
  45. package/dist/indexer/stages/import-resolution.d.ts +17 -0
  46. package/dist/indexer/stages/import-resolution.d.ts.map +1 -0
  47. package/dist/indexer/stages/import-resolution.js +47 -0
  48. package/dist/indexer/stages/import-resolution.js.map +1 -0
  49. package/dist/indexer/stages/index.d.ts +12 -0
  50. package/dist/indexer/stages/index.d.ts.map +1 -0
  51. package/dist/indexer/stages/index.js +12 -0
  52. package/dist/indexer/stages/index.js.map +1 -0
  53. package/dist/indexer/stages/lsp-enrichment.d.ts +48 -0
  54. package/dist/indexer/stages/lsp-enrichment.d.ts.map +1 -0
  55. package/dist/indexer/stages/lsp-enrichment.js +158 -0
  56. package/dist/indexer/stages/lsp-enrichment.js.map +1 -0
  57. package/dist/indexer/stages/source-index.d.ts +31 -0
  58. package/dist/indexer/stages/source-index.d.ts.map +1 -0
  59. package/dist/indexer/stages/source-index.js +314 -0
  60. package/dist/indexer/stages/source-index.js.map +1 -0
  61. package/dist/lore-server/db.d.ts +51 -4
  62. package/dist/lore-server/db.d.ts.map +1 -1
  63. package/dist/lore-server/db.js +74 -69
  64. package/dist/lore-server/db.js.map +1 -1
  65. package/dist/lore-server/server.d.ts +5 -0
  66. package/dist/lore-server/server.d.ts.map +1 -1
  67. package/dist/lore-server/server.js +51 -233
  68. package/dist/lore-server/server.js.map +1 -1
  69. package/dist/lore-server/tool-registry.d.ts +101 -0
  70. package/dist/lore-server/tool-registry.d.ts.map +1 -0
  71. package/dist/lore-server/tool-registry.js +227 -0
  72. package/dist/lore-server/tool-registry.js.map +1 -0
  73. package/dist/lore-server/tools/graph.d.ts +7 -0
  74. package/dist/lore-server/tools/graph.d.ts.map +1 -1
  75. package/dist/lore-server/tools/graph.js +64 -7
  76. package/dist/lore-server/tools/graph.js.map +1 -1
  77. package/dist/lore-server/tools/lookup.d.ts +9 -3
  78. package/dist/lore-server/tools/lookup.d.ts.map +1 -1
  79. package/dist/lore-server/tools/lookup.js +9 -4
  80. package/dist/lore-server/tools/lookup.js.map +1 -1
  81. package/dist/lore-server/tools/search.d.ts +4 -0
  82. package/dist/lore-server/tools/search.d.ts.map +1 -1
  83. package/dist/lore-server/tools/search.js +4 -0
  84. package/dist/lore-server/tools/search.js.map +1 -1
  85. package/dist/runtime.d.ts +88 -0
  86. package/dist/runtime.d.ts.map +1 -0
  87. package/dist/runtime.js +153 -0
  88. package/dist/runtime.js.map +1 -0
  89. package/package.json +12 -12
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @module indexer/resolution-method
3
+ *
4
+ * Authoritative taxonomy for the `resolution_method` column stored on
5
+ * `symbol_refs`, `type_refs`, and `symbol_relationships`.
6
+ *
7
+ * Consumers should import from here rather than using string literals so that
8
+ * writers (call-graph.ts) and readers (graph.ts) stay in sync.
9
+ */
10
+ /**
11
+ * Resolution confidence tiers, ordered from highest to lowest confidence.
12
+ *
13
+ * - `lsp_definition` — the LSP server returned a precise definition location
14
+ * that was mapped to the narrowest enclosing indexed symbol.
15
+ * - `name_same_file` — no LSP data was available; the callee/type name matched
16
+ * exactly one symbol *in the same file* as the reference.
17
+ * - `name_unique` — no LSP data was available; the callee/type name matched
18
+ * exactly one symbol *in the entire index*.
19
+ * - `external_definition` — the LSP server returned a definition location whose
20
+ * path is not in the indexed file set (e.g. node_modules, stdlib).
21
+ * - `ambiguous_definition` — the LSP server returned a definition location that
22
+ * maps to multiple equally-narrow candidate symbols. Manual disambiguation is
23
+ * needed.
24
+ * - `unresolved` — no resolution strategy succeeded. The reference remains a
25
+ * dangling name.
26
+ */
27
+ export const RESOLUTION_METHODS = [
28
+ 'lsp_definition',
29
+ 'name_same_file',
30
+ 'name_unique',
31
+ 'external_definition',
32
+ 'ambiguous_definition',
33
+ 'unresolved',
34
+ ];
35
+ /**
36
+ * Set of resolution methods that indicate a successfully resolved target.
37
+ * Useful for filtering edges to only include high-confidence results.
38
+ */
39
+ export const RESOLVED_METHODS = new Set([
40
+ 'lsp_definition',
41
+ 'name_same_file',
42
+ 'name_unique',
43
+ ]);
44
+ /**
45
+ * Set of resolution methods where the target_id is expected to be NULL.
46
+ * These represent references that could not be mapped to an indexed symbol.
47
+ */
48
+ export const UNRESOLVED_METHODS = new Set([
49
+ 'external_definition',
50
+ 'ambiguous_definition',
51
+ 'unresolved',
52
+ ]);
53
+ //# sourceMappingURL=resolution-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-method.js","sourceRoot":"","sources":["../../src/indexer/resolution-method.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,qBAAqB;IACrB,sBAAsB;IACtB,YAAY;CACJ,CAAC;AAKX;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkC,IAAI,GAAG,CAAC;IACrE,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;CACd,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkC,IAAI,GAAG,CAAC;IACvE,qBAAqB;IACrB,sBAAsB;IACtB,YAAY;CACb,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module indexer/stages/dependency-api
3
+ *
4
+ * Pipeline stage: index declaration-surface symbols from direct dependencies
5
+ * (.d.ts files for npm, etc.). Populates `external_symbols`.
6
+ */
7
+ import type { PipelineContext, PipelineStage } from '../pipeline.js';
8
+ /**
9
+ * Index exported declarations from direct npm dependencies (.d.ts files).
10
+ * Stores results in `external_symbols`.
11
+ */
12
+ export declare class DependencyApiStage implements PipelineStage {
13
+ readonly name = "dependency-api";
14
+ private pool;
15
+ execute(context: PipelineContext, _mode: 'build' | 'update'): Promise<void>;
16
+ dispose(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=dependency-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-api.d.ts","sourceRoot":"","sources":["../../../src/indexer/stages/dependency-api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAcrE;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACtD,QAAQ,CAAC,IAAI,oBAAoB;IAEjC,OAAO,CAAC,IAAI,CAA2B;IAEjC,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA+F3E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @module indexer/stages/dependency-api
3
+ *
4
+ * Pipeline stage: index declaration-surface symbols from direct dependencies
5
+ * (.d.ts files for npm, etc.). Populates `external_symbols`.
6
+ */
7
+ import * as fs from 'node:fs';
8
+ import * as path from 'node:path';
9
+ import { ParserPool } from '../parser.js';
10
+ import { LspEnrichmentCoordinator } from '../lsp/enrichment.js';
11
+ import { isPublicDeclarationSurfaceSymbol, } from '../extractors/types.js';
12
+ import { TypeScriptExtractor } from '../extractors/typescript.js';
13
+ // ─── Stage ────────────────────────────────────────────────────────────────────
14
+ /**
15
+ * Index exported declarations from direct npm dependencies (.d.ts files).
16
+ * Stores results in `external_symbols`.
17
+ */
18
+ export class DependencyApiStage {
19
+ name = 'dependency-api';
20
+ pool = null;
21
+ async execute(context, _mode) {
22
+ const { db, walkerConfig, lsp } = context;
23
+ // Always clear external symbols — when indexDependencies is false, this
24
+ // ensures stale data from a previous deps-enabled build is removed.
25
+ db.prepare('DELETE FROM external_symbols').run();
26
+ if (!context.indexDependencies)
27
+ return;
28
+ this.pool = new ParserPool();
29
+ const directDependencies = loadDirectDependencies(walkerConfig.rootDir);
30
+ if (directDependencies.size === 0)
31
+ return;
32
+ const extractor = new TypeScriptExtractor();
33
+ // Optional LSP coordinator for enriching external symbols.
34
+ let lspCoordinator = null;
35
+ if (lsp?.enabled) {
36
+ lspCoordinator = new LspEnrichmentCoordinator(lsp, walkerConfig.rootDir);
37
+ await lspCoordinator.start(new Set(['typescript']));
38
+ }
39
+ try {
40
+ const insertExternalSymbol = db.prepare(`INSERT OR IGNORE INTO external_symbols
41
+ (
42
+ package_name,
43
+ package_version,
44
+ source_ref,
45
+ symbol_name,
46
+ symbol_kind,
47
+ signature,
48
+ doc_comment,
49
+ resolved_type_signature,
50
+ resolved_return_type,
51
+ definition_uri,
52
+ definition_path
53
+ )
54
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
55
+ for (const [packageName, declaredVersion] of directDependencies) {
56
+ const packageDir = path.join(walkerConfig.rootDir, 'node_modules', packageName);
57
+ if (!fs.existsSync(packageDir) || !fs.statSync(packageDir).isDirectory())
58
+ continue;
59
+ const packageVersion = readInstalledPackageVersion(packageDir) ?? declaredVersion ?? null;
60
+ const declarationFiles = collectDeclarationFiles(packageDir);
61
+ for (const declarationFile of declarationFiles) {
62
+ const source = fs.readFileSync(declarationFile, 'utf8');
63
+ const tree = this.pool.parse('typescript', source);
64
+ if (!tree)
65
+ continue;
66
+ const result = extractor.extract(tree, source, declarationFile);
67
+ const declarationSymbols = result.symbols.filter((symbol) => shouldIndexDependencySymbol(symbol));
68
+ const enrichmentRows = lspCoordinator
69
+ ? await lspCoordinator.enrich({
70
+ filePath: declarationFile,
71
+ language: 'typescript',
72
+ source,
73
+ targets: declarationSymbols.map((symbol) => ({
74
+ line: symbol.startLine,
75
+ character: symbol.startCharacter ?? 0,
76
+ })),
77
+ })
78
+ : declarationSymbols.map(() => null);
79
+ for (let i = 0; i < declarationSymbols.length; i++) {
80
+ const symbol = declarationSymbols[i];
81
+ if (!symbol)
82
+ continue;
83
+ const metadata = enrichmentRows[i];
84
+ insertExternalSymbol.run(packageName, packageVersion, declarationFile, symbol.name, symbol.kind, symbol.signature, symbol.docComment ?? null, metadata?.resolvedTypeSignature ?? null, metadata?.resolvedReturnType ?? null, metadata?.definitionUri ?? null, metadata?.definitionPath ?? null);
85
+ }
86
+ }
87
+ }
88
+ }
89
+ finally {
90
+ if (lspCoordinator) {
91
+ await lspCoordinator.dispose();
92
+ }
93
+ }
94
+ }
95
+ async dispose() {
96
+ this.pool = null;
97
+ }
98
+ }
99
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
100
+ function loadDirectDependencies(rootDir) {
101
+ const packageJsonPath = path.join(rootDir, 'package.json');
102
+ if (!fs.existsSync(packageJsonPath))
103
+ return new Map();
104
+ const raw = fs.readFileSync(packageJsonPath, 'utf8');
105
+ const pkg = JSON.parse(raw);
106
+ const deps = new Map();
107
+ for (const section of [pkg.dependencies, pkg.devDependencies, pkg.peerDependencies]) {
108
+ if (!section)
109
+ continue;
110
+ for (const [name, version] of Object.entries(section)) {
111
+ if (!deps.has(name))
112
+ deps.set(name, version);
113
+ }
114
+ }
115
+ return deps;
116
+ }
117
+ function readInstalledPackageVersion(packageDir) {
118
+ const packageJsonPath = path.join(packageDir, 'package.json');
119
+ if (!fs.existsSync(packageJsonPath))
120
+ return undefined;
121
+ const raw = fs.readFileSync(packageJsonPath, 'utf8');
122
+ const pkg = JSON.parse(raw);
123
+ return pkg.version;
124
+ }
125
+ function collectDeclarationFiles(packageDir) {
126
+ const declarations = [];
127
+ const stack = [packageDir];
128
+ while (stack.length > 0) {
129
+ const currentDir = stack.pop();
130
+ if (!currentDir)
131
+ continue;
132
+ const entries = fs.readdirSync(currentDir, { withFileTypes: true });
133
+ for (const entry of entries) {
134
+ if (entry.name === 'node_modules')
135
+ continue;
136
+ const fullPath = path.join(currentDir, entry.name);
137
+ if (entry.isDirectory()) {
138
+ stack.push(fullPath);
139
+ continue;
140
+ }
141
+ if (entry.isFile() && fullPath.endsWith('.d.ts')) {
142
+ declarations.push(fullPath);
143
+ }
144
+ }
145
+ }
146
+ return declarations;
147
+ }
148
+ function shouldIndexDependencySymbol(symbol) {
149
+ if (!isPublicDeclarationSurfaceSymbol(symbol))
150
+ return false;
151
+ if (symbol.declarationSurface)
152
+ return true;
153
+ return !hasImplementationBody(symbol);
154
+ }
155
+ function hasImplementationBody(symbol) {
156
+ const node = symbol.astNode;
157
+ if (!node)
158
+ return false;
159
+ if (node.type === 'arrow_function' ||
160
+ node.type === 'function_expression' ||
161
+ node.type === 'generator_function') {
162
+ return true;
163
+ }
164
+ if (node.type === 'class_declaration' ||
165
+ node.type === 'interface_declaration' ||
166
+ node.type === 'type_alias_declaration') {
167
+ return false;
168
+ }
169
+ const bodyNode = node.childForFieldName('body');
170
+ if (!bodyNode)
171
+ return false;
172
+ return bodyNode.namedChildCount > 0 || bodyNode.text.trim() !== '';
173
+ }
174
+ //# sourceMappingURL=dependency-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-api.js","sourceRoot":"","sources":["../../../src/indexer/stages/dependency-api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAIL,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACpB,IAAI,GAAG,gBAAgB,CAAC;IAEzB,IAAI,GAAsB,IAAI,CAAC;IAEvC,KAAK,C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 +1,20 @@
1
+ /**
2
+ * @module indexer/stages/docs-index
3
+ *
4
+ * Pipeline stage: walk documentation files, chunk by headings, insert into
5
+ * the database, and optionally seed notes from documentation content.
6
+ */
7
+ import type { PipelineContext, PipelineStage } from '../pipeline.js';
8
+ import type { Database } from '../db.js';
9
+ import type { DocumentationFile } from '../docs.js';
10
+ /**
11
+ * Walk documentation files, chunk by headings, and persist to the database.
12
+ * Optionally seeds notes from documentation content.
13
+ */
14
+ export declare class DocsIndexStage implements PipelineStage {
15
+ readonly name = "docs-index";
16
+ execute(context: PipelineContext, mode: 'build' | 'update'): Promise<void>;
17
+ }
18
+ export declare function processDocumentationFile(db: Database.Database, doc: DocumentationFile, branch: string): void;
19
+ export declare function upsertSeededDocumentationNote(db: Database.Database, doc: DocumentationFile, branch: string): void;
20
+ //# sourceMappingURL=docs-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-index.d.ts","sourceRoot":"","sources":["../../../src/indexer/stages/docs-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiBpD;;;GAGG;AACH,qBAAa,cAAe,YAAW,aAAa;IAClD,QAAQ,CAAC,IAAI,gBAAgB;IAEvB,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCjF;AAID,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,GACb,IAAI,CAsEN;AAED,wBAAgB,6BAA6B,CAC3C,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,GACb,IAAI,CAsBN"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @module indexer/stages/docs-index
3
+ *
4
+ * Pipeline stage: walk documentation files, chunk by headings, insert into
5
+ * the database, and optionally seed notes from documentation content.
6
+ */
7
+ import { walkDocumentationFiles } from '../walker.js';
8
+ import { inferSeededDocNoteKey, buildDocNoteScope } from '../docs.js';
9
+ // ─── Stage ────────────────────────────────────────────────────────────────────
10
+ /**
11
+ * Walk documentation files, chunk by headings, and persist to the database.
12
+ * Optionally seeds notes from documentation content.
13
+ */
14
+ export class DocsIndexStage {
15
+ name = 'docs-index';
16
+ async execute(context, mode) {
17
+ const docs = await walkDocumentationFiles(context.walkerConfig);
18
+ context.log.indexing('docs walk complete', { docCount: docs.length });
19
+ const { db, branch } = context;
20
+ if (mode === 'build') {
21
+ db.transaction(() => {
22
+ const seenDocPaths = new Set();
23
+ for (const doc of docs) {
24
+ seenDocPaths.add(doc.path);
25
+ processDocumentationFile(db, doc, branch);
26
+ if (context.docsAutoNotes) {
27
+ upsertSeededDocumentationNote(db, doc, branch);
28
+ }
29
+ }
30
+ removeStaleDocumentation(db, branch, seenDocPaths);
31
+ })();
32
+ }
33
+ else {
34
+ // Update mode: only process docs that are in the changed-file list
35
+ const changedFiles = context.changedFiles ?? [];
36
+ const changedSet = new Set(changedFiles);
37
+ const docsByPath = new Map(docs.map(doc => [doc.path, doc]));
38
+ db.transaction(() => {
39
+ for (const filePath of changedFiles) {
40
+ const changedDoc = docsByPath.get(filePath);
41
+ if (changedDoc) {
42
+ processDocumentationFile(db, changedDoc, branch);
43
+ if (context.docsAutoNotes)
44
+ upsertSeededDocumentationNote(db, changedDoc, branch);
45
+ context.changedDocPaths.push(filePath);
46
+ }
47
+ else {
48
+ deleteDocumentationByPath(db, filePath, branch);
49
+ }
50
+ }
51
+ })();
52
+ }
53
+ }
54
+ }
55
+ // ─── Documentation file processing ───────────────────────────────────────────
56
+ export function processDocumentationFile(db, doc, branch) {
57
+ const existing = db.prepare('SELECT id, content_hash FROM docs WHERE path = ? AND branch = ?').get(doc.path, branch);
58
+ if (existing?.content_hash === doc.hash) {
59
+ return;
60
+ }
61
+ let docId;
62
+ if (existing) {
63
+ db.prepare(`UPDATE docs
64
+ SET kind = ?, title = ?, content = ?, content_hash = ?, indexed_at = unixepoch()
65
+ WHERE id = ?`).run(doc.kind, doc.title, doc.content, doc.hash, existing.id);
66
+ docId = existing.id;
67
+ }
68
+ else {
69
+ const info = db.prepare(`INSERT INTO docs (path, branch, kind, title, content, content_hash)
70
+ VALUES (?, ?, ?, ?, ?, ?)`).run(doc.path, branch, doc.kind, doc.title, doc.content, doc.hash);
71
+ docId = Number(info.lastInsertRowid);
72
+ }
73
+ const existingSections = db.prepare('SELECT id, section_index FROM doc_sections WHERE doc_id = ?').all(docId);
74
+ const insertSection = db.prepare(`INSERT INTO doc_sections (
75
+ doc_id, section_index, title, depth, heading_path, line_start, line_end, content, content_hash
76
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
77
+ ON CONFLICT(doc_id, section_index) DO UPDATE SET
78
+ title = excluded.title,
79
+ depth = excluded.depth,
80
+ heading_path = excluded.heading_path,
81
+ line_start = excluded.line_start,
82
+ line_end = excluded.line_end,
83
+ content = excluded.content,
84
+ content_hash = excluded.content_hash`);
85
+ const activeSectionIndexes = new Set();
86
+ for (const chunk of doc.chunks) {
87
+ activeSectionIndexes.add(chunk.sectionIndex);
88
+ insertSection.run(docId, chunk.sectionIndex, chunk.title, chunk.depth, JSON.stringify(chunk.headingPath), chunk.lineStart, chunk.lineEnd, chunk.content, chunk.hash);
89
+ }
90
+ const staleSectionIds = existingSections
91
+ .filter(section => !activeSectionIndexes.has(section.section_index))
92
+ .map(section => section.id);
93
+ deleteDocSectionEmbeddings(db, staleSectionIds);
94
+ if (staleSectionIds.length > 0) {
95
+ db.prepare(`DELETE FROM doc_sections
96
+ WHERE id IN (${staleSectionIds.map(() => '?').join(', ')})`).run(...staleSectionIds);
97
+ }
98
+ }
99
+ export function upsertSeededDocumentationNote(db, doc, branch) {
100
+ const key = inferSeededDocNoteKey(doc);
101
+ if (!key)
102
+ return;
103
+ const scope = buildDocNoteScope(doc.path, branch);
104
+ const existing = db.prepare('SELECT content, source_hash FROM notes WHERE key = ? AND scope = ?').get(key, scope);
105
+ if (existing?.content === doc.content && existing.source_hash === doc.hash) {
106
+ return;
107
+ }
108
+ db.prepare(`INSERT INTO notes (key, scope, content, model, source_hash, created_at, updated_at)
109
+ VALUES (?, ?, ?, ?, ?, unixepoch(), unixepoch())
110
+ ON CONFLICT(key, scope) DO UPDATE SET
111
+ content = excluded.content,
112
+ model = excluded.model,
113
+ source_hash = excluded.source_hash,
114
+ updated_at = unixepoch()`).run(key, scope, doc.content, 'system:auto-doc-seed', doc.hash);
115
+ }
116
+ function deleteDocumentationByPath(db, docPath, branch) {
117
+ const row = db.prepare('SELECT id FROM docs WHERE path = ? AND branch = ?')
118
+ .get(docPath, branch);
119
+ if (!row)
120
+ return;
121
+ deleteDocumentationById(db, row.id);
122
+ }
123
+ function removeStaleDocumentation(db, branch, retainedPaths) {
124
+ const docs = db.prepare('SELECT id, path FROM docs WHERE branch = ?').all(branch);
125
+ for (const doc of docs) {
126
+ if (!retainedPaths.has(doc.path)) {
127
+ deleteDocumentationById(db, doc.id);
128
+ }
129
+ }
130
+ }
131
+ function deleteDocumentationById(db, docId) {
132
+ const sectionIds = db.prepare('SELECT id FROM doc_sections WHERE doc_id = ?').all(docId);
133
+ deleteDocSectionEmbeddings(db, sectionIds.map(row => row.id));
134
+ db.prepare('DELETE FROM docs WHERE id = ?').run(docId);
135
+ }
136
+ function deleteDocSectionEmbeddings(db, sectionIds) {
137
+ if (sectionIds.length === 0)
138
+ return;
139
+ const hasEmbeddingsTable = db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type IN ('table', 'virtual table') AND name = 'doc_section_embeddings'").get();
140
+ if (!hasEmbeddingsTable)
141
+ return;
142
+ db.prepare(`DELETE FROM doc_section_embeddings WHERE rowid IN (${sectionIds.map(() => '?').join(', ')})`).run(...sectionIds);
143
+ }
144
+ //# sourceMappingURL=docs-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-index.js","sourceRoot":"","sources":["../../../src/indexer/stages/docs-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AActE,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,YAAY,CAAC;IAE7B,KAAK,CAAC,OAAO,CAAC,OAAwB,EAAE,IAAwB;QAC9D,MAAM,IAAI,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAEtE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE/B,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;gBAClB,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;gBACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;oBACvB,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAC3B,wBAAwB,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;oBAC1C,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;wBAC1B,6BAA6B,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;oBACjD,CAAC;gBACH,CAAC;gBACD,wBAAwB,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,CAA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C,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9F,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module indexer/stages/embedding
3
+ *
4
+ * Pipeline stage: embed symbol signatures, documentation sections, and
5
+ * commit messages into vec0 virtual tables for semantic search.
6
+ */
7
+ import type { PipelineContext, PipelineStage } from '../pipeline.js';
8
+ /**
9
+ * Embed symbol signatures, documentation sections, and commit messages.
10
+ *
11
+ * Skips entirely when no `EmbeddingProvider` is configured in the context.
12
+ */
13
+ export declare class EmbeddingStage implements PipelineStage {
14
+ readonly name = "embedding";
15
+ execute(context: PipelineContext, mode: 'build' | 'update'): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=embedding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../src/indexer/stages/embedding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AASrE;;;;GAIG;AACH,qBAAa,cAAe,YAAW,aAAa;IAClD,QAAQ,CAAC,IAAI,eAAe;IAEtB,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BjF"}