@optave/codegraph 3.4.0 → 3.5.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 +23 -22
- package/dist/ast-analysis/engine.d.ts.map +1 -1
- package/dist/ast-analysis/engine.js +3 -9
- 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/shared.d.ts.map +1 -1
- package/dist/ast-analysis/shared.js +0 -1
- package/dist/ast-analysis/shared.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 +103 -35
- package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -1
- package/dist/ast-analysis/visitors/cfg-conditionals.d.ts +5 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.js +166 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-loops.d.ts +7 -0
- package/dist/ast-analysis/visitors/cfg-loops.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-loops.js +73 -0
- package/dist/ast-analysis/visitors/cfg-loops.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-shared.d.ts +56 -0
- package/dist/ast-analysis/visitors/cfg-shared.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-shared.js +107 -0
- package/dist/ast-analysis/visitors/cfg-shared.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.d.ts +4 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.js +100 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts +2 -2
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/cfg-visitor.js +11 -445
- package/dist/ast-analysis/visitors/cfg-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.map +1 -1
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -1
- package/dist/cli/commands/batch.d.ts.map +1 -1
- package/dist/cli/commands/batch.js +4 -3
- package/dist/cli/commands/batch.js.map +1 -1
- package/dist/cli/commands/branch-compare.js +1 -1
- package/dist/cli/commands/branch-compare.js.map +1 -1
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +1 -2
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +7 -2
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/plot.d.ts.map +1 -1
- package/dist/cli/commands/plot.js +2 -2
- package/dist/cli/commands/plot.js.map +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/shared/open-graph.d.ts +2 -2
- package/dist/cli/shared/open-graph.d.ts.map +1 -1
- package/dist/cli/shared/open-graph.js.map +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli.js +2 -3
- package/dist/cli.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 +30 -2
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +167 -4
- 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 +9 -0
- 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/brief.d.ts.map +1 -1
- package/dist/domain/analysis/brief.js +1 -3
- package/dist/domain/analysis/brief.js.map +1 -1
- package/dist/domain/analysis/context.d.ts.map +1 -1
- package/dist/domain/analysis/context.js +2 -4
- package/dist/domain/analysis/context.js.map +1 -1
- package/dist/domain/analysis/dependencies.d.ts +49 -0
- package/dist/domain/analysis/dependencies.d.ts.map +1 -1
- package/dist/domain/analysis/dependencies.js +145 -0
- package/dist/domain/analysis/dependencies.js.map +1 -1
- package/dist/domain/analysis/diff-impact.d.ts +76 -0
- package/dist/domain/analysis/diff-impact.d.ts.map +1 -0
- package/dist/domain/analysis/diff-impact.js +282 -0
- package/dist/domain/analysis/diff-impact.js.map +1 -0
- package/dist/domain/analysis/exports.d.ts.map +1 -1
- package/dist/domain/analysis/exports.js +0 -1
- package/dist/domain/analysis/exports.js.map +1 -1
- package/dist/domain/analysis/fn-impact.d.ts +66 -0
- package/dist/domain/analysis/fn-impact.d.ts.map +1 -0
- package/dist/domain/analysis/fn-impact.js +189 -0
- package/dist/domain/analysis/fn-impact.js.map +1 -0
- package/dist/domain/analysis/impact.d.ts +8 -148
- package/dist/domain/analysis/impact.d.ts.map +1 -1
- package/dist/domain/analysis/impact.js +8 -568
- package/dist/domain/analysis/impact.js.map +1 -1
- package/dist/domain/analysis/module-map.d.ts.map +1 -1
- package/dist/domain/analysis/module-map.js +1 -3
- package/dist/domain/analysis/module-map.js.map +1 -1
- package/dist/domain/graph/builder/context.d.ts +3 -3
- 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 +4 -5
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -1
- package/dist/domain/graph/builder/helpers.js +1 -2
- package/dist/domain/graph/builder/helpers.js.map +1 -1
- package/dist/domain/graph/builder/incremental.d.ts +2 -3
- package/dist/domain/graph/builder/incremental.d.ts.map +1 -1
- 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 +34 -6
- 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 +113 -15
- 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 +186 -62
- 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 +71 -7
- 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 +42 -20
- 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 +111 -64
- 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 +104 -9
- 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 +58 -11
- package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -1
- package/dist/domain/graph/cycles.js +2 -2
- package/dist/domain/graph/cycles.js.map +1 -1
- package/dist/domain/graph/resolve.d.ts.map +1 -1
- package/dist/domain/graph/resolve.js +10 -8
- 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 +1 -3
- package/dist/domain/graph/watcher.js.map +1 -1
- package/dist/domain/parser.d.ts.map +1 -1
- package/dist/domain/parser.js +12 -12
- package/dist/domain/parser.js.map +1 -1
- package/dist/domain/queries.d.ts +3 -2
- package/dist/domain/queries.d.ts.map +1 -1
- package/dist/domain/queries.js +3 -2
- package/dist/domain/queries.js.map +1 -1
- package/dist/domain/search/generator.d.ts.map +1 -1
- package/dist/domain/search/generator.js.map +1 -1
- package/dist/extractors/csharp.js +2 -2
- package/dist/extractors/csharp.js.map +1 -1
- package/dist/extractors/go.js +2 -2
- package/dist/extractors/go.js.map +1 -1
- package/dist/extractors/helpers.d.ts +5 -0
- package/dist/extractors/helpers.d.ts.map +1 -1
- package/dist/extractors/helpers.js +5 -0
- package/dist/extractors/helpers.js.map +1 -1
- package/dist/extractors/javascript.js +111 -98
- package/dist/extractors/javascript.js.map +1 -1
- package/dist/extractors/php.js +2 -2
- package/dist/extractors/php.js.map +1 -1
- package/dist/extractors/python.js +2 -2
- package/dist/extractors/python.js.map +1 -1
- package/dist/extractors/rust.js +4 -3
- package/dist/extractors/rust.js.map +1 -1
- package/dist/features/ast.d.ts +14 -1
- package/dist/features/ast.d.ts.map +1 -1
- package/dist/features/ast.js +38 -1
- package/dist/features/ast.js.map +1 -1
- package/dist/features/audit.d.ts.map +1 -1
- package/dist/features/audit.js +1 -2
- package/dist/features/audit.js.map +1 -1
- package/dist/features/branch-compare.d.ts.map +1 -1
- package/dist/features/branch-compare.js +5 -4
- package/dist/features/branch-compare.js.map +1 -1
- package/dist/features/cfg.d.ts.map +1 -1
- package/dist/features/cfg.js +2 -4
- package/dist/features/cfg.js.map +1 -1
- package/dist/features/cochange.js +4 -4
- package/dist/features/cochange.js.map +1 -1
- package/dist/features/communities.js +4 -4
- package/dist/features/communities.js.map +1 -1
- package/dist/features/complexity-query.d.ts +37 -0
- package/dist/features/complexity-query.d.ts.map +1 -0
- package/dist/features/complexity-query.js +263 -0
- package/dist/features/complexity-query.js.map +1 -0
- package/dist/features/complexity.d.ts +2 -30
- package/dist/features/complexity.d.ts.map +1 -1
- package/dist/features/complexity.js +7 -261
- package/dist/features/complexity.js.map +1 -1
- package/dist/features/dataflow.d.ts.map +1 -1
- package/dist/features/dataflow.js +8 -24
- package/dist/features/dataflow.js.map +1 -1
- package/dist/features/export.d.ts +7 -8
- package/dist/features/export.d.ts.map +1 -1
- package/dist/features/export.js.map +1 -1
- package/dist/features/flow.d.ts.map +1 -1
- package/dist/features/flow.js.map +1 -1
- package/dist/features/graph-enrichment.d.ts.map +1 -1
- package/dist/features/graph-enrichment.js +1 -3
- package/dist/features/graph-enrichment.js.map +1 -1
- package/dist/features/manifesto.js +8 -8
- package/dist/features/manifesto.js.map +1 -1
- package/dist/features/snapshot.js +2 -2
- package/dist/features/snapshot.js.map +1 -1
- package/dist/features/structure-query.d.ts +76 -0
- package/dist/features/structure-query.d.ts.map +1 -0
- package/dist/features/structure-query.js +245 -0
- package/dist/features/structure-query.js.map +1 -0
- package/dist/features/structure.d.ts +12 -67
- package/dist/features/structure.d.ts.map +1 -1
- package/dist/features/structure.js +188 -244
- package/dist/features/structure.js.map +1 -1
- package/dist/features/triage.js +2 -2
- package/dist/features/triage.js.map +1 -1
- package/dist/graph/algorithms/leiden/adapter.d.ts.map +1 -1
- package/dist/graph/algorithms/leiden/adapter.js +2 -9
- package/dist/graph/algorithms/leiden/adapter.js.map +1 -1
- package/dist/graph/classifiers/roles.d.ts +5 -1
- package/dist/graph/classifiers/roles.d.ts.map +1 -1
- package/dist/graph/classifiers/roles.js +20 -12
- package/dist/graph/classifiers/roles.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/config.d.ts.map +1 -1
- package/dist/infrastructure/config.js +12 -11
- package/dist/infrastructure/config.js.map +1 -1
- package/dist/infrastructure/native.d.ts.map +1 -1
- package/dist/infrastructure/native.js +7 -3
- package/dist/infrastructure/native.js.map +1 -1
- package/dist/infrastructure/registry.d.ts.map +1 -1
- package/dist/infrastructure/registry.js +1 -1
- package/dist/infrastructure/registry.js.map +1 -1
- package/dist/infrastructure/update-check.js +3 -3
- package/dist/infrastructure/update-check.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +4 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +9 -4
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/audit.js +1 -1
- package/dist/mcp/tools/audit.js.map +1 -1
- package/dist/mcp/tools/cfg.js +1 -1
- package/dist/mcp/tools/cfg.js.map +1 -1
- package/dist/mcp/tools/check.js +2 -2
- package/dist/mcp/tools/check.js.map +1 -1
- package/dist/mcp/tools/dataflow.js +2 -2
- package/dist/mcp/tools/dataflow.js.map +1 -1
- package/dist/mcp/tools/export-graph.js +1 -1
- package/dist/mcp/tools/export-graph.js.map +1 -1
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/path.d.ts +1 -0
- package/dist/mcp/tools/path.d.ts.map +1 -1
- package/dist/mcp/tools/path.js +9 -0
- package/dist/mcp/tools/path.js.map +1 -1
- package/dist/mcp/tools/query.js +1 -1
- package/dist/mcp/tools/query.js.map +1 -1
- package/dist/mcp/tools/semantic-search.js +1 -1
- package/dist/mcp/tools/semantic-search.js.map +1 -1
- package/dist/mcp/tools/sequence.js +1 -1
- package/dist/mcp/tools/sequence.js.map +1 -1
- package/dist/mcp/tools/symbol-children.js +1 -1
- package/dist/mcp/tools/symbol-children.js.map +1 -1
- package/dist/mcp/tools/triage.js +1 -1
- package/dist/mcp/tools/triage.js.map +1 -1
- package/dist/presentation/audit.d.ts.map +1 -1
- package/dist/presentation/audit.js +0 -1
- package/dist/presentation/audit.js.map +1 -1
- package/dist/presentation/diff-impact-mermaid.d.ts +11 -0
- package/dist/presentation/diff-impact-mermaid.d.ts.map +1 -0
- package/dist/presentation/diff-impact-mermaid.js +105 -0
- package/dist/presentation/diff-impact-mermaid.js.map +1 -0
- package/dist/presentation/flow.d.ts.map +1 -1
- package/dist/presentation/flow.js +0 -2
- package/dist/presentation/flow.js.map +1 -1
- package/dist/presentation/manifesto.d.ts.map +1 -1
- package/dist/presentation/manifesto.js +0 -1
- package/dist/presentation/manifesto.js.map +1 -1
- package/dist/presentation/queries-cli/inspect.d.ts.map +1 -1
- package/dist/presentation/queries-cli/inspect.js.map +1 -1
- package/dist/presentation/queries-cli/path.d.ts.map +1 -1
- package/dist/presentation/queries-cli/path.js +45 -1
- package/dist/presentation/queries-cli/path.js.map +1 -1
- package/dist/presentation/result-formatter.d.ts.map +1 -1
- package/dist/presentation/result-formatter.js +1 -3
- package/dist/presentation/result-formatter.js.map +1 -1
- package/dist/presentation/sequence.d.ts.map +1 -1
- package/dist/presentation/sequence.js +0 -1
- package/dist/presentation/sequence.js.map +1 -1
- package/dist/presentation/structure.d.ts.map +1 -1
- package/dist/presentation/structure.js.map +1 -1
- package/dist/presentation/triage.d.ts.map +1 -1
- package/dist/presentation/triage.js +0 -1
- package/dist/presentation/triage.js.map +1 -1
- package/dist/shared/constants.d.ts +9 -3
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +6 -3
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/errors.d.ts +2 -0
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +4 -0
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/version.d.ts +2 -0
- package/dist/shared/version.d.ts.map +1 -0
- package/dist/shared/version.js +5 -0
- package/dist/shared/version.js.map +1 -0
- package/dist/types.d.ts +230 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +62 -11
- package/src/ast-analysis/engine.ts +3 -9
- package/src/ast-analysis/rules/javascript.ts +1 -0
- package/src/ast-analysis/shared.ts +0 -1
- package/src/ast-analysis/visitors/ast-store-visitor.ts +102 -33
- package/src/ast-analysis/visitors/cfg-conditionals.ts +227 -0
- package/src/ast-analysis/visitors/cfg-loops.ts +136 -0
- package/src/ast-analysis/visitors/cfg-shared.ts +196 -0
- package/src/ast-analysis/visitors/cfg-try-catch.ts +142 -0
- package/src/ast-analysis/visitors/cfg-visitor.ts +34 -655
- package/src/ast-analysis/visitors/complexity-visitor.ts +0 -1
- package/src/ast-analysis/visitors/dataflow-visitor.ts +0 -1
- package/src/cli/commands/batch.ts +4 -3
- package/src/cli/commands/branch-compare.ts +1 -1
- package/src/cli/commands/build.ts +1 -1
- package/src/cli/commands/info.ts +1 -2
- package/src/cli/commands/path.ts +7 -2
- package/src/cli/commands/plot.ts +2 -2
- package/src/cli/commands/watch.ts +1 -1
- package/src/cli/index.ts +2 -2
- package/src/cli/shared/open-graph.ts +2 -2
- package/src/cli/types.ts +1 -1
- package/src/cli.ts +2 -3
- package/src/db/better-sqlite3.ts +20 -0
- package/src/db/connection.ts +191 -16
- package/src/db/index.ts +5 -1
- package/src/db/migrations.ts +9 -0
- 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/brief.ts +0 -1
- package/src/domain/analysis/context.ts +2 -6
- package/src/domain/analysis/dependencies.ts +165 -0
- package/src/domain/analysis/diff-impact.ts +354 -0
- package/src/domain/analysis/exports.ts +0 -2
- package/src/domain/analysis/fn-impact.ts +241 -0
- package/src/domain/analysis/impact.ts +8 -718
- package/src/domain/analysis/module-map.ts +1 -5
- package/src/domain/graph/builder/context.ts +4 -2
- package/src/domain/graph/builder/helpers.ts +14 -11
- package/src/domain/graph/builder/incremental.ts +33 -28
- package/src/domain/graph/builder/pipeline.ts +37 -5
- package/src/domain/graph/builder/stages/build-edges.ts +131 -20
- package/src/domain/graph/builder/stages/build-structure.ts +245 -80
- package/src/domain/graph/builder/stages/collect-files.ts +84 -7
- package/src/domain/graph/builder/stages/detect-changes.ts +49 -32
- package/src/domain/graph/builder/stages/finalize.ts +132 -84
- package/src/domain/graph/builder/stages/insert-nodes.ts +141 -18
- package/src/domain/graph/builder/stages/resolve-imports.ts +75 -10
- package/src/domain/graph/cycles.ts +2 -2
- package/src/domain/graph/resolve.ts +14 -8
- package/src/domain/graph/watcher.ts +2 -4
- package/src/domain/parser.ts +12 -13
- package/src/domain/queries.ts +2 -2
- package/src/domain/search/generator.ts +3 -4
- package/src/extractors/csharp.ts +2 -2
- package/src/extractors/go.ts +2 -2
- package/src/extractors/helpers.ts +6 -0
- package/src/extractors/javascript.ts +112 -97
- package/src/extractors/php.ts +2 -2
- package/src/extractors/python.ts +2 -2
- package/src/extractors/rust.ts +4 -3
- package/src/features/ast.ts +66 -1
- package/src/features/audit.ts +1 -2
- package/src/features/branch-compare.ts +6 -10
- package/src/features/cfg.ts +2 -4
- package/src/features/cochange.ts +4 -4
- package/src/features/communities.ts +4 -4
- package/src/features/complexity-query.ts +370 -0
- package/src/features/complexity.ts +6 -365
- package/src/features/dataflow.ts +48 -70
- package/src/features/export.ts +12 -16
- package/src/features/flow.ts +0 -1
- package/src/features/graph-enrichment.ts +1 -3
- package/src/features/manifesto.ts +8 -8
- package/src/features/snapshot.ts +3 -3
- package/src/features/structure-query.ts +387 -0
- package/src/features/structure.ts +231 -376
- package/src/features/triage.ts +2 -2
- package/src/graph/algorithms/leiden/adapter.ts +2 -9
- package/src/graph/classifiers/roles.ts +22 -13
- package/src/index.ts +1 -0
- package/src/infrastructure/config.ts +12 -13
- package/src/infrastructure/native.ts +7 -3
- package/src/infrastructure/registry.ts +1 -1
- package/src/infrastructure/update-check.ts +3 -3
- package/src/mcp/server.ts +4 -20
- package/src/mcp/tool-registry.ts +11 -4
- package/src/mcp/tools/audit.ts +1 -1
- package/src/mcp/tools/cfg.ts +1 -1
- package/src/mcp/tools/check.ts +2 -2
- package/src/mcp/tools/dataflow.ts +2 -2
- package/src/mcp/tools/export-graph.ts +1 -1
- package/src/mcp/tools/index.ts +0 -1
- package/src/mcp/tools/path.ts +10 -0
- package/src/mcp/tools/query.ts +1 -1
- package/src/mcp/tools/semantic-search.ts +1 -1
- package/src/mcp/tools/sequence.ts +1 -1
- package/src/mcp/tools/symbol-children.ts +1 -1
- package/src/mcp/tools/triage.ts +1 -1
- package/src/presentation/audit.ts +0 -1
- package/src/presentation/diff-impact-mermaid.ts +127 -0
- package/src/presentation/flow.ts +0 -2
- package/src/presentation/manifesto.ts +0 -1
- package/src/presentation/queries-cli/inspect.ts +0 -1
- package/src/presentation/queries-cli/path.ts +71 -1
- package/src/presentation/result-formatter.ts +0 -1
- package/src/presentation/sequence.ts +0 -1
- package/src/presentation/structure.ts +0 -12
- package/src/presentation/triage.ts +0 -1
- package/src/shared/constants.ts +33 -19
- package/src/shared/errors.ts +5 -0
- package/src/shared/version.ts +10 -0
- package/src/types.ts +277 -10
- package/src/vendor.d.ts +0 -39
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { kindIcon, pathData } from '../../domain/queries.js';
|
|
1
|
+
import { filePathData, kindIcon, pathData } from '../../domain/queries.js';
|
|
2
2
|
import { outputResult } from '../../infrastructure/result-formatter.js';
|
|
3
3
|
|
|
4
4
|
interface PathCandidate {
|
|
@@ -80,6 +80,11 @@ export function symbolPath(
|
|
|
80
80
|
customDbPath: string,
|
|
81
81
|
opts: PathOpts = {},
|
|
82
82
|
): void {
|
|
83
|
+
if (opts.file) {
|
|
84
|
+
filePath(from, to, customDbPath, opts);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
83
88
|
const data = pathData(from, to, customDbPath, opts) as PathDataResult;
|
|
84
89
|
if (outputResult(data as unknown as Record<string, unknown>, null, opts)) return;
|
|
85
90
|
|
|
@@ -107,3 +112,68 @@ export function symbolPath(
|
|
|
107
112
|
printPathSteps(data);
|
|
108
113
|
console.log();
|
|
109
114
|
}
|
|
115
|
+
|
|
116
|
+
// ── File-level path ──────────────────────────────────────────────────────
|
|
117
|
+
|
|
118
|
+
interface FilePathDataResult {
|
|
119
|
+
error?: string;
|
|
120
|
+
found?: boolean;
|
|
121
|
+
hops?: number | null;
|
|
122
|
+
reverse?: boolean;
|
|
123
|
+
maxDepth?: number;
|
|
124
|
+
path: string[];
|
|
125
|
+
fromCandidates: string[];
|
|
126
|
+
toCandidates: string[];
|
|
127
|
+
alternateCount: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function filePath(from: string, to: string, customDbPath: string, opts: PathOpts = {}): void {
|
|
131
|
+
const data = filePathData(from, to, customDbPath, opts) as FilePathDataResult;
|
|
132
|
+
if (outputResult(data as unknown as Record<string, unknown>, null, opts)) return;
|
|
133
|
+
|
|
134
|
+
if (data.error) {
|
|
135
|
+
console.log(data.error);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!data.found) {
|
|
140
|
+
const dir = data.reverse ? 'reverse ' : '';
|
|
141
|
+
console.log(`No ${dir}file path from "${from}" to "${to}" within ${data.maxDepth} hops.`);
|
|
142
|
+
if (data.fromCandidates.length > 1) {
|
|
143
|
+
console.log(
|
|
144
|
+
`\n "${from}" matched ${data.fromCandidates.length} files — using: ${data.fromCandidates[0]}`,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
if (data.toCandidates.length > 1) {
|
|
148
|
+
console.log(
|
|
149
|
+
` "${to}" matched ${data.toCandidates.length} files — using: ${data.toCandidates[0]}`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (data.hops === 0) {
|
|
156
|
+
console.log(`\n"${from}" and "${to}" resolve to the same file (0 hops):`);
|
|
157
|
+
console.log(` ${data.path[0]}\n`);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const dir = data.reverse ? ' (reverse)' : '';
|
|
162
|
+
console.log(
|
|
163
|
+
`\nFile path from ${from} to ${to} (${data.hops} ${data.hops === 1 ? 'hop' : 'hops'})${dir}:\n`,
|
|
164
|
+
);
|
|
165
|
+
for (let i = 0; i < data.path.length; i++) {
|
|
166
|
+
const indent = ' '.repeat(i + 1);
|
|
167
|
+
if (i === 0) {
|
|
168
|
+
console.log(`${indent}${data.path[i]}`);
|
|
169
|
+
} else {
|
|
170
|
+
console.log(`${indent}→ ${data.path[i]}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (data.alternateCount > 0) {
|
|
174
|
+
console.log(
|
|
175
|
+
`\n (${data.alternateCount} alternate shortest ${data.alternateCount === 1 ? 'path' : 'paths'} at same depth)`,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
console.log();
|
|
179
|
+
}
|
|
@@ -16,7 +16,6 @@ interface SequenceOpts {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function sequence(name: string, dbPath: string | undefined, opts: SequenceOpts = {}): void {
|
|
19
|
-
// biome-ignore lint/suspicious/noExplicitAny: dynamic shape from sequenceData
|
|
20
19
|
const data = sequenceData(name, dbPath, opts) as any;
|
|
21
20
|
|
|
22
21
|
if (outputResult(data, 'messages', opts)) return;
|
|
@@ -49,22 +49,10 @@ export function formatStructure(data: StructureResult): string {
|
|
|
49
49
|
return lines.join('\n');
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
interface HotspotEntry {
|
|
53
|
-
name: string;
|
|
54
|
-
kind: string;
|
|
55
|
-
fileCount?: number;
|
|
56
|
-
cohesion?: number | null;
|
|
57
|
-
lineCount?: number;
|
|
58
|
-
symbolCount?: number;
|
|
59
|
-
fanIn?: number;
|
|
60
|
-
fanOut?: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
52
|
interface HotspotsResult {
|
|
64
53
|
metric: string;
|
|
65
54
|
level: string;
|
|
66
55
|
limit: number;
|
|
67
|
-
// biome-ignore lint/suspicious/noExplicitAny: hotspots shape varies by level
|
|
68
56
|
hotspots: any[];
|
|
69
57
|
}
|
|
70
58
|
|
|
@@ -37,7 +37,6 @@ interface TriageSummary {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export function triage(customDbPath: string | undefined, opts: TriageOpts = {}): void {
|
|
40
|
-
// biome-ignore lint/suspicious/noExplicitAny: dynamic shape from triageData
|
|
41
40
|
const data = triageData(customDbPath, opts as any) as {
|
|
42
41
|
items: TriageItem[];
|
|
43
42
|
summary: TriageSummary;
|
package/src/shared/constants.ts
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { SUPPORTED_EXTENSIONS } from '../domain/parser.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Set with a `.toArray()` convenience method for consumers migrating from
|
|
6
|
+
* the pre-3.4 Array-based API (where `.includes()` / `.indexOf()` worked).
|
|
7
|
+
*/
|
|
8
|
+
export interface ArrayCompatSet<T> extends Set<T> {
|
|
9
|
+
toArray(): T[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function withArrayCompat<T>(s: Set<T>): ArrayCompatSet<T> {
|
|
13
|
+
return Object.assign(s, { toArray: () => [...s] });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const IGNORE_DIRS: ArrayCompatSet<string> = withArrayCompat(
|
|
17
|
+
new Set([
|
|
18
|
+
'node_modules',
|
|
19
|
+
'.git',
|
|
20
|
+
'dist',
|
|
21
|
+
'build',
|
|
22
|
+
'.next',
|
|
23
|
+
'.nuxt',
|
|
24
|
+
'.svelte-kit',
|
|
25
|
+
'coverage',
|
|
26
|
+
'.codegraph',
|
|
27
|
+
'__pycache__',
|
|
28
|
+
'.tox',
|
|
29
|
+
'vendor',
|
|
30
|
+
'.venv',
|
|
31
|
+
'venv',
|
|
32
|
+
'env',
|
|
33
|
+
'.env',
|
|
34
|
+
]),
|
|
35
|
+
);
|
|
22
36
|
|
|
23
|
-
export
|
|
37
|
+
export const EXTENSIONS: ArrayCompatSet<string> = withArrayCompat(new Set(SUPPORTED_EXTENSIONS));
|
|
24
38
|
|
|
25
39
|
export function shouldIgnore(dirName: string): boolean {
|
|
26
40
|
return IGNORE_DIRS.has(dirName) || dirName.startsWith('.');
|
package/src/shared/errors.ts
CHANGED
|
@@ -72,3 +72,8 @@ export class BoundaryError extends CodegraphError {
|
|
|
72
72
|
this.name = 'BoundaryError';
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
/** Safely extract a string message from an unknown thrown value. */
|
|
77
|
+
export function toErrorMessage(e: unknown): string {
|
|
78
|
+
return e instanceof Error ? e.message : String(e);
|
|
79
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const __sharedDir = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/i, '$1'));
|
|
5
|
+
|
|
6
|
+
export const CODEGRAPH_VERSION: string = (
|
|
7
|
+
JSON.parse(fs.readFileSync(path.join(__sharedDir, '..', '..', 'package.json'), 'utf-8')) as {
|
|
8
|
+
version: string;
|
|
9
|
+
}
|
|
10
|
+
).version;
|
package/src/types.ts
CHANGED
|
@@ -881,6 +881,8 @@ export interface EngineOpts {
|
|
|
881
881
|
engine: EngineMode;
|
|
882
882
|
dataflow: boolean;
|
|
883
883
|
ast: boolean;
|
|
884
|
+
/** Persistent NativeDatabase connection for build writes (Phase 6.15). */
|
|
885
|
+
nativeDb?: NativeDatabase;
|
|
884
886
|
}
|
|
885
887
|
|
|
886
888
|
/** A file change detected during incremental builds. */
|
|
@@ -1774,8 +1776,9 @@ export interface BetterSqlite3Database {
|
|
|
1774
1776
|
exec(sql: string): this;
|
|
1775
1777
|
close(): void;
|
|
1776
1778
|
pragma(sql: string): unknown;
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
+
transaction<F extends (...args: any[]) => any>(
|
|
1780
|
+
fn: F,
|
|
1781
|
+
): (...args: F extends (...a: infer A) => unknown ? A : never) => ReturnType<F>;
|
|
1779
1782
|
readonly open: boolean;
|
|
1780
1783
|
readonly name: string;
|
|
1781
1784
|
}
|
|
@@ -1803,6 +1806,10 @@ export interface NativeAddon {
|
|
|
1803
1806
|
buildCallEdges(files: unknown[], nodes: unknown[], builtinReceivers: string[]): unknown[];
|
|
1804
1807
|
engineVersion(): string;
|
|
1805
1808
|
ParseTreeCache: new () => NativeParseTreeCache;
|
|
1809
|
+
NativeDatabase: {
|
|
1810
|
+
openReadWrite(dbPath: string): NativeDatabase;
|
|
1811
|
+
openReadonly(dbPath: string): NativeDatabase;
|
|
1812
|
+
};
|
|
1806
1813
|
}
|
|
1807
1814
|
|
|
1808
1815
|
/** Native parse-tree cache instance. */
|
|
@@ -1813,20 +1820,283 @@ export interface NativeParseTreeCache {
|
|
|
1813
1820
|
clear(): void;
|
|
1814
1821
|
}
|
|
1815
1822
|
|
|
1823
|
+
/** Row types returned by NativeDatabase query methods (auto-generated by napi-rs). */
|
|
1824
|
+
export interface NativeNodeRow {
|
|
1825
|
+
id: number;
|
|
1826
|
+
name: string;
|
|
1827
|
+
kind: string;
|
|
1828
|
+
file: string;
|
|
1829
|
+
line: number | null;
|
|
1830
|
+
endLine: number | null;
|
|
1831
|
+
parentId: number | null;
|
|
1832
|
+
exported: number | null;
|
|
1833
|
+
qualifiedName: string | null;
|
|
1834
|
+
scope: string | null;
|
|
1835
|
+
visibility: string | null;
|
|
1836
|
+
role: string | null;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
export interface NativeNodeRowWithFanIn extends NativeNodeRow {
|
|
1840
|
+
fanIn: number;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
export interface NativeTriageNodeRow extends NativeNodeRow {
|
|
1844
|
+
fanIn: number;
|
|
1845
|
+
cognitive: number;
|
|
1846
|
+
mi: number;
|
|
1847
|
+
cyclomatic: number;
|
|
1848
|
+
maxNesting: number;
|
|
1849
|
+
churn: number;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
export interface NativeNodeIdRow {
|
|
1853
|
+
id: number;
|
|
1854
|
+
name: string;
|
|
1855
|
+
kind: string;
|
|
1856
|
+
line: number | null;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
export interface NativeChildNodeRow {
|
|
1860
|
+
name: string;
|
|
1861
|
+
kind: string;
|
|
1862
|
+
line: number | null;
|
|
1863
|
+
endLine: number | null;
|
|
1864
|
+
qualifiedName: string | null;
|
|
1865
|
+
scope: string | null;
|
|
1866
|
+
visibility: string | null;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
export interface NativeRelatedNodeRow {
|
|
1870
|
+
id: number;
|
|
1871
|
+
name: string;
|
|
1872
|
+
kind: string;
|
|
1873
|
+
file: string;
|
|
1874
|
+
line: number | null;
|
|
1875
|
+
endLine: number | null;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
export interface NativeAdjacentEdgeRow {
|
|
1879
|
+
name: string;
|
|
1880
|
+
kind: string;
|
|
1881
|
+
file: string;
|
|
1882
|
+
line: number | null;
|
|
1883
|
+
edgeKind: string;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
export interface NativeImportEdgeRow {
|
|
1887
|
+
file: string;
|
|
1888
|
+
edgeKind: string;
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
export interface NativeIntraFileCallEdge {
|
|
1892
|
+
callerName: string;
|
|
1893
|
+
calleeName: string;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
export interface NativeCallableNodeRow {
|
|
1897
|
+
id: number;
|
|
1898
|
+
name: string;
|
|
1899
|
+
kind: string;
|
|
1900
|
+
file: string;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
export interface NativeCallEdgeRow {
|
|
1904
|
+
sourceId: number;
|
|
1905
|
+
targetId: number;
|
|
1906
|
+
confidence: number | null;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
export interface NativeFileNodeRow {
|
|
1910
|
+
id: number;
|
|
1911
|
+
name: string;
|
|
1912
|
+
file: string;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
export interface NativeImportGraphEdgeRow {
|
|
1916
|
+
sourceId: number;
|
|
1917
|
+
targetId: number;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
export interface NativeComplexityMetrics {
|
|
1921
|
+
cognitive: number;
|
|
1922
|
+
cyclomatic: number;
|
|
1923
|
+
maxNesting: number;
|
|
1924
|
+
maintainabilityIndex: number | null;
|
|
1925
|
+
halsteadVolume: number | null;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
/** Native rusqlite database wrapper instance (Phase 6.13 + 6.14 + 6.15). */
|
|
1929
|
+
export interface NativeDatabase {
|
|
1930
|
+
// ── Lifecycle (6.13) ────────────────────────────────────────────────
|
|
1931
|
+
initSchema(): void;
|
|
1932
|
+
getBuildMeta(key: string): string | null;
|
|
1933
|
+
setBuildMeta(entries: Array<{ key: string; value: string }>): void;
|
|
1934
|
+
exec(sql: string): void;
|
|
1935
|
+
pragma(sql: string): string | null;
|
|
1936
|
+
close(): void;
|
|
1937
|
+
readonly dbPath: string;
|
|
1938
|
+
readonly isOpen: boolean;
|
|
1939
|
+
|
|
1940
|
+
// ── Node lookups (6.14) ──────────────────────────────────────────────
|
|
1941
|
+
countNodes(): number;
|
|
1942
|
+
countEdges(): number;
|
|
1943
|
+
countFiles(): number;
|
|
1944
|
+
findNodeById(id: number): NativeNodeRow | null;
|
|
1945
|
+
getNodeId(name: string, kind: string, file: string, line: number): number | null;
|
|
1946
|
+
getFunctionNodeId(name: string, file: string, line: number): number | null;
|
|
1947
|
+
bulkNodeIdsByFile(file: string): NativeNodeIdRow[];
|
|
1948
|
+
findNodeChildren(parentId: number): NativeChildNodeRow[];
|
|
1949
|
+
findNodesByFile(file: string): NativeNodeRow[];
|
|
1950
|
+
findFileNodes(fileLike: string): NativeNodeRow[];
|
|
1951
|
+
findNodesByScope(
|
|
1952
|
+
scopeName: string,
|
|
1953
|
+
kind: string | null | undefined,
|
|
1954
|
+
file: string | null | undefined,
|
|
1955
|
+
): NativeNodeRow[];
|
|
1956
|
+
findNodeByQualifiedName(qualifiedName: string, file: string | null | undefined): NativeNodeRow[];
|
|
1957
|
+
findNodesWithFanIn(
|
|
1958
|
+
namePattern: string,
|
|
1959
|
+
kinds: string[] | null | undefined,
|
|
1960
|
+
file: string | null | undefined,
|
|
1961
|
+
): NativeNodeRowWithFanIn[];
|
|
1962
|
+
findNodesForTriage(
|
|
1963
|
+
kind: string | null | undefined,
|
|
1964
|
+
role: string | null | undefined,
|
|
1965
|
+
file: string | null | undefined,
|
|
1966
|
+
noTests: boolean | null | undefined,
|
|
1967
|
+
): NativeTriageNodeRow[];
|
|
1968
|
+
listFunctionNodes(
|
|
1969
|
+
file: string | null | undefined,
|
|
1970
|
+
pattern: string | null | undefined,
|
|
1971
|
+
noTests: boolean | null | undefined,
|
|
1972
|
+
): NativeNodeRow[];
|
|
1973
|
+
iterateFunctionNodes(
|
|
1974
|
+
file: string | null | undefined,
|
|
1975
|
+
pattern: string | null | undefined,
|
|
1976
|
+
noTests: boolean | null | undefined,
|
|
1977
|
+
): NativeNodeRow[];
|
|
1978
|
+
|
|
1979
|
+
// ── Edge queries (6.14) ──────────────────────────────────────────────
|
|
1980
|
+
findCallees(nodeId: number): NativeRelatedNodeRow[];
|
|
1981
|
+
findCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
1982
|
+
findDistinctCallers(nodeId: number): NativeRelatedNodeRow[];
|
|
1983
|
+
findAllOutgoingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
1984
|
+
findAllIncomingEdges(nodeId: number): NativeAdjacentEdgeRow[];
|
|
1985
|
+
findCalleeNames(nodeId: number): string[];
|
|
1986
|
+
findCallerNames(nodeId: number): string[];
|
|
1987
|
+
findImportTargets(nodeId: number): NativeImportEdgeRow[];
|
|
1988
|
+
findImportSources(nodeId: number): NativeImportEdgeRow[];
|
|
1989
|
+
findImportDependents(nodeId: number): NativeNodeRow[];
|
|
1990
|
+
findCrossFileCallTargets(file: string): number[];
|
|
1991
|
+
countCrossFileCallers(nodeId: number, file: string): number;
|
|
1992
|
+
getClassHierarchy(classNodeId: number): number[];
|
|
1993
|
+
findImplementors(nodeId: number): NativeRelatedNodeRow[];
|
|
1994
|
+
findInterfaces(nodeId: number): NativeRelatedNodeRow[];
|
|
1995
|
+
findIntraFileCallEdges(file: string): NativeIntraFileCallEdge[];
|
|
1996
|
+
|
|
1997
|
+
// ── Graph-read queries (6.14) ────────────────────────────────────────
|
|
1998
|
+
getCallableNodes(): NativeCallableNodeRow[];
|
|
1999
|
+
getCallEdges(): NativeCallEdgeRow[];
|
|
2000
|
+
getFileNodesAll(): NativeFileNodeRow[];
|
|
2001
|
+
getImportEdges(): NativeImportGraphEdgeRow[];
|
|
2002
|
+
|
|
2003
|
+
// ── Table checks (6.14) ──────────────────────────────────────────────
|
|
2004
|
+
hasCfgTables(): boolean;
|
|
2005
|
+
hasEmbeddings(): boolean;
|
|
2006
|
+
hasDataflowTable(): boolean;
|
|
2007
|
+
getComplexityForNode(nodeId: number): NativeComplexityMetrics | null;
|
|
2008
|
+
|
|
2009
|
+
// ── Build pipeline writes (6.15) ───────────────────────────────────
|
|
2010
|
+
bulkInsertNodes(
|
|
2011
|
+
batches: Array<{
|
|
2012
|
+
file: string;
|
|
2013
|
+
definitions: Array<{
|
|
2014
|
+
name: string;
|
|
2015
|
+
kind: string;
|
|
2016
|
+
line: number;
|
|
2017
|
+
endLine?: number | null;
|
|
2018
|
+
visibility?: string | null;
|
|
2019
|
+
children: Array<{
|
|
2020
|
+
name: string;
|
|
2021
|
+
kind: string;
|
|
2022
|
+
line: number;
|
|
2023
|
+
endLine?: number | null;
|
|
2024
|
+
visibility?: string | null;
|
|
2025
|
+
}>;
|
|
2026
|
+
}>;
|
|
2027
|
+
exports: Array<{ name: string; kind: string; line: number }>;
|
|
2028
|
+
}>,
|
|
2029
|
+
fileHashes: Array<{ file: string; hash: string; mtime: number; size: number }>,
|
|
2030
|
+
removedFiles: string[],
|
|
2031
|
+
): boolean;
|
|
2032
|
+
bulkInsertEdges(
|
|
2033
|
+
edges: Array<{
|
|
2034
|
+
sourceId: number;
|
|
2035
|
+
targetId: number;
|
|
2036
|
+
kind: string;
|
|
2037
|
+
confidence: number;
|
|
2038
|
+
dynamic: number;
|
|
2039
|
+
}>,
|
|
2040
|
+
): boolean;
|
|
2041
|
+
bulkInsertAstNodes(
|
|
2042
|
+
batches: Array<{
|
|
2043
|
+
file: string;
|
|
2044
|
+
nodes: Array<{
|
|
2045
|
+
line: number;
|
|
2046
|
+
kind: string;
|
|
2047
|
+
name: string;
|
|
2048
|
+
text?: string | null;
|
|
2049
|
+
receiver?: string | null;
|
|
2050
|
+
}>;
|
|
2051
|
+
}>,
|
|
2052
|
+
): number;
|
|
2053
|
+
classifyRolesFull(): {
|
|
2054
|
+
entry: number;
|
|
2055
|
+
core: number;
|
|
2056
|
+
utility: number;
|
|
2057
|
+
adapter: number;
|
|
2058
|
+
dead: number;
|
|
2059
|
+
deadLeaf: number;
|
|
2060
|
+
deadEntry: number;
|
|
2061
|
+
deadFfi: number;
|
|
2062
|
+
deadUnresolved: number;
|
|
2063
|
+
testOnly: number;
|
|
2064
|
+
leaf: number;
|
|
2065
|
+
} | null;
|
|
2066
|
+
classifyRolesIncremental(changedFiles: string[]): {
|
|
2067
|
+
entry: number;
|
|
2068
|
+
core: number;
|
|
2069
|
+
utility: number;
|
|
2070
|
+
adapter: number;
|
|
2071
|
+
dead: number;
|
|
2072
|
+
deadLeaf: number;
|
|
2073
|
+
deadEntry: number;
|
|
2074
|
+
deadFfi: number;
|
|
2075
|
+
deadUnresolved: number;
|
|
2076
|
+
testOnly: number;
|
|
2077
|
+
leaf: number;
|
|
2078
|
+
} | null;
|
|
2079
|
+
purgeFilesData(files: string[], purgeHashes?: boolean, reverseDepFiles?: string[]): void;
|
|
2080
|
+
|
|
2081
|
+
// ── Generic query execution & version validation (6.16) ─────────────
|
|
2082
|
+
/** Execute a parameterized SELECT and return all rows as objects. */
|
|
2083
|
+
queryAll(sql: string, params: Array<string | number | null>): Record<string, unknown>[];
|
|
2084
|
+
/** Execute a parameterized SELECT and return the first row, or null. */
|
|
2085
|
+
queryGet(sql: string, params: Array<string | number | null>): Record<string, unknown> | null;
|
|
2086
|
+
/** Validate DB codegraph_version matches expected. Warns on mismatch. */
|
|
2087
|
+
validateSchemaVersion(expectedVersion: string): boolean;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
1816
2090
|
// ════════════════════════════════════════════════════════════════════════
|
|
1817
2091
|
// §14 CLI Command Framework
|
|
1818
2092
|
// ════════════════════════════════════════════════════════════════════════
|
|
1819
2093
|
|
|
1820
2094
|
/** Shared context passed to every CLI command's execute/validate functions. */
|
|
1821
2095
|
export interface CommandContext {
|
|
1822
|
-
// biome-ignore lint/suspicious/noExplicitAny: config is a deeply nested dynamic object
|
|
1823
2096
|
config: Record<string, any>;
|
|
1824
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
1825
2097
|
resolveNoTests: (opts: any) => boolean;
|
|
1826
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
1827
2098
|
resolveQueryOpts: (opts: any) => any;
|
|
1828
2099
|
formatSize: (bytes: number) => string;
|
|
1829
|
-
// biome-ignore lint/suspicious/noExplicitAny: data shapes vary per command
|
|
1830
2100
|
outputResult: (data: any, key: string, opts: any) => boolean;
|
|
1831
2101
|
program: import('commander').Command;
|
|
1832
2102
|
}
|
|
@@ -1839,12 +2109,9 @@ export interface CommandDefinition {
|
|
|
1839
2109
|
options?: Array<
|
|
1840
2110
|
| [string, string]
|
|
1841
2111
|
| [string, string, string | boolean | number]
|
|
1842
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander parse functions accept arbitrary return types
|
|
1843
2112
|
| [string, string, (val: string) => any, string | boolean | number]
|
|
1844
2113
|
>;
|
|
1845
|
-
|
|
1846
|
-
validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined | void;
|
|
1847
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
2114
|
+
validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined;
|
|
1848
2115
|
execute?: (args: any[], opts: any, ctx: CommandContext) => void | Promise<void>;
|
|
1849
2116
|
subcommands?: CommandDefinition[];
|
|
1850
2117
|
}
|
package/src/vendor.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ambient type declarations for third-party modules without bundled types.
|
|
3
|
-
* Used by the TS migration — keeps @types/* out of devDeps to avoid
|
|
4
|
-
* declaration-emit conflicts with allowJs.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare module 'better-sqlite3' {
|
|
8
|
-
namespace BetterSqlite3 {
|
|
9
|
-
interface Database {
|
|
10
|
-
prepare<TRow = unknown>(sql: string): Statement<TRow>;
|
|
11
|
-
exec(sql: string): Database;
|
|
12
|
-
// biome-ignore lint/suspicious/noExplicitAny: must match better-sqlite3's generic Transaction<F>
|
|
13
|
-
transaction<F extends (...args: any[]) => any>(fn: F): F;
|
|
14
|
-
close(): void;
|
|
15
|
-
pragma(pragma: string, options?: { simple?: boolean }): unknown;
|
|
16
|
-
readonly open: boolean;
|
|
17
|
-
readonly name: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Statement<TRow = unknown> {
|
|
21
|
-
run(...params: unknown[]): RunResult;
|
|
22
|
-
get(...params: unknown[]): TRow | undefined;
|
|
23
|
-
all(...params: unknown[]): TRow[];
|
|
24
|
-
iterate(...params: unknown[]): IterableIterator<TRow>;
|
|
25
|
-
raw(toggle?: boolean): this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface RunResult {
|
|
29
|
-
changes: number;
|
|
30
|
-
lastInsertRowid: number | bigint;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function BetterSqlite3(
|
|
35
|
-
filename: string,
|
|
36
|
-
options?: Record<string, unknown>,
|
|
37
|
-
): BetterSqlite3.Database;
|
|
38
|
-
export = BetterSqlite3;
|
|
39
|
-
}
|