@optave/codegraph 3.4.1 → 3.6.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/README.md +50 -28
- package/dist/ast-analysis/engine.d.ts.map +1 -1
- package/dist/ast-analysis/engine.js +119 -127
- package/dist/ast-analysis/engine.js.map +1 -1
- package/dist/ast-analysis/rules/javascript.d.ts.map +1 -1
- package/dist/ast-analysis/rules/javascript.js +1 -0
- package/dist/ast-analysis/rules/javascript.js.map +1 -1
- package/dist/ast-analysis/visitors/ast-store-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/ast-store-visitor.js +116 -35
- package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -1
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/complexity-visitor.js +11 -13
- package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -1
- package/dist/db/better-sqlite3.d.ts +3 -0
- package/dist/db/better-sqlite3.d.ts.map +1 -0
- package/dist/db/better-sqlite3.js +19 -0
- package/dist/db/better-sqlite3.js.map +1 -0
- package/dist/db/connection.d.ts +25 -4
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +125 -23
- package/dist/db/connection.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +40 -32
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/query-builder.d.ts +5 -5
- package/dist/db/query-builder.d.ts.map +1 -1
- package/dist/db/query-builder.js +20 -4
- package/dist/db/query-builder.js.map +1 -1
- package/dist/db/repository/index.d.ts +1 -0
- package/dist/db/repository/index.d.ts.map +1 -1
- package/dist/db/repository/index.js +1 -0
- package/dist/db/repository/index.js.map +1 -1
- package/dist/db/repository/native-repository.d.ts +58 -0
- package/dist/db/repository/native-repository.d.ts.map +1 -0
- package/dist/db/repository/native-repository.js +261 -0
- package/dist/db/repository/native-repository.js.map +1 -0
- package/dist/db/repository/nodes.d.ts +4 -4
- package/dist/db/repository/nodes.d.ts.map +1 -1
- package/dist/db/repository/nodes.js +6 -6
- package/dist/db/repository/nodes.js.map +1 -1
- package/dist/domain/analysis/context.d.ts.map +1 -1
- package/dist/domain/analysis/context.js +51 -66
- package/dist/domain/analysis/context.js.map +1 -1
- package/dist/domain/analysis/dependencies.d.ts.map +1 -1
- package/dist/domain/analysis/dependencies.js +62 -70
- package/dist/domain/analysis/dependencies.js.map +1 -1
- package/dist/domain/analysis/diff-impact.d.ts +9 -7
- package/dist/domain/analysis/diff-impact.d.ts.map +1 -1
- package/dist/domain/analysis/exports.d.ts.map +1 -1
- package/dist/domain/analysis/exports.js +29 -33
- package/dist/domain/analysis/exports.js.map +1 -1
- package/dist/domain/analysis/fn-impact.d.ts +15 -17
- package/dist/domain/analysis/fn-impact.d.ts.map +1 -1
- package/dist/domain/analysis/fn-impact.js +35 -65
- package/dist/domain/analysis/fn-impact.js.map +1 -1
- package/dist/domain/analysis/module-map.d.ts.map +1 -1
- package/dist/domain/analysis/module-map.js +91 -6
- package/dist/domain/analysis/module-map.js.map +1 -1
- package/dist/domain/analysis/query-helpers.d.ts +20 -0
- package/dist/domain/analysis/query-helpers.d.ts.map +1 -0
- package/dist/domain/analysis/query-helpers.js +27 -0
- package/dist/domain/analysis/query-helpers.js.map +1 -0
- package/dist/domain/graph/builder/context.d.ts +2 -1
- package/dist/domain/graph/builder/context.d.ts.map +1 -1
- package/dist/domain/graph/builder/context.js +1 -0
- package/dist/domain/graph/builder/context.js.map +1 -1
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -1
- package/dist/domain/graph/builder/helpers.js +15 -9
- package/dist/domain/graph/builder/helpers.js.map +1 -1
- package/dist/domain/graph/builder/incremental.d.ts.map +1 -1
- package/dist/domain/graph/builder/incremental.js +3 -2
- package/dist/domain/graph/builder/incremental.js.map +1 -1
- package/dist/domain/graph/builder/pipeline.d.ts.map +1 -1
- package/dist/domain/graph/builder/pipeline.js +95 -7
- package/dist/domain/graph/builder/pipeline.js.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.js +101 -57
- package/dist/domain/graph/builder/stages/build-edges.js.map +1 -1
- package/dist/domain/graph/builder/stages/build-structure.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/build-structure.js +33 -3
- package/dist/domain/graph/builder/stages/build-structure.js.map +1 -1
- package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/collect-files.js +70 -6
- package/dist/domain/graph/builder/stages/collect-files.js.map +1 -1
- package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/detect-changes.js +36 -14
- package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -1
- package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/finalize.js +130 -88
- package/dist/domain/graph/builder/stages/finalize.js.map +1 -1
- package/dist/domain/graph/builder/stages/insert-nodes.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/insert-nodes.js +124 -16
- package/dist/domain/graph/builder/stages/insert-nodes.js.map +1 -1
- package/dist/domain/graph/builder/stages/resolve-imports.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/resolve-imports.js +3 -2
- package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -1
- package/dist/domain/graph/resolve.d.ts +0 -4
- package/dist/domain/graph/resolve.d.ts.map +1 -1
- package/dist/domain/graph/resolve.js +32 -48
- package/dist/domain/graph/resolve.js.map +1 -1
- package/dist/domain/graph/watcher.d.ts.map +1 -1
- package/dist/domain/graph/watcher.js +12 -12
- package/dist/domain/graph/watcher.js.map +1 -1
- package/dist/domain/parser.d.ts +1 -1
- package/dist/domain/parser.d.ts.map +1 -1
- package/dist/domain/parser.js +165 -101
- package/dist/domain/parser.js.map +1 -1
- package/dist/domain/search/search/cli-formatter.d.ts.map +1 -1
- package/dist/domain/search/search/cli-formatter.js +88 -83
- package/dist/domain/search/search/cli-formatter.js.map +1 -1
- package/dist/extractors/bash.d.ts +6 -0
- package/dist/extractors/bash.d.ts.map +1 -0
- package/dist/extractors/bash.js +91 -0
- package/dist/extractors/bash.js.map +1 -0
- package/dist/extractors/c.d.ts +6 -0
- package/dist/extractors/c.d.ts.map +1 -0
- package/dist/extractors/c.js +204 -0
- package/dist/extractors/c.js.map +1 -0
- package/dist/extractors/cpp.d.ts +6 -0
- package/dist/extractors/cpp.d.ts.map +1 -0
- package/dist/extractors/cpp.js +283 -0
- package/dist/extractors/cpp.js.map +1 -0
- package/dist/extractors/csharp.d.ts.map +1 -1
- package/dist/extractors/csharp.js +42 -54
- package/dist/extractors/csharp.js.map +1 -1
- package/dist/extractors/go.d.ts.map +1 -1
- package/dist/extractors/go.js +126 -130
- package/dist/extractors/go.js.map +1 -1
- package/dist/extractors/hcl.js +6 -6
- package/dist/extractors/hcl.js.map +1 -1
- package/dist/extractors/helpers.d.ts +32 -1
- package/dist/extractors/helpers.d.ts.map +1 -1
- package/dist/extractors/helpers.js +74 -0
- package/dist/extractors/helpers.js.map +1 -1
- package/dist/extractors/index.d.ts +6 -0
- package/dist/extractors/index.d.ts.map +1 -1
- package/dist/extractors/index.js +6 -0
- package/dist/extractors/index.js.map +1 -1
- package/dist/extractors/java.d.ts.map +1 -1
- package/dist/extractors/java.js +32 -47
- package/dist/extractors/java.js.map +1 -1
- package/dist/extractors/javascript.d.ts.map +1 -1
- package/dist/extractors/javascript.js +359 -330
- package/dist/extractors/javascript.js.map +1 -1
- package/dist/extractors/kotlin.d.ts +6 -0
- package/dist/extractors/kotlin.d.ts.map +1 -0
- package/dist/extractors/kotlin.js +275 -0
- package/dist/extractors/kotlin.js.map +1 -0
- package/dist/extractors/php.d.ts.map +1 -1
- package/dist/extractors/php.js +39 -44
- package/dist/extractors/php.js.map +1 -1
- package/dist/extractors/python.d.ts.map +1 -1
- package/dist/extractors/python.js +75 -93
- package/dist/extractors/python.js.map +1 -1
- package/dist/extractors/ruby.js +6 -13
- package/dist/extractors/ruby.js.map +1 -1
- package/dist/extractors/rust.d.ts.map +1 -1
- package/dist/extractors/rust.js +58 -82
- package/dist/extractors/rust.js.map +1 -1
- package/dist/extractors/scala.d.ts +6 -0
- package/dist/extractors/scala.d.ts.map +1 -0
- package/dist/extractors/scala.js +269 -0
- package/dist/extractors/scala.js.map +1 -0
- package/dist/extractors/swift.d.ts +6 -0
- package/dist/extractors/swift.d.ts.map +1 -0
- package/dist/extractors/swift.js +275 -0
- package/dist/extractors/swift.js.map +1 -0
- package/dist/features/ast.d.ts +16 -1
- package/dist/features/ast.d.ts.map +1 -1
- package/dist/features/ast.js +45 -23
- package/dist/features/ast.js.map +1 -1
- package/dist/features/audit.d.ts.map +1 -1
- package/dist/features/audit.js +17 -21
- package/dist/features/audit.js.map +1 -1
- package/dist/features/branch-compare.d.ts.map +1 -1
- package/dist/features/branch-compare.js +50 -4
- package/dist/features/branch-compare.js.map +1 -1
- package/dist/features/cfg.d.ts +7 -1
- package/dist/features/cfg.d.ts.map +1 -1
- package/dist/features/cfg.js +118 -62
- package/dist/features/cfg.js.map +1 -1
- package/dist/features/check.d.ts.map +1 -1
- package/dist/features/check.js +79 -62
- package/dist/features/check.js.map +1 -1
- package/dist/features/complexity-query.d.ts.map +1 -1
- package/dist/features/complexity-query.js +142 -137
- package/dist/features/complexity-query.js.map +1 -1
- package/dist/features/complexity.d.ts +7 -1
- package/dist/features/complexity.d.ts.map +1 -1
- package/dist/features/complexity.js +62 -1
- package/dist/features/complexity.js.map +1 -1
- package/dist/features/dataflow.d.ts +7 -1
- package/dist/features/dataflow.d.ts.map +1 -1
- package/dist/features/dataflow.js +356 -188
- package/dist/features/dataflow.js.map +1 -1
- package/dist/features/graph-enrichment.d.ts.map +1 -1
- package/dist/features/graph-enrichment.js +117 -104
- package/dist/features/graph-enrichment.js.map +1 -1
- package/dist/features/sequence.d.ts.map +1 -1
- package/dist/features/sequence.js +25 -4
- package/dist/features/sequence.js.map +1 -1
- package/dist/features/snapshot.d.ts.map +1 -1
- package/dist/features/snapshot.js +2 -1
- package/dist/features/snapshot.js.map +1 -1
- package/dist/features/structure-query.d.ts.map +1 -1
- package/dist/features/structure-query.js +29 -4
- package/dist/features/structure-query.js.map +1 -1
- package/dist/features/structure.d.ts.map +1 -1
- package/dist/features/structure.js +35 -15
- package/dist/features/structure.js.map +1 -1
- package/dist/graph/algorithms/leiden/adapter.d.ts.map +1 -1
- package/dist/graph/algorithms/leiden/adapter.js +88 -73
- package/dist/graph/algorithms/leiden/adapter.js.map +1 -1
- package/dist/graph/algorithms/leiden/index.js +43 -28
- package/dist/graph/algorithms/leiden/index.js.map +1 -1
- package/dist/graph/algorithms/leiden/optimiser.d.ts.map +1 -1
- package/dist/graph/algorithms/leiden/optimiser.js +90 -104
- package/dist/graph/algorithms/leiden/optimiser.js.map +1 -1
- package/dist/graph/algorithms/leiden/partition.d.ts.map +1 -1
- package/dist/graph/algorithms/leiden/partition.js +89 -106
- package/dist/graph/algorithms/leiden/partition.js.map +1 -1
- package/dist/graph/model.d.ts +2 -0
- package/dist/graph/model.d.ts.map +1 -1
- package/dist/graph/model.js +20 -8
- package/dist/graph/model.js.map +1 -1
- package/dist/infrastructure/config.d.ts +0 -8
- package/dist/infrastructure/config.d.ts.map +1 -1
- package/dist/infrastructure/config.js +73 -62
- package/dist/infrastructure/config.js.map +1 -1
- package/dist/infrastructure/registry.d.ts +0 -8
- package/dist/infrastructure/registry.d.ts.map +1 -1
- package/dist/infrastructure/registry.js +12 -14
- package/dist/infrastructure/registry.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +47 -45
- package/dist/mcp/server.js.map +1 -1
- package/dist/presentation/audit.d.ts.map +1 -1
- package/dist/presentation/audit.js +61 -57
- package/dist/presentation/audit.js.map +1 -1
- package/dist/presentation/branch-compare.d.ts.map +1 -1
- package/dist/presentation/branch-compare.js +56 -38
- package/dist/presentation/branch-compare.js.map +1 -1
- package/dist/presentation/check.d.ts.map +1 -1
- package/dist/presentation/check.js +30 -32
- package/dist/presentation/check.js.map +1 -1
- package/dist/presentation/colors.d.ts.map +1 -1
- package/dist/presentation/colors.js +2 -0
- package/dist/presentation/colors.js.map +1 -1
- package/dist/presentation/complexity.d.ts.map +1 -1
- package/dist/presentation/complexity.js +25 -19
- package/dist/presentation/complexity.js.map +1 -1
- package/dist/presentation/queries-cli/exports.d.ts.map +1 -1
- package/dist/presentation/queries-cli/exports.js +15 -15
- package/dist/presentation/queries-cli/exports.js.map +1 -1
- package/dist/presentation/queries-cli/impact.d.ts.map +1 -1
- package/dist/presentation/queries-cli/impact.js +29 -19
- package/dist/presentation/queries-cli/impact.js.map +1 -1
- package/dist/types.d.ts +406 -3
- package/dist/types.d.ts.map +1 -1
- package/grammars/tree-sitter-bash.wasm +0 -0
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-cpp.wasm +0 -0
- package/grammars/tree-sitter-kotlin.wasm +0 -0
- package/grammars/tree-sitter-scala.wasm +0 -0
- package/grammars/tree-sitter-swift.wasm +0 -0
- package/package.json +67 -11
- package/src/ast-analysis/engine.ts +147 -138
- package/src/ast-analysis/rules/javascript.ts +1 -0
- package/src/ast-analysis/visitors/ast-store-visitor.ts +116 -34
- package/src/ast-analysis/visitors/complexity-visitor.ts +11 -11
- package/src/db/better-sqlite3.ts +20 -0
- package/src/db/connection.ts +148 -26
- package/src/db/index.ts +4 -1
- package/src/db/migrations.ts +38 -32
- package/src/db/query-builder.ts +30 -5
- package/src/db/repository/index.ts +1 -0
- package/src/db/repository/native-repository.ts +361 -0
- package/src/db/repository/nodes.ts +7 -3
- package/src/domain/analysis/context.ts +73 -75
- package/src/domain/analysis/dependencies.ts +78 -68
- package/src/domain/analysis/exports.ts +45 -34
- package/src/domain/analysis/fn-impact.ts +67 -64
- package/src/domain/analysis/module-map.ts +103 -8
- package/src/domain/analysis/query-helpers.ts +35 -0
- package/src/domain/graph/builder/context.ts +2 -0
- package/src/domain/graph/builder/helpers.ts +12 -6
- package/src/domain/graph/builder/incremental.ts +3 -2
- package/src/domain/graph/builder/pipeline.ts +98 -6
- package/src/domain/graph/builder/stages/build-edges.ts +116 -83
- package/src/domain/graph/builder/stages/build-structure.ts +46 -8
- package/src/domain/graph/builder/stages/collect-files.ts +83 -6
- package/src/domain/graph/builder/stages/detect-changes.ts +44 -21
- package/src/domain/graph/builder/stages/finalize.ts +172 -109
- package/src/domain/graph/builder/stages/insert-nodes.ts +147 -17
- package/src/domain/graph/builder/stages/resolve-imports.ts +3 -2
- package/src/domain/graph/resolve.ts +34 -46
- package/src/domain/graph/watcher.ts +12 -14
- package/src/domain/parser.ts +169 -97
- package/src/domain/search/search/cli-formatter.ts +121 -94
- package/src/extractors/bash.ts +97 -0
- package/src/extractors/c.ts +212 -0
- package/src/extractors/cpp.ts +298 -0
- package/src/extractors/csharp.ts +53 -56
- package/src/extractors/go.ts +152 -134
- package/src/extractors/hcl.ts +6 -6
- package/src/extractors/helpers.ts +93 -1
- package/src/extractors/index.ts +6 -0
- package/src/extractors/java.ts +43 -48
- package/src/extractors/javascript.ts +382 -317
- package/src/extractors/kotlin.ts +293 -0
- package/src/extractors/php.ts +46 -40
- package/src/extractors/python.ts +81 -104
- package/src/extractors/ruby.ts +6 -13
- package/src/extractors/rust.ts +65 -84
- package/src/extractors/scala.ts +285 -0
- package/src/extractors/swift.ts +293 -0
- package/src/features/ast.ts +74 -24
- package/src/features/audit.ts +24 -20
- package/src/features/branch-compare.ts +54 -5
- package/src/features/cfg.ts +158 -65
- package/src/features/check.ts +90 -74
- package/src/features/complexity-query.ts +181 -163
- package/src/features/complexity.ts +64 -1
- package/src/features/dataflow.ts +462 -217
- package/src/features/graph-enrichment.ts +161 -117
- package/src/features/sequence.ts +27 -4
- package/src/features/snapshot.ts +2 -1
- package/src/features/structure-query.ts +43 -4
- package/src/features/structure.ts +50 -22
- package/src/graph/algorithms/leiden/adapter.ts +126 -71
- package/src/graph/algorithms/leiden/index.ts +67 -28
- package/src/graph/algorithms/leiden/optimiser.ts +114 -105
- package/src/graph/algorithms/leiden/partition.ts +131 -98
- package/src/graph/model.ts +19 -7
- package/src/infrastructure/config.ts +60 -58
- package/src/infrastructure/registry.ts +17 -14
- package/src/mcp/server.ts +48 -47
- package/src/presentation/audit.ts +72 -67
- package/src/presentation/branch-compare.ts +54 -50
- package/src/presentation/check.ts +34 -34
- package/src/presentation/colors.ts +2 -0
- package/src/presentation/complexity.ts +39 -33
- package/src/presentation/queries-cli/exports.ts +17 -17
- package/src/presentation/queries-cli/impact.ts +30 -22
- package/src/types.ts +458 -3
package/src/types.ts
CHANGED
|
@@ -22,10 +22,11 @@ export type CoreSymbolKind =
|
|
|
22
22
|
| 'enum'
|
|
23
23
|
| 'trait'
|
|
24
24
|
| 'record'
|
|
25
|
-
| 'module'
|
|
25
|
+
| 'module'
|
|
26
|
+
| 'namespace';
|
|
26
27
|
|
|
27
28
|
/** Sub-declaration kinds (Phase 1). Includes 'method' for class child nodes. */
|
|
28
|
-
export type ExtendedSymbolKind = 'parameter' | 'property' | 'constant' | 'method';
|
|
29
|
+
export type ExtendedSymbolKind = 'parameter' | 'property' | 'constant' | 'variable' | 'method';
|
|
29
30
|
|
|
30
31
|
/** All queryable symbol kinds. */
|
|
31
32
|
export type SymbolKind = CoreSymbolKind | ExtendedSymbolKind;
|
|
@@ -83,7 +84,13 @@ export type LanguageId =
|
|
|
83
84
|
| 'csharp'
|
|
84
85
|
| 'ruby'
|
|
85
86
|
| 'php'
|
|
86
|
-
| 'hcl'
|
|
87
|
+
| 'hcl'
|
|
88
|
+
| 'c'
|
|
89
|
+
| 'cpp'
|
|
90
|
+
| 'kotlin'
|
|
91
|
+
| 'swift'
|
|
92
|
+
| 'scala'
|
|
93
|
+
| 'bash';
|
|
87
94
|
|
|
88
95
|
/** Engine mode selector. */
|
|
89
96
|
export type EngineMode = 'native' | 'wasm' | 'auto';
|
|
@@ -433,6 +440,11 @@ export interface Import {
|
|
|
433
440
|
csharpUsing?: boolean;
|
|
434
441
|
rubyRequire?: boolean;
|
|
435
442
|
phpUse?: boolean;
|
|
443
|
+
cInclude?: boolean;
|
|
444
|
+
kotlinImport?: boolean;
|
|
445
|
+
swiftImport?: boolean;
|
|
446
|
+
scalaImport?: boolean;
|
|
447
|
+
bashSource?: boolean;
|
|
436
448
|
}
|
|
437
449
|
|
|
438
450
|
/** A class/struct/trait relationship (extends or implements). */
|
|
@@ -881,6 +893,15 @@ export interface EngineOpts {
|
|
|
881
893
|
engine: EngineMode;
|
|
882
894
|
dataflow: boolean;
|
|
883
895
|
ast: boolean;
|
|
896
|
+
/** Persistent NativeDatabase connection for build writes (Phase 6.15). */
|
|
897
|
+
nativeDb?: NativeDatabase;
|
|
898
|
+
/**
|
|
899
|
+
* Suspend the JS (better-sqlite3) connection before a native write to avoid
|
|
900
|
+
* dual-connection WAL corruption. Call `resumeJsDb()` after the write completes.
|
|
901
|
+
* Only set during pipeline builds where both connections coexist.
|
|
902
|
+
*/
|
|
903
|
+
suspendJsDb?: () => void;
|
|
904
|
+
resumeJsDb?: () => void;
|
|
884
905
|
}
|
|
885
906
|
|
|
886
907
|
/** A file change detected during incremental builds. */
|
|
@@ -1804,6 +1825,10 @@ export interface NativeAddon {
|
|
|
1804
1825
|
buildCallEdges(files: unknown[], nodes: unknown[], builtinReceivers: string[]): unknown[];
|
|
1805
1826
|
engineVersion(): string;
|
|
1806
1827
|
ParseTreeCache: new () => NativeParseTreeCache;
|
|
1828
|
+
NativeDatabase: {
|
|
1829
|
+
openReadWrite(dbPath: string): NativeDatabase;
|
|
1830
|
+
openReadonly(dbPath: string): NativeDatabase;
|
|
1831
|
+
};
|
|
1807
1832
|
}
|
|
1808
1833
|
|
|
1809
1834
|
/** Native parse-tree cache instance. */
|
|
@@ -1814,6 +1839,436 @@ export interface NativeParseTreeCache {
|
|
|
1814
1839
|
clear(): void;
|
|
1815
1840
|
}
|
|
1816
1841
|
|
|
1842
|
+
/** Row types returned by NativeDatabase query methods (auto-generated by napi-rs). */
|
|
1843
|
+
export interface NativeNodeRow {
|
|
1844
|
+
id: number;
|
|
1845
|
+
name: string;
|
|
1846
|
+
kind: string;
|
|
1847
|
+
file: string;
|
|
1848
|
+
line: number | null;
|
|
1849
|
+
endLine: number | null;
|
|
1850
|
+
parentId: number | null;
|
|
1851
|
+
exported: number | null;
|
|
1852
|
+
qualifiedName: string | null;
|
|
1853
|
+
scope: string | null;
|
|
1854
|
+
visibility: string | null;
|
|
1855
|
+
role: string | null;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
export interface NativeNodeRowWithFanIn extends NativeNodeRow {
|
|
1859
|
+
fanIn: number;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
export interface NativeTriageNodeRow extends NativeNodeRow {
|
|
1863
|
+
fanIn: number;
|
|
1864
|
+
cognitive: number;
|
|
1865
|
+
mi: number;
|
|
1866
|
+
cyclomatic: number;
|
|
1867
|
+
maxNesting: number;
|
|
1868
|
+
churn: number;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
export interface NativeNodeIdRow {
|
|
1872
|
+
id: number;
|
|
1873
|
+
name: string;
|
|
1874
|
+
kind: string;
|
|
1875
|
+
line: number | null;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
export interface NativeChildNodeRow {
|
|
1879
|
+
name: string;
|
|
1880
|
+
kind: string;
|
|
1881
|
+
line: number | null;
|
|
1882
|
+
endLine: number | null;
|
|
1883
|
+
qualifiedName: string | null;
|
|
1884
|
+
scope: string | null;
|
|
1885
|
+
visibility: string | null;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
export interface NativeRelatedNodeRow {
|
|
1889
|
+
id: number;
|
|
1890
|
+
name: string;
|
|
1891
|
+
kind: string;
|
|
1892
|
+
file: string;
|
|
1893
|
+
line: number | null;
|
|
1894
|
+
endLine: number | null;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
export interface NativeAdjacentEdgeRow {
|
|
1898
|
+
name: string;
|
|
1899
|
+
kind: string;
|
|
1900
|
+
file: string;
|
|
1901
|
+
line: number | null;
|
|
1902
|
+
edgeKind: string;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
export interface NativeImportEdgeRow {
|
|
1906
|
+
file: string;
|
|
1907
|
+
edgeKind: string;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
export interface NativeIntraFileCallEdge {
|
|
1911
|
+
callerName: string;
|
|
1912
|
+
calleeName: string;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
export interface NativeCallableNodeRow {
|
|
1916
|
+
id: number;
|
|
1917
|
+
name: string;
|
|
1918
|
+
kind: string;
|
|
1919
|
+
file: string;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
export interface NativeCallEdgeRow {
|
|
1923
|
+
sourceId: number;
|
|
1924
|
+
targetId: number;
|
|
1925
|
+
confidence: number | null;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
export interface NativeFileNodeRow {
|
|
1929
|
+
id: number;
|
|
1930
|
+
name: string;
|
|
1931
|
+
file: string;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
export interface NativeImportGraphEdgeRow {
|
|
1935
|
+
sourceId: number;
|
|
1936
|
+
targetId: number;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
export interface NativeComplexityMetrics {
|
|
1940
|
+
cognitive: number;
|
|
1941
|
+
cyclomatic: number;
|
|
1942
|
+
maxNesting: number;
|
|
1943
|
+
maintainabilityIndex: number | null;
|
|
1944
|
+
halsteadVolume: number | null;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
/** Native rusqlite database wrapper instance (Phase 6.13 + 6.14 + 6.15). */
|
|
1948
|
+
export interface NativeDatabase {
|
|
1949
|
+
// ── Lifecycle (6.13) ────────────────────────────────────────────────
|
|
1950
|
+
initSchema(): void;
|
|
1951
|
+
getBuildMeta(key: string): string | null;
|
|
1952
|
+
setBuildMeta(entries: Array<{ key: string; value: string }>): void;
|
|
1953
|
+
exec(sql: string): void;
|
|
1954
|
+
pragma(sql: string): string | null;
|
|
1955
|
+
close(): void;
|
|
1956
|
+
readonly dbPath: string;
|
|
1957
|
+
readonly isOpen: boolean;
|
|
1958
|
+
|
|
1959
|
+
// ── Node lookups (6.14) ──────────────────────────────────────────────
|
|
1960
|
+
countNodes(): number;
|
|
1961
|
+
countEdges(): number;
|
|
1962
|
+
countFiles(): number;
|
|
1963
|
+
findNodeById(id: number): NativeNodeRow | null;
|
|
1964
|
+
getNodeId(name: string, kind: string, file: string, line: number): number | null;
|
|
1965
|
+
getFunctionNodeId(name: string, file: string, line: number): number | null;
|
|
1966
|
+
bulkNodeIdsByFile(file: string): NativeNodeIdRow[];
|
|
1967
|
+
findNodeChildren(parentId: number): NativeChildNodeRow[];
|
|
1968
|
+
findNodesByFile(file: string): NativeNodeRow[];
|
|
1969
|
+
findFileNodes(fileLike: string): NativeNodeRow[];
|
|
1970
|
+
findNodesByScope(
|
|
1971
|
+
scopeName: string,
|
|
1972
|
+
kind: string | null | undefined,
|
|
1973
|
+
file: string | null | undefined,
|
|
1974
|
+
): NativeNodeRow[];
|
|
1975
|
+
findNodeByQualifiedName(qualifiedName: string, file: string | null | undefined): NativeNodeRow[];
|
|
1976
|
+
findNodesWithFanIn(
|
|
1977
|
+
namePattern: string,
|
|
1978
|
+
kinds: string[] | null | undefined,
|
|
1979
|
+
file: string | null | undefined,
|
|
1980
|
+
): NativeNodeRowWithFanIn[];
|
|
1981
|
+
findNodesForTriage(
|
|
1982
|
+
kind: string | null | undefined,
|
|
1983
|
+
role: string | null | undefined,
|
|
1984
|
+
file: string | null | undefined,
|
|
1985
|
+
noTests: boolean | null | undefined,
|
|
1986
|
+
): NativeTriageNodeRow[];
|
|
1987
|
+
listFunctionNodes(
|
|
1988
|
+
file: string | null | undefined,
|
|
1989
|
+
pattern: string | null | undefined,
|
|
1990
|
+
noTests: boolean | null | undefined,
|
|
1991
|
+
): NativeNodeRow[];
|
|
1992
|
+
iterateFunctionNodes(
|
|
1993
|
+
file: string | null | undefined,
|
|
1994
|
+
pattern: string | null | undefined,
|
|
1995
|
+
noTests: boolean | null | undefined,
|
|
1996
|
+
): NativeNodeRow[];
|
|
1997
|
+
|
|
1998
|
+
// ── Edge queries (6.14) ──────────────────────────────────────────────
|
|
1999
|
+
findCallees(nodeId: number): NativeRelatedNodeRow[];
|
|
2000
|
+
findCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
2001
|
+
findDistinctCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
2002
|
+
findAllOutgoingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
2003
|
+
findAllIncomingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
2004
|
+
findCalleeNames(nodeId: number): string[];
|
|
2005
|
+
findCallerNames(nodeId: number): string[];
|
|
2006
|
+
findImportTargets(nodeId: number): NativeImportEdgeRow[];
|
|
2007
|
+
findImportSources(nodeId: number): NativeImportEdgeRow[];
|
|
2008
|
+
findImportDependents(nodeId: number): NativeNodeRow[];
|
|
2009
|
+
findCrossFileCallTargets(file: string): number[];
|
|
2010
|
+
countCrossFileCallers(nodeId: number, file: string): number;
|
|
2011
|
+
getClassHierarchy(classNodeId: number): number[];
|
|
2012
|
+
findImplementors(nodeId: number): NativeRelatedNodeRow[];
|
|
2013
|
+
findInterfaces(nodeId: number): NativeRelatedNodeRow[];
|
|
2014
|
+
findIntraFileCallEdges(file: string): NativeIntraFileCallEdge[];
|
|
2015
|
+
|
|
2016
|
+
// ── Graph-read queries (6.14) ────────────────────────────────────────
|
|
2017
|
+
getCallableNodes(): NativeCallableNodeRow[];
|
|
2018
|
+
getCallEdges(): NativeCallEdgeRow[];
|
|
2019
|
+
getFileNodesAll(): NativeFileNodeRow[];
|
|
2020
|
+
getImportEdges(): NativeImportGraphEdgeRow[];
|
|
2021
|
+
|
|
2022
|
+
// ── Table checks (6.14) ──────────────────────────────────────────────
|
|
2023
|
+
hasCfgTables(): boolean;
|
|
2024
|
+
hasEmbeddings(): boolean;
|
|
2025
|
+
hasDataflowTable(): boolean;
|
|
2026
|
+
getComplexityForNode(nodeId: number): NativeComplexityMetrics | null;
|
|
2027
|
+
|
|
2028
|
+
// ── Build pipeline writes (6.15) ───────────────────────────────────
|
|
2029
|
+
bulkInsertNodes(
|
|
2030
|
+
batches: Array<{
|
|
2031
|
+
file: string;
|
|
2032
|
+
definitions: Array<{
|
|
2033
|
+
name: string;
|
|
2034
|
+
kind: string;
|
|
2035
|
+
line: number;
|
|
2036
|
+
endLine?: number;
|
|
2037
|
+
visibility?: string;
|
|
2038
|
+
children: Array<{
|
|
2039
|
+
name: string;
|
|
2040
|
+
kind: string;
|
|
2041
|
+
line: number;
|
|
2042
|
+
endLine?: number;
|
|
2043
|
+
visibility?: string;
|
|
2044
|
+
}>;
|
|
2045
|
+
}>;
|
|
2046
|
+
exports: Array<{ name: string; kind: string; line: number }>;
|
|
2047
|
+
}>,
|
|
2048
|
+
fileHashes: Array<{ file: string; hash: string; mtime: number; size: number }>,
|
|
2049
|
+
removedFiles: string[],
|
|
2050
|
+
): boolean;
|
|
2051
|
+
bulkInsertEdges(
|
|
2052
|
+
edges: Array<{
|
|
2053
|
+
sourceId: number;
|
|
2054
|
+
targetId: number;
|
|
2055
|
+
kind: string;
|
|
2056
|
+
confidence: number;
|
|
2057
|
+
dynamic: number;
|
|
2058
|
+
}>,
|
|
2059
|
+
): boolean;
|
|
2060
|
+
bulkInsertAstNodes(
|
|
2061
|
+
batches: Array<{
|
|
2062
|
+
file: string;
|
|
2063
|
+
nodes: Array<{
|
|
2064
|
+
line: number;
|
|
2065
|
+
kind: string;
|
|
2066
|
+
name: string;
|
|
2067
|
+
text?: string | null;
|
|
2068
|
+
receiver?: string | null;
|
|
2069
|
+
}>;
|
|
2070
|
+
}>,
|
|
2071
|
+
): number;
|
|
2072
|
+
bulkInsertComplexity?(
|
|
2073
|
+
rows: Array<{
|
|
2074
|
+
nodeId: number;
|
|
2075
|
+
cognitive: number;
|
|
2076
|
+
cyclomatic: number;
|
|
2077
|
+
maxNesting: number;
|
|
2078
|
+
loc: number;
|
|
2079
|
+
sloc: number;
|
|
2080
|
+
commentLines: number;
|
|
2081
|
+
halsteadN1: number;
|
|
2082
|
+
halsteadN2: number;
|
|
2083
|
+
halsteadBigN1: number;
|
|
2084
|
+
halsteadBigN2: number;
|
|
2085
|
+
halsteadVocabulary: number;
|
|
2086
|
+
halsteadLength: number;
|
|
2087
|
+
halsteadVolume: number;
|
|
2088
|
+
halsteadDifficulty: number;
|
|
2089
|
+
halsteadEffort: number;
|
|
2090
|
+
halsteadBugs: number;
|
|
2091
|
+
maintainabilityIndex: number;
|
|
2092
|
+
}>,
|
|
2093
|
+
): number;
|
|
2094
|
+
bulkInsertCfg?(
|
|
2095
|
+
entries: Array<{
|
|
2096
|
+
nodeId: number;
|
|
2097
|
+
blocks: Array<{
|
|
2098
|
+
index: number;
|
|
2099
|
+
blockType: string;
|
|
2100
|
+
startLine?: number | null;
|
|
2101
|
+
endLine?: number | null;
|
|
2102
|
+
label?: string | null;
|
|
2103
|
+
}>;
|
|
2104
|
+
edges: Array<{
|
|
2105
|
+
sourceIndex: number;
|
|
2106
|
+
targetIndex: number;
|
|
2107
|
+
kind: string;
|
|
2108
|
+
}>;
|
|
2109
|
+
}>,
|
|
2110
|
+
): number;
|
|
2111
|
+
bulkInsertDataflow?(
|
|
2112
|
+
edges: Array<{
|
|
2113
|
+
sourceId: number;
|
|
2114
|
+
targetId: number;
|
|
2115
|
+
kind: string;
|
|
2116
|
+
paramIndex?: number | null;
|
|
2117
|
+
expression?: string | null;
|
|
2118
|
+
line?: number | null;
|
|
2119
|
+
confidence: number;
|
|
2120
|
+
}>,
|
|
2121
|
+
): number;
|
|
2122
|
+
classifyRolesFull(): {
|
|
2123
|
+
entry: number;
|
|
2124
|
+
core: number;
|
|
2125
|
+
utility: number;
|
|
2126
|
+
adapter: number;
|
|
2127
|
+
dead: number;
|
|
2128
|
+
deadLeaf: number;
|
|
2129
|
+
deadEntry: number;
|
|
2130
|
+
deadFfi: number;
|
|
2131
|
+
deadUnresolved: number;
|
|
2132
|
+
testOnly: number;
|
|
2133
|
+
leaf: number;
|
|
2134
|
+
} | null;
|
|
2135
|
+
classifyRolesIncremental(changedFiles: string[]): {
|
|
2136
|
+
entry: number;
|
|
2137
|
+
core: number;
|
|
2138
|
+
utility: number;
|
|
2139
|
+
adapter: number;
|
|
2140
|
+
dead: number;
|
|
2141
|
+
deadLeaf: number;
|
|
2142
|
+
deadEntry: number;
|
|
2143
|
+
deadFfi: number;
|
|
2144
|
+
deadUnresolved: number;
|
|
2145
|
+
testOnly: number;
|
|
2146
|
+
leaf: number;
|
|
2147
|
+
} | null;
|
|
2148
|
+
purgeFilesData(files: string[], purgeHashes?: boolean, reverseDepFiles?: string[]): void;
|
|
2149
|
+
|
|
2150
|
+
// ── Batched query methods ────────────────────────────────────────────
|
|
2151
|
+
/** All graph statistics in a single napi call (replaces ~11 queries in module-map). */
|
|
2152
|
+
getGraphStats?(noTests: boolean): {
|
|
2153
|
+
totalNodes: number;
|
|
2154
|
+
totalEdges: number;
|
|
2155
|
+
nodesByKind: Array<{ kind: string; count: number }>;
|
|
2156
|
+
edgesByKind: Array<{ kind: string; count: number }>;
|
|
2157
|
+
roleCounts: Array<{ role: string; count: number }>;
|
|
2158
|
+
quality: {
|
|
2159
|
+
callableTotal: number;
|
|
2160
|
+
callableWithCallers: number;
|
|
2161
|
+
callEdges: number;
|
|
2162
|
+
highConfCallEdges: number;
|
|
2163
|
+
};
|
|
2164
|
+
hotspots: Array<{ file: string; fanIn: number; fanOut: number }>;
|
|
2165
|
+
complexity: {
|
|
2166
|
+
analyzed: number;
|
|
2167
|
+
avgCognitive: number;
|
|
2168
|
+
avgCyclomatic: number;
|
|
2169
|
+
maxCognitive: number;
|
|
2170
|
+
maxCyclomatic: number;
|
|
2171
|
+
avgMi: number;
|
|
2172
|
+
minMi: number;
|
|
2173
|
+
} | null;
|
|
2174
|
+
embeddings: {
|
|
2175
|
+
count: number;
|
|
2176
|
+
model: string | null;
|
|
2177
|
+
dim: number | null;
|
|
2178
|
+
builtAt: string | null;
|
|
2179
|
+
} | null;
|
|
2180
|
+
};
|
|
2181
|
+
/** All 6 directional dataflow edge sets for a node in one call. */
|
|
2182
|
+
getDataflowEdges?(nodeId: number): {
|
|
2183
|
+
flowsToOut: Array<{
|
|
2184
|
+
name: string;
|
|
2185
|
+
kind: string;
|
|
2186
|
+
file: string;
|
|
2187
|
+
line: number | null;
|
|
2188
|
+
paramIndex: number | null;
|
|
2189
|
+
expression: string | null;
|
|
2190
|
+
confidence: number | null;
|
|
2191
|
+
}>;
|
|
2192
|
+
flowsToIn: Array<{
|
|
2193
|
+
name: string;
|
|
2194
|
+
kind: string;
|
|
2195
|
+
file: string;
|
|
2196
|
+
line: number | null;
|
|
2197
|
+
paramIndex: number | null;
|
|
2198
|
+
expression: string | null;
|
|
2199
|
+
confidence: number | null;
|
|
2200
|
+
}>;
|
|
2201
|
+
returnsOut: Array<{
|
|
2202
|
+
name: string;
|
|
2203
|
+
kind: string;
|
|
2204
|
+
file: string;
|
|
2205
|
+
line: number | null;
|
|
2206
|
+
paramIndex: number | null;
|
|
2207
|
+
expression: string | null;
|
|
2208
|
+
confidence: number | null;
|
|
2209
|
+
}>;
|
|
2210
|
+
returnsIn: Array<{
|
|
2211
|
+
name: string;
|
|
2212
|
+
kind: string;
|
|
2213
|
+
file: string;
|
|
2214
|
+
line: number | null;
|
|
2215
|
+
paramIndex: number | null;
|
|
2216
|
+
expression: string | null;
|
|
2217
|
+
confidence: number | null;
|
|
2218
|
+
}>;
|
|
2219
|
+
mutatesOut: Array<{
|
|
2220
|
+
name: string;
|
|
2221
|
+
kind: string;
|
|
2222
|
+
file: string;
|
|
2223
|
+
line: number | null;
|
|
2224
|
+
paramIndex: number | null;
|
|
2225
|
+
expression: string | null;
|
|
2226
|
+
confidence: number | null;
|
|
2227
|
+
}>;
|
|
2228
|
+
mutatesIn: Array<{
|
|
2229
|
+
name: string;
|
|
2230
|
+
kind: string;
|
|
2231
|
+
file: string;
|
|
2232
|
+
line: number | null;
|
|
2233
|
+
paramIndex: number | null;
|
|
2234
|
+
expression: string | null;
|
|
2235
|
+
confidence: number | null;
|
|
2236
|
+
}>;
|
|
2237
|
+
};
|
|
2238
|
+
/** Hotspot rows for a metric/kind/limit in one call. */
|
|
2239
|
+
getHotspots?(
|
|
2240
|
+
kind: string,
|
|
2241
|
+
metric: string,
|
|
2242
|
+
noTests: boolean,
|
|
2243
|
+
limit: number,
|
|
2244
|
+
): Array<{
|
|
2245
|
+
name: string;
|
|
2246
|
+
kind: string;
|
|
2247
|
+
lineCount: number | null;
|
|
2248
|
+
symbolCount: number | null;
|
|
2249
|
+
importCount: number | null;
|
|
2250
|
+
exportCount: number | null;
|
|
2251
|
+
fanIn: number | null;
|
|
2252
|
+
fanOut: number | null;
|
|
2253
|
+
cohesion: number | null;
|
|
2254
|
+
fileCount: number | null;
|
|
2255
|
+
}>;
|
|
2256
|
+
/** Batch fan-in/fan-out for multiple node IDs in one call. */
|
|
2257
|
+
batchFanMetrics?(nodeIds: number[]): Array<{
|
|
2258
|
+
nodeId: number;
|
|
2259
|
+
fanIn: number;
|
|
2260
|
+
fanOut: number;
|
|
2261
|
+
}>;
|
|
2262
|
+
|
|
2263
|
+
// ── Generic query execution & version validation (6.16) ─────────────
|
|
2264
|
+
/** Execute a parameterized SELECT and return all rows as objects. */
|
|
2265
|
+
queryAll(sql: string, params: Array<string | number | null>): Record<string, unknown>[];
|
|
2266
|
+
/** Execute a parameterized SELECT and return the first row, or null. */
|
|
2267
|
+
queryGet(sql: string, params: Array<string | number | null>): Record<string, unknown> | null;
|
|
2268
|
+
/** Validate DB codegraph_version matches expected. Warns on mismatch. */
|
|
2269
|
+
validateSchemaVersion(expectedVersion: string): boolean;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
1817
2272
|
// ════════════════════════════════════════════════════════════════════════
|
|
1818
2273
|
// §14 CLI Command Framework
|
|
1819
2274
|
// ════════════════════════════════════════════════════════════════════════
|