kirograph 0.27.2 → 0.28.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 +14 -7
- package/dist/bin/commands/annotations.js +56 -0
- package/dist/bin/commands/annotations.js.map +7 -0
- package/dist/bin/commands/ast-rewrite.js +55 -0
- package/dist/bin/commands/ast-rewrite.js.map +7 -0
- package/dist/bin/commands/bench.js +103 -0
- package/dist/bin/commands/bench.js.map +7 -0
- package/dist/bin/commands/branch.js +133 -0
- package/dist/bin/commands/branch.js.map +7 -0
- package/dist/bin/commands/changelog.js +55 -0
- package/dist/bin/commands/changelog.js.map +7 -0
- package/dist/bin/commands/commit-context.js +55 -0
- package/dist/bin/commands/commit-context.js.map +7 -0
- package/dist/bin/commands/complexity.js +60 -0
- package/dist/bin/commands/complexity.js.map +7 -0
- package/dist/bin/commands/cost.js +146 -0
- package/dist/bin/commands/cost.js.map +7 -0
- package/dist/bin/commands/dependency-depth.js +55 -0
- package/dist/bin/commands/dependency-depth.js.map +7 -0
- package/dist/bin/commands/diff-context.js +55 -0
- package/dist/bin/commands/diff-context.js.map +7 -0
- package/dist/bin/commands/distribution.js +56 -0
- package/dist/bin/commands/distribution.js.map +7 -0
- package/dist/bin/commands/doc-coverage.js +56 -0
- package/dist/bin/commands/doc-coverage.js.map +7 -0
- package/dist/bin/commands/doctor.js +202 -0
- package/dist/bin/commands/doctor.js.map +7 -0
- package/dist/bin/commands/dsm.js +56 -0
- package/dist/bin/commands/dsm.js.map +7 -0
- package/dist/bin/commands/gini.js +55 -0
- package/dist/bin/commands/gini.js.map +7 -0
- package/dist/bin/commands/god-class.js +56 -0
- package/dist/bin/commands/god-class.js.map +7 -0
- package/dist/bin/commands/health.js +55 -0
- package/dist/bin/commands/health.js.map +7 -0
- package/dist/bin/commands/help.js +224 -45
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/inheritance-depth.js +56 -0
- package/dist/bin/commands/inheritance-depth.js.map +7 -0
- package/dist/bin/commands/insert-at.js +55 -0
- package/dist/bin/commands/insert-at.js.map +7 -0
- package/dist/bin/commands/largest.js +56 -0
- package/dist/bin/commands/largest.js.map +7 -0
- package/dist/bin/commands/manifest.js +158 -0
- package/dist/bin/commands/manifest.js.map +7 -0
- package/dist/bin/commands/module-api.js +57 -0
- package/dist/bin/commands/module-api.js.map +7 -0
- package/dist/bin/commands/monitor.js +91 -0
- package/dist/bin/commands/monitor.js.map +7 -0
- package/dist/bin/commands/multi-replace.js +66 -0
- package/dist/bin/commands/multi-replace.js.map +7 -0
- package/dist/bin/commands/pr-context.js +55 -0
- package/dist/bin/commands/pr-context.js.map +7 -0
- package/dist/bin/commands/query.js +19 -1
- package/dist/bin/commands/query.js.map +3 -3
- package/dist/bin/commands/rank.js +56 -0
- package/dist/bin/commands/rank.js.map +7 -0
- package/dist/bin/commands/read.js +1 -1
- package/dist/bin/commands/read.js.map +2 -2
- package/dist/bin/commands/recursion.js +56 -0
- package/dist/bin/commands/recursion.js.map +7 -0
- package/dist/bin/commands/rename-preview.js +56 -0
- package/dist/bin/commands/rename-preview.js.map +7 -0
- package/dist/bin/commands/session.js +60 -0
- package/dist/bin/commands/session.js.map +7 -0
- package/dist/bin/commands/simplify-scan.js +56 -0
- package/dist/bin/commands/simplify-scan.js.map +7 -0
- package/dist/bin/commands/str-replace.js +55 -0
- package/dist/bin/commands/str-replace.js.map +7 -0
- package/dist/bin/commands/test-coverage.js +59 -0
- package/dist/bin/commands/test-coverage.js.map +7 -0
- package/dist/bin/commands/test-map.js +56 -0
- package/dist/bin/commands/test-map.js.map +7 -0
- package/dist/bin/commands/test-risk.js +59 -0
- package/dist/bin/commands/test-risk.js.map +7 -0
- package/dist/bin/commands/unused-imports.js +55 -0
- package/dist/bin/commands/unused-imports.js.map +7 -0
- package/dist/bin/commands/upgrade.js +78 -0
- package/dist/bin/commands/upgrade.js.map +7 -0
- package/dist/bin/installer/common.js +5 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +239 -93
- package/dist/bin/installer/config-prompt.js.map +3 -3
- package/dist/bin/installer/index.js +38 -6
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +7 -11
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.js.map +2 -2
- package/dist/bin/installer/steering.js +531 -100
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/kiro.js +7 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/kirograph.js +73 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/config.js +26 -8
- package/dist/config.js.map +2 -2
- package/dist/core/branch-manager.js +111 -0
- package/dist/core/branch-manager.js.map +7 -0
- package/dist/core/pipeline.js +3 -3
- package/dist/core/pipeline.js.map +2 -2
- package/dist/db/database.js +34 -7
- package/dist/db/database.js.map +2 -2
- package/dist/db/schema.sql +7 -1
- package/dist/extraction/complexity.js +116 -0
- package/dist/extraction/complexity.js.map +7 -0
- package/dist/extraction/extractor.js +52 -1
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/graph/git-context.js +229 -0
- package/dist/graph/git-context.js.map +7 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +2 -2
- package/dist/mcp/handler.js +446 -0
- package/dist/mcp/handler.js.map +7 -0
- package/dist/mcp/handlers/architecture.js +297 -0
- package/dist/mcp/handlers/architecture.js.map +7 -0
- package/dist/mcp/handlers/branch.js +175 -0
- package/dist/mcp/handlers/branch.js.map +7 -0
- package/dist/mcp/handlers/code-health.js +563 -0
- package/dist/mcp/handlers/code-health.js.map +7 -0
- package/dist/mcp/handlers/complexity.js +267 -0
- package/dist/mcp/handlers/complexity.js.map +7 -0
- package/dist/mcp/handlers/core.js +611 -0
- package/dist/mcp/handlers/core.js.map +7 -0
- package/dist/mcp/handlers/data.js +337 -0
- package/dist/mcp/handlers/data.js.map +7 -0
- package/dist/mcp/handlers/docs.js +159 -0
- package/dist/mcp/handlers/docs.js.map +7 -0
- package/dist/mcp/handlers/edit-primitives.js +200 -0
- package/dist/mcp/handlers/edit-primitives.js.map +7 -0
- package/dist/mcp/handlers/git-context.js +286 -0
- package/dist/mcp/handlers/git-context.js.map +7 -0
- package/dist/mcp/handlers/memory.js +363 -0
- package/dist/mcp/handlers/memory.js.map +7 -0
- package/dist/mcp/handlers/patterns.js +310 -0
- package/dist/mcp/handlers/patterns.js.map +7 -0
- package/dist/mcp/handlers/security.js +699 -0
- package/dist/mcp/handlers/security.js.map +7 -0
- package/dist/mcp/handlers/utils.js +97 -0
- package/dist/mcp/handlers/utils.js.map +7 -0
- package/dist/mcp/handlers/watchmen.js +104 -0
- package/dist/mcp/handlers/watchmen.js.map +7 -0
- package/dist/mcp/handlers/wiki.js +242 -0
- package/dist/mcp/handlers/wiki.js.map +7 -0
- package/dist/mcp/server.js +72 -3
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.js +94 -7
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +445 -3210
- package/dist/mcp/tools.js.map +3 -3
- package/dist/types.js.map +2 -2
- package/package.json +36 -10
- package/dist/architecture/index.d.ts +0 -11
- package/dist/architecture/index.d.ts.map +0 -1
- package/dist/architecture/layers/csharp.d.ts +0 -6
- package/dist/architecture/layers/csharp.d.ts.map +0 -1
- package/dist/architecture/layers/dart.d.ts +0 -10
- package/dist/architecture/layers/dart.d.ts.map +0 -1
- package/dist/architecture/layers/elixir.d.ts +0 -6
- package/dist/architecture/layers/elixir.d.ts.map +0 -1
- package/dist/architecture/layers/go.d.ts +0 -7
- package/dist/architecture/layers/go.d.ts.map +0 -1
- package/dist/architecture/layers/index.d.ts +0 -30
- package/dist/architecture/layers/index.d.ts.map +0 -1
- package/dist/architecture/layers/java.d.ts +0 -7
- package/dist/architecture/layers/java.d.ts.map +0 -1
- package/dist/architecture/layers/ocaml.d.ts +0 -6
- package/dist/architecture/layers/ocaml.d.ts.map +0 -1
- package/dist/architecture/layers/python.d.ts +0 -7
- package/dist/architecture/layers/python.d.ts.map +0 -1
- package/dist/architecture/layers/ruby.d.ts +0 -6
- package/dist/architecture/layers/ruby.d.ts.map +0 -1
- package/dist/architecture/layers/rust.d.ts +0 -6
- package/dist/architecture/layers/rust.d.ts.map +0 -1
- package/dist/architecture/layers/scala.d.ts +0 -6
- package/dist/architecture/layers/scala.d.ts.map +0 -1
- package/dist/architecture/layers/solidity.d.ts +0 -6
- package/dist/architecture/layers/solidity.d.ts.map +0 -1
- package/dist/architecture/layers/types.d.ts +0 -2
- package/dist/architecture/layers/types.d.ts.map +0 -1
- package/dist/architecture/layers/typescript.d.ts +0 -9
- package/dist/architecture/layers/typescript.d.ts.map +0 -1
- package/dist/architecture/layers/vue.d.ts +0 -6
- package/dist/architecture/layers/vue.d.ts.map +0 -1
- package/dist/architecture/manifest/cargo.d.ts +0 -3
- package/dist/architecture/manifest/cargo.d.ts.map +0 -1
- package/dist/architecture/manifest/csproj.d.ts +0 -3
- package/dist/architecture/manifest/csproj.d.ts.map +0 -1
- package/dist/architecture/manifest/elm.d.ts +0 -3
- package/dist/architecture/manifest/elm.d.ts.map +0 -1
- package/dist/architecture/manifest/go.d.ts +0 -3
- package/dist/architecture/manifest/go.d.ts.map +0 -1
- package/dist/architecture/manifest/gradle.d.ts +0 -3
- package/dist/architecture/manifest/gradle.d.ts.map +0 -1
- package/dist/architecture/manifest/index.d.ts +0 -12
- package/dist/architecture/manifest/index.d.ts.map +0 -1
- package/dist/architecture/manifest/maven.d.ts +0 -3
- package/dist/architecture/manifest/maven.d.ts.map +0 -1
- package/dist/architecture/manifest/npm.d.ts +0 -3
- package/dist/architecture/manifest/npm.d.ts.map +0 -1
- package/dist/architecture/manifest/ocaml.d.ts +0 -3
- package/dist/architecture/manifest/ocaml.d.ts.map +0 -1
- package/dist/architecture/manifest/python.d.ts +0 -3
- package/dist/architecture/manifest/python.d.ts.map +0 -1
- package/dist/architecture/manifest/scala.d.ts +0 -3
- package/dist/architecture/manifest/scala.d.ts.map +0 -1
- package/dist/architecture/manifest/types.d.ts +0 -2
- package/dist/architecture/manifest/types.d.ts.map +0 -1
- package/dist/architecture/types.d.ts +0 -91
- package/dist/architecture/types.d.ts.map +0 -1
- package/dist/banner.d.ts +0 -6
- package/dist/banner.d.ts.map +0 -1
- package/dist/banner.js +0 -67
- package/dist/banner.js.map +0 -1
- package/dist/bin/banner.d.ts +0 -6
- package/dist/bin/banner.d.ts.map +0 -1
- package/dist/bin/commands/affected.d.ts +0 -3
- package/dist/bin/commands/affected.d.ts.map +0 -1
- package/dist/bin/commands/architecture.d.ts +0 -3
- package/dist/bin/commands/architecture.d.ts.map +0 -1
- package/dist/bin/commands/attack-surface.d.ts +0 -3
- package/dist/bin/commands/attack-surface.d.ts.map +0 -1
- package/dist/bin/commands/benchmark.d.ts +0 -9
- package/dist/bin/commands/benchmark.d.ts.map +0 -1
- package/dist/bin/commands/budget.d.ts +0 -6
- package/dist/bin/commands/budget.d.ts.map +0 -1
- package/dist/bin/commands/caveman.d.ts +0 -7
- package/dist/bin/commands/caveman.d.ts.map +0 -1
- package/dist/bin/commands/communities.d.ts +0 -3
- package/dist/bin/commands/communities.d.ts.map +0 -1
- package/dist/bin/commands/compression.d.ts +0 -7
- package/dist/bin/commands/compression.d.ts.map +0 -1
- package/dist/bin/commands/configure-mcp.js +0 -104
- package/dist/bin/commands/configure-mcp.js.map +0 -7
- package/dist/bin/commands/context.d.ts +0 -3
- package/dist/bin/commands/context.d.ts.map +0 -1
- package/dist/bin/commands/coupling.d.ts +0 -3
- package/dist/bin/commands/coupling.d.ts.map +0 -1
- package/dist/bin/commands/dashboard.d.ts +0 -3
- package/dist/bin/commands/dashboard.d.ts.map +0 -1
- package/dist/bin/commands/data.d.ts +0 -3
- package/dist/bin/commands/data.d.ts.map +0 -1
- package/dist/bin/commands/dead-code.d.ts +0 -3
- package/dist/bin/commands/dead-code.d.ts.map +0 -1
- package/dist/bin/commands/dep-confusion.d.ts +0 -3
- package/dist/bin/commands/dep-confusion.d.ts.map +0 -1
- package/dist/bin/commands/docs.d.ts +0 -3
- package/dist/bin/commands/docs.d.ts.map +0 -1
- package/dist/bin/commands/exec.d.ts +0 -11
- package/dist/bin/commands/exec.d.ts.map +0 -1
- package/dist/bin/commands/export.d.ts +0 -3
- package/dist/bin/commands/export.d.ts.map +0 -1
- package/dist/bin/commands/files.d.ts +0 -3
- package/dist/bin/commands/files.d.ts.map +0 -1
- package/dist/bin/commands/flows.d.ts +0 -3
- package/dist/bin/commands/flows.d.ts.map +0 -1
- package/dist/bin/commands/gain.d.ts +0 -6
- package/dist/bin/commands/gain.d.ts.map +0 -1
- package/dist/bin/commands/help.d.ts +0 -11
- package/dist/bin/commands/help.d.ts.map +0 -1
- package/dist/bin/commands/hotspots.d.ts +0 -3
- package/dist/bin/commands/hotspots.d.ts.map +0 -1
- package/dist/bin/commands/index.d.ts +0 -3
- package/dist/bin/commands/index.d.ts.map +0 -1
- package/dist/bin/commands/init.d.ts +0 -3
- package/dist/bin/commands/init.d.ts.map +0 -1
- package/dist/bin/commands/install.d.ts +0 -3
- package/dist/bin/commands/install.d.ts.map +0 -1
- package/dist/bin/commands/licenses.d.ts +0 -3
- package/dist/bin/commands/licenses.d.ts.map +0 -1
- package/dist/bin/commands/mark-dirty.d.ts +0 -3
- package/dist/bin/commands/mark-dirty.d.ts.map +0 -1
- package/dist/bin/commands/memory.d.ts +0 -16
- package/dist/bin/commands/memory.d.ts.map +0 -1
- package/dist/bin/commands/package.d.ts +0 -3
- package/dist/bin/commands/package.d.ts.map +0 -1
- package/dist/bin/commands/path.d.ts +0 -3
- package/dist/bin/commands/path.d.ts.map +0 -1
- package/dist/bin/commands/pattern.d.ts +0 -3
- package/dist/bin/commands/pattern.d.ts.map +0 -1
- package/dist/bin/commands/qdrant.d.ts +0 -3
- package/dist/bin/commands/qdrant.d.ts.map +0 -1
- package/dist/bin/commands/qdrant.js +0 -159
- package/dist/bin/commands/qdrant.js.map +0 -1
- package/dist/bin/commands/query.d.ts +0 -3
- package/dist/bin/commands/query.d.ts.map +0 -1
- package/dist/bin/commands/reachability.d.ts +0 -3
- package/dist/bin/commands/reachability.d.ts.map +0 -1
- package/dist/bin/commands/read.d.ts +0 -6
- package/dist/bin/commands/read.d.ts.map +0 -1
- package/dist/bin/commands/refactor.d.ts +0 -3
- package/dist/bin/commands/refactor.d.ts.map +0 -1
- package/dist/bin/commands/remediation.d.ts +0 -3
- package/dist/bin/commands/remediation.d.ts.map +0 -1
- package/dist/bin/commands/sbom.d.ts +0 -3
- package/dist/bin/commands/sbom.d.ts.map +0 -1
- package/dist/bin/commands/security-ci-report.d.ts +0 -9
- package/dist/bin/commands/security-ci-report.d.ts.map +0 -1
- package/dist/bin/commands/security-export.d.ts +0 -2
- package/dist/bin/commands/security-export.d.ts.map +0 -1
- package/dist/bin/commands/security-flows.d.ts +0 -3
- package/dist/bin/commands/security-flows.d.ts.map +0 -1
- package/dist/bin/commands/security-secrets.d.ts +0 -3
- package/dist/bin/commands/security-secrets.d.ts.map +0 -1
- package/dist/bin/commands/security.d.ts +0 -3
- package/dist/bin/commands/security.d.ts.map +0 -1
- package/dist/bin/commands/serve.d.ts +0 -3
- package/dist/bin/commands/serve.d.ts.map +0 -1
- package/dist/bin/commands/snapshot.d.ts +0 -3
- package/dist/bin/commands/snapshot.d.ts.map +0 -1
- package/dist/bin/commands/staleness.d.ts +0 -3
- package/dist/bin/commands/staleness.d.ts.map +0 -1
- package/dist/bin/commands/status.d.ts +0 -3
- package/dist/bin/commands/status.d.ts.map +0 -1
- package/dist/bin/commands/stop.d.ts +0 -3
- package/dist/bin/commands/stop.d.ts.map +0 -1
- package/dist/bin/commands/stop.js +0 -81
- package/dist/bin/commands/stop.js.map +0 -1
- package/dist/bin/commands/supply-chain.d.ts +0 -3
- package/dist/bin/commands/supply-chain.d.ts.map +0 -1
- package/dist/bin/commands/surprising.d.ts +0 -3
- package/dist/bin/commands/surprising.d.ts.map +0 -1
- package/dist/bin/commands/sync-if-dirty.d.ts +0 -3
- package/dist/bin/commands/sync-if-dirty.d.ts.map +0 -1
- package/dist/bin/commands/sync.d.ts +0 -3
- package/dist/bin/commands/sync.d.ts.map +0 -1
- package/dist/bin/commands/typesense.d.ts +0 -3
- package/dist/bin/commands/typesense.d.ts.map +0 -1
- package/dist/bin/commands/typesense.js +0 -126
- package/dist/bin/commands/typesense.js.map +0 -1
- package/dist/bin/commands/uninit.d.ts +0 -4
- package/dist/bin/commands/uninit.d.ts.map +0 -1
- package/dist/bin/commands/unlock.d.ts +0 -3
- package/dist/bin/commands/unlock.d.ts.map +0 -1
- package/dist/bin/commands/utils.d.ts +0 -17
- package/dist/bin/commands/utils.d.ts.map +0 -1
- package/dist/bin/commands/vex.d.ts +0 -3
- package/dist/bin/commands/vex.d.ts.map +0 -1
- package/dist/bin/commands/vuln-suppress.d.ts +0 -3
- package/dist/bin/commands/vuln-suppress.d.ts.map +0 -1
- package/dist/bin/commands/vulns.d.ts +0 -3
- package/dist/bin/commands/vulns.d.ts.map +0 -1
- package/dist/bin/installer/archive.d.ts +0 -47
- package/dist/bin/installer/archive.d.ts.map +0 -1
- package/dist/bin/installer/auto-detect.d.ts +0 -16
- package/dist/bin/installer/auto-detect.d.ts.map +0 -1
- package/dist/bin/installer/caveman.d.ts +0 -12
- package/dist/bin/installer/caveman.d.ts.map +0 -1
- package/dist/bin/installer/cli-agent.d.ts +0 -20
- package/dist/bin/installer/cli-agent.d.ts.map +0 -1
- package/dist/bin/installer/common.d.ts +0 -36
- package/dist/bin/installer/common.d.ts.map +0 -1
- package/dist/bin/installer/config-prompt.d.ts +0 -13
- package/dist/bin/installer/config-prompt.d.ts.map +0 -1
- package/dist/bin/installer/dashboard.d.ts +0 -3
- package/dist/bin/installer/dashboard.d.ts.map +0 -1
- package/dist/bin/installer/detect.d.ts +0 -30
- package/dist/bin/installer/detect.d.ts.map +0 -1
- package/dist/bin/installer/hooks.d.ts +0 -8
- package/dist/bin/installer/hooks.d.ts.map +0 -1
- package/dist/bin/installer/index.d.ts +0 -12
- package/dist/bin/installer/index.d.ts.map +0 -1
- package/dist/bin/installer/instructions.d.ts +0 -14
- package/dist/bin/installer/instructions.d.ts.map +0 -1
- package/dist/bin/installer/mcp.d.ts +0 -5
- package/dist/bin/installer/mcp.d.ts.map +0 -1
- package/dist/bin/installer/prompts.d.ts +0 -45
- package/dist/bin/installer/prompts.d.ts.map +0 -1
- package/dist/bin/installer/qdrant-dashboard.d.ts +0 -4
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +0 -1
- package/dist/bin/installer/steering.d.ts +0 -17
- package/dist/bin/installer/steering.d.ts.map +0 -1
- package/dist/bin/installer/targets/aider.d.ts +0 -6
- package/dist/bin/installer/targets/aider.d.ts.map +0 -1
- package/dist/bin/installer/targets/amp.d.ts +0 -6
- package/dist/bin/installer/targets/amp.d.ts.map +0 -1
- package/dist/bin/installer/targets/antigravity.d.ts +0 -13
- package/dist/bin/installer/targets/antigravity.d.ts.map +0 -1
- package/dist/bin/installer/targets/augment.d.ts +0 -6
- package/dist/bin/installer/targets/augment.d.ts.map +0 -1
- package/dist/bin/installer/targets/claude.d.ts +0 -6
- package/dist/bin/installer/targets/claude.d.ts.map +0 -1
- package/dist/bin/installer/targets/cline.d.ts +0 -13
- package/dist/bin/installer/targets/cline.d.ts.map +0 -1
- package/dist/bin/installer/targets/codex.d.ts +0 -6
- package/dist/bin/installer/targets/codex.d.ts.map +0 -1
- package/dist/bin/installer/targets/continue.d.ts +0 -12
- package/dist/bin/installer/targets/continue.d.ts.map +0 -1
- package/dist/bin/installer/targets/copilot-cli.d.ts +0 -12
- package/dist/bin/installer/targets/copilot-cli.d.ts.map +0 -1
- package/dist/bin/installer/targets/copilot.d.ts +0 -6
- package/dist/bin/installer/targets/copilot.d.ts.map +0 -1
- package/dist/bin/installer/targets/cursor.d.ts +0 -6
- package/dist/bin/installer/targets/cursor.d.ts.map +0 -1
- package/dist/bin/installer/targets/devin.d.ts +0 -13
- package/dist/bin/installer/targets/devin.d.ts.map +0 -1
- package/dist/bin/installer/targets/gemini-cli.d.ts +0 -16
- package/dist/bin/installer/targets/gemini-cli.d.ts.map +0 -1
- package/dist/bin/installer/targets/generic.d.ts +0 -59
- package/dist/bin/installer/targets/generic.d.ts.map +0 -1
- package/dist/bin/installer/targets/goose.d.ts +0 -6
- package/dist/bin/installer/targets/goose.d.ts.map +0 -1
- package/dist/bin/installer/targets/index.d.ts +0 -11
- package/dist/bin/installer/targets/index.d.ts.map +0 -1
- package/dist/bin/installer/targets/junie.d.ts +0 -13
- package/dist/bin/installer/targets/junie.d.ts.map +0 -1
- package/dist/bin/installer/targets/kilo.d.ts +0 -12
- package/dist/bin/installer/targets/kilo.d.ts.map +0 -1
- package/dist/bin/installer/targets/kiro.d.ts +0 -5
- package/dist/bin/installer/targets/kiro.d.ts.map +0 -1
- package/dist/bin/installer/targets/opencode.d.ts +0 -13
- package/dist/bin/installer/targets/opencode.d.ts.map +0 -1
- package/dist/bin/installer/targets/openhands.d.ts +0 -6
- package/dist/bin/installer/targets/openhands.d.ts.map +0 -1
- package/dist/bin/installer/targets/qoder.d.ts +0 -12
- package/dist/bin/installer/targets/qoder.d.ts.map +0 -1
- package/dist/bin/installer/targets/qwen.d.ts +0 -12
- package/dist/bin/installer/targets/qwen.d.ts.map +0 -1
- package/dist/bin/installer/targets/replit.d.ts +0 -6
- package/dist/bin/installer/targets/replit.d.ts.map +0 -1
- package/dist/bin/installer/targets/roo.d.ts +0 -13
- package/dist/bin/installer/targets/roo.d.ts.map +0 -1
- package/dist/bin/installer/targets/tabnine.d.ts +0 -6
- package/dist/bin/installer/targets/tabnine.d.ts.map +0 -1
- package/dist/bin/installer/targets/trae.d.ts +0 -6
- package/dist/bin/installer/targets/trae.d.ts.map +0 -1
- package/dist/bin/installer/targets/warp.d.ts +0 -12
- package/dist/bin/installer/targets/warp.d.ts.map +0 -1
- package/dist/bin/installer/targets/windsurf.d.ts +0 -13
- package/dist/bin/installer/targets/windsurf.d.ts.map +0 -1
- package/dist/bin/kirograph.d.ts +0 -6
- package/dist/bin/kirograph.d.ts.map +0 -1
- package/dist/bin/progress.d.ts +0 -29
- package/dist/bin/progress.d.ts.map +0 -1
- package/dist/bin/ui.d.ts +0 -11
- package/dist/bin/ui.d.ts.map +0 -1
- package/dist/compression/filters/aws.d.ts +0 -9
- package/dist/compression/filters/aws.d.ts.map +0 -1
- package/dist/compression/filters/docker.d.ts +0 -6
- package/dist/compression/filters/docker.d.ts.map +0 -1
- package/dist/compression/filters/files.d.ts +0 -6
- package/dist/compression/filters/files.d.ts.map +0 -1
- package/dist/compression/filters/generic.d.ts +0 -7
- package/dist/compression/filters/generic.d.ts.map +0 -1
- package/dist/compression/filters/git.d.ts +0 -6
- package/dist/compression/filters/git.d.ts.map +0 -1
- package/dist/compression/filters/github.d.ts +0 -6
- package/dist/compression/filters/github.d.ts.map +0 -1
- package/dist/compression/filters/lint.d.ts +0 -6
- package/dist/compression/filters/lint.d.ts.map +0 -1
- package/dist/compression/filters/misc.d.ts +0 -6
- package/dist/compression/filters/misc.d.ts.map +0 -1
- package/dist/compression/filters/package.d.ts +0 -6
- package/dist/compression/filters/package.d.ts.map +0 -1
- package/dist/compression/filters/test.d.ts +0 -6
- package/dist/compression/filters/test.d.ts.map +0 -1
- package/dist/compression/index.d.ts +0 -29
- package/dist/compression/index.d.ts.map +0 -1
- package/dist/compression/naive-cost.d.ts +0 -26
- package/dist/compression/naive-cost.d.ts.map +0 -1
- package/dist/compression/tracker.d.ts +0 -155
- package/dist/compression/tracker.d.ts.map +0 -1
- package/dist/compression/types.d.ts +0 -49
- package/dist/compression/types.d.ts.map +0 -1
- package/dist/config.d.ts +0 -138
- package/dist/config.d.ts.map +0 -1
- package/dist/context/index.d.ts +0 -61
- package/dist/context/index.d.ts.map +0 -1
- package/dist/core/file-tree.d.ts +0 -15
- package/dist/core/file-tree.d.ts.map +0 -1
- package/dist/core/lock-manager.d.ts +0 -22
- package/dist/core/lock-manager.d.ts.map +0 -1
- package/dist/core/pipeline.d.ts +0 -40
- package/dist/core/pipeline.d.ts.map +0 -1
- package/dist/core/snapshot.d.ts +0 -58
- package/dist/core/snapshot.d.ts.map +0 -1
- package/dist/data/filters.d.ts +0 -23
- package/dist/data/filters.d.ts.map +0 -1
- package/dist/data/indexer.d.ts +0 -25
- package/dist/data/indexer.d.ts.map +0 -1
- package/dist/data/linker.d.ts +0 -37
- package/dist/data/linker.d.ts.map +0 -1
- package/dist/data/linker.test.js +0 -60
- package/dist/data/linker.test.js.map +0 -7
- package/dist/data/lint.d.ts +0 -27
- package/dist/data/lint.d.ts.map +0 -1
- package/dist/data/parsers/__fixtures__/pdf-inspector-stub.js +0 -41
- package/dist/data/parsers/__fixtures__/pdf-inspector-stub.js.map +0 -7
- package/dist/data/parsers/csv.d.ts +0 -11
- package/dist/data/parsers/csv.d.ts.map +0 -1
- package/dist/data/parsers/excel.d.ts +0 -10
- package/dist/data/parsers/excel.d.ts.map +0 -1
- package/dist/data/parsers/index.d.ts +0 -28
- package/dist/data/parsers/index.d.ts.map +0 -1
- package/dist/data/parsers/json-array.d.ts +0 -9
- package/dist/data/parsers/json-array.d.ts.map +0 -1
- package/dist/data/parsers/jsonl.d.ts +0 -9
- package/dist/data/parsers/jsonl.d.ts.map +0 -1
- package/dist/data/parsers/parquet.d.ts +0 -10
- package/dist/data/parsers/parquet.d.ts.map +0 -1
- package/dist/data/parsers/pdf.test.js +0 -125
- package/dist/data/parsers/pdf.test.js.map +0 -7
- package/dist/data/profiler.d.ts +0 -29
- package/dist/data/profiler.d.ts.map +0 -1
- package/dist/data/queries.d.ts +0 -95
- package/dist/data/queries.d.ts.map +0 -1
- package/dist/data/types.d.ts +0 -103
- package/dist/data/types.d.ts.map +0 -1
- package/dist/db/database.d.ts +0 -190
- package/dist/db/database.d.ts.map +0 -1
- package/dist/docs/formats/asciidoc.d.ts +0 -9
- package/dist/docs/formats/asciidoc.d.ts.map +0 -1
- package/dist/docs/formats/html.d.ts +0 -10
- package/dist/docs/formats/html.d.ts.map +0 -1
- package/dist/docs/formats/index.d.ts +0 -31
- package/dist/docs/formats/index.d.ts.map +0 -1
- package/dist/docs/formats/markdown.d.ts +0 -11
- package/dist/docs/formats/markdown.d.ts.map +0 -1
- package/dist/docs/formats/openapi.d.ts +0 -17
- package/dist/docs/formats/openapi.d.ts.map +0 -1
- package/dist/docs/formats/org.d.ts +0 -9
- package/dist/docs/formats/org.d.ts.map +0 -1
- package/dist/docs/formats/plaintext.d.ts +0 -11
- package/dist/docs/formats/plaintext.d.ts.map +0 -1
- package/dist/docs/formats/rdoc.d.ts +0 -10
- package/dist/docs/formats/rdoc.d.ts.map +0 -1
- package/dist/docs/formats/rst.d.ts +0 -11
- package/dist/docs/formats/rst.d.ts.map +0 -1
- package/dist/docs/indexer.d.ts +0 -49
- package/dist/docs/indexer.d.ts.map +0 -1
- package/dist/docs/linker.d.ts +0 -30
- package/dist/docs/linker.d.ts.map +0 -1
- package/dist/docs/lint.d.ts +0 -27
- package/dist/docs/lint.d.ts.map +0 -1
- package/dist/docs/queries.d.ts +0 -78
- package/dist/docs/queries.d.ts.map +0 -1
- package/dist/docs/section-id.d.ts +0 -48
- package/dist/docs/section-id.d.ts.map +0 -1
- package/dist/docs/summarizer.d.ts +0 -13
- package/dist/docs/summarizer.d.ts.map +0 -1
- package/dist/docs/types.d.ts +0 -71
- package/dist/docs/types.d.ts.map +0 -1
- package/dist/docs/vectors.d.ts +0 -54
- package/dist/docs/vectors.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -49
- package/dist/errors.d.ts.map +0 -1
- package/dist/extraction/extractor.d.ts +0 -29
- package/dist/extraction/extractor.d.ts.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -54
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/languages.d.ts +0 -9
- package/dist/extraction/languages.d.ts.map +0 -1
- package/dist/extraction/notebook.d.ts +0 -14
- package/dist/extraction/notebook.d.ts.map +0 -1
- package/dist/frameworks/amplify.d.ts +0 -9
- package/dist/frameworks/amplify.d.ts.map +0 -1
- package/dist/frameworks/angular.d.ts +0 -9
- package/dist/frameworks/angular.d.ts.map +0 -1
- package/dist/frameworks/ansible.d.ts +0 -8
- package/dist/frameworks/ansible.d.ts.map +0 -1
- package/dist/frameworks/cloudformation.d.ts +0 -9
- package/dist/frameworks/cloudformation.d.ts.map +0 -1
- package/dist/frameworks/csharp.d.ts +0 -8
- package/dist/frameworks/csharp.d.ts.map +0 -1
- package/dist/frameworks/docker.d.ts +0 -9
- package/dist/frameworks/docker.d.ts.map +0 -1
- package/dist/frameworks/elixir.d.ts +0 -6
- package/dist/frameworks/elixir.d.ts.map +0 -1
- package/dist/frameworks/express.d.ts +0 -8
- package/dist/frameworks/express.d.ts.map +0 -1
- package/dist/frameworks/flutter.d.ts +0 -12
- package/dist/frameworks/flutter.d.ts.map +0 -1
- package/dist/frameworks/go.d.ts +0 -8
- package/dist/frameworks/go.d.ts.map +0 -1
- package/dist/frameworks/iac.d.ts +0 -10
- package/dist/frameworks/iac.d.ts.map +0 -1
- package/dist/frameworks/index.d.ts +0 -44
- package/dist/frameworks/index.d.ts.map +0 -1
- package/dist/frameworks/java.d.ts +0 -8
- package/dist/frameworks/java.d.ts.map +0 -1
- package/dist/frameworks/kubernetes.d.ts +0 -9
- package/dist/frameworks/kubernetes.d.ts.map +0 -1
- package/dist/frameworks/laravel.d.ts +0 -9
- package/dist/frameworks/laravel.d.ts.map +0 -1
- package/dist/frameworks/pulumi.d.ts +0 -9
- package/dist/frameworks/pulumi.d.ts.map +0 -1
- package/dist/frameworks/python.d.ts +0 -10
- package/dist/frameworks/python.d.ts.map +0 -1
- package/dist/frameworks/react.d.ts +0 -9
- package/dist/frameworks/react.d.ts.map +0 -1
- package/dist/frameworks/ruby.d.ts +0 -8
- package/dist/frameworks/ruby.d.ts.map +0 -1
- package/dist/frameworks/rust.d.ts +0 -8
- package/dist/frameworks/rust.d.ts.map +0 -1
- package/dist/frameworks/scala.d.ts +0 -6
- package/dist/frameworks/scala.d.ts.map +0 -1
- package/dist/frameworks/solidity.d.ts +0 -6
- package/dist/frameworks/solidity.d.ts.map +0 -1
- package/dist/frameworks/svelte.d.ts +0 -8
- package/dist/frameworks/svelte.d.ts.map +0 -1
- package/dist/frameworks/swift.d.ts +0 -10
- package/dist/frameworks/swift.d.ts.map +0 -1
- package/dist/frameworks/terraform.d.ts +0 -14
- package/dist/frameworks/terraform.d.ts.map +0 -1
- package/dist/frameworks/types.d.ts +0 -37
- package/dist/frameworks/types.d.ts.map +0 -1
- package/dist/frameworks/vue.d.ts +0 -7
- package/dist/frameworks/vue.d.ts.map +0 -1
- package/dist/graph/communities.d.ts +0 -43
- package/dist/graph/communities.d.ts.map +0 -1
- package/dist/graph/flows.d.ts +0 -55
- package/dist/graph/flows.d.ts.map +0 -1
- package/dist/graph/queries.d.ts +0 -53
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/refactor.d.ts +0 -43
- package/dist/graph/refactor.d.ts.map +0 -1
- package/dist/graph/traversal.d.ts +0 -35
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/index.d.ts +0 -134
- package/dist/index.d.ts.map +0 -1
- package/dist/installer/index.d.ts +0 -10
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -526
- package/dist/installer/index.js.map +0 -1
- package/dist/mcp/cache.d.ts +0 -69
- package/dist/mcp/cache.d.ts.map +0 -1
- package/dist/mcp/read-modes.d.ts +0 -31
- package/dist/mcp/read-modes.d.ts.map +0 -1
- package/dist/mcp/server.d.ts +0 -17
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/tool-names.d.ts +0 -2
- package/dist/mcp/tool-names.d.ts.map +0 -1
- package/dist/mcp/tools.d.ts +0 -49
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/transport.d.ts +0 -29
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/memory/compress.d.ts +0 -19
- package/dist/memory/compress.d.ts.map +0 -1
- package/dist/memory/database.d.ts +0 -92
- package/dist/memory/database.d.ts.map +0 -1
- package/dist/memory/index.d.ts +0 -71
- package/dist/memory/index.d.ts.map +0 -1
- package/dist/memory/symbols.d.ts +0 -21
- package/dist/memory/symbols.d.ts.map +0 -1
- package/dist/memory/types.d.ts +0 -78
- package/dist/memory/types.d.ts.map +0 -1
- package/dist/memory/vectors.d.ts +0 -43
- package/dist/memory/vectors.d.ts.map +0 -1
- package/dist/patterns/graph.d.ts +0 -16
- package/dist/patterns/graph.d.ts.map +0 -1
- package/dist/patterns/index.d.ts +0 -4
- package/dist/patterns/index.d.ts.map +0 -1
- package/dist/patterns/indexer.d.ts +0 -15
- package/dist/patterns/indexer.d.ts.map +0 -1
- package/dist/patterns/loader.d.ts +0 -18
- package/dist/patterns/loader.d.ts.map +0 -1
- package/dist/patterns/runner.d.ts +0 -42
- package/dist/patterns/runner.d.ts.map +0 -1
- package/dist/patterns/types.d.ts +0 -27
- package/dist/patterns/types.d.ts.map +0 -1
- package/dist/resolution/bridges/android-rn.d.ts +0 -13
- package/dist/resolution/bridges/android-rn.d.ts.map +0 -1
- package/dist/resolution/bridges/expo-modules.d.ts +0 -10
- package/dist/resolution/bridges/expo-modules.d.ts.map +0 -1
- package/dist/resolution/bridges/flutter-channel.d.ts +0 -14
- package/dist/resolution/bridges/flutter-channel.d.ts.map +0 -1
- package/dist/resolution/bridges/index.d.ts +0 -40
- package/dist/resolution/bridges/index.d.ts.map +0 -1
- package/dist/resolution/bridges/native-events.d.ts +0 -10
- package/dist/resolution/bridges/native-events.d.ts.map +0 -1
- package/dist/resolution/bridges/native-views.d.ts +0 -13
- package/dist/resolution/bridges/native-views.d.ts.map +0 -1
- package/dist/resolution/bridges/react-native.d.ts +0 -9
- package/dist/resolution/bridges/react-native.d.ts.map +0 -1
- package/dist/resolution/bridges/swift-objc.d.ts +0 -14
- package/dist/resolution/bridges/swift-objc.d.ts.map +0 -1
- package/dist/resolution/bridges/turbomodules.d.ts +0 -10
- package/dist/resolution/bridges/turbomodules.d.ts.map +0 -1
- package/dist/resolution/index.d.ts +0 -81
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -25
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/scripts/postinstall.js +0 -64
- package/dist/search/query-utils.d.ts +0 -21
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/searcher.d.ts +0 -15
- package/dist/search/searcher.d.ts.map +0 -1
- package/dist/security/attack-surface.d.ts +0 -46
- package/dist/security/attack-surface.d.ts.map +0 -1
- package/dist/security/context-warnings.d.ts +0 -40
- package/dist/security/context-warnings.d.ts.map +0 -1
- package/dist/security/data-flows.d.ts +0 -33
- package/dist/security/data-flows.d.ts.map +0 -1
- package/dist/security/dep-confusion.d.ts +0 -23
- package/dist/security/dep-confusion.d.ts.map +0 -1
- package/dist/security/errors.d.ts +0 -16
- package/dist/security/errors.d.ts.map +0 -1
- package/dist/security/export/fix-suggestions.d.ts +0 -21
- package/dist/security/export/fix-suggestions.d.ts.map +0 -1
- package/dist/security/export/sbom.d.ts +0 -33
- package/dist/security/export/sbom.d.ts.map +0 -1
- package/dist/security/export/serialization.d.ts +0 -62
- package/dist/security/export/serialization.d.ts.map +0 -1
- package/dist/security/export/vex.d.ts +0 -58
- package/dist/security/export/vex.d.ts.map +0 -1
- package/dist/security/index.d.ts +0 -21
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/integrator.d.ts +0 -63
- package/dist/security/integrator.d.ts.map +0 -1
- package/dist/security/license.d.ts +0 -33
- package/dist/security/license.d.ts.map +0 -1
- package/dist/security/manifest/adapter.d.ts +0 -92
- package/dist/security/manifest/adapter.d.ts.map +0 -1
- package/dist/security/manifest/parser.d.ts +0 -73
- package/dist/security/manifest/parser.d.ts.map +0 -1
- package/dist/security/manifest/plugins/cargo.d.ts +0 -11
- package/dist/security/manifest/plugins/cargo.d.ts.map +0 -1
- package/dist/security/manifest/plugins/composer.d.ts +0 -11
- package/dist/security/manifest/plugins/composer.d.ts.map +0 -1
- package/dist/security/manifest/plugins/go.d.ts +0 -12
- package/dist/security/manifest/plugins/go.d.ts.map +0 -1
- package/dist/security/manifest/plugins/gradle.d.ts +0 -12
- package/dist/security/manifest/plugins/gradle.d.ts.map +0 -1
- package/dist/security/manifest/plugins/hex.d.ts +0 -11
- package/dist/security/manifest/plugins/hex.d.ts.map +0 -1
- package/dist/security/manifest/plugins/maven.d.ts +0 -11
- package/dist/security/manifest/plugins/maven.d.ts.map +0 -1
- package/dist/security/manifest/plugins/npm.d.ts +0 -11
- package/dist/security/manifest/plugins/npm.d.ts.map +0 -1
- package/dist/security/manifest/plugins/nuget.d.ts +0 -12
- package/dist/security/manifest/plugins/nuget.d.ts.map +0 -1
- package/dist/security/manifest/plugins/pip.d.ts +0 -11
- package/dist/security/manifest/plugins/pip.d.ts.map +0 -1
- package/dist/security/manifest/plugins/pubspec.d.ts +0 -11
- package/dist/security/manifest/plugins/pubspec.d.ts.map +0 -1
- package/dist/security/manifest/plugins/pyproject.d.ts +0 -3
- package/dist/security/manifest/plugins/pyproject.d.ts.map +0 -1
- package/dist/security/manifest/plugins/rubygems.d.ts +0 -11
- package/dist/security/manifest/plugins/rubygems.d.ts.map +0 -1
- package/dist/security/manifest/plugins/swift.d.ts +0 -11
- package/dist/security/manifest/plugins/swift.d.ts.map +0 -1
- package/dist/security/owasp.d.ts +0 -16
- package/dist/security/owasp.d.ts.map +0 -1
- package/dist/security/pipeline.d.ts +0 -37
- package/dist/security/pipeline.d.ts.map +0 -1
- package/dist/security/reachability.d.ts +0 -67
- package/dist/security/reachability.d.ts.map +0 -1
- package/dist/security/remediation.d.ts +0 -51
- package/dist/security/remediation.d.ts.map +0 -1
- package/dist/security/secrets.d.ts +0 -38
- package/dist/security/secrets.d.ts.map +0 -1
- package/dist/security/staleness.d.ts +0 -43
- package/dist/security/staleness.d.ts.map +0 -1
- package/dist/security/supply-chain.d.ts +0 -34
- package/dist/security/supply-chain.d.ts.map +0 -1
- package/dist/security/suppressions.d.ts +0 -18
- package/dist/security/suppressions.d.ts.map +0 -1
- package/dist/security/types.d.ts +0 -144
- package/dist/security/types.d.ts.map +0 -1
- package/dist/security/vuln/client.d.ts +0 -90
- package/dist/security/vuln/client.d.ts.map +0 -1
- package/dist/security/vuln/epss-client.d.ts +0 -26
- package/dist/security/vuln/epss-client.d.ts.map +0 -1
- package/dist/security/vuln/index.d.ts +0 -6
- package/dist/security/vuln/index.d.ts.map +0 -1
- package/dist/security/vuln/osv-adapter.d.ts +0 -58
- package/dist/security/vuln/osv-adapter.d.ts.map +0 -1
- package/dist/security/vuln/types.d.ts +0 -29
- package/dist/security/vuln/types.d.ts.map +0 -1
- package/dist/sync/index.d.ts +0 -35
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -137
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -52
- package/dist/utils.d.ts.map +0 -1
- package/dist/vectors/index.d.ts +0 -79
- package/dist/vectors/index.d.ts.map +0 -1
- package/dist/vectors/lancedb-index.d.ts +0 -50
- package/dist/vectors/lancedb-index.d.ts.map +0 -1
- package/dist/vectors/orama-index.d.ts +0 -54
- package/dist/vectors/orama-index.d.ts.map +0 -1
- package/dist/vectors/pglite-index.d.ts +0 -53
- package/dist/vectors/pglite-index.d.ts.map +0 -1
- package/dist/vectors/qdrant-index.d.ts +0 -77
- package/dist/vectors/qdrant-index.d.ts.map +0 -1
- package/dist/vectors/typesense-index.d.ts +0 -75
- package/dist/vectors/typesense-index.d.ts.map +0 -1
- package/dist/vectors/vec-index.d.ts +0 -52
- package/dist/vectors/vec-index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ class KiroGraph {
|
|
|
74
74
|
await kg.vectors.initialize(onModelProgress);
|
|
75
75
|
return kg;
|
|
76
76
|
}
|
|
77
|
-
static async open(projectRoot, onModelProgress) {
|
|
77
|
+
static async open(projectRoot, onModelProgress, opts) {
|
|
78
78
|
const resolved = path.resolve(projectRoot);
|
|
79
79
|
(0, import_utils.validateProjectPath)(resolved);
|
|
80
80
|
if (!fs.existsSync(path.join(resolved, KIROGRAPH_DIR))) {
|
|
@@ -83,7 +83,9 @@ class KiroGraph {
|
|
|
83
83
|
const cfg = await (0, import_config.loadConfig)(resolved);
|
|
84
84
|
const db = new import_database.GraphDatabase(resolved);
|
|
85
85
|
const kg = new KiroGraph(resolved, db, cfg);
|
|
86
|
-
|
|
86
|
+
if (!opts?.skipVectors) {
|
|
87
|
+
await kg.vectors.initialize(onModelProgress);
|
|
88
|
+
}
|
|
87
89
|
return kg;
|
|
88
90
|
}
|
|
89
91
|
static isInitialized(projectRoot) {
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph \u2014 Semantic code knowledge graph for Kiro\n *\n * Pure facade. Every method delegates to a focused sub-system.\n * No business logic lives here.\n */\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { GraphDatabase } from './db/database';\nimport { validatePathWithinRoot, validateProjectPath } from './utils';\nimport { loadConfig, createDefaultConfig, saveConfig } from './config';\nimport type { KiroGraphConfig } from './config';\nimport { GraphQueryManager } from './graph/queries';\nimport { ReferenceResolver } from './resolution/index';\nimport { VectorManager } from './vectors/index';\nimport { ContextBuilder } from './context/index';\nimport { ArchitectureAnalyzer } from './architecture/index';\nimport { LockManager } from './core/lock-manager';\nimport { IndexPipeline } from './core/pipeline';\nimport { buildFileTree } from './core/file-tree';\nimport { SnapshotManager } from './core/snapshot';\nimport { Searcher } from './search/searcher';\nimport type { FileTreeNode, FileTree } from './core/file-tree';\nimport type { GraphSnapshot, GraphDiff } from './core/snapshot';\n\nexport type { GraphSnapshot, GraphDiff };\nimport type {\n Node, Edge, NodeKind, IndexResult, IndexProgress, SyncResult, TaskContext,\n SearchResult, SearchOptions, NodeContext, NodeMetrics,\n} from './types';\nimport type { ArchitectureResult } from './architecture/types';\n\nexport type { FileTreeNode, FileTree };\n\nconst KIROGRAPH_DIR = '.kirograph';\n\nexport default class KiroGraph {\n private readonly db: GraphDatabase;\n private readonly config: KiroGraphConfig;\n private readonly projectRoot: string;\n private readonly queryManager: GraphQueryManager;\n private readonly resolver: ReferenceResolver;\n private readonly vectors: VectorManager;\n private readonly contextBuilder: ContextBuilder;\n private readonly arch: ArchitectureAnalyzer;\n private readonly lock: LockManager;\n private readonly pipeline: IndexPipeline;\n private readonly searcher: Searcher;\n\n private constructor(projectRoot: string, db: GraphDatabase, config: KiroGraphConfig) {\n this.projectRoot = projectRoot;\n this.db = db;\n this.config = config;\n this.queryManager = new GraphQueryManager(db);\n this.resolver = new ReferenceResolver(db, config, projectRoot);\n this.vectors = new VectorManager(db, config, projectRoot);\n this.contextBuilder = new ContextBuilder(db, this.resolver, this.vectors, projectRoot);\n this.arch = new ArchitectureAnalyzer(db, config, projectRoot);\n this.lock = new LockManager(projectRoot);\n this.pipeline = new IndexPipeline(db, this.vectors, this.resolver, this.arch, this.lock, config, projectRoot);\n this.searcher = new Searcher(db);\n }\n\n // \u2500\u2500 Factory \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n static async init(\n projectRoot: string,\n config?: Partial<KiroGraphConfig>,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n fs.mkdirSync(path.join(resolved, KIROGRAPH_DIR), { recursive: true });\n const cfg = { ...createDefaultConfig(resolved), ...config };\n await saveConfig(resolved, cfg);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static async open(\n projectRoot: string,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n if (!fs.existsSync(path.join(resolved, KIROGRAPH_DIR))) {\n throw new Error(`KiroGraph not initialized at ${resolved}. Run: kirograph init`);\n }\n const cfg = await loadConfig(resolved);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static isInitialized(projectRoot: string): boolean {\n return fs.existsSync(path.join(path.resolve(projectRoot), KIROGRAPH_DIR));\n }\n\n // \u2500\u2500 Lock / dirty marker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n unlockForce(): void { this.lock.forceRelease(); }\n markDirty(): void { this.lock.markDirty(); }\n clearDirty(): void { this.lock.clearDirty(); }\n isDirty(): boolean { return this.lock.isDirty(); }\n isIndexLocked(): boolean { return this.lock.isLocked(); }\n\n async syncIfDirty(): Promise<SyncResult | null> {\n if (!this.isDirty()) return null;\n return this.sync();\n }\n\n /**\n * Returns the number of files that have changed on disk but are not yet\n * reflected in the index. Used by the MCP status tool to warn the agent\n * when the index may be stale.\n */\n async getPendingSyncCount(): Promise<number> {\n try {\n const { getChangedFiles, scanDirectory } = await Promise.resolve().then(() => require('./sync/index.js'));\n const gitChanged = await getChangedFiles(this.projectRoot, this.config);\n const hasGitChanges =\n gitChanged.added.length > 0 ||\n gitChanged.modified.length > 0 ||\n gitChanged.removed.length > 0;\n\n if (hasGitChanges) {\n return gitChanged.added.length + gitChanged.modified.length + gitChanged.removed.length;\n }\n\n // Fallback: compare indexed set vs current filesystem set\n const indexed = new Set(this.db.getAllFiles().map((f: { path: string }) => f.path));\n const current = new Set(\n (await scanDirectory(this.projectRoot, this.config))\n .map(f => require('path').relative(this.projectRoot, f).replace(/\\\\/g, '/'))\n );\n let pending = 0;\n for (const p of indexed) { if (!current.has(p)) pending++; }\n for (const p of current) { if (!indexed.has(p)) pending++; }\n return pending;\n } catch {\n return 0;\n }\n }\n\n // \u2500\u2500 Indexing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async indexAll(opts?: { onProgress?: (p: IndexProgress) => void; force?: boolean; signal?: AbortSignal }): Promise<IndexResult> {\n return this.pipeline.indexAll(opts);\n }\n\n async sync(changedFilesOrOpts?: string[] | { files?: string[]; onProgress?: (p: IndexProgress) => void }): Promise<SyncResult> {\n if (Array.isArray(changedFilesOrOpts)) {\n return this.pipeline.sync({ changedFiles: changedFilesOrOpts });\n }\n return this.pipeline.sync({\n changedFiles: changedFilesOrOpts?.files,\n onProgress: changedFilesOrOpts?.onProgress,\n });\n }\n\n // \u2500\u2500 Symbol search \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n searchNodes(query: string, kindOrOpts?: NodeKind | SearchOptions, limit = 20): SearchResult[] {\n return this.searcher.search(query, kindOrOpts, limit);\n }\n\n // \u2500\u2500 Graph queries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async getCallers(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallers(nodeId, limit); }\n async getCallees(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallees(nodeId, limit); }\n async getImpactRadius(nodeId: string, depth = 2): Promise<Node[]> { return this.queryManager.getImpactRadius(nodeId, depth); }\n getAllNodes(): Node[] { return this.db.getAllNodes(); }\n getAllEdges(): Edge[] { return this.db.getAllEdges(); }\n findDeadCode(limit = 50): Node[] { return this.db.findDeadCode(limit); }\n findCircularDependencies(): string[][] { return this.db.findCircularDependencies(); }\n async findPath(fromId: string, toId: string, maxDepth = 10): Promise<Node[]> { return this.queryManager.findPath(fromId, toId, maxDepth); }\n getTypeHierarchy(nodeId: string, direction: 'up' | 'down' | 'both' = 'both'): Node[] { return this.db.getTypeHierarchy(nodeId, direction); }\n getNode(id: string): Node | null { return this.db.getNode(id); }\n getNodeContext(nodeId: string): NodeContext | null { return this.db.getNodeContext(nodeId); }\n getNodeMetrics(nodeId: string): NodeMetrics { return this.db.getNodeMetrics(nodeId); }\n\n getNodeSource(node: Node): string | null {\n const absPath = validatePathWithinRoot(path.join(this.projectRoot, node.filePath), this.projectRoot);\n if (!absPath) return null;\n try {\n return fs.readFileSync(absPath, 'utf8').split('\\n').slice(node.startLine - 1, node.endLine).join('\\n');\n } catch { return null; }\n }\n\n // \u2500\u2500 Context building \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async buildContext(task: string, opts?: { maxNodes?: number; includeCode?: boolean }): Promise<TaskContext> {\n return this.contextBuilder.buildTaskContext(task, opts);\n }\n\n // \u2500\u2500 File browsing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getFiles(opts?: { filterPath?: string; pattern?: string; maxDepth?: number }): FileTree {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const picomatch = opts?.pattern ? require('picomatch')(opts.pattern) : null;\n const filtered = this.db.getAllFiles().filter(f => {\n if (opts?.filterPath && !f.path.startsWith(opts.filterPath)) return false;\n if (picomatch && !picomatch(f.path)) return false;\n return true;\n });\n return buildFileTree(filtered, opts?.maxDepth);\n }\n\n getAffectedTests(changedFiles: string[], opts?: { depth?: number; testPattern?: string }): string[] {\n return this.queryManager.getAffectedTests(changedFiles, opts);\n }\n\n // \u2500\u2500 Graph insights \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n findHotspots(limit = 20): Array<Node & { degree: number; inDegree: number; outDegree: number }> {\n return this.db.findHotspots(limit);\n }\n\n findSurprisingConnections(limit = 20): Array<{ source: Node; target: Node; kind: string; score: number }> {\n return this.db.findSurprisingConnections(limit);\n }\n\n // \u2500\u2500 Snapshots \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n createSnapshotManager(): SnapshotManager {\n return new SnapshotManager(this.db, this.projectRoot);\n }\n\n // \u2500\u2500 Stats \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async getStats() {\n const stats = this.db.getStats();\n const vecIndexCount = await this.vectors.vecIndexCount();\n const embeddingCount = vecIndexCount > 0 ? vecIndexCount : stats.embeddingCount;\n const EMBEDDABLE = ['function', 'method', 'class', 'interface', 'type_alias', 'component', 'module'];\n const embeddableNodeCount = EMBEDDABLE.reduce((sum, k) => sum + (stats.nodesByKind[k] ?? 0), 0);\n const pendingFiles = await this.getPendingSyncCount();\n const syncRunning = this.isIndexLocked();\n return {\n ...stats,\n embeddingCount,\n embeddableNodeCount,\n embeddingsEnabled: this.config.enableEmbeddings ?? false,\n embeddingModel: this.config.embeddingModel,\n useVecIndex: this.config.useVecIndex ?? false,\n semanticEngine: this.config.semanticEngine ?? 'cosine',\n turbovecBits: this.config.turbovecBits,\n vecIndexCount,\n engineFallback: this.vectors.getEngineFallback(),\n frameworks: this.config.frameworkHints ?? [],\n architectureEnabled: this.config.enableArchitecture ?? false,\n ...(this.config.enableArchitecture ? { architectureStats: this.db.getArchStats() } : {}),\n pendingFiles,\n syncRunning,\n syncWarningThreshold: this.config.syncWarningThreshold ?? 10,\n };\n }\n\n getEngineFallback(): string | null { return this.vectors.getEngineFallback(); }\n\n // \u2500\u2500 Architecture API \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getArchitecture(): ArchitectureResult & {\n filePackages: Record<string, string[]>;\n fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>>;\n } {\n const base = this.db.getArchitectureResult();\n\n const filePackages: Record<string, string[]> = {};\n for (const { filePath, packageId } of this.db.getArchFilePackages()) {\n if (!filePackages[filePath]) filePackages[filePath] = [];\n filePackages[filePath].push(packageId);\n }\n\n const fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>> = {};\n for (const row of this.db.getArchFileLayers()) {\n if (!fileLayers[row.filePath]) fileLayers[row.filePath] = [];\n fileLayers[row.filePath].push({ layerId: row.layerId, confidence: row.confidence, matchedPattern: row.matchedPattern });\n }\n\n return { ...base, filePackages, fileLayers };\n }\n\n isArchitectureEnabled(): boolean { return this.config.enableArchitecture ?? false; }\n\n // \u2500\u2500 Misc \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getProjectRoot(): string { return this.projectRoot; }\n\n getDatabase(): GraphDatabase { return this.db; }\n\n close(): void {\n this.vectors.close();\n this.lock.release();\n this.db.close();\n }\n}\n\n// \u2500\u2500 Module-level helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Walk up directories to find the nearest .kirograph/ folder. */\nexport function findNearestKiroGraphRoot(startPath: string): string | null {\n let current = path.resolve(startPath);\n while (true) {\n if (fs.existsSync(path.join(current, KIROGRAPH_DIR))) return current;\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,WAAsB;AACtB,SAAoB;AACpB,sBAA8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
+
"sourcesContent": ["/**\n * KiroGraph \u2014 Semantic code knowledge graph for Kiro\n *\n * Pure facade. Every method delegates to a focused sub-system.\n * No business logic lives here.\n */\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { GraphDatabase } from './db/database';\nimport { validatePathWithinRoot, validateProjectPath } from './utils';\nimport { loadConfig, createDefaultConfig, saveConfig } from './config';\nimport type { KiroGraphConfig } from './config';\nimport { GraphQueryManager } from './graph/queries';\nimport { ReferenceResolver } from './resolution/index';\nimport { VectorManager } from './vectors/index';\nimport { ContextBuilder } from './context/index';\nimport { ArchitectureAnalyzer } from './architecture/index';\nimport { LockManager } from './core/lock-manager';\nimport { IndexPipeline } from './core/pipeline';\nimport { buildFileTree } from './core/file-tree';\nimport { SnapshotManager } from './core/snapshot';\nimport { Searcher } from './search/searcher';\nimport type { FileTreeNode, FileTree } from './core/file-tree';\nimport type { GraphSnapshot, GraphDiff } from './core/snapshot';\n\nexport type { GraphSnapshot, GraphDiff };\nimport type {\n Node, Edge, NodeKind, IndexResult, IndexProgress, SyncResult, TaskContext,\n SearchResult, SearchOptions, NodeContext, NodeMetrics,\n} from './types';\nimport type { ArchitectureResult } from './architecture/types';\n\nexport type { FileTreeNode, FileTree };\n\nconst KIROGRAPH_DIR = '.kirograph';\n\nexport default class KiroGraph {\n private readonly db: GraphDatabase;\n private readonly config: KiroGraphConfig;\n private readonly projectRoot: string;\n private readonly queryManager: GraphQueryManager;\n private readonly resolver: ReferenceResolver;\n private readonly vectors: VectorManager;\n private readonly contextBuilder: ContextBuilder;\n private readonly arch: ArchitectureAnalyzer;\n private readonly lock: LockManager;\n private readonly pipeline: IndexPipeline;\n private readonly searcher: Searcher;\n\n private constructor(projectRoot: string, db: GraphDatabase, config: KiroGraphConfig) {\n this.projectRoot = projectRoot;\n this.db = db;\n this.config = config;\n this.queryManager = new GraphQueryManager(db);\n this.resolver = new ReferenceResolver(db, config, projectRoot);\n this.vectors = new VectorManager(db, config, projectRoot);\n this.contextBuilder = new ContextBuilder(db, this.resolver, this.vectors, projectRoot);\n this.arch = new ArchitectureAnalyzer(db, config, projectRoot);\n this.lock = new LockManager(projectRoot);\n this.pipeline = new IndexPipeline(db, this.vectors, this.resolver, this.arch, this.lock, config, projectRoot);\n this.searcher = new Searcher(db);\n }\n\n // \u2500\u2500 Factory \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n static async init(\n projectRoot: string,\n config?: Partial<KiroGraphConfig>,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n fs.mkdirSync(path.join(resolved, KIROGRAPH_DIR), { recursive: true });\n const cfg = { ...createDefaultConfig(resolved), ...config };\n await saveConfig(resolved, cfg);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static async open(\n projectRoot: string,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n opts?: { skipVectors?: boolean },\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n if (!fs.existsSync(path.join(resolved, KIROGRAPH_DIR))) {\n throw new Error(`KiroGraph not initialized at ${resolved}. Run: kirograph init`);\n }\n const cfg = await loadConfig(resolved);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n if (!opts?.skipVectors) {\n await kg.vectors.initialize(onModelProgress);\n }\n return kg;\n }\n\n static isInitialized(projectRoot: string): boolean {\n return fs.existsSync(path.join(path.resolve(projectRoot), KIROGRAPH_DIR));\n }\n\n // \u2500\u2500 Lock / dirty marker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n unlockForce(): void { this.lock.forceRelease(); }\n markDirty(): void { this.lock.markDirty(); }\n clearDirty(): void { this.lock.clearDirty(); }\n isDirty(): boolean { return this.lock.isDirty(); }\n isIndexLocked(): boolean { return this.lock.isLocked(); }\n\n async syncIfDirty(): Promise<SyncResult | null> {\n if (!this.isDirty()) return null;\n return this.sync();\n }\n\n /**\n * Returns the number of files that have changed on disk but are not yet\n * reflected in the index. Used by the MCP status tool to warn the agent\n * when the index may be stale.\n */\n async getPendingSyncCount(): Promise<number> {\n try {\n const { getChangedFiles, scanDirectory } = await Promise.resolve().then(() => require('./sync/index.js'));\n const gitChanged = await getChangedFiles(this.projectRoot, this.config);\n const hasGitChanges =\n gitChanged.added.length > 0 ||\n gitChanged.modified.length > 0 ||\n gitChanged.removed.length > 0;\n\n if (hasGitChanges) {\n return gitChanged.added.length + gitChanged.modified.length + gitChanged.removed.length;\n }\n\n // Fallback: compare indexed set vs current filesystem set\n const indexed = new Set(this.db.getAllFiles().map((f: { path: string }) => f.path));\n const current = new Set(\n (await scanDirectory(this.projectRoot, this.config))\n .map(f => require('path').relative(this.projectRoot, f).replace(/\\\\/g, '/'))\n );\n let pending = 0;\n for (const p of indexed) { if (!current.has(p)) pending++; }\n for (const p of current) { if (!indexed.has(p)) pending++; }\n return pending;\n } catch {\n return 0;\n }\n }\n\n // \u2500\u2500 Indexing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async indexAll(opts?: { onProgress?: (p: IndexProgress) => void; force?: boolean; signal?: AbortSignal }): Promise<IndexResult> {\n return this.pipeline.indexAll(opts);\n }\n\n async sync(changedFilesOrOpts?: string[] | { files?: string[]; onProgress?: (p: IndexProgress) => void }): Promise<SyncResult> {\n if (Array.isArray(changedFilesOrOpts)) {\n return this.pipeline.sync({ changedFiles: changedFilesOrOpts });\n }\n return this.pipeline.sync({\n changedFiles: changedFilesOrOpts?.files,\n onProgress: changedFilesOrOpts?.onProgress,\n });\n }\n\n // \u2500\u2500 Symbol search \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n searchNodes(query: string, kindOrOpts?: NodeKind | SearchOptions, limit = 20): SearchResult[] {\n return this.searcher.search(query, kindOrOpts, limit);\n }\n\n // \u2500\u2500 Graph queries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async getCallers(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallers(nodeId, limit); }\n async getCallees(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallees(nodeId, limit); }\n async getImpactRadius(nodeId: string, depth = 2): Promise<Node[]> { return this.queryManager.getImpactRadius(nodeId, depth); }\n getAllNodes(): Node[] { return this.db.getAllNodes(); }\n getAllEdges(): Edge[] { return this.db.getAllEdges(); }\n findDeadCode(limit = 50): Node[] { return this.db.findDeadCode(limit); }\n findCircularDependencies(): string[][] { return this.db.findCircularDependencies(); }\n async findPath(fromId: string, toId: string, maxDepth = 10): Promise<Node[]> { return this.queryManager.findPath(fromId, toId, maxDepth); }\n getTypeHierarchy(nodeId: string, direction: 'up' | 'down' | 'both' = 'both'): Node[] { return this.db.getTypeHierarchy(nodeId, direction); }\n getNode(id: string): Node | null { return this.db.getNode(id); }\n getNodeContext(nodeId: string): NodeContext | null { return this.db.getNodeContext(nodeId); }\n getNodeMetrics(nodeId: string): NodeMetrics { return this.db.getNodeMetrics(nodeId); }\n\n getNodeSource(node: Node): string | null {\n const absPath = validatePathWithinRoot(path.join(this.projectRoot, node.filePath), this.projectRoot);\n if (!absPath) return null;\n try {\n return fs.readFileSync(absPath, 'utf8').split('\\n').slice(node.startLine - 1, node.endLine).join('\\n');\n } catch { return null; }\n }\n\n // \u2500\u2500 Context building \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async buildContext(task: string, opts?: { maxNodes?: number; includeCode?: boolean }): Promise<TaskContext> {\n return this.contextBuilder.buildTaskContext(task, opts);\n }\n\n // \u2500\u2500 File browsing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getFiles(opts?: { filterPath?: string; pattern?: string; maxDepth?: number }): FileTree {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const picomatch = opts?.pattern ? require('picomatch')(opts.pattern) : null;\n const filtered = this.db.getAllFiles().filter(f => {\n if (opts?.filterPath && !f.path.startsWith(opts.filterPath)) return false;\n if (picomatch && !picomatch(f.path)) return false;\n return true;\n });\n return buildFileTree(filtered, opts?.maxDepth);\n }\n\n getAffectedTests(changedFiles: string[], opts?: { depth?: number; testPattern?: string }): string[] {\n return this.queryManager.getAffectedTests(changedFiles, opts);\n }\n\n // \u2500\u2500 Graph insights \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n findHotspots(limit = 20): Array<Node & { degree: number; inDegree: number; outDegree: number }> {\n return this.db.findHotspots(limit);\n }\n\n findSurprisingConnections(limit = 20): Array<{ source: Node; target: Node; kind: string; score: number }> {\n return this.db.findSurprisingConnections(limit);\n }\n\n // \u2500\u2500 Snapshots \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n createSnapshotManager(): SnapshotManager {\n return new SnapshotManager(this.db, this.projectRoot);\n }\n\n // \u2500\u2500 Stats \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async getStats() {\n const stats = this.db.getStats();\n const vecIndexCount = await this.vectors.vecIndexCount();\n const embeddingCount = vecIndexCount > 0 ? vecIndexCount : stats.embeddingCount;\n const EMBEDDABLE = ['function', 'method', 'class', 'interface', 'type_alias', 'component', 'module'];\n const embeddableNodeCount = EMBEDDABLE.reduce((sum, k) => sum + (stats.nodesByKind[k] ?? 0), 0);\n const pendingFiles = await this.getPendingSyncCount();\n const syncRunning = this.isIndexLocked();\n return {\n ...stats,\n embeddingCount,\n embeddableNodeCount,\n embeddingsEnabled: this.config.enableEmbeddings ?? false,\n embeddingModel: this.config.embeddingModel,\n useVecIndex: this.config.useVecIndex ?? false,\n semanticEngine: this.config.semanticEngine ?? 'cosine',\n turbovecBits: this.config.turbovecBits,\n vecIndexCount,\n engineFallback: this.vectors.getEngineFallback(),\n frameworks: this.config.frameworkHints ?? [],\n architectureEnabled: this.config.enableArchitecture ?? false,\n ...(this.config.enableArchitecture ? { architectureStats: this.db.getArchStats() } : {}),\n pendingFiles,\n syncRunning,\n syncWarningThreshold: this.config.syncWarningThreshold ?? 10,\n };\n }\n\n getEngineFallback(): string | null { return this.vectors.getEngineFallback(); }\n\n // \u2500\u2500 Architecture API \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getArchitecture(): ArchitectureResult & {\n filePackages: Record<string, string[]>;\n fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>>;\n } {\n const base = this.db.getArchitectureResult();\n\n const filePackages: Record<string, string[]> = {};\n for (const { filePath, packageId } of this.db.getArchFilePackages()) {\n if (!filePackages[filePath]) filePackages[filePath] = [];\n filePackages[filePath].push(packageId);\n }\n\n const fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>> = {};\n for (const row of this.db.getArchFileLayers()) {\n if (!fileLayers[row.filePath]) fileLayers[row.filePath] = [];\n fileLayers[row.filePath].push({ layerId: row.layerId, confidence: row.confidence, matchedPattern: row.matchedPattern });\n }\n\n return { ...base, filePackages, fileLayers };\n }\n\n isArchitectureEnabled(): boolean { return this.config.enableArchitecture ?? false; }\n\n // \u2500\u2500 Misc \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getProjectRoot(): string { return this.projectRoot; }\n\n getDatabase(): GraphDatabase { return this.db; }\n\n close(): void {\n this.vectors.close();\n this.lock.release();\n this.db.close();\n }\n}\n\n// \u2500\u2500 Module-level helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Walk up directories to find the nearest .kirograph/ folder. */\nexport function findNearestKiroGraphRoot(startPath: string): string | null {\n let current = path.resolve(startPath);\n while (true) {\n if (fs.existsSync(path.join(current, KIROGRAPH_DIR))) return current;\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,WAAsB;AACtB,SAAoB;AACpB,sBAA8B;AAC9B,mBAA4D;AAC5D,oBAA4D;AAE5D,qBAAkC;AAClC,wBAAkC;AAClC,qBAA8B;AAC9B,qBAA+B;AAC/B,0BAAqC;AACrC,0BAA4B;AAC5B,sBAA8B;AAC9B,uBAA8B;AAC9B,sBAAgC;AAChC,sBAAyB;AAazB,MAAM,gBAAgB;AAEtB,MAAO,UAAwB;AAAA,EAarB,YAAY,aAAqB,IAAmB,QAAyB;AACnF,SAAK,cAAc;AACnB,SAAK,KAAK;AACV,SAAK,SAAS;AACd,SAAK,eAAe,IAAI,iCAAkB,EAAE;AAC5C,SAAK,WAAW,IAAI,oCAAkB,IAAI,QAAQ,WAAW;AAC7D,SAAK,UAAU,IAAI,6BAAc,IAAI,QAAQ,WAAW;AACxD,SAAK,iBAAiB,IAAI,8BAAe,IAAI,KAAK,U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"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var handler_exports = {};
|
|
30
|
+
__export(handler_exports, {
|
|
31
|
+
ToolHandler: () => ToolHandler
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(handler_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_child_process = require("child_process");
|
|
37
|
+
var import__ = __toESM(require("../index"));
|
|
38
|
+
var import_errors = require("../errors");
|
|
39
|
+
var import_compression = require("../compression/index");
|
|
40
|
+
var import_tracker = require("../compression/tracker");
|
|
41
|
+
var import_utils = require("./handlers/utils");
|
|
42
|
+
var import_core = require("./handlers/core");
|
|
43
|
+
var import_code_health = require("./handlers/code-health");
|
|
44
|
+
var import_architecture = require("./handlers/architecture");
|
|
45
|
+
var import_edit_primitives = require("./handlers/edit-primitives");
|
|
46
|
+
var import_git_context = require("./handlers/git-context");
|
|
47
|
+
var import_complexity = require("./handlers/complexity");
|
|
48
|
+
var import_memory = require("./handlers/memory");
|
|
49
|
+
var import_docs = require("./handlers/docs");
|
|
50
|
+
var import_data = require("./handlers/data");
|
|
51
|
+
var import_watchmen = require("./handlers/watchmen");
|
|
52
|
+
var import_security = require("./handlers/security");
|
|
53
|
+
var import_patterns = require("./handlers/patterns");
|
|
54
|
+
var import_wiki = require("./handlers/wiki");
|
|
55
|
+
var import_branch = require("./handlers/branch");
|
|
56
|
+
const CORE_TOOLS = /* @__PURE__ */ new Set([
|
|
57
|
+
"kirograph_search",
|
|
58
|
+
"kirograph_context",
|
|
59
|
+
"kirograph_callers",
|
|
60
|
+
"kirograph_callees",
|
|
61
|
+
"kirograph_impact",
|
|
62
|
+
"kirograph_node",
|
|
63
|
+
"kirograph_status",
|
|
64
|
+
"kirograph_files",
|
|
65
|
+
"kirograph_affected"
|
|
66
|
+
]);
|
|
67
|
+
const CODE_HEALTH_TOOLS = /* @__PURE__ */ new Set([
|
|
68
|
+
"kirograph_dead_code",
|
|
69
|
+
"kirograph_circular_deps",
|
|
70
|
+
"kirograph_path",
|
|
71
|
+
"kirograph_type_hierarchy",
|
|
72
|
+
"kirograph_hotspots",
|
|
73
|
+
"kirograph_surprising",
|
|
74
|
+
"kirograph_diff",
|
|
75
|
+
"kirograph_snapshot_save",
|
|
76
|
+
"kirograph_snapshot_list",
|
|
77
|
+
"kirograph_module_api",
|
|
78
|
+
"kirograph_rename_preview",
|
|
79
|
+
"kirograph_doc_coverage",
|
|
80
|
+
"kirograph_god_class",
|
|
81
|
+
"kirograph_inheritance_depth",
|
|
82
|
+
"kirograph_recursion",
|
|
83
|
+
"kirograph_largest",
|
|
84
|
+
"kirograph_rank",
|
|
85
|
+
"kirograph_distribution",
|
|
86
|
+
"kirograph_annotations",
|
|
87
|
+
"kirograph_session_start",
|
|
88
|
+
"kirograph_session_end",
|
|
89
|
+
"kirograph_unused_imports",
|
|
90
|
+
"kirograph_gini",
|
|
91
|
+
"kirograph_dependency_depth"
|
|
92
|
+
]);
|
|
93
|
+
const ARCHITECTURE_TOOLS = /* @__PURE__ */ new Set([
|
|
94
|
+
"kirograph_architecture",
|
|
95
|
+
"kirograph_coupling",
|
|
96
|
+
"kirograph_package",
|
|
97
|
+
"kirograph_communities",
|
|
98
|
+
"kirograph_manifest"
|
|
99
|
+
]);
|
|
100
|
+
const GIT_CONTEXT_TOOLS = /* @__PURE__ */ new Set([
|
|
101
|
+
"kirograph_flows",
|
|
102
|
+
"kirograph_diff_context",
|
|
103
|
+
"kirograph_commit_context",
|
|
104
|
+
"kirograph_pr_context",
|
|
105
|
+
"kirograph_changelog",
|
|
106
|
+
"kirograph_test_map",
|
|
107
|
+
"kirograph_test_coverage"
|
|
108
|
+
]);
|
|
109
|
+
const COMPLEXITY_TOOLS = /* @__PURE__ */ new Set([
|
|
110
|
+
"kirograph_complexity",
|
|
111
|
+
"kirograph_simplify_scan",
|
|
112
|
+
"kirograph_health",
|
|
113
|
+
"kirograph_dsm",
|
|
114
|
+
"kirograph_test_risk"
|
|
115
|
+
]);
|
|
116
|
+
const BRANCH_TOOLS = /* @__PURE__ */ new Set(["kirograph_branch_list", "kirograph_branch_diff", "kirograph_branch_search"]);
|
|
117
|
+
const EDIT_PRIMITIVES_TOOLS = /* @__PURE__ */ new Set([
|
|
118
|
+
"kirograph_refactor",
|
|
119
|
+
"kirograph_str_replace",
|
|
120
|
+
"kirograph_multi_str_replace",
|
|
121
|
+
"kirograph_insert_at",
|
|
122
|
+
"kirograph_ast_grep_rewrite"
|
|
123
|
+
]);
|
|
124
|
+
const SECURITY_TOOLS = /* @__PURE__ */ new Set([
|
|
125
|
+
"kirograph_security",
|
|
126
|
+
"kirograph_vulns",
|
|
127
|
+
"kirograph_vuln_add",
|
|
128
|
+
"kirograph_vuln_suppress",
|
|
129
|
+
"kirograph_sbom",
|
|
130
|
+
"kirograph_vex",
|
|
131
|
+
"kirograph_reachability",
|
|
132
|
+
"kirograph_staleness",
|
|
133
|
+
"kirograph_licenses",
|
|
134
|
+
"kirograph_attack_surface",
|
|
135
|
+
"kirograph_secrets",
|
|
136
|
+
"kirograph_security_flows",
|
|
137
|
+
"kirograph_supply_chain",
|
|
138
|
+
"kirograph_dep_confusion",
|
|
139
|
+
"kirograph_remediation"
|
|
140
|
+
]);
|
|
141
|
+
const PATTERNS_TOOLS = /* @__PURE__ */ new Set([
|
|
142
|
+
"kirograph_live_search",
|
|
143
|
+
"kirograph_pattern_coverage",
|
|
144
|
+
"kirograph_pattern_save_baseline",
|
|
145
|
+
"kirograph_pattern_diff"
|
|
146
|
+
]);
|
|
147
|
+
const WATCHMEN_TOOLS = /* @__PURE__ */ new Set([
|
|
148
|
+
"kirograph_watchmen_status",
|
|
149
|
+
"kirograph_watchmen_synthesize",
|
|
150
|
+
"kirograph_watchmen_reset"
|
|
151
|
+
]);
|
|
152
|
+
class ToolHandler {
|
|
153
|
+
constructor(cg) {
|
|
154
|
+
this.connections = /* @__PURE__ */ new Map();
|
|
155
|
+
this.defaultCg = cg;
|
|
156
|
+
}
|
|
157
|
+
setDefaultKiroGraph(cg) {
|
|
158
|
+
this.defaultCg = cg;
|
|
159
|
+
}
|
|
160
|
+
/** Close all cached cross-project connections. */
|
|
161
|
+
closeAll() {
|
|
162
|
+
for (const cg of this.connections.values()) {
|
|
163
|
+
try {
|
|
164
|
+
cg.close();
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
this.connections.clear();
|
|
169
|
+
}
|
|
170
|
+
async getConnection(projectPath) {
|
|
171
|
+
if (!projectPath) return this.defaultCg;
|
|
172
|
+
const resolved = import_path.default.resolve(projectPath);
|
|
173
|
+
if (!import_path.default.isAbsolute(resolved)) return null;
|
|
174
|
+
if (this.connections.has(resolved)) return this.connections.get(resolved);
|
|
175
|
+
try {
|
|
176
|
+
const cg = await import__.default.open(resolved);
|
|
177
|
+
this.connections.set(resolved, cg);
|
|
178
|
+
return cg;
|
|
179
|
+
} catch {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async handle(toolName, args) {
|
|
184
|
+
try {
|
|
185
|
+
const text = await this.dispatch(toolName, args);
|
|
186
|
+
const truncated = (0, import_utils.truncate)(text);
|
|
187
|
+
let metricsTrailer = "";
|
|
188
|
+
if (toolName !== "kirograph_exec" && toolName !== "kirograph_gain") {
|
|
189
|
+
try {
|
|
190
|
+
const projectRoot = args.projectPath || this.defaultCg?.getProjectRoot() || process.cwd();
|
|
191
|
+
const { estimateNaiveCost } = await Promise.resolve().then(() => require("../compression/naive-cost.js"));
|
|
192
|
+
const { estimateTokens } = await Promise.resolve().then(() => require("../compression/index.js"));
|
|
193
|
+
const outputTokens = estimateTokens(truncated);
|
|
194
|
+
const naiveCost = estimateNaiveCost(toolName, outputTokens, args);
|
|
195
|
+
if (naiveCost !== null && naiveCost > outputTokens) {
|
|
196
|
+
const tracker = new import_tracker.TokenTracker(projectRoot);
|
|
197
|
+
if (toolName.startsWith("kirograph_mem_")) {
|
|
198
|
+
tracker.recordMemorySaving(toolName, outputTokens, naiveCost);
|
|
199
|
+
} else if (toolName.startsWith("kirograph_docs_")) {
|
|
200
|
+
tracker.recordDocsSaving(toolName, outputTokens, naiveCost);
|
|
201
|
+
} else if (toolName.startsWith("kirograph_data_")) {
|
|
202
|
+
tracker.recordDataSaving(toolName, outputTokens, naiveCost);
|
|
203
|
+
} else {
|
|
204
|
+
tracker.recordGraphSaving(toolName, outputTokens, naiveCost);
|
|
205
|
+
}
|
|
206
|
+
const saved = Math.round((naiveCost - outputTokens) / naiveCost * 100);
|
|
207
|
+
metricsTrailer = `
|
|
208
|
+
|
|
209
|
+
[kirograph_metrics: before=${naiveCost} after=${outputTokens} saved=${saved}%]`;
|
|
210
|
+
} else {
|
|
211
|
+
metricsTrailer = `
|
|
212
|
+
|
|
213
|
+
[kirograph_metrics: tokens=${outputTokens}]`;
|
|
214
|
+
}
|
|
215
|
+
} catch {
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return { content: [{ type: "text", text: truncated + metricsTrailer }] };
|
|
219
|
+
} catch (err) {
|
|
220
|
+
(0, import_errors.logError)("MCP tool error", { tool: toolName, error: err });
|
|
221
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
222
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async dispatch(toolName, args) {
|
|
226
|
+
if (toolName === "kirograph_exec") {
|
|
227
|
+
const cmd = args.command;
|
|
228
|
+
if (!cmd) return "Error: command is required.";
|
|
229
|
+
const projectRoot = args.projectPath || args.cwd || process.cwd();
|
|
230
|
+
const execCwd = args.cwd || projectRoot;
|
|
231
|
+
let defaultLevel = "normal";
|
|
232
|
+
try {
|
|
233
|
+
const { loadConfig } = await Promise.resolve().then(() => require("../config.js"));
|
|
234
|
+
const config = await loadConfig(projectRoot);
|
|
235
|
+
if (config.shellCompressionLevel && config.shellCompressionLevel !== "off") {
|
|
236
|
+
defaultLevel = config.shellCompressionLevel;
|
|
237
|
+
}
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
const level = args.level ?? defaultLevel;
|
|
241
|
+
const timeout = (args.timeout ?? 60) * 1e3;
|
|
242
|
+
let rawOutput;
|
|
243
|
+
let exitCode = 0;
|
|
244
|
+
try {
|
|
245
|
+
rawOutput = (0, import_child_process.execSync)(cmd, {
|
|
246
|
+
cwd: execCwd,
|
|
247
|
+
timeout,
|
|
248
|
+
encoding: "utf8",
|
|
249
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
250
|
+
maxBuffer: 10 * 1024 * 1024
|
|
251
|
+
});
|
|
252
|
+
} catch (err) {
|
|
253
|
+
rawOutput = (err.stdout || "") + (err.stderr || "");
|
|
254
|
+
exitCode = err.status ?? 1;
|
|
255
|
+
}
|
|
256
|
+
const result = (0, import_compression.compress)(cmd, rawOutput, { level, preserveErrors: exitCode !== 0 });
|
|
257
|
+
const tracker = new import_tracker.TokenTracker(projectRoot);
|
|
258
|
+
tracker.record(cmd, result.originalTokens, result.compressedTokens, result.strategy);
|
|
259
|
+
const header = exitCode !== 0 ? `[exit ${exitCode}] ` : "";
|
|
260
|
+
const footer = result.savings > 5 ? `
|
|
261
|
+
|
|
262
|
+
[${result.savings}% tokens saved | ${result.originalTokens}\u2192${result.compressedTokens} | ${result.strategy}]` : "";
|
|
263
|
+
return `${header}${result.output}${footer}`;
|
|
264
|
+
}
|
|
265
|
+
if (toolName === "kirograph_gain") {
|
|
266
|
+
const projectRoot = args.projectPath || process.cwd();
|
|
267
|
+
const period = args.period ?? "session";
|
|
268
|
+
const tracker = new import_tracker.TokenTracker(projectRoot);
|
|
269
|
+
const stats = tracker.getStats(period);
|
|
270
|
+
if (stats.totalCommands === 0) {
|
|
271
|
+
return "No savings recorded yet. Use kirograph tools and kirograph_exec \u2014 savings are tracked automatically.";
|
|
272
|
+
}
|
|
273
|
+
const lines = [
|
|
274
|
+
`Token Savings (${period}):`,
|
|
275
|
+
` Total calls: ${stats.totalCommands}`,
|
|
276
|
+
` Tokens without KiroGraph: ~${stats.totalOriginal.toLocaleString()}`,
|
|
277
|
+
` Tokens with KiroGraph: ~${stats.totalCompressed.toLocaleString()}`,
|
|
278
|
+
` Saved: ${stats.totalSaved.toLocaleString()} tokens (${stats.savingsPercent}%)`
|
|
279
|
+
];
|
|
280
|
+
if (stats.bySource.exec.count > 0 || stats.bySource.graph.count > 0 || stats.bySource.memory.count > 0 || stats.bySource.docs.count > 0) {
|
|
281
|
+
lines.push("", "By source:");
|
|
282
|
+
if (stats.bySource.graph.count > 0) {
|
|
283
|
+
lines.push(` Graph tools: ${stats.bySource.graph.count} calls, ~${stats.bySource.graph.saved.toLocaleString()} tokens saved (vs file reads/grep)`);
|
|
284
|
+
}
|
|
285
|
+
if (stats.bySource.docs.count > 0) {
|
|
286
|
+
lines.push(` Docs tools: ${stats.bySource.docs.count} calls, ~${stats.bySource.docs.saved.toLocaleString()} tokens saved (vs reading full doc files)`);
|
|
287
|
+
}
|
|
288
|
+
if (stats.bySource.data.count > 0) {
|
|
289
|
+
lines.push(` Data tools: ${stats.bySource.data.count} calls, ~${stats.bySource.data.saved.toLocaleString()} tokens saved (vs loading raw data files)`);
|
|
290
|
+
}
|
|
291
|
+
if (stats.bySource.exec.count > 0) {
|
|
292
|
+
lines.push(` Compression: ${stats.bySource.exec.count} calls, ~${stats.bySource.exec.saved.toLocaleString()} tokens saved (vs raw output)`);
|
|
293
|
+
}
|
|
294
|
+
if (stats.bySource.memory.count > 0) {
|
|
295
|
+
lines.push(` Memory: ${stats.bySource.memory.count} calls, ~${stats.bySource.memory.saved.toLocaleString()} tokens saved (vs re-discovering context)`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (Object.keys(stats.byFamily).length > 0) {
|
|
299
|
+
lines.push("", "Top families:");
|
|
300
|
+
for (const [family, data] of Object.entries(stats.byFamily).slice(0, 7)) {
|
|
301
|
+
lines.push(` ${family}: ${data.count} calls, ${data.savings}% avg savings`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (stats.recentCommands.length > 0) {
|
|
305
|
+
lines.push("", "Recent:");
|
|
306
|
+
for (const cmd of stats.recentCommands.slice(0, 5)) {
|
|
307
|
+
const tag = cmd.source === "graph" ? "\u{1F4CA}" : "\u26A1";
|
|
308
|
+
lines.push(` ${tag} ${cmd.command.slice(0, 40)} \u2192 ${cmd.savings}% saved`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return lines.join("\n");
|
|
312
|
+
}
|
|
313
|
+
if (toolName === "kirograph_read") {
|
|
314
|
+
const filePath = args.path;
|
|
315
|
+
if (!filePath) return "Error: path is required.";
|
|
316
|
+
const projectRoot = args.projectPath || process.cwd();
|
|
317
|
+
const resolvedPath = import_path.default.isAbsolute(filePath) ? filePath : import_path.default.join(projectRoot, filePath);
|
|
318
|
+
const mode = args.mode ?? "full";
|
|
319
|
+
const noCache = args.noCache ?? false;
|
|
320
|
+
if (!import_fs.default.existsSync(resolvedPath)) {
|
|
321
|
+
return `Error: File not found: ${resolvedPath}`;
|
|
322
|
+
}
|
|
323
|
+
const { getFileReadCache } = await Promise.resolve().then(() => require("./cache.js"));
|
|
324
|
+
const { executeReadMode } = await Promise.resolve().then(() => require("./read-modes.js"));
|
|
325
|
+
const cache = getFileReadCache();
|
|
326
|
+
if (mode !== "full") {
|
|
327
|
+
let cg2 = null;
|
|
328
|
+
try {
|
|
329
|
+
cg2 = await this.getConnection(args.projectPath);
|
|
330
|
+
} catch {
|
|
331
|
+
}
|
|
332
|
+
const result2 = executeReadMode({
|
|
333
|
+
mode,
|
|
334
|
+
filePath: resolvedPath,
|
|
335
|
+
start: args.start,
|
|
336
|
+
end: args.end,
|
|
337
|
+
cg: cg2
|
|
338
|
+
});
|
|
339
|
+
cache.read(resolvedPath, true);
|
|
340
|
+
return result2.content;
|
|
341
|
+
}
|
|
342
|
+
const result = cache.read(resolvedPath, noCache);
|
|
343
|
+
if (result.cached) {
|
|
344
|
+
return result.content;
|
|
345
|
+
}
|
|
346
|
+
if (result.changed) {
|
|
347
|
+
return `[file changed since last read]
|
|
348
|
+
|
|
349
|
+
${result.content}`;
|
|
350
|
+
}
|
|
351
|
+
return result.content;
|
|
352
|
+
}
|
|
353
|
+
if (toolName === "kirograph_retrieve") {
|
|
354
|
+
const filePath = args.path;
|
|
355
|
+
if (!filePath) return "Error: path is required.";
|
|
356
|
+
const projectRoot = args.projectPath || process.cwd();
|
|
357
|
+
const resolvedPath = import_path.default.isAbsolute(filePath) ? filePath : import_path.default.join(projectRoot, filePath);
|
|
358
|
+
const { getFileReadCache } = await Promise.resolve().then(() => require("./cache.js"));
|
|
359
|
+
const cache = getFileReadCache();
|
|
360
|
+
const cached = cache.getPreviousContent(resolvedPath);
|
|
361
|
+
if (cached !== void 0) {
|
|
362
|
+
return cached;
|
|
363
|
+
}
|
|
364
|
+
if (!import_fs.default.existsSync(resolvedPath)) {
|
|
365
|
+
return `Error: File not found: ${resolvedPath}`;
|
|
366
|
+
}
|
|
367
|
+
const result = cache.read(resolvedPath, true);
|
|
368
|
+
return result.content;
|
|
369
|
+
}
|
|
370
|
+
if (toolName === "kirograph_compress") {
|
|
371
|
+
const text = args.text;
|
|
372
|
+
if (!text) return "Error: text is required.";
|
|
373
|
+
const rawLevel = args.level ?? "full";
|
|
374
|
+
const command = args.command;
|
|
375
|
+
const { estimateTokens: est } = await Promise.resolve().then(() => require("../compression/index.js"));
|
|
376
|
+
const originalTokens = est(text);
|
|
377
|
+
let compressed;
|
|
378
|
+
let strategy;
|
|
379
|
+
if (command) {
|
|
380
|
+
const shellLevel = rawLevel === "ultra" ? "ultra" : rawLevel === "lite" || rawLevel === "normal" ? "normal" : "aggressive";
|
|
381
|
+
const { compress: compress2 } = await Promise.resolve().then(() => require("../compression/index.js"));
|
|
382
|
+
const result = compress2(command, text, { level: shellLevel });
|
|
383
|
+
compressed = result.output;
|
|
384
|
+
strategy = `rtk:${result.commandFamily}:${shellLevel}`;
|
|
385
|
+
} else {
|
|
386
|
+
const cavemanLevel = rawLevel === "normal" || rawLevel === "lite" ? "lite" : rawLevel === "aggressive" ? "full" : rawLevel;
|
|
387
|
+
const { compressObservation } = await Promise.resolve().then(() => require("../memory/compress.js"));
|
|
388
|
+
const result = compressObservation(text, cavemanLevel);
|
|
389
|
+
compressed = result.compressed;
|
|
390
|
+
strategy = `caveman:${cavemanLevel}`;
|
|
391
|
+
}
|
|
392
|
+
const compressedTokens = est(compressed);
|
|
393
|
+
const savings = originalTokens > 0 ? Math.round((originalTokens - compressedTokens) / originalTokens * 100) : 0;
|
|
394
|
+
const footer = savings > 5 ? `
|
|
395
|
+
|
|
396
|
+
[${savings}% tokens saved | ${originalTokens}\u2192${compressedTokens} | ${strategy}]` : "";
|
|
397
|
+
return compressed + footer;
|
|
398
|
+
}
|
|
399
|
+
if (toolName === "kirograph_budget") {
|
|
400
|
+
const projectRoot = args.projectPath || process.cwd();
|
|
401
|
+
const reset = args.reset ?? false;
|
|
402
|
+
const { BudgetTracker } = await Promise.resolve().then(() => require("../compression/tracker.js"));
|
|
403
|
+
const budget = BudgetTracker.getInstance(projectRoot);
|
|
404
|
+
if (reset) {
|
|
405
|
+
budget.reset();
|
|
406
|
+
return "Context budget counters reset.";
|
|
407
|
+
}
|
|
408
|
+
const status = budget.getStatus();
|
|
409
|
+
const lines = [
|
|
410
|
+
"Context Budget:",
|
|
411
|
+
` Tokens consumed: ${status.consumed.toLocaleString()}`,
|
|
412
|
+
` Budget limit: ${status.limit > 0 ? status.limit.toLocaleString() : "unlimited"}`,
|
|
413
|
+
` Remaining: ${status.limit > 0 ? status.remaining.toLocaleString() : "\u221E"}`,
|
|
414
|
+
` Utilization: ${status.utilization}%`
|
|
415
|
+
];
|
|
416
|
+
if (status.warning) {
|
|
417
|
+
lines.push(`
|
|
418
|
+
\u26A0 ${status.warning}`);
|
|
419
|
+
}
|
|
420
|
+
return lines.join("\n");
|
|
421
|
+
}
|
|
422
|
+
const cg = await this.getConnection(args.projectPath);
|
|
423
|
+
if (!cg) return "KiroGraph not initialized. Run `kirograph init` in your project first.";
|
|
424
|
+
(0, import_utils.writeSessionMarker)(cg.getProjectRoot());
|
|
425
|
+
if (CORE_TOOLS.has(toolName)) return (0, import_core.handleCore)(toolName, args, cg);
|
|
426
|
+
if (CODE_HEALTH_TOOLS.has(toolName)) return (0, import_code_health.handleCodeHealth)(toolName, args, cg);
|
|
427
|
+
if (ARCHITECTURE_TOOLS.has(toolName)) return (0, import_architecture.handleArchitecture)(toolName, args, cg);
|
|
428
|
+
if (GIT_CONTEXT_TOOLS.has(toolName)) return (0, import_git_context.handleGitContext)(toolName, args, cg);
|
|
429
|
+
if (COMPLEXITY_TOOLS.has(toolName)) return (0, import_complexity.handleComplexity)(toolName, args, cg);
|
|
430
|
+
if (BRANCH_TOOLS.has(toolName)) return (0, import_branch.handleBranch)(toolName, args, cg);
|
|
431
|
+
if (EDIT_PRIMITIVES_TOOLS.has(toolName)) return (0, import_edit_primitives.handleEditPrimitives)(toolName, args, cg);
|
|
432
|
+
if (SECURITY_TOOLS.has(toolName)) return (0, import_security.handleSecurity)(toolName, args, cg);
|
|
433
|
+
if (PATTERNS_TOOLS.has(toolName)) return (0, import_patterns.handlePatterns)(toolName, args, cg);
|
|
434
|
+
if (WATCHMEN_TOOLS.has(toolName)) return (0, import_watchmen.handleWatchmen)(toolName, args, cg);
|
|
435
|
+
if (toolName.startsWith("kirograph_mem_")) return (0, import_memory.handleMemory)(toolName, args, cg);
|
|
436
|
+
if (toolName.startsWith("kirograph_docs_")) return (0, import_docs.handleDocs)(toolName, args, cg);
|
|
437
|
+
if (toolName.startsWith("kirograph_data_")) return (0, import_data.handleData)(toolName, args, cg);
|
|
438
|
+
if (toolName.startsWith("kirograph_wiki_")) return (0, import_wiki.handleWiki)(toolName, args, cg);
|
|
439
|
+
return `Unknown tool: ${toolName}`;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
443
|
+
0 && (module.exports = {
|
|
444
|
+
ToolHandler
|
|
445
|
+
});
|
|
446
|
+
//# sourceMappingURL=handler.js.map
|