@optave/codegraph 3.4.0 → 3.4.1
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 +7 -7
- 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/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/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/connection.d.ts +17 -0
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +91 -2
- package/dist/db/connection.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- 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 +7 -0
- package/dist/db/migrations.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 +2 -3
- package/dist/domain/graph/builder/context.d.ts.map +1 -1
- 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 +6 -0
- 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 +12 -2
- 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 +155 -59
- package/dist/domain/graph/builder/stages/build-structure.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 +6 -6
- 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 +85 -61
- 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.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 +11 -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 +58 -60
- 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 +2 -2
- package/dist/extractors/rust.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 +2 -3
- 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.d.ts.map +1 -1
- package/dist/features/snapshot.js +0 -1
- 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 +2 -8
- 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 +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/ast-analysis/engine.ts +3 -9
- package/src/ast-analysis/shared.ts +0 -1
- 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/connection.ts +97 -13
- package/src/db/index.ts +2 -0
- package/src/db/migrations.ts +7 -0
- 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 +2 -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 +8 -0
- package/src/domain/graph/builder/stages/build-edges.ts +17 -4
- package/src/domain/graph/builder/stages/build-structure.ts +205 -76
- package/src/domain/graph/builder/stages/detect-changes.ts +11 -12
- package/src/domain/graph/builder/stages/finalize.ts +100 -81
- package/src/domain/graph/builder/stages/insert-nodes.ts +12 -8
- 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 +11 -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 +58 -61
- package/src/extractors/php.ts +2 -2
- package/src/extractors/python.ts +2 -2
- package/src/extractors/rust.ts +2 -2
- package/src/features/audit.ts +1 -2
- package/src/features/branch-compare.ts +3 -9
- 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 +1 -2
- 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 +2 -10
- 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 +4 -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
|
@@ -1774,8 +1774,9 @@ export interface BetterSqlite3Database {
|
|
|
1774
1774
|
exec(sql: string): this;
|
|
1775
1775
|
close(): void;
|
|
1776
1776
|
pragma(sql: string): unknown;
|
|
1777
|
-
|
|
1778
|
-
|
|
1777
|
+
transaction<F extends (...args: any[]) => any>(
|
|
1778
|
+
fn: F,
|
|
1779
|
+
): (...args: F extends (...a: infer A) => unknown ? A : never) => ReturnType<F>;
|
|
1779
1780
|
readonly open: boolean;
|
|
1780
1781
|
readonly name: string;
|
|
1781
1782
|
}
|
|
@@ -1819,14 +1820,10 @@ export interface NativeParseTreeCache {
|
|
|
1819
1820
|
|
|
1820
1821
|
/** Shared context passed to every CLI command's execute/validate functions. */
|
|
1821
1822
|
export interface CommandContext {
|
|
1822
|
-
// biome-ignore lint/suspicious/noExplicitAny: config is a deeply nested dynamic object
|
|
1823
1823
|
config: Record<string, any>;
|
|
1824
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
1825
1824
|
resolveNoTests: (opts: any) => boolean;
|
|
1826
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
1827
1825
|
resolveQueryOpts: (opts: any) => any;
|
|
1828
1826
|
formatSize: (bytes: number) => string;
|
|
1829
|
-
// biome-ignore lint/suspicious/noExplicitAny: data shapes vary per command
|
|
1830
1827
|
outputResult: (data: any, key: string, opts: any) => boolean;
|
|
1831
1828
|
program: import('commander').Command;
|
|
1832
1829
|
}
|
|
@@ -1839,12 +1836,9 @@ export interface CommandDefinition {
|
|
|
1839
1836
|
options?: Array<
|
|
1840
1837
|
| [string, string]
|
|
1841
1838
|
| [string, string, string | boolean | number]
|
|
1842
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander parse functions accept arbitrary return types
|
|
1843
1839
|
| [string, string, (val: string) => any, string | boolean | number]
|
|
1844
1840
|
>;
|
|
1845
|
-
|
|
1846
|
-
validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined | void;
|
|
1847
|
-
// biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
|
|
1841
|
+
validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined;
|
|
1848
1842
|
execute?: (args: any[], opts: any, ctx: CommandContext) => void | Promise<void>;
|
|
1849
1843
|
subcommands?: CommandDefinition[];
|
|
1850
1844
|
}
|
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
|
-
}
|