kirograph 0.27.2 → 0.28.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.
Files changed (155) hide show
  1. package/README.md +14 -7
  2. package/dist/bin/commands/annotations.js +56 -0
  3. package/dist/bin/commands/annotations.js.map +7 -0
  4. package/dist/bin/commands/ast-rewrite.js +55 -0
  5. package/dist/bin/commands/ast-rewrite.js.map +7 -0
  6. package/dist/bin/commands/bench.js +103 -0
  7. package/dist/bin/commands/bench.js.map +7 -0
  8. package/dist/bin/commands/branch.js +133 -0
  9. package/dist/bin/commands/branch.js.map +7 -0
  10. package/dist/bin/commands/changelog.js +55 -0
  11. package/dist/bin/commands/changelog.js.map +7 -0
  12. package/dist/bin/commands/commit-context.js +55 -0
  13. package/dist/bin/commands/commit-context.js.map +7 -0
  14. package/dist/bin/commands/complexity.js +60 -0
  15. package/dist/bin/commands/complexity.js.map +7 -0
  16. package/dist/bin/commands/cost.js +146 -0
  17. package/dist/bin/commands/cost.js.map +7 -0
  18. package/dist/bin/commands/dependency-depth.js +55 -0
  19. package/dist/bin/commands/dependency-depth.js.map +7 -0
  20. package/dist/bin/commands/diff-context.js +55 -0
  21. package/dist/bin/commands/diff-context.js.map +7 -0
  22. package/dist/bin/commands/distribution.js +56 -0
  23. package/dist/bin/commands/distribution.js.map +7 -0
  24. package/dist/bin/commands/doc-coverage.js +56 -0
  25. package/dist/bin/commands/doc-coverage.js.map +7 -0
  26. package/dist/bin/commands/doctor.js +202 -0
  27. package/dist/bin/commands/doctor.js.map +7 -0
  28. package/dist/bin/commands/dsm.js +56 -0
  29. package/dist/bin/commands/dsm.js.map +7 -0
  30. package/dist/bin/commands/gini.js +55 -0
  31. package/dist/bin/commands/gini.js.map +7 -0
  32. package/dist/bin/commands/god-class.js +56 -0
  33. package/dist/bin/commands/god-class.js.map +7 -0
  34. package/dist/bin/commands/health.js +55 -0
  35. package/dist/bin/commands/health.js.map +7 -0
  36. package/dist/bin/commands/help.js +224 -45
  37. package/dist/bin/commands/help.js.map +2 -2
  38. package/dist/bin/commands/inheritance-depth.js +56 -0
  39. package/dist/bin/commands/inheritance-depth.js.map +7 -0
  40. package/dist/bin/commands/insert-at.js +55 -0
  41. package/dist/bin/commands/insert-at.js.map +7 -0
  42. package/dist/bin/commands/largest.js +56 -0
  43. package/dist/bin/commands/largest.js.map +7 -0
  44. package/dist/bin/commands/manifest.js +158 -0
  45. package/dist/bin/commands/manifest.js.map +7 -0
  46. package/dist/bin/commands/module-api.js +57 -0
  47. package/dist/bin/commands/module-api.js.map +7 -0
  48. package/dist/bin/commands/monitor.js +91 -0
  49. package/dist/bin/commands/monitor.js.map +7 -0
  50. package/dist/bin/commands/multi-replace.js +66 -0
  51. package/dist/bin/commands/multi-replace.js.map +7 -0
  52. package/dist/bin/commands/pr-context.js +55 -0
  53. package/dist/bin/commands/pr-context.js.map +7 -0
  54. package/dist/bin/commands/query.js +19 -1
  55. package/dist/bin/commands/query.js.map +3 -3
  56. package/dist/bin/commands/rank.js +56 -0
  57. package/dist/bin/commands/rank.js.map +7 -0
  58. package/dist/bin/commands/read.js +1 -1
  59. package/dist/bin/commands/read.js.map +2 -2
  60. package/dist/bin/commands/recursion.js +56 -0
  61. package/dist/bin/commands/recursion.js.map +7 -0
  62. package/dist/bin/commands/rename-preview.js +56 -0
  63. package/dist/bin/commands/rename-preview.js.map +7 -0
  64. package/dist/bin/commands/session.js +60 -0
  65. package/dist/bin/commands/session.js.map +7 -0
  66. package/dist/bin/commands/simplify-scan.js +56 -0
  67. package/dist/bin/commands/simplify-scan.js.map +7 -0
  68. package/dist/bin/commands/str-replace.js +55 -0
  69. package/dist/bin/commands/str-replace.js.map +7 -0
  70. package/dist/bin/commands/test-coverage.js +59 -0
  71. package/dist/bin/commands/test-coverage.js.map +7 -0
  72. package/dist/bin/commands/test-map.js +56 -0
  73. package/dist/bin/commands/test-map.js.map +7 -0
  74. package/dist/bin/commands/test-risk.js +59 -0
  75. package/dist/bin/commands/test-risk.js.map +7 -0
  76. package/dist/bin/commands/unused-imports.js +55 -0
  77. package/dist/bin/commands/unused-imports.js.map +7 -0
  78. package/dist/bin/commands/upgrade.js +78 -0
  79. package/dist/bin/commands/upgrade.js.map +7 -0
  80. package/dist/bin/installer/common.js +5 -1
  81. package/dist/bin/installer/common.js.map +2 -2
  82. package/dist/bin/installer/config-prompt.js +140 -11
  83. package/dist/bin/installer/config-prompt.js.map +3 -3
  84. package/dist/bin/installer/index.js +38 -6
  85. package/dist/bin/installer/index.js.map +2 -2
  86. package/dist/bin/installer/instructions.js +7 -11
  87. package/dist/bin/installer/instructions.js.map +2 -2
  88. package/dist/bin/installer/mcp.js.map +2 -2
  89. package/dist/bin/installer/steering.js +531 -100
  90. package/dist/bin/installer/steering.js.map +2 -2
  91. package/dist/bin/installer/targets/kiro.js +7 -3
  92. package/dist/bin/installer/targets/kiro.js.map +2 -2
  93. package/dist/bin/kirograph.js +73 -1
  94. package/dist/bin/kirograph.js.map +3 -3
  95. package/dist/config.js +26 -8
  96. package/dist/config.js.map +2 -2
  97. package/dist/core/branch-manager.js +111 -0
  98. package/dist/core/branch-manager.js.map +7 -0
  99. package/dist/core/pipeline.js +3 -3
  100. package/dist/core/pipeline.js.map +2 -2
  101. package/dist/data/pixelrag-bridge.js +93 -0
  102. package/dist/data/pixelrag-bridge.js.map +7 -0
  103. package/dist/data/pixelrag-manager.js +416 -0
  104. package/dist/data/pixelrag-manager.js.map +7 -0
  105. package/dist/db/database.js +34 -7
  106. package/dist/db/database.js.map +2 -2
  107. package/dist/db/schema.sql +7 -1
  108. package/dist/extraction/complexity.js +116 -0
  109. package/dist/extraction/complexity.js.map +7 -0
  110. package/dist/extraction/extractor.js +52 -1
  111. package/dist/extraction/extractor.js.map +2 -2
  112. package/dist/graph/git-context.js +229 -0
  113. package/dist/graph/git-context.js.map +7 -0
  114. package/dist/index.js +4 -2
  115. package/dist/index.js.map +2 -2
  116. package/dist/mcp/handler.js +446 -0
  117. package/dist/mcp/handler.js.map +7 -0
  118. package/dist/mcp/handlers/architecture.js +297 -0
  119. package/dist/mcp/handlers/architecture.js.map +7 -0
  120. package/dist/mcp/handlers/branch.js +175 -0
  121. package/dist/mcp/handlers/branch.js.map +7 -0
  122. package/dist/mcp/handlers/code-health.js +563 -0
  123. package/dist/mcp/handlers/code-health.js.map +7 -0
  124. package/dist/mcp/handlers/complexity.js +267 -0
  125. package/dist/mcp/handlers/complexity.js.map +7 -0
  126. package/dist/mcp/handlers/core.js +611 -0
  127. package/dist/mcp/handlers/core.js.map +7 -0
  128. package/dist/mcp/handlers/data.js +337 -0
  129. package/dist/mcp/handlers/data.js.map +7 -0
  130. package/dist/mcp/handlers/docs.js +159 -0
  131. package/dist/mcp/handlers/docs.js.map +7 -0
  132. package/dist/mcp/handlers/edit-primitives.js +200 -0
  133. package/dist/mcp/handlers/edit-primitives.js.map +7 -0
  134. package/dist/mcp/handlers/git-context.js +286 -0
  135. package/dist/mcp/handlers/git-context.js.map +7 -0
  136. package/dist/mcp/handlers/memory.js +363 -0
  137. package/dist/mcp/handlers/memory.js.map +7 -0
  138. package/dist/mcp/handlers/patterns.js +310 -0
  139. package/dist/mcp/handlers/patterns.js.map +7 -0
  140. package/dist/mcp/handlers/security.js +699 -0
  141. package/dist/mcp/handlers/security.js.map +7 -0
  142. package/dist/mcp/handlers/utils.js +97 -0
  143. package/dist/mcp/handlers/utils.js.map +7 -0
  144. package/dist/mcp/handlers/watchmen.js +104 -0
  145. package/dist/mcp/handlers/watchmen.js.map +7 -0
  146. package/dist/mcp/handlers/wiki.js +242 -0
  147. package/dist/mcp/handlers/wiki.js.map +7 -0
  148. package/dist/mcp/server.js +72 -3
  149. package/dist/mcp/server.js.map +2 -2
  150. package/dist/mcp/tool-names.js +94 -7
  151. package/dist/mcp/tool-names.js.map +2 -2
  152. package/dist/mcp/tools.js +445 -3210
  153. package/dist/mcp/tools.js.map +3 -3
  154. package/dist/types.js.map +2 -2
  155. package/package.json +36 -10
package/README.md CHANGED
@@ -59,25 +59,30 @@ The result is fewer tool calls, less context used, and faster responses on compl
59
59
 
60
60
  ## MCP Tool List Token Budget
61
61
 
62
- Each enabled flag adds tools to the model context on every MCP call. Total with all flags: **92 tools · ~4,367 tok**.
62
+ Each enabled flag adds tools to the model context on every MCP call. Total with all flags: **126 tools · ~6,240 tok**.
63
63
 
64
64
  | Flag | Tools | ~Tokens |
65
65
  |------|------:|--------:|
66
- | core (always-on) | 8 | ~472 |
66
+ | core (always-on) | 3 | ~170 |
67
+ | `enableNavigation` | 3 | ~120 |
67
68
  | `enableMemory` | 16 | ~746 |
68
69
  | `enableSecurity` | 15 | ~675 |
69
70
  | `enableData` | 10 | ~519 |
70
71
  | `enableWiki` | 10 | ~319 |
71
- | `enableCodeHealth` | 7 | ~309 |
72
+ | `enableCodeHealth` | 25 | ~935 |
73
+ | `enableDocs` | 5 | ~241 |
72
74
  | `enableAgentUtils` | 4 | ~278 |
73
- | `enableAdvancedAnalysis` | 4 | ~210 |
74
- | `enableArchitecture` | 3 | ~142 |
75
+ | `enableArchitecture` | 5 | ~205 |
75
76
  | `enableWatchmen` | 3 | ~140 |
76
77
  | `enablePatterns` | 3 | ~93 |
77
78
  | `trackCallSites` | 2 | ~84 |
79
+ | `enableGitContext` | 7 | ~410 |
80
+ | `enableComplexity` | 5 | ~660 |
81
+ | `enableEditPrimitives` | 5 | ~280 |
82
+ | `enableBranch` | 3 | ~300 |
78
83
  | `enableShellExec` | 1 | ~71 |
79
84
  | `enableGeneralCompression` | 1 | ~68 |
80
- | **Total** | **92** | **~4,367** |
85
+ | **Total** | **126** | **~6,240** |
81
86
 
82
87
  ## Quick Start
83
88
 
@@ -180,6 +185,7 @@ KiroGraph is inspired by [CodeGraph](https://github.com/colbymchenry/codegraph)
180
185
  - [turboquant-js](https://github.com/danilodevhub/turboquant-js) by [Danilo Dev](https://github.com/danilodevhub): the TurboQuant engine — TypeScript implementation of Google's Walsh-Hadamard + Lloyd-Max quantization algorithm used for embedding compression.
181
186
  - [turbovec](https://github.com/RyanCodrai/turbovec) by [Ryan Codrai](https://github.com/RyanCodrai): the TurboVec engine — Rust implementation of TurboQuant with SIMD acceleration, exposed to Node.js via a napi-rs native addon.
182
187
  - [pdf-inspector](https://github.com/firecrawl/pdf-inspector) by [Firecrawl](https://github.com/firecrawl): the PDF parser used in the data module — pure Rust, no OCR, no network, prebuilt binaries for linux-x64 and macOS ARM64.
188
+ - [tokensave](https://tokensave.dev): gap-close roadmap inspiration — code quality tools (complexity, god class, recursion, doc coverage), git workflow context tools (diff_context, commit_context, test_map), atomic edit primitives, multi-branch indexing, per-call token metrics, and MCP protocol annotations (`readOnlyHint`, `alwaysLoad`).
183
189
 
184
190
  ### Contributors
185
191
 
@@ -206,8 +212,9 @@ KiroGraph combines capabilities from 14 separate projects into one integrated MC
206
212
  | Embedding compression | [turboquant-js](https://github.com/danilodevhub/turboquant-js) | 9 engine options, SIMD Rust variant, 20–30× RAM savings |
207
213
  | SIMD vector search | [turbovec](https://github.com/RyanCodrai/turbovec) | NEON on ARM64, AVX-512BW on x86, auto-built by installer |
208
214
  | Context layer | [lean-ctx](https://github.com/yvgude/lean-ctx) | File caching, read modes, budget governance |
215
+ | Gap-close roadmap | [tokensave](https://tokensave.dev) | Code quality metrics, git context tools, atomic edit primitives, multi-branch indexing |
209
216
 
210
- See the [full comparison](docs/guide/comparison.md) for a detailed feature matrix against CodeGraph, code-review-graph, jCodeMunch, and others.
217
+ See the [full comparison](docs/guide/comparison.md) for a detailed feature matrix against CodeGraph, code-review-graph, jCodeMunch, tokensave, and others.
211
218
 
212
219
  ## Star History
213
220
 
@@ -0,0 +1,56 @@
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 annotations_exports = {};
30
+ __export(annotations_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(annotations_exports);
34
+ var path = __toESM(require("path"));
35
+ async function runTool(target, toolName, args) {
36
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
37
+ const { ToolHandler } = await Promise.resolve().then(() => require("../../mcp/handler.js"));
38
+ const cg = await KiroGraph.open(target);
39
+ const handler = new ToolHandler(cg);
40
+ const result = await handler.handle(toolName, { ...args, projectPath: target });
41
+ cg.close();
42
+ const text = result.content.map((c) => c.text).join("");
43
+ console.log(text);
44
+ }
45
+ function register(program) {
46
+ program.command("annotations [projectPath]").description("Decorator/attribute histogram across the codebase").option("--decorator <name>", "Filter by decorator name").option("--limit <n>", "Max results", "20").action(async (projectPath, opts) => {
47
+ const target = path.resolve(projectPath ?? process.cwd());
48
+ const limit = parseInt(opts.limit) || 20;
49
+ await runTool(target, "kirograph_annotations", { decorator: opts.decorator, limit });
50
+ });
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ register
55
+ });
56
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/annotations.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nasync function runTool(target: string, toolName: string, args: Record<string, unknown>): Promise<void> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { ToolHandler } = (await Promise.resolve().then(() => require('../../mcp/handler.js'))) as any;\n const cg = await KiroGraph.open(target);\n const handler = new ToolHandler(cg);\n const result = await handler.handle(toolName, { ...args, projectPath: target });\n cg.close();\n const text: string = result.content.map((c: any) => c.text).join('');\n console.log(text);\n}\n\nexport function register(program: Command): void {\n program\n .command('annotations [projectPath]')\n .description('Decorator/attribute histogram across the codebase')\n .option('--decorator <name>', 'Filter by decorator name')\n .option('--limit <n>', 'Max results', '20')\n .action(async (projectPath: string | undefined, opts: { decorator?: string; limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 20;\n await runTool(target, 'kirograph_annotations', { decorator: opts.decorator, limit });\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAItB,eAAe,QAAQ,QAAgB,UAAkB,MAA8C;AACrG,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,EAAE,YAAY,IAAK,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,sBAAsB,CAAC;AAC3F,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,QAAM,UAAU,IAAI,YAAY,EAAE;AAClC,QAAM,SAAS,MAAM,QAAQ,OAAO,UAAU,EAAE,GAAG,MAAM,aAAa,OAAO,CAAC;AAC9E,KAAG,MAAM;AACT,QAAM,OAAe,OAAO,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK,EAAE;AACnE,UAAQ,IAAI,IAAI;AAClB;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,2BAA2B,EACnC,YAAY,mDAAmD,EAC/D,OAAO,sBAAsB,0BAA0B,EACvD,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,OAAO,aAAiC,SAAgD;AAC9F,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,yBAAyB,EAAE,WAAW,KAAK,WAAW,MAAM,CAAC;AAAA,EACrF,CAAC;AACL;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
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 ast_rewrite_exports = {};
30
+ __export(ast_rewrite_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(ast_rewrite_exports);
34
+ var path = __toESM(require("path"));
35
+ async function runTool(target, toolName, args) {
36
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
37
+ const { ToolHandler } = await Promise.resolve().then(() => require("../../mcp/handler.js"));
38
+ const cg = await KiroGraph.open(target);
39
+ const handler = new ToolHandler(cg);
40
+ const result = await handler.handle(toolName, { ...args, projectPath: target });
41
+ cg.close();
42
+ const text = result.content.map((c) => c.text).join("");
43
+ console.log(text);
44
+ }
45
+ function register(program) {
46
+ program.command("ast-rewrite <file> <pattern> <rewrite> [projectPath]").description("Structural rewrite via ast-grep (requires ast-grep on PATH)").action(async (file, pattern, rewrite, projectPath) => {
47
+ const target = path.resolve(projectPath ?? process.cwd());
48
+ await runTool(target, "kirograph_ast_grep_rewrite", { file, pattern, rewrite });
49
+ });
50
+ }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ register
54
+ });
55
+ //# sourceMappingURL=ast-rewrite.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/ast-rewrite.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nasync function runTool(target: string, toolName: string, args: Record<string, unknown>): Promise<void> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { ToolHandler } = (await Promise.resolve().then(() => require('../../mcp/handler.js'))) as any;\n const cg = await KiroGraph.open(target);\n const handler = new ToolHandler(cg);\n const result = await handler.handle(toolName, { ...args, projectPath: target });\n cg.close();\n const text: string = result.content.map((c: any) => c.text).join('');\n console.log(text);\n}\n\nexport function register(program: Command): void {\n program\n .command('ast-rewrite <file> <pattern> <rewrite> [projectPath]')\n .description('Structural rewrite via ast-grep (requires ast-grep on PATH)')\n .action(async (file: string, pattern: string, rewrite: string, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_ast_grep_rewrite', { file, pattern, rewrite });\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAItB,eAAe,QAAQ,QAAgB,UAAkB,MAA8C;AACrG,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,EAAE,YAAY,IAAK,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,sBAAsB,CAAC;AAC3F,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,QAAM,UAAU,IAAI,YAAY,EAAE;AAClC,QAAM,SAAS,MAAM,QAAQ,OAAO,UAAU,EAAE,GAAG,MAAM,aAAa,OAAO,CAAC;AAC9E,KAAG,MAAM;AACT,QAAM,OAAe,OAAO,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK,EAAE;AACnE,UAAQ,IAAI,IAAI;AAClB;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,sDAAsD,EAC9D,YAAY,6DAA6D,EACzE,OAAO,OAAO,MAAc,SAAiB,SAAiB,gBAAoC;AACjG,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,8BAA8B,EAAE,MAAM,SAAS,QAAQ,CAAC;AAAA,EAChF,CAAC;AACL;",
6
+ "names": []
7
+ }
@@ -0,0 +1,103 @@
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 bench_exports = {};
30
+ __export(bench_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(bench_exports);
34
+ var path = __toESM(require("path"));
35
+ var fs = __toESM(require("fs"));
36
+ var import_ui = require("../ui");
37
+ const BENCH_QUERIES = [
38
+ { label: "context:large-task", tool: "context", task: "Understand the main entry point and core data flow" },
39
+ { label: "context:small-task", tool: "context", task: "Find authentication logic" },
40
+ { label: "search:function", tool: "search", query: "handle" }
41
+ ];
42
+ function register(program) {
43
+ program.command("bench [projectPath]").description("Quick token-efficiency benchmark on the current project").option("--quiet", "Output only the summary line").action(async (projectPath, opts) => {
44
+ const target = path.resolve(projectPath ?? process.cwd());
45
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
46
+ if (!KiroGraph.isInitialized(target)) {
47
+ console.error("Project not indexed. Run: kirograph index");
48
+ process.exit(1);
49
+ }
50
+ const cg = await KiroGraph.open(target);
51
+ const allNodes = cg.getAllNodes();
52
+ const sourceFiles = [...new Set(allNodes.map((n) => n.filePath))];
53
+ let naiveTokens = 0;
54
+ for (const fp of sourceFiles) {
55
+ try {
56
+ const fullPath = path.join(target, fp);
57
+ naiveTokens += Math.round(fs.statSync(fullPath).size / 4);
58
+ } catch {
59
+ }
60
+ }
61
+ if (!opts.quiet) {
62
+ console.log("\n KiroGraph Local Bench");
63
+ console.log(" " + import_ui.dim + sourceFiles.length + " source files, ~" + naiveTokens.toLocaleString() + " naive tokens" + import_ui.reset);
64
+ console.log("");
65
+ }
66
+ let totalGraphTokens = 0;
67
+ let queryCount = 0;
68
+ for (const q of BENCH_QUERIES) {
69
+ const start = Date.now();
70
+ let responseText = "";
71
+ try {
72
+ if (q.tool === "context") {
73
+ const ctx = await cg.buildContext(q.task, { maxNodes: 20, includeCode: true });
74
+ responseText = ctx.summary + ctx.entryPoints.map((n) => n.name).join(" ");
75
+ for (const [, code] of ctx.codeSnippets) responseText += code;
76
+ } else {
77
+ const results = cg.searchNodes(q.query, void 0, 20);
78
+ responseText = results.map((r) => r.node.name + " " + r.node.filePath).join("\n");
79
+ }
80
+ } catch {
81
+ }
82
+ const graphTok = Math.round(responseText.length / 4);
83
+ totalGraphTokens += graphTok;
84
+ queryCount++;
85
+ const ms = Date.now() - start;
86
+ if (!opts.quiet) {
87
+ const savings = naiveTokens > 0 ? Math.round((1 - graphTok / naiveTokens) * 100) : 0;
88
+ console.log(" " + q.label + ": " + graphTok + " tok (" + savings + "% savings, " + ms + "ms)");
89
+ }
90
+ }
91
+ cg.close();
92
+ const avgTok = Math.round(totalGraphTokens / queryCount);
93
+ const avgSavings = naiveTokens > 0 ? Math.round((1 - avgTok / naiveTokens) * 100) : 0;
94
+ console.log("");
95
+ console.log(" avg " + avgSavings + "% token savings vs naive file reading");
96
+ console.log("");
97
+ });
98
+ }
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {
101
+ register
102
+ });
103
+ //# sourceMappingURL=bench.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/bench.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport * as fs from 'fs';\nimport { Command } from 'commander';\nimport { dim, reset } from '../ui';\n\nconst BENCH_QUERIES = [\n { label: 'context:large-task', tool: 'context', task: 'Understand the main entry point and core data flow' },\n { label: 'context:small-task', tool: 'context', task: 'Find authentication logic' },\n { label: 'search:function', tool: 'search', query: 'handle' },\n];\n\nexport function register(program: Command): void {\n program.command('bench [projectPath]')\n .description('Quick token-efficiency benchmark on the current project')\n .option('--quiet', 'Output only the summary line')\n .action(async (projectPath: string | undefined, opts: { quiet?: boolean }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error('Project not indexed. Run: kirograph index');\n process.exit(1);\n }\n const cg = await KiroGraph.open(target);\n\n // Estimate naive token cost: sum all source file sizes / 4\n const allNodes = cg.getAllNodes();\n const sourceFiles = [...new Set(allNodes.map((n: any) => n.filePath as string))];\n let naiveTokens = 0;\n for (const fp of sourceFiles) {\n try {\n const fullPath = path.join(target, fp);\n naiveTokens += Math.round(fs.statSync(fullPath).size / 4);\n } catch { /* skip */ }\n }\n\n if (!opts.quiet) {\n console.log('\\n KiroGraph Local Bench');\n console.log(' ' + dim + sourceFiles.length + ' source files, ~' + naiveTokens.toLocaleString() + ' naive tokens' + reset);\n console.log('');\n }\n\n let totalGraphTokens = 0;\n let queryCount = 0;\n for (const q of BENCH_QUERIES) {\n const start = Date.now();\n let responseText = '';\n try {\n if (q.tool === 'context') {\n const ctx = await cg.buildContext(q.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 {\n const results = cg.searchNodes(q.query as string, undefined, 20);\n responseText = results.map((r: any) => r.node.name + ' ' + r.node.filePath).join('\\n');\n }\n } catch { /* skip */ }\n const graphTok = Math.round(responseText.length / 4);\n totalGraphTokens += graphTok;\n queryCount++;\n const ms = Date.now() - start;\n if (!opts.quiet) {\n const savings = naiveTokens > 0 ? Math.round((1 - graphTok / naiveTokens) * 100) : 0;\n console.log(' ' + q.label + ': ' + graphTok + ' tok (' + savings + '% savings, ' + ms + 'ms)');\n }\n }\n cg.close();\n\n const avgTok = Math.round(totalGraphTokens / queryCount);\n const avgSavings = naiveTokens > 0 ? Math.round((1 - avgTok / naiveTokens) * 100) : 0;\n console.log('');\n console.log(' avg ' + avgSavings + '% token savings vs naive file reading');\n console.log('');\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AACtB,SAAoB;AAEpB,gBAA2B;AAE3B,MAAM,gBAAgB;AAAA,EACpB,EAAE,OAAO,sBAAsB,MAAM,WAAW,MAAM,qDAAqD;AAAA,EAC3G,EAAE,OAAO,sBAAsB,MAAM,WAAW,MAAM,4BAA4B;AAAA,EAClF,EAAE,OAAO,mBAAmB,MAAM,UAAU,OAAO,SAAS;AAC9D;AAEO,SAAS,SAAS,SAAwB;AAC/C,UAAQ,QAAQ,qBAAqB,EAClC,YAAY,yDAAyD,EACrE,OAAO,WAAW,8BAA8B,EAChD,OAAO,OAAO,aAAiC,SAA8B;AAC5E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAI,CAAC,UAAU,cAAc,MAAM,GAAG;AACpC,cAAQ,MAAM,2CAA2C;AACzD,cAAQ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0BAAoB;AACpB;AACA,YAAM,KAAK,KAAK,IAAI,IAAI;AACxB,UAAI,CAAC,KAAK,OAAO;AACf,cAAM,UAAU,cAAc,IAAI,KAAK,OAAO,IAAI,WAAW,eAAe,GAAG,IAAI;AACnF,gBAAQ,IAAI,OAAO,EAAE,QAAQ,OAAO,WAAW,WAAW,UAAU,gBAAgB,KAAK,KAAK;AAAA,MAChG;AAAA,IACF;AACA,OAAG,MAAM;AAET,UAAM,SAAS,KAAK,MAAM,mBAAmB,UAAU;AACvD,UAAM,aAAa,cAAc,IAAI,KAAK,OAAO,IAAI,SAAS,eAAe,GAAG,IAAI;AACpF,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,WAAW,aAAa,uCAAuC;AAC3E,YAAQ,IAAI,EAAE;AAAA,EAChB,CAAC;AACL;",
6
+ "names": []
7
+ }
@@ -0,0 +1,133 @@
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 branch_exports = {};
30
+ __export(branch_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(branch_exports);
34
+ var path = __toESM(require("path"));
35
+ async function runTool(target, toolName, args) {
36
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
37
+ const { ToolHandler } = await Promise.resolve().then(() => require("../../mcp/handler.js"));
38
+ const cg = await KiroGraph.open(target);
39
+ const handler = new ToolHandler(cg);
40
+ const result = await handler.handle(toolName, { ...args, projectPath: target });
41
+ cg.close();
42
+ const text = result.content.map((c) => c.text).join("");
43
+ console.log(text);
44
+ }
45
+ async function getBranchManager() {
46
+ try {
47
+ return await Promise.resolve().then(() => require("../../core/branch-manager.js"));
48
+ } catch {
49
+ return null;
50
+ }
51
+ }
52
+ function register(program) {
53
+ const branch = program.command("branch").description("Multi-branch graph management");
54
+ branch.command("list [projectPath]").description("List tracked branches").action(async (projectPath) => {
55
+ const target = path.resolve(projectPath ?? process.cwd());
56
+ const bm = await getBranchManager();
57
+ if (!bm) {
58
+ console.error(" Branch manager not available in this build.");
59
+ process.exit(1);
60
+ }
61
+ const branches = bm.listTrackedBranches(target);
62
+ const current = bm.getCurrentGitBranch(target);
63
+ if (branches.length === 0) {
64
+ console.log(" No tracked branches. Use: kirograph branch add [name]");
65
+ return;
66
+ }
67
+ console.log(" Tracked branches (current git branch: " + current + "):");
68
+ for (const b of branches) {
69
+ const size = b.sizeBytes > 1048576 ? (b.sizeBytes / 1048576).toFixed(1) + " MB" : Math.round(b.sizeBytes / 1024) + " KB";
70
+ const sync = new Date(b.mtimeMs).toISOString().slice(0, 19);
71
+ console.log(" * " + b.name + " " + size + " synced " + sync);
72
+ }
73
+ });
74
+ branch.command("add [branchName] [projectPath]").description("Start tracking a branch").action(async (branchName, projectPath) => {
75
+ const target = path.resolve(projectPath ?? process.cwd());
76
+ const bm = await getBranchManager();
77
+ if (!bm) {
78
+ console.error(" Branch manager not available in this build.");
79
+ process.exit(1);
80
+ }
81
+ const name = branchName ?? bm.getCurrentGitBranch(target);
82
+ try {
83
+ const r = bm.addBranch(target, name);
84
+ if (r.created) {
85
+ console.log(" Tracking branch " + name + " \u2192 " + r.dbPath);
86
+ console.log(" Run kirograph sync to populate.");
87
+ } else {
88
+ console.log(" Already tracking branch: " + name);
89
+ }
90
+ } catch (err) {
91
+ console.error(" Error: " + err.message);
92
+ process.exit(1);
93
+ }
94
+ });
95
+ branch.command("remove <branchName> [projectPath]").description("Stop tracking a branch").action(async (branchName, projectPath) => {
96
+ const target = path.resolve(projectPath ?? process.cwd());
97
+ const bm = await getBranchManager();
98
+ if (!bm) {
99
+ console.error(" Branch manager not available in this build.");
100
+ process.exit(1);
101
+ }
102
+ const removed = bm.removeBranch(target, branchName);
103
+ console.log(removed ? " Removed branch: " + branchName : " Branch not tracked: " + branchName);
104
+ });
105
+ branch.command("gc [projectPath]").description("Remove DBs for deleted git branches").action(async (projectPath) => {
106
+ const target = path.resolve(projectPath ?? process.cwd());
107
+ const bm = await getBranchManager();
108
+ if (!bm) {
109
+ console.error(" Branch manager not available in this build.");
110
+ process.exit(1);
111
+ }
112
+ const removed = bm.gcBranches(target);
113
+ if (removed.length === 0) {
114
+ console.log(" Nothing to clean up.");
115
+ return;
116
+ }
117
+ for (const name of removed) console.log(" Removed: " + name);
118
+ console.log(" Cleaned " + removed.length + " branch(es).");
119
+ });
120
+ branch.command("diff <branchA> [branchB] [projectPath]").description("Diff symbols between two tracked branches").action(async (branchA, branchB, projectPath) => {
121
+ const target = path.resolve(projectPath ?? process.cwd());
122
+ await runTool(target, "kirograph_branch_diff", { branchA, branchB: branchB ?? "main" });
123
+ });
124
+ branch.command("search <query> <branchName> [projectPath]").description("Search symbols in a tracked branch").action(async (query, branchName, projectPath) => {
125
+ const target = path.resolve(projectPath ?? process.cwd());
126
+ await runTool(target, "kirograph_branch_search", { query, branch: branchName });
127
+ });
128
+ }
129
+ // Annotate the CommonJS export names for ESM import in node:
130
+ 0 && (module.exports = {
131
+ register
132
+ });
133
+ //# sourceMappingURL=branch.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/branch.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\n\nasync function runTool(target: string, toolName: string, args: Record<string, unknown>): Promise<void> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { ToolHandler } = (await Promise.resolve().then(() => require('../../mcp/handler.js'))) as any;\n const cg = await KiroGraph.open(target);\n const handler = new ToolHandler(cg);\n const result = await handler.handle(toolName, { ...args, projectPath: target });\n cg.close();\n const text: string = result.content.map((c: any) => c.text).join('');\n console.log(text);\n}\n\nasync function getBranchManager() {\n try {\n return await Promise.resolve().then(() => require('../../core/branch-manager.js')) as any;\n } catch {\n return null;\n }\n}\n\nexport function register(program: Command): void {\n const branch = program.command('branch').description('Multi-branch graph management');\n\n branch.command('list [projectPath]').description('List tracked branches').action(async (projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const bm = await getBranchManager();\n if (!bm) {\n console.error(' Branch manager not available in this build.');\n process.exit(1);\n }\n const branches = bm.listTrackedBranches(target);\n const current = bm.getCurrentGitBranch(target);\n if (branches.length === 0) {\n console.log(' No tracked branches. Use: kirograph branch add [name]');\n return;\n }\n console.log(' Tracked branches (current git branch: ' + current + '):');\n for (const b of branches) {\n const size = b.sizeBytes > 1048576 ? (b.sizeBytes / 1048576).toFixed(1) + ' MB' : Math.round(b.sizeBytes / 1024) + ' KB';\n const sync = new Date(b.mtimeMs).toISOString().slice(0, 19);\n console.log(' * ' + b.name + ' ' + size + ' synced ' + sync);\n }\n });\n\n branch.command('add [branchName] [projectPath]').description('Start tracking a branch').action(async (branchName: string | undefined, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const bm = await getBranchManager();\n if (!bm) {\n console.error(' Branch manager not available in this build.');\n process.exit(1);\n }\n const name = branchName ?? bm.getCurrentGitBranch(target);\n try {\n const r = bm.addBranch(target, name);\n if (r.created) {\n console.log(' Tracking branch ' + name + ' \u2192 ' + r.dbPath);\n console.log(' Run kirograph sync to populate.');\n } else {\n console.log(' Already tracking branch: ' + name);\n }\n } catch (err: any) {\n console.error(' Error: ' + err.message);\n process.exit(1);\n }\n });\n\n branch.command('remove <branchName> [projectPath]').description('Stop tracking a branch').action(async (branchName: string, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const bm = await getBranchManager();\n if (!bm) {\n console.error(' Branch manager not available in this build.');\n process.exit(1);\n }\n const removed = bm.removeBranch(target, branchName);\n console.log(removed ? ' Removed branch: ' + branchName : ' Branch not tracked: ' + branchName);\n });\n\n branch.command('gc [projectPath]').description('Remove DBs for deleted git branches').action(async (projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const bm = await getBranchManager();\n if (!bm) {\n console.error(' Branch manager not available in this build.');\n process.exit(1);\n }\n const removed = bm.gcBranches(target);\n if (removed.length === 0) { console.log(' Nothing to clean up.'); return; }\n for (const name of removed) console.log(' Removed: ' + name);\n console.log(' Cleaned ' + removed.length + ' branch(es).');\n });\n\n branch.command('diff <branchA> [branchB] [projectPath]').description('Diff symbols between two tracked branches').action(async (branchA: string, branchB: string | undefined, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_branch_diff', { branchA, branchB: branchB ?? 'main' });\n });\n\n branch.command('search <query> <branchName> [projectPath]').description('Search symbols in a tracked branch').action(async (query: string, branchName: string, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_branch_search', { query, branch: branchName });\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA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AQ,UAAU;AAClD,YAAQ,IAAI,UAAU,uBAAuB,aAAa,2BAA2B,UAAU;AAAA,EACjG,CAAC;AAED,SAAO,QAAQ,kBAAkB,EAAE,YAAY,qCAAqC,EAAE,OAAO,OAAO,gBAAoC;AACtI,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,KAAK,MAAM,iBAAiB;AAClC,QAAI,CAAC,IAAI;AACP,cAAQ,MAAM,+CAA+C;AAC7D,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,UAAM,UAAU,GAAG,WAAW,MAAM;AACpC,QAAI,QAAQ,WAAW,GAAG;AAAE,cAAQ,IAAI,wBAAwB;AAAG;AAAA,IAAQ;AAC3E,eAAW,QAAQ,QAAS,SAAQ,IAAI,gBAAgB,IAAI;AAC5D,YAAQ,IAAI,eAAe,QAAQ,SAAS,cAAc;AAAA,EAC5D,CAAC;AAED,SAAO,QAAQ,wCAAwC,EAAE,YAAY,2CAA2C,EAAE,OAAO,OAAO,SAAiB,SAA6B,gBAAoC;AAChN,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,yBAAyB,EAAE,SAAS,SAAS,WAAW,OAAO,CAAC;AAAA,EACxF,CAAC;AAED,SAAO,QAAQ,2CAA2C,EAAE,YAAY,oCAAoC,EAAE,OAAO,OAAO,OAAe,YAAoB,gBAAoC;AACjM,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,2BAA2B,EAAE,OAAO,QAAQ,WAAW,CAAC;AAAA,EAChF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
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 changelog_exports = {};
30
+ __export(changelog_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(changelog_exports);
34
+ var path = __toESM(require("path"));
35
+ async function runTool(target, toolName, args) {
36
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
37
+ const { ToolHandler } = await Promise.resolve().then(() => require("../../mcp/handler.js"));
38
+ const cg = await KiroGraph.open(target);
39
+ const handler = new ToolHandler(cg);
40
+ const result = await handler.handle(toolName, { ...args, projectPath: target });
41
+ cg.close();
42
+ const text = result.content.map((c) => c.text).join("");
43
+ console.log(text);
44
+ }
45
+ function register(program) {
46
+ program.command("changelog <ref1> <ref2> [projectPath]").description("Human-readable semantic diff between two git refs").action(async (ref1, ref2, projectPath) => {
47
+ const target = path.resolve(projectPath ?? process.cwd());
48
+ await runTool(target, "kirograph_changelog", { ref1, ref2 });
49
+ });
50
+ }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ register
54
+ });
55
+ //# sourceMappingURL=changelog.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/changelog.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nasync function runTool(target: string, toolName: string, args: Record<string, unknown>): Promise<void> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { ToolHandler } = (await Promise.resolve().then(() => require('../../mcp/handler.js'))) as any;\n const cg = await KiroGraph.open(target);\n const handler = new ToolHandler(cg);\n const result = await handler.handle(toolName, { ...args, projectPath: target });\n cg.close();\n const text: string = result.content.map((c: any) => c.text).join('');\n console.log(text);\n}\n\nexport function register(program: Command): void {\n program\n .command('changelog <ref1> <ref2> [projectPath]')\n .description('Human-readable semantic diff between two git refs')\n .action(async (ref1: string, ref2: string, projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_changelog', { ref1, ref2 });\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAItB,eAAe,QAAQ,QAAgB,UAAkB,MAA8C;AACrG,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,EAAE,YAAY,IAAK,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,sBAAsB,CAAC;AAC3F,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,QAAM,UAAU,IAAI,YAAY,EAAE;AAClC,QAAM,SAAS,MAAM,QAAQ,OAAO,UAAU,EAAE,GAAG,MAAM,aAAa,OAAO,CAAC;AAC9E,KAAG,MAAM;AACT,QAAM,OAAe,OAAO,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK,EAAE;AACnE,UAAQ,IAAI,IAAI;AAClB;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,uCAAuC,EAC/C,YAAY,mDAAmD,EAC/D,OAAO,OAAO,MAAc,MAAc,gBAAoC;AAC7E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,uBAAuB,EAAE,MAAM,KAAK,CAAC;AAAA,EAC7D,CAAC;AACL;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
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 commit_context_exports = {};
30
+ __export(commit_context_exports, {
31
+ register: () => register
32
+ });
33
+ module.exports = __toCommonJS(commit_context_exports);
34
+ var path = __toESM(require("path"));
35
+ async function runTool(target, toolName, args) {
36
+ const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
37
+ const { ToolHandler } = await Promise.resolve().then(() => require("../../mcp/handler.js"));
38
+ const cg = await KiroGraph.open(target);
39
+ const handler = new ToolHandler(cg);
40
+ const result = await handler.handle(toolName, { ...args, projectPath: target });
41
+ cg.close();
42
+ const text = result.content.map((c) => c.text).join("");
43
+ console.log(text);
44
+ }
45
+ function register(program) {
46
+ program.command("commit-context [projectPath]").description("Structured summary of staged changes, ready for a commit message").action(async (projectPath) => {
47
+ const target = path.resolve(projectPath ?? process.cwd());
48
+ await runTool(target, "kirograph_commit_context", {});
49
+ });
50
+ }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ register
54
+ });
55
+ //# sourceMappingURL=commit-context.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/commands/commit-context.ts"],
4
+ "sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nasync function runTool(target: string, toolName: string, args: Record<string, unknown>): Promise<void> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { ToolHandler } = (await Promise.resolve().then(() => require('../../mcp/handler.js'))) as any;\n const cg = await KiroGraph.open(target);\n const handler = new ToolHandler(cg);\n const result = await handler.handle(toolName, { ...args, projectPath: target });\n cg.close();\n const text: string = result.content.map((c: any) => c.text).join('');\n console.log(text);\n}\n\nexport function register(program: Command): void {\n program\n .command('commit-context [projectPath]')\n .description('Structured summary of staged changes, ready for a commit message')\n .action(async (projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_commit_context', {});\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAItB,eAAe,QAAQ,QAAgB,UAAkB,MAA8C;AACrG,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,EAAE,YAAY,IAAK,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,sBAAsB,CAAC;AAC3F,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,QAAM,UAAU,IAAI,YAAY,EAAE;AAClC,QAAM,SAAS,MAAM,QAAQ,OAAO,UAAU,EAAE,GAAG,MAAM,aAAa,OAAO,CAAC;AAC9E,KAAG,MAAM;AACT,QAAM,OAAe,OAAO,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK,EAAE;AACnE,UAAQ,IAAI,IAAI;AAClB;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,8BAA8B,EACtC,YAAY,kEAAkE,EAC9E,OAAO,OAAO,gBAAoC;AACjD,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,4BAA4B,CAAC,CAAC;AAAA,EACtD,CAAC;AACL;",
6
+ "names": []
7
+ }