seer-mcp 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.
- package/.vscode/settings.json +3 -0
- package/LICENSE +176 -0
- package/README.md +272 -0
- package/README_dev.md +199 -0
- package/dist/bundle/ci.d.ts +47 -0
- package/dist/bundle/ci.d.ts.map +1 -0
- package/dist/bundle/ci.js +113 -0
- package/dist/bundle/ci.js.map +1 -0
- package/dist/bundle/contract.d.ts +111 -0
- package/dist/bundle/contract.d.ts.map +1 -0
- package/dist/bundle/contract.js +352 -0
- package/dist/bundle/contract.js.map +1 -0
- package/dist/bundle/export.d.ts +36 -0
- package/dist/bundle/export.d.ts.map +1 -0
- package/dist/bundle/export.js +152 -0
- package/dist/bundle/export.js.map +1 -0
- package/dist/bundle/external.d.ts +66 -0
- package/dist/bundle/external.d.ts.map +1 -0
- package/dist/bundle/external.js +238 -0
- package/dist/bundle/external.js.map +1 -0
- package/dist/bundle/format.d.ts +94 -0
- package/dist/bundle/format.d.ts.map +1 -0
- package/dist/bundle/format.js +42 -0
- package/dist/bundle/format.js.map +1 -0
- package/dist/bundle/import.d.ts +49 -0
- package/dist/bundle/import.d.ts.map +1 -0
- package/dist/bundle/import.js +116 -0
- package/dist/bundle/import.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +1402 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +48 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +284 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/db/schema.d.ts +3 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +616 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/store.d.ts +1011 -0
- package/dist/db/store.d.ts.map +1 -0
- package/dist/db/store.js +3888 -0
- package/dist/db/store.js.map +1 -0
- package/dist/graph/pagerank.d.ts +9 -0
- package/dist/graph/pagerank.d.ts.map +1 -0
- package/dist/graph/pagerank.js +47 -0
- package/dist/graph/pagerank.js.map +1 -0
- package/dist/indexer/architecture.d.ts +72 -0
- package/dist/indexer/architecture.d.ts.map +1 -0
- package/dist/indexer/architecture.js +112 -0
- package/dist/indexer/architecture.js.map +1 -0
- package/dist/indexer/behavior.d.ts +75 -0
- package/dist/indexer/behavior.d.ts.map +1 -0
- package/dist/indexer/behavior.js +395 -0
- package/dist/indexer/behavior.js.map +1 -0
- package/dist/indexer/boundaries.d.ts +60 -0
- package/dist/indexer/boundaries.d.ts.map +1 -0
- package/dist/indexer/boundaries.js +366 -0
- package/dist/indexer/boundaries.js.map +1 -0
- package/dist/indexer/churn.d.ts +15 -0
- package/dist/indexer/churn.d.ts.map +1 -0
- package/dist/indexer/churn.js +49 -0
- package/dist/indexer/churn.js.map +1 -0
- package/dist/indexer/classify.d.ts +9 -0
- package/dist/indexer/classify.d.ts.map +1 -0
- package/dist/indexer/classify.js +90 -0
- package/dist/indexer/classify.js.map +1 -0
- package/dist/indexer/context.d.ts +176 -0
- package/dist/indexer/context.d.ts.map +1 -0
- package/dist/indexer/context.js +193 -0
- package/dist/indexer/context.js.map +1 -0
- package/dist/indexer/continuity.d.ts +67 -0
- package/dist/indexer/continuity.d.ts.map +1 -0
- package/dist/indexer/continuity.js +288 -0
- package/dist/indexer/continuity.js.map +1 -0
- package/dist/indexer/detectchanges.d.ts +32 -0
- package/dist/indexer/detectchanges.d.ts.map +1 -0
- package/dist/indexer/detectchanges.js +74 -0
- package/dist/indexer/detectchanges.js.map +1 -0
- package/dist/indexer/discovery.d.ts +37 -0
- package/dist/indexer/discovery.d.ts.map +1 -0
- package/dist/indexer/discovery.js +136 -0
- package/dist/indexer/discovery.js.map +1 -0
- package/dist/indexer/externaldeps.d.ts +18 -0
- package/dist/indexer/externaldeps.d.ts.map +1 -0
- package/dist/indexer/externaldeps.js +288 -0
- package/dist/indexer/externaldeps.js.map +1 -0
- package/dist/indexer/freshness.d.ts +48 -0
- package/dist/indexer/freshness.d.ts.map +1 -0
- package/dist/indexer/freshness.js +128 -0
- package/dist/indexer/freshness.js.map +1 -0
- package/dist/indexer/git.d.ts +144 -0
- package/dist/indexer/git.d.ts.map +1 -0
- package/dist/indexer/git.js +444 -0
- package/dist/indexer/git.js.map +1 -0
- package/dist/indexer/index.d.ts +145 -0
- package/dist/indexer/index.d.ts.map +1 -0
- package/dist/indexer/index.js +930 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/indexer/modules.d.ts +62 -0
- package/dist/indexer/modules.d.ts.map +1 -0
- package/dist/indexer/modules.js +293 -0
- package/dist/indexer/modules.js.map +1 -0
- package/dist/indexer/preflight.d.ts +154 -0
- package/dist/indexer/preflight.d.ts.map +1 -0
- package/dist/indexer/preflight.js +399 -0
- package/dist/indexer/preflight.js.map +1 -0
- package/dist/indexer/protoScanner.d.ts +34 -0
- package/dist/indexer/protoScanner.d.ts.map +1 -0
- package/dist/indexer/protoScanner.js +133 -0
- package/dist/indexer/protoScanner.js.map +1 -0
- package/dist/indexer/risk.d.ts +115 -0
- package/dist/indexer/risk.d.ts.map +1 -0
- package/dist/indexer/risk.js +194 -0
- package/dist/indexer/risk.js.map +1 -0
- package/dist/indexer/serviceHostScanner.d.ts +25 -0
- package/dist/indexer/serviceHostScanner.d.ts.map +1 -0
- package/dist/indexer/serviceHostScanner.js +95 -0
- package/dist/indexer/serviceHostScanner.js.map +1 -0
- package/dist/indexer/serviceLinks.d.ts +105 -0
- package/dist/indexer/serviceLinks.d.ts.map +1 -0
- package/dist/indexer/serviceLinks.js +509 -0
- package/dist/indexer/serviceLinks.js.map +1 -0
- package/dist/indexer/shapehash.d.ts +98 -0
- package/dist/indexer/shapehash.d.ts.map +1 -0
- package/dist/indexer/shapehash.js +354 -0
- package/dist/indexer/shapehash.js.map +1 -0
- package/dist/indexer/skeleton.d.ts +15 -0
- package/dist/indexer/skeleton.d.ts.map +1 -0
- package/dist/indexer/skeleton.js +136 -0
- package/dist/indexer/skeleton.js.map +1 -0
- package/dist/indexer/symbolhistory.d.ts +41 -0
- package/dist/indexer/symbolhistory.d.ts.map +1 -0
- package/dist/indexer/symbolhistory.js +124 -0
- package/dist/indexer/symbolhistory.js.map +1 -0
- package/dist/indexer/watcher.d.ts +68 -0
- package/dist/indexer/watcher.d.ts.map +1 -0
- package/dist/indexer/watcher.js +179 -0
- package/dist/indexer/watcher.js.map +1 -0
- package/dist/mcp/server.d.ts +80 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +1610 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/parser/index.d.ts +8 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +33 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/languages/cpp.d.ts +3 -0
- package/dist/parser/languages/cpp.d.ts.map +1 -0
- package/dist/parser/languages/cpp.js +350 -0
- package/dist/parser/languages/cpp.js.map +1 -0
- package/dist/parser/languages/csharp.d.ts +3 -0
- package/dist/parser/languages/csharp.d.ts.map +1 -0
- package/dist/parser/languages/csharp.js +239 -0
- package/dist/parser/languages/csharp.js.map +1 -0
- package/dist/parser/languages/go.d.ts +3 -0
- package/dist/parser/languages/go.d.ts.map +1 -0
- package/dist/parser/languages/go.js +259 -0
- package/dist/parser/languages/go.js.map +1 -0
- package/dist/parser/languages/java.d.ts +3 -0
- package/dist/parser/languages/java.d.ts.map +1 -0
- package/dist/parser/languages/java.js +391 -0
- package/dist/parser/languages/java.js.map +1 -0
- package/dist/parser/languages/python.d.ts +3 -0
- package/dist/parser/languages/python.d.ts.map +1 -0
- package/dist/parser/languages/python.js +396 -0
- package/dist/parser/languages/python.js.map +1 -0
- package/dist/parser/languages/rust.d.ts +3 -0
- package/dist/parser/languages/rust.d.ts.map +1 -0
- package/dist/parser/languages/rust.js +159 -0
- package/dist/parser/languages/rust.js.map +1 -0
- package/dist/parser/languages/typescript.d.ts +3 -0
- package/dist/parser/languages/typescript.d.ts.map +1 -0
- package/dist/parser/languages/typescript.js +1442 -0
- package/dist/parser/languages/typescript.js.map +1 -0
- package/dist/parser/parserContext.d.ts +77 -0
- package/dist/parser/parserContext.d.ts.map +1 -0
- package/dist/parser/parserContext.js +354 -0
- package/dist/parser/parserContext.js.map +1 -0
- package/dist/parser/walker.d.ts +81 -0
- package/dist/parser/walker.d.ts.map +1 -0
- package/dist/parser/walker.js +217 -0
- package/dist/parser/walker.js.map +1 -0
- package/dist/parser/worker.d.ts +66 -0
- package/dist/parser/worker.d.ts.map +1 -0
- package/dist/parser/worker.js +129 -0
- package/dist/parser/worker.js.map +1 -0
- package/dist/parser/workerpool.d.ts +107 -0
- package/dist/parser/workerpool.d.ts.map +1 -0
- package/dist/parser/workerpool.js +383 -0
- package/dist/parser/workerpool.js.map +1 -0
- package/dist/scip/format.d.ts +87 -0
- package/dist/scip/format.d.ts.map +1 -0
- package/dist/scip/format.js +31 -0
- package/dist/scip/format.js.map +1 -0
- package/dist/scip/import.d.ts +37 -0
- package/dist/scip/import.d.ts.map +1 -0
- package/dist/scip/import.js +180 -0
- package/dist/scip/import.js.map +1 -0
- package/dist/types.d.ts +392 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/docs/architecture.md +105 -0
- package/docs/benchmarks/methodology.md +134 -0
- package/docs/benchmarks/raw-results.md +71 -0
- package/docs/benchmarks.md +74 -0
- package/docs/cli.md +148 -0
- package/docs/examples/behavior-tests.md +70 -0
- package/docs/examples/change-history.md +85 -0
- package/docs/examples/pre-edit-context.md +81 -0
- package/docs/examples/service-links.md +88 -0
- package/docs/examples.md +80 -0
- package/docs/faq.md +70 -0
- package/docs/internals.md +104 -0
- package/docs/languages.md +70 -0
- package/docs/limits.md +52 -0
- package/docs/mcp.md +199 -0
- package/docs/quickstart.md +119 -0
- package/docs/testing.md +123 -0
- package/docs/tools.md +115 -0
- package/package.json +52 -0
- package/research-codebase.md +578 -0
- package/seer-cli-docs.md +326 -0
- package/seer-master-guide.md +246 -0
- package/src/bundle/ci.ts +141 -0
- package/src/bundle/contract.ts +387 -0
- package/src/bundle/export.ts +175 -0
- package/src/bundle/external.ts +285 -0
- package/src/bundle/format.ts +92 -0
- package/src/bundle/import.ts +157 -0
- package/src/cli/index.ts +1249 -0
- package/src/cli/init.ts +389 -0
- package/src/db/schema.ts +614 -0
- package/src/db/store.ts +4306 -0
- package/src/graph/pagerank.ts +53 -0
- package/src/indexer/architecture.ts +148 -0
- package/src/indexer/behavior.ts +466 -0
- package/src/indexer/boundaries.ts +374 -0
- package/src/indexer/churn.ts +58 -0
- package/src/indexer/classify.ts +96 -0
- package/src/indexer/context.ts +340 -0
- package/src/indexer/continuity.ts +322 -0
- package/src/indexer/detectchanges.ts +94 -0
- package/src/indexer/discovery.ts +176 -0
- package/src/indexer/externaldeps.ts +243 -0
- package/src/indexer/freshness.ts +166 -0
- package/src/indexer/git.ts +453 -0
- package/src/indexer/index.ts +1092 -0
- package/src/indexer/modules.ts +358 -0
- package/src/indexer/preflight.ts +548 -0
- package/src/indexer/protoScanner.ts +147 -0
- package/src/indexer/risk.ts +304 -0
- package/src/indexer/serviceHostScanner.ts +92 -0
- package/src/indexer/serviceLinks.ts +543 -0
- package/src/indexer/shapehash.ts +370 -0
- package/src/indexer/skeleton.ts +169 -0
- package/src/indexer/symbolhistory.ts +172 -0
- package/src/indexer/watcher.ts +206 -0
- package/src/mcp/server.ts +1659 -0
- package/src/parser/index.ts +37 -0
- package/src/parser/languages/cpp.ts +361 -0
- package/src/parser/languages/csharp.ts +235 -0
- package/src/parser/languages/go.ts +259 -0
- package/src/parser/languages/java.ts +382 -0
- package/src/parser/languages/python.ts +370 -0
- package/src/parser/languages/rust.ts +164 -0
- package/src/parser/languages/typescript.ts +1435 -0
- package/src/parser/parserContext.ts +392 -0
- package/src/parser/walker.ts +306 -0
- package/src/parser/worker.ts +181 -0
- package/src/parser/workerpool.ts +448 -0
- package/src/scip/format.ts +83 -0
- package/src/scip/import.ts +216 -0
- package/src/types.ts +457 -0
- package/tests/benchmark-service-links.ts +244 -0
- package/tests/bug-regressions.ts +626 -0
- package/tests/filters.ts +264 -0
- package/tests/fixtures/Counter.tsx +38 -0
- package/tests/fixtures/caller.ts +7 -0
- package/tests/fixtures/collisions.ts +23 -0
- package/tests/fixtures/local_helper.ts +5 -0
- package/tests/fixtures/overloads.java +17 -0
- package/tests/fixtures/remote_helper.ts +4 -0
- package/tests/fixtures/sample.c +15 -0
- package/tests/fixtures/sample.cpp +47 -0
- package/tests/fixtures/sample.cs +62 -0
- package/tests/fixtures/sample.go +68 -0
- package/tests/fixtures/sample.h +30 -0
- package/tests/fixtures/sample.java +85 -0
- package/tests/fixtures/sample.py +46 -0
- package/tests/fixtures/sample.rs +78 -0
- package/tests/fixtures/sample.ts +76 -0
- package/tests/fixtures-service/HttpClients.cs +30 -0
- package/tests/fixtures-service/HttpClients.java +24 -0
- package/tests/fixtures-service/billing.ts +15 -0
- package/tests/fixtures-service/docker-compose.yml +15 -0
- package/tests/fixtures-service/gateway.ts +10 -0
- package/tests/fixtures-service/get_user.ts +11 -0
- package/tests/fixtures-service/graphql_client.ts +63 -0
- package/tests/fixtures-service/graphql_server.ts +30 -0
- package/tests/fixtures-service/grpc_client.go +30 -0
- package/tests/fixtures-service/http_clients.go +23 -0
- package/tests/fixtures-service/http_clients.py +38 -0
- package/tests/fixtures-service/http_clients.ts +49 -0
- package/tests/fixtures-service/k8s/payment-service.yaml +22 -0
- package/tests/fixtures-service/k8s_calls.ts +20 -0
- package/tests/fixtures-service/messaging.ts +87 -0
- package/tests/fixtures-service/trpc_client.ts +39 -0
- package/tests/fixtures-service/trpc_server.ts +39 -0
- package/tests/fixtures-service/user_service.proto +33 -0
- package/tests/fixtures-trackcd/Cargo.toml +11 -0
- package/tests/fixtures-trackcd/SpringController.java +36 -0
- package/tests/fixtures-trackcd/auth_service.ts +19 -0
- package/tests/fixtures-trackcd/complex_module.py +50 -0
- package/tests/fixtures-trackcd/express_app.js +30 -0
- package/tests/fixtures-trackcd/fastapi_app.py +49 -0
- package/tests/fixtures-trackcd/fastify_object_routes.js +32 -0
- package/tests/fixtures-trackcd/go.mod +8 -0
- package/tests/fixtures-trackcd/package.json +15 -0
- package/tests/fixtures-trackcd/requirements.txt +4 -0
- package/tests/fixtures-trackcd/tests/auth_service.test.ts +13 -0
- package/tests/fixtures-tracke/auth/AuthService.ts +23 -0
- package/tests/fixtures-tracke/auth/crypto.ts +7 -0
- package/tests/fixtures-tracke/billing/Billing.ts +20 -0
- package/tests/fixtures-tracke/billing/Invoice.ts +10 -0
- package/tests/fixtures-tracke/billing/server.ts +17 -0
- package/tests/fixtures-tracke/package.json +7 -0
- package/tests/fixtures-tracke/tests/auth.test.ts +23 -0
- package/tests/fixtures-tracke/tests/billing.test.ts +14 -0
- package/tests/fixtures-trackf/package.json +5 -0
- package/tests/fixtures-trackf/src/auth.ts +26 -0
- package/tests/fixtures-trackf/src/handlers.ts +35 -0
- package/tests/fixtures-tracki/billing/routes.ts +12 -0
- package/tests/fixtures-tracki/gateway/client.ts +13 -0
- package/tests/git-features.ts +267 -0
- package/tests/init.ts +141 -0
- package/tests/mcp-jit.ts +130 -0
- package/tests/mcp-smoke.ts +191 -0
- package/tests/mcp-trackcd.ts +169 -0
- package/tests/mcp-tracke.ts +229 -0
- package/tests/mcp-trackf.ts +330 -0
- package/tests/mcp-trackg.ts +219 -0
- package/tests/mcp-tracki.ts +174 -0
- package/tests/mcp-watcher.ts +126 -0
- package/tests/optspec.ts +194 -0
- package/tests/parallel-index.ts +333 -0
- package/tests/parallel-read.ts +125 -0
- package/tests/parallel-recovery.ts +241 -0
- package/tests/perf-callers.ts +145 -0
- package/tests/query-parity.ts +184 -0
- package/tests/query-perf.ts +55 -0
- package/tests/scale-parallel-parity.ts +225 -0
- package/tests/scale-test.ts +523 -0
- package/tests/smoke.ts +396 -0
- package/tests/trackcd.ts +325 -0
- package/tests/tracke-collisions.ts +255 -0
- package/tests/tracke.ts +314 -0
- package/tests/trackf-bugs.ts +406 -0
- package/tests/trackf.ts +390 -0
- package/tests/trackg.ts +1372 -0
- package/tests/tracki-boundaries.ts +202 -0
- package/tests/tracki-continuity.ts +253 -0
- package/tests/tracki-contract-diff.ts +249 -0
- package/tests/tracki-external-bundles.ts +341 -0
- package/tests/tracki-preflight.ts +251 -0
- package/tests/verify-roles.ts +51 -0
- package/tests/worker-parity.ts +286 -0
- package/tests/worker-pool.ts +262 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,1011 @@
|
|
|
1
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { SymbolDef, SymbolRow, CallerRow, CalleeRow, StatsRow, RouteRow, ExternalDepRow, ConfigKeyRow, FileChurnRow, SymbolHistoryRow } from '../types.js';
|
|
3
|
+
export declare function isRankableKind(kind: string): boolean;
|
|
4
|
+
export interface EdgeResolutionStats {
|
|
5
|
+
sameFile: number;
|
|
6
|
+
imported: number;
|
|
7
|
+
global: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What kind of code a file is. Used to keep project-owned code from being
|
|
12
|
+
* drowned out by vendored or generated boilerplate in ranking and search.
|
|
13
|
+
*/
|
|
14
|
+
export type FileRole = 'project' | 'vendor' | 'generated' | 'test';
|
|
15
|
+
export interface FileClassification {
|
|
16
|
+
role: FileRole;
|
|
17
|
+
isVendor: 0 | 1;
|
|
18
|
+
isGenerated: 0 | 1;
|
|
19
|
+
}
|
|
20
|
+
export interface SymbolSearchOptions {
|
|
21
|
+
limit?: number;
|
|
22
|
+
includeVendor?: boolean;
|
|
23
|
+
includeGenerated?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* When false (default for agent-facing search/ranking), file-role=test
|
|
26
|
+
* symbols are filtered out. seer_behavior bypasses this because the test
|
|
27
|
+
* relationship IS its content; everything else (top symbols, search, deps,
|
|
28
|
+
* complexity) should default to non-test code so agents don't get drowned
|
|
29
|
+
* in test names. Indexer-wide test indexing stays on so seer_behavior keeps
|
|
30
|
+
* working — this filter is purely query-side.
|
|
31
|
+
*/
|
|
32
|
+
includeTests?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* When false (default), rows where symbol_role='declaration' (forward
|
|
35
|
+
* declarations, C++ class-body method declarations whose bodies live
|
|
36
|
+
* out-of-line) are hidden. Pass true to include them — useful for
|
|
37
|
+
* "show me every place this method is announced" workflows.
|
|
38
|
+
*/
|
|
39
|
+
includeDeclarations?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When false (default), symbol_role='type_ref' rows stay hidden. Currently
|
|
42
|
+
* Seer's extractors never emit type-ref rows, so the flag is a forward-
|
|
43
|
+
* looking opt-in for future indexing modes that materialize them.
|
|
44
|
+
*/
|
|
45
|
+
includeTypeRefs?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface StoreOptions {
|
|
48
|
+
readonly?: boolean;
|
|
49
|
+
busyTimeoutMs?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface SchemaInfo {
|
|
52
|
+
dbVersion: number;
|
|
53
|
+
buildVersion: number;
|
|
54
|
+
current: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Split an identifier into searchable tokens. Used at FTS-insert time so a
|
|
58
|
+
* query for "auth" finds `AuthService`, `auth_service`, `authService`, and
|
|
59
|
+
* `AuthServiceImpl` alike.
|
|
60
|
+
*
|
|
61
|
+
* - splits on _ and -
|
|
62
|
+
* - splits camelCase boundaries (`AuthService` → "Auth Service Auth_Service")
|
|
63
|
+
* - splits consecutive caps like XMLParser → "XML Parser"
|
|
64
|
+
* - always includes the original token so prefix matches still work
|
|
65
|
+
*/
|
|
66
|
+
export declare function splitIdentifierTokens(s: string): string;
|
|
67
|
+
export declare class Store {
|
|
68
|
+
private db;
|
|
69
|
+
private readonly readonly;
|
|
70
|
+
private cachedSchemaInfo;
|
|
71
|
+
private hasRoleColumns;
|
|
72
|
+
private hasComplexityColumns;
|
|
73
|
+
private hasV4Tables;
|
|
74
|
+
/**
|
|
75
|
+
* True when the v5 `symbols.symbol_role` column exists. Read-only opens
|
|
76
|
+
* against a pre-v5 DB transparently skip declaration/type_ref filtering;
|
|
77
|
+
* writer opens always have it since runMigrations() adds the column.
|
|
78
|
+
*/
|
|
79
|
+
private hasSymbolRoleColumn;
|
|
80
|
+
/**
|
|
81
|
+
* True when the v6 module tables (modules / module_members / module_edges)
|
|
82
|
+
* exist. Read-only opens against a pre-v6 DB skip module queries gracefully
|
|
83
|
+
* (they return empty arrays); writer opens always have it.
|
|
84
|
+
*/
|
|
85
|
+
private hasModuleTables;
|
|
86
|
+
/**
|
|
87
|
+
* True when the v7 provenance/shape_hash columns + scip_imports table exist.
|
|
88
|
+
* Read-only opens against a pre-v7 DB return empty arrays for SCIP / dup
|
|
89
|
+
* queries and skip the provenance column on selects.
|
|
90
|
+
*/
|
|
91
|
+
private hasV7Columns;
|
|
92
|
+
/**
|
|
93
|
+
* True when v10 external_bundles / boundaries / symbol_history_continuity
|
|
94
|
+
* tables exist. Read-only opens against a pre-v10 DB return empty arrays.
|
|
95
|
+
*/
|
|
96
|
+
private hasV10Tables;
|
|
97
|
+
private stmtUpsertFile;
|
|
98
|
+
private stmtInsertSymbol;
|
|
99
|
+
private stmtInsertEdge;
|
|
100
|
+
private stmtInsertFileImport;
|
|
101
|
+
private stmtInsertRoute;
|
|
102
|
+
private stmtInsertConfigKey;
|
|
103
|
+
private stmtInsertExternalDep;
|
|
104
|
+
private stmtInsertServiceCall;
|
|
105
|
+
private stmtInsertServiceLink;
|
|
106
|
+
private stmtInsertSymbolsFts;
|
|
107
|
+
private stmtInsertFilesFts;
|
|
108
|
+
private stmtDeleteSymbolsFtsForFile;
|
|
109
|
+
private stmtDeleteFilesFtsForFile;
|
|
110
|
+
constructor(dbPath: string, options?: StoreOptions);
|
|
111
|
+
private checkHasV10Tables;
|
|
112
|
+
private checkHasModuleTables;
|
|
113
|
+
private checkHasRoleColumns;
|
|
114
|
+
private checkHasV4Tables;
|
|
115
|
+
static openReadOnly(dbPath: string, busyTimeoutMs?: number): Store;
|
|
116
|
+
isReadOnly(): boolean;
|
|
117
|
+
private assertWritable;
|
|
118
|
+
schemaInfo(): SchemaInfo;
|
|
119
|
+
/**
|
|
120
|
+
* v8 Track-G migration guard. When an existing v7 DB is opened by v8 code,
|
|
121
|
+
* service_calls/service_links tables are created empty. A normal cached
|
|
122
|
+
* re-index would skip every unchanged file, so service_calls would remain
|
|
123
|
+
* empty forever. Until an index run marks this backfill version complete,
|
|
124
|
+
* the indexer must force one full parse pass.
|
|
125
|
+
*/
|
|
126
|
+
needsServiceCallBackfill(): boolean;
|
|
127
|
+
markServiceCallsBackfilled(): void;
|
|
128
|
+
private readSchemaInfo;
|
|
129
|
+
private runMigrations;
|
|
130
|
+
/**
|
|
131
|
+
* Populate symbols.symbol_key for every existing row. Mirrors
|
|
132
|
+
* makeSymbolKey() — `kind:qualified_name` (or `kind:name` if qualified is
|
|
133
|
+
* NULL). symbol_history is keyed on these so without the backfill,
|
|
134
|
+
* listSymbolsForHistoryIndex() returns zero candidates after a v3→v4
|
|
135
|
+
* upgrade.
|
|
136
|
+
*/
|
|
137
|
+
private backfillSymbolKeysFromExistingRows;
|
|
138
|
+
/**
|
|
139
|
+
* Rebuild symbols_fts / files_fts from the current symbols / files rows if
|
|
140
|
+
* either FTS table is empty while its source table has rows. This is the
|
|
141
|
+
* only safe trigger condition — Seer never deliberately leaves FTS empty
|
|
142
|
+
* while symbols are populated, so emptiness is a reliable "stale FTS"
|
|
143
|
+
* signal (post-migration or post-manual-patch).
|
|
144
|
+
*/
|
|
145
|
+
private rebuildFtsIfStale;
|
|
146
|
+
private hasColumn;
|
|
147
|
+
private addColumnIfMissing;
|
|
148
|
+
private prepare;
|
|
149
|
+
pruneFilesNotIn(keepIds: Set<number>): number;
|
|
150
|
+
upsertFile(path: string, relPath: string, language: string, hash: string, lines: number, classification?: FileClassification): number;
|
|
151
|
+
upsertFileWithCache(path: string, relPath: string, language: string, hash: string, lines: number, classification?: FileClassification): {
|
|
152
|
+
fileId: number;
|
|
153
|
+
unchanged: boolean;
|
|
154
|
+
};
|
|
155
|
+
insertSymbol(fileId: number, def: SymbolDef): number;
|
|
156
|
+
insertEdge(fromSymbolId: number, toName: string, kind: string, line: number): void;
|
|
157
|
+
insertFileImport(fromFileId: number, importName: string): void;
|
|
158
|
+
insertRoute(fileId: number, method: string, routePath: string, framework: string, handlerName: string | null, line: number, options?: {
|
|
159
|
+
protocol?: string;
|
|
160
|
+
operation?: string | null;
|
|
161
|
+
topic?: string | null;
|
|
162
|
+
queue?: string | null;
|
|
163
|
+
exchange?: string | null;
|
|
164
|
+
service?: string | null;
|
|
165
|
+
broker?: string | null;
|
|
166
|
+
metadataJson?: string | null;
|
|
167
|
+
}): void;
|
|
168
|
+
insertConfigKey(key: string, source: string, fileId: number, symbolId: number | null, line: number): void;
|
|
169
|
+
/**
|
|
170
|
+
* v8 Track G — return a closure that inserts service_link rows. Used by
|
|
171
|
+
* the resolver in `resolveServiceLinks(store)` so it can stream inserts
|
|
172
|
+
* inside one prepared statement rather than re-resolving the statement
|
|
173
|
+
* per row.
|
|
174
|
+
*/
|
|
175
|
+
makeServiceLinkInserter(): (args: {
|
|
176
|
+
callId: number;
|
|
177
|
+
routeId: number | null;
|
|
178
|
+
callerSymbolId: number | null;
|
|
179
|
+
handlerSymbolId: number | null;
|
|
180
|
+
protocol: string;
|
|
181
|
+
matchKind: string;
|
|
182
|
+
confidence: number;
|
|
183
|
+
evidenceJson: string;
|
|
184
|
+
}) => void;
|
|
185
|
+
/**
|
|
186
|
+
* v8 Track G — insert a service-call row (outbound HTTP/etc. client call).
|
|
187
|
+
* The post-index resolver derives service_links from these and from routes.
|
|
188
|
+
* Returns the new row id so callers can attach evidence in the same batch.
|
|
189
|
+
*/
|
|
190
|
+
insertServiceCall(args: {
|
|
191
|
+
fileId: number;
|
|
192
|
+
symbolId: number | null;
|
|
193
|
+
protocol: string;
|
|
194
|
+
method: string | null;
|
|
195
|
+
rawTarget: string;
|
|
196
|
+
normalizedPath: string | null;
|
|
197
|
+
hostHint: string | null;
|
|
198
|
+
envKey: string | null;
|
|
199
|
+
framework: string;
|
|
200
|
+
line: number;
|
|
201
|
+
confidence: number;
|
|
202
|
+
operation?: string | null;
|
|
203
|
+
topic?: string | null;
|
|
204
|
+
queue?: string | null;
|
|
205
|
+
exchange?: string | null;
|
|
206
|
+
service?: string | null;
|
|
207
|
+
broker?: string | null;
|
|
208
|
+
metadataJson?: string | null;
|
|
209
|
+
}): number;
|
|
210
|
+
insertExternalDep(ecosystem: string, name: string, versionRange: string | null, manifestPath: string, isDev: 0 | 1): void;
|
|
211
|
+
clearExternalDeps(): void;
|
|
212
|
+
resolveImports(): number;
|
|
213
|
+
resolveEdges(): EdgeResolutionStats;
|
|
214
|
+
/**
|
|
215
|
+
* After symbol IDs are known, link routes.handler_id by name. Routes that
|
|
216
|
+
* named a handler not defined in the same file stay with handler_id NULL.
|
|
217
|
+
* Matching is by `handler_name = symbols.name` AND `file_id = routes.file_id`
|
|
218
|
+
* — handlers nearly always live in the same file as the route registration.
|
|
219
|
+
*/
|
|
220
|
+
resolveRouteHandlers(): number;
|
|
221
|
+
/**
|
|
222
|
+
* Backfill config_keys.symbol_id by line span. The extractor doesn't always
|
|
223
|
+
* know the enclosing symbol id (extraction precedes symbol insertion), so we
|
|
224
|
+
* resolve it via "the smallest function/method containing this line."
|
|
225
|
+
*/
|
|
226
|
+
resolveConfigKeySymbols(): number;
|
|
227
|
+
/**
|
|
228
|
+
* Promote calls from a test-file symbol to a non-test target into 'tests'
|
|
229
|
+
* edges (in addition to keeping the original 'call' edge). The original
|
|
230
|
+
* call edge is left in place so caller/callee queries don't double-count;
|
|
231
|
+
* test edges live in their own kind so `seer_behavior` can pull them
|
|
232
|
+
* directly without scanning the full edge table.
|
|
233
|
+
*
|
|
234
|
+
* The synthesized edge copies the SOURCE 'call' edge's `to_id` verbatim —
|
|
235
|
+
* the call-edge resolution pass already did the same-file / imported /
|
|
236
|
+
* global fallback work to pick the correct target. Re-resolving by name
|
|
237
|
+
* via `WHERE name = edges.to_name LIMIT 1` (the old behavior) was buggy
|
|
238
|
+
* when two symbols shared the same short name (`Alpha.run` / `Beta.run`):
|
|
239
|
+
* `LIMIT 1` would attribute every test edge to whichever id sorted first,
|
|
240
|
+
* so `seer_behavior(Beta.run)` returned tests that actually exercised
|
|
241
|
+
* `Alpha.run`. Preserving the source `to_id` matches what the original
|
|
242
|
+
* resolver already chose.
|
|
243
|
+
*
|
|
244
|
+
* Returns the number of new test edges inserted.
|
|
245
|
+
*/
|
|
246
|
+
synthesizeTestEdges(): number;
|
|
247
|
+
findCallers(symbolName: string, limit?: number): CallerRow[];
|
|
248
|
+
countCallers(symbolName: string): number;
|
|
249
|
+
/**
|
|
250
|
+
* Callers of a specific symbol id — never collapses short-name siblings.
|
|
251
|
+
* Track E + any tool that already has a resolved symbol id should use
|
|
252
|
+
* this instead of `findCallers(name)`. Edges whose `to_id` is NULL
|
|
253
|
+
* (unresolved) are intentionally skipped: with no resolved id we can't
|
|
254
|
+
* tell whether they target THIS specific symbol vs. a same-short-name
|
|
255
|
+
* sibling, and Track E callers want id-specificity.
|
|
256
|
+
*/
|
|
257
|
+
findCallersById(symbolId: number, limit?: number): CallerRow[];
|
|
258
|
+
/** Count of callers for a specific symbol id (id-scoped). */
|
|
259
|
+
countCallersById(symbolId: number): number;
|
|
260
|
+
/**
|
|
261
|
+
* Callees emitted by a specific caller symbol id — never collapses
|
|
262
|
+
* short-name siblings the way `findCallees(name)` does. Returns one row
|
|
263
|
+
* per call edge.
|
|
264
|
+
*/
|
|
265
|
+
findCalleesById(symbolId: number): CalleeRow[];
|
|
266
|
+
findCallees(symbolName: string): CalleeRow[];
|
|
267
|
+
/**
|
|
268
|
+
* Build the predicate suffix shared by findSymbols / getDefinition /
|
|
269
|
+
* getTopSymbols / countSymbols. Returns the `AND …` string that augments a
|
|
270
|
+
* WHERE clause; never starts the WHERE itself so callers control the rest.
|
|
271
|
+
*/
|
|
272
|
+
private filterClauseFromOptions;
|
|
273
|
+
findSymbols(name: string, options?: SymbolSearchOptions): SymbolRow[];
|
|
274
|
+
/**
|
|
275
|
+
* FTS5 search across symbol name / qualified_name / signature / split form.
|
|
276
|
+
* Falls back to `findSymbols` (LIKE) when FTS5 isn't available or returns
|
|
277
|
+
* nothing. Returns BM25-ranked results.
|
|
278
|
+
*/
|
|
279
|
+
searchSymbolsFts(query: string, options?: SymbolSearchOptions): SymbolRow[];
|
|
280
|
+
/**
|
|
281
|
+
* FTS5 search over file paths. Returns matching files ranked by BM25.
|
|
282
|
+
*/
|
|
283
|
+
searchFilesFts(query: string, limit?: number, options?: {
|
|
284
|
+
includeTests?: boolean;
|
|
285
|
+
includeVendor?: boolean;
|
|
286
|
+
includeGenerated?: boolean;
|
|
287
|
+
}): Array<{
|
|
288
|
+
id: number;
|
|
289
|
+
path: string;
|
|
290
|
+
relPath: string;
|
|
291
|
+
language: string;
|
|
292
|
+
role: string;
|
|
293
|
+
}>;
|
|
294
|
+
listSymbolsInFile(filePath: string, limit?: number): SymbolRow[];
|
|
295
|
+
getTopSymbols(limit?: number, options?: SymbolSearchOptions): SymbolRow[];
|
|
296
|
+
getDefinition(name: string, options?: {
|
|
297
|
+
filePath?: string;
|
|
298
|
+
} & SymbolSearchOptions): SymbolRow[];
|
|
299
|
+
getSymbolById(id: number): SymbolRow | null;
|
|
300
|
+
countSymbols(name: string, options?: SymbolSearchOptions): number;
|
|
301
|
+
listFiles(): Array<{
|
|
302
|
+
id: number;
|
|
303
|
+
path: string;
|
|
304
|
+
relPath: string;
|
|
305
|
+
language: string;
|
|
306
|
+
hash: string;
|
|
307
|
+
indexedAt: number;
|
|
308
|
+
role: string;
|
|
309
|
+
isVendor: number;
|
|
310
|
+
isGenerated: number;
|
|
311
|
+
}>;
|
|
312
|
+
getRoleCounts(): {
|
|
313
|
+
project: number;
|
|
314
|
+
vendor: number;
|
|
315
|
+
generated: number;
|
|
316
|
+
test: number;
|
|
317
|
+
};
|
|
318
|
+
listRoutes(options?: {
|
|
319
|
+
method?: string;
|
|
320
|
+
pathSubstr?: string;
|
|
321
|
+
framework?: string;
|
|
322
|
+
/** v9 Track-H — filter by protocol ('http' / 'trpc' / 'graphql' / 'grpc' / 'kafka' / ...). */
|
|
323
|
+
protocol?: string;
|
|
324
|
+
operation?: string;
|
|
325
|
+
topic?: string;
|
|
326
|
+
queue?: string;
|
|
327
|
+
service?: string;
|
|
328
|
+
limit?: number;
|
|
329
|
+
}): RouteRow[];
|
|
330
|
+
countRoutes(): number;
|
|
331
|
+
/** Total count of service_calls rows. */
|
|
332
|
+
countServiceCalls(): number;
|
|
333
|
+
/** Total count of service_links rows. */
|
|
334
|
+
countServiceLinks(): number;
|
|
335
|
+
/** List service_calls with the AST-attributed caller joined in. */
|
|
336
|
+
listServiceCalls(options?: {
|
|
337
|
+
protocol?: string;
|
|
338
|
+
method?: string;
|
|
339
|
+
pathSubstr?: string;
|
|
340
|
+
framework?: string;
|
|
341
|
+
callerSymbolId?: number;
|
|
342
|
+
minConfidence?: number;
|
|
343
|
+
/** v9 Track-H — filter by tRPC procedure / GraphQL operation / gRPC method. */
|
|
344
|
+
operation?: string;
|
|
345
|
+
/** v9 Track-H — filter by Kafka / pubsub topic. */
|
|
346
|
+
topic?: string;
|
|
347
|
+
/** v9 Track-H — filter by SQS / RabbitMQ queue. */
|
|
348
|
+
queue?: string;
|
|
349
|
+
/** v9 Track-H — filter by gRPC service / k8s service host. */
|
|
350
|
+
service?: string;
|
|
351
|
+
limit?: number;
|
|
352
|
+
offset?: number;
|
|
353
|
+
}): import('../types.js').ServiceCallRow[];
|
|
354
|
+
/** List service_links with caller + handler + route joined in. */
|
|
355
|
+
listServiceLinks(options?: {
|
|
356
|
+
protocol?: string;
|
|
357
|
+
method?: string;
|
|
358
|
+
pathSubstr?: string;
|
|
359
|
+
callerSymbolId?: number;
|
|
360
|
+
handlerSymbolId?: number;
|
|
361
|
+
matchKind?: string;
|
|
362
|
+
minConfidence?: number;
|
|
363
|
+
limit?: number;
|
|
364
|
+
offset?: number;
|
|
365
|
+
}): import('../types.js').ServiceLinkRow[];
|
|
366
|
+
/** id-scoped helper: every service_link whose caller is symbolId. */
|
|
367
|
+
serviceLinksForCaller(symbolId: number, options?: {
|
|
368
|
+
limit?: number;
|
|
369
|
+
}): import('../types.js').ServiceLinkRow[];
|
|
370
|
+
/** id-scoped helper: every service_link whose handler is symbolId. */
|
|
371
|
+
serviceLinksForHandler(symbolId: number, options?: {
|
|
372
|
+
limit?: number;
|
|
373
|
+
}): import('../types.js').ServiceLinkRow[];
|
|
374
|
+
/**
|
|
375
|
+
* Bounded BFS over service_links from caller to handler. Treats each
|
|
376
|
+
* service_link as a directed edge `caller_symbol_id → handler_symbol_id`.
|
|
377
|
+
* Returns the shortest path as an array of symbol ids, or [] if unreachable
|
|
378
|
+
* within maxDepth. Combines with the normal call-graph trace done by
|
|
379
|
+
* `tracePath`; this one is service-link only.
|
|
380
|
+
*/
|
|
381
|
+
traceServicePath(fromSymbolId: number, toSymbolId: number, maxDepth?: number): number[];
|
|
382
|
+
/**
|
|
383
|
+
* v9 Track-H — bounded service-link traversal from a single symbol.
|
|
384
|
+
*
|
|
385
|
+
* Walks the directed service-link graph starting at `fromSymbolId`. Each
|
|
386
|
+
* step follows `caller_symbol_id → handler_symbol_id` edges, recording the
|
|
387
|
+
* protocol / matchKind / hop chain for every reachable handler.
|
|
388
|
+
*
|
|
389
|
+
* Bounds (all configurable; defaults are conservative):
|
|
390
|
+
* - maxDepth limit hops away from the source (default 4)
|
|
391
|
+
* - maxNodes stop after expanding this many handlers (default 200)
|
|
392
|
+
* - maxFanout stop expanding a node after this many outgoing service
|
|
393
|
+
* links (default 20)
|
|
394
|
+
*
|
|
395
|
+
* Returns one record per reached handler with the protocols and match-kinds
|
|
396
|
+
* encountered along the path; `cutoff` flags the limit that fired (if any).
|
|
397
|
+
*/
|
|
398
|
+
traceServiceDependencies(fromSymbolId: number, options?: {
|
|
399
|
+
maxDepth?: number;
|
|
400
|
+
maxNodes?: number;
|
|
401
|
+
maxFanout?: number;
|
|
402
|
+
}): {
|
|
403
|
+
reached: Array<{
|
|
404
|
+
symbolId: number;
|
|
405
|
+
depth: number;
|
|
406
|
+
protocols: string[];
|
|
407
|
+
matchKinds: string[];
|
|
408
|
+
hops: number[];
|
|
409
|
+
}>;
|
|
410
|
+
cutoff: 'maxNodes' | 'maxDepth' | 'maxFanout' | null;
|
|
411
|
+
fromExpanded: number;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* v9 Track-H — bounded service-link traversal at module granularity.
|
|
415
|
+
*
|
|
416
|
+
* Returns the set of modules reachable from `fromModuleId` by following
|
|
417
|
+
* cross-module service links (one or more service_link edges whose caller
|
|
418
|
+
* and handler live in different modules). For each reached module the
|
|
419
|
+
* result includes the minimum hop depth and which protocols carry traffic
|
|
420
|
+
* into it.
|
|
421
|
+
*
|
|
422
|
+
* Useful for "which modules depend on `billing` through HTTP/Kafka/etc?".
|
|
423
|
+
*/
|
|
424
|
+
traceModuleServiceDependencies(fromModuleId: number, options?: {
|
|
425
|
+
maxDepth?: number;
|
|
426
|
+
maxNodes?: number;
|
|
427
|
+
}): {
|
|
428
|
+
reached: Array<{
|
|
429
|
+
moduleId: number;
|
|
430
|
+
depth: number;
|
|
431
|
+
protocols: string[];
|
|
432
|
+
viaLinks: number;
|
|
433
|
+
}>;
|
|
434
|
+
cutoff: 'maxNodes' | 'maxDepth' | null;
|
|
435
|
+
};
|
|
436
|
+
/** True iff the v10 external/boundary/continuity tables exist on disk. */
|
|
437
|
+
hasV10(): boolean;
|
|
438
|
+
/** Replace the boundaries / boundary_members / boundary_edges tables.
|
|
439
|
+
* Atomic — wrapped in a single transaction. */
|
|
440
|
+
replaceBoundaries(boundaries: Array<{
|
|
441
|
+
label: string;
|
|
442
|
+
kind: string;
|
|
443
|
+
rootRelPath: string;
|
|
444
|
+
manifestPath: string | null;
|
|
445
|
+
ecosystem: string | null;
|
|
446
|
+
fileIds: number[];
|
|
447
|
+
}>, edges: Array<{
|
|
448
|
+
fromIndex: number;
|
|
449
|
+
toIndex: number;
|
|
450
|
+
kind: string;
|
|
451
|
+
weight: number;
|
|
452
|
+
}>): void;
|
|
453
|
+
/** True iff boundaries were populated this build. */
|
|
454
|
+
hasBoundariesData(): boolean;
|
|
455
|
+
countBoundaries(): number;
|
|
456
|
+
listBoundaries(limit?: number): Array<{
|
|
457
|
+
id: number;
|
|
458
|
+
label: string;
|
|
459
|
+
kind: string;
|
|
460
|
+
rootRelPath: string;
|
|
461
|
+
manifestPath: string | null;
|
|
462
|
+
ecosystem: string | null;
|
|
463
|
+
sizeFiles: number;
|
|
464
|
+
}>;
|
|
465
|
+
/** Boundary that owns a file id (or null). */
|
|
466
|
+
boundaryForFile(fileId: number): {
|
|
467
|
+
id: number;
|
|
468
|
+
label: string;
|
|
469
|
+
kind: string;
|
|
470
|
+
rootRelPath: string;
|
|
471
|
+
} | null;
|
|
472
|
+
/** Cross-boundary dependency edges from a boundary (outgoing by default). */
|
|
473
|
+
boundaryDependencies(boundaryId: number, options?: {
|
|
474
|
+
direction?: 'in' | 'out';
|
|
475
|
+
limit?: number;
|
|
476
|
+
}): Array<{
|
|
477
|
+
boundaryId: number;
|
|
478
|
+
label: string;
|
|
479
|
+
kind: string;
|
|
480
|
+
weight: number;
|
|
481
|
+
}>;
|
|
482
|
+
/** For a given symbol id, return the boundaries of each of its callees. */
|
|
483
|
+
calleeBoundariesOf(symbolId: number): Array<{
|
|
484
|
+
calleeId: number;
|
|
485
|
+
boundaryId: number;
|
|
486
|
+
}>;
|
|
487
|
+
/**
|
|
488
|
+
* Return every files.id that's actually a phantom file backing an external
|
|
489
|
+
* bundle layer. The indexer's prune pass preserves these so a local
|
|
490
|
+
* re-index never drops external-imported rows.
|
|
491
|
+
*/
|
|
492
|
+
listExternalPhantomFileIds(): number[];
|
|
493
|
+
/** Insert (or replace) an external_bundles row for a given bundle path. */
|
|
494
|
+
upsertExternalBundle(args: {
|
|
495
|
+
bundlePath: string;
|
|
496
|
+
externalProject: string | null;
|
|
497
|
+
externalVersion: string | null;
|
|
498
|
+
externalHash: string | null;
|
|
499
|
+
schemaVersion: number;
|
|
500
|
+
routesImported: number;
|
|
501
|
+
serviceCallsImported: number;
|
|
502
|
+
serviceLinksImported: number;
|
|
503
|
+
}): number;
|
|
504
|
+
/**
|
|
505
|
+
* Look up an existing external_bundles row by its bundle path. Returns the
|
|
506
|
+
* id and the imported_at/external_hash for the existing layer when present.
|
|
507
|
+
*/
|
|
508
|
+
findExternalBundleByPath(bundlePath: string): {
|
|
509
|
+
id: number;
|
|
510
|
+
bundlePath: string;
|
|
511
|
+
externalProject: string | null;
|
|
512
|
+
externalVersion: string | null;
|
|
513
|
+
externalHash: string | null;
|
|
514
|
+
} | null;
|
|
515
|
+
/** List every external_bundles row (newest first). */
|
|
516
|
+
listExternalBundles(): Array<{
|
|
517
|
+
id: number;
|
|
518
|
+
sourceKind: string;
|
|
519
|
+
bundlePath: string;
|
|
520
|
+
externalProject: string | null;
|
|
521
|
+
externalVersion: string | null;
|
|
522
|
+
externalHash: string | null;
|
|
523
|
+
schemaVersion: number;
|
|
524
|
+
importedAt: number;
|
|
525
|
+
routesImported: number;
|
|
526
|
+
serviceCallsImported: number;
|
|
527
|
+
serviceLinksImported: number;
|
|
528
|
+
}>;
|
|
529
|
+
/**
|
|
530
|
+
* Delete every row associated with a given external_bundles.id — its
|
|
531
|
+
* routes/service_calls/service_links rows and the bundle row itself. Used
|
|
532
|
+
* during re-import so a fresh import is fully replacing the previous
|
|
533
|
+
* snapshot of that bundle.
|
|
534
|
+
*/
|
|
535
|
+
clearExternalBundle(bundleId: number): {
|
|
536
|
+
routes: number;
|
|
537
|
+
serviceCalls: number;
|
|
538
|
+
serviceLinks: number;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Insert a route from an external bundle. file_id is intentionally NULL —
|
|
542
|
+
* external routes do not belong to any local file. The Store schema does
|
|
543
|
+
* not allow NULL on routes.file_id by default; v10 keeps file_id NOT NULL,
|
|
544
|
+
* so we have to ensure an external "phantom" file row exists per bundle to
|
|
545
|
+
* own the routes. The route stays linked to the external_bundle_id so we
|
|
546
|
+
* can wipe them as a layer.
|
|
547
|
+
*/
|
|
548
|
+
insertExternalRoute(args: {
|
|
549
|
+
bundleId: number;
|
|
550
|
+
externalFileId: number;
|
|
551
|
+
method: string;
|
|
552
|
+
path: string;
|
|
553
|
+
framework: string;
|
|
554
|
+
handlerName: string | null;
|
|
555
|
+
line: number;
|
|
556
|
+
protocol?: string;
|
|
557
|
+
operation?: string | null;
|
|
558
|
+
topic?: string | null;
|
|
559
|
+
queue?: string | null;
|
|
560
|
+
exchange?: string | null;
|
|
561
|
+
service?: string | null;
|
|
562
|
+
broker?: string | null;
|
|
563
|
+
metadataJson?: string | null;
|
|
564
|
+
}): number;
|
|
565
|
+
/**
|
|
566
|
+
* Create (or reuse) an "external" phantom file row that owns external
|
|
567
|
+
* bundle rows. Each external_bundles.id gets its own external-phantom file
|
|
568
|
+
* so deleting a layer doesn't disturb sibling layers. The phantom file
|
|
569
|
+
* carries role='vendor' so it stays out of project-first defaults.
|
|
570
|
+
*/
|
|
571
|
+
ensureExternalFile(bundleId: number, externalProject: string): number;
|
|
572
|
+
/** Count of routes that came from an external bundle. */
|
|
573
|
+
countExternalRoutes(): number;
|
|
574
|
+
/**
|
|
575
|
+
* List routes filtered to external bundles only. Useful for verifying that
|
|
576
|
+
* an external import landed and for the seer_external_bundles MCP tool.
|
|
577
|
+
*/
|
|
578
|
+
listExternalRoutes(options?: {
|
|
579
|
+
bundleId?: number;
|
|
580
|
+
method?: string;
|
|
581
|
+
pathSubstr?: string;
|
|
582
|
+
protocol?: string;
|
|
583
|
+
limit?: number;
|
|
584
|
+
}): Array<{
|
|
585
|
+
id: number;
|
|
586
|
+
method: string;
|
|
587
|
+
path: string;
|
|
588
|
+
framework: string;
|
|
589
|
+
handlerName: string | null;
|
|
590
|
+
line: number;
|
|
591
|
+
protocol: string | null;
|
|
592
|
+
operation: string | null;
|
|
593
|
+
topic: string | null;
|
|
594
|
+
queue: string | null;
|
|
595
|
+
service: string | null;
|
|
596
|
+
externalBundleId: number;
|
|
597
|
+
externalProject: string | null;
|
|
598
|
+
}>;
|
|
599
|
+
listExternalDeps(options?: {
|
|
600
|
+
ecosystem?: string;
|
|
601
|
+
nameSubstr?: string;
|
|
602
|
+
limit?: number;
|
|
603
|
+
}): ExternalDepRow[];
|
|
604
|
+
countExternalDeps(): number;
|
|
605
|
+
listConfigKeys(options?: {
|
|
606
|
+
key?: string;
|
|
607
|
+
source?: string;
|
|
608
|
+
limit?: number;
|
|
609
|
+
}): ConfigKeyRow[];
|
|
610
|
+
countConfigKeys(): number;
|
|
611
|
+
upsertFileChurn(fileId: number, commitCount: number, lastCommitSha: string | null, lastCommitAt: number | null, topAuthor: string | null, secondAuthor: string | null): void;
|
|
612
|
+
getFileChurn(filePath: string): FileChurnRow | null;
|
|
613
|
+
topChurnedFiles(limit?: number): FileChurnRow[];
|
|
614
|
+
insertSymbolHistory(symbolId: number, symbolKey: string, commitSha: string, authorName: string | null, authorEmail: string | null, committedAt: number, message: string | null, linesAdded: number, linesRemoved: number, prNumber: number | null, prUrl: string | null, matchStrategy: string, confidence: number): void;
|
|
615
|
+
getSymbolHistory(symbolId: number, options?: {
|
|
616
|
+
limit?: number;
|
|
617
|
+
since?: number;
|
|
618
|
+
}): SymbolHistoryRow[];
|
|
619
|
+
/** Total history count for a symbol — for "showing N of M commits" headers. */
|
|
620
|
+
countSymbolHistory(symbolId: number): number;
|
|
621
|
+
getGitIndexState(): {
|
|
622
|
+
repoRoot: string;
|
|
623
|
+
lastHeadSha: string | null;
|
|
624
|
+
lastProcessedAt: number;
|
|
625
|
+
remoteUrl: string | null;
|
|
626
|
+
algorithmVersion: number;
|
|
627
|
+
lastHistoryHeadSha: string | null;
|
|
628
|
+
lastHistoryAt: number | null;
|
|
629
|
+
} | null;
|
|
630
|
+
/**
|
|
631
|
+
* Generic "the indexer has seen this HEAD" stamp — used by churn and any
|
|
632
|
+
* other read-only git pass. Does NOT touch the history-specific marker.
|
|
633
|
+
* symbol-history has its own setHistoryHeadSha() so the two passes can't
|
|
634
|
+
* mask each other.
|
|
635
|
+
*/
|
|
636
|
+
setGitIndexState(repoRoot: string, lastHeadSha: string | null, remoteUrl: string | null, algorithmVersion?: number): void;
|
|
637
|
+
/**
|
|
638
|
+
* Stamp the HEAD that symbol-history was last built against. Independent of
|
|
639
|
+
* setGitIndexState() so running file-level churn never makes a subsequent
|
|
640
|
+
* buildSymbolHistory() skip.
|
|
641
|
+
*/
|
|
642
|
+
setHistoryHeadSha(repoRoot: string, lastHistoryHeadSha: string | null, remoteUrl: string | null): void;
|
|
643
|
+
/** All symbols matching a symbol_key — used by `seer_history` to find the
|
|
644
|
+
* current id for a key that came from the indexed graph. */
|
|
645
|
+
findSymbolsByKey(symbolKey: string): SymbolRow[];
|
|
646
|
+
/** Iterate over (id, file_id, line_start, line_end, symbol_key) — used by
|
|
647
|
+
* the symbol-history indexer to map historical line ranges to current ids. */
|
|
648
|
+
listSymbolsForHistoryIndex(): Array<{
|
|
649
|
+
id: number;
|
|
650
|
+
fileId: number;
|
|
651
|
+
filePath: string;
|
|
652
|
+
relPath: string;
|
|
653
|
+
lineStart: number;
|
|
654
|
+
lineEnd: number;
|
|
655
|
+
symbolKey: string;
|
|
656
|
+
}>;
|
|
657
|
+
getAllEdges(): Array<{
|
|
658
|
+
from: number;
|
|
659
|
+
to: number;
|
|
660
|
+
}>;
|
|
661
|
+
getAllSymbolIds(): number[];
|
|
662
|
+
updatePageRanks(ranks: Map<number, number>): void;
|
|
663
|
+
/**
|
|
664
|
+
* Bounded breadth-first search over the call graph. Returns one shortest
|
|
665
|
+
* path from `fromId` to `toId` (by edge count), or null if none found.
|
|
666
|
+
* The search expands at most `maxDepth` hops and at most `maxNodes` nodes
|
|
667
|
+
* visited overall — without those caps a cycle in the graph would explode.
|
|
668
|
+
*/
|
|
669
|
+
tracePath(fromId: number, toId: number, maxDepth?: number, maxNodes?: number): Array<{
|
|
670
|
+
id: number;
|
|
671
|
+
name: string;
|
|
672
|
+
qualifiedName: string | null;
|
|
673
|
+
kind: string;
|
|
674
|
+
filePath: string;
|
|
675
|
+
}> | null;
|
|
676
|
+
/** Reverse BFS from a symbol — for "everything that transitively calls X". */
|
|
677
|
+
reverseReachable(toId: number, maxDepth?: number, maxNodes?: number): number[];
|
|
678
|
+
/**
|
|
679
|
+
* Bounded reverse-reachable callers WITH depth, for risk/context callers.
|
|
680
|
+
* Same termination semantics as reverseReachable() but returns the depth
|
|
681
|
+
* at which each id was first discovered (1-indexed; direct callers = 1).
|
|
682
|
+
*/
|
|
683
|
+
reverseReachableWithDepth(toId: number, maxDepth?: number, maxNodes?: number): Array<{
|
|
684
|
+
id: number;
|
|
685
|
+
depth: number;
|
|
686
|
+
}>;
|
|
687
|
+
/**
|
|
688
|
+
* Bounded forward-reachable callees with depth — for callee blast-radius
|
|
689
|
+
* questions and behavioral indirect-coverage. Mirror of
|
|
690
|
+
* reverseReachableWithDepth().
|
|
691
|
+
*/
|
|
692
|
+
forwardReachableWithDepth(fromId: number, maxDepth?: number, maxNodes?: number): Array<{
|
|
693
|
+
id: number;
|
|
694
|
+
depth: number;
|
|
695
|
+
}>;
|
|
696
|
+
/**
|
|
697
|
+
* Bounded BFS over the file-import graph. Used by
|
|
698
|
+
* seer_trace_file_dependencies — returns each reachable file with the BFS
|
|
699
|
+
* depth at which we first saw it.
|
|
700
|
+
*/
|
|
701
|
+
fileImportClosure(fileId: number, maxDepth?: number, maxNodes?: number): Array<{
|
|
702
|
+
id: number;
|
|
703
|
+
depth: number;
|
|
704
|
+
relPath: string;
|
|
705
|
+
language: string;
|
|
706
|
+
}>;
|
|
707
|
+
/**
|
|
708
|
+
* All cross-file call edges as (fromFile, toFile, weight) triples.
|
|
709
|
+
* Used by the Louvain clusterer; only resolved 'call' edges count.
|
|
710
|
+
*/
|
|
711
|
+
fileCallEdgeWeights(): Array<{
|
|
712
|
+
from: number;
|
|
713
|
+
to: number;
|
|
714
|
+
weight: number;
|
|
715
|
+
}>;
|
|
716
|
+
/** Resolved cross-file import edges as (fromFile, toFile, weight). */
|
|
717
|
+
fileImportEdgeWeights(): Array<{
|
|
718
|
+
from: number;
|
|
719
|
+
to: number;
|
|
720
|
+
weight: number;
|
|
721
|
+
}>;
|
|
722
|
+
/** Synthesized test → production edges, file-aggregated. */
|
|
723
|
+
fileTestEdgeWeights(): Array<{
|
|
724
|
+
from: number;
|
|
725
|
+
to: number;
|
|
726
|
+
weight: number;
|
|
727
|
+
}>;
|
|
728
|
+
/**
|
|
729
|
+
* v8 Track-G — service-link file-aggregated edges. Each link contributes one
|
|
730
|
+
* cross-file edge from the call-site file (service_calls.file_id) to the
|
|
731
|
+
* handler-symbol's file. Used by the module clusterer to surface
|
|
732
|
+
* client→handler dependencies as architecturally important.
|
|
733
|
+
*/
|
|
734
|
+
fileServiceLinkEdgeWeights(): Array<{
|
|
735
|
+
from: number;
|
|
736
|
+
to: number;
|
|
737
|
+
weight: number;
|
|
738
|
+
}>;
|
|
739
|
+
/** All file ids + their language + rel path — feeds the clusterer. */
|
|
740
|
+
listFileSummaries(): Array<{
|
|
741
|
+
id: number;
|
|
742
|
+
relPath: string;
|
|
743
|
+
language: string;
|
|
744
|
+
role: string;
|
|
745
|
+
}>;
|
|
746
|
+
/**
|
|
747
|
+
* Replace the modules / module_members / module_edges tables with the
|
|
748
|
+
* provided clustering. Atomic — wrapped in a single transaction so a
|
|
749
|
+
* partial write can't leave inconsistent membership.
|
|
750
|
+
*/
|
|
751
|
+
replaceModules(modules: Array<{
|
|
752
|
+
label: string;
|
|
753
|
+
sizeFiles: number;
|
|
754
|
+
sizeSymbols: number;
|
|
755
|
+
primaryLanguage: string | null;
|
|
756
|
+
cohesion: number;
|
|
757
|
+
centrality: number;
|
|
758
|
+
fileIds: number[];
|
|
759
|
+
}>, edges: Array<{
|
|
760
|
+
fromIndex: number;
|
|
761
|
+
toIndex: number;
|
|
762
|
+
kind: string;
|
|
763
|
+
weight: number;
|
|
764
|
+
}>, algorithm?: string): void;
|
|
765
|
+
hasModulesData(): boolean;
|
|
766
|
+
countModules(): number;
|
|
767
|
+
listModules(options?: {
|
|
768
|
+
limit?: number;
|
|
769
|
+
sortBy?: 'centrality' | 'size' | 'label';
|
|
770
|
+
}): Array<{
|
|
771
|
+
id: number;
|
|
772
|
+
label: string;
|
|
773
|
+
sizeFiles: number;
|
|
774
|
+
sizeSymbols: number;
|
|
775
|
+
primaryLanguage: string | null;
|
|
776
|
+
cohesion: number;
|
|
777
|
+
centrality: number;
|
|
778
|
+
}>;
|
|
779
|
+
getModuleById(id: number): {
|
|
780
|
+
id: number;
|
|
781
|
+
label: string;
|
|
782
|
+
sizeFiles: number;
|
|
783
|
+
sizeSymbols: number;
|
|
784
|
+
primaryLanguage: string | null;
|
|
785
|
+
cohesion: number;
|
|
786
|
+
centrality: number;
|
|
787
|
+
} | null;
|
|
788
|
+
/** Module label → row. Used by CLI/MCP module lookups by name. */
|
|
789
|
+
getModuleByLabel(label: string): {
|
|
790
|
+
id: number;
|
|
791
|
+
label: string;
|
|
792
|
+
sizeFiles: number;
|
|
793
|
+
sizeSymbols: number;
|
|
794
|
+
primaryLanguage: string | null;
|
|
795
|
+
cohesion: number;
|
|
796
|
+
centrality: number;
|
|
797
|
+
} | null;
|
|
798
|
+
/**
|
|
799
|
+
* Files in a module, sorted by file path. Returns empty array if the
|
|
800
|
+
* module id doesn't exist or modules haven't been built.
|
|
801
|
+
*/
|
|
802
|
+
listModuleMembers(moduleId: number, limit?: number): Array<{
|
|
803
|
+
fileId: number;
|
|
804
|
+
path: string;
|
|
805
|
+
relPath: string;
|
|
806
|
+
language: string;
|
|
807
|
+
role: string;
|
|
808
|
+
}>;
|
|
809
|
+
/** Top symbols (by PageRank) inside a module. Useful for "what does this module own?" */
|
|
810
|
+
listModuleTopSymbols(moduleId: number, limit?: number): SymbolRow[];
|
|
811
|
+
/** Module containing a file id, or null when the file has no membership row. */
|
|
812
|
+
moduleForFile(fileId: number): {
|
|
813
|
+
id: number;
|
|
814
|
+
label: string;
|
|
815
|
+
} | null;
|
|
816
|
+
/**
|
|
817
|
+
* Cross-module dependency edges. Direction is configurable:
|
|
818
|
+
* - 'out' (default) → modules this one depends on (from = moduleId)
|
|
819
|
+
* - 'in' → modules that depend on this one (to = moduleId)
|
|
820
|
+
* Aggregates across all edge kinds; the kind is preserved per row.
|
|
821
|
+
*/
|
|
822
|
+
moduleDependencies(moduleId: number, options?: {
|
|
823
|
+
direction?: 'in' | 'out';
|
|
824
|
+
limit?: number;
|
|
825
|
+
}): Array<{
|
|
826
|
+
moduleId: number;
|
|
827
|
+
label: string;
|
|
828
|
+
kind: string;
|
|
829
|
+
weight: number;
|
|
830
|
+
}>;
|
|
831
|
+
/**
|
|
832
|
+
* Raw 'tests' edges into a specific symbol id — id-scoped so short-name
|
|
833
|
+
* siblings (`Alpha.run` / `Beta.run`) don't share a behavioral contract.
|
|
834
|
+
* Returns the test-side caller info (name, file, line) so the ranker can
|
|
835
|
+
* compute path-convention and naming-convention signals without
|
|
836
|
+
* re-fetching.
|
|
837
|
+
*
|
|
838
|
+
* The id-based filter is correct because `synthesizeTestEdges()` now
|
|
839
|
+
* preserves the source call edge's resolved `to_id` verbatim instead of
|
|
840
|
+
* re-resolving via `WHERE name = edges.to_name LIMIT 1` (which collapsed
|
|
841
|
+
* same-short-name symbols).
|
|
842
|
+
*/
|
|
843
|
+
directTestEdgesForId(symbolId: number, limit?: number): Array<{
|
|
844
|
+
callerId: number;
|
|
845
|
+
callerName: string;
|
|
846
|
+
callerQualifiedName: string | null;
|
|
847
|
+
callerKind: string;
|
|
848
|
+
callerFile: string;
|
|
849
|
+
callerLineStart: number;
|
|
850
|
+
callerLineEnd: number;
|
|
851
|
+
edgeLine: number;
|
|
852
|
+
assertionCount: number;
|
|
853
|
+
}>;
|
|
854
|
+
/**
|
|
855
|
+
* Count how many distinct routes have this symbol as their resolved handler.
|
|
856
|
+
* Used by seer_risk for the "route exposure" signal.
|
|
857
|
+
*/
|
|
858
|
+
routesForHandler(symbolId: number): Array<{
|
|
859
|
+
method: string;
|
|
860
|
+
path: string;
|
|
861
|
+
framework: string;
|
|
862
|
+
}>;
|
|
863
|
+
/** Distinct config keys read inside a symbol's body. */
|
|
864
|
+
configKeysForSymbol(symbolId: number): Array<{
|
|
865
|
+
key: string;
|
|
866
|
+
source: string;
|
|
867
|
+
line: number;
|
|
868
|
+
}>;
|
|
869
|
+
/**
|
|
870
|
+
* For each call edge OUT of a symbol, return the callee's module id (when
|
|
871
|
+
* resolved). Used by seer_risk for the "module-boundary crossing" signal.
|
|
872
|
+
* NULL module ids are filtered out — those are external/unresolved calls.
|
|
873
|
+
*/
|
|
874
|
+
calleeModulesOf(symbolId: number): Array<{
|
|
875
|
+
calleeId: number;
|
|
876
|
+
moduleId: number;
|
|
877
|
+
}>;
|
|
878
|
+
/**
|
|
879
|
+
* For each file id, return the symbols that match the given line ranges.
|
|
880
|
+
* Used by `detect_changes` to compute the blast radius of a diff.
|
|
881
|
+
*/
|
|
882
|
+
symbolsTouchingLines(fileId: number, lineRanges: Array<[number, number]>): SymbolRow[];
|
|
883
|
+
/**
|
|
884
|
+
* Record (or refresh) a SCIP import. Returns the row id. UNIQUE on
|
|
885
|
+
* (path, sha256) — if the same file with the same content is re-imported,
|
|
886
|
+
* the existing row is kept (the caller's idempotency guarantee).
|
|
887
|
+
*/
|
|
888
|
+
recordScipImport(scipPath: string, sha256: string, tool: string | null, projectRoot: string | null, symbolCount: number, refCount: number): number;
|
|
889
|
+
/**
|
|
890
|
+
* Has this exact SCIP file (by sha) been imported already? Lets callers
|
|
891
|
+
* short-circuit a re-parse on no-op CI re-runs.
|
|
892
|
+
*/
|
|
893
|
+
hasScipImport(scipPath: string, sha256: string): boolean;
|
|
894
|
+
/** Listing for `seer_scip_imports` / the bundle manifest. */
|
|
895
|
+
listScipImports(): Array<{
|
|
896
|
+
id: number;
|
|
897
|
+
path: string;
|
|
898
|
+
sha256: string;
|
|
899
|
+
tool: string | null;
|
|
900
|
+
projectRoot: string | null;
|
|
901
|
+
importedAt: number;
|
|
902
|
+
symbolCount: number;
|
|
903
|
+
refCount: number;
|
|
904
|
+
}>;
|
|
905
|
+
/**
|
|
906
|
+
* Insert (or upsert) a SCIP-sourced symbol. Returns the row id. Uses
|
|
907
|
+
* (file_id, qualified_name, line_start, kind) as the dedup key when the
|
|
908
|
+
* existing row was also SCIP-sourced — we never delete tree-sitter rows.
|
|
909
|
+
* Tree-sitter rows with the same identifier and overlapping line range are
|
|
910
|
+
* marked 'scip-merge' (precision confirmed by SCIP) instead of being
|
|
911
|
+
* duplicated, so the agent-facing default lens stays compact.
|
|
912
|
+
*
|
|
913
|
+
* `scipImportId` is the `scip_imports.id` row this symbol came from — it
|
|
914
|
+
* gets persisted on both fresh inserts and merge updates so a later
|
|
915
|
+
* `clearScipProvenance(path)` can scope its wipe to a single layer instead
|
|
916
|
+
* of nuking every SCIP row in the DB.
|
|
917
|
+
*/
|
|
918
|
+
insertOrMergeScipSymbol(fileId: number, def: SymbolDef, scipImportId: number): {
|
|
919
|
+
id: number;
|
|
920
|
+
merged: boolean;
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Insert a SCIP-sourced reference edge. `to_id` is set immediately because
|
|
924
|
+
* SCIP gives us precise targets — no need for the same-file/imported/global
|
|
925
|
+
* fallback resolver used for tree-sitter call edges.
|
|
926
|
+
*
|
|
927
|
+
* `scipImportId` ties the edge to the contributing SCIP layer so per-layer
|
|
928
|
+
* wipes are clean.
|
|
929
|
+
*/
|
|
930
|
+
insertScipEdge(fromSymbolId: number, toSymbolId: number, toName: string, kind: string, line: number, scipImportId: number): void;
|
|
931
|
+
/**
|
|
932
|
+
* Wipe SCIP-sourced rows so a fresh import can replace them. Tree-sitter
|
|
933
|
+
* rows are preserved; only the rows that came from the specified SCIP layer
|
|
934
|
+
* are touched.
|
|
935
|
+
*
|
|
936
|
+
* - scipPath omitted → ALL SCIP layers are wiped (every scip-provenance
|
|
937
|
+
* row is dropped, every scip-merge row demoted to tree-sitter, and
|
|
938
|
+
* the scip_imports table emptied). Useful for "I want my baseline
|
|
939
|
+
* back."
|
|
940
|
+
* - scipPath provided → only rows linked to scip_imports.id for that
|
|
941
|
+
* path are touched. Sibling layers stay intact. This is what
|
|
942
|
+
* importScip() calls before re-ingesting the same path, so a
|
|
943
|
+
* multi-layer setup (rust+ts SCIPs) stays correct on partial refresh.
|
|
944
|
+
*/
|
|
945
|
+
clearScipProvenance(scipPath?: string): number;
|
|
946
|
+
/** Provenance breakdown for `seer_health` / `seer_stats`. */
|
|
947
|
+
getProvenanceCounts(): {
|
|
948
|
+
symbols: Record<string, number>;
|
|
949
|
+
edges: Record<string, number>;
|
|
950
|
+
};
|
|
951
|
+
/** Set a symbol's shape_hash. NULL clears it. Persisted as INTEGER. */
|
|
952
|
+
setShapeHash(symbolId: number, hash: bigint | null): void;
|
|
953
|
+
/**
|
|
954
|
+
* Fetch all symbols that have a non-null shape_hash. Used as the candidate
|
|
955
|
+
* pool for duplicate detection. Returns minimal fields to keep the working
|
|
956
|
+
* set small on huge codebases.
|
|
957
|
+
*/
|
|
958
|
+
listSymbolsWithShapeHash(opts?: {
|
|
959
|
+
minLoc?: number;
|
|
960
|
+
includeTests?: boolean;
|
|
961
|
+
limit?: number;
|
|
962
|
+
}): Array<{
|
|
963
|
+
id: number;
|
|
964
|
+
name: string;
|
|
965
|
+
qualifiedName: string | null;
|
|
966
|
+
kind: string;
|
|
967
|
+
filePath: string;
|
|
968
|
+
lineStart: number;
|
|
969
|
+
lineEnd: number;
|
|
970
|
+
loc: number | null;
|
|
971
|
+
shapeHash: bigint;
|
|
972
|
+
}>;
|
|
973
|
+
/** v7 read-flag accessor for downstream features that need to gate on it. */
|
|
974
|
+
hasV7(): boolean;
|
|
975
|
+
/**
|
|
976
|
+
* Are there function-like symbols (kind function/method/constructor, role
|
|
977
|
+
* not 'declaration', loc >= 4) that don't yet have a shape_hash? Used by
|
|
978
|
+
* the indexer to decide whether to run buildShapeHashes() on a cached
|
|
979
|
+
* re-run — when a pre-v7 DB migrates to v7, every existing row still has
|
|
980
|
+
* shape_hash NULL even though the file is "cached" (its content hash
|
|
981
|
+
* didn't change), so the normal graphChanged predicate misses the
|
|
982
|
+
* backfill. This check catches that.
|
|
983
|
+
*/
|
|
984
|
+
hasMissingShapeHashes(minLoc?: number): boolean;
|
|
985
|
+
getStats(): StatsRow;
|
|
986
|
+
/** Direct access to the underlying DB for niche callers (history indexer). */
|
|
987
|
+
rawDb(): DatabaseSync;
|
|
988
|
+
begin(): void;
|
|
989
|
+
commit(): void;
|
|
990
|
+
rollback(): void;
|
|
991
|
+
close(): void;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Build a stable symbol-history key for a symbol. The shape is
|
|
995
|
+
* `kind:qualified_name` — coarse on purpose so a function rename within a
|
|
996
|
+
* file collapses history to the new name (we'd rather lose precision than
|
|
997
|
+
* lose history entirely when extractors disagree about parameter shape).
|
|
998
|
+
*
|
|
999
|
+
* Future: include parameter arity or signature-hash for overload distinction.
|
|
1000
|
+
*/
|
|
1001
|
+
export declare function makeSymbolKey(kind: string, qualifiedName: string): string;
|
|
1002
|
+
/**
|
|
1003
|
+
* Build an FTS5 MATCH expression from a free-text query. Strategy:
|
|
1004
|
+
* - lower-case
|
|
1005
|
+
* - split on whitespace and identifier punctuation
|
|
1006
|
+
* - quote each non-empty token and OR them together with `*` for prefix
|
|
1007
|
+
*
|
|
1008
|
+
* Empty / invalid → null (the caller falls back to LIKE).
|
|
1009
|
+
*/
|
|
1010
|
+
export declare function ftsQuery(input: string): string | null;
|
|
1011
|
+
//# sourceMappingURL=store.d.ts.map
|