@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/dist/types.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* parsers, builders, visitors, features, config, and the graph model.
|
|
8
8
|
*/
|
|
9
9
|
/** The original 10 symbol kinds — default query scope. */
|
|
10
|
-
export type CoreSymbolKind = 'function' | 'method' | 'class' | 'interface' | 'type' | 'struct' | 'enum' | 'trait' | 'record' | 'module';
|
|
10
|
+
export type CoreSymbolKind = 'function' | 'method' | 'class' | 'interface' | 'type' | 'struct' | 'enum' | 'trait' | 'record' | 'module' | 'namespace';
|
|
11
11
|
/** Sub-declaration kinds (Phase 1). Includes 'method' for class child nodes. */
|
|
12
|
-
export type ExtendedSymbolKind = 'parameter' | 'property' | 'constant' | 'method';
|
|
12
|
+
export type ExtendedSymbolKind = 'parameter' | 'property' | 'constant' | 'variable' | 'method';
|
|
13
13
|
/** All queryable symbol kinds. */
|
|
14
14
|
export type SymbolKind = CoreSymbolKind | ExtendedSymbolKind;
|
|
15
15
|
/** Special kind used for file-level nodes in the graph. */
|
|
@@ -35,7 +35,7 @@ export type DeadSubRole = 'dead-leaf' | 'dead-entry' | 'dead-ffi' | 'dead-unreso
|
|
|
35
35
|
/** Every valid role. */
|
|
36
36
|
export type Role = CoreRole | DeadSubRole;
|
|
37
37
|
/** Supported language identifiers (from LANGUAGE_REGISTRY). */
|
|
38
|
-
export type LanguageId = 'javascript' | 'typescript' | 'tsx' | 'python' | 'go' | 'rust' | 'java' | 'csharp' | 'ruby' | 'php' | 'hcl';
|
|
38
|
+
export type LanguageId = 'javascript' | 'typescript' | 'tsx' | 'python' | 'go' | 'rust' | 'java' | 'csharp' | 'ruby' | 'php' | 'hcl' | 'c' | 'cpp' | 'kotlin' | 'swift' | 'scala' | 'bash';
|
|
39
39
|
/** Engine mode selector. */
|
|
40
40
|
export type EngineMode = 'native' | 'wasm' | 'auto';
|
|
41
41
|
/** Graph export formats. */
|
|
@@ -334,6 +334,11 @@ export interface Import {
|
|
|
334
334
|
csharpUsing?: boolean;
|
|
335
335
|
rubyRequire?: boolean;
|
|
336
336
|
phpUse?: boolean;
|
|
337
|
+
cInclude?: boolean;
|
|
338
|
+
kotlinImport?: boolean;
|
|
339
|
+
swiftImport?: boolean;
|
|
340
|
+
scalaImport?: boolean;
|
|
341
|
+
bashSource?: boolean;
|
|
337
342
|
}
|
|
338
343
|
/** A class/struct/trait relationship (extends or implements). */
|
|
339
344
|
export interface ClassRelation {
|
|
@@ -716,6 +721,15 @@ export interface EngineOpts {
|
|
|
716
721
|
engine: EngineMode;
|
|
717
722
|
dataflow: boolean;
|
|
718
723
|
ast: boolean;
|
|
724
|
+
/** Persistent NativeDatabase connection for build writes (Phase 6.15). */
|
|
725
|
+
nativeDb?: NativeDatabase;
|
|
726
|
+
/**
|
|
727
|
+
* Suspend the JS (better-sqlite3) connection before a native write to avoid
|
|
728
|
+
* dual-connection WAL corruption. Call `resumeJsDb()` after the write completes.
|
|
729
|
+
* Only set during pipeline builds where both connections coexist.
|
|
730
|
+
*/
|
|
731
|
+
suspendJsDb?: () => void;
|
|
732
|
+
resumeJsDb?: () => void;
|
|
719
733
|
}
|
|
720
734
|
/** A file change detected during incremental builds. */
|
|
721
735
|
export interface ParseChange {
|
|
@@ -1511,6 +1525,10 @@ export interface NativeAddon {
|
|
|
1511
1525
|
buildCallEdges(files: unknown[], nodes: unknown[], builtinReceivers: string[]): unknown[];
|
|
1512
1526
|
engineVersion(): string;
|
|
1513
1527
|
ParseTreeCache: new () => NativeParseTreeCache;
|
|
1528
|
+
NativeDatabase: {
|
|
1529
|
+
openReadWrite(dbPath: string): NativeDatabase;
|
|
1530
|
+
openReadonly(dbPath: string): NativeDatabase;
|
|
1531
|
+
};
|
|
1514
1532
|
}
|
|
1515
1533
|
/** Native parse-tree cache instance. */
|
|
1516
1534
|
export interface NativeParseTreeCache {
|
|
@@ -1519,6 +1537,391 @@ export interface NativeParseTreeCache {
|
|
|
1519
1537
|
delete(filePath: string): void;
|
|
1520
1538
|
clear(): void;
|
|
1521
1539
|
}
|
|
1540
|
+
/** Row types returned by NativeDatabase query methods (auto-generated by napi-rs). */
|
|
1541
|
+
export interface NativeNodeRow {
|
|
1542
|
+
id: number;
|
|
1543
|
+
name: string;
|
|
1544
|
+
kind: string;
|
|
1545
|
+
file: string;
|
|
1546
|
+
line: number | null;
|
|
1547
|
+
endLine: number | null;
|
|
1548
|
+
parentId: number | null;
|
|
1549
|
+
exported: number | null;
|
|
1550
|
+
qualifiedName: string | null;
|
|
1551
|
+
scope: string | null;
|
|
1552
|
+
visibility: string | null;
|
|
1553
|
+
role: string | null;
|
|
1554
|
+
}
|
|
1555
|
+
export interface NativeNodeRowWithFanIn extends NativeNodeRow {
|
|
1556
|
+
fanIn: number;
|
|
1557
|
+
}
|
|
1558
|
+
export interface NativeTriageNodeRow extends NativeNodeRow {
|
|
1559
|
+
fanIn: number;
|
|
1560
|
+
cognitive: number;
|
|
1561
|
+
mi: number;
|
|
1562
|
+
cyclomatic: number;
|
|
1563
|
+
maxNesting: number;
|
|
1564
|
+
churn: number;
|
|
1565
|
+
}
|
|
1566
|
+
export interface NativeNodeIdRow {
|
|
1567
|
+
id: number;
|
|
1568
|
+
name: string;
|
|
1569
|
+
kind: string;
|
|
1570
|
+
line: number | null;
|
|
1571
|
+
}
|
|
1572
|
+
export interface NativeChildNodeRow {
|
|
1573
|
+
name: string;
|
|
1574
|
+
kind: string;
|
|
1575
|
+
line: number | null;
|
|
1576
|
+
endLine: number | null;
|
|
1577
|
+
qualifiedName: string | null;
|
|
1578
|
+
scope: string | null;
|
|
1579
|
+
visibility: string | null;
|
|
1580
|
+
}
|
|
1581
|
+
export interface NativeRelatedNodeRow {
|
|
1582
|
+
id: number;
|
|
1583
|
+
name: string;
|
|
1584
|
+
kind: string;
|
|
1585
|
+
file: string;
|
|
1586
|
+
line: number | null;
|
|
1587
|
+
endLine: number | null;
|
|
1588
|
+
}
|
|
1589
|
+
export interface NativeAdjacentEdgeRow {
|
|
1590
|
+
name: string;
|
|
1591
|
+
kind: string;
|
|
1592
|
+
file: string;
|
|
1593
|
+
line: number | null;
|
|
1594
|
+
edgeKind: string;
|
|
1595
|
+
}
|
|
1596
|
+
export interface NativeImportEdgeRow {
|
|
1597
|
+
file: string;
|
|
1598
|
+
edgeKind: string;
|
|
1599
|
+
}
|
|
1600
|
+
export interface NativeIntraFileCallEdge {
|
|
1601
|
+
callerName: string;
|
|
1602
|
+
calleeName: string;
|
|
1603
|
+
}
|
|
1604
|
+
export interface NativeCallableNodeRow {
|
|
1605
|
+
id: number;
|
|
1606
|
+
name: string;
|
|
1607
|
+
kind: string;
|
|
1608
|
+
file: string;
|
|
1609
|
+
}
|
|
1610
|
+
export interface NativeCallEdgeRow {
|
|
1611
|
+
sourceId: number;
|
|
1612
|
+
targetId: number;
|
|
1613
|
+
confidence: number | null;
|
|
1614
|
+
}
|
|
1615
|
+
export interface NativeFileNodeRow {
|
|
1616
|
+
id: number;
|
|
1617
|
+
name: string;
|
|
1618
|
+
file: string;
|
|
1619
|
+
}
|
|
1620
|
+
export interface NativeImportGraphEdgeRow {
|
|
1621
|
+
sourceId: number;
|
|
1622
|
+
targetId: number;
|
|
1623
|
+
}
|
|
1624
|
+
export interface NativeComplexityMetrics {
|
|
1625
|
+
cognitive: number;
|
|
1626
|
+
cyclomatic: number;
|
|
1627
|
+
maxNesting: number;
|
|
1628
|
+
maintainabilityIndex: number | null;
|
|
1629
|
+
halsteadVolume: number | null;
|
|
1630
|
+
}
|
|
1631
|
+
/** Native rusqlite database wrapper instance (Phase 6.13 + 6.14 + 6.15). */
|
|
1632
|
+
export interface NativeDatabase {
|
|
1633
|
+
initSchema(): void;
|
|
1634
|
+
getBuildMeta(key: string): string | null;
|
|
1635
|
+
setBuildMeta(entries: Array<{
|
|
1636
|
+
key: string;
|
|
1637
|
+
value: string;
|
|
1638
|
+
}>): void;
|
|
1639
|
+
exec(sql: string): void;
|
|
1640
|
+
pragma(sql: string): string | null;
|
|
1641
|
+
close(): void;
|
|
1642
|
+
readonly dbPath: string;
|
|
1643
|
+
readonly isOpen: boolean;
|
|
1644
|
+
countNodes(): number;
|
|
1645
|
+
countEdges(): number;
|
|
1646
|
+
countFiles(): number;
|
|
1647
|
+
findNodeById(id: number): NativeNodeRow | null;
|
|
1648
|
+
getNodeId(name: string, kind: string, file: string, line: number): number | null;
|
|
1649
|
+
getFunctionNodeId(name: string, file: string, line: number): number | null;
|
|
1650
|
+
bulkNodeIdsByFile(file: string): NativeNodeIdRow[];
|
|
1651
|
+
findNodeChildren(parentId: number): NativeChildNodeRow[];
|
|
1652
|
+
findNodesByFile(file: string): NativeNodeRow[];
|
|
1653
|
+
findFileNodes(fileLike: string): NativeNodeRow[];
|
|
1654
|
+
findNodesByScope(scopeName: string, kind: string | null | undefined, file: string | null | undefined): NativeNodeRow[];
|
|
1655
|
+
findNodeByQualifiedName(qualifiedName: string, file: string | null | undefined): NativeNodeRow[];
|
|
1656
|
+
findNodesWithFanIn(namePattern: string, kinds: string[] | null | undefined, file: string | null | undefined): NativeNodeRowWithFanIn[];
|
|
1657
|
+
findNodesForTriage(kind: string | null | undefined, role: string | null | undefined, file: string | null | undefined, noTests: boolean | null | undefined): NativeTriageNodeRow[];
|
|
1658
|
+
listFunctionNodes(file: string | null | undefined, pattern: string | null | undefined, noTests: boolean | null | undefined): NativeNodeRow[];
|
|
1659
|
+
iterateFunctionNodes(file: string | null | undefined, pattern: string | null | undefined, noTests: boolean | null | undefined): NativeNodeRow[];
|
|
1660
|
+
findCallees(nodeId: number): NativeRelatedNodeRow[];
|
|
1661
|
+
findCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
1662
|
+
findDistinctCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
1663
|
+
findAllOutgoingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
1664
|
+
findAllIncomingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
1665
|
+
findCalleeNames(nodeId: number): string[];
|
|
1666
|
+
findCallerNames(nodeId: number): string[];
|
|
1667
|
+
findImportTargets(nodeId: number): NativeImportEdgeRow[];
|
|
1668
|
+
findImportSources(nodeId: number): NativeImportEdgeRow[];
|
|
1669
|
+
findImportDependents(nodeId: number): NativeNodeRow[];
|
|
1670
|
+
findCrossFileCallTargets(file: string): number[];
|
|
1671
|
+
countCrossFileCallers(nodeId: number, file: string): number;
|
|
1672
|
+
getClassHierarchy(classNodeId: number): number[];
|
|
1673
|
+
findImplementors(nodeId: number): NativeRelatedNodeRow[];
|
|
1674
|
+
findInterfaces(nodeId: number): NativeRelatedNodeRow[];
|
|
1675
|
+
findIntraFileCallEdges(file: string): NativeIntraFileCallEdge[];
|
|
1676
|
+
getCallableNodes(): NativeCallableNodeRow[];
|
|
1677
|
+
getCallEdges(): NativeCallEdgeRow[];
|
|
1678
|
+
getFileNodesAll(): NativeFileNodeRow[];
|
|
1679
|
+
getImportEdges(): NativeImportGraphEdgeRow[];
|
|
1680
|
+
hasCfgTables(): boolean;
|
|
1681
|
+
hasEmbeddings(): boolean;
|
|
1682
|
+
hasDataflowTable(): boolean;
|
|
1683
|
+
getComplexityForNode(nodeId: number): NativeComplexityMetrics | null;
|
|
1684
|
+
bulkInsertNodes(batches: Array<{
|
|
1685
|
+
file: string;
|
|
1686
|
+
definitions: Array<{
|
|
1687
|
+
name: string;
|
|
1688
|
+
kind: string;
|
|
1689
|
+
line: number;
|
|
1690
|
+
endLine?: number;
|
|
1691
|
+
visibility?: string;
|
|
1692
|
+
children: Array<{
|
|
1693
|
+
name: string;
|
|
1694
|
+
kind: string;
|
|
1695
|
+
line: number;
|
|
1696
|
+
endLine?: number;
|
|
1697
|
+
visibility?: string;
|
|
1698
|
+
}>;
|
|
1699
|
+
}>;
|
|
1700
|
+
exports: Array<{
|
|
1701
|
+
name: string;
|
|
1702
|
+
kind: string;
|
|
1703
|
+
line: number;
|
|
1704
|
+
}>;
|
|
1705
|
+
}>, fileHashes: Array<{
|
|
1706
|
+
file: string;
|
|
1707
|
+
hash: string;
|
|
1708
|
+
mtime: number;
|
|
1709
|
+
size: number;
|
|
1710
|
+
}>, removedFiles: string[]): boolean;
|
|
1711
|
+
bulkInsertEdges(edges: Array<{
|
|
1712
|
+
sourceId: number;
|
|
1713
|
+
targetId: number;
|
|
1714
|
+
kind: string;
|
|
1715
|
+
confidence: number;
|
|
1716
|
+
dynamic: number;
|
|
1717
|
+
}>): boolean;
|
|
1718
|
+
bulkInsertAstNodes(batches: Array<{
|
|
1719
|
+
file: string;
|
|
1720
|
+
nodes: Array<{
|
|
1721
|
+
line: number;
|
|
1722
|
+
kind: string;
|
|
1723
|
+
name: string;
|
|
1724
|
+
text?: string | null;
|
|
1725
|
+
receiver?: string | null;
|
|
1726
|
+
}>;
|
|
1727
|
+
}>): number;
|
|
1728
|
+
bulkInsertComplexity?(rows: Array<{
|
|
1729
|
+
nodeId: number;
|
|
1730
|
+
cognitive: number;
|
|
1731
|
+
cyclomatic: number;
|
|
1732
|
+
maxNesting: number;
|
|
1733
|
+
loc: number;
|
|
1734
|
+
sloc: number;
|
|
1735
|
+
commentLines: number;
|
|
1736
|
+
halsteadN1: number;
|
|
1737
|
+
halsteadN2: number;
|
|
1738
|
+
halsteadBigN1: number;
|
|
1739
|
+
halsteadBigN2: number;
|
|
1740
|
+
halsteadVocabulary: number;
|
|
1741
|
+
halsteadLength: number;
|
|
1742
|
+
halsteadVolume: number;
|
|
1743
|
+
halsteadDifficulty: number;
|
|
1744
|
+
halsteadEffort: number;
|
|
1745
|
+
halsteadBugs: number;
|
|
1746
|
+
maintainabilityIndex: number;
|
|
1747
|
+
}>): number;
|
|
1748
|
+
bulkInsertCfg?(entries: Array<{
|
|
1749
|
+
nodeId: number;
|
|
1750
|
+
blocks: Array<{
|
|
1751
|
+
index: number;
|
|
1752
|
+
blockType: string;
|
|
1753
|
+
startLine?: number | null;
|
|
1754
|
+
endLine?: number | null;
|
|
1755
|
+
label?: string | null;
|
|
1756
|
+
}>;
|
|
1757
|
+
edges: Array<{
|
|
1758
|
+
sourceIndex: number;
|
|
1759
|
+
targetIndex: number;
|
|
1760
|
+
kind: string;
|
|
1761
|
+
}>;
|
|
1762
|
+
}>): number;
|
|
1763
|
+
bulkInsertDataflow?(edges: Array<{
|
|
1764
|
+
sourceId: number;
|
|
1765
|
+
targetId: number;
|
|
1766
|
+
kind: string;
|
|
1767
|
+
paramIndex?: number | null;
|
|
1768
|
+
expression?: string | null;
|
|
1769
|
+
line?: number | null;
|
|
1770
|
+
confidence: number;
|
|
1771
|
+
}>): number;
|
|
1772
|
+
classifyRolesFull(): {
|
|
1773
|
+
entry: number;
|
|
1774
|
+
core: number;
|
|
1775
|
+
utility: number;
|
|
1776
|
+
adapter: number;
|
|
1777
|
+
dead: number;
|
|
1778
|
+
deadLeaf: number;
|
|
1779
|
+
deadEntry: number;
|
|
1780
|
+
deadFfi: number;
|
|
1781
|
+
deadUnresolved: number;
|
|
1782
|
+
testOnly: number;
|
|
1783
|
+
leaf: number;
|
|
1784
|
+
} | null;
|
|
1785
|
+
classifyRolesIncremental(changedFiles: string[]): {
|
|
1786
|
+
entry: number;
|
|
1787
|
+
core: number;
|
|
1788
|
+
utility: number;
|
|
1789
|
+
adapter: number;
|
|
1790
|
+
dead: number;
|
|
1791
|
+
deadLeaf: number;
|
|
1792
|
+
deadEntry: number;
|
|
1793
|
+
deadFfi: number;
|
|
1794
|
+
deadUnresolved: number;
|
|
1795
|
+
testOnly: number;
|
|
1796
|
+
leaf: number;
|
|
1797
|
+
} | null;
|
|
1798
|
+
purgeFilesData(files: string[], purgeHashes?: boolean, reverseDepFiles?: string[]): void;
|
|
1799
|
+
/** All graph statistics in a single napi call (replaces ~11 queries in module-map). */
|
|
1800
|
+
getGraphStats?(noTests: boolean): {
|
|
1801
|
+
totalNodes: number;
|
|
1802
|
+
totalEdges: number;
|
|
1803
|
+
nodesByKind: Array<{
|
|
1804
|
+
kind: string;
|
|
1805
|
+
count: number;
|
|
1806
|
+
}>;
|
|
1807
|
+
edgesByKind: Array<{
|
|
1808
|
+
kind: string;
|
|
1809
|
+
count: number;
|
|
1810
|
+
}>;
|
|
1811
|
+
roleCounts: Array<{
|
|
1812
|
+
role: string;
|
|
1813
|
+
count: number;
|
|
1814
|
+
}>;
|
|
1815
|
+
quality: {
|
|
1816
|
+
callableTotal: number;
|
|
1817
|
+
callableWithCallers: number;
|
|
1818
|
+
callEdges: number;
|
|
1819
|
+
highConfCallEdges: number;
|
|
1820
|
+
};
|
|
1821
|
+
hotspots: Array<{
|
|
1822
|
+
file: string;
|
|
1823
|
+
fanIn: number;
|
|
1824
|
+
fanOut: number;
|
|
1825
|
+
}>;
|
|
1826
|
+
complexity: {
|
|
1827
|
+
analyzed: number;
|
|
1828
|
+
avgCognitive: number;
|
|
1829
|
+
avgCyclomatic: number;
|
|
1830
|
+
maxCognitive: number;
|
|
1831
|
+
maxCyclomatic: number;
|
|
1832
|
+
avgMi: number;
|
|
1833
|
+
minMi: number;
|
|
1834
|
+
} | null;
|
|
1835
|
+
embeddings: {
|
|
1836
|
+
count: number;
|
|
1837
|
+
model: string | null;
|
|
1838
|
+
dim: number | null;
|
|
1839
|
+
builtAt: string | null;
|
|
1840
|
+
} | null;
|
|
1841
|
+
};
|
|
1842
|
+
/** All 6 directional dataflow edge sets for a node in one call. */
|
|
1843
|
+
getDataflowEdges?(nodeId: number): {
|
|
1844
|
+
flowsToOut: Array<{
|
|
1845
|
+
name: string;
|
|
1846
|
+
kind: string;
|
|
1847
|
+
file: string;
|
|
1848
|
+
line: number | null;
|
|
1849
|
+
paramIndex: number | null;
|
|
1850
|
+
expression: string | null;
|
|
1851
|
+
confidence: number | null;
|
|
1852
|
+
}>;
|
|
1853
|
+
flowsToIn: Array<{
|
|
1854
|
+
name: string;
|
|
1855
|
+
kind: string;
|
|
1856
|
+
file: string;
|
|
1857
|
+
line: number | null;
|
|
1858
|
+
paramIndex: number | null;
|
|
1859
|
+
expression: string | null;
|
|
1860
|
+
confidence: number | null;
|
|
1861
|
+
}>;
|
|
1862
|
+
returnsOut: Array<{
|
|
1863
|
+
name: string;
|
|
1864
|
+
kind: string;
|
|
1865
|
+
file: string;
|
|
1866
|
+
line: number | null;
|
|
1867
|
+
paramIndex: number | null;
|
|
1868
|
+
expression: string | null;
|
|
1869
|
+
confidence: number | null;
|
|
1870
|
+
}>;
|
|
1871
|
+
returnsIn: Array<{
|
|
1872
|
+
name: string;
|
|
1873
|
+
kind: string;
|
|
1874
|
+
file: string;
|
|
1875
|
+
line: number | null;
|
|
1876
|
+
paramIndex: number | null;
|
|
1877
|
+
expression: string | null;
|
|
1878
|
+
confidence: number | null;
|
|
1879
|
+
}>;
|
|
1880
|
+
mutatesOut: Array<{
|
|
1881
|
+
name: string;
|
|
1882
|
+
kind: string;
|
|
1883
|
+
file: string;
|
|
1884
|
+
line: number | null;
|
|
1885
|
+
paramIndex: number | null;
|
|
1886
|
+
expression: string | null;
|
|
1887
|
+
confidence: number | null;
|
|
1888
|
+
}>;
|
|
1889
|
+
mutatesIn: Array<{
|
|
1890
|
+
name: string;
|
|
1891
|
+
kind: string;
|
|
1892
|
+
file: string;
|
|
1893
|
+
line: number | null;
|
|
1894
|
+
paramIndex: number | null;
|
|
1895
|
+
expression: string | null;
|
|
1896
|
+
confidence: number | null;
|
|
1897
|
+
}>;
|
|
1898
|
+
};
|
|
1899
|
+
/** Hotspot rows for a metric/kind/limit in one call. */
|
|
1900
|
+
getHotspots?(kind: string, metric: string, noTests: boolean, limit: number): Array<{
|
|
1901
|
+
name: string;
|
|
1902
|
+
kind: string;
|
|
1903
|
+
lineCount: number | null;
|
|
1904
|
+
symbolCount: number | null;
|
|
1905
|
+
importCount: number | null;
|
|
1906
|
+
exportCount: number | null;
|
|
1907
|
+
fanIn: number | null;
|
|
1908
|
+
fanOut: number | null;
|
|
1909
|
+
cohesion: number | null;
|
|
1910
|
+
fileCount: number | null;
|
|
1911
|
+
}>;
|
|
1912
|
+
/** Batch fan-in/fan-out for multiple node IDs in one call. */
|
|
1913
|
+
batchFanMetrics?(nodeIds: number[]): Array<{
|
|
1914
|
+
nodeId: number;
|
|
1915
|
+
fanIn: number;
|
|
1916
|
+
fanOut: number;
|
|
1917
|
+
}>;
|
|
1918
|
+
/** Execute a parameterized SELECT and return all rows as objects. */
|
|
1919
|
+
queryAll(sql: string, params: Array<string | number | null>): Record<string, unknown>[];
|
|
1920
|
+
/** Execute a parameterized SELECT and return the first row, or null. */
|
|
1921
|
+
queryGet(sql: string, params: Array<string | number | null>): Record<string, unknown> | null;
|
|
1922
|
+
/** Validate DB codegraph_version matches expected. Warns on mismatch. */
|
|
1923
|
+
validateSchemaVersion(expectedVersion: string): boolean;
|
|
1924
|
+
}
|
|
1522
1925
|
/** Shared context passed to every CLI command's execute/validate functions. */
|
|
1523
1926
|
export interface CommandContext {
|
|
1524
1927
|
config: Record<string, any>;
|