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,202 @@
|
|
|
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 doctor_exports = {};
|
|
30
|
+
__export(doctor_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(doctor_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var fs = __toESM(require("fs"));
|
|
36
|
+
var os = __toESM(require("os"));
|
|
37
|
+
var import_ui = require("../ui");
|
|
38
|
+
const RED = "\x1B[38;5;203m";
|
|
39
|
+
const YELLOW = "\x1B[38;5;227m";
|
|
40
|
+
function pass(name, message) {
|
|
41
|
+
return { name, status: "ok", message };
|
|
42
|
+
}
|
|
43
|
+
function warn(name, message, fix) {
|
|
44
|
+
return { name, status: "warn", message, fix };
|
|
45
|
+
}
|
|
46
|
+
function fail(name, message, fix) {
|
|
47
|
+
return { name, status: "fail", message, fix };
|
|
48
|
+
}
|
|
49
|
+
function skip(name, message) {
|
|
50
|
+
return { name, status: "skip", message };
|
|
51
|
+
}
|
|
52
|
+
function statusIcon(s) {
|
|
53
|
+
if (s === "ok") return `${import_ui.green}\u2713${import_ui.reset}`;
|
|
54
|
+
if (s === "warn") return `${YELLOW}\u26A0${import_ui.reset}`;
|
|
55
|
+
if (s === "fail") return `${RED}\u2716${import_ui.reset}`;
|
|
56
|
+
return `${import_ui.dim}\u2013${import_ui.reset}`;
|
|
57
|
+
}
|
|
58
|
+
function register(program) {
|
|
59
|
+
program.command("doctor [projectPath]").description("Health check: index, config, hooks, and permissions").option("--fix", "Auto-repair fixable issues (hook permissions, stale lock file)").action(async (projectPath, opts) => {
|
|
60
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
61
|
+
const kirographDir = path.join(target, ".kirograph");
|
|
62
|
+
const dbPath = path.join(kirographDir, "kirograph.db");
|
|
63
|
+
const lockPath = path.join(kirographDir, "kirograph.lock");
|
|
64
|
+
const configPath = path.join(kirographDir, "config.json");
|
|
65
|
+
const globalDir = path.join(os.homedir(), ".kirograph");
|
|
66
|
+
const hooksDir = path.join(target, ".kiro", "hooks");
|
|
67
|
+
const checks = [];
|
|
68
|
+
if (!fs.existsSync(kirographDir)) {
|
|
69
|
+
checks.push(fail("index dir", `.kirograph/ not found \u2014 run \`kirograph init\``));
|
|
70
|
+
} else {
|
|
71
|
+
checks.push(pass("index dir", `.kirograph/ exists`));
|
|
72
|
+
if (!fs.existsSync(dbPath)) {
|
|
73
|
+
checks.push(fail("database", `kirograph.db not found \u2014 run \`kirograph index\``));
|
|
74
|
+
} else {
|
|
75
|
+
const stat = fs.statSync(dbPath);
|
|
76
|
+
const sizeMB = (stat.size / 1048576).toFixed(1);
|
|
77
|
+
checks.push(pass("database", `kirograph.db present (${sizeMB} MB)`));
|
|
78
|
+
}
|
|
79
|
+
if (fs.existsSync(lockPath)) {
|
|
80
|
+
const lockContent = fs.readFileSync(lockPath, "utf8").trim();
|
|
81
|
+
checks.push(warn(
|
|
82
|
+
"lock file",
|
|
83
|
+
`Stale lock held by: ${lockContent}`,
|
|
84
|
+
opts.fix ? () => {
|
|
85
|
+
fs.unlinkSync(lockPath);
|
|
86
|
+
} : void 0
|
|
87
|
+
));
|
|
88
|
+
} else {
|
|
89
|
+
checks.push(pass("lock file", "no stale lock"));
|
|
90
|
+
}
|
|
91
|
+
if (!fs.existsSync(configPath)) {
|
|
92
|
+
checks.push(skip("config", "config.json not found (using defaults)"));
|
|
93
|
+
} else {
|
|
94
|
+
try {
|
|
95
|
+
JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
96
|
+
checks.push(pass("config", "config.json is valid JSON"));
|
|
97
|
+
} catch (e) {
|
|
98
|
+
checks.push(fail("config", `config.json parse error: ${e.message}`));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
fs.accessSync(kirographDir, fs.constants.W_OK);
|
|
103
|
+
checks.push(pass("permissions", ".kirograph/ is writable"));
|
|
104
|
+
} catch {
|
|
105
|
+
const fix = opts.fix ? () => {
|
|
106
|
+
try {
|
|
107
|
+
fs.chmodSync(kirographDir, 493);
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
} : void 0;
|
|
111
|
+
checks.push(fail("permissions", ".kirograph/ is not writable", fix));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!fs.existsSync(globalDir)) {
|
|
115
|
+
checks.push(skip("global store", `~/.kirograph/ not found (created on first \`kirograph hook save\`)`));
|
|
116
|
+
} else {
|
|
117
|
+
checks.push(pass("global store", `~/.kirograph/ exists`));
|
|
118
|
+
const globalDb = path.join(globalDir, "kirograph.db");
|
|
119
|
+
if (fs.existsSync(globalDb)) {
|
|
120
|
+
const stat = fs.statSync(globalDb);
|
|
121
|
+
checks.push(pass("global db", `~/.kirograph/kirograph.db (${(stat.size / 1048576).toFixed(1)} MB)`));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (!fs.existsSync(hooksDir)) {
|
|
125
|
+
checks.push(skip("hooks", ".kiro/hooks/ not found (no workspace hooks installed)"));
|
|
126
|
+
} else {
|
|
127
|
+
let hookFiles = [];
|
|
128
|
+
try {
|
|
129
|
+
hookFiles = fs.readdirSync(hooksDir).filter((f) => f.endsWith(".kiro.hook"));
|
|
130
|
+
} catch {
|
|
131
|
+
checks.push(fail("hooks", ".kiro/hooks/ is not readable"));
|
|
132
|
+
}
|
|
133
|
+
if (hookFiles.length > 0) {
|
|
134
|
+
const brokenHooks = [];
|
|
135
|
+
for (const hf of hookFiles) {
|
|
136
|
+
const hp = path.join(hooksDir, hf);
|
|
137
|
+
try {
|
|
138
|
+
JSON.parse(fs.readFileSync(hp, "utf8"));
|
|
139
|
+
} catch {
|
|
140
|
+
brokenHooks.push(hf);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (brokenHooks.length > 0) {
|
|
144
|
+
checks.push(warn("hooks", `${brokenHooks.length} hook file(s) have invalid JSON: ${brokenHooks.join(", ")}`));
|
|
145
|
+
} else {
|
|
146
|
+
checks.push(pass("hooks", `${hookFiles.length} hook file(s) valid`));
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
checks.push(skip("hooks", ".kiro/hooks/ empty (no hooks installed)"));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const { execSync } = await import("child_process");
|
|
153
|
+
try {
|
|
154
|
+
const which = execSync("which kirograph 2>/dev/null || where kirograph 2>nul", { encoding: "utf8" }).trim();
|
|
155
|
+
checks.push(pass("binary", `kirograph found at ${which}`));
|
|
156
|
+
} catch {
|
|
157
|
+
checks.push(warn("binary", "kirograph not found in PATH \u2014 install via `npm install -g kirograph`"));
|
|
158
|
+
}
|
|
159
|
+
const fixable = checks.filter((c) => c.status !== "ok" && c.fix);
|
|
160
|
+
if (opts.fix && fixable.length > 0) {
|
|
161
|
+
for (const c of fixable) {
|
|
162
|
+
try {
|
|
163
|
+
c.fix();
|
|
164
|
+
c.status = "ok";
|
|
165
|
+
c.message += " (fixed)";
|
|
166
|
+
} catch (e) {
|
|
167
|
+
c.message += ` (fix failed: ${e.message})`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
console.log();
|
|
172
|
+
console.log((0, import_ui.section)(" KiroGraph Doctor"));
|
|
173
|
+
console.log(` ${import_ui.dim}Project: ${target}${import_ui.reset}`);
|
|
174
|
+
console.log();
|
|
175
|
+
const maxNameLen = Math.max(...checks.map((c) => c.name.length));
|
|
176
|
+
for (const c of checks) {
|
|
177
|
+
const icon = statusIcon(c.status);
|
|
178
|
+
const name = c.name.padEnd(maxNameLen);
|
|
179
|
+
const canFix = c.fix && !opts.fix ? ` ${import_ui.dim}(pass --fix to repair)${import_ui.reset}` : "";
|
|
180
|
+
console.log(` ${icon} ${(0, import_ui.label)(name)} ${c.message}${canFix}`);
|
|
181
|
+
}
|
|
182
|
+
const fails = checks.filter((c) => c.status === "fail").length;
|
|
183
|
+
const warns = checks.filter((c) => c.status === "warn").length;
|
|
184
|
+
console.log();
|
|
185
|
+
if (fails === 0 && warns === 0) {
|
|
186
|
+
console.log(` ${import_ui.green}${import_ui.bold}All checks passed.${import_ui.reset}`);
|
|
187
|
+
} else {
|
|
188
|
+
if (fails > 0) console.log(` ${RED}${fails} check(s) failed.${import_ui.reset}`);
|
|
189
|
+
if (warns > 0) console.log(` ${YELLOW}${warns} warning(s).${import_ui.reset}`);
|
|
190
|
+
if (!opts.fix && fixable.length > 0) {
|
|
191
|
+
console.log(` ${import_ui.dim}Run \`kirograph doctor --fix\` to auto-repair ${fixable.length} issue(s).${import_ui.reset}`);
|
|
192
|
+
}
|
|
193
|
+
process.exitCode = fails > 0 ? 1 : 0;
|
|
194
|
+
}
|
|
195
|
+
console.log();
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
199
|
+
0 && (module.exports = {
|
|
200
|
+
register
|
|
201
|
+
});
|
|
202
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/doctor.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport { dim, reset, green, bold, section, label } from '../ui';\n\nconst RED = '\\x1b[38;5;203m';\nconst YELLOW = '\\x1b[38;5;227m';\n\ntype CheckStatus = 'ok' | 'warn' | 'fail' | 'skip';\n\ninterface Check {\n name: string;\n status: CheckStatus;\n message: string;\n fix?: () => void;\n}\n\nfunction pass(name: string, message: string): Check { return { name, status: 'ok', message }; }\nfunction warn(name: string, message: string, fix?: () => void): Check { return { name, status: 'warn', message, fix }; }\nfunction fail(name: string, message: string, fix?: () => void): Check { return { name, status: 'fail', message, fix }; }\nfunction skip(name: string, message: string): Check { return { name, status: 'skip', message }; }\n\nfunction statusIcon(s: CheckStatus): string {\n if (s === 'ok') return `${green}\u2713${reset}`;\n if (s === 'warn') return `${YELLOW}\u26A0${reset}`;\n if (s === 'fail') return `${RED}\u2716${reset}`;\n return `${dim}\u2013${reset}`;\n}\n\nexport function register(program: Command): void {\n program\n .command('doctor [projectPath]')\n .description('Health check: index, config, hooks, and permissions')\n .option('--fix', 'Auto-repair fixable issues (hook permissions, stale lock file)')\n .action(async (projectPath: string | undefined, opts: { fix?: boolean }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const kirographDir = path.join(target, '.kirograph');\n const dbPath = path.join(kirographDir, 'kirograph.db');\n const lockPath = path.join(kirographDir, 'kirograph.lock');\n const configPath = path.join(kirographDir, 'config.json');\n const globalDir = path.join(os.homedir(), '.kirograph');\n const hooksDir = path.join(target, '.kiro', 'hooks');\n\n const checks: Check[] = [];\n\n // \u2500\u2500 Index \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (!fs.existsSync(kirographDir)) {\n checks.push(fail('index dir', `.kirograph/ not found \u2014 run \\`kirograph init\\``));\n } else {\n checks.push(pass('index dir', `.kirograph/ exists`));\n\n if (!fs.existsSync(dbPath)) {\n checks.push(fail('database', `kirograph.db not found \u2014 run \\`kirograph index\\``));\n } else {\n const stat = fs.statSync(dbPath);\n const sizeMB = (stat.size / 1_048_576).toFixed(1);\n checks.push(pass('database', `kirograph.db present (${sizeMB} MB)`));\n }\n\n // Stale lock\n if (fs.existsSync(lockPath)) {\n const lockContent = fs.readFileSync(lockPath, 'utf8').trim();\n checks.push(warn('lock file', `Stale lock held by: ${lockContent}`,\n opts.fix ? () => { fs.unlinkSync(lockPath); } : undefined));\n } else {\n checks.push(pass('lock file', 'no stale lock'));\n }\n\n // Config validity\n if (!fs.existsSync(configPath)) {\n checks.push(skip('config', 'config.json not found (using defaults)'));\n } else {\n try {\n JSON.parse(fs.readFileSync(configPath, 'utf8'));\n checks.push(pass('config', 'config.json is valid JSON'));\n } catch (e) {\n checks.push(fail('config', `config.json parse error: ${(e as Error).message}`));\n }\n }\n\n // Permissions\n try {\n fs.accessSync(kirographDir, fs.constants.W_OK);\n checks.push(pass('permissions', '.kirograph/ is writable'));\n } catch {\n const fix = opts.fix\n ? () => { try { fs.chmodSync(kirographDir, 0o755); } catch { /* ignore */ } }\n : undefined;\n checks.push(fail('permissions', '.kirograph/ is not writable', fix));\n }\n }\n\n // \u2500\u2500 Global store \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (!fs.existsSync(globalDir)) {\n checks.push(skip('global store', `~/.kirograph/ not found (created on first \\`kirograph hook save\\`)`));\n } else {\n checks.push(pass('global store', `~/.kirograph/ exists`));\n const globalDb = path.join(globalDir, 'kirograph.db');\n if (fs.existsSync(globalDb)) {\n const stat = fs.statSync(globalDb);\n checks.push(pass('global db', `~/.kirograph/kirograph.db (${(stat.size / 1_048_576).toFixed(1)} MB)`));\n }\n }\n\n // \u2500\u2500 Hooks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (!fs.existsSync(hooksDir)) {\n checks.push(skip('hooks', '.kiro/hooks/ not found (no workspace hooks installed)'));\n } else {\n let hookFiles: string[] = [];\n try {\n hookFiles = fs.readdirSync(hooksDir).filter(f => f.endsWith('.kiro.hook'));\n } catch {\n checks.push(fail('hooks', '.kiro/hooks/ is not readable'));\n }\n if (hookFiles.length > 0) {\n const brokenHooks: string[] = [];\n for (const hf of hookFiles) {\n const hp = path.join(hooksDir, hf);\n try {\n JSON.parse(fs.readFileSync(hp, 'utf8'));\n } catch {\n brokenHooks.push(hf);\n }\n }\n if (brokenHooks.length > 0) {\n checks.push(warn('hooks', `${brokenHooks.length} hook file(s) have invalid JSON: ${brokenHooks.join(', ')}`));\n } else {\n checks.push(pass('hooks', `${hookFiles.length} hook file(s) valid`));\n }\n } else {\n checks.push(skip('hooks', '.kiro/hooks/ empty (no hooks installed)'));\n }\n }\n\n // \u2500\u2500 Binary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const { execSync } = await import('child_process');\n try {\n const which = execSync('which kirograph 2>/dev/null || where kirograph 2>nul', { encoding: 'utf8' }).trim();\n checks.push(pass('binary', `kirograph found at ${which}`));\n } catch {\n checks.push(warn('binary', 'kirograph not found in PATH \u2014 install via `npm install -g kirograph`'));\n }\n\n // \u2500\u2500 Apply fixes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const fixable = checks.filter(c => c.status !== 'ok' && c.fix);\n if (opts.fix && fixable.length > 0) {\n for (const c of fixable) {\n try {\n c.fix!();\n c.status = 'ok';\n c.message += ' (fixed)';\n } catch (e) {\n c.message += ` (fix failed: ${(e as Error).message})`;\n }\n }\n }\n\n // \u2500\u2500 Print results \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n console.log();\n console.log(section(' KiroGraph Doctor'));\n console.log(` ${dim}Project: ${target}${reset}`);\n console.log();\n\n const maxNameLen = Math.max(...checks.map(c => c.name.length));\n for (const c of checks) {\n const icon = statusIcon(c.status);\n const name = c.name.padEnd(maxNameLen);\n const canFix = c.fix && !opts.fix ? ` ${dim}(pass --fix to repair)${reset}` : '';\n console.log(` ${icon} ${label(name)} ${c.message}${canFix}`);\n }\n\n const fails = checks.filter(c => c.status === 'fail').length;\n const warns = checks.filter(c => c.status === 'warn').length;\n console.log();\n if (fails === 0 && warns === 0) {\n console.log(` ${green}${bold}All checks passed.${reset}`);\n } else {\n if (fails > 0) console.log(` ${RED}${fails} check(s) failed.${reset}`);\n if (warns > 0) console.log(` ${YELLOW}${warns} warning(s).${reset}`);\n if (!opts.fix && fixable.length > 0) {\n console.log(` ${dim}Run \\`kirograph doctor --fix\\` to auto-repair ${fixable.length} issue(s).${reset}`);\n }\n process.exitCode = fails > 0 ? 1 : 0;\n }\n console.log();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,SAAoB;AACpB,gBAAwD;AAExD,MAAM,MAAQ;AACd,MAAM,SAAS;AAWf,SAAS,KAAK,MAAc,SAAwB;AAAE,SAAO,EAAE,MAAM,QAAQ,MAAM,QAAQ;AAAG;AAC9F,SAAS,KAAK,MAAc,SAAiB,KAAyB;AAAE,SAAO,EAAE,MAAM,QAAQ,QAAQ,SAAS,IAAI;AAAG;AACvH,SAAS,KAAK,MAAc,SAAiB,KAAyB;AAAE,SAAO,EAAE,MAAM,QAAQ,QAAQ,SAAS,IAAI;AAAG;AACvH,SAAS,KAAK,MAAc,SAAwB;AAAE,SAAO,EAAE,MAAM,QAAQ,QAAQ,QAAQ;AAAG;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,eAAK,EAAE;AAAA,MACzG;AACA,cAAQ,WAAW,QAAQ,IAAI,IAAI;AAAA,IACrC;AACA,YAAQ,IAAI;AAAA,EACd,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 dsm_exports = {};
|
|
30
|
+
__export(dsm_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(dsm_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("dsm [projectPath]").description("Dependency Structure Matrix \u2014 detect strongly coupled module groups").option("--limit <n>", "Max groups to show (default: 15)", "15").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
const limit = parseInt(opts.limit) || 15;
|
|
49
|
+
await runTool(target, "kirograph_dsm", { limit });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
register
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=dsm.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/dsm.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('dsm [projectPath]')\n .description('Dependency Structure Matrix \u2014 detect strongly coupled module groups')\n .option('--limit <n>', 'Max groups to show (default: 15)', '15')\n .action(async (projectPath: string | undefined, opts: { limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 15;\n await runTool(target, 'kirograph_dsm', { 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,mBAAmB,EAC3B,YAAY,0EAAqE,EACjF,OAAO,eAAe,oCAAoC,IAAI,EAC9D,OAAO,OAAO,aAAiC,SAA4B;AAC1E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,iBAAiB,EAAE,MAAM,CAAC;AAAA,EAClD,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 gini_exports = {};
|
|
30
|
+
__export(gini_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(gini_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("gini [projectPath]").description("Compute Gini inequality coefficient on a metric across function/method nodes").option("--metric <m>", "Metric to use: loc | fan-in | fan-out (default: loc)", "loc").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
await runTool(target, "kirograph_gini", { metric: opts.metric });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
register
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=gini.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/gini.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('gini [projectPath]')\n .description('Compute Gini inequality coefficient on a metric across function/method nodes')\n .option('--metric <m>', 'Metric to use: loc | fan-in | fan-out (default: loc)', 'loc')\n .action(async (projectPath: string | undefined, opts: { metric: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_gini', { metric: opts.metric });\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,oBAAoB,EAC5B,YAAY,8EAA8E,EAC1F,OAAO,gBAAgB,wDAAwD,KAAK,EACpF,OAAO,OAAO,aAAiC,SAA6B;AAC3E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,kBAAkB,EAAE,QAAQ,KAAK,OAAO,CAAC;AAAA,EACjE,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 god_class_exports = {};
|
|
30
|
+
__export(god_class_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(god_class_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("god-class [projectPath]").description("Classes ranked by member count").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_god_class", { limit });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
register
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=god-class.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/god-class.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('god-class [projectPath]')\n .description('Classes ranked by member count')\n .option('--limit <n>', 'Max results', '20')\n .action(async (projectPath: string | undefined, opts: { limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const limit = parseInt(opts.limit) || 20;\n await runTool(target, 'kirograph_god_class', { 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,yBAAyB,EACjC,YAAY,gCAAgC,EAC5C,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,OAAO,aAAiC,SAA4B;AAC1E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,SAAS,KAAK,KAAK,KAAK;AACtC,UAAM,QAAQ,QAAQ,uBAAuB,EAAE,MAAM,CAAC;AAAA,EACxD,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 health_exports = {};
|
|
30
|
+
__export(health_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(health_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("health [projectPath]").description("Show overall codebase health metrics").action(async (projectPath) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
await runTool(target, "kirograph_health", {});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
register
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/health.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('health [projectPath]')\n .description('Show overall codebase health metrics')\n .action(async (projectPath: string | undefined) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_health', {});\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,sBAAsB,EAC9B,YAAY,sCAAsC,EAClD,OAAO,OAAO,gBAAoC;AACjD,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,oBAAoB,CAAC,CAAC;AAAA,EAC9C,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|