kirograph 0.16.1 → 0.19.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 +103 -1605
- package/dist/architecture/layers/dart.js +112 -0
- package/dist/architecture/layers/dart.js.map +7 -0
- package/dist/architecture/layers/index.js +3 -1
- package/dist/architecture/layers/index.js.map +2 -2
- package/dist/bin/banner.js +74 -6
- package/dist/bin/banner.js.map +2 -2
- package/dist/bin/commands/affected.js +40 -5
- package/dist/bin/commands/affected.js.map +2 -2
- package/dist/bin/commands/attack-surface.js +157 -0
- package/dist/bin/commands/attack-surface.js.map +7 -0
- package/dist/bin/commands/benchmark.js +206 -0
- package/dist/bin/commands/benchmark.js.map +7 -0
- package/dist/bin/commands/budget.js +70 -0
- package/dist/bin/commands/budget.js.map +7 -0
- package/dist/bin/commands/communities.js +77 -0
- package/dist/bin/commands/communities.js.map +7 -0
- package/dist/bin/commands/data.js +665 -0
- package/dist/bin/commands/data.js.map +7 -0
- package/dist/bin/commands/dep-confusion.js +119 -0
- package/dist/bin/commands/dep-confusion.js.map +7 -0
- package/dist/bin/commands/export.js +304 -10
- package/dist/bin/commands/export.js.map +2 -2
- package/dist/bin/commands/flows.js +97 -0
- package/dist/bin/commands/flows.js.map +7 -0
- package/dist/bin/commands/help.js +386 -100
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/install.js +90 -8
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.js +201 -0
- package/dist/bin/commands/licenses.js.map +7 -0
- package/dist/bin/commands/reachability.js +160 -0
- package/dist/bin/commands/reachability.js.map +7 -0
- package/dist/bin/commands/read.js +100 -0
- package/dist/bin/commands/read.js.map +7 -0
- package/dist/bin/commands/refactor.js +116 -0
- package/dist/bin/commands/refactor.js.map +7 -0
- package/dist/bin/commands/remediation.js +133 -0
- package/dist/bin/commands/remediation.js.map +7 -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.js +267 -0
- package/dist/bin/commands/security-ci-report.js.map +7 -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.js +126 -0
- package/dist/bin/commands/security-flows.js.map +7 -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.js +193 -0
- package/dist/bin/commands/security.js.map +7 -0
- package/dist/bin/commands/staleness.js +144 -0
- package/dist/bin/commands/staleness.js.map +7 -0
- package/dist/bin/commands/status.js +102 -2
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.js +138 -0
- package/dist/bin/commands/supply-chain.js.map +7 -0
- package/dist/bin/commands/uninit.js +109 -60
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/vex.js +76 -0
- package/dist/bin/commands/vex.js.map +7 -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.js +382 -0
- package/dist/bin/commands/vulns.js.map +7 -0
- package/dist/bin/installer/auto-detect.js +125 -0
- package/dist/bin/installer/auto-detect.js.map +7 -0
- package/dist/bin/installer/cli-agent.js +28 -5
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.js +47 -0
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +39 -1
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/detect.js +309 -0
- package/dist/bin/installer/detect.js.map +7 -0
- package/dist/bin/installer/index.js +36 -1
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +195 -3
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/steering.js +440 -0
- package/dist/bin/installer/steering.js.map +2 -2
- 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.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- 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.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- 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.js +32 -6
- package/dist/bin/installer/targets/cline.js.map +2 -2
- 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.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- 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.js +31 -5
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- 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.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- 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.js +2 -14
- package/dist/bin/installer/targets/generic.js.map +2 -2
- 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.js +250 -0
- package/dist/bin/installer/targets/index.js.map +2 -2
- 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.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.js +3 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- 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.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- 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.js +96 -0
- package/dist/bin/installer/targets/qwen.js.map +7 -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.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- 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.js +5 -5
- package/dist/bin/installer/targets/trae.js.map +2 -2
- 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.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.js +30 -0
- package/dist/bin/progress.js.map +2 -2
- package/dist/compression/naive-cost.js +25 -0
- package/dist/compression/naive-cost.js.map +2 -2
- package/dist/compression/tracker.js +91 -2
- package/dist/compression/tracker.js.map +2 -2
- package/dist/compression/types.js.map +1 -1
- package/dist/config.js +126 -3
- package/dist/config.js.map +2 -2
- package/dist/core/pipeline.js +92 -4
- package/dist/core/pipeline.js.map +2 -2
- package/dist/data/filters.js +105 -0
- package/dist/data/filters.js.map +7 -0
- package/dist/data/indexer.js +225 -0
- package/dist/data/indexer.js.map +7 -0
- package/dist/data/linker.js +150 -0
- package/dist/data/linker.js.map +7 -0
- package/dist/data/lint.js +109 -0
- package/dist/data/lint.js.map +7 -0
- package/dist/data/parsers/csv.js +132 -0
- package/dist/data/parsers/csv.js.map +7 -0
- package/dist/data/parsers/excel.js +88 -0
- package/dist/data/parsers/excel.js.map +7 -0
- package/dist/data/parsers/index.js +79 -0
- package/dist/data/parsers/index.js.map +7 -0
- package/dist/data/parsers/json-array.js +89 -0
- package/dist/data/parsers/json-array.js.map +7 -0
- package/dist/data/parsers/jsonl.js +84 -0
- package/dist/data/parsers/jsonl.js.map +7 -0
- package/dist/data/parsers/parquet.js +95 -0
- package/dist/data/parsers/parquet.js.map +7 -0
- package/dist/data/profiler.js +182 -0
- package/dist/data/profiler.js.map +7 -0
- package/dist/data/queries.js +512 -0
- package/dist/data/queries.js.map +7 -0
- package/dist/data/types.js +17 -0
- package/dist/data/types.js.map +7 -0
- package/dist/db/data-schema.sql +61 -0
- package/dist/db/database.js +67 -5
- package/dist/db/database.js.map +2 -2
- package/dist/db/memory-schema.sql +5 -1
- package/dist/db/schema.sql +3 -1
- package/dist/db/security-schema.sql +72 -0
- package/dist/extraction/extractor.js +81 -0
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +32 -8
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.js +43 -1
- package/dist/extraction/languages.js.map +2 -2
- 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/flutter.js +130 -0
- package/dist/frameworks/flutter.js.map +7 -0
- package/dist/frameworks/index.js +7 -1
- package/dist/frameworks/index.js.map +3 -3
- package/dist/graph/communities.js +317 -0
- package/dist/graph/communities.js.map +7 -0
- package/dist/graph/flows.js +138 -0
- package/dist/graph/flows.js.map +7 -0
- package/dist/graph/refactor.js +155 -0
- package/dist/graph/refactor.js.map +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/cache.js +172 -0
- package/dist/mcp/cache.js.map +7 -0
- package/dist/mcp/read-modes.js +295 -0
- package/dist/mcp/read-modes.js.map +7 -0
- package/dist/mcp/server.js +2 -1
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.js +29 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +1588 -6
- package/dist/mcp/tools.js.map +3 -3
- package/dist/memory/database.js +32 -2
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/types.js.map +1 -1
- 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.js +155 -0
- package/dist/resolution/bridges/expo-modules.js.map +7 -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.js +80 -0
- package/dist/resolution/bridges/index.js.map +7 -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.js +244 -0
- package/dist/resolution/bridges/native-views.js.map +7 -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.js +227 -0
- package/dist/resolution/bridges/swift-objc.js.map +7 -0
- package/dist/resolution/bridges/turbomodules.js +216 -0
- package/dist/resolution/bridges/turbomodules.js.map +7 -0
- package/dist/resolution/index.js +61 -2
- package/dist/resolution/index.js.map +2 -2
- package/dist/security/attack-surface.js +164 -0
- package/dist/security/attack-surface.js.map +7 -0
- package/dist/security/context-warnings.js +123 -0
- package/dist/security/context-warnings.js.map +7 -0
- package/dist/security/context-warnings.test.js +300 -0
- package/dist/security/context-warnings.test.js.map +7 -0
- package/dist/security/data-flows.js +228 -0
- package/dist/security/data-flows.js.map +7 -0
- package/dist/security/dep-confusion.js +255 -0
- package/dist/security/dep-confusion.js.map +7 -0
- package/dist/security/errors.js +51 -0
- package/dist/security/errors.js.map +7 -0
- package/dist/security/export/fix-suggestions.js +58 -0
- package/dist/security/export/fix-suggestions.js.map +7 -0
- package/dist/security/export/fix-suggestions.test.js +74 -0
- package/dist/security/export/fix-suggestions.test.js.map +7 -0
- package/dist/security/export/sbom.js +230 -0
- package/dist/security/export/sbom.js.map +7 -0
- package/dist/security/export/sbom.test.js +288 -0
- package/dist/security/export/sbom.test.js.map +7 -0
- package/dist/security/export/serialization.js +142 -0
- package/dist/security/export/serialization.js.map +7 -0
- package/dist/security/export/serialization.test.js +310 -0
- package/dist/security/export/serialization.test.js.map +7 -0
- package/dist/security/export/vex.js +220 -0
- package/dist/security/export/vex.js.map +7 -0
- package/dist/security/export/vex.test.js +278 -0
- package/dist/security/export/vex.test.js.map +7 -0
- package/dist/security/index.js +67 -0
- package/dist/security/index.js.map +7 -0
- package/dist/security/integrator-transitives.test.js +359 -0
- package/dist/security/integrator-transitives.test.js.map +7 -0
- package/dist/security/integrator.js +491 -0
- package/dist/security/integrator.js.map +7 -0
- package/dist/security/integrator.test.js +237 -0
- package/dist/security/integrator.test.js.map +7 -0
- package/dist/security/license.js +70 -0
- package/dist/security/license.js.map +7 -0
- package/dist/security/manifest/adapter.js +243 -0
- package/dist/security/manifest/adapter.js.map +7 -0
- package/dist/security/manifest/adapter.test.js +272 -0
- package/dist/security/manifest/adapter.test.js.map +7 -0
- package/dist/security/manifest/parser.js +376 -0
- package/dist/security/manifest/parser.js.map +7 -0
- package/dist/security/manifest/parser.test.js +110 -0
- package/dist/security/manifest/parser.test.js.map +7 -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/cargo.test.js +304 -0
- package/dist/security/manifest/plugins/cargo.test.js.map +7 -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.js +146 -0
- package/dist/security/manifest/plugins/go.js.map +7 -0
- package/dist/security/manifest/plugins/go.test.js +341 -0
- package/dist/security/manifest/plugins/go.test.js.map +7 -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.js +159 -0
- package/dist/security/manifest/plugins/hex.js.map +7 -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/maven.test.js +389 -0
- package/dist/security/manifest/plugins/maven.test.js.map +7 -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/npm.test.js +298 -0
- package/dist/security/manifest/plugins/npm.test.js.map +7 -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.js +123 -0
- package/dist/security/manifest/plugins/pip.js.map +7 -0
- package/dist/security/manifest/plugins/pip.test.js +208 -0
- package/dist/security/manifest/plugins/pip.test.js.map +7 -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.js +261 -0
- package/dist/security/manifest/plugins/pyproject.js.map +7 -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.js +200 -0
- package/dist/security/manifest/plugins/swift.js.map +7 -0
- package/dist/security/owasp.js +104 -0
- package/dist/security/owasp.js.map +7 -0
- package/dist/security/pipeline.js +125 -0
- package/dist/security/pipeline.js.map +7 -0
- package/dist/security/reachability.js +276 -0
- package/dist/security/reachability.js.map +7 -0
- package/dist/security/reachability.test.js +394 -0
- package/dist/security/reachability.test.js.map +7 -0
- package/dist/security/remediation.js +126 -0
- package/dist/security/remediation.js.map +7 -0
- package/dist/security/secrets.js +176 -0
- package/dist/security/secrets.js.map +7 -0
- package/dist/security/staleness.js +231 -0
- package/dist/security/staleness.js.map +7 -0
- package/dist/security/supply-chain.js +301 -0
- package/dist/security/supply-chain.js.map +7 -0
- package/dist/security/suppressions.js +106 -0
- package/dist/security/suppressions.js.map +7 -0
- package/dist/security/types.js +17 -0
- package/dist/security/types.js.map +7 -0
- package/dist/security/vuln/client.js +355 -0
- package/dist/security/vuln/client.js.map +7 -0
- package/dist/security/vuln/client.test.js +288 -0
- package/dist/security/vuln/client.test.js.map +7 -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.js +29 -0
- package/dist/security/vuln/index.js.map +7 -0
- package/dist/security/vuln/osv-adapter.js +321 -0
- package/dist/security/vuln/osv-adapter.js.map +7 -0
- package/dist/security/vuln/osv-adapter.test.js +391 -0
- package/dist/security/vuln/osv-adapter.test.js.map +7 -0
- package/dist/security/vuln/types.js +17 -0
- package/dist/security/vuln/types.js.map +7 -0
- package/dist/types.js.map +2 -2
- package/package.json +5 -2
package/dist/bin/kirograph.js
CHANGED
|
@@ -33,6 +33,29 @@ var import_compression = require("./commands/compression");
|
|
|
33
33
|
var import_exec = require("./commands/exec");
|
|
34
34
|
var import_memory = require("./commands/memory");
|
|
35
35
|
var import_docs = require("./commands/docs");
|
|
36
|
+
var import_data = require("./commands/data");
|
|
37
|
+
var import_benchmark = require("./commands/benchmark");
|
|
38
|
+
var import_flows = require("./commands/flows");
|
|
39
|
+
var import_communities = require("./commands/communities");
|
|
40
|
+
var import_refactor = require("./commands/refactor");
|
|
41
|
+
var import_read = require("./commands/read");
|
|
42
|
+
var import_budget = require("./commands/budget");
|
|
43
|
+
var import_security = require("./commands/security");
|
|
44
|
+
var import_sbom = require("./commands/sbom");
|
|
45
|
+
var import_vex = require("./commands/vex");
|
|
46
|
+
var import_vulns = require("./commands/vulns");
|
|
47
|
+
var import_reachability = require("./commands/reachability");
|
|
48
|
+
var import_staleness = require("./commands/staleness");
|
|
49
|
+
var import_licenses = require("./commands/licenses");
|
|
50
|
+
var import_security_export = require("./commands/security-export");
|
|
51
|
+
var import_vuln_suppress = require("./commands/vuln-suppress");
|
|
52
|
+
var import_attack_surface = require("./commands/attack-surface");
|
|
53
|
+
var import_security_secrets = require("./commands/security-secrets");
|
|
54
|
+
var import_security_flows = require("./commands/security-flows");
|
|
55
|
+
var import_security_ci_report = require("./commands/security-ci-report");
|
|
56
|
+
var import_supply_chain = require("./commands/supply-chain");
|
|
57
|
+
var import_dep_confusion = require("./commands/dep-confusion");
|
|
58
|
+
var import_remediation = require("./commands/remediation");
|
|
36
59
|
process.on("uncaughtException", (err) => {
|
|
37
60
|
const msg = err?.message ?? String(err);
|
|
38
61
|
const isWasmAbort = msg.includes("Aborted(") || msg.includes("RuntimeError") || err?.constructor?.name === "RuntimeError";
|
|
@@ -61,7 +84,7 @@ process.on("uncaughtException", (err) => {
|
|
|
61
84
|
process.exit(1);
|
|
62
85
|
});
|
|
63
86
|
const program = new import_commander.Command();
|
|
64
|
-
program.name("kirograph").description("Semantic code knowledge graph for Kiro").version("0.
|
|
87
|
+
program.name("kirograph").description("Semantic code knowledge graph for Kiro").version("0.19.0").addHelpCommand(true).hook("preAction", (thisCommand) => {
|
|
65
88
|
const name = thisCommand.name();
|
|
66
89
|
if (name === "init") (0, import_banner.printBanner)();
|
|
67
90
|
});
|
|
@@ -95,11 +118,56 @@ program.name("kirograph").description("Semantic code knowledge graph for Kiro").
|
|
|
95
118
|
(0, import_exec.register)(program);
|
|
96
119
|
(0, import_memory.register)(program);
|
|
97
120
|
(0, import_docs.register)(program);
|
|
121
|
+
(0, import_data.register)(program);
|
|
122
|
+
(0, import_benchmark.register)(program);
|
|
123
|
+
(0, import_flows.register)(program);
|
|
124
|
+
(0, import_communities.register)(program);
|
|
125
|
+
(0, import_refactor.register)(program);
|
|
126
|
+
(0, import_read.register)(program);
|
|
127
|
+
(0, import_budget.register)(program);
|
|
128
|
+
const securityCmd = (0, import_security.register)(program);
|
|
129
|
+
(0, import_sbom.register)(program);
|
|
130
|
+
(0, import_vex.register)(program);
|
|
131
|
+
(0, import_vulns.register)(program);
|
|
132
|
+
(0, import_reachability.register)(program);
|
|
133
|
+
(0, import_staleness.register)(program);
|
|
134
|
+
(0, import_licenses.register)(program);
|
|
135
|
+
(0, import_security_export.register)(securityCmd);
|
|
136
|
+
(0, import_security_secrets.register)(securityCmd);
|
|
137
|
+
(0, import_security_flows.register)(securityCmd);
|
|
138
|
+
(0, import_security_ci_report.register)(securityCmd);
|
|
139
|
+
(0, import_vuln_suppress.register)(program);
|
|
140
|
+
(0, import_attack_surface.register)(program);
|
|
141
|
+
(0, import_supply_chain.register)(program);
|
|
142
|
+
(0, import_dep_confusion.register)(program);
|
|
143
|
+
(0, import_remediation.register)(program);
|
|
144
|
+
program.command("help").description("Show interactive help").action(() => {
|
|
145
|
+
if (process.stdout.isTTY) {
|
|
146
|
+
(0, import_help.printInteractiveHelp)();
|
|
147
|
+
} else {
|
|
148
|
+
(0, import_banner.printBanner)();
|
|
149
|
+
(0, import_help.printColoredHelp)();
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
(0, import_help.register)(program);
|
|
98
154
|
if (process.argv.length === 2) {
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
|
|
155
|
+
if (process.stdout.isTTY) {
|
|
156
|
+
(0, import_help.printInteractiveHelp)();
|
|
157
|
+
} else {
|
|
158
|
+
(0, import_banner.printBanner)();
|
|
159
|
+
(0, import_help.printColoredHelp)();
|
|
160
|
+
process.exit(0);
|
|
161
|
+
}
|
|
162
|
+
} else if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
163
|
+
if (process.stdout.isTTY) {
|
|
164
|
+
(0, import_help.printInteractiveHelp)();
|
|
165
|
+
} else {
|
|
166
|
+
(0, import_banner.printBanner)();
|
|
167
|
+
(0, import_help.printColoredHelp)();
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
program.parse(process.argv);
|
|
102
172
|
}
|
|
103
|
-
(0, import_help.register)(program);
|
|
104
|
-
program.parse(process.argv);
|
|
105
173
|
//# sourceMappingURL=kirograph.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bin/kirograph.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n/**\n * KiroGraph CLI\n */\n\nimport { Command } from 'commander';\nimport { printBanner } from './banner';\nimport { printColoredHelp, register as registerHelp } from './commands/help';\nimport { register as registerInit } from './commands/init';\nimport { register as registerUninit } from './commands/uninit';\nimport { register as registerIndex } from './commands/index';\nimport { register as registerSync } from './commands/sync';\nimport { register as registerStatus } from './commands/status';\nimport { register as registerQuery } from './commands/query';\nimport { register as registerFiles } from './commands/files';\nimport { register as registerContext } from './commands/context';\nimport { register as registerAffected } from './commands/affected';\nimport { register as registerMarkDirty } from './commands/mark-dirty';\nimport { register as registerSyncIfDirty } from './commands/sync-if-dirty';\nimport { register as registerUnlock } from './commands/unlock';\nimport { register as registerInstall } from './commands/install';\nimport { register as registerServe } from './commands/serve';\nimport { register as registerDashboard } from './commands/dashboard';\nimport { register as registerArchitecture } from './commands/architecture';\nimport { register as registerCoupling } from './commands/coupling';\nimport { register as registerPackage } from './commands/package';\nimport { register as registerCaveman } from './commands/caveman';\nimport { register as registerDeadCode } from './commands/dead-code';\nimport { register as registerHotspots } from './commands/hotspots';\nimport { register as registerSurprising } from './commands/surprising';\nimport { register as registerSnapshot } from './commands/snapshot';\nimport { register as registerPath } from './commands/path';\nimport { register as registerExport } from './commands/export';\nimport { register as registerGain } from './commands/gain';\nimport { register as registerCompression } from './commands/compression';\nimport { register as registerExec } from './commands/exec';\nimport { register as registerMemory } from './commands/memory';\nimport { register as registerDocs } from './commands/docs';\n\n// \u2500\u2500 Global error handler for WASM runtime crashes \u2500\u2500\u2500\u2500\u2500\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// node-sqlite3-wasm calls process.abort() when it hits a fatal error (e.g.\n// database is locked by another process). This produces a raw \"Aborted()\"\n// message with no context. We intercept it here to print a clear explanation\n// before the process exits.\nprocess.on('uncaughtException', (err: Error) => {\n const msg = err?.message ?? String(err);\n const isWasmAbort = msg.includes('Aborted(') || msg.includes('RuntimeError') || (err as any)?.constructor?.name === 'RuntimeError';\n\n if (isWasmAbort) {\n process.stderr.write([\n '',\n ' \u2716 KiroGraph crashed: SQLite WASM runtime aborted.',\n '',\n ' Most likely cause: another process (e.g. the Kiro MCP server) is',\n ' holding the database open while indexing is running.',\n '',\n ' How to fix:',\n ' 1. Close Kiro IDE (or disable the kirograph MCP server) before indexing',\n ' 2. Run: kirograph unlock',\n ' 3. Then retry: kirograph index',\n '',\n ' If the problem persists, delete the lock manually:',\n ' del .kirograph\\\\kirograph.db.lock (Windows)',\n ' rm -rf .kirograph/kirograph.db.lock (macOS/Linux)',\n '',\n ].join('\\n'));\n process.exit(1);\n }\n\n // Not a WASM crash \u2014 re-throw as normal\n process.stderr.write(`Uncaught error: ${msg}\\n`);\n process.exit(1);\n});\n\ndeclare const __CLI_VERSION__: string;\n\nconst program = new Command();\n\nprogram\n .name('kirograph')\n .description('Semantic code knowledge graph for Kiro')\n .version(__CLI_VERSION__)\n .addHelpCommand(true)\n .hook('preAction', (thisCommand) => {\n const name = thisCommand.name();\n if (name === 'init') printBanner();\n });\n\nregisterInstall(program);\nregisterInit(program);\nregisterUninit(program);\nregisterIndex(program);\nregisterSync(program);\nregisterSyncIfDirty(program);\nregisterMarkDirty(program);\nregisterStatus(program);\nregisterQuery(program);\nregisterContext(program);\nregisterFiles(program);\nregisterAffected(program);\nregisterUnlock(program);\nregisterServe(program);\nregisterDashboard(program);\nregisterArchitecture(program);\nregisterCoupling(program);\nregisterPackage(program);\nregisterCaveman(program);\nregisterDeadCode(program);\nregisterHotspots(program);\nregisterSurprising(program);\nregisterSnapshot(program);\nregisterPath(program);\nregisterExport(program);\nregisterGain(program);\nregisterCompression(program);\nregisterExec(program);\nregisterMemory(program);\nregisterDocs(program);\n\n// Show
|
|
5
|
-
"mappings": ";;AAKA,uBAAwB;AACxB,oBAA4B;AAC5B,
|
|
6
|
-
"names": ["registerInstall", "registerInit", "registerUninit", "registerIndex", "registerSync", "registerSyncIfDirty", "registerMarkDirty", "registerStatus", "registerQuery", "registerContext", "registerFiles", "registerAffected", "registerUnlock", "registerServe", "registerDashboard", "registerArchitecture", "registerCoupling", "registerPackage", "registerCaveman", "registerDeadCode", "registerHotspots", "registerSurprising", "registerSnapshot", "registerPath", "registerExport", "registerGain", "registerCompression", "registerExec", "registerMemory", "registerDocs", "registerHelp"]
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n/**\n * KiroGraph CLI\n */\n\nimport { Command } from 'commander';\nimport { printBanner } from './banner';\nimport { printColoredHelp, printInteractiveHelp, register as registerHelp } from './commands/help';\nimport { register as registerInit } from './commands/init';\nimport { register as registerUninit } from './commands/uninit';\nimport { register as registerIndex } from './commands/index';\nimport { register as registerSync } from './commands/sync';\nimport { register as registerStatus } from './commands/status';\nimport { register as registerQuery } from './commands/query';\nimport { register as registerFiles } from './commands/files';\nimport { register as registerContext } from './commands/context';\nimport { register as registerAffected } from './commands/affected';\nimport { register as registerMarkDirty } from './commands/mark-dirty';\nimport { register as registerSyncIfDirty } from './commands/sync-if-dirty';\nimport { register as registerUnlock } from './commands/unlock';\nimport { register as registerInstall } from './commands/install';\nimport { register as registerServe } from './commands/serve';\nimport { register as registerDashboard } from './commands/dashboard';\nimport { register as registerArchitecture } from './commands/architecture';\nimport { register as registerCoupling } from './commands/coupling';\nimport { register as registerPackage } from './commands/package';\nimport { register as registerCaveman } from './commands/caveman';\nimport { register as registerDeadCode } from './commands/dead-code';\nimport { register as registerHotspots } from './commands/hotspots';\nimport { register as registerSurprising } from './commands/surprising';\nimport { register as registerSnapshot } from './commands/snapshot';\nimport { register as registerPath } from './commands/path';\nimport { register as registerExport } from './commands/export';\nimport { register as registerGain } from './commands/gain';\nimport { register as registerCompression } from './commands/compression';\nimport { register as registerExec } from './commands/exec';\nimport { register as registerMemory } from './commands/memory';\nimport { register as registerDocs } from './commands/docs';\nimport { register as registerData } from './commands/data';\nimport { register as registerBenchmark } from './commands/benchmark';\nimport { register as registerFlows } from './commands/flows';\nimport { register as registerCommunities } from './commands/communities';\nimport { register as registerRefactor } from './commands/refactor';\nimport { register as registerRead } from './commands/read';\nimport { register as registerBudget } from './commands/budget';\nimport { register as registerSecurity } from './commands/security';\nimport { register as registerSbom } from './commands/sbom';\nimport { register as registerVex } from './commands/vex';\nimport { register as registerVulns } from './commands/vulns';\nimport { register as registerReachability } from './commands/reachability';\nimport { register as registerStaleness } from './commands/staleness';\nimport { register as registerLicenses } from './commands/licenses';\nimport { register as registerSecurityExport } from './commands/security-export';\nimport { register as registerVulnSuppress } from './commands/vuln-suppress';\nimport { register as registerAttackSurface } from './commands/attack-surface';\nimport { register as registerSecuritySecrets } from './commands/security-secrets';\nimport { register as registerSecurityFlows } from './commands/security-flows';\nimport { register as registerSecurityCiReport } from './commands/security-ci-report';\nimport { register as registerSupplyChain } from './commands/supply-chain';\nimport { register as registerDepConfusion } from './commands/dep-confusion';\nimport { register as registerRemediation } from './commands/remediation';\n\n// \u2500\u2500 Global error handler for WASM runtime crashes \u2500\u2500\u2500\u2500\u2500\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// node-sqlite3-wasm calls process.abort() when it hits a fatal error (e.g.\n// database is locked by another process). This produces a raw \"Aborted()\"\n// message with no context. We intercept it here to print a clear explanation\n// before the process exits.\nprocess.on('uncaughtException', (err: Error) => {\n const msg = err?.message ?? String(err);\n const isWasmAbort = msg.includes('Aborted(') || msg.includes('RuntimeError') || (err as any)?.constructor?.name === 'RuntimeError';\n\n if (isWasmAbort) {\n process.stderr.write([\n '',\n ' \u2716 KiroGraph crashed: SQLite WASM runtime aborted.',\n '',\n ' Most likely cause: another process (e.g. the Kiro MCP server) is',\n ' holding the database open while indexing is running.',\n '',\n ' How to fix:',\n ' 1. Close Kiro IDE (or disable the kirograph MCP server) before indexing',\n ' 2. Run: kirograph unlock',\n ' 3. Then retry: kirograph index',\n '',\n ' If the problem persists, delete the lock manually:',\n ' del .kirograph\\\\kirograph.db.lock (Windows)',\n ' rm -rf .kirograph/kirograph.db.lock (macOS/Linux)',\n '',\n ].join('\\n'));\n process.exit(1);\n }\n\n // Not a WASM crash \u2014 re-throw as normal\n process.stderr.write(`Uncaught error: ${msg}\\n`);\n process.exit(1);\n});\n\ndeclare const __CLI_VERSION__: string;\n\nconst program = new Command();\n\nprogram\n .name('kirograph')\n .description('Semantic code knowledge graph for Kiro')\n .version(__CLI_VERSION__)\n .addHelpCommand(true)\n .hook('preAction', (thisCommand) => {\n const name = thisCommand.name();\n if (name === 'init') printBanner();\n });\n\nregisterInstall(program);\nregisterInit(program);\nregisterUninit(program);\nregisterIndex(program);\nregisterSync(program);\nregisterSyncIfDirty(program);\nregisterMarkDirty(program);\nregisterStatus(program);\nregisterQuery(program);\nregisterContext(program);\nregisterFiles(program);\nregisterAffected(program);\nregisterUnlock(program);\nregisterServe(program);\nregisterDashboard(program);\nregisterArchitecture(program);\nregisterCoupling(program);\nregisterPackage(program);\nregisterCaveman(program);\nregisterDeadCode(program);\nregisterHotspots(program);\nregisterSurprising(program);\nregisterSnapshot(program);\nregisterPath(program);\nregisterExport(program);\nregisterGain(program);\nregisterCompression(program);\nregisterExec(program);\nregisterMemory(program);\nregisterDocs(program);\nregisterData(program);\nregisterBenchmark(program);\nregisterFlows(program);\nregisterCommunities(program);\nregisterRefactor(program);\nregisterRead(program);\nregisterBudget(program);\nconst securityCmd = registerSecurity(program);\nregisterSbom(program);\nregisterVex(program);\nregisterVulns(program);\nregisterReachability(program);\nregisterStaleness(program);\nregisterLicenses(program);\nregisterSecurityExport(securityCmd);\nregisterSecuritySecrets(securityCmd);\nregisterSecurityFlows(securityCmd);\nregisterSecurityCiReport(securityCmd);\nregisterVulnSuppress(program);\nregisterAttackSurface(program);\nregisterSupplyChain(program);\nregisterDepConfusion(program);\nregisterRemediation(program);\n\n// Register the help command for `kirograph help`\nprogram\n .command('help')\n .description('Show interactive help')\n .action(() => {\n if (process.stdout.isTTY) {\n printInteractiveHelp();\n } else {\n printBanner();\n printColoredHelp();\n process.exit(0);\n }\n });\n\nregisterHelp(program);\n\n// Show interactive help when called with no arguments\nif (process.argv.length === 2) {\n if (process.stdout.isTTY) {\n printInteractiveHelp();\n } else {\n printBanner();\n printColoredHelp();\n process.exit(0);\n }\n} else if (process.argv.includes('--help') || process.argv.includes('-h')) {\n // Intercept --help before Commander to avoid process.exit\n if (process.stdout.isTTY) {\n printInteractiveHelp();\n } else {\n printBanner();\n printColoredHelp();\n process.exit(0);\n }\n} else {\n program.parse(process.argv);\n}\n"],
|
|
5
|
+
"mappings": ";;AAKA,uBAAwB;AACxB,oBAA4B;AAC5B,kBAAiF;AACjF,kBAAyC;AACzC,oBAA2C;AAC3C,sBAA0C;AAC1C,kBAAyC;AACzC,oBAA2C;AAC3C,mBAA0C;AAC1C,mBAA0C;AAC1C,qBAA4C;AAC5C,sBAA6C;AAC7C,wBAA8C;AAC9C,2BAAgD;AAChD,oBAA2C;AAC3C,qBAA4C;AAC5C,mBAA0C;AAC1C,uBAA8C;AAC9C,0BAAiD;AACjD,sBAA6C;AAC7C,qBAA4C;AAC5C,qBAA4C;AAC5C,uBAA6C;AAC7C,sBAA6C;AAC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erSyncIfDirty", "registerMarkDirty", "registerStatus", "registerQuery", "registerContext", "registerFiles", "registerAffected", "registerUnlock", "registerServe", "registerDashboard", "registerArchitecture", "registerCoupling", "registerPackage", "registerCaveman", "registerDeadCode", "registerHotspots", "registerSurprising", "registerSnapshot", "registerPath", "registerExport", "registerGain", "registerCompression", "registerExec", "registerMemory", "registerDocs", "registerData", "registerBenchmark", "registerFlows", "registerCommunities", "registerRefactor", "registerRead", "registerBudget", "registerSecurity", "registerSbom", "registerVex", "registerVulns", "registerReachability", "registerStaleness", "registerLicenses", "registerSecurityExport", "registerSecuritySecrets", "registerSecurityFlows", "registerSecurityCiReport", "registerVulnSuppress", "registerAttackSurface", "registerSupplyChain", "registerDepConfusion", "registerRemediation", "registerHelp"]
|
|
7
7
|
}
|
package/dist/bin/progress.js
CHANGED
|
@@ -78,6 +78,16 @@ function renderIndexProgress(p) {
|
|
|
78
78
|
process.stdout.write(`\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${" ".repeat(10)}`);
|
|
79
79
|
if (p.current === p.total && p.total > 0) process.stdout.write("\n");
|
|
80
80
|
}
|
|
81
|
+
} else if (p.phase === "docs") {
|
|
82
|
+
if (p.meta?.msg) {
|
|
83
|
+
process.stdout.write(`\r ${_v}docs${_r} ${_d}${p.meta.msg}${_r}${" ".repeat(20)}`);
|
|
84
|
+
if (String(p.meta.msg).startsWith("docs:")) process.stdout.write("\n");
|
|
85
|
+
}
|
|
86
|
+
} else if (p.phase === "data") {
|
|
87
|
+
if (p.meta?.msg) {
|
|
88
|
+
process.stdout.write(`\r ${_v}data${_r} ${_d}${p.meta.msg}${_r}${" ".repeat(20)}`);
|
|
89
|
+
if (String(p.meta.msg).startsWith("data:")) process.stdout.write("\n");
|
|
90
|
+
}
|
|
81
91
|
} else {
|
|
82
92
|
process.stdout.write(`\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${" ".repeat(20)}`);
|
|
83
93
|
}
|
|
@@ -118,6 +128,16 @@ function renderSyncProgress(p) {
|
|
|
118
128
|
process.stdout.write(`\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${" ".repeat(10)}`);
|
|
119
129
|
if (p.current === p.total && p.total > 0) process.stdout.write("\n");
|
|
120
130
|
}
|
|
131
|
+
} else if (p.phase === "docs") {
|
|
132
|
+
if (p.meta?.msg) {
|
|
133
|
+
process.stdout.write(`\r ${_v}docs${_r} ${_d}${p.meta.msg}${_r}${" ".repeat(20)}`);
|
|
134
|
+
if (String(p.meta.msg).startsWith("docs:")) process.stdout.write("\n");
|
|
135
|
+
}
|
|
136
|
+
} else if (p.phase === "data") {
|
|
137
|
+
if (p.meta?.msg) {
|
|
138
|
+
process.stdout.write(`\r ${_v}data${_r} ${_d}${p.meta.msg}${_r}${" ".repeat(20)}`);
|
|
139
|
+
if (String(p.meta.msg).startsWith("data:")) process.stdout.write("\n");
|
|
140
|
+
}
|
|
121
141
|
} else {
|
|
122
142
|
process.stdout.write(`\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${" ".repeat(20)}`);
|
|
123
143
|
}
|
|
@@ -169,6 +189,16 @@ function renderSyncProgressVerbose(p) {
|
|
|
169
189
|
`);
|
|
170
190
|
} else if (p.current === p.total && p.total > 0) {
|
|
171
191
|
process.stdout.write(` ${_v}\u2713 architecture${_r}
|
|
192
|
+
`);
|
|
193
|
+
}
|
|
194
|
+
} else if (p.phase === "docs") {
|
|
195
|
+
if (p.meta?.msg) {
|
|
196
|
+
process.stdout.write(` ${_v}docs${_r} ${_d}${p.meta.msg}${_r}
|
|
197
|
+
`);
|
|
198
|
+
}
|
|
199
|
+
} else if (p.phase === "data") {
|
|
200
|
+
if (p.meta?.msg) {
|
|
201
|
+
process.stdout.write(` ${_v}data${_r} ${_d}${p.meta.msg}${_r}
|
|
172
202
|
`);
|
|
173
203
|
}
|
|
174
204
|
} else {
|
package/dist/bin/progress.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bin/progress.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph CLI Progress Renderer\n *\n * Renders indexAll/sync progress events to stdout.\n * Lives in src/bin/ because it is a display concern \u2014 not part of the core library.\n */\n\nimport type { IndexProgress, SyncResult } from '../types';\n\n// \u2500\u2500 ANSI 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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst _v = '\\x1b[38;5;99m'; // violet\nconst _r = '\\x1b[0m'; // reset\nconst _d = '\\x1b[2m'; // dim\nconst _g = '\\x1b[38;5;114m'; // green\n\nfunction _bar(pct: number, width = 20): string {\n const filled = Math.floor(pct / (100 / width));\n return '\u2588'.repeat(filled) + '\u2591'.repeat(width - filled);\n}\n\nfunction _num(n: number): string {\n return n.toLocaleString();\n}\n\n// \u2500\u2500 Renderer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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/**\n * Renders a single indexAll progress event to stdout.\n * Scanning and framework detection print a persistent line (with \\n).\n * Parsing, resolving, and embeddings overwrite the current line (\\r).\n */\nexport function renderIndexProgress(p: IndexProgress): void {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n\n if (p.phase === 'scanning') {\n process.stdout.write(` ${_v}\u2713 scanning${_r} ${_v}${p.current}${_r} ${_d}files found${_r}\\n`);\n\n } else if (p.phase === 'parsing') {\n process.stdout.write(`\\r ${_v}parsing${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(8)}`);\n if (p.current === p.total) process.stdout.write('\\n');\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(`\\r ${_v}resolving${_r} cross-file references\u2026${' '.repeat(20)}`);\n } else if (p.total > 0) {\n const bar = _bar(pct);\n const suffix = p.current === p.total\n ? `${_v}${p.current}${_r}${_d}/${p.total} refs${_r}\\n`\n : `${_v}${p.current}${_r}${_d}/${p.total}${_r}${' '.repeat(10)}`;\n const prefix = p.current === p.total ? `\\r ${_v}\u2713 resolving${_r}` : `\\r ${_v}resolving${_r} `;\n process.stdout.write(`${prefix} [${bar}] ${suffix}`);\n }\n\n } else if (p.phase === 'detecting frameworks') {\n if (p.current === 1) {\n const frameworks = (p.meta?.frameworks as string[]) ?? [];\n const languages = (p.meta?.languages as string[]) ?? [];\n const fwLabel = frameworks.length > 0 ? `${_v}${frameworks.join(', ')}${_r}` : `${_d}none${_r}`;\n const langLabel = languages.length > 0 ? `${_v}${languages.join(', ')}${_r}` : `${_d}none${_r}`;\n process.stdout.write(` ${_v}\u2713 languages${_r} detected: ${langLabel}\\n`);\n process.stdout.write(` ${_v}\u2713 frameworks${_r} detected: ${fwLabel}\\n`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n // Large-codebase pre-flight warning emitted by VectorManager\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else {\n process.stdout.write(`\\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${' '.repeat(20)}`);\n }\n}\n\n\n// \u2500\u2500 Sync Progress Renderer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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/**\n * Renders a single sync progress event to stdout.\n * Same visual style as renderIndexProgress but tailored for incremental sync.\n */\nexport function renderSyncProgress(p: IndexProgress): void {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n\n if (p.phase === 'scanning') {\n if (p.current > 0) {\n process.stdout.write(`\\r ${_v}\u2713 scanning${_r} ${_v}${_num(p.current)}${_r} ${_d}files found${_r}\\n`);\n } else {\n process.stdout.write(`\\r ${_v}scanning${_r} ${_d}detecting changes\u2026${_r}${' '.repeat(20)}`);\n }\n\n } else if (p.phase === 'parsing') {\n process.stdout.write(`\\r ${_v}parsing${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(8)}`);\n if (p.current === p.total) process.stdout.write('\\n');\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(`\\r ${_v}resolving${_r} cross-file references\u2026${' '.repeat(20)}`);\n } else if (p.total > 0) {\n const bar = _bar(pct);\n const suffix = p.current === p.total\n ? `${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)} refs${_r}\\n`\n : `${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)}${_r}${' '.repeat(10)}`;\n const prefix = p.current === p.total ? `\\r ${_v}\u2713 resolving${_r}` : `\\r ${_v}resolving${_r} `;\n process.stdout.write(`${prefix} [${bar}] ${suffix}`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else {\n process.stdout.write(`\\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${' '.repeat(20)}`);\n }\n}\n\n/**\n * Verbose sync progress renderer for `sync --progress`.\n * Prints each file as it is processed, errors inline, and a running count.\n * Exclude-cleanup removals are shown with a distinct prefix.\n */\nexport function renderSyncProgressVerbose(p: IndexProgress): void {\n if (p.phase === 'scanning') {\n if (p.meta?.excludeCleanup && p.meta.file) {\n // A file is being removed because it now matches an exclude pattern\n process.stdout.write(` ${_d}exclude${_r} ${_d}${p.meta.file}${_r}\\n`);\n } else if (p.current > 0) {\n process.stdout.write(` ${_v}\u2713 scanning${_r} ${_v}${_num(p.current)}${_r} ${_d}files found${_r}\\n`);\n } else {\n process.stdout.write(` ${_v}scanning${_r} ${_d}detecting changes\u2026${_r}\\n`);\n }\n\n } else if (p.phase === 'parsing') {\n if (p.currentFile) {\n const short = p.currentFile.length > 60\n ? '\u2026' + p.currentFile.slice(p.currentFile.length - 59)\n : p.currentFile;\n process.stdout.write(` ${_v}parse${_r} ${_d}[${_num(p.current)}/${_num(p.total)}]${_r} ${short}\\n`);\n }\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(` ${_v}resolving${_r} cross-file references\u2026\\n`);\n } else if (p.total > 0 && p.current === p.total) {\n process.stdout.write(` ${_v}\u2713 resolving${_r} ${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)} refs${_r}\\n`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'architecture') {\n if (p.meta?.msg) {\n process.stdout.write(` ${_v}architecture${_r} ${_d}${p.meta.msg}${_r}\\n`);\n } else if (p.current === p.total && p.total > 0) {\n process.stdout.write(` ${_v}\u2713 architecture${_r}\\n`);\n }\n\n } else {\n process.stdout.write(` ${_v}${p.phase}${_r} ${p.current}/${p.total}\\n`);\n }\n}\n\n/**\n * Renders the final sync summary with before/after counts.\n */\nexport function renderSyncSummary(result: SyncResult): void {\n const secs = (result.duration / 1000).toFixed(1);\n const filesChanged = result.added.length + result.modified.length;\n const filesDeleted = result.removed.length;\n\n console.log(`\\n ${_g}\u2713${_r} sync complete ${_d}(${secs}s)${_r}`);\n console.log(` ${_d}files scanned:${_r} ${_v}${_num(result.filesScanned)}${_r}`);\n console.log(` ${_d}files changed:${_r} ${_v}${_num(filesChanged)}${_r}`);\n console.log(` ${_d}files deleted:${_r} ${_v}${_num(filesDeleted)}${_r}`);\n console.log(` ${_d}nodes added:${_r} ${_v}${_num(result.nodesCreated)}${_r}`);\n console.log(` ${_d}nodes updated:${_r} ${_v}${_num(result.nodesUpdated)}${_r}`);\n console.log(` ${_d}nodes removed:${_r} ${_v}${_num(result.nodesRemoved)}${_r}`);\n console.log(` ${_d}edges added:${_r} ${_v}${_num(result.edgesCreated)}${_r}`);\n console.log(` ${_d}edges removed:${_r} ${_v}${_num(result.edgesRemoved)}${_r}`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,KAAK;AAEX,SAAS,KAAK,KAAa,QAAQ,IAAY;AAC7C,QAAM,SAAS,KAAK,MAAM,OAAO,MAAM,MAAM;AAC7C,SAAO,SAAI,OAAO,MAAM,IAAI,SAAI,OAAO,QAAQ,MAAM;AACvD;AAEA,SAAS,KAAK,GAAmB;AAC/B,SAAO,EAAE,eAAe;AAC1B;AASO,SAAS,oBAAoB,GAAwB;AAC1D,QAAM,MAAM,EAAE,QAAQ,IAAI,KAAK,MAAO,EAAE,UAAU,EAAE,QAAS,GAAG,IAAI;AAEpE,MAAI,EAAE,UAAU,YAAY;AAC1B,YAAQ,OAAO,MAAM,KAAK,EAAE,kBAAa,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE;AAAA,CAAI;AAAA,EAEhG,WAAW,EAAE,UAAU,WAAW;AAChC,YAAQ,OAAO,MAAM,OAAO,EAAE,UAAU,EAAE,QAAQ,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE;AAChG,QAAI,EAAE,YAAY,EAAE,MAAO,SAAQ,OAAO,MAAM,IAAI;AAAA,EA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derer\n *\n * Renders indexAll/sync progress events to stdout.\n * Lives in src/bin/ because it is a display concern \u2014 not part of the core library.\n */\n\nimport type { IndexProgress, SyncResult } from '../types';\n\n// \u2500\u2500 ANSI 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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst _v = '\\x1b[38;5;99m'; // violet\nconst _r = '\\x1b[0m'; // reset\nconst _d = '\\x1b[2m'; // dim\nconst _g = '\\x1b[38;5;114m'; // green\n\nfunction _bar(pct: number, width = 20): string {\n const filled = Math.floor(pct / (100 / width));\n return '\u2588'.repeat(filled) + '\u2591'.repeat(width - filled);\n}\n\nfunction _num(n: number): string {\n return n.toLocaleString();\n}\n\n// \u2500\u2500 Renderer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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/**\n * Renders a single indexAll progress event to stdout.\n * Scanning and framework detection print a persistent line (with \\n).\n * Parsing, resolving, and embeddings overwrite the current line (\\r).\n */\nexport function renderIndexProgress(p: IndexProgress): void {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n\n if (p.phase === 'scanning') {\n process.stdout.write(` ${_v}\u2713 scanning${_r} ${_v}${p.current}${_r} ${_d}files found${_r}\\n`);\n\n } else if (p.phase === 'parsing') {\n process.stdout.write(`\\r ${_v}parsing${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(8)}`);\n if (p.current === p.total) process.stdout.write('\\n');\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(`\\r ${_v}resolving${_r} cross-file references\u2026${' '.repeat(20)}`);\n } else if (p.total > 0) {\n const bar = _bar(pct);\n const suffix = p.current === p.total\n ? `${_v}${p.current}${_r}${_d}/${p.total} refs${_r}\\n`\n : `${_v}${p.current}${_r}${_d}/${p.total}${_r}${' '.repeat(10)}`;\n const prefix = p.current === p.total ? `\\r ${_v}\u2713 resolving${_r}` : `\\r ${_v}resolving${_r} `;\n process.stdout.write(`${prefix} [${bar}] ${suffix}`);\n }\n\n } else if (p.phase === 'detecting frameworks') {\n if (p.current === 1) {\n const frameworks = (p.meta?.frameworks as string[]) ?? [];\n const languages = (p.meta?.languages as string[]) ?? [];\n const fwLabel = frameworks.length > 0 ? `${_v}${frameworks.join(', ')}${_r}` : `${_d}none${_r}`;\n const langLabel = languages.length > 0 ? `${_v}${languages.join(', ')}${_r}` : `${_d}none${_r}`;\n process.stdout.write(` ${_v}\u2713 languages${_r} detected: ${langLabel}\\n`);\n process.stdout.write(` ${_v}\u2713 frameworks${_r} detected: ${fwLabel}\\n`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n // Large-codebase pre-flight warning emitted by VectorManager\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'docs') {\n if (p.meta?.msg) {\n process.stdout.write(`\\r ${_v}docs${_r} ${_d}${p.meta.msg}${_r}${' '.repeat(20)}`);\n if (String(p.meta.msg).startsWith('docs:')) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'data') {\n if (p.meta?.msg) {\n process.stdout.write(`\\r ${_v}data${_r} ${_d}${p.meta.msg}${_r}${' '.repeat(20)}`);\n if (String(p.meta.msg).startsWith('data:')) process.stdout.write('\\n');\n }\n\n } else {\n process.stdout.write(`\\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${' '.repeat(20)}`);\n }\n}\n\n\n// \u2500\u2500 Sync Progress Renderer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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/**\n * Renders a single sync progress event to stdout.\n * Same visual style as renderIndexProgress but tailored for incremental sync.\n */\nexport function renderSyncProgress(p: IndexProgress): void {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n\n if (p.phase === 'scanning') {\n if (p.current > 0) {\n process.stdout.write(`\\r ${_v}\u2713 scanning${_r} ${_v}${_num(p.current)}${_r} ${_d}files found${_r}\\n`);\n } else {\n process.stdout.write(`\\r ${_v}scanning${_r} ${_d}detecting changes\u2026${_r}${' '.repeat(20)}`);\n }\n\n } else if (p.phase === 'parsing') {\n process.stdout.write(`\\r ${_v}parsing${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(8)}`);\n if (p.current === p.total) process.stdout.write('\\n');\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(`\\r ${_v}resolving${_r} cross-file references\u2026${' '.repeat(20)}`);\n } else if (p.total > 0) {\n const bar = _bar(pct);\n const suffix = p.current === p.total\n ? `${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)} refs${_r}\\n`\n : `${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)}${_r}${' '.repeat(10)}`;\n const prefix = p.current === p.total ? `\\r ${_v}\u2713 resolving${_r}` : `\\r ${_v}resolving${_r} `;\n process.stdout.write(`${prefix} [${bar}] ${suffix}`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'docs') {\n if (p.meta?.msg) {\n process.stdout.write(`\\r ${_v}docs${_r} ${_d}${p.meta.msg}${_r}${' '.repeat(20)}`);\n if (String(p.meta.msg).startsWith('docs:')) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'data') {\n if (p.meta?.msg) {\n process.stdout.write(`\\r ${_v}data${_r} ${_d}${p.meta.msg}${_r}${' '.repeat(20)}`);\n if (String(p.meta.msg).startsWith('data:')) process.stdout.write('\\n');\n }\n\n } else {\n process.stdout.write(`\\r ${_v}${p.phase}${_r} ${p.current}/${p.total}${' '.repeat(20)}`);\n }\n}\n\n/**\n * Verbose sync progress renderer for `sync --progress`.\n * Prints each file as it is processed, errors inline, and a running count.\n * Exclude-cleanup removals are shown with a distinct prefix.\n */\nexport function renderSyncProgressVerbose(p: IndexProgress): void {\n if (p.phase === 'scanning') {\n if (p.meta?.excludeCleanup && p.meta.file) {\n // A file is being removed because it now matches an exclude pattern\n process.stdout.write(` ${_d}exclude${_r} ${_d}${p.meta.file}${_r}\\n`);\n } else if (p.current > 0) {\n process.stdout.write(` ${_v}\u2713 scanning${_r} ${_v}${_num(p.current)}${_r} ${_d}files found${_r}\\n`);\n } else {\n process.stdout.write(` ${_v}scanning${_r} ${_d}detecting changes\u2026${_r}\\n`);\n }\n\n } else if (p.phase === 'parsing') {\n if (p.currentFile) {\n const short = p.currentFile.length > 60\n ? '\u2026' + p.currentFile.slice(p.currentFile.length - 59)\n : p.currentFile;\n process.stdout.write(` ${_v}parse${_r} ${_d}[${_num(p.current)}/${_num(p.total)}]${_r} ${short}\\n`);\n }\n\n } else if (p.phase === 'resolving') {\n if (p.current === 0 && p.total <= 1) {\n process.stdout.write(` ${_v}resolving${_r} cross-file references\u2026\\n`);\n } else if (p.total > 0 && p.current === p.total) {\n process.stdout.write(` ${_v}\u2713 resolving${_r} ${_v}${_num(p.current)}${_r}${_d}/${_num(p.total)} refs${_r}\\n`);\n }\n\n } else if (p.phase === 'embeddings') {\n if (p.current === -1) {\n process.stdout.write(`\\n \\x1b[33m\u26A0 Large codebase: ${_num(p.total)} embeddable symbols detected.\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m Embedding may be slow or memory-intensive. Consider setting enableEmbeddings: false\\x1b[0m\\n`);\n process.stdout.write(` \\x1b[33m for codebases this large, or use a lighter model (e.g. Xenova/all-MiniLM-L6-v2).\\x1b[0m\\n\\n`);\n } else {\n const pct = p.total > 0 ? Math.round((p.current / p.total) * 100) : 0;\n process.stdout.write(`\\r ${_v}embeddings${_r} [${_bar(pct)}] ${_v}${pct}%${_r}${' '.repeat(10)}`);\n if (p.current === p.total && p.total > 0) process.stdout.write('\\n');\n }\n\n } else if (p.phase === 'architecture') {\n if (p.meta?.msg) {\n process.stdout.write(` ${_v}architecture${_r} ${_d}${p.meta.msg}${_r}\\n`);\n } else if (p.current === p.total && p.total > 0) {\n process.stdout.write(` ${_v}\u2713 architecture${_r}\\n`);\n }\n\n } else if (p.phase === 'docs') {\n if (p.meta?.msg) {\n process.stdout.write(` ${_v}docs${_r} ${_d}${p.meta.msg}${_r}\\n`);\n }\n\n } else if (p.phase === 'data') {\n if (p.meta?.msg) {\n process.stdout.write(` ${_v}data${_r} ${_d}${p.meta.msg}${_r}\\n`);\n }\n\n } else {\n process.stdout.write(` ${_v}${p.phase}${_r} ${p.current}/${p.total}\\n`);\n }\n}\n\n/**\n * Renders the final sync summary with before/after counts.\n */\nexport function renderSyncSummary(result: SyncResult): void {\n const secs = (result.duration / 1000).toFixed(1);\n const filesChanged = result.added.length + result.modified.length;\n const filesDeleted = result.removed.length;\n\n console.log(`\\n ${_g}\u2713${_r} sync complete ${_d}(${secs}s)${_r}`);\n console.log(` ${_d}files scanned:${_r} ${_v}${_num(result.filesScanned)}${_r}`);\n console.log(` ${_d}files changed:${_r} ${_v}${_num(filesChanged)}${_r}`);\n console.log(` ${_d}files deleted:${_r} ${_v}${_num(filesDeleted)}${_r}`);\n console.log(` ${_d}nodes added:${_r} ${_v}${_num(result.nodesCreated)}${_r}`);\n console.log(` ${_d}nodes updated:${_r} ${_v}${_num(result.nodesUpdated)}${_r}`);\n console.log(` ${_d}nodes removed:${_r} ${_v}${_num(result.nodesRemoved)}${_r}`);\n console.log(` ${_d}edges added:${_r} ${_v}${_num(result.edgesCreated)}${_r}`);\n console.log(` ${_d}edges removed:${_r} ${_v}${_num(result.edgesRemoved)}${_r}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,KAAK;AAEX,SAAS,KAAK,KAAa,QAAQ,IAAY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,OAAO,MAAM,SAAS,OAAO,SAAS;AAC3D,QAAM,eAAe,OAAO,QAAQ;AAEpC,UAAQ,IAAI;AAAA,IAAO,EAAE,SAAI,EAAE,kBAAkB,EAAE,IAAI,IAAI,KAAK,EAAE,EAAE;AAChE,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AAClF,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE;AAC3E,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE;AAC3E,UAAQ,IAAI,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AAClF,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AAClF,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AAClF,UAAQ,IAAI,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AAClF,UAAQ,IAAI,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE;AACpF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -115,6 +115,31 @@ function estimateNaiveCost(toolName, outputTokens, args) {
|
|
|
115
115
|
case "kirograph_docs_refs": {
|
|
116
116
|
return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;
|
|
117
117
|
}
|
|
118
|
+
// ── Data tools ────────────────────────────────────────────────────────────
|
|
119
|
+
case "kirograph_data_list": {
|
|
120
|
+
return AVG_FIND_TOKENS + AVG_FILE_TOKENS;
|
|
121
|
+
}
|
|
122
|
+
case "kirograph_data_describe": {
|
|
123
|
+
return AVG_FILE_TOKENS * 30;
|
|
124
|
+
}
|
|
125
|
+
case "kirograph_data_query": {
|
|
126
|
+
return AVG_FILE_TOKENS * 30;
|
|
127
|
+
}
|
|
128
|
+
case "kirograph_data_aggregate": {
|
|
129
|
+
return AVG_FILE_TOKENS * 35;
|
|
130
|
+
}
|
|
131
|
+
case "kirograph_data_search": {
|
|
132
|
+
return AVG_GREP_TOKENS * 2 + AVG_FILE_TOKENS * 5;
|
|
133
|
+
}
|
|
134
|
+
case "kirograph_data_join": {
|
|
135
|
+
return AVG_FILE_TOKENS * 60;
|
|
136
|
+
}
|
|
137
|
+
case "kirograph_data_correlations": {
|
|
138
|
+
return AVG_FILE_TOKENS * 40;
|
|
139
|
+
}
|
|
140
|
+
case "kirograph_data_quality": {
|
|
141
|
+
return AVG_FILE_TOKENS * 20;
|
|
142
|
+
}
|
|
118
143
|
// kirograph_exec and kirograph_gain are tracked separately
|
|
119
144
|
default:
|
|
120
145
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/compression/naive-cost.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Naive cost estimator for KiroGraph MCP tools.\n *\n * Estimates how many tokens the agent would have consumed doing the same\n * work without KiroGraph (reading files, running grep, etc.).\n *\n * These are conservative estimates based on typical agent behavior:\n * - kirograph_context: agent would read 5-10 files fully to orient\n * - kirograph_search: agent would run grep/ripgrep across the project\n * - kirograph_callers/callees: agent would grep for the symbol name + read each file\n * - kirograph_impact: agent would trace callers recursively (multiple grep + read cycles)\n * - kirograph_node: agent would read the full file containing the symbol\n * - kirograph_files: agent would run find/ls -R\n * - kirograph_status: agent would check file counts, run wc, etc.\n * - kirograph_hotspots/surprising/dead_code: not feasible manually (infinite cost \u2192 cap at 5x)\n */\n\nimport { estimateTokens } from './index';\n\n/** Average tokens per file read (medium-sized source file ~200 lines) */\nconst AVG_FILE_TOKENS = 1500;\n\n/** Average tokens for a grep result across a medium project */\nconst AVG_GREP_TOKENS = 800;\n\n/** Average tokens for ls -R or find output on a medium project */\nconst AVG_FIND_TOKENS = 2000;\n\n/**\n * Estimate the naive token cost (what the agent would have spent without KiroGraph).\n *\n * @param toolName - The MCP tool that was called\n * @param outputTokens - Actual tokens in the tool's response\n * @param args - The tool arguments (for context-aware estimation)\n * @returns Estimated naive cost in tokens, or null if not estimable\n */\nexport function estimateNaiveCost(toolName: string, outputTokens: number, args?: Record<string, unknown>): number | null {\n switch (toolName) {\n case 'kirograph_context': {\n // Agent would read ~5-10 files to understand a task area\n const maxNodes = (args?.maxNodes as number) || 20;\n const filesEstimate = Math.min(Math.ceil(maxNodes / 2), 10);\n return filesEstimate * AVG_FILE_TOKENS;\n }\n\n case 'kirograph_search': {\n // Agent would run grep/ripgrep and read through results\n const limit = (args?.limit as number) || 10;\n // grep output + reading top matches\n return AVG_GREP_TOKENS + Math.min(limit, 5) * (AVG_FILE_TOKENS / 3);\n }\n\n case 'kirograph_callers': {\n // Agent would grep for the symbol, then read each calling file\n const limit = (args?.limit as number) || 20;\n const callersEstimate = Math.min(limit, 10);\n return AVG_GREP_TOKENS + callersEstimate * (AVG_FILE_TOKENS / 2);\n }\n\n case 'kirograph_callees': {\n // Agent would read the function body + grep for each called symbol\n return AVG_FILE_TOKENS + AVG_GREP_TOKENS * 3;\n }\n\n case 'kirograph_impact': {\n // Agent would need multiple rounds of grep + read (recursive)\n const depth = (args?.depth as number) || 2;\n return (AVG_GREP_TOKENS + AVG_FILE_TOKENS * 3) * depth;\n }\n\n case 'kirograph_node': {\n // Agent would read the full file to find the symbol\n return AVG_FILE_TOKENS;\n }\n\n case 'kirograph_files': {\n // Agent would run find or ls -R\n return AVG_FIND_TOKENS;\n }\n\n case 'kirograph_status': {\n // Agent would run multiple commands (wc -l, find, du, etc.)\n return 500;\n }\n\n case 'kirograph_path': {\n // Agent would need to manually trace connections \u2014 multiple grep + read cycles\n return AVG_GREP_TOKENS * 4 + AVG_FILE_TOKENS * 3;\n }\n\n case 'kirograph_type_hierarchy': {\n // Agent would grep for extends/implements, read each file\n return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_dead_code': {\n // Not feasible manually \u2014 would require reading every file and cross-referencing\n // Cap at 5x the output (conservative)\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_circular_deps': {\n // Not feasible manually \u2014 would require building a full import graph\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 8);\n }\n\n case 'kirograph_hotspots': {\n // Not feasible manually \u2014 would require counting edges for every symbol\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_surprising': {\n // Not feasible manually\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_architecture':\n case 'kirograph_coupling':\n case 'kirograph_package': {\n // Architecture analysis is not feasible manually\n return Math.max(outputTokens * 4, AVG_FILE_TOKENS * 5);\n }\n\n case 'kirograph_diff': {\n // Agent would need to compare file lists and grep for symbols\n return Math.max(outputTokens * 3, AVG_FILE_TOKENS * 5);\n }\n\n case 'kirograph_mem_search': {\n // Without memory, agent would re-read files to rediscover past decisions.\n // Typically 3-5 files + grep for related context.\n const limit = (args?.limit as number) || 10;\n const filesEstimate = Math.min(Math.ceil(limit / 2), 5);\n return filesEstimate * AVG_FILE_TOKENS + AVG_GREP_TOKENS;\n }\n\n case 'kirograph_mem_store': {\n // Storing has no direct naive equivalent \u2014 the knowledge would simply be lost.\n // We don't count savings on store; savings are realized on future searches.\n return null;\n }\n\n case 'kirograph_mem_timeline': {\n // Agent would ask user or re-read previous session context.\n return AVG_FILE_TOKENS + AVG_GREP_TOKENS;\n }\n\n case 'kirograph_mem_status': {\n // Lightweight status check, minimal naive cost.\n return 500;\n }\n\n // \u2500\u2500 Docs tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 case 'kirograph_docs_toc': {\n // Agent would read all doc files to understand structure.\n // Conservative: 3-5 doc files fully read.\n return AVG_FILE_TOKENS * 4 + AVG_FILE_TOKENS; // docs are ~2500 tokens avg\n }\n\n case 'kirograph_docs_search': {\n // Agent would grep across all doc files + read top matches.\n const limit = (args?.limit as number) || 10;\n const filesEstimate = Math.min(Math.ceil(limit / 2), 5);\n return AVG_GREP_TOKENS + filesEstimate * AVG_FILE_TOKENS;\n }\n\n case 'kirograph_docs_section': {\n // Agent would read the full file to find the relevant section.\n // With context=true, agent would also read parent/child files.\n const withContext = args?.context as boolean;\n return withContext ? AVG_FILE_TOKENS * 3 : AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_docs_outline': {\n // Agent would read the full file to understand its structure.\n return AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_docs_refs': {\n // Agent would grep for symbol names across docs + read code files.\n return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;\n }\n\n // kirograph_exec and kirograph_gain are tracked separately\n default:\n return null;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAUjB,SAAS,kBAAkB,UAAkB,cAAsB,MAA+C;AACvH,UAAQ,UAAU;AAAA,IAChB,KAAK,qBAAqB;AAExB,YAAM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AAA,IACxD;AAAA,IAEA,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,qBAAqB;AAExB,aAAO,KAAK,IAAI,eAAe,GAAG,kBAAkB,CAAC;AAAA,IACvD;AAAA,IAEA,KAAK,kBAAkB;AAErB,aAAO,KAAK,IAAI,eAAe,GAAG,kBAAkB,CAAC;AAAA,IACvD;AAAA,IAEA,KAAK,wBAAwB;AAG3B,YAAM,QAAS,MAAM,SAAoB;AACzC,YAAM,gBAAgB,KAAK,IAAI,KAAK,KAAK,QAAQ,CAAC,GAAG,CAAC;AACtD,aAAO,gBAAgB,kBAAkB;AAAA,IAC3C;AAAA,IAEA,KAAK,uBAAuB;AAG1B,aAAO;AAAA,IACT;AAAA,IAEA,KAAK,0BAA0B;AAE7B,aAAO,kBAAkB;AAAA,IAC3B;AAAA,IAEA,KAAK,wBAAwB;AAE3B,aAAO;AAAA,IACT;AAAA;AAAA,IAIA,KAAK,sBAAsB;AAGzB,aAAO,kBAAkB,IAAI;AAAA,IAC/B;AAAA,IAEA,KAAK,yBAAyB;AAE5B,YAAM,QAAS,MAAM,SAAoB;AACzC,YAAM,gBAAgB,KAAK,IAAI,KAAK,KAAK,QAAQ,CAAC,GAAG,CAAC;AACtD,aAAO,kBAAkB,gBAAgB;AAAA,IAC3C;AAAA,IAEA,KAAK,0BAA0B;AAG7B,YAAM,cAAc,MAAM;AAC1B,aAAO,cAAc,kBAAkB,IAAI,kBAAkB;AAAA,IAC/D;AAAA,IAEA,KAAK,0BAA0B;AAE7B,aAAO,kBAAkB;AAAA,IAC3B;AAAA,IAEA,KAAK,uBAAuB;AAE1B,aAAO,kBAAkB,IAAI,kBAAkB;AAAA,IACjD;AAAA;AAAA,IAGA;AACE,aAAO;AAAA,EACX;AACF;",
|
|
4
|
+
"sourcesContent": ["/**\n * Naive cost estimator for KiroGraph MCP tools.\n *\n * Estimates how many tokens the agent would have consumed doing the same\n * work without KiroGraph (reading files, running grep, etc.).\n *\n * These are conservative estimates based on typical agent behavior:\n * - kirograph_context: agent would read 5-10 files fully to orient\n * - kirograph_search: agent would run grep/ripgrep across the project\n * - kirograph_callers/callees: agent would grep for the symbol name + read each file\n * - kirograph_impact: agent would trace callers recursively (multiple grep + read cycles)\n * - kirograph_node: agent would read the full file containing the symbol\n * - kirograph_files: agent would run find/ls -R\n * - kirograph_status: agent would check file counts, run wc, etc.\n * - kirograph_hotspots/surprising/dead_code: not feasible manually (infinite cost \u2192 cap at 5x)\n */\n\nimport { estimateTokens } from './index';\n\n/** Average tokens per file read (medium-sized source file ~200 lines) */\nconst AVG_FILE_TOKENS = 1500;\n\n/** Average tokens for a grep result across a medium project */\nconst AVG_GREP_TOKENS = 800;\n\n/** Average tokens for ls -R or find output on a medium project */\nconst AVG_FIND_TOKENS = 2000;\n\n/**\n * Estimate the naive token cost (what the agent would have spent without KiroGraph).\n *\n * @param toolName - The MCP tool that was called\n * @param outputTokens - Actual tokens in the tool's response\n * @param args - The tool arguments (for context-aware estimation)\n * @returns Estimated naive cost in tokens, or null if not estimable\n */\nexport function estimateNaiveCost(toolName: string, outputTokens: number, args?: Record<string, unknown>): number | null {\n switch (toolName) {\n case 'kirograph_context': {\n // Agent would read ~5-10 files to understand a task area\n const maxNodes = (args?.maxNodes as number) || 20;\n const filesEstimate = Math.min(Math.ceil(maxNodes / 2), 10);\n return filesEstimate * AVG_FILE_TOKENS;\n }\n\n case 'kirograph_search': {\n // Agent would run grep/ripgrep and read through results\n const limit = (args?.limit as number) || 10;\n // grep output + reading top matches\n return AVG_GREP_TOKENS + Math.min(limit, 5) * (AVG_FILE_TOKENS / 3);\n }\n\n case 'kirograph_callers': {\n // Agent would grep for the symbol, then read each calling file\n const limit = (args?.limit as number) || 20;\n const callersEstimate = Math.min(limit, 10);\n return AVG_GREP_TOKENS + callersEstimate * (AVG_FILE_TOKENS / 2);\n }\n\n case 'kirograph_callees': {\n // Agent would read the function body + grep for each called symbol\n return AVG_FILE_TOKENS + AVG_GREP_TOKENS * 3;\n }\n\n case 'kirograph_impact': {\n // Agent would need multiple rounds of grep + read (recursive)\n const depth = (args?.depth as number) || 2;\n return (AVG_GREP_TOKENS + AVG_FILE_TOKENS * 3) * depth;\n }\n\n case 'kirograph_node': {\n // Agent would read the full file to find the symbol\n return AVG_FILE_TOKENS;\n }\n\n case 'kirograph_files': {\n // Agent would run find or ls -R\n return AVG_FIND_TOKENS;\n }\n\n case 'kirograph_status': {\n // Agent would run multiple commands (wc -l, find, du, etc.)\n return 500;\n }\n\n case 'kirograph_path': {\n // Agent would need to manually trace connections \u2014 multiple grep + read cycles\n return AVG_GREP_TOKENS * 4 + AVG_FILE_TOKENS * 3;\n }\n\n case 'kirograph_type_hierarchy': {\n // Agent would grep for extends/implements, read each file\n return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_dead_code': {\n // Not feasible manually \u2014 would require reading every file and cross-referencing\n // Cap at 5x the output (conservative)\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_circular_deps': {\n // Not feasible manually \u2014 would require building a full import graph\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 8);\n }\n\n case 'kirograph_hotspots': {\n // Not feasible manually \u2014 would require counting edges for every symbol\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_surprising': {\n // Not feasible manually\n return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);\n }\n\n case 'kirograph_architecture':\n case 'kirograph_coupling':\n case 'kirograph_package': {\n // Architecture analysis is not feasible manually\n return Math.max(outputTokens * 4, AVG_FILE_TOKENS * 5);\n }\n\n case 'kirograph_diff': {\n // Agent would need to compare file lists and grep for symbols\n return Math.max(outputTokens * 3, AVG_FILE_TOKENS * 5);\n }\n\n case 'kirograph_mem_search': {\n // Without memory, agent would re-read files to rediscover past decisions.\n // Typically 3-5 files + grep for related context.\n const limit = (args?.limit as number) || 10;\n const filesEstimate = Math.min(Math.ceil(limit / 2), 5);\n return filesEstimate * AVG_FILE_TOKENS + AVG_GREP_TOKENS;\n }\n\n case 'kirograph_mem_store': {\n // Storing has no direct naive equivalent \u2014 the knowledge would simply be lost.\n // We don't count savings on store; savings are realized on future searches.\n return null;\n }\n\n case 'kirograph_mem_timeline': {\n // Agent would ask user or re-read previous session context.\n return AVG_FILE_TOKENS + AVG_GREP_TOKENS;\n }\n\n case 'kirograph_mem_status': {\n // Lightweight status check, minimal naive cost.\n return 500;\n }\n\n // \u2500\u2500 Docs tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 case 'kirograph_docs_toc': {\n // Agent would read all doc files to understand structure.\n // Conservative: 3-5 doc files fully read.\n return AVG_FILE_TOKENS * 4 + AVG_FILE_TOKENS; // docs are ~2500 tokens avg\n }\n\n case 'kirograph_docs_search': {\n // Agent would grep across all doc files + read top matches.\n const limit = (args?.limit as number) || 10;\n const filesEstimate = Math.min(Math.ceil(limit / 2), 5);\n return AVG_GREP_TOKENS + filesEstimate * AVG_FILE_TOKENS;\n }\n\n case 'kirograph_docs_section': {\n // Agent would read the full file to find the relevant section.\n // With context=true, agent would also read parent/child files.\n const withContext = args?.context as boolean;\n return withContext ? AVG_FILE_TOKENS * 3 : AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_docs_outline': {\n // Agent would read the full file to understand its structure.\n return AVG_FILE_TOKENS * 2;\n }\n\n case 'kirograph_docs_refs': {\n // Agent would grep for symbol names across docs + read code files.\n return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;\n }\n\n // \u2500\u2500 Data tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 case 'kirograph_data_list': {\n // Agent would run ls/find on data files + inspect each\n return AVG_FIND_TOKENS + AVG_FILE_TOKENS;\n }\n\n case 'kirograph_data_describe': {\n // Agent would read the full data file to understand its schema (~30x a code file)\n return AVG_FILE_TOKENS * 30;\n }\n\n case 'kirograph_data_query': {\n // Agent would read the full file and scan for matching rows\n return AVG_FILE_TOKENS * 30;\n }\n\n case 'kirograph_data_aggregate': {\n // Agent would read the full file, then reason about aggregation in context\n return AVG_FILE_TOKENS * 35;\n }\n\n case 'kirograph_data_search': {\n // Agent would read file headers + grep for values\n return AVG_GREP_TOKENS * 2 + AVG_FILE_TOKENS * 5;\n }\n\n case 'kirograph_data_join': {\n // Agent would read both files entirely\n return AVG_FILE_TOKENS * 60;\n }\n\n case 'kirograph_data_correlations': {\n // Not feasible manually \u2014 would require reading all numeric data\n return AVG_FILE_TOKENS * 40;\n }\n\n case 'kirograph_data_quality': {\n // Agent would read the file and manually inspect each column\n return AVG_FILE_TOKENS * 20;\n }\n\n // kirograph_exec and kirograph_gain are tracked separately\n default:\n return null;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAUjB,SAAS,kBAAkB,UAAkB,cAAsB,MAA+C;AACvH,UAAQ,UAAU;AAAA,IAChB,KAAK,qBAAqB;AAExB,YAAM,WAAY,MAAM,YAAuB;AAC/C,YAAM,gBAAgB,KAA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kB;AAAA,IAC3B;AAAA,IAEA,KAAK,yBAAyB;AAE5B,aAAO,kBAAkB,IAAI,kBAAkB;AAAA,IACjD;AAAA,IAEA,KAAK,uBAAuB;AAE1B,aAAO,kBAAkB;AAAA,IAC3B;AAAA,IAEA,KAAK,+BAA+B;AAElC,aAAO,kBAAkB;AAAA,IAC3B;AAAA,IAEA,KAAK,0BAA0B;AAE7B,aAAO,kBAAkB;AAAA,IAC3B;AAAA;AAAA,IAGA;AACE,aAAO;AAAA,EACX;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var tracker_exports = {};
|
|
30
30
|
__export(tracker_exports, {
|
|
31
|
+
BudgetTracker: () => BudgetTracker,
|
|
31
32
|
TokenTracker: () => TokenTracker
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(tracker_exports);
|
|
@@ -105,6 +106,15 @@ class TokenTracker {
|
|
|
105
106
|
recordDocsSaving(toolName, outputTokens, naiveCost) {
|
|
106
107
|
this.record(toolName, naiveCost, outputTokens, `docs:${toolName}`, "docs");
|
|
107
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Record a data tool saving.
|
|
111
|
+
* @param toolName - The MCP tool that was called
|
|
112
|
+
* @param outputTokens - Actual tokens returned by the tool
|
|
113
|
+
* @param naiveCost - Estimated tokens the agent would have used without data indexing
|
|
114
|
+
*/
|
|
115
|
+
recordDataSaving(toolName, outputTokens, naiveCost) {
|
|
116
|
+
this.record(toolName, naiveCost, outputTokens, `data:${toolName}`, "data");
|
|
117
|
+
}
|
|
108
118
|
/**
|
|
109
119
|
* Get aggregated statistics for a time period.
|
|
110
120
|
*/
|
|
@@ -119,13 +129,13 @@ class TokenTracker {
|
|
|
119
129
|
savingsPercent: 0,
|
|
120
130
|
byFamily: {},
|
|
121
131
|
recentCommands: [],
|
|
122
|
-
bySource: { exec: { count: 0, saved: 0 }, graph: { count: 0, saved: 0 }, memory: { count: 0, saved: 0 }, docs: { count: 0, saved: 0 } }
|
|
132
|
+
bySource: { exec: { count: 0, saved: 0 }, graph: { count: 0, saved: 0 }, memory: { count: 0, saved: 0 }, docs: { count: 0, saved: 0 }, data: { count: 0, saved: 0 } }
|
|
123
133
|
};
|
|
124
134
|
}
|
|
125
135
|
let totalOriginal = 0;
|
|
126
136
|
let totalCompressed = 0;
|
|
127
137
|
const byFamily = /* @__PURE__ */ new Map();
|
|
128
|
-
const bySource = { exec: { count: 0, saved: 0 }, graph: { count: 0, saved: 0 }, memory: { count: 0, saved: 0 }, docs: { count: 0, saved: 0 } };
|
|
138
|
+
const bySource = { exec: { count: 0, saved: 0 }, graph: { count: 0, saved: 0 }, memory: { count: 0, saved: 0 }, docs: { count: 0, saved: 0 }, data: { count: 0, saved: 0 } };
|
|
129
139
|
for (const r of records) {
|
|
130
140
|
totalOriginal += r.originalTokens;
|
|
131
141
|
totalCompressed += r.compressedTokens;
|
|
@@ -244,8 +254,87 @@ class TokenTracker {
|
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
256
|
}
|
|
257
|
+
const DEFAULT_BUDGET = {
|
|
258
|
+
maxTokensPerSession: 1e5,
|
|
259
|
+
warnAt: 8e4,
|
|
260
|
+
throttleAt: 95e3
|
|
261
|
+
};
|
|
262
|
+
class BudgetTracker {
|
|
263
|
+
constructor(projectRoot, config) {
|
|
264
|
+
this.consumed = 0;
|
|
265
|
+
this.projectRoot = projectRoot;
|
|
266
|
+
this.config = { ...DEFAULT_BUDGET, ...config };
|
|
267
|
+
}
|
|
268
|
+
static {
|
|
269
|
+
this.instances = /* @__PURE__ */ new Map();
|
|
270
|
+
}
|
|
271
|
+
static getInstance(projectRoot, config) {
|
|
272
|
+
const key = projectRoot;
|
|
273
|
+
if (!BudgetTracker.instances.has(key)) {
|
|
274
|
+
BudgetTracker.instances.set(key, new BudgetTracker(projectRoot, config));
|
|
275
|
+
}
|
|
276
|
+
const instance = BudgetTracker.instances.get(key);
|
|
277
|
+
if (config) {
|
|
278
|
+
instance.config = { ...DEFAULT_BUDGET, ...config };
|
|
279
|
+
}
|
|
280
|
+
return instance;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Record tokens consumed by a tool response.
|
|
284
|
+
*/
|
|
285
|
+
recordConsumption(tokens) {
|
|
286
|
+
this.consumed += tokens;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get current budget status.
|
|
290
|
+
*/
|
|
291
|
+
getStatus() {
|
|
292
|
+
const limit = this.config.maxTokensPerSession;
|
|
293
|
+
const remaining = Math.max(0, limit - this.consumed);
|
|
294
|
+
const utilization = limit > 0 ? Math.round(this.consumed / limit * 100) : 0;
|
|
295
|
+
let warning = null;
|
|
296
|
+
if (limit > 0 && this.consumed >= this.config.throttleAt) {
|
|
297
|
+
warning = `Budget nearly exhausted (${utilization}%). Responses will be truncated.`;
|
|
298
|
+
} else if (limit > 0 && this.consumed >= this.config.warnAt) {
|
|
299
|
+
warning = `Approaching budget limit (${utilization}%). Consider using compact read modes.`;
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
consumed: this.consumed,
|
|
303
|
+
limit,
|
|
304
|
+
remaining,
|
|
305
|
+
utilization,
|
|
306
|
+
warning,
|
|
307
|
+
throttled: limit > 0 && this.consumed >= this.config.throttleAt
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Check if the budget is throttled (responses should be truncated).
|
|
312
|
+
*/
|
|
313
|
+
isThrottled() {
|
|
314
|
+
return this.config.maxTokensPerSession > 0 && this.consumed >= this.config.throttleAt;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Check if a warning should be appended to responses.
|
|
318
|
+
*/
|
|
319
|
+
shouldWarn() {
|
|
320
|
+
return this.config.maxTokensPerSession > 0 && this.consumed >= this.config.warnAt;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Reset the budget counters.
|
|
324
|
+
*/
|
|
325
|
+
reset() {
|
|
326
|
+
this.consumed = 0;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Update budget configuration.
|
|
330
|
+
*/
|
|
331
|
+
updateConfig(config) {
|
|
332
|
+
this.config = { ...this.config, ...config };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
247
335
|
// Annotate the CommonJS export names for ESM import in node:
|
|
248
336
|
0 && (module.exports = {
|
|
337
|
+
BudgetTracker,
|
|
249
338
|
TokenTracker
|
|
250
339
|
});
|
|
251
340
|
//# sourceMappingURL=tracker.js.map
|