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.
- package/README.md +14 -7
- package/dist/bin/commands/annotations.js +56 -0
- package/dist/bin/commands/annotations.js.map +7 -0
- package/dist/bin/commands/ast-rewrite.js +55 -0
- package/dist/bin/commands/ast-rewrite.js.map +7 -0
- package/dist/bin/commands/bench.js +103 -0
- package/dist/bin/commands/bench.js.map +7 -0
- package/dist/bin/commands/branch.js +133 -0
- package/dist/bin/commands/branch.js.map +7 -0
- package/dist/bin/commands/changelog.js +55 -0
- package/dist/bin/commands/changelog.js.map +7 -0
- package/dist/bin/commands/commit-context.js +55 -0
- package/dist/bin/commands/commit-context.js.map +7 -0
- package/dist/bin/commands/complexity.js +60 -0
- package/dist/bin/commands/complexity.js.map +7 -0
- package/dist/bin/commands/cost.js +146 -0
- package/dist/bin/commands/cost.js.map +7 -0
- package/dist/bin/commands/dependency-depth.js +55 -0
- package/dist/bin/commands/dependency-depth.js.map +7 -0
- package/dist/bin/commands/diff-context.js +55 -0
- package/dist/bin/commands/diff-context.js.map +7 -0
- package/dist/bin/commands/distribution.js +56 -0
- package/dist/bin/commands/distribution.js.map +7 -0
- package/dist/bin/commands/doc-coverage.js +56 -0
- package/dist/bin/commands/doc-coverage.js.map +7 -0
- package/dist/bin/commands/doctor.js +202 -0
- package/dist/bin/commands/doctor.js.map +7 -0
- package/dist/bin/commands/dsm.js +56 -0
- package/dist/bin/commands/dsm.js.map +7 -0
- package/dist/bin/commands/gini.js +55 -0
- package/dist/bin/commands/gini.js.map +7 -0
- package/dist/bin/commands/god-class.js +56 -0
- package/dist/bin/commands/god-class.js.map +7 -0
- package/dist/bin/commands/health.js +55 -0
- package/dist/bin/commands/health.js.map +7 -0
- package/dist/bin/commands/help.js +224 -45
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/inheritance-depth.js +56 -0
- package/dist/bin/commands/inheritance-depth.js.map +7 -0
- package/dist/bin/commands/insert-at.js +55 -0
- package/dist/bin/commands/insert-at.js.map +7 -0
- package/dist/bin/commands/largest.js +56 -0
- package/dist/bin/commands/largest.js.map +7 -0
- package/dist/bin/commands/manifest.js +158 -0
- package/dist/bin/commands/manifest.js.map +7 -0
- package/dist/bin/commands/module-api.js +57 -0
- package/dist/bin/commands/module-api.js.map +7 -0
- package/dist/bin/commands/monitor.js +91 -0
- package/dist/bin/commands/monitor.js.map +7 -0
- package/dist/bin/commands/multi-replace.js +66 -0
- package/dist/bin/commands/multi-replace.js.map +7 -0
- package/dist/bin/commands/pr-context.js +55 -0
- package/dist/bin/commands/pr-context.js.map +7 -0
- package/dist/bin/commands/query.js +19 -1
- package/dist/bin/commands/query.js.map +3 -3
- package/dist/bin/commands/rank.js +56 -0
- package/dist/bin/commands/rank.js.map +7 -0
- package/dist/bin/commands/read.js +1 -1
- package/dist/bin/commands/read.js.map +2 -2
- package/dist/bin/commands/recursion.js +56 -0
- package/dist/bin/commands/recursion.js.map +7 -0
- package/dist/bin/commands/rename-preview.js +56 -0
- package/dist/bin/commands/rename-preview.js.map +7 -0
- package/dist/bin/commands/session.js +60 -0
- package/dist/bin/commands/session.js.map +7 -0
- package/dist/bin/commands/simplify-scan.js +56 -0
- package/dist/bin/commands/simplify-scan.js.map +7 -0
- package/dist/bin/commands/str-replace.js +55 -0
- package/dist/bin/commands/str-replace.js.map +7 -0
- package/dist/bin/commands/test-coverage.js +59 -0
- package/dist/bin/commands/test-coverage.js.map +7 -0
- package/dist/bin/commands/test-map.js +56 -0
- package/dist/bin/commands/test-map.js.map +7 -0
- package/dist/bin/commands/test-risk.js +59 -0
- package/dist/bin/commands/test-risk.js.map +7 -0
- package/dist/bin/commands/unused-imports.js +55 -0
- package/dist/bin/commands/unused-imports.js.map +7 -0
- package/dist/bin/commands/upgrade.js +78 -0
- package/dist/bin/commands/upgrade.js.map +7 -0
- package/dist/bin/installer/common.js +5 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +140 -11
- package/dist/bin/installer/config-prompt.js.map +3 -3
- package/dist/bin/installer/index.js +38 -6
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +7 -11
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.js.map +2 -2
- package/dist/bin/installer/steering.js +531 -100
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/kiro.js +7 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/kirograph.js +73 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/config.js +26 -8
- package/dist/config.js.map +2 -2
- package/dist/core/branch-manager.js +111 -0
- package/dist/core/branch-manager.js.map +7 -0
- package/dist/core/pipeline.js +3 -3
- package/dist/core/pipeline.js.map +2 -2
- package/dist/data/pixelrag-bridge.js +93 -0
- package/dist/data/pixelrag-bridge.js.map +7 -0
- package/dist/data/pixelrag-manager.js +416 -0
- package/dist/data/pixelrag-manager.js.map +7 -0
- package/dist/db/database.js +34 -7
- package/dist/db/database.js.map +2 -2
- package/dist/db/schema.sql +7 -1
- package/dist/extraction/complexity.js +116 -0
- package/dist/extraction/complexity.js.map +7 -0
- package/dist/extraction/extractor.js +52 -1
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/graph/git-context.js +229 -0
- package/dist/graph/git-context.js.map +7 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +2 -2
- package/dist/mcp/handler.js +446 -0
- package/dist/mcp/handler.js.map +7 -0
- package/dist/mcp/handlers/architecture.js +297 -0
- package/dist/mcp/handlers/architecture.js.map +7 -0
- package/dist/mcp/handlers/branch.js +175 -0
- package/dist/mcp/handlers/branch.js.map +7 -0
- package/dist/mcp/handlers/code-health.js +563 -0
- package/dist/mcp/handlers/code-health.js.map +7 -0
- package/dist/mcp/handlers/complexity.js +267 -0
- package/dist/mcp/handlers/complexity.js.map +7 -0
- package/dist/mcp/handlers/core.js +611 -0
- package/dist/mcp/handlers/core.js.map +7 -0
- package/dist/mcp/handlers/data.js +337 -0
- package/dist/mcp/handlers/data.js.map +7 -0
- package/dist/mcp/handlers/docs.js +159 -0
- package/dist/mcp/handlers/docs.js.map +7 -0
- package/dist/mcp/handlers/edit-primitives.js +200 -0
- package/dist/mcp/handlers/edit-primitives.js.map +7 -0
- package/dist/mcp/handlers/git-context.js +286 -0
- package/dist/mcp/handlers/git-context.js.map +7 -0
- package/dist/mcp/handlers/memory.js +363 -0
- package/dist/mcp/handlers/memory.js.map +7 -0
- package/dist/mcp/handlers/patterns.js +310 -0
- package/dist/mcp/handlers/patterns.js.map +7 -0
- package/dist/mcp/handlers/security.js +699 -0
- package/dist/mcp/handlers/security.js.map +7 -0
- package/dist/mcp/handlers/utils.js +97 -0
- package/dist/mcp/handlers/utils.js.map +7 -0
- package/dist/mcp/handlers/watchmen.js +104 -0
- package/dist/mcp/handlers/watchmen.js.map +7 -0
- package/dist/mcp/handlers/wiki.js +242 -0
- package/dist/mcp/handlers/wiki.js.map +7 -0
- package/dist/mcp/server.js +72 -3
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.js +94 -7
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +445 -3210
- package/dist/mcp/tools.js.map +3 -3
- package/dist/types.js.map +2 -2
- package/package.json +36 -10
|
@@ -0,0 +1,60 @@
|
|
|
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 complexity_exports = {};
|
|
30
|
+
__export(complexity_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(complexity_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("complexity [projectPath]").description("Rank functions by cyclomatic complexity, cognitive complexity, and maintainability index").option("--limit <n>", "Max results (default: 20)", "20").option("--sort <by>", "Sort by: cyclomatic | cognitive | maintainability (default: cyclomatic)", "cyclomatic").option("--threshold <n>", "Only show results above this threshold").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
const limit = parseInt(opts.limit) || 20;
|
|
49
|
+
await runTool(target, "kirograph_complexity", {
|
|
50
|
+
limit,
|
|
51
|
+
sortBy: opts.sort,
|
|
52
|
+
threshold: opts.threshold ? parseInt(opts.threshold) : void 0
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
register
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=complexity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/complexity.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('complexity [projectPath]')\n .description('Rank functions by cyclomatic complexity, cognitive complexity, and maintainability index')\n .option('--limit <n>', 'Max results (default: 20)', '20')\n .option('--sort <by>', 'Sort by: cyclomatic | cognitive | maintainability (default: cyclomatic)', 'cyclomatic')\n .option('--threshold <n>', 'Only show results above this threshold')\n .action(async (\n projectPath: string | undefined,\n opts: { limit: string; sort: string; threshold?: string },\n ) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 20;\n await runTool(target, 'kirograph_complexity', {\n limit,\n sortBy: opts.sort,\n threshold: opts.threshold ? parseInt(opts.threshold) : undefined,\n });\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,0BAA0B,EAClC,YAAY,0FAA0F,EACtG,OAAO,eAAe,6BAA6B,IAAI,EACvD,OAAO,eAAe,2EAA2E,YAAY,EAC7G,OAAO,mBAAmB,wCAAwC,EAClE,OAAO,OACN,aACA,SACG;AACH,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,wBAAwB;AAAA,MAC5C;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,WAAW,KAAK,YAAY,SAAS,KAAK,SAAS,IAAI;AAAA,IACzD,CAAC;AAAA,EACH,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
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 cost_exports = {};
|
|
30
|
+
__export(cost_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(cost_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var os = __toESM(require("os"));
|
|
37
|
+
const TOOL_CATEGORIES = {
|
|
38
|
+
kirograph_context: "Core",
|
|
39
|
+
kirograph_search: "Core",
|
|
40
|
+
kirograph_node: "Core",
|
|
41
|
+
kirograph_callers: "Navigation",
|
|
42
|
+
kirograph_callees: "Navigation",
|
|
43
|
+
kirograph_impact: "Navigation",
|
|
44
|
+
kirograph_status: "Navigation",
|
|
45
|
+
kirograph_files: "Navigation",
|
|
46
|
+
kirograph_complexity: "Code Health",
|
|
47
|
+
kirograph_health: "Code Health",
|
|
48
|
+
kirograph_dsm: "Code Health",
|
|
49
|
+
kirograph_test_risk: "Code Health",
|
|
50
|
+
kirograph_hotspots: "Code Health",
|
|
51
|
+
kirograph_dead_code: "Code Health",
|
|
52
|
+
kirograph_diff_context: "Git Context",
|
|
53
|
+
kirograph_commit_context: "Git Context",
|
|
54
|
+
kirograph_pr_context: "Git Context",
|
|
55
|
+
kirograph_test_coverage: "Git Context",
|
|
56
|
+
kirograph_test_map: "Git Context",
|
|
57
|
+
kirograph_changelog: "Git Context",
|
|
58
|
+
kirograph_str_replace: "Edit",
|
|
59
|
+
kirograph_multi_str_replace: "Edit",
|
|
60
|
+
kirograph_insert_at: "Edit",
|
|
61
|
+
kirograph_architecture: "Architecture",
|
|
62
|
+
kirograph_coupling: "Architecture",
|
|
63
|
+
kirograph_package: "Architecture",
|
|
64
|
+
kirograph_mem_store: "Memory",
|
|
65
|
+
kirograph_mem_search: "Memory",
|
|
66
|
+
kirograph_mem_timeline: "Memory"
|
|
67
|
+
};
|
|
68
|
+
function getCategory(toolName) {
|
|
69
|
+
if (TOOL_CATEGORIES[toolName]) return TOOL_CATEGORIES[toolName];
|
|
70
|
+
if (toolName.startsWith("kirograph_mem_")) return "Memory";
|
|
71
|
+
if (toolName.startsWith("kirograph_wiki_")) return "Wiki";
|
|
72
|
+
if (toolName.startsWith("kirograph_data_")) return "Data";
|
|
73
|
+
if (toolName.startsWith("kirograph_docs_")) return "Docs";
|
|
74
|
+
if (toolName.startsWith("kirograph_security") || toolName.startsWith("kirograph_vuln") || toolName.startsWith("kirograph_sbom")) return "Security";
|
|
75
|
+
if (toolName.startsWith("kirograph_")) return "Other";
|
|
76
|
+
return "Non-KiroGraph";
|
|
77
|
+
}
|
|
78
|
+
function getSessionDir() {
|
|
79
|
+
if (process.platform === "darwin" || process.platform === "linux") {
|
|
80
|
+
return path.join(os.homedir(), ".config", "claude-code", "sessions");
|
|
81
|
+
}
|
|
82
|
+
return path.join(process.env.APPDATA ?? os.homedir(), "Claude", "sessions");
|
|
83
|
+
}
|
|
84
|
+
function register(program) {
|
|
85
|
+
program.command("cost [sessionDir]").description("Report KiroGraph MCP tool usage cost from Claude Code session transcripts").option("--last <n>", "Only analyze last N session files", "10").option("--category", "Group by category instead of tool").action((sessionDir, opts) => {
|
|
86
|
+
const dir = sessionDir ? path.resolve(sessionDir) : getSessionDir();
|
|
87
|
+
if (!fs.existsSync(dir)) {
|
|
88
|
+
console.log(" Session directory not found: " + dir);
|
|
89
|
+
console.log(" Provide path to Claude Code sessions directory as argument.");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const files = fs.readdirSync(dir).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, mtime: fs.statSync(path.join(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime).slice(0, parseInt(opts.last) || 10).map((x) => x.f);
|
|
93
|
+
if (files.length === 0) {
|
|
94
|
+
console.log(" No session files found in: " + dir);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const toolCounts = {};
|
|
98
|
+
let totalCalls = 0;
|
|
99
|
+
for (const file of files) {
|
|
100
|
+
const lines = fs.readFileSync(path.join(dir, file), "utf8").split("\n").filter(Boolean);
|
|
101
|
+
for (const line of lines) {
|
|
102
|
+
try {
|
|
103
|
+
const entry = JSON.parse(line);
|
|
104
|
+
const content = Array.isArray(entry.content) ? entry.content : [];
|
|
105
|
+
for (const item of content) {
|
|
106
|
+
if (item.type === "tool_use" && typeof item.name === "string" && item.name.startsWith("kirograph_")) {
|
|
107
|
+
toolCounts[item.name] = (toolCounts[item.name] ?? 0) + 1;
|
|
108
|
+
totalCalls++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (totalCalls === 0) {
|
|
116
|
+
console.log(" No KiroGraph tool calls found in last " + files.length + " sessions.");
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
console.log("\n KiroGraph tool usage (" + files.length + " sessions, " + totalCalls + " calls total):\n");
|
|
120
|
+
if (opts.category) {
|
|
121
|
+
const catCounts = {};
|
|
122
|
+
for (const [tool, count] of Object.entries(toolCounts)) {
|
|
123
|
+
const cat = getCategory(tool);
|
|
124
|
+
catCounts[cat] = (catCounts[cat] ?? 0) + count;
|
|
125
|
+
}
|
|
126
|
+
const sorted = Object.entries(catCounts).sort((a, b) => b[1] - a[1]);
|
|
127
|
+
for (const [cat, count] of sorted) {
|
|
128
|
+
const pct = Math.round(count / totalCalls * 100);
|
|
129
|
+
console.log(" " + cat.padEnd(20) + count.toString().padStart(6) + " calls (" + pct + "%)");
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
const sorted = Object.entries(toolCounts).sort((a, b) => b[1] - a[1]);
|
|
133
|
+
for (const [tool, count] of sorted) {
|
|
134
|
+
const pct = Math.round(count / totalCalls * 100);
|
|
135
|
+
const cat = getCategory(tool);
|
|
136
|
+
console.log(" " + tool.padEnd(40) + count.toString().padStart(6) + " [" + cat + "] (" + pct + "%)");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
console.log("");
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
register
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=cost.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/cost.ts"],
|
|
4
|
+
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { Command } from 'commander';\n\nconst TOOL_CATEGORIES: Record<string, string> = {\n kirograph_context: 'Core', kirograph_search: 'Core', kirograph_node: 'Core',\n kirograph_callers: 'Navigation', kirograph_callees: 'Navigation', kirograph_impact: 'Navigation',\n kirograph_status: 'Navigation', kirograph_files: 'Navigation',\n kirograph_complexity: 'Code Health', kirograph_health: 'Code Health', kirograph_dsm: 'Code Health',\n kirograph_test_risk: 'Code Health', kirograph_hotspots: 'Code Health', kirograph_dead_code: 'Code Health',\n kirograph_diff_context: 'Git Context', kirograph_commit_context: 'Git Context', kirograph_pr_context: 'Git Context',\n kirograph_test_coverage: 'Git Context', kirograph_test_map: 'Git Context', kirograph_changelog: 'Git Context',\n kirograph_str_replace: 'Edit', kirograph_multi_str_replace: 'Edit', kirograph_insert_at: 'Edit',\n kirograph_architecture: 'Architecture', kirograph_coupling: 'Architecture', kirograph_package: 'Architecture',\n kirograph_mem_store: 'Memory', kirograph_mem_search: 'Memory', kirograph_mem_timeline: 'Memory',\n};\n\nfunction getCategory(toolName: string): string {\n if (TOOL_CATEGORIES[toolName]) return TOOL_CATEGORIES[toolName];\n if (toolName.startsWith('kirograph_mem_')) return 'Memory';\n if (toolName.startsWith('kirograph_wiki_')) return 'Wiki';\n if (toolName.startsWith('kirograph_data_')) return 'Data';\n if (toolName.startsWith('kirograph_docs_')) return 'Docs';\n if (toolName.startsWith('kirograph_security') || toolName.startsWith('kirograph_vuln') || toolName.startsWith('kirograph_sbom')) return 'Security';\n if (toolName.startsWith('kirograph_')) return 'Other';\n return 'Non-KiroGraph';\n}\n\nfunction getSessionDir(): string {\n if (process.platform === 'darwin' || process.platform === 'linux') {\n return path.join(os.homedir(), '.config', 'claude-code', 'sessions');\n }\n return path.join(process.env.APPDATA ?? os.homedir(), 'Claude', 'sessions');\n}\n\nexport function register(program: Command): void {\n program.command('cost [sessionDir]')\n .description('Report KiroGraph MCP tool usage cost from Claude Code session transcripts')\n .option('--last <n>', 'Only analyze last N session files', '10')\n .option('--category', 'Group by category instead of tool')\n .action((sessionDir: string | undefined, opts: { last: string; category?: boolean }) => {\n const dir = sessionDir ? path.resolve(sessionDir) : getSessionDir();\n if (!fs.existsSync(dir)) {\n console.log(' Session directory not found: ' + dir);\n console.log(' Provide path to Claude Code sessions directory as argument.');\n return;\n }\n\n const files = fs.readdirSync(dir)\n .filter(f => f.endsWith('.jsonl'))\n .map(f => ({ f, mtime: fs.statSync(path.join(dir, f)).mtimeMs }))\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, parseInt(opts.last) || 10)\n .map(x => x.f);\n\n if (files.length === 0) { console.log(' No session files found in: ' + dir); return; }\n\n const toolCounts: Record<string, number> = {};\n let totalCalls = 0;\n\n for (const file of files) {\n const lines = fs.readFileSync(path.join(dir, file), 'utf8').split('\\n').filter(Boolean);\n for (const line of lines) {\n try {\n const entry = JSON.parse(line);\n const content = Array.isArray(entry.content) ? entry.content : [];\n for (const item of content) {\n if (item.type === 'tool_use' && typeof item.name === 'string' && item.name.startsWith('kirograph_')) {\n toolCounts[item.name] = (toolCounts[item.name] ?? 0) + 1;\n totalCalls++;\n }\n }\n } catch { /* skip malformed lines */ }\n }\n }\n\n if (totalCalls === 0) { console.log(' No KiroGraph tool calls found in last ' + files.length + ' sessions.'); return; }\n\n console.log('\\n KiroGraph tool usage (' + files.length + ' sessions, ' + totalCalls + ' calls total):\\n');\n\n if (opts.category) {\n const catCounts: Record<string, number> = {};\n for (const [tool, count] of Object.entries(toolCounts)) {\n const cat = getCategory(tool);\n catCounts[cat] = (catCounts[cat] ?? 0) + count;\n }\n const sorted = Object.entries(catCounts).sort((a, b) => b[1] - a[1]);\n for (const [cat, count] of sorted) {\n const pct = Math.round(count / totalCalls * 100);\n console.log(' ' + cat.padEnd(20) + count.toString().padStart(6) + ' calls (' + pct + '%)');\n }\n } else {\n const sorted = Object.entries(toolCounts).sort((a, b) => b[1] - a[1]);\n for (const [tool, count] of sorted) {\n const pct = Math.round(count / totalCalls * 100);\n const cat = getCategory(tool);\n console.log(' ' + tool.padEnd(40) + count.toString().padStart(6) + ' [' + cat + '] (' + pct + '%)');\n }\n }\n console.log('');\n });\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
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 dependency_depth_exports = {};
|
|
30
|
+
__export(dependency_depth_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(dependency_depth_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("dependency-depth [projectPath]").description("Compute topological depth of each file in the import graph (Kahn's algorithm)").option("--limit <n>", "Max files to show (default: 20)", "20").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
await runTool(target, "kirograph_dependency_depth", { limit: parseInt(opts.limit) });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
register
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=dependency-depth.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/dependency-depth.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\nexport function register(program: Command): void {\n program\n .command('dependency-depth [projectPath]')\n .description('Compute topological depth of each file in the import graph (Kahn\\'s algorithm)')\n .option('--limit <n>', 'Max files to show (default: 20)', '20')\n .action(async (projectPath: string | undefined, opts: { limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_dependency_depth', { limit: parseInt(opts.limit) });\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAGtB,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,gCAAgC,EACxC,YAAY,+EAAgF,EAC5F,OAAO,eAAe,mCAAmC,IAAI,EAC7D,OAAO,OAAO,aAAiC,SAA4B;AAC1E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,8BAA8B,EAAE,OAAO,SAAS,KAAK,KAAK,EAAE,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 diff_context_exports = {};
|
|
30
|
+
__export(diff_context_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(diff_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("diff-context [projectPath]").description("Show changed symbols (unstaged or staged), their callers/callees, and affected tests").option("--staged", "Use staged changes only").option("--ref <ref>", "Compare against git ref").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
await runTool(target, "kirograph_diff_context", { staged: opts.staged, ref: opts.ref });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
register
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=diff-context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/diff-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('diff-context [projectPath]')\n .description('Show changed symbols (unstaged or staged), their callers/callees, and affected tests')\n .option('--staged', 'Use staged changes only')\n .option('--ref <ref>', 'Compare against git ref')\n .action(async (projectPath: string | undefined, opts: { staged?: boolean; ref?: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_diff_context', { staged: opts.staged, ref: opts.ref });\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,4BAA4B,EACpC,YAAY,sFAAsF,EAClG,OAAO,YAAY,yBAAyB,EAC5C,OAAO,eAAe,yBAAyB,EAC/C,OAAO,OAAO,aAAiC,SAA6C;AAC3F,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,0BAA0B,EAAE,QAAQ,KAAK,QAAQ,KAAK,KAAK,IAAI,CAAC;AAAA,EACxF,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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 distribution_exports = {};
|
|
30
|
+
__export(distribution_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(distribution_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("distribution [dirPath] [projectPath]").description("Symbol-kind breakdown per file or directory").option("--limit <n>", "Max results", "30").action(async (dirPath, projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
const limit = parseInt(opts.limit) || 30;
|
|
49
|
+
await runTool(target, "kirograph_distribution", { path: dirPath, limit });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
register
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=distribution.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/distribution.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('distribution [dirPath] [projectPath]')\n .description('Symbol-kind breakdown per file or directory')\n .option('--limit <n>', 'Max results', '30')\n .action(async (dirPath: string | undefined, projectPath: string | undefined, opts: { limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 30;\n await runTool(target, 'kirograph_distribution', { path: dirPath, 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,sCAAsC,EAC9C,YAAY,6CAA6C,EACzD,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,OAAO,SAA6B,aAAiC,SAA4B;AACvG,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,0BAA0B,EAAE,MAAM,SAAS,MAAM,CAAC;AAAA,EAC1E,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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 doc_coverage_exports = {};
|
|
30
|
+
__export(doc_coverage_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(doc_coverage_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("doc-coverage [projectPath]").description("Find exported symbols missing docstrings").option("--limit <n>", "Max results", "50").option("--path <p>", "File/dir filter").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
const limit = parseInt(opts.limit) || 50;
|
|
49
|
+
await runTool(target, "kirograph_doc_coverage", { path: opts.path, limit });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
register
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=doc-coverage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/doc-coverage.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('doc-coverage [projectPath]')\n .description('Find exported symbols missing docstrings')\n .option('--limit <n>', 'Max results', '50')\n .option('--path <p>', 'File/dir filter')\n .action(async (projectPath: string | undefined, opts: { limit: string; path?: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 50;\n await runTool(target, 'kirograph_doc_coverage', { path: opts.path, 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,4BAA4B,EACpC,YAAY,0CAA0C,EACtD,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,cAAc,iBAAiB,EACtC,OAAO,OAAO,aAAiC,SAA2C;AACzF,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,0BAA0B,EAAE,MAAM,KAAK,MAAM,MAAM,CAAC;AAAA,EAC5E,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|