kirograph 0.17.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +105 -1822
- package/dist/architecture/layers/dart.d.ts +10 -0
- package/dist/architecture/layers/dart.d.ts.map +1 -0
- package/dist/architecture/layers/dart.js +112 -0
- package/dist/architecture/layers/dart.js.map +7 -0
- package/dist/architecture/layers/elixir.d.ts +6 -0
- package/dist/architecture/layers/elixir.d.ts.map +1 -0
- package/dist/architecture/layers/index.d.ts.map +1 -1
- package/dist/architecture/layers/index.js +3 -1
- package/dist/architecture/layers/index.js.map +2 -2
- package/dist/architecture/layers/ocaml.d.ts +6 -0
- package/dist/architecture/layers/ocaml.d.ts.map +1 -0
- package/dist/architecture/layers/scala.d.ts +6 -0
- package/dist/architecture/layers/scala.d.ts.map +1 -0
- package/dist/architecture/layers/solidity.d.ts +6 -0
- package/dist/architecture/layers/solidity.d.ts.map +1 -0
- package/dist/architecture/layers/vue.d.ts +6 -0
- package/dist/architecture/layers/vue.d.ts.map +1 -0
- package/dist/architecture/manifest/elm.d.ts +3 -0
- package/dist/architecture/manifest/elm.d.ts.map +1 -0
- package/dist/architecture/manifest/index.d.ts.map +1 -1
- package/dist/architecture/manifest/ocaml.d.ts +3 -0
- package/dist/architecture/manifest/ocaml.d.ts.map +1 -0
- package/dist/architecture/manifest/scala.d.ts +3 -0
- package/dist/architecture/manifest/scala.d.ts.map +1 -0
- package/dist/bin/banner.d.ts.map +1 -1
- package/dist/bin/banner.js +74 -6
- package/dist/bin/banner.js.map +2 -2
- package/dist/bin/commands/affected.d.ts.map +1 -1
- package/dist/bin/commands/attack-surface.d.ts +3 -0
- package/dist/bin/commands/attack-surface.d.ts.map +1 -0
- package/dist/bin/commands/attack-surface.js +164 -0
- package/dist/bin/commands/attack-surface.js.map +7 -0
- package/dist/bin/commands/benchmark.d.ts +9 -0
- package/dist/bin/commands/benchmark.d.ts.map +1 -0
- package/dist/bin/commands/benchmark.js +206 -0
- package/dist/bin/commands/benchmark.js.map +7 -0
- package/dist/bin/commands/budget.d.ts +6 -0
- package/dist/bin/commands/budget.d.ts.map +1 -0
- package/dist/bin/commands/budget.js +70 -0
- package/dist/bin/commands/budget.js.map +7 -0
- package/dist/bin/commands/caveman.d.ts +7 -0
- package/dist/bin/commands/caveman.d.ts.map +1 -0
- package/dist/bin/commands/communities.d.ts +3 -0
- package/dist/bin/commands/communities.d.ts.map +1 -0
- package/dist/bin/commands/communities.js +77 -0
- package/dist/bin/commands/communities.js.map +7 -0
- package/dist/bin/commands/compression.d.ts +7 -0
- package/dist/bin/commands/compression.d.ts.map +1 -0
- package/dist/bin/commands/context.d.ts.map +1 -1
- package/dist/bin/commands/data.d.ts +3 -0
- package/dist/bin/commands/data.d.ts.map +1 -0
- package/dist/bin/commands/dead-code.d.ts +3 -0
- package/dist/bin/commands/dead-code.d.ts.map +1 -0
- package/dist/bin/commands/dep-confusion.d.ts +3 -0
- package/dist/bin/commands/dep-confusion.d.ts.map +1 -0
- package/dist/bin/commands/dep-confusion.js +119 -0
- package/dist/bin/commands/dep-confusion.js.map +7 -0
- package/dist/bin/commands/docs.d.ts +3 -0
- package/dist/bin/commands/docs.d.ts.map +1 -0
- package/dist/bin/commands/exec.d.ts +11 -0
- package/dist/bin/commands/exec.d.ts.map +1 -0
- package/dist/bin/commands/export.d.ts +3 -0
- package/dist/bin/commands/export.d.ts.map +1 -0
- package/dist/bin/commands/export.js +304 -10
- package/dist/bin/commands/export.js.map +2 -2
- package/dist/bin/commands/flows.d.ts +3 -0
- package/dist/bin/commands/flows.d.ts.map +1 -0
- package/dist/bin/commands/flows.js +97 -0
- package/dist/bin/commands/flows.js.map +7 -0
- package/dist/bin/commands/gain.d.ts +6 -0
- package/dist/bin/commands/gain.d.ts.map +1 -0
- package/dist/bin/commands/help.d.ts +7 -0
- package/dist/bin/commands/help.d.ts.map +1 -1
- package/dist/bin/commands/help.js +399 -101
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/hotspots.d.ts +3 -0
- package/dist/bin/commands/hotspots.d.ts.map +1 -0
- package/dist/bin/commands/hotspots.js +94 -1
- package/dist/bin/commands/hotspots.js.map +3 -3
- package/dist/bin/commands/install.d.ts.map +1 -1
- package/dist/bin/commands/install.js +90 -8
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.d.ts +3 -0
- package/dist/bin/commands/licenses.d.ts.map +1 -0
- package/dist/bin/commands/licenses.js +201 -0
- package/dist/bin/commands/licenses.js.map +7 -0
- package/dist/bin/commands/memory.d.ts +16 -0
- package/dist/bin/commands/memory.d.ts.map +1 -0
- package/dist/bin/commands/memory.js +151 -4
- package/dist/bin/commands/memory.js.map +2 -2
- package/dist/bin/commands/path.d.ts +3 -0
- package/dist/bin/commands/path.d.ts.map +1 -0
- package/dist/bin/commands/pattern.d.ts +3 -0
- package/dist/bin/commands/pattern.d.ts.map +1 -0
- package/dist/bin/commands/pattern.js +592 -0
- package/dist/bin/commands/pattern.js.map +7 -0
- package/dist/bin/commands/query.d.ts.map +1 -1
- package/dist/bin/commands/reachability.d.ts +3 -0
- package/dist/bin/commands/reachability.d.ts.map +1 -0
- package/dist/bin/commands/reachability.js +160 -0
- package/dist/bin/commands/reachability.js.map +7 -0
- package/dist/bin/commands/read.d.ts +6 -0
- package/dist/bin/commands/read.d.ts.map +1 -0
- package/dist/bin/commands/read.js +100 -0
- package/dist/bin/commands/read.js.map +7 -0
- package/dist/bin/commands/refactor.d.ts +3 -0
- package/dist/bin/commands/refactor.d.ts.map +1 -0
- package/dist/bin/commands/refactor.js +116 -0
- package/dist/bin/commands/refactor.js.map +7 -0
- package/dist/bin/commands/remediation.d.ts +3 -0
- package/dist/bin/commands/remediation.d.ts.map +1 -0
- package/dist/bin/commands/remediation.js +133 -0
- package/dist/bin/commands/remediation.js.map +7 -0
- package/dist/bin/commands/sbom.d.ts +3 -0
- package/dist/bin/commands/sbom.d.ts.map +1 -0
- package/dist/bin/commands/sbom.js +76 -0
- package/dist/bin/commands/sbom.js.map +7 -0
- package/dist/bin/commands/security-ci-report.d.ts +9 -0
- package/dist/bin/commands/security-ci-report.d.ts.map +1 -0
- package/dist/bin/commands/security-ci-report.js +267 -0
- package/dist/bin/commands/security-ci-report.js.map +7 -0
- package/dist/bin/commands/security-export.d.ts +2 -0
- package/dist/bin/commands/security-export.d.ts.map +1 -0
- package/dist/bin/commands/security-export.js +1349 -0
- package/dist/bin/commands/security-export.js.map +7 -0
- package/dist/bin/commands/security-flows.d.ts +3 -0
- package/dist/bin/commands/security-flows.d.ts.map +1 -0
- package/dist/bin/commands/security-flows.js +126 -0
- package/dist/bin/commands/security-flows.js.map +7 -0
- package/dist/bin/commands/security-secrets.d.ts +3 -0
- package/dist/bin/commands/security-secrets.d.ts.map +1 -0
- package/dist/bin/commands/security-secrets.js +170 -0
- package/dist/bin/commands/security-secrets.js.map +7 -0
- package/dist/bin/commands/security.d.ts +3 -0
- package/dist/bin/commands/security.d.ts.map +1 -0
- package/dist/bin/commands/security.js +208 -0
- package/dist/bin/commands/security.js.map +7 -0
- package/dist/bin/commands/snapshot.d.ts +3 -0
- package/dist/bin/commands/snapshot.d.ts.map +1 -0
- package/dist/bin/commands/staleness.d.ts +3 -0
- package/dist/bin/commands/staleness.d.ts.map +1 -0
- package/dist/bin/commands/staleness.js +144 -0
- package/dist/bin/commands/staleness.js.map +7 -0
- package/dist/bin/commands/status.d.ts.map +1 -1
- package/dist/bin/commands/status.js +129 -2
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.d.ts +3 -0
- package/dist/bin/commands/supply-chain.d.ts.map +1 -0
- package/dist/bin/commands/supply-chain.js +138 -0
- package/dist/bin/commands/supply-chain.js.map +7 -0
- package/dist/bin/commands/surprising.d.ts +3 -0
- package/dist/bin/commands/surprising.d.ts.map +1 -0
- package/dist/bin/commands/sync.d.ts.map +1 -1
- package/dist/bin/commands/uninit.d.ts.map +1 -1
- package/dist/bin/commands/uninit.js +109 -60
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/utils.d.ts +5 -0
- package/dist/bin/commands/utils.d.ts.map +1 -1
- package/dist/bin/commands/vex.d.ts +3 -0
- package/dist/bin/commands/vex.d.ts.map +1 -0
- package/dist/bin/commands/vex.js +76 -0
- package/dist/bin/commands/vex.js.map +7 -0
- package/dist/bin/commands/vuln-suppress.d.ts +3 -0
- package/dist/bin/commands/vuln-suppress.d.ts.map +1 -0
- package/dist/bin/commands/vuln-suppress.js +95 -0
- package/dist/bin/commands/vuln-suppress.js.map +7 -0
- package/dist/bin/commands/vulns.d.ts +3 -0
- package/dist/bin/commands/vulns.d.ts.map +1 -0
- package/dist/bin/commands/vulns.js +382 -0
- package/dist/bin/commands/vulns.js.map +7 -0
- package/dist/bin/installer/archive.d.ts +47 -0
- package/dist/bin/installer/archive.d.ts.map +1 -0
- package/dist/bin/installer/auto-detect.d.ts +16 -0
- package/dist/bin/installer/auto-detect.d.ts.map +1 -0
- package/dist/bin/installer/auto-detect.js +125 -0
- package/dist/bin/installer/auto-detect.js.map +7 -0
- package/dist/bin/installer/caveman.d.ts +12 -0
- package/dist/bin/installer/caveman.d.ts.map +1 -0
- package/dist/bin/installer/cli-agent.d.ts +7 -2
- package/dist/bin/installer/cli-agent.d.ts.map +1 -1
- package/dist/bin/installer/cli-agent.js +32 -5
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.d.ts +36 -0
- package/dist/bin/installer/common.d.ts.map +1 -0
- package/dist/bin/installer/common.js +48 -0
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.d.ts +1 -1
- package/dist/bin/installer/config-prompt.d.ts.map +1 -1
- package/dist/bin/installer/config-prompt.js +85 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/dashboard.d.ts.map +1 -1
- package/dist/bin/installer/detect.d.ts +30 -0
- package/dist/bin/installer/detect.d.ts.map +1 -0
- package/dist/bin/installer/detect.js +309 -0
- package/dist/bin/installer/detect.js.map +7 -0
- package/dist/bin/installer/hooks.d.ts +4 -1
- package/dist/bin/installer/hooks.d.ts.map +1 -1
- package/dist/bin/installer/hooks.js +34 -0
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.d.ts +5 -4
- package/dist/bin/installer/index.d.ts.map +1 -1
- package/dist/bin/installer/index.js +46 -8
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.d.ts +14 -0
- package/dist/bin/installer/instructions.d.ts.map +1 -0
- package/dist/bin/installer/instructions.js +209 -3
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.d.ts.map +1 -1
- package/dist/bin/installer/prompts.d.ts +17 -0
- package/dist/bin/installer/prompts.d.ts.map +1 -1
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -1
- package/dist/bin/installer/steering.d.ts +14 -2
- package/dist/bin/installer/steering.d.ts.map +1 -1
- package/dist/bin/installer/steering.js +488 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.d.ts +6 -0
- package/dist/bin/installer/targets/aider.d.ts.map +1 -0
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.d.ts +6 -0
- package/dist/bin/installer/targets/amp.d.ts.map +1 -0
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.d.ts +13 -0
- package/dist/bin/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/bin/installer/targets/antigravity.js +35 -6
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.d.ts +6 -0
- package/dist/bin/installer/targets/augment.d.ts.map +1 -0
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.d.ts +6 -0
- package/dist/bin/installer/targets/claude.d.ts.map +1 -0
- package/dist/bin/installer/targets/claude.js +49 -5
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.d.ts +13 -0
- package/dist/bin/installer/targets/cline.d.ts.map +1 -0
- package/dist/bin/installer/targets/cline.js +32 -6
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.d.ts +6 -0
- package/dist/bin/installer/targets/codex.d.ts.map +1 -0
- package/dist/bin/installer/targets/codex.js +64 -12
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.d.ts +12 -0
- package/dist/bin/installer/targets/continue.d.ts.map +1 -0
- package/dist/bin/installer/targets/continue.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.d.ts +12 -0
- package/dist/bin/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot-cli.js +101 -0
- package/dist/bin/installer/targets/copilot-cli.js.map +7 -0
- package/dist/bin/installer/targets/copilot.d.ts +6 -0
- package/dist/bin/installer/targets/copilot.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot.js +31 -5
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.d.ts +6 -0
- package/dist/bin/installer/targets/cursor.d.ts.map +1 -0
- package/dist/bin/installer/targets/cursor.js +4 -4
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.d.ts +13 -0
- package/dist/bin/installer/targets/devin.d.ts.map +1 -0
- package/dist/bin/installer/targets/devin.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.d.ts +16 -0
- package/dist/bin/installer/targets/gemini-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/gemini-cli.js +2 -2
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.d.ts +59 -0
- package/dist/bin/installer/targets/generic.d.ts.map +1 -0
- package/dist/bin/installer/targets/generic.js +2 -14
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.d.ts +6 -0
- package/dist/bin/installer/targets/goose.d.ts.map +1 -0
- package/dist/bin/installer/targets/goose.js +3 -3
- package/dist/bin/installer/targets/goose.js.map +2 -2
- package/dist/bin/installer/targets/index.d.ts +11 -0
- package/dist/bin/installer/targets/index.d.ts.map +1 -0
- package/dist/bin/installer/targets/index.js +250 -0
- package/dist/bin/installer/targets/index.js.map +2 -2
- package/dist/bin/installer/targets/junie.d.ts +13 -0
- package/dist/bin/installer/targets/junie.d.ts.map +1 -0
- package/dist/bin/installer/targets/junie.js +2 -2
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.d.ts +12 -0
- package/dist/bin/installer/targets/kilo.d.ts.map +1 -0
- package/dist/bin/installer/targets/kilo.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.d.ts +5 -0
- package/dist/bin/installer/targets/kiro.d.ts.map +1 -0
- package/dist/bin/installer/targets/kiro.js +4 -4
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.d.ts +13 -0
- package/dist/bin/installer/targets/opencode.d.ts.map +1 -0
- package/dist/bin/installer/targets/opencode.js +2 -2
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.d.ts +6 -0
- package/dist/bin/installer/targets/openhands.d.ts.map +1 -0
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.d.ts +12 -0
- package/dist/bin/installer/targets/qoder.d.ts.map +1 -0
- package/dist/bin/installer/targets/qoder.js +91 -0
- package/dist/bin/installer/targets/qoder.js.map +7 -0
- package/dist/bin/installer/targets/qwen.d.ts +12 -0
- package/dist/bin/installer/targets/qwen.d.ts.map +1 -0
- package/dist/bin/installer/targets/qwen.js +96 -0
- package/dist/bin/installer/targets/qwen.js.map +7 -0
- package/dist/bin/installer/targets/replit.d.ts +6 -0
- package/dist/bin/installer/targets/replit.d.ts.map +1 -0
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.d.ts +13 -0
- package/dist/bin/installer/targets/roo.d.ts.map +1 -0
- package/dist/bin/installer/targets/roo.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.d.ts +6 -0
- package/dist/bin/installer/targets/tabnine.d.ts.map +1 -0
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.d.ts +6 -0
- package/dist/bin/installer/targets/trae.d.ts.map +1 -0
- package/dist/bin/installer/targets/trae.js +5 -5
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.d.ts +12 -0
- package/dist/bin/installer/targets/warp.d.ts.map +1 -0
- package/dist/bin/installer/targets/warp.js +2 -2
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.d.ts +13 -0
- package/dist/bin/installer/targets/windsurf.d.ts.map +1 -0
- package/dist/bin/installer/targets/windsurf.js +35 -6
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +74 -6
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/bin/progress.d.ts +16 -1
- package/dist/bin/progress.d.ts.map +1 -1
- package/dist/compression/filters/aws.d.ts +9 -0
- package/dist/compression/filters/aws.d.ts.map +1 -0
- package/dist/compression/filters/docker.d.ts +6 -0
- package/dist/compression/filters/docker.d.ts.map +1 -0
- package/dist/compression/filters/files.d.ts +6 -0
- package/dist/compression/filters/files.d.ts.map +1 -0
- package/dist/compression/filters/generic.d.ts +7 -0
- package/dist/compression/filters/generic.d.ts.map +1 -0
- package/dist/compression/filters/git.d.ts +6 -0
- package/dist/compression/filters/git.d.ts.map +1 -0
- package/dist/compression/filters/github.d.ts +6 -0
- package/dist/compression/filters/github.d.ts.map +1 -0
- package/dist/compression/filters/lint.d.ts +6 -0
- package/dist/compression/filters/lint.d.ts.map +1 -0
- package/dist/compression/filters/misc.d.ts +6 -0
- package/dist/compression/filters/misc.d.ts.map +1 -0
- package/dist/compression/filters/package.d.ts +6 -0
- package/dist/compression/filters/package.d.ts.map +1 -0
- package/dist/compression/filters/test.d.ts +6 -0
- package/dist/compression/filters/test.d.ts.map +1 -0
- package/dist/compression/index.d.ts +29 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/naive-cost.d.ts +26 -0
- package/dist/compression/naive-cost.d.ts.map +1 -0
- package/dist/compression/tracker.d.ts +155 -0
- package/dist/compression/tracker.d.ts.map +1 -0
- package/dist/compression/tracker.js +80 -0
- package/dist/compression/tracker.js.map +2 -2
- package/dist/compression/types.d.ts +49 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +144 -3
- package/dist/config.js.map +2 -2
- package/dist/core/lock-manager.d.ts +2 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/pipeline.d.ts +4 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +78 -2
- package/dist/core/pipeline.js.map +2 -2
- package/dist/core/snapshot.d.ts +58 -0
- package/dist/core/snapshot.d.ts.map +1 -0
- package/dist/data/filters.d.ts +23 -0
- package/dist/data/filters.d.ts.map +1 -0
- package/dist/data/indexer.d.ts +25 -0
- package/dist/data/indexer.d.ts.map +1 -0
- package/dist/data/linker.d.ts +37 -0
- package/dist/data/linker.d.ts.map +1 -0
- package/dist/data/lint.d.ts +27 -0
- package/dist/data/lint.d.ts.map +1 -0
- package/dist/data/parsers/csv.d.ts +11 -0
- package/dist/data/parsers/csv.d.ts.map +1 -0
- package/dist/data/parsers/excel.d.ts +10 -0
- package/dist/data/parsers/excel.d.ts.map +1 -0
- package/dist/data/parsers/index.d.ts +28 -0
- package/dist/data/parsers/index.d.ts.map +1 -0
- package/dist/data/parsers/json-array.d.ts +9 -0
- package/dist/data/parsers/json-array.d.ts.map +1 -0
- package/dist/data/parsers/jsonl.d.ts +9 -0
- package/dist/data/parsers/jsonl.d.ts.map +1 -0
- package/dist/data/parsers/parquet.d.ts +10 -0
- package/dist/data/parsers/parquet.d.ts.map +1 -0
- package/dist/data/profiler.d.ts +29 -0
- package/dist/data/profiler.d.ts.map +1 -0
- package/dist/data/queries.d.ts +95 -0
- package/dist/data/queries.d.ts.map +1 -0
- package/dist/data/types.d.ts +103 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/db/database.d.ts +57 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/database.js +75 -5
- package/dist/db/database.js.map +2 -2
- package/dist/db/memory-schema.sql +5 -1
- package/dist/db/patterns-schema.sql +23 -0
- package/dist/db/schema.sql +3 -1
- package/dist/db/security-schema.sql +72 -0
- package/dist/docs/formats/asciidoc.d.ts +9 -0
- package/dist/docs/formats/asciidoc.d.ts.map +1 -0
- package/dist/docs/formats/html.d.ts +10 -0
- package/dist/docs/formats/html.d.ts.map +1 -0
- package/dist/docs/formats/index.d.ts +31 -0
- package/dist/docs/formats/index.d.ts.map +1 -0
- package/dist/docs/formats/markdown.d.ts +11 -0
- package/dist/docs/formats/markdown.d.ts.map +1 -0
- package/dist/docs/formats/openapi.d.ts +17 -0
- package/dist/docs/formats/openapi.d.ts.map +1 -0
- package/dist/docs/formats/org.d.ts +9 -0
- package/dist/docs/formats/org.d.ts.map +1 -0
- package/dist/docs/formats/plaintext.d.ts +11 -0
- package/dist/docs/formats/plaintext.d.ts.map +1 -0
- package/dist/docs/formats/rdoc.d.ts +10 -0
- package/dist/docs/formats/rdoc.d.ts.map +1 -0
- package/dist/docs/formats/rst.d.ts +11 -0
- package/dist/docs/formats/rst.d.ts.map +1 -0
- package/dist/docs/indexer.d.ts +49 -0
- package/dist/docs/indexer.d.ts.map +1 -0
- package/dist/docs/linker.d.ts +30 -0
- package/dist/docs/linker.d.ts.map +1 -0
- package/dist/docs/lint.d.ts +27 -0
- package/dist/docs/lint.d.ts.map +1 -0
- package/dist/docs/queries.d.ts +78 -0
- package/dist/docs/queries.d.ts.map +1 -0
- package/dist/docs/section-id.d.ts +48 -0
- package/dist/docs/section-id.d.ts.map +1 -0
- package/dist/docs/summarizer.d.ts +13 -0
- package/dist/docs/summarizer.d.ts.map +1 -0
- package/dist/docs/types.d.ts +71 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/vectors.d.ts +54 -0
- package/dist/docs/vectors.d.ts.map +1 -0
- package/dist/extraction/extractor.d.ts +1 -1
- package/dist/extraction/extractor.d.ts.map +1 -1
- package/dist/extraction/extractor.js +81 -0
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.d.ts +6 -0
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +32 -8
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.d.ts.map +1 -1
- package/dist/extraction/languages.js +43 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/notebook.d.ts +14 -0
- package/dist/extraction/notebook.d.ts.map +1 -0
- package/dist/extraction/notebook.js +300 -0
- package/dist/extraction/notebook.js.map +7 -0
- package/dist/extraction/wasm/tree-sitter-astro.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-gdscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-julia.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-perl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-powershell.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-sql.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-verilog.wasm +0 -0
- package/dist/frameworks/amplify.d.ts +9 -0
- package/dist/frameworks/amplify.d.ts.map +1 -0
- package/dist/frameworks/angular.d.ts +9 -0
- package/dist/frameworks/angular.d.ts.map +1 -0
- package/dist/frameworks/ansible.d.ts +8 -0
- package/dist/frameworks/ansible.d.ts.map +1 -0
- package/dist/frameworks/cloudformation.d.ts +9 -0
- package/dist/frameworks/cloudformation.d.ts.map +1 -0
- package/dist/frameworks/docker.d.ts +9 -0
- package/dist/frameworks/docker.d.ts.map +1 -0
- package/dist/frameworks/elixir.d.ts +6 -0
- package/dist/frameworks/elixir.d.ts.map +1 -0
- package/dist/frameworks/flutter.d.ts +12 -0
- package/dist/frameworks/flutter.d.ts.map +1 -0
- package/dist/frameworks/flutter.js +130 -0
- package/dist/frameworks/flutter.js.map +7 -0
- package/dist/frameworks/iac.d.ts +10 -0
- package/dist/frameworks/iac.d.ts.map +1 -0
- package/dist/frameworks/index.d.ts +14 -0
- package/dist/frameworks/index.d.ts.map +1 -1
- package/dist/frameworks/index.js +7 -1
- package/dist/frameworks/index.js.map +3 -3
- package/dist/frameworks/kubernetes.d.ts +9 -0
- package/dist/frameworks/kubernetes.d.ts.map +1 -0
- package/dist/frameworks/pulumi.d.ts +9 -0
- package/dist/frameworks/pulumi.d.ts.map +1 -0
- package/dist/frameworks/scala.d.ts +6 -0
- package/dist/frameworks/scala.d.ts.map +1 -0
- package/dist/frameworks/solidity.d.ts +6 -0
- package/dist/frameworks/solidity.d.ts.map +1 -0
- package/dist/frameworks/terraform.d.ts +14 -0
- package/dist/frameworks/terraform.d.ts.map +1 -0
- package/dist/frameworks/vue.d.ts +7 -0
- package/dist/frameworks/vue.d.ts.map +1 -0
- package/dist/graph/communities.d.ts +43 -0
- package/dist/graph/communities.d.ts.map +1 -0
- package/dist/graph/communities.js +317 -0
- package/dist/graph/communities.js.map +7 -0
- package/dist/graph/flows.d.ts +55 -0
- package/dist/graph/flows.d.ts.map +1 -0
- package/dist/graph/flows.js +138 -0
- package/dist/graph/flows.js.map +7 -0
- package/dist/graph/refactor.d.ts +43 -0
- package/dist/graph/refactor.d.ts.map +1 -0
- package/dist/graph/refactor.js +155 -0
- package/dist/graph/refactor.js.map +7 -0
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/cache.d.ts +69 -0
- package/dist/mcp/cache.d.ts.map +1 -0
- package/dist/mcp/cache.js +172 -0
- package/dist/mcp/cache.js.map +7 -0
- package/dist/mcp/read-modes.d.ts +31 -0
- package/dist/mcp/read-modes.d.ts.map +1 -0
- package/dist/mcp/read-modes.js +295 -0
- package/dist/mcp/read-modes.js.map +7 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +17 -3
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.d.ts +2 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +24 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1560 -4
- package/dist/mcp/tools.js.map +3 -3
- package/dist/memory/compress.d.ts +19 -0
- package/dist/memory/compress.d.ts.map +1 -0
- package/dist/memory/database.d.ts +92 -0
- package/dist/memory/database.d.ts.map +1 -0
- package/dist/memory/database.js +70 -2
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/index.d.ts +71 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +12 -2
- package/dist/memory/index.js.map +2 -2
- package/dist/memory/symbols.d.ts +21 -0
- package/dist/memory/symbols.d.ts.map +1 -0
- package/dist/memory/types.d.ts +78 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/memory/vectors.d.ts +43 -0
- package/dist/memory/vectors.d.ts.map +1 -0
- package/dist/patterns/graph.d.ts +16 -0
- package/dist/patterns/graph.d.ts.map +1 -0
- package/dist/patterns/graph.js +45 -0
- package/dist/patterns/graph.js.map +7 -0
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +39 -0
- package/dist/patterns/index.js.map +7 -0
- package/dist/patterns/indexer.d.ts +15 -0
- package/dist/patterns/indexer.d.ts.map +1 -0
- package/dist/patterns/indexer.js +97 -0
- package/dist/patterns/indexer.js.map +7 -0
- package/dist/patterns/library/command-injection-go.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-js.yaml +14 -0
- package/dist/patterns/library/dangerous-exec-py.yaml +13 -0
- package/dist/patterns/library/dangerous-reflection-java.yaml +8 -0
- package/dist/patterns/library/path-traversal-go.yaml +11 -0
- package/dist/patterns/library/path-traversal-py.yaml +12 -0
- package/dist/patterns/library/path-traversal-readfile-js.yaml +14 -0
- package/dist/patterns/library/prototype-pollution-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-concat-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-java.yaml +13 -0
- package/dist/patterns/library/sql-injection-py.yaml +12 -0
- package/dist/patterns/library/sql-injection-template-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-md5-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-py.yaml +13 -0
- package/dist/patterns/loader.d.ts +18 -0
- package/dist/patterns/loader.d.ts.map +1 -0
- package/dist/patterns/loader.js +277 -0
- package/dist/patterns/loader.js.map +7 -0
- package/dist/patterns/runner.d.ts +42 -0
- package/dist/patterns/runner.d.ts.map +1 -0
- package/dist/patterns/runner.js +277 -0
- package/dist/patterns/runner.js.map +7 -0
- package/dist/patterns/types.d.ts +27 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +34 -0
- package/dist/patterns/types.js.map +7 -0
- package/dist/resolution/bridges/android-rn.d.ts +13 -0
- package/dist/resolution/bridges/android-rn.d.ts.map +1 -0
- package/dist/resolution/bridges/android-rn.js +298 -0
- package/dist/resolution/bridges/android-rn.js.map +7 -0
- package/dist/resolution/bridges/expo-modules.d.ts +10 -0
- package/dist/resolution/bridges/expo-modules.d.ts.map +1 -0
- package/dist/resolution/bridges/expo-modules.js +155 -0
- package/dist/resolution/bridges/expo-modules.js.map +7 -0
- package/dist/resolution/bridges/flutter-channel.d.ts +14 -0
- package/dist/resolution/bridges/flutter-channel.d.ts.map +1 -0
- package/dist/resolution/bridges/flutter-channel.js +385 -0
- package/dist/resolution/bridges/flutter-channel.js.map +7 -0
- package/dist/resolution/bridges/index.d.ts +40 -0
- package/dist/resolution/bridges/index.d.ts.map +1 -0
- package/dist/resolution/bridges/index.js +80 -0
- package/dist/resolution/bridges/index.js.map +7 -0
- package/dist/resolution/bridges/native-events.d.ts +10 -0
- package/dist/resolution/bridges/native-events.d.ts.map +1 -0
- package/dist/resolution/bridges/native-events.js +188 -0
- package/dist/resolution/bridges/native-events.js.map +7 -0
- package/dist/resolution/bridges/native-views.d.ts +13 -0
- package/dist/resolution/bridges/native-views.d.ts.map +1 -0
- package/dist/resolution/bridges/native-views.js +244 -0
- package/dist/resolution/bridges/native-views.js.map +7 -0
- package/dist/resolution/bridges/react-native.d.ts +9 -0
- package/dist/resolution/bridges/react-native.d.ts.map +1 -0
- package/dist/resolution/bridges/react-native.js +161 -0
- package/dist/resolution/bridges/react-native.js.map +7 -0
- package/dist/resolution/bridges/swift-objc.d.ts +14 -0
- package/dist/resolution/bridges/swift-objc.d.ts.map +1 -0
- package/dist/resolution/bridges/swift-objc.js +227 -0
- package/dist/resolution/bridges/swift-objc.js.map +7 -0
- package/dist/resolution/bridges/turbomodules.d.ts +10 -0
- package/dist/resolution/bridges/turbomodules.d.ts.map +1 -0
- package/dist/resolution/bridges/turbomodules.js +216 -0
- package/dist/resolution/bridges/turbomodules.js.map +7 -0
- package/dist/resolution/index.d.ts +28 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +61 -2
- package/dist/resolution/index.js.map +2 -2
- package/dist/security/attack-surface.d.ts +46 -0
- package/dist/security/attack-surface.d.ts.map +1 -0
- package/dist/security/attack-surface.js +206 -0
- package/dist/security/attack-surface.js.map +7 -0
- package/dist/security/context-warnings.d.ts +40 -0
- package/dist/security/context-warnings.d.ts.map +1 -0
- package/dist/security/context-warnings.js +123 -0
- package/dist/security/context-warnings.js.map +7 -0
- package/dist/security/data-flows.d.ts +33 -0
- package/dist/security/data-flows.d.ts.map +1 -0
- package/dist/security/data-flows.js +286 -0
- package/dist/security/data-flows.js.map +7 -0
- package/dist/security/dep-confusion.d.ts +23 -0
- package/dist/security/dep-confusion.d.ts.map +1 -0
- package/dist/security/dep-confusion.js +255 -0
- package/dist/security/dep-confusion.js.map +7 -0
- package/dist/security/errors.d.ts +16 -0
- package/dist/security/errors.d.ts.map +1 -0
- package/dist/security/errors.js +51 -0
- package/dist/security/errors.js.map +7 -0
- package/dist/security/export/fix-suggestions.d.ts +21 -0
- package/dist/security/export/fix-suggestions.d.ts.map +1 -0
- package/dist/security/export/fix-suggestions.js +58 -0
- package/dist/security/export/fix-suggestions.js.map +7 -0
- package/dist/security/export/sbom.d.ts +33 -0
- package/dist/security/export/sbom.d.ts.map +1 -0
- package/dist/security/export/sbom.js +230 -0
- package/dist/security/export/sbom.js.map +7 -0
- package/dist/security/export/serialization.d.ts +62 -0
- package/dist/security/export/serialization.d.ts.map +1 -0
- package/dist/security/export/serialization.js +142 -0
- package/dist/security/export/serialization.js.map +7 -0
- package/dist/security/export/vex.d.ts +58 -0
- package/dist/security/export/vex.d.ts.map +1 -0
- package/dist/security/export/vex.js +220 -0
- package/dist/security/export/vex.js.map +7 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +67 -0
- package/dist/security/index.js.map +7 -0
- package/dist/security/integrator.d.ts +63 -0
- package/dist/security/integrator.d.ts.map +1 -0
- package/dist/security/integrator.js +491 -0
- package/dist/security/integrator.js.map +7 -0
- package/dist/security/license.d.ts +33 -0
- package/dist/security/license.d.ts.map +1 -0
- package/dist/security/license.js +70 -0
- package/dist/security/license.js.map +7 -0
- package/dist/security/manifest/adapter.d.ts +92 -0
- package/dist/security/manifest/adapter.d.ts.map +1 -0
- package/dist/security/manifest/adapter.js +243 -0
- package/dist/security/manifest/adapter.js.map +7 -0
- package/dist/security/manifest/parser.d.ts +73 -0
- package/dist/security/manifest/parser.d.ts.map +1 -0
- package/dist/security/manifest/parser.js +376 -0
- package/dist/security/manifest/parser.js.map +7 -0
- package/dist/security/manifest/plugins/cargo.d.ts +11 -0
- package/dist/security/manifest/plugins/cargo.d.ts.map +1 -0
- package/dist/security/manifest/plugins/cargo.js +233 -0
- package/dist/security/manifest/plugins/cargo.js.map +7 -0
- package/dist/security/manifest/plugins/composer.d.ts +11 -0
- package/dist/security/manifest/plugins/composer.d.ts.map +1 -0
- package/dist/security/manifest/plugins/composer.js +152 -0
- package/dist/security/manifest/plugins/composer.js.map +7 -0
- package/dist/security/manifest/plugins/go.d.ts +12 -0
- package/dist/security/manifest/plugins/go.d.ts.map +1 -0
- package/dist/security/manifest/plugins/go.js +146 -0
- package/dist/security/manifest/plugins/go.js.map +7 -0
- package/dist/security/manifest/plugins/gradle.d.ts +12 -0
- package/dist/security/manifest/plugins/gradle.d.ts.map +1 -0
- package/dist/security/manifest/plugins/gradle.js +159 -0
- package/dist/security/manifest/plugins/gradle.js.map +7 -0
- package/dist/security/manifest/plugins/hex.d.ts +11 -0
- package/dist/security/manifest/plugins/hex.d.ts.map +1 -0
- package/dist/security/manifest/plugins/hex.js +159 -0
- package/dist/security/manifest/plugins/hex.js.map +7 -0
- package/dist/security/manifest/plugins/maven.d.ts +11 -0
- package/dist/security/manifest/plugins/maven.d.ts.map +1 -0
- package/dist/security/manifest/plugins/maven.js +128 -0
- package/dist/security/manifest/plugins/maven.js.map +7 -0
- package/dist/security/manifest/plugins/npm.d.ts +11 -0
- package/dist/security/manifest/plugins/npm.d.ts.map +1 -0
- package/dist/security/manifest/plugins/npm.js +284 -0
- package/dist/security/manifest/plugins/npm.js.map +7 -0
- package/dist/security/manifest/plugins/nuget.d.ts +12 -0
- package/dist/security/manifest/plugins/nuget.d.ts.map +1 -0
- package/dist/security/manifest/plugins/nuget.js +186 -0
- package/dist/security/manifest/plugins/nuget.js.map +7 -0
- package/dist/security/manifest/plugins/pip.d.ts +11 -0
- package/dist/security/manifest/plugins/pip.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pip.js +123 -0
- package/dist/security/manifest/plugins/pip.js.map +7 -0
- package/dist/security/manifest/plugins/pubspec.d.ts +11 -0
- package/dist/security/manifest/plugins/pubspec.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pubspec.js +212 -0
- package/dist/security/manifest/plugins/pubspec.js.map +7 -0
- package/dist/security/manifest/plugins/pyproject.d.ts +3 -0
- package/dist/security/manifest/plugins/pyproject.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pyproject.js +261 -0
- package/dist/security/manifest/plugins/pyproject.js.map +7 -0
- package/dist/security/manifest/plugins/rubygems.d.ts +11 -0
- package/dist/security/manifest/plugins/rubygems.d.ts.map +1 -0
- package/dist/security/manifest/plugins/rubygems.js +185 -0
- package/dist/security/manifest/plugins/rubygems.js.map +7 -0
- package/dist/security/manifest/plugins/swift.d.ts +11 -0
- package/dist/security/manifest/plugins/swift.d.ts.map +1 -0
- package/dist/security/manifest/plugins/swift.js +200 -0
- package/dist/security/manifest/plugins/swift.js.map +7 -0
- package/dist/security/owasp.d.ts +16 -0
- package/dist/security/owasp.d.ts.map +1 -0
- package/dist/security/owasp.js +104 -0
- package/dist/security/owasp.js.map +7 -0
- package/dist/security/pipeline.d.ts +37 -0
- package/dist/security/pipeline.d.ts.map +1 -0
- package/dist/security/pipeline.js +125 -0
- package/dist/security/pipeline.js.map +7 -0
- package/dist/security/reachability.d.ts +67 -0
- package/dist/security/reachability.d.ts.map +1 -0
- package/dist/security/reachability.js +276 -0
- package/dist/security/reachability.js.map +7 -0
- package/dist/security/remediation.d.ts +51 -0
- package/dist/security/remediation.d.ts.map +1 -0
- package/dist/security/remediation.js +126 -0
- package/dist/security/remediation.js.map +7 -0
- package/dist/security/secrets.d.ts +38 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/secrets.js +176 -0
- package/dist/security/secrets.js.map +7 -0
- package/dist/security/staleness.d.ts +43 -0
- package/dist/security/staleness.d.ts.map +1 -0
- package/dist/security/staleness.js +231 -0
- package/dist/security/staleness.js.map +7 -0
- package/dist/security/supply-chain.d.ts +34 -0
- package/dist/security/supply-chain.d.ts.map +1 -0
- package/dist/security/supply-chain.js +301 -0
- package/dist/security/supply-chain.js.map +7 -0
- package/dist/security/suppressions.d.ts +18 -0
- package/dist/security/suppressions.d.ts.map +1 -0
- package/dist/security/suppressions.js +106 -0
- package/dist/security/suppressions.js.map +7 -0
- package/dist/security/types.d.ts +144 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/types.js +17 -0
- package/dist/security/types.js.map +7 -0
- package/dist/security/vuln/client.d.ts +90 -0
- package/dist/security/vuln/client.d.ts.map +1 -0
- package/dist/security/vuln/client.js +355 -0
- package/dist/security/vuln/client.js.map +7 -0
- package/dist/security/vuln/epss-client.d.ts +26 -0
- package/dist/security/vuln/epss-client.d.ts.map +1 -0
- package/dist/security/vuln/epss-client.js +95 -0
- package/dist/security/vuln/epss-client.js.map +7 -0
- package/dist/security/vuln/index.d.ts +6 -0
- package/dist/security/vuln/index.d.ts.map +1 -0
- package/dist/security/vuln/index.js +29 -0
- package/dist/security/vuln/index.js.map +7 -0
- package/dist/security/vuln/osv-adapter.d.ts +58 -0
- package/dist/security/vuln/osv-adapter.d.ts.map +1 -0
- package/dist/security/vuln/osv-adapter.js +321 -0
- package/dist/security/vuln/osv-adapter.js.map +7 -0
- package/dist/security/vuln/types.d.ts +29 -0
- package/dist/security/vuln/types.d.ts.map +1 -0
- package/dist/security/vuln/types.js +17 -0
- package/dist/security/vuln/types.js.map +7 -0
- package/dist/sync/index.d.ts +4 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/types.d.ts +10 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +2 -2
- package/dist/vectors/index.d.ts +11 -3
- package/dist/vectors/index.d.ts.map +1 -1
- package/dist/vectors/qdrant-index.d.ts +10 -3
- package/dist/vectors/qdrant-index.d.ts.map +1 -1
- package/dist/vectors/typesense-index.d.ts.map +1 -1
- package/dist/watchmen/index.js +83 -0
- package/dist/watchmen/index.js.map +7 -0
- package/dist/watchmen/synthesize.js +475 -0
- package/dist/watchmen/synthesize.js.map +7 -0
- package/package.json +6 -2
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"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 attack_surface_exports = {};
|
|
30
|
+
__export(attack_surface_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(attack_surface_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_config = require("../../config");
|
|
36
|
+
var import_ui = require("../ui");
|
|
37
|
+
const red = "\x1B[31m";
|
|
38
|
+
const yellow = "\x1B[33m";
|
|
39
|
+
function register(program) {
|
|
40
|
+
program.command("attack-surface [projectPath]").description("Map HTTP routes to reachable vulnerable dependencies").option("--limit <n>", "Max routes to show (default: 20)", "20").option("--public-only", "Show only public/unauthenticated routes").option("--format <fmt>", "Output format: text, json (default: text)", "text").action(async (projectPath, opts) => {
|
|
41
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
42
|
+
const config = await (0, import_config.loadConfig)(target);
|
|
43
|
+
if (!config.enableSecurity) {
|
|
44
|
+
console.error(`
|
|
45
|
+
${yellow}\u26A0 Security analysis is disabled.${import_ui.reset}`);
|
|
46
|
+
console.error(` ${import_ui.dim}Enable it in .kirograph/config.json:${import_ui.reset} ${import_ui.violet}${import_ui.bold}"enableSecurity": true${import_ui.reset}`);
|
|
47
|
+
console.error(` ${import_ui.dim}Then re-run:${import_ui.reset} ${import_ui.violet}${import_ui.bold}kirograph index${import_ui.reset}
|
|
48
|
+
`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const limit = parseInt(opts.limit, 10);
|
|
52
|
+
if (isNaN(limit) || limit < 1) {
|
|
53
|
+
console.error(` \u2716 Invalid --limit value: ${opts.limit}. Must be a positive integer.`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
const validFormats = ["text", "json"];
|
|
57
|
+
if (!validFormats.includes(opts.format)) {
|
|
58
|
+
console.error(` \u2716 Invalid --format value: ${opts.format}. Use: text, json`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
62
|
+
if (!KiroGraph.isInitialized(target)) {
|
|
63
|
+
console.error(" \u2716 KiroGraph not initialized. Run: kirograph init");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
const cg = await KiroGraph.open(target);
|
|
67
|
+
const db = cg.getDatabase();
|
|
68
|
+
db.applySecuritySchema();
|
|
69
|
+
const { AttackSurfaceAnalyzer } = await Promise.resolve().then(() => require("../../security/attack-surface.js"));
|
|
70
|
+
const analyzer = new AttackSurfaceAnalyzer(db);
|
|
71
|
+
const result = await analyzer.analyze();
|
|
72
|
+
cg.close();
|
|
73
|
+
let routes = opts.publicOnly ? result.allRoutes.filter((r) => r.exposureLevel === "public") : result.allRoutes;
|
|
74
|
+
const limited = routes.slice(0, limit);
|
|
75
|
+
if (opts.format === "json") {
|
|
76
|
+
console.log(JSON.stringify(
|
|
77
|
+
{
|
|
78
|
+
totalRoutes: result.totalRoutes,
|
|
79
|
+
publicRoutes: result.publicRoutes,
|
|
80
|
+
authenticatedRoutes: result.authenticatedRoutes,
|
|
81
|
+
routesWithVulns: result.routesWithVulns,
|
|
82
|
+
criticalPaths: result.criticalPaths,
|
|
83
|
+
routes: limited
|
|
84
|
+
},
|
|
85
|
+
null,
|
|
86
|
+
2
|
|
87
|
+
));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const totalLabel = result.totalRoutes === 1 ? "route" : "routes";
|
|
91
|
+
console.log(
|
|
92
|
+
`
|
|
93
|
+
${(0, import_ui.section)("Attack Surface")} ${import_ui.dim}(${result.totalRoutes} ${totalLabel} total: ${result.publicRoutes} public, ${result.authenticatedRoutes} authenticated)${import_ui.reset}
|
|
94
|
+
`
|
|
95
|
+
);
|
|
96
|
+
if (result.criticalPaths.length === 0) {
|
|
97
|
+
console.log(` ${import_ui.dim}No routes reaching vulnerable dependencies found.${import_ui.reset}
|
|
98
|
+
`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
console.log(` ${import_ui.violet}${import_ui.bold}\u25CF Critical paths${import_ui.reset} ${import_ui.dim}(routes reaching affected vulnerabilities)${import_ui.reset}
|
|
102
|
+
`);
|
|
103
|
+
const criticalToShow = result.criticalPaths.slice(0, limit);
|
|
104
|
+
for (const entry of criticalToShow) {
|
|
105
|
+
printRouteEntry(entry);
|
|
106
|
+
}
|
|
107
|
+
if (!opts.publicOnly) {
|
|
108
|
+
const cleanCount = result.totalRoutes - result.routesWithVulns;
|
|
109
|
+
if (cleanCount > 0) {
|
|
110
|
+
console.log(` ${import_ui.dim}+ ${cleanCount} clean route${cleanCount === 1 ? "" : "s"} (no reachable vulnerabilities)${import_ui.reset}
|
|
111
|
+
`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function printRouteEntry(entry) {
|
|
117
|
+
const isPublicVuln = entry.exposureLevel === "public" && entry.vulnerableDeps.length > 0;
|
|
118
|
+
const isAuthVuln = (entry.exposureLevel === "authenticated" || entry.exposureLevel === "internal") && entry.vulnerableDeps.length > 0;
|
|
119
|
+
const routeColor = isPublicVuln ? red : isAuthVuln ? yellow : import_ui.dim;
|
|
120
|
+
const riskLabel = entry.riskScore > 0 ? `${entry.riskScore.toFixed(1)}` : "?";
|
|
121
|
+
const exposureBadge = (() => {
|
|
122
|
+
switch (entry.exposureLevel) {
|
|
123
|
+
case "public":
|
|
124
|
+
return `${red}public${import_ui.reset} `;
|
|
125
|
+
case "authenticated":
|
|
126
|
+
return `${yellow}authenticated${import_ui.reset}`;
|
|
127
|
+
case "internal":
|
|
128
|
+
return `${import_ui.dim}internal${import_ui.reset} `;
|
|
129
|
+
default:
|
|
130
|
+
return `${import_ui.dim}unknown${import_ui.reset} `;
|
|
131
|
+
}
|
|
132
|
+
})();
|
|
133
|
+
const topVuln = entry.vulnerableDeps.reduce(
|
|
134
|
+
(best, v) => {
|
|
135
|
+
if (!best) return v;
|
|
136
|
+
if ((v.riskScore ?? 0) > (best.riskScore ?? 0)) return v;
|
|
137
|
+
return best;
|
|
138
|
+
},
|
|
139
|
+
null
|
|
140
|
+
);
|
|
141
|
+
let vulnSuffix = "";
|
|
142
|
+
if (topVuln) {
|
|
143
|
+
const hopWord = topVuln.hopCount === 1 ? "1 hop" : `${topVuln.hopCount} hops`;
|
|
144
|
+
vulnSuffix = ` ${import_ui.dim}\u2192${import_ui.reset} ${import_ui.violet}${topVuln.packageName}${import_ui.reset} ${import_ui.dim}${topVuln.cveId}${import_ui.reset} ${import_ui.dim}(${hopWord})${import_ui.reset}`;
|
|
145
|
+
if (entry.vulnerableDeps.length > 1) {
|
|
146
|
+
vulnSuffix += ` ${import_ui.dim}+${entry.vulnerableDeps.length - 1} more${import_ui.reset}`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
console.log(
|
|
150
|
+
` ${routeColor}[${riskLabel}]${import_ui.reset} ${import_ui.bold}${entry.route.padEnd(30)}${import_ui.reset} ${exposureBadge}${vulnSuffix}`
|
|
151
|
+
);
|
|
152
|
+
for (const pm of entry.patternMatches) {
|
|
153
|
+
const sevUpper = pm.severity.toUpperCase();
|
|
154
|
+
const pmColor = pm.severity === "critical" ? red : pm.severity === "high" ? yellow : import_ui.dim;
|
|
155
|
+
console.log(
|
|
156
|
+
` ${pmColor}\u26A0 [${sevUpper}]${import_ui.reset} ${import_ui.dim}${pm.patternId}${import_ui.reset} ${import_ui.dim}at${import_ui.reset} ${pm.symbolName}:${pm.line}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
161
|
+
0 && (module.exports = {
|
|
162
|
+
register
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=attack-surface.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/attack-surface.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { loadConfig } from '../../config';\nimport { dim, reset, violet, bold, section } from '../ui';\nimport type { AttackSurfaceEntry } from '../../security/attack-surface';\n\nconst red = '\\x1b[31m';\nconst yellow = '\\x1b[33m';\n\nexport function register(program: Command): void {\n program\n .command('attack-surface [projectPath]')\n .description('Map HTTP routes to reachable vulnerable dependencies')\n .option('--limit <n>', 'Max routes to show (default: 20)', '20')\n .option('--public-only', 'Show only public/unauthenticated routes')\n .option('--format <fmt>', 'Output format: text, json (default: text)', 'text')\n .action(async (\n projectPath: string | undefined,\n opts: { limit: string; publicOnly?: boolean; format: string },\n ) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const config = await loadConfig(target);\n\n if (!config.enableSecurity) {\n console.error(`\\n ${yellow}\u26A0 Security analysis is disabled.${reset}`);\n console.error(` ${dim}Enable it in .kirograph/config.json:${reset} ${violet}${bold}\"enableSecurity\": true${reset}`);\n console.error(` ${dim}Then re-run:${reset} ${violet}${bold}kirograph index${reset}\\n`);\n process.exit(1);\n }\n\n const limit = parseInt(opts.limit, 10);\n if (isNaN(limit) || limit < 1) {\n console.error(` \u2716 Invalid --limit value: ${opts.limit}. Must be a positive integer.`);\n process.exit(1);\n }\n\n const validFormats = ['text', 'json'];\n if (!validFormats.includes(opts.format)) {\n console.error(` \u2716 Invalid --format value: ${opts.format}. Use: text, json`);\n process.exit(1);\n }\n\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error(' \u2716 KiroGraph not initialized. Run: kirograph init');\n process.exit(1);\n }\n\n const cg = await KiroGraph.open(target);\n const db = cg.getDatabase();\n db.applySecuritySchema();\n\n const { AttackSurfaceAnalyzer } = await Promise.resolve().then(() => require('../../security/attack-surface.js'));\n const analyzer = new AttackSurfaceAnalyzer(db);\n const result = await analyzer.analyze();\n\n cg.close();\n\n // Apply --public-only filter\n let routes = opts.publicOnly\n ? result.allRoutes.filter(r => r.exposureLevel === 'public')\n : result.allRoutes;\n\n // Apply limit\n const limited = routes.slice(0, limit);\n\n // \u2500\u2500 JSON output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 if (opts.format === 'json') {\n console.log(JSON.stringify(\n {\n totalRoutes: result.totalRoutes,\n publicRoutes: result.publicRoutes,\n authenticatedRoutes: result.authenticatedRoutes,\n routesWithVulns: result.routesWithVulns,\n criticalPaths: result.criticalPaths,\n routes: limited,\n },\n null,\n 2,\n ));\n return;\n }\n\n // \u2500\u2500 Text output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 const totalLabel = result.totalRoutes === 1 ? 'route' : 'routes';\n console.log(\n `\\n ${section('Attack Surface')} ` +\n `${dim}(${result.totalRoutes} ${totalLabel} total: ${result.publicRoutes} public, ${result.authenticatedRoutes} authenticated)${reset}\\n`,\n );\n\n if (result.criticalPaths.length === 0) {\n console.log(` ${dim}No routes reaching vulnerable dependencies found.${reset}\\n`);\n return;\n }\n\n // Critical paths section\n console.log(` ${violet}${bold}\u25CF Critical paths${reset} ${dim}(routes reaching affected vulnerabilities)${reset}\\n`);\n\n const criticalToShow = result.criticalPaths.slice(0, limit);\n\n for (const entry of criticalToShow) {\n printRouteEntry(entry);\n }\n\n // If public-only was not set, also show clean routes summary\n if (!opts.publicOnly) {\n const cleanCount = result.totalRoutes - result.routesWithVulns;\n if (cleanCount > 0) {\n console.log(` ${dim}+ ${cleanCount} clean route${cleanCount === 1 ? '' : 's'} (no reachable vulnerabilities)${reset}\\n`);\n }\n }\n });\n}\n\nfunction printRouteEntry(entry: AttackSurfaceEntry): void {\n const isPublicVuln = entry.exposureLevel === 'public' && entry.vulnerableDeps.length > 0;\n const isAuthVuln = (entry.exposureLevel === 'authenticated' || entry.exposureLevel === 'internal') && entry.vulnerableDeps.length > 0;\n\n const routeColor = isPublicVuln ? red : isAuthVuln ? yellow : dim;\n const riskLabel = entry.riskScore > 0 ? `${entry.riskScore.toFixed(1)}` : '?';\n\n // Exposure badge\n const exposureBadge = (() => {\n switch (entry.exposureLevel) {\n case 'public': return `${red}public${reset} `;\n case 'authenticated': return `${yellow}authenticated${reset}`;\n case 'internal': return `${dim}internal${reset} `;\n default: return `${dim}unknown${reset} `;\n }\n })();\n\n // Pick the top vuln by riskScore to show inline\n const topVuln = entry.vulnerableDeps.reduce<AttackSurfaceEntry['vulnerableDeps'][0] | null>(\n (best, v) => {\n if (!best) return v;\n if ((v.riskScore ?? 0) > (best.riskScore ?? 0)) return v;\n return best;\n },\n null,\n );\n\n let vulnSuffix = '';\n if (topVuln) {\n const hopWord = topVuln.hopCount === 1 ? '1 hop' : `${topVuln.hopCount} hops`;\n vulnSuffix = ` ${dim}\u2192${reset} ${violet}${topVuln.packageName}${reset} ${dim}${topVuln.cveId}${reset} ${dim}(${hopWord})${reset}`;\n if (entry.vulnerableDeps.length > 1) {\n vulnSuffix += ` ${dim}+${entry.vulnerableDeps.length - 1} more${reset}`;\n }\n }\n\n console.log(\n ` ${routeColor}[${riskLabel}]${reset} ${bold}${entry.route.padEnd(30)}${reset} ${exposureBadge}${vulnSuffix}`,\n );\n\n // Pattern matches below the route line\n for (const pm of entry.patternMatches) {\n const sevUpper = pm.severity.toUpperCase();\n const pmColor = pm.severity === 'critical' ? red : pm.severity === 'high' ? yellow : dim;\n console.log(\n ` ${pmColor}\u26A0 [${sevUpper}]${reset} ${dim}${pm.patternId}${reset} ${dim}at${reset} ${pm.symbolName}:${pm.line}`,\n );\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,oBAA2B;AAC3B,gBAAkD;AAGlD,MAAM,MAAS;AACf,MAAM,SAAS;AAER,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,8BAA8B,EACtC,YAAY,sDAAsD,EAClE,OAAO,eAAe,oCAAoC,IAAI,EAC9D,OAAO,iBAAiB,yCAAyC,EACjE,OAAO,kBAAkB,6CAA6C,MAAM,EAC5E,OAAO,OACN,aACA,SACG;AACH,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,SAAS,UAAM,0BAAW,MAAM;AAEtC,QAAI,CAAC,OAAO,gBAAgB;AAC1B,cAAQ,MAAM;AAAA,IAAO,MAAM,wCAAmC,eAAK,EAAE;AACrE,cAAQ,MAAM,KAAK,aAAG,uCAAuC,eAAK,IAAI,gBAAM,GAAG,cAAI,yBAAyB,eAAK,EAAE;AACnH,cAAQ,MAAM,KAAK,aAAG,eAAe,eAAK,IAAI,gBAAM,GAAG,cAAI,kBAAkB,eAAK;AAAA,CAAI;AACtF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAA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1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiroGraph Benchmark Runner
|
|
3
|
+
*
|
|
4
|
+
* Clones repos at pinned SHAs, indexes them, runs predefined queries,
|
|
5
|
+
* and measures token efficiency vs naive file reading.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
export declare function register(program: Command): void;
|
|
9
|
+
//# sourceMappingURL=benchmark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/benchmark.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCpC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4C/C"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"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 benchmark_exports = {};
|
|
30
|
+
__export(benchmark_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(benchmark_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var import_child_process = require("child_process");
|
|
37
|
+
var import_ui = require("../ui");
|
|
38
|
+
function register(program) {
|
|
39
|
+
program.command("benchmark").description("Run reproducible token-efficiency benchmarks").option("--repo <name>", "Run benchmark for a specific repo only").option("--report", "Generate markdown report from existing results").option("--output <dir>", "Output directory for results", "benchmarks/results").action(async (opts) => {
|
|
40
|
+
const configPath = path.join(process.cwd(), "benchmarks", "config.json");
|
|
41
|
+
if (!fs.existsSync(configPath)) {
|
|
42
|
+
console.error(" benchmarks/config.json not found. Run from the KiroGraph project root.");
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
46
|
+
const outputDir = path.resolve(opts.output);
|
|
47
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
48
|
+
if (opts.report) {
|
|
49
|
+
generateReport(outputDir);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const repos = opts.repo ? config.repos.filter((r) => r.name === opts.repo) : config.repos;
|
|
53
|
+
if (repos.length === 0) {
|
|
54
|
+
console.error(` Repo "${opts.repo}" not found in config.`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
console.log(`
|
|
58
|
+
${import_ui.bold}KiroGraph Benchmark${import_ui.reset}`);
|
|
59
|
+
console.log(` ${import_ui.dim}Running ${repos.length} repo(s)\u2026${import_ui.reset}
|
|
60
|
+
`);
|
|
61
|
+
for (const repo of repos) {
|
|
62
|
+
const result = await runRepoBenchmark(repo);
|
|
63
|
+
const resultPath = path.join(outputDir, `${repo.name}.json`);
|
|
64
|
+
fs.writeFileSync(resultPath, JSON.stringify(result, null, 2));
|
|
65
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} ${repo.name}: avg ${result.avgSavingsPct}% savings \u2192 ${resultPath}
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
console.log(` ${import_ui.dim}Run \`kirograph benchmark --report\` to generate summary.${import_ui.reset}
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async function runRepoBenchmark(repo) {
|
|
73
|
+
const tmpDir = path.join(process.cwd(), ".kirograph-bench-tmp", repo.name);
|
|
74
|
+
console.log(` ${import_ui.violet}${repo.name}${import_ui.reset}: ${repo.description}`);
|
|
75
|
+
if (!fs.existsSync(tmpDir)) {
|
|
76
|
+
console.log(` ${import_ui.dim}Cloning ${repo.url}\u2026${import_ui.reset}`);
|
|
77
|
+
fs.mkdirSync(path.dirname(tmpDir), { recursive: true });
|
|
78
|
+
(0, import_child_process.execSync)(`git clone --depth 1 ${repo.url} ${tmpDir}`, { stdio: "pipe" });
|
|
79
|
+
if (repo.sha !== "main" && repo.sha !== "master") {
|
|
80
|
+
try {
|
|
81
|
+
(0, import_child_process.execSync)(`git checkout ${repo.sha}`, { cwd: tmpDir, stdio: "pipe" });
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
console.log(` ${import_ui.dim}Indexing\u2026${import_ui.reset}`);
|
|
87
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
88
|
+
const indexStart = Date.now();
|
|
89
|
+
let cg;
|
|
90
|
+
if (!KiroGraph.isInitialized(tmpDir)) {
|
|
91
|
+
cg = await KiroGraph.init(tmpDir);
|
|
92
|
+
} else {
|
|
93
|
+
cg = await KiroGraph.open(tmpDir);
|
|
94
|
+
}
|
|
95
|
+
const indexResult = await cg.indexAll();
|
|
96
|
+
const indexDurationMs = Date.now() - indexStart;
|
|
97
|
+
console.log(` ${import_ui.dim}Indexed: ${indexResult.filesIndexed} files, ${indexResult.nodesCreated} nodes, ${indexResult.edgesCreated} edges (${indexDurationMs}ms)${import_ui.reset}`);
|
|
98
|
+
const allFiles = cg.getAllNodes().map((n) => n.filePath);
|
|
99
|
+
const uniqueFiles = [...new Set(allFiles)];
|
|
100
|
+
let totalNaiveTokens = 0;
|
|
101
|
+
for (const fp of uniqueFiles) {
|
|
102
|
+
try {
|
|
103
|
+
const fullPath = path.join(tmpDir, fp);
|
|
104
|
+
const stat = fs.statSync(fullPath);
|
|
105
|
+
totalNaiveTokens += Math.round(stat.size / 4);
|
|
106
|
+
} catch {
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const queryResults = [];
|
|
110
|
+
for (const query of repo.queries) {
|
|
111
|
+
const start = Date.now();
|
|
112
|
+
let responseText = "";
|
|
113
|
+
try {
|
|
114
|
+
if (query.tool === "kirograph_context") {
|
|
115
|
+
const ctx = await cg.buildContext(query.args.task, { maxNodes: 20, includeCode: true });
|
|
116
|
+
responseText = ctx.summary + ctx.entryPoints.map((n) => n.name).join(" ");
|
|
117
|
+
for (const [, code] of ctx.codeSnippets) responseText += code;
|
|
118
|
+
} else if (query.tool === "kirograph_callers") {
|
|
119
|
+
const results = cg.searchNodes(query.args.symbol, void 0, 5);
|
|
120
|
+
if (results.length > 0) {
|
|
121
|
+
const callers = await cg.getCallers(results[0].node.id, 20);
|
|
122
|
+
responseText = callers.map((n) => `${n.name} ${n.filePath}`).join("\n");
|
|
123
|
+
}
|
|
124
|
+
} else if (query.tool === "kirograph_impact") {
|
|
125
|
+
const results = cg.searchNodes(query.args.symbol, void 0, 5);
|
|
126
|
+
if (results.length > 0) {
|
|
127
|
+
const impact = await cg.getImpactRadius(results[0].node.id, query.args.depth ?? 2);
|
|
128
|
+
responseText = impact.map((n) => `${n.name} ${n.filePath}`).join("\n");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
const durationMs = Date.now() - start;
|
|
134
|
+
const graphTokens = Math.round(responseText.length / 4);
|
|
135
|
+
const naiveFileCount = query.tool === "kirograph_context" ? 8 : 5;
|
|
136
|
+
const avgFileTokens = totalNaiveTokens / Math.max(uniqueFiles.length, 1);
|
|
137
|
+
const naiveTokens = Math.round(avgFileTokens * naiveFileCount);
|
|
138
|
+
const savingsPct = naiveTokens > 0 ? Math.round((1 - graphTokens / naiveTokens) * 100) : 0;
|
|
139
|
+
queryResults.push({
|
|
140
|
+
tool: query.tool,
|
|
141
|
+
args: query.args,
|
|
142
|
+
graphTokens,
|
|
143
|
+
naiveTokens,
|
|
144
|
+
savingsPct: Math.max(0, savingsPct),
|
|
145
|
+
durationMs
|
|
146
|
+
});
|
|
147
|
+
console.log(` ${import_ui.dim} ${query.tool}(${JSON.stringify(query.args).slice(0, 40)}\u2026) \u2192 ${savingsPct}% savings (${durationMs}ms)${import_ui.reset}`);
|
|
148
|
+
}
|
|
149
|
+
cg.close();
|
|
150
|
+
const avgSavingsPct = queryResults.length > 0 ? Math.round(queryResults.reduce((s, q) => s + q.savingsPct, 0) / queryResults.length) : 0;
|
|
151
|
+
return {
|
|
152
|
+
name: repo.name,
|
|
153
|
+
description: repo.description,
|
|
154
|
+
filesIndexed: indexResult.filesIndexed,
|
|
155
|
+
nodesCreated: indexResult.nodesCreated,
|
|
156
|
+
edgesCreated: indexResult.edgesCreated,
|
|
157
|
+
indexDurationMs,
|
|
158
|
+
queries: queryResults,
|
|
159
|
+
avgSavingsPct
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function generateReport(outputDir) {
|
|
163
|
+
const files = fs.readdirSync(outputDir).filter((f) => f.endsWith(".json"));
|
|
164
|
+
if (files.length === 0) {
|
|
165
|
+
console.log(" No results found. Run `kirograph benchmark` first.");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const results = files.map(
|
|
169
|
+
(f) => JSON.parse(fs.readFileSync(path.join(outputDir, f), "utf8"))
|
|
170
|
+
);
|
|
171
|
+
const lines = [
|
|
172
|
+
"# KiroGraph Benchmark Results",
|
|
173
|
+
"",
|
|
174
|
+
`Generated: ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 19)}`,
|
|
175
|
+
"",
|
|
176
|
+
"## Summary",
|
|
177
|
+
"",
|
|
178
|
+
"| Repository | Files | Nodes | Edges | Index Time | Avg Savings |",
|
|
179
|
+
"|-----------|-------|-------|-------|-----------|-------------|"
|
|
180
|
+
];
|
|
181
|
+
for (const r of results) {
|
|
182
|
+
lines.push(`| ${r.name} | ${r.filesIndexed} | ${r.nodesCreated} | ${r.edgesCreated} | ${r.indexDurationMs}ms | ${r.avgSavingsPct}% |`);
|
|
183
|
+
}
|
|
184
|
+
lines.push("", "## Query Details", "");
|
|
185
|
+
for (const r of results) {
|
|
186
|
+
lines.push(`### ${r.name}`, "");
|
|
187
|
+
lines.push("| Query | Graph Tokens | Naive Tokens | Savings | Time |");
|
|
188
|
+
lines.push("|-------|-------------|-------------|---------|------|");
|
|
189
|
+
for (const q of r.queries) {
|
|
190
|
+
const queryDesc = `${q.tool}(${JSON.stringify(q.args).slice(0, 30)}\u2026)`;
|
|
191
|
+
lines.push(`| ${queryDesc} | ${q.graphTokens} | ${q.naiveTokens} | ${q.savingsPct}% | ${q.durationMs}ms |`);
|
|
192
|
+
}
|
|
193
|
+
lines.push("");
|
|
194
|
+
}
|
|
195
|
+
const reportPath = path.join(outputDir, "REPORT.md");
|
|
196
|
+
fs.writeFileSync(reportPath, lines.join("\n"));
|
|
197
|
+
console.log(`
|
|
198
|
+
${import_ui.green}Report generated${import_ui.reset}: ${reportPath}
|
|
199
|
+
`);
|
|
200
|
+
console.log(lines.join("\n"));
|
|
201
|
+
}
|
|
202
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
203
|
+
0 && (module.exports = {
|
|
204
|
+
register
|
|
205
|
+
});
|
|
206
|
+
//# sourceMappingURL=benchmark.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/benchmark.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Benchmark Runner\n *\n * Clones repos at pinned SHAs, indexes them, runs predefined queries,\n * and measures token efficiency vs naive file reading.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { execSync } from 'child_process';\nimport { Command } from 'commander';\nimport { bold, dim, green, reset, violet } from '../ui';\n\ninterface BenchmarkQuery {\n tool: string;\n args: Record<string, unknown>;\n}\n\ninterface BenchmarkRepo {\n name: string;\n url: string;\n sha: string;\n description: string;\n queries: BenchmarkQuery[];\n}\n\ninterface BenchmarkConfig {\n repos: BenchmarkRepo[];\n}\n\ninterface QueryResult {\n tool: string;\n args: Record<string, unknown>;\n graphTokens: number;\n naiveTokens: number;\n savingsPct: number;\n durationMs: number;\n}\n\ninterface RepoResult {\n name: string;\n description: string;\n filesIndexed: number;\n nodesCreated: number;\n edgesCreated: number;\n indexDurationMs: number;\n queries: QueryResult[];\n avgSavingsPct: number;\n}\n\nexport function register(program: Command): void {\n program\n .command('benchmark')\n .description('Run reproducible token-efficiency benchmarks')\n .option('--repo <name>', 'Run benchmark for a specific repo only')\n .option('--report', 'Generate markdown report from existing results')\n .option('--output <dir>', 'Output directory for results', 'benchmarks/results')\n .action(async (opts: { repo?: string; report?: boolean; output: string }) => {\n const configPath = path.join(process.cwd(), 'benchmarks', 'config.json');\n if (!fs.existsSync(configPath)) {\n console.error(' benchmarks/config.json not found. Run from the KiroGraph project root.');\n process.exit(1);\n }\n\n const config: BenchmarkConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));\n const outputDir = path.resolve(opts.output);\n fs.mkdirSync(outputDir, { recursive: true });\n\n if (opts.report) {\n generateReport(outputDir);\n return;\n }\n\n const repos = opts.repo\n ? config.repos.filter(r => r.name === opts.repo)\n : config.repos;\n\n if (repos.length === 0) {\n console.error(` Repo \"${opts.repo}\" not found in config.`);\n process.exit(1);\n }\n\n console.log(`\\n ${bold}KiroGraph Benchmark${reset}`);\n console.log(` ${dim}Running ${repos.length} repo(s)\u2026${reset}\\n`);\n\n for (const repo of repos) {\n const result = await runRepoBenchmark(repo);\n const resultPath = path.join(outputDir, `${repo.name}.json`);\n fs.writeFileSync(resultPath, JSON.stringify(result, null, 2));\n console.log(` ${green}\u2713${reset} ${repo.name}: avg ${result.avgSavingsPct}% savings \u2192 ${resultPath}\\n`);\n }\n\n console.log(` ${dim}Run \\`kirograph benchmark --report\\` to generate summary.${reset}\\n`);\n });\n}\n\nasync function runRepoBenchmark(repo: BenchmarkRepo): Promise<RepoResult> {\n const tmpDir = path.join(process.cwd(), '.kirograph-bench-tmp', repo.name);\n\n console.log(` ${violet}${repo.name}${reset}: ${repo.description}`);\n\n // Clone if not already present\n if (!fs.existsSync(tmpDir)) {\n console.log(` ${dim}Cloning ${repo.url}\u2026${reset}`);\n fs.mkdirSync(path.dirname(tmpDir), { recursive: true });\n execSync(`git clone --depth 1 ${repo.url} ${tmpDir}`, { stdio: 'pipe' });\n if (repo.sha !== 'main' && repo.sha !== 'master') {\n try {\n execSync(`git checkout ${repo.sha}`, { cwd: tmpDir, stdio: 'pipe' });\n } catch {\n // SHA might not be fetchable with --depth 1, continue with HEAD\n }\n }\n }\n\n // Index\n console.log(` ${dim}Indexing\u2026${reset}`);\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const indexStart = Date.now();\n\n let cg;\n if (!KiroGraph.isInitialized(tmpDir)) {\n cg = await KiroGraph.init(tmpDir);\n } else {\n cg = await KiroGraph.open(tmpDir);\n }\n\n const indexResult = await cg.indexAll();\n const indexDurationMs = Date.now() - indexStart;\n\n console.log(` ${dim}Indexed: ${indexResult.filesIndexed} files, ${indexResult.nodesCreated} nodes, ${indexResult.edgesCreated} edges (${indexDurationMs}ms)${reset}`);\n\n // Estimate naive tokens (reading all source files)\n const allFiles = cg.getAllNodes().map((n: any) => n.filePath as string);\n const uniqueFiles = [...new Set(allFiles)];\n let totalNaiveTokens = 0;\n for (const fp of uniqueFiles) {\n try {\n const fullPath = path.join(tmpDir, fp);\n const stat = fs.statSync(fullPath);\n totalNaiveTokens += Math.round(stat.size / 4);\n } catch { /* skip */ }\n }\n\n // Run queries\n const queryResults: QueryResult[] = [];\n for (const query of repo.queries) {\n const start = Date.now();\n let responseText = '';\n\n try {\n if (query.tool === 'kirograph_context') {\n const ctx = await cg.buildContext(query.args.task as string, { maxNodes: 20, includeCode: true });\n responseText = ctx.summary + ctx.entryPoints.map((n: any) => n.name).join(' ');\n for (const [, code] of ctx.codeSnippets) responseText += code;\n } else if (query.tool === 'kirograph_callers') {\n const results = cg.searchNodes(query.args.symbol as string, undefined, 5);\n if (results.length > 0) {\n const callers = await cg.getCallers(results[0].node.id, 20);\n responseText = callers.map((n: any) => `${n.name} ${n.filePath}`).join('\\n');\n }\n } else if (query.tool === 'kirograph_impact') {\n const results = cg.searchNodes(query.args.symbol as string, undefined, 5);\n if (results.length > 0) {\n const impact = await cg.getImpactRadius(results[0].node.id, (query.args.depth as number) ?? 2);\n responseText = impact.map((n: any) => `${n.name} ${n.filePath}`).join('\\n');\n }\n }\n } catch { /* query failed \u2014 record 0 */ }\n\n const durationMs = Date.now() - start;\n const graphTokens = Math.round(responseText.length / 4);\n\n // Naive estimate: for context queries, agent would read ~5-10 files\n // For callers/impact, agent would grep + read ~3-5 files\n const naiveFileCount = query.tool === 'kirograph_context' ? 8 : 5;\n const avgFileTokens = totalNaiveTokens / Math.max(uniqueFiles.length, 1);\n const naiveTokens = Math.round(avgFileTokens * naiveFileCount);\n\n const savingsPct = naiveTokens > 0 ? Math.round((1 - graphTokens / naiveTokens) * 100) : 0;\n\n queryResults.push({\n tool: query.tool,\n args: query.args,\n graphTokens,\n naiveTokens,\n savingsPct: Math.max(0, savingsPct),\n durationMs,\n });\n\n console.log(` ${dim} ${query.tool}(${JSON.stringify(query.args).slice(0, 40)}\u2026) \u2192 ${savingsPct}% savings (${durationMs}ms)${reset}`);\n }\n\n cg.close();\n\n const avgSavingsPct = queryResults.length > 0\n ? Math.round(queryResults.reduce((s, q) => s + q.savingsPct, 0) / queryResults.length)\n : 0;\n\n return {\n name: repo.name,\n description: repo.description,\n filesIndexed: indexResult.filesIndexed,\n nodesCreated: indexResult.nodesCreated,\n edgesCreated: indexResult.edgesCreated,\n indexDurationMs,\n queries: queryResults,\n avgSavingsPct,\n };\n}\n\nfunction generateReport(outputDir: string): void {\n const files = fs.readdirSync(outputDir).filter(f => f.endsWith('.json'));\n if (files.length === 0) {\n console.log(' No results found. Run `kirograph benchmark` first.');\n return;\n }\n\n const results: RepoResult[] = files.map(f =>\n JSON.parse(fs.readFileSync(path.join(outputDir, f), 'utf8'))\n );\n\n const lines = [\n '# KiroGraph Benchmark Results',\n '',\n `Generated: ${new Date().toISOString().slice(0, 19)}`,\n '',\n '## Summary',\n '',\n '| Repository | Files | Nodes | Edges | Index Time | Avg Savings |',\n '|-----------|-------|-------|-------|-----------|-------------|',\n ];\n\n for (const r of results) {\n lines.push(`| ${r.name} | ${r.filesIndexed} | ${r.nodesCreated} | ${r.edgesCreated} | ${r.indexDurationMs}ms | ${r.avgSavingsPct}% |`);\n }\n\n lines.push('', '## Query Details', '');\n\n for (const r of results) {\n lines.push(`### ${r.name}`, '');\n lines.push('| Query | Graph Tokens | Naive Tokens | Savings | Time |');\n lines.push('|-------|-------------|-------------|---------|------|');\n for (const q of r.queries) {\n const queryDesc = `${q.tool}(${JSON.stringify(q.args).slice(0, 30)}\u2026)`;\n lines.push(`| ${queryDesc} | ${q.graphTokens} | ${q.naiveTokens} | ${q.savingsPct}% | ${q.durationMs}ms |`);\n }\n lines.push('');\n }\n\n const reportPath = path.join(outputDir, 'REPORT.md');\n fs.writeFileSync(reportPath, lines.join('\\n'));\n console.log(`\\n ${green}Report generated${reset}: ${reportPath}\\n`);\n console.log(lines.join('\\n'));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAoB;AACpB,WAAsB;AACtB,2BAAyB;AAEzB,gBAAgD;AAuCzC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,WAAW,EACnB,YAAY,8CAA8C,EAC1D,OAAO,iBAAiB,wCAAwC,EAChE,OAAO,YAAY,gDAAgD,EACnE,OAAO,kBAAkB,gCAAgC,oBAAoB,EAC7E,OAAO,OAAO,SAA8D;AAC3E,UAAM,aAAa,KAAK,KAAK,QAAQ,IAAI,GAAG,cAAc,aAAa;AACvE,QAAI,CAAC,GAAG,WAAW,UAAU,GAAG;AAC9B,cAAQ,MAAM,0EAA0E;AACxF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,SAA0B,KAAK,MAAM,GAAG,aAAa,YAAY,MAAM,CAAC;AAC9E,UAAM,YAAY,KAAK,QAAQ,KAAK,MAAM;AAC1C,OAAG,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;AAE3C,QAAI,KAAK,QAAQ;AACf,qBAAe,SAAS;AACxB;AAAA,IACF;AAEA,UAAM,QAAQ,KAAK,OACf,OAAO,MAAM,OAAO,OAAK,EAAE,SAAS,KAAK,IAAI,IAC7C,OAAO;AAEX,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,MAAM,WAAW,KAAK,IAAI,wBAAwB;AAC1D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,IAAI;AAAA,IAAO,cAAI,sBAAsB,eAAK,EAAE;A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,EAAE,MAAM,GAAG,EAAE,CAAC;AAClE,YAAM,KAAK,KAAK,SAAS,MAAM,EAAE,WAAW,MAAM,EAAE,WAAW,MAAM,EAAE,UAAU,OAAO,EAAE,UAAU,MAAM;AAAA,IAC5G;AACA,UAAM,KAAK,EAAE;AAAA,EACf;AAEA,QAAM,aAAa,KAAK,KAAK,WAAW,WAAW;AACnD,KAAG,cAAc,YAAY,MAAM,KAAK,IAAI,CAAC;AAC7C,UAAQ,IAAI;AAAA,IAAO,eAAK,mBAAmB,eAAK,KAAK,UAAU;AAAA,CAAI;AACnE,UAAQ,IAAI,MAAM,KAAK,IAAI,CAAC;AAC9B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/budget.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoD/C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var budget_exports = {};
|
|
20
|
+
__export(budget_exports, {
|
|
21
|
+
register: () => register
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(budget_exports);
|
|
24
|
+
function register(program) {
|
|
25
|
+
program.command("budget").description("Show current session context budget usage").option("--reset", "Reset session budget counters").option("--json", "Output as JSON").action(async (opts) => {
|
|
26
|
+
const { BudgetTracker } = await Promise.resolve().then(() => require("../../compression/tracker.js"));
|
|
27
|
+
const projectRoot = process.cwd();
|
|
28
|
+
let budgetConfig;
|
|
29
|
+
try {
|
|
30
|
+
const { loadConfig } = await Promise.resolve().then(() => require("../../config.js"));
|
|
31
|
+
const config = await loadConfig(projectRoot);
|
|
32
|
+
if (config.contextBudget) {
|
|
33
|
+
budgetConfig = config.contextBudget;
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
const budget = BudgetTracker.getInstance(projectRoot, budgetConfig);
|
|
38
|
+
if (opts.reset) {
|
|
39
|
+
budget.reset();
|
|
40
|
+
if (opts.json) {
|
|
41
|
+
console.log(JSON.stringify({ reset: true }));
|
|
42
|
+
} else {
|
|
43
|
+
console.log(" Context budget counters reset.");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const status = budget.getStatus();
|
|
48
|
+
if (opts.json) {
|
|
49
|
+
console.log(JSON.stringify(status, null, 2));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
console.log(`
|
|
53
|
+
Context Budget:`);
|
|
54
|
+
console.log(` ${"\u2500".repeat(40)}`);
|
|
55
|
+
console.log(` Tokens consumed: ${status.consumed.toLocaleString()}`);
|
|
56
|
+
console.log(` Budget limit: ${status.limit > 0 ? status.limit.toLocaleString() : "unlimited"}`);
|
|
57
|
+
console.log(` Remaining: ${status.limit > 0 ? status.remaining.toLocaleString() : "\u221E"}`);
|
|
58
|
+
console.log(` Utilization: ${status.utilization}%`);
|
|
59
|
+
if (status.warning) {
|
|
60
|
+
console.log(`
|
|
61
|
+
\u26A0 ${status.warning}`);
|
|
62
|
+
}
|
|
63
|
+
console.log();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
register
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=budget.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/budget.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * kirograph budget \u2014 Context budget governance CLI command\n */\n\nimport { Command } from 'commander';\n\nexport function register(program: Command): void {\n program\n .command('budget')\n .description('Show current session context budget usage')\n .option('--reset', 'Reset session budget counters')\n .option('--json', 'Output as JSON')\n .action(async (opts: { reset?: boolean; json?: boolean }) => {\n const { BudgetTracker } = await Promise.resolve().then(() => require('../../compression/tracker.js'));\n const projectRoot = process.cwd();\n\n // Load budget config from .kirograph/config.json if available\n let budgetConfig: { maxTokensPerSession?: number; warnAt?: number; throttleAt?: number } | undefined;\n try {\n const { loadConfig } = await Promise.resolve().then(() => require('../../config.js'));\n const config = await loadConfig(projectRoot);\n if (config.contextBudget) {\n budgetConfig = config.contextBudget;\n }\n } catch { /* no config \u2014 use defaults */ }\n\n const budget = BudgetTracker.getInstance(projectRoot, budgetConfig);\n\n if (opts.reset) {\n budget.reset();\n if (opts.json) {\n console.log(JSON.stringify({ reset: true }));\n } else {\n console.log(' Context budget counters reset.');\n }\n return;\n }\n\n const status = budget.getStatus();\n\n if (opts.json) {\n console.log(JSON.stringify(status, null, 2));\n return;\n }\n\n console.log(`\\n Context Budget:`);\n console.log(` ${'\u2500'.repeat(40)}`);\n console.log(` Tokens consumed: ${status.consumed.toLocaleString()}`);\n console.log(` Budget limit: ${status.limit > 0 ? status.limit.toLocaleString() : 'unlimited'}`);\n console.log(` Remaining: ${status.limit > 0 ? status.remaining.toLocaleString() : '\u221E'}`);\n console.log(` Utilization: ${status.utilization}%`);\n\n if (status.warning) {\n console.log(`\\n \u26A0 ${status.warning}`);\n }\n\n console.log();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,QAAQ,EAChB,YAAY,2CAA2C,EACvD,OAAO,WAAW,+BAA+B,EACjD,OAAO,UAAU,gBAAgB,EACjC,OAAO,OAAO,SAA8C;AAC3D,UAAM,EAAE,cAAc,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,8BAA8B,CAAC;AACpG,UAAM,cAAc,QAAQ,IAAI;AAGhC,QAAI;AACJ,QAAI;AACF,YAAM,EAAE,WAAW,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,iBAAiB,CAAC;AACpF,YAAM,SAAS,MAAM,WAAW,WAAW;AAC3C,UAAI,OAAO,eAAe;AACxB,uBAAe,OAAO;AAAA,MACxB;AAAA,IACF,QAAQ;AAAA,IAAiC;AAEzC,UAAM,SAAS,cAAc,YAAY,aAAa,YAAY;AAElE,QAAI,KAAK,OAAO;AACd,aAAO,MAAM;AACb,UAAI,KAAK,MAAM;AACb,gBAAQ,IAAI,KAAK,UAAU,EAAE,OAAO,KAAK,CAAC,CAAC;AAAA,MAC7C,OAAO;AACL,gBAAQ,IAAI,kCAAkC;AAAA,MAChD;AACA;AAAA,IACF;AAEA,UAAM,SAAS,OAAO,UAAU;AAEhC,QAAI,KAAK,MAAM;AACb,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAC3C;AAAA,IACF;AAEA,YAAQ,IAAI;AAAA,kBAAqB;AACjC,YAAQ,IAAI,KAAK,SAAI,OAAO,EAAE,CAAC,EAAE;AACjC,YAAQ,IAAI,sBAAsB,OAAO,SAAS,eAAe,CAAC,EAAE;AACpE,YAAQ,IAAI,sBAAsB,OAAO,QAAQ,IAAI,OAAO,MAAM,eAAe,IAAI,WAAW,EAAE;AAClG,YAAQ,IAAI,sBAAsB,OAAO,QAAQ,IAAI,OAAO,UAAU,eAAe,IAAI,QAAG,EAAE;AAC9F,YAAQ,IAAI,sBAAsB,OAAO,WAAW,GAAG;AAEvD,QAAI,OAAO,SAAS;AAClB,cAAQ,IAAI;AAAA,WAAS,OAAO,OAAO,EAAE;AAAA,IACvC;AAEA,YAAQ,IAAI;AAAA,EACd,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caveman.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/caveman.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCpC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgG/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"communities.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/communities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+C/C"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"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 communities_exports = {};
|
|
30
|
+
__export(communities_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(communities_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_ui = require("../ui");
|
|
36
|
+
function register(program) {
|
|
37
|
+
program.command("communities [projectPath]").description("Detect code communities (clusters of related symbols)").option("--resolution <n>", "Resolution parameter (higher = more communities)", "1.0").option("--limit <n>", "Max communities to show", "15").option("--json", "Output as JSON").action(async (projectPath, opts) => {
|
|
38
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
39
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
40
|
+
const cg = await KiroGraph.open(target);
|
|
41
|
+
const { detectCommunities } = await Promise.resolve().then(() => require("../../graph/communities.js"));
|
|
42
|
+
const db = cg.getDatabase();
|
|
43
|
+
const result = detectCommunities(db, {
|
|
44
|
+
resolution: parseFloat(opts.resolution)
|
|
45
|
+
});
|
|
46
|
+
if (opts.json) {
|
|
47
|
+
console.log(JSON.stringify(result, null, 2));
|
|
48
|
+
cg.close();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (result.communities.length === 0) {
|
|
52
|
+
console.log("\n No communities detected. The graph may be too small or have no edges.\n");
|
|
53
|
+
cg.close();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const limit = Math.min(parseInt(opts.limit), result.communities.length);
|
|
57
|
+
console.log(`
|
|
58
|
+
${import_ui.bold}Communities${import_ui.reset} (${result.communities.length} detected, modularity: ${result.modularity.toFixed(3)})`);
|
|
59
|
+
console.log(` ${import_ui.dim}${result.totalNodes} nodes, ${result.totalEdges} edges${import_ui.reset}
|
|
60
|
+
`);
|
|
61
|
+
for (const c of result.communities.slice(0, limit)) {
|
|
62
|
+
console.log(` ${import_ui.green}${c.label}${import_ui.reset} \u2014 ${c.memberCount} symbols`);
|
|
63
|
+
console.log(` ${import_ui.dim}dir: ${c.dominantDirectory} | lang: ${c.dominantLanguage} | cross-edges: ${c.interCommunityEdges}${import_ui.reset}`);
|
|
64
|
+
for (const m of c.members.slice(0, 5)) {
|
|
65
|
+
console.log(` ${import_ui.dim}${m.kind}${import_ui.reset} ${import_ui.violet}${m.name}${import_ui.reset} ${import_ui.dim}\u2014 ${m.filePath}${import_ui.reset}`);
|
|
66
|
+
}
|
|
67
|
+
if (c.memberCount > 5) console.log(` ${import_ui.dim}\u2026and ${c.memberCount - 5} more${import_ui.reset}`);
|
|
68
|
+
console.log();
|
|
69
|
+
}
|
|
70
|
+
cg.close();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
register
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=communities.js.map
|