kirograph 0.13.1 → 0.14.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 +191 -8
- package/dist/bin/commands/caveman.js +7 -2
- package/dist/bin/commands/caveman.js.map +2 -2
- package/dist/bin/commands/compression.js +109 -0
- package/dist/bin/commands/compression.js.map +7 -0
- package/dist/bin/commands/context.js +31 -24
- package/dist/bin/commands/context.js.map +2 -2
- package/dist/bin/commands/exec.js +107 -0
- package/dist/bin/commands/exec.js.map +7 -0
- package/dist/bin/commands/gain.js +119 -0
- package/dist/bin/commands/gain.js.map +7 -0
- package/dist/bin/commands/help.js +10 -1
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/query.js +5 -1
- package/dist/bin/commands/query.js.map +2 -2
- package/dist/bin/commands/uninit.js +1 -1
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/utils.js +16 -0
- package/dist/bin/commands/utils.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +9 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/hooks.js +19 -1
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.js +6 -1
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/steering.js +116 -40
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/kiro.js +4 -2
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/kirograph.js +7 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/compression/filters/aws.js +418 -0
- package/dist/compression/filters/aws.js.map +7 -0
- package/dist/compression/filters/docker.js +153 -0
- package/dist/compression/filters/docker.js.map +7 -0
- package/dist/compression/filters/files.js +150 -0
- package/dist/compression/filters/files.js.map +7 -0
- package/dist/compression/filters/generic.js +86 -0
- package/dist/compression/filters/generic.js.map +7 -0
- package/dist/compression/filters/git.js +272 -0
- package/dist/compression/filters/git.js.map +7 -0
- package/dist/compression/filters/github.js +137 -0
- package/dist/compression/filters/github.js.map +7 -0
- package/dist/compression/filters/lint.js +280 -0
- package/dist/compression/filters/lint.js.map +7 -0
- package/dist/compression/filters/misc.js +212 -0
- package/dist/compression/filters/misc.js.map +7 -0
- package/dist/compression/filters/package.js +151 -0
- package/dist/compression/filters/package.js.map +7 -0
- package/dist/compression/filters/test.js +266 -0
- package/dist/compression/filters/test.js.map +7 -0
- package/dist/compression/index.js +144 -0
- package/dist/compression/index.js.map +7 -0
- package/dist/compression/naive-cost.js +94 -0
- package/dist/compression/naive-cost.js.map +7 -0
- package/dist/compression/tracker.js +228 -0
- package/dist/compression/tracker.js.map +7 -0
- package/dist/compression/types.js +17 -0
- package/dist/compression/types.js.map +7 -0
- package/dist/config.js +18 -1
- package/dist/config.js.map +2 -2
- package/dist/mcp/tool-names.js +3 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +170 -4
- package/dist/mcp/tools.js.map +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var exec_exports = {};
|
|
20
|
+
__export(exec_exports, {
|
|
21
|
+
register: () => register
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(exec_exports);
|
|
24
|
+
var import_child_process = require("child_process");
|
|
25
|
+
var import_compression = require("../../compression/index");
|
|
26
|
+
var import_tracker = require("../../compression/tracker");
|
|
27
|
+
var import_config = require("../../config");
|
|
28
|
+
var import_ui = require("../ui");
|
|
29
|
+
function register(program) {
|
|
30
|
+
program.command("exec").description("Run a shell command and return token-optimized output").option("-l, --level <level>", "Compression level: normal, aggressive, ultra").option("-t, --timeout <seconds>", "Timeout in seconds", "60").option("--raw", "Also print the raw output for comparison").option("--json", "Output result as JSON").allowUnknownOption(true).allowExcessArguments(true).action(async (opts, cmd) => {
|
|
31
|
+
const args = cmd.args;
|
|
32
|
+
if (args.length === 0) {
|
|
33
|
+
console.error(" Usage: kirograph exec <command...>");
|
|
34
|
+
console.error(" Example: kirograph exec git status");
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const shellCommand = args.join(" ");
|
|
38
|
+
const cwd = process.cwd();
|
|
39
|
+
const timeout = (parseInt(opts.timeout || "60", 10) || 60) * 1e3;
|
|
40
|
+
let defaultLevel = "normal";
|
|
41
|
+
try {
|
|
42
|
+
const config = await (0, import_config.loadConfig)(cwd);
|
|
43
|
+
if (config.shellCompressionLevel && config.shellCompressionLevel !== "off") {
|
|
44
|
+
defaultLevel = config.shellCompressionLevel;
|
|
45
|
+
}
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
const level = opts.level || defaultLevel;
|
|
49
|
+
const validLevels = ["normal", "aggressive", "ultra"];
|
|
50
|
+
if (!validLevels.includes(level)) {
|
|
51
|
+
console.error(` Unknown level: ${level}. Choose from: normal, aggressive, ultra`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
let rawOutput;
|
|
55
|
+
let exitCode = 0;
|
|
56
|
+
try {
|
|
57
|
+
rawOutput = (0, import_child_process.execSync)(shellCommand, {
|
|
58
|
+
cwd,
|
|
59
|
+
timeout,
|
|
60
|
+
encoding: "utf8",
|
|
61
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
62
|
+
maxBuffer: 10 * 1024 * 1024
|
|
63
|
+
});
|
|
64
|
+
} catch (err) {
|
|
65
|
+
rawOutput = (err.stdout || "") + (err.stderr || "");
|
|
66
|
+
exitCode = err.status ?? 1;
|
|
67
|
+
}
|
|
68
|
+
const result = (0, import_compression.compress)(shellCommand, rawOutput, { level, preserveErrors: exitCode !== 0 });
|
|
69
|
+
const tracker = new import_tracker.TokenTracker(cwd);
|
|
70
|
+
tracker.record(shellCommand, result.originalTokens, result.compressedTokens, result.strategy);
|
|
71
|
+
if (opts.json) {
|
|
72
|
+
console.log(JSON.stringify({
|
|
73
|
+
command: shellCommand,
|
|
74
|
+
exitCode,
|
|
75
|
+
level,
|
|
76
|
+
strategy: result.strategy,
|
|
77
|
+
commandFamily: result.commandFamily,
|
|
78
|
+
originalTokens: result.originalTokens,
|
|
79
|
+
compressedTokens: result.compressedTokens,
|
|
80
|
+
savings: result.savings,
|
|
81
|
+
output: result.output
|
|
82
|
+
}, null, 2));
|
|
83
|
+
process.exit(exitCode);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (opts.raw) {
|
|
87
|
+
console.log(`${import_ui.dim}\u2500\u2500 raw (${result.originalTokens} tokens) \u2500\u2500${import_ui.reset}`);
|
|
88
|
+
console.log(rawOutput);
|
|
89
|
+
console.log(`${import_ui.dim}\u2500\u2500 compressed (${result.compressedTokens} tokens) \u2500\u2500${import_ui.reset}`);
|
|
90
|
+
}
|
|
91
|
+
if (exitCode !== 0) {
|
|
92
|
+
process.stderr.write(result.output + "\n");
|
|
93
|
+
} else {
|
|
94
|
+
console.log(result.output);
|
|
95
|
+
}
|
|
96
|
+
if (result.savings > 5) {
|
|
97
|
+
console.log(`
|
|
98
|
+
${import_ui.dim}[${import_ui.green}${result.savings}% saved${import_ui.reset}${import_ui.dim} | ${result.originalTokens}\u2192${result.compressedTokens} tokens | ${import_ui.violet}${result.strategy}${import_ui.reset}${import_ui.dim}]${import_ui.reset}`);
|
|
99
|
+
}
|
|
100
|
+
process.exit(exitCode);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
register
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/exec.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * kirograph exec <command...> \u2014 Run a shell command with token-optimized output\n *\n * Examples:\n * kirograph exec git status\n * kirograph exec --level aggressive npm test\n * kirograph exec -l ultra ls -la src/\n */\n\nimport { Command } from 'commander';\nimport { execSync } from 'child_process';\nimport { compress } from '../../compression/index';\nimport { TokenTracker } from '../../compression/tracker';\nimport { loadConfig } from '../../config';\nimport { dim, green, reset, violet } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('exec')\n .description('Run a shell command and return token-optimized output')\n .option('-l, --level <level>', 'Compression level: normal, aggressive, ultra')\n .option('-t, --timeout <seconds>', 'Timeout in seconds', '60')\n .option('--raw', 'Also print the raw output for comparison')\n .option('--json', 'Output result as JSON')\n .allowUnknownOption(true)\n .allowExcessArguments(true)\n .action(async (opts: { level?: string; timeout?: string; raw?: boolean; json?: boolean }, cmd: Command) => {\n // Everything after \"exec\" and known options is the command to run\n const args = cmd.args;\n if (args.length === 0) {\n console.error(' Usage: kirograph exec <command...>');\n console.error(' Example: kirograph exec git status');\n process.exit(1);\n }\n\n const shellCommand = args.join(' ');\n const cwd = process.cwd();\n const timeout = (parseInt(opts.timeout || '60', 10) || 60) * 1000;\n\n // Read default level from config\n let defaultLevel: 'normal' | 'aggressive' | 'ultra' = 'normal';\n try {\n const config = await loadConfig(cwd);\n if (config.shellCompressionLevel && config.shellCompressionLevel !== 'off') {\n defaultLevel = config.shellCompressionLevel as 'normal' | 'aggressive' | 'ultra';\n }\n } catch { /* no config */ }\n\n const level = (opts.level as 'normal' | 'aggressive' | 'ultra') || defaultLevel;\n const validLevels = ['normal', 'aggressive', 'ultra'];\n if (!validLevels.includes(level)) {\n console.error(` Unknown level: ${level}. Choose from: normal, aggressive, ultra`);\n process.exit(1);\n }\n\n // Execute the command\n let rawOutput: string;\n let exitCode = 0;\n try {\n rawOutput = execSync(shellCommand, {\n cwd,\n timeout,\n encoding: 'utf8',\n stdio: ['pipe', 'pipe', 'pipe'],\n maxBuffer: 10 * 1024 * 1024,\n });\n } catch (err: any) {\n rawOutput = (err.stdout || '') + (err.stderr || '');\n exitCode = err.status ?? 1;\n }\n\n // Compress\n const result = compress(shellCommand, rawOutput, { level, preserveErrors: exitCode !== 0 });\n\n // Track savings\n const tracker = new TokenTracker(cwd);\n tracker.record(shellCommand, result.originalTokens, result.compressedTokens, result.strategy);\n\n // Output\n if (opts.json) {\n console.log(JSON.stringify({\n command: shellCommand,\n exitCode,\n level,\n strategy: result.strategy,\n commandFamily: result.commandFamily,\n originalTokens: result.originalTokens,\n compressedTokens: result.compressedTokens,\n savings: result.savings,\n output: result.output,\n }, null, 2));\n process.exit(exitCode);\n return;\n }\n\n if (opts.raw) {\n console.log(`${dim}\u2500\u2500 raw (${result.originalTokens} tokens) \u2500\u2500${reset}`);\n console.log(rawOutput);\n console.log(`${dim}\u2500\u2500 compressed (${result.compressedTokens} tokens) \u2500\u2500${reset}`);\n }\n\n // Print compressed output\n if (exitCode !== 0) {\n process.stderr.write(result.output + '\\n');\n } else {\n console.log(result.output);\n }\n\n // Print savings footer\n if (result.savings > 5) {\n console.log(`\\n${dim}[${green}${result.savings}% saved${reset}${dim} | ${result.originalTokens}\u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AG,OAAO,QAAQ,GAAG,eAAK,GAAG,aAAG,IAAI,eAAK,EAAE;AAAA,IACzL;AAEA,YAAQ,KAAK,QAAQ;AAAA,EACvB,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var gain_exports = {};
|
|
20
|
+
__export(gain_exports, {
|
|
21
|
+
register: () => register
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(gain_exports);
|
|
24
|
+
function register(program) {
|
|
25
|
+
program.command("gain").description("Show token savings from kirograph_exec compression").option("--graph", "Show ASCII graph of daily savings").option("--history", "Show recent command history").option("--daily", "Show day-by-day breakdown").option("--period <period>", "Time period: session, today, week, all", "all").option("--json", "Output as JSON").action(async (opts) => {
|
|
26
|
+
const { TokenTracker } = await Promise.resolve().then(() => require("../../compression/tracker.js"));
|
|
27
|
+
const tracker = new TokenTracker(process.cwd());
|
|
28
|
+
if (opts.history) {
|
|
29
|
+
const history = tracker.getHistory(20);
|
|
30
|
+
if (history.length === 0) {
|
|
31
|
+
console.log(" No commands recorded yet. Use kirograph_exec to run commands with compression.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (opts.json) {
|
|
35
|
+
console.log(JSON.stringify(history, null, 2));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.log(" Recent compressed commands:\n");
|
|
39
|
+
for (const r of history) {
|
|
40
|
+
const date = new Date(r.timestamp).toLocaleString();
|
|
41
|
+
const savings = r.originalTokens > 0 ? Math.round((r.originalTokens - r.compressedTokens) / r.originalTokens * 100) : 0;
|
|
42
|
+
const cmd = r.command.length > 50 ? r.command.slice(0, 47) + "..." : r.command;
|
|
43
|
+
console.log(` ${date} ${cmd.padEnd(50)} ${savings}% saved (${r.strategy})`);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (opts.daily || opts.graph) {
|
|
48
|
+
const daily = tracker.getDailyBreakdown(30);
|
|
49
|
+
if (daily.length === 0) {
|
|
50
|
+
console.log(" No data yet.");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (opts.json) {
|
|
54
|
+
console.log(JSON.stringify(daily, null, 2));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (opts.graph) {
|
|
58
|
+
console.log(" Token savings (last 30 days):\n");
|
|
59
|
+
const maxSaved = Math.max(...daily.map((d) => d.saved), 1);
|
|
60
|
+
const barWidth = 40;
|
|
61
|
+
for (const day of daily) {
|
|
62
|
+
const bar = "\u2588".repeat(Math.round(day.saved / maxSaved * barWidth));
|
|
63
|
+
const label = day.date.slice(5);
|
|
64
|
+
console.log(` ${label} ${bar} ${day.saved.toLocaleString()} tokens (${day.commands} cmds)`);
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
console.log(" Daily breakdown:\n");
|
|
69
|
+
console.log(" Date Commands Tokens Saved");
|
|
70
|
+
console.log(" " + "\u2500".repeat(40));
|
|
71
|
+
for (const day of daily) {
|
|
72
|
+
console.log(` ${day.date} ${String(day.commands).padStart(8)} ${day.saved.toLocaleString().padStart(12)}`);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const period = opts.period;
|
|
77
|
+
const stats = tracker.getStats(period);
|
|
78
|
+
if (stats.totalCommands === 0) {
|
|
79
|
+
console.log(" No savings recorded yet.");
|
|
80
|
+
console.log(" Use kirograph tools and kirograph exec . Savings are tracked automatically.");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (opts.json) {
|
|
84
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
console.log(`
|
|
88
|
+
Token Savings (${period}):`);
|
|
89
|
+
console.log(` ${"\u2500".repeat(50)}`);
|
|
90
|
+
console.log(` Total calls: ${stats.totalCommands}`);
|
|
91
|
+
console.log(` Tokens without KiroGraph: ~${stats.totalOriginal.toLocaleString()}`);
|
|
92
|
+
console.log(` Tokens with KiroGraph: ~${stats.totalCompressed.toLocaleString()}`);
|
|
93
|
+
console.log(` Saved: ~${stats.totalSaved.toLocaleString()} (${stats.savingsPercent}%)`);
|
|
94
|
+
if (stats.bySource.exec.count > 0 || stats.bySource.graph.count > 0) {
|
|
95
|
+
console.log(`
|
|
96
|
+
By source:`);
|
|
97
|
+
if (stats.bySource.graph.count > 0) {
|
|
98
|
+
console.log(` \u{1F4CA} Graph tools: ${String(stats.bySource.graph.count).padStart(4)} calls ~${stats.bySource.graph.saved.toLocaleString()} tokens saved (vs file reads/grep)`);
|
|
99
|
+
}
|
|
100
|
+
if (stats.bySource.exec.count > 0) {
|
|
101
|
+
console.log(` \u26A1 Compression: ${String(stats.bySource.exec.count).padStart(4)} calls ~${stats.bySource.exec.saved.toLocaleString()} tokens saved (vs raw output)`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (Object.keys(stats.byFamily).length > 0) {
|
|
105
|
+
console.log(`
|
|
106
|
+
By family:`);
|
|
107
|
+
for (const [family, data] of Object.entries(stats.byFamily)) {
|
|
108
|
+
const icon = family.startsWith("graph") ? "\u{1F4CA}" : "\u26A1";
|
|
109
|
+
console.log(` ${icon} ${family.padEnd(20)} ${String(data.count).padStart(4)} calls ${data.savings}% avg savings`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
console.log();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
register
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=gain.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/gain.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * kirograph gain \u2014 Token savings analytics CLI command\n */\n\nimport { Command } from 'commander';\n\nexport function register(program: Command): void {\n program\n .command('gain')\n .description('Show token savings from kirograph_exec compression')\n .option('--graph', 'Show ASCII graph of daily savings')\n .option('--history', 'Show recent command history')\n .option('--daily', 'Show day-by-day breakdown')\n .option('--period <period>', 'Time period: session, today, week, all', 'all')\n .option('--json', 'Output as JSON')\n .action(async (opts: { graph?: boolean; history?: boolean; daily?: boolean; period: string; json?: boolean }) => {\n const { TokenTracker } = await Promise.resolve().then(() => require('../../compression/tracker.js'));\n const tracker = new TokenTracker(process.cwd());\n\n if (opts.history) {\n const history = tracker.getHistory(20);\n if (history.length === 0) {\n console.log(' No commands recorded yet. Use kirograph_exec to run commands with compression.');\n return;\n }\n\n if (opts.json) {\n console.log(JSON.stringify(history, null, 2));\n return;\n }\n\n console.log(' Recent compressed commands:\\n');\n for (const r of history) {\n const date = new Date(r.timestamp).toLocaleString();\n const savings = r.originalTokens > 0\n ? Math.round(((r.originalTokens - r.compressedTokens) / r.originalTokens) * 100)\n : 0;\n const cmd = r.command.length > 50 ? r.command.slice(0, 47) + '...' : r.command;\n console.log(` ${date} ${cmd.padEnd(50)} ${savings}% saved (${r.strategy})`);\n }\n return;\n }\n\n if (opts.daily || opts.graph) {\n const daily = tracker.getDailyBreakdown(30);\n if (daily.length === 0) {\n console.log(' No data yet.');\n return;\n }\n\n if (opts.json) {\n console.log(JSON.stringify(daily, null, 2));\n return;\n }\n\n if (opts.graph) {\n console.log(' Token savings (last 30 days):\\n');\n const maxSaved = Math.max(...daily.map(d => d.saved), 1);\n const barWidth = 40;\n\n for (const day of daily) {\n const bar = '\u2588'.repeat(Math.round((day.saved / maxSaved) * barWidth));\n const label = day.date.slice(5); // MM-DD\n console.log(` ${label} ${bar} ${day.saved.toLocaleString()} tokens (${day.commands} cmds)`);\n }\n return;\n }\n\n console.log(' Daily breakdown:\\n');\n console.log(' Date Commands Tokens Saved');\n console.log(' ' + '\u2500'.repeat(40));\n for (const day of daily) {\n console.log(` ${day.date} ${String(day.commands).padStart(8)} ${day.saved.toLocaleString().padStart(12)}`);\n }\n return;\n }\n\n // Default: summary stats\n const period = opts.period as 'session' | 'today' | 'week' | 'all';\n const stats = tracker.getStats(period);\n\n if (stats.totalCommands === 0) {\n console.log(' No savings recorded yet.');\n console.log(' Use kirograph tools and kirograph exec . Savings are tracked automatically.');\n return;\n }\n\n if (opts.json) {\n console.log(JSON.stringify(stats, null, 2));\n return;\n }\n\n console.log(`\\n Token Savings (${period}):`);\n console.log(` ${'\u2500'.repeat(50)}`);\n console.log(` Total calls: ${stats.totalCommands}`);\n console.log(` Tokens without KiroGraph: ~${stats.totalOriginal.toLocaleString()}`);\n console.log(` Tokens with KiroGraph: ~${stats.totalCompressed.toLocaleString()}`);\n console.log(` Saved: ~${stats.totalSaved.toLocaleString()} (${stats.savingsPercent}%)`);\n\n // Source breakdown\n if (stats.bySource.exec.count > 0 || stats.bySource.graph.count > 0) {\n console.log(`\\n By source:`);\n if (stats.bySource.graph.count > 0) {\n console.log(` \uD83D\uDCCA Graph tools: ${String(stats.bySource.graph.count).padStart(4)} calls ~${stats.bySource.graph.saved.toLocaleString()} tokens saved (vs file reads/grep)`);\n }\n if (stats.bySource.exec.count > 0) {\n console.log(` \u26A1 Compression: ${String(stats.bySource.exec.count).padStart(4)} calls ~${stats.bySource.exec.saved.toLocaleString()} tokens saved (vs raw output)`);\n }\n }\n\n if (Object.keys(stats.byFamily).length > 0) {\n console.log(`\\n By family:`);\n for (const [family, data] of Object.entries(stats.byFamily)) {\n const icon = family.startsWith('graph') ? '\uD83D\uDCCA' : '\u26A1';\n console.log(` ${icon} ${family.padEnd(20)} ${String(data.count).padStart(4)} calls ${data.savings}% avg savings`);\n }\n }\n\n console.log();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,MAAM,EACd,YAAY,oDAAoD,EAChE,OAAO,WAAW,mCAAmC,EACrD,OAAO,aAAa,6BAA6B,EACjD,OAAO,WAAW,2BAA2B,EAC7C,OAAO,qBAAqB,0CAA0C,KAAK,EAC3E,OAAO,UAAU,gBAAgB,EACjC,OAAO,OAAO,SAAkG;AAC/G,UAAM,EAAE,aAAa,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,8BAA8B,CAAC;AACnG,UAAM,UAAU,IAAI,aAAa,QAAQ,IAAI,CAAC;AAE9C,QAAI,KAAK,SAAS;AAChB,YAAM,UAAU,QAAQ,WAAW,EAAE;AACrC,UAAI,QAAQ,WAAW,GAAG;AACxB,gBAAQ,IAAI,kFAAkF;AAC9F;AAAA,MACF;AAEA,UAAI,KAAK,MAAM;AACb,gBAAQ,IAAI,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAC5C;AAAA,MACF;AAEA,cAAQ,IAAI,iCAAiC;AAC7C,iBAAW,KAAK,SAAS;AACvB,cAAM,OAAO,IAAI,KAAK,EAAE,SAAS,EAAE,eAAe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AAS,GAAG;AAC1C,cAAQ,IAAI;AAAA,aAAgB;AAC5B,iBAAW,CAAC,QAAQ,IAAI,KAAK,OAAO,QAAQ,MAAM,QAAQ,GAAG;AAC3D,cAAM,OAAO,OAAO,WAAW,OAAO,IAAI,cAAO;AACjD,gBAAQ,IAAI,OAAO,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC,IAAI,OAAO,KAAK,KAAK,EAAE,SAAS,CAAC,CAAC,WAAW,KAAK,OAAO,eAAe;AAAA,MACtH;AAAA,IACF;AAEA,YAAQ,IAAI;AAAA,EACd,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -89,6 +89,9 @@ function printColoredHelp() {
|
|
|
89
89
|
title: "\u2699\uFE0F Agent & Configuration",
|
|
90
90
|
commands: [
|
|
91
91
|
{ name: "caveman", args: "[mode]", desc: "Set agent communication style (off | lite | full | ultra)" },
|
|
92
|
+
{ name: "compression", args: "[level]", desc: "Set shell compression level (off | normal | aggressive | ultra)" },
|
|
93
|
+
{ name: "exec", args: "<command...>", desc: "Run a shell command with token-optimized output", opts: ["-l, --level <l> normal | aggressive | ultra", "-t, --timeout <s> Timeout in seconds (default 60)", "--raw Show raw + compressed for comparison", "--json Output as JSON"] },
|
|
94
|
+
{ name: "gain", desc: "Show token savings from compressed command outputs", opts: ["--graph ASCII graph (last 30 days)", "--history Recent command history", "--daily Day-by-day breakdown", "--period <p> session | today | week | all"] },
|
|
92
95
|
{ name: "serve", desc: "Start the MCP server", opts: ["--mcp Run as MCP stdio server", "--path <p> Project path"] },
|
|
93
96
|
{ name: "dashboard", desc: "Manage the Qdrant or Typesense dashboard server", opts: ["start [path] Start server and open dashboard", "stop [path] Stop the running server"] }
|
|
94
97
|
]
|
|
@@ -113,7 +116,7 @@ ${c.bold}${c.paleLavender}USAGE${c.reset}`);
|
|
|
113
116
|
console.log(`${prefix}${namePart}${pad}${c.gray}${cmd.desc}${c.reset}`);
|
|
114
117
|
if (isCaveman) {
|
|
115
118
|
const inspiredPad = " ".repeat(3 + nameWidth);
|
|
116
|
-
console.log(`${inspiredPad}${c.dim}Inspired by Caveman
|
|
119
|
+
console.log(`${inspiredPad}${c.dim}Inspired by Caveman , original idea by github.com/JuliusBrussee/caveman${c.reset}`);
|
|
117
120
|
console.log();
|
|
118
121
|
}
|
|
119
122
|
if (cmd.opts) {
|
|
@@ -184,6 +187,12 @@ ${c.bold}${c.paleLavender}USAGE${c.reset}`);
|
|
|
184
187
|
examples: [
|
|
185
188
|
["kirograph caveman full", "Enable full caveman mode for the agent"],
|
|
186
189
|
["kirograph caveman off", "Disable caveman mode"],
|
|
190
|
+
["kirograph compression aggressive", "Set compression to aggressive level"],
|
|
191
|
+
["kirograph compression off", "Disable compression hook (tool still available)"],
|
|
192
|
+
["kirograph exec git status", "Run git status with compression"],
|
|
193
|
+
["kirograph exec --level ultra npm test", "Run tests with ultra compression"],
|
|
194
|
+
["kirograph exec --raw cargo build", "Show raw vs compressed comparison"],
|
|
195
|
+
["kirograph gain --graph", "Show token savings graph"],
|
|
187
196
|
["kirograph serve --mcp", "Start the MCP server"]
|
|
188
197
|
]
|
|
189
198
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/help.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { printBanner } from '../banner';\n\ntype CommandEntry = { name: string; args?: string; desc: string; opts?: string[] };\ntype Group = { title: string; commands: CommandEntry[] };\n\nexport function printColoredHelp(): void {\n const c = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n dim: '\\x1b[2m',\n violet: '\\x1b[38;5;99m',\n purple: '\\x1b[38;5;135m',\n lavender: '\\x1b[38;5;141m',\n paleLavender: '\\x1b[38;5;183m',\n gray: '\\x1b[90m',\n brown: '\\x1b[38;5;130m',\n };\n\n const groups: Group[] = [\n {\n title: '\uD83D\uDD27 Workspace Setup',\n commands: [\n { name: 'install', desc: 'Wire up MCP/instructions for an agent workspace', opts: ['--target <t> kiro | claude | codex'] },\n { name: 'init', args: '[path]', desc: 'Initialize KiroGraph in a project', opts: ['-i, --index Index immediately after init'] },\n { name: 'uninit', args: '[path]', desc: 'Remove KiroGraph from a project', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n { name: 'uninstall', args: '[path]', desc: 'Alias for uninit', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n ],\n },\n {\n title: '\uD83D\uDCE6 Indexing',\n commands: [\n { name: 'index', args: '[path]', desc: 'Full re-index of a project', opts: ['--force Force re-index all files'] },\n { name: 'sync', args: '[path]', desc: 'Incremental sync of changed files', opts: ['--files <f> Specific files to sync'] },\n { name: 'sync-if-dirty', args: '[path]', desc: 'Sync only if a dirty marker is present', opts: ['-q, --quiet Suppress output'] },\n { name: 'mark-dirty', args: '[path]', desc: 'Write a dirty marker for deferred sync' },\n { name: 'unlock', args: '[path]', desc: 'Force-release a stale lock file' },\n ],\n },\n {\n title: '\uD83D\uDD0D Search & Exploration',\n commands: [\n { name: 'status', args: '[path]', desc: 'Show index statistics and health' },\n { name: 'query', args: '<search>', desc: 'Search for symbols by name', opts: ['--kind <k> Filter by kind', '--limit <n> Max results (default 10)'] },\n { name: 'context', args: '<task>', desc: 'Build relevant code context for a task', opts: ['--max-nodes <n> Max symbols (default 20)', '--no-code Exclude code snippets', '--format <fmt> markdown | json'] },\n { name: 'files', args: '[path]', desc: 'Show project file structure from the index', opts: ['--format <fmt> tree | flat | grouped', '--filter <path> Filter by directory prefix', '--pattern <glob> Filter by glob', '--max-depth <n> Limit tree depth', '--json Output as JSON'] },\n { name: 'path', args: '<from> <to>', desc: 'Find the shortest path between two symbols', opts: ['--format <fmt> table | json'] },\n { name: 'export build', args: '[path]', desc: 'Generate the interactive graph dashboard (.kirograph/export/)', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'export start', args: '[path]', desc: 'Generate and open the dashboard in the browser', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'affected', args: '[files...]', desc: 'Find test files affected by changed source files', opts: ['--stdin Read file list from stdin', '-d, --depth <n> Max traversal depth (default 5)', '-f, --filter <g> Custom test file glob', '-j, --json Output as JSON', '-q, --quiet File paths only'] },\n ],\n },\n {\n title: '\uD83D\uDCCA Graph Insights',\n commands: [\n { name: 'hotspots', args: '[path]', desc: 'Find most-connected symbols by edge degree', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'surprising', args: '[path]', desc: 'Find non-obvious cross-file connections', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'dead-code', args: '[path]', desc: 'Find unexported symbols with no incoming references', opts: ['--limit <n> Max results (default 50)', '--format <f> table | json'] },\n { name: 'snapshot', desc: 'Save or list graph snapshots for structural diffing', opts: ['save [label] Save current graph state', 'list List saved snapshots', 'diff [label] Diff current graph vs a snapshot --format summary|full|json'] },\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture Analysis',\n commands: [\n { name: 'architecture', args: '[path]', desc: 'Show package graph and layer map', opts: ['--packages Show packages only', '--layers Show layers only', '--format <f> json'] },\n { name: 'coupling', args: '[path]', desc: 'Show coupling metrics per package', opts: ['--sort <s> instability | ca | ce | name', '--package <n> Detail view for one package', '--format <f> json'] },\n { name: 'package', args: '<name>', desc: 'Inspect a package: deps, files, metrics', opts: ['--no-files Omit file list', '--format <f> json'] },\n ],\n },\n {\n title: '\u2699\uFE0F Agent & Configuration',\n commands: [\n { name: 'caveman', args: '[mode]', desc: 'Set agent communication style (off | lite | full | ultra)' },\n { name: 'serve', desc: 'Start the MCP server', opts: ['--mcp Run as MCP stdio server', '--path <p> Project path'] },\n { name: 'dashboard', desc: 'Manage the Qdrant or Typesense dashboard server', opts: ['start [path] Start server and open dashboard', 'stop [path] Stop the running server'] },\n ],\n },\n ];\n\n console.log(`\\n${c.bold}${c.paleLavender}USAGE${c.reset}`);\n console.log(` ${c.lavender}kirograph${c.reset} ${c.gray}<command>${c.reset} ${c.dim}[options]${c.reset}\\n`);\n\n // Compute max name+args width across ALL groups for alignment\n const allCmds = groups.flatMap(g => g.commands);\n const nameWidth = Math.max(...allCmds.map(cmd => (cmd.name + (cmd.args ? ' ' + cmd.args : '')).length)) + 2;\n\n for (const group of groups) {\n console.log(`${c.bold}${c.paleLavender}${group.title.toUpperCase()}${c.reset}\\n`);\n for (const cmd of group.commands) {\n const signature = cmd.name + (cmd.args ? ' ' + cmd.args : '');\n const isCaveman = cmd.name === 'caveman';\n const nameColor = isCaveman ? c.brown : c.lavender;\n const prefix = isCaveman ? '\uD83E\uDEA8 ' : ' ';\n const namePart = `${nameColor}${cmd.name}${c.reset}${cmd.args ? ' ' + c.dim + cmd.args + c.reset : ''}`;\n const pad = ' '.repeat(Math.max(0, nameWidth - signature.length));\n console.log(`${prefix}${namePart}${pad}${c.gray}${cmd.desc}${c.reset}`);\n if (isCaveman) {\n // desc starts at: emoji prefix (3 display cols: \uD83E\uDEA8 + space) + nameWidth\n const inspiredPad = ' '.repeat(3 + nameWidth);\n console.log(`${inspiredPad}${c.dim}Inspired by Caveman \u2014 original idea by github.com/JuliusBrussee/caveman${c.reset}`);\n console.log();\n }\n if (cmd.opts) {\n for (const opt of cmd.opts) {\n const [flag, ...rest] = opt.split(/ +/);\n const optPad = ' '.repeat(nameWidth + 2);\n console.log(` ${optPad}${c.purple}${flag}${c.reset}${rest.length ? ' ' + c.dim + rest.join(' ') + c.reset : ''}`);\n }\n console.log();\n }\n }\n if (!groups[groups.length - 1].commands.includes(group.commands[group.commands.length - 1])) {\n // extra spacing between groups handled by opts blank line; add one if no opts\n const lastHasOpts = group.commands[group.commands.length - 1].opts;\n if (!lastHasOpts) console.log();\n }\n }\n\n console.log(`${c.bold}${c.paleLavender}GLOBAL FLAGS${c.reset}\\n`);\n console.log(` ${c.purple}-h, --help${c.reset} ${c.gray}Show this help${c.reset}`);\n console.log(` ${c.purple}-V, --version${c.reset} ${c.gray}Show version number${c.reset}\\n`);\n\n console.log(`${c.bold}${c.paleLavender}EXAMPLES${c.reset}\\n`);\n\n const exampleGroups: Array<{ title: string; examples: [string, string][] }> = [\n {\n title: '\uD83D\uDD27 Setup & indexing',\n examples: [\n ['kirograph install', 'Wire up Kiro MCP + hooks + steering for the current workspace'],\n ['kirograph install --target claude', 'Wire up Claude Code MCP + project memory'],\n ['kirograph install --target codex', 'Install Codex project instructions and print MCP config'],\n ['kirograph init --index', 'Init and immediately index the project'],\n ['kirograph sync', 'Incremental sync of changed files'],\n ],\n },\n {\n title: '\uD83D\uDD0D Search & exploration',\n examples: [\n ['kirograph query useState', 'Find all symbols named useState'],\n ['kirograph context \"add dark mode\"', 'Get relevant code context for a task'],\n ['kirograph files --format grouped', 'Show files grouped by directory'],\n ['kirograph path LoginController DatabasePool', 'Find how two symbols are connected'],\n ['kirograph affected src/auth.ts', 'Find tests affected by a change'],\n ['git diff --name-only | kirograph affected --stdin', 'Affected tests from a git diff'],\n ['kirograph export start', 'Open the interactive graph dashboard in the browser'],\n ['kirograph export build -o /tmp/graph', 'Export the dashboard to a custom directory'],\n ],\n },\n {\n title: '\uD83D\uDCCA Graph insights',\n examples: [\n ['kirograph hotspots --limit 10', 'Top 10 most-connected symbols'],\n ['kirograph surprising', 'Find unexpected cross-module connections'],\n ['kirograph dead-code', 'Find unreferenced unexported symbols'],\n ['kirograph snapshot save pre-refactor', 'Save a named snapshot before a refactor'],\n ['kirograph snapshot diff pre-refactor', 'Diff current graph vs the named snapshot'],\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture',\n examples: [\n ['kirograph architecture --packages', 'List all detected packages'],\n ['kirograph coupling --sort instability', 'Show packages ranked by instability'],\n ['kirograph package src/auth', 'Inspect the auth package'],\n ],\n },\n {\n title: '\u2699\uFE0F Agent',\n examples: [\n ['kirograph caveman full', 'Enable full caveman mode for the agent'],\n ['kirograph caveman off', 'Disable caveman mode'],\n ['kirograph serve --mcp', 'Start the MCP server'],\n ],\n },\n ];\n\n for (const eg of exampleGroups) {\n console.log(` ${c.dim}${eg.title}${c.reset}`);\n for (const [ex, desc] of eg.examples) {\n console.log(` ${c.violet}$${c.reset} ${c.lavender}${ex}${c.reset}`);\n console.log(` ${c.dim}${desc}${c.reset}`);\n }\n console.log();\n }\n}\n\nexport function register(program: Command): void {\n program.configureHelp({ formatHelp: () => '' });\n program.addHelpText('afterAll', '');\n program.helpInformation = () => {\n printBanner();\n printColoredHelp();\n return '';\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA4B;AAKrB,SAAS,mBAAyB;AACvC,QAAM,IAAI;AAAA,IACR,OAAc;AAAA,IACd,MAAc;AAAA,IACd,KAAc;AAAA,IACd,QAAc;AAAA,IACd,QAAc;AAAA,IACd,UAAc;AAAA,IACd,cAAc;AAAA,IACd,MAAc;AAAA,IACd,OAAc;AAAA,EAChB;AAEA,QAAM,SAAkB;AAAA,IACtB;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR,EAAE,MAAM,WAAiB,MAAM,mDAAmD,MAAM,CAAC,qCAAqC,EAAE;AAAA,QAChI,EAAE,MAAM,QAAiB,MAAM,UAAU,MAAM,qCAAqC,MAAM,CAAC,2CAA2C,EAAE;AAAA,QACxI,EAAE,MAAM,UAAiB,MAAM,UAAU,MAAM,mCAAqC,MAAM,CAAC,kCAAkC,2CAA2C,EAAE;AAAA,QAC1K,EAAE,MAAM,aAAiB,MAAM,UAAU,MAAM,oBAAqC,MAAM,CAAC,kCAAkC,2CAA2C,EAAE;AAAA,MAC5K;AAAA,IACF;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR,EAAE,MAAM,SAAiB,MAAM,UAAU,MAAM,8BAA0C,MAAM,CAAC,sCAAsC,EAAE;AAAA,QACxI,EAAE,MAAM,QAAiB,MAAM,UAAU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QAAM,YAAY,KAAK,IAAI,GAAG,QAAQ,IAAI,UAAQ,IAAI,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,IAAI;AAE1G,aAAW,SAAS,QAAQ;AAC1B,YAAQ,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,YAAY,GAAG,MAAM,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK;AAAA,CAAI;AAChF,eAAW,OAAO,MAAM,UAAU;AAChC,YAAM,YAAY,IAAI,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO;AAC1D,YAAM,YAAY,IAAI,SAAS;AAC/B,YAAM,YAAY,YAAY,EAAE,QAAQ,EAAE;AAC1C,YAAM,SAAS,YAAY,eAAQ;AACnC,YAAM,WAAW,GAAG,SAAS,GAAG,IAAI,IAAI,GAAG,EAAE,KAAK,GAAG,IAAI,OAAO,MAAM,EAAE,MAAM,IAAI,OAAO,EAAE,QAAQ,EAAE;AACrG,YAAM,MAAM,IAAI,OAAO,KAAK,IAAI,GAAG,YAAY,UAAU,MAAM,CAAC;AAChE,cAAQ,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,GAAG,GAAG,EAAE,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE,KAAK,EAAE;AACtE,UAAI,WAAW;AAEb,cAAM,cAAc,IAAI,OAAO,IAAI,SAAS;AAC5C,gBAAQ,IAAI,GAAG,WAAW,GAAG,EAAE,GAAG
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { printBanner } from '../banner';\n\ntype CommandEntry = { name: string; args?: string; desc: string; opts?: string[] };\ntype Group = { title: string; commands: CommandEntry[] };\n\nexport function printColoredHelp(): void {\n const c = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n dim: '\\x1b[2m',\n violet: '\\x1b[38;5;99m',\n purple: '\\x1b[38;5;135m',\n lavender: '\\x1b[38;5;141m',\n paleLavender: '\\x1b[38;5;183m',\n gray: '\\x1b[90m',\n brown: '\\x1b[38;5;130m',\n };\n\n const groups: Group[] = [\n {\n title: '\uD83D\uDD27 Workspace Setup',\n commands: [\n { name: 'install', desc: 'Wire up MCP/instructions for an agent workspace', opts: ['--target <t> kiro | claude | codex'] },\n { name: 'init', args: '[path]', desc: 'Initialize KiroGraph in a project', opts: ['-i, --index Index immediately after init'] },\n { name: 'uninit', args: '[path]', desc: 'Remove KiroGraph from a project', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n { name: 'uninstall', args: '[path]', desc: 'Alias for uninit', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n ],\n },\n {\n title: '\uD83D\uDCE6 Indexing',\n commands: [\n { name: 'index', args: '[path]', desc: 'Full re-index of a project', opts: ['--force Force re-index all files'] },\n { name: 'sync', args: '[path]', desc: 'Incremental sync of changed files', opts: ['--files <f> Specific files to sync'] },\n { name: 'sync-if-dirty', args: '[path]', desc: 'Sync only if a dirty marker is present', opts: ['-q, --quiet Suppress output'] },\n { name: 'mark-dirty', args: '[path]', desc: 'Write a dirty marker for deferred sync' },\n { name: 'unlock', args: '[path]', desc: 'Force-release a stale lock file' },\n ],\n },\n {\n title: '\uD83D\uDD0D Search & Exploration',\n commands: [\n { name: 'status', args: '[path]', desc: 'Show index statistics and health' },\n { name: 'query', args: '<search>', desc: 'Search for symbols by name', opts: ['--kind <k> Filter by kind', '--limit <n> Max results (default 10)'] },\n { name: 'context', args: '<task>', desc: 'Build relevant code context for a task', opts: ['--max-nodes <n> Max symbols (default 20)', '--no-code Exclude code snippets', '--format <fmt> markdown | json'] },\n { name: 'files', args: '[path]', desc: 'Show project file structure from the index', opts: ['--format <fmt> tree | flat | grouped', '--filter <path> Filter by directory prefix', '--pattern <glob> Filter by glob', '--max-depth <n> Limit tree depth', '--json Output as JSON'] },\n { name: 'path', args: '<from> <to>', desc: 'Find the shortest path between two symbols', opts: ['--format <fmt> table | json'] },\n { name: 'export build', args: '[path]', desc: 'Generate the interactive graph dashboard (.kirograph/export/)', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'export start', args: '[path]', desc: 'Generate and open the dashboard in the browser', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'affected', args: '[files...]', desc: 'Find test files affected by changed source files', opts: ['--stdin Read file list from stdin', '-d, --depth <n> Max traversal depth (default 5)', '-f, --filter <g> Custom test file glob', '-j, --json Output as JSON', '-q, --quiet File paths only'] },\n ],\n },\n {\n title: '\uD83D\uDCCA Graph Insights',\n commands: [\n { name: 'hotspots', args: '[path]', desc: 'Find most-connected symbols by edge degree', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'surprising', args: '[path]', desc: 'Find non-obvious cross-file connections', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'dead-code', args: '[path]', desc: 'Find unexported symbols with no incoming references', opts: ['--limit <n> Max results (default 50)', '--format <f> table | json'] },\n { name: 'snapshot', desc: 'Save or list graph snapshots for structural diffing', opts: ['save [label] Save current graph state', 'list List saved snapshots', 'diff [label] Diff current graph vs a snapshot --format summary|full|json'] },\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture Analysis',\n commands: [\n { name: 'architecture', args: '[path]', desc: 'Show package graph and layer map', opts: ['--packages Show packages only', '--layers Show layers only', '--format <f> json'] },\n { name: 'coupling', args: '[path]', desc: 'Show coupling metrics per package', opts: ['--sort <s> instability | ca | ce | name', '--package <n> Detail view for one package', '--format <f> json'] },\n { name: 'package', args: '<name>', desc: 'Inspect a package: deps, files, metrics', opts: ['--no-files Omit file list', '--format <f> json'] },\n ],\n },\n {\n title: '\u2699\uFE0F Agent & Configuration',\n commands: [\n { name: 'caveman', args: '[mode]', desc: 'Set agent communication style (off | lite | full | ultra)' },\n { name: 'compression', args: '[level]', desc: 'Set shell compression level (off | normal | aggressive | ultra)' },\n { name: 'exec', args: '<command...>', desc: 'Run a shell command with token-optimized output', opts: ['-l, --level <l> normal | aggressive | ultra', '-t, --timeout <s> Timeout in seconds (default 60)', '--raw Show raw + compressed for comparison', '--json Output as JSON'] },\n { name: 'gain', desc: 'Show token savings from compressed command outputs', opts: ['--graph ASCII graph (last 30 days)', '--history Recent command history', '--daily Day-by-day breakdown', '--period <p> session | today | week | all'] },\n { name: 'serve', desc: 'Start the MCP server', opts: ['--mcp Run as MCP stdio server', '--path <p> Project path'] },\n { name: 'dashboard', desc: 'Manage the Qdrant or Typesense dashboard server', opts: ['start [path] Start server and open dashboard', 'stop [path] Stop the running server'] },\n ],\n },\n ];\n\n console.log(`\\n${c.bold}${c.paleLavender}USAGE${c.reset}`);\n console.log(` ${c.lavender}kirograph${c.reset} ${c.gray}<command>${c.reset} ${c.dim}[options]${c.reset}\\n`);\n\n // Compute max name+args width across ALL groups for alignment\n const allCmds = groups.flatMap(g => g.commands);\n const nameWidth = Math.max(...allCmds.map(cmd => (cmd.name + (cmd.args ? ' ' + cmd.args : '')).length)) + 2;\n\n for (const group of groups) {\n console.log(`${c.bold}${c.paleLavender}${group.title.toUpperCase()}${c.reset}\\n`);\n for (const cmd of group.commands) {\n const signature = cmd.name + (cmd.args ? ' ' + cmd.args : '');\n const isCaveman = cmd.name === 'caveman';\n const nameColor = isCaveman ? c.brown : c.lavender;\n const prefix = isCaveman ? '\uD83E\uDEA8 ' : ' ';\n const namePart = `${nameColor}${cmd.name}${c.reset}${cmd.args ? ' ' + c.dim + cmd.args + c.reset : ''}`;\n const pad = ' '.repeat(Math.max(0, nameWidth - signature.length));\n console.log(`${prefix}${namePart}${pad}${c.gray}${cmd.desc}${c.reset}`);\n if (isCaveman) {\n // desc starts at: emoji prefix (3 display cols: \uD83E\uDEA8 + space) + nameWidth\n const inspiredPad = ' '.repeat(3 + nameWidth);\n console.log(`${inspiredPad}${c.dim}Inspired by Caveman , original idea by github.com/JuliusBrussee/caveman${c.reset}`);\n console.log();\n }\n if (cmd.opts) {\n for (const opt of cmd.opts) {\n const [flag, ...rest] = opt.split(/ +/);\n const optPad = ' '.repeat(nameWidth + 2);\n console.log(` ${optPad}${c.purple}${flag}${c.reset}${rest.length ? ' ' + c.dim + rest.join(' ') + c.reset : ''}`);\n }\n console.log();\n }\n }\n if (!groups[groups.length - 1].commands.includes(group.commands[group.commands.length - 1])) {\n // extra spacing between groups handled by opts blank line; add one if no opts\n const lastHasOpts = group.commands[group.commands.length - 1].opts;\n if (!lastHasOpts) console.log();\n }\n }\n\n console.log(`${c.bold}${c.paleLavender}GLOBAL FLAGS${c.reset}\\n`);\n console.log(` ${c.purple}-h, --help${c.reset} ${c.gray}Show this help${c.reset}`);\n console.log(` ${c.purple}-V, --version${c.reset} ${c.gray}Show version number${c.reset}\\n`);\n\n console.log(`${c.bold}${c.paleLavender}EXAMPLES${c.reset}\\n`);\n\n const exampleGroups: Array<{ title: string; examples: [string, string][] }> = [\n {\n title: '\uD83D\uDD27 Setup & indexing',\n examples: [\n ['kirograph install', 'Wire up Kiro MCP + hooks + steering for the current workspace'],\n ['kirograph install --target claude', 'Wire up Claude Code MCP + project memory'],\n ['kirograph install --target codex', 'Install Codex project instructions and print MCP config'],\n ['kirograph init --index', 'Init and immediately index the project'],\n ['kirograph sync', 'Incremental sync of changed files'],\n ],\n },\n {\n title: '\uD83D\uDD0D Search & exploration',\n examples: [\n ['kirograph query useState', 'Find all symbols named useState'],\n ['kirograph context \"add dark mode\"', 'Get relevant code context for a task'],\n ['kirograph files --format grouped', 'Show files grouped by directory'],\n ['kirograph path LoginController DatabasePool', 'Find how two symbols are connected'],\n ['kirograph affected src/auth.ts', 'Find tests affected by a change'],\n ['git diff --name-only | kirograph affected --stdin', 'Affected tests from a git diff'],\n ['kirograph export start', 'Open the interactive graph dashboard in the browser'],\n ['kirograph export build -o /tmp/graph', 'Export the dashboard to a custom directory'],\n ],\n },\n {\n title: '\uD83D\uDCCA Graph insights',\n examples: [\n ['kirograph hotspots --limit 10', 'Top 10 most-connected symbols'],\n ['kirograph surprising', 'Find unexpected cross-module connections'],\n ['kirograph dead-code', 'Find unreferenced unexported symbols'],\n ['kirograph snapshot save pre-refactor', 'Save a named snapshot before a refactor'],\n ['kirograph snapshot diff pre-refactor', 'Diff current graph vs the named snapshot'],\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture',\n examples: [\n ['kirograph architecture --packages', 'List all detected packages'],\n ['kirograph coupling --sort instability', 'Show packages ranked by instability'],\n ['kirograph package src/auth', 'Inspect the auth package'],\n ],\n },\n {\n title: '\u2699\uFE0F Agent',\n examples: [\n ['kirograph caveman full', 'Enable full caveman mode for the agent'],\n ['kirograph caveman off', 'Disable caveman mode'],\n ['kirograph compression aggressive', 'Set compression to aggressive level'],\n ['kirograph compression off', 'Disable compression hook (tool still available)'],\n ['kirograph exec git status', 'Run git status with compression'],\n ['kirograph exec --level ultra npm test', 'Run tests with ultra compression'],\n ['kirograph exec --raw cargo build', 'Show raw vs compressed comparison'],\n ['kirograph gain --graph', 'Show token savings graph'],\n ['kirograph serve --mcp', 'Start the MCP server'],\n ],\n },\n ];\n\n for (const eg of exampleGroups) {\n console.log(` ${c.dim}${eg.title}${c.reset}`);\n for (const [ex, desc] of eg.examples) {\n console.log(` ${c.violet}$${c.reset} ${c.lavender}${ex}${c.reset}`);\n console.log(` ${c.dim}${desc}${c.reset}`);\n }\n console.log();\n }\n}\n\nexport function register(program: Command): void {\n program.configureHelp({ formatHelp: () => '' });\n program.addHelpText('afterAll', '');\n program.helpInformation = () => {\n printBanner();\n printColoredHelp();\n return '';\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA4B;AAKrB,SAAS,mBAAyB;AACvC,QAAM,IAAI;AAAA,IACR,OAAc;AAAA,IACd,MAAc;AAAA,IACd,KAAc;AAAA,IACd,QAAc;AAAA,IACd,QAAc;AAAA,IACd,UAAc;AAAA,IACd,cAAc;AAAA,IACd,MAAc;AAAA,IACd,OAAc;AAAA,EAChB;AAEA,QAAM,S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AU;AAAA,QACR,CAAC,qCAAkD,4BAA4B;AAAA,QAC/E,CAAC,yCAAkD,qCAAqC;AAAA,QACxF,CAAC,8BAAkD,0BAA0B;AAAA,MAC/E;AAAA,IACF;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR,CAAC,0BAAkD,wCAAwC;AAAA,QAC3F,CAAC,yBAAkD,sBAAsB;AAAA,QACzE,CAAC,oCAAiD,qCAAqC;AAAA,QACvF,CAAC,6BAAkD,iDAAiD;AAAA,QACpG,CAAC,6BAAkD,iCAAiC;AAAA,QACpF,CAAC,yCAAkD,kCAAkC;AAAA,QACrF,CAAC,oCAAkD,mCAAmC;AAAA,QACtF,CAAC,0BAAkD,0BAA0B;AAAA,QAC7E,CAAC,yBAAkD,sBAAsB;AAAA,MAC3E;AAAA,IACF;AAAA,EACF;AAEA,aAAW,MAAM,eAAe;AAC9B,YAAQ,IAAI,KAAK,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC7C,eAAW,CAAC,IAAI,IAAI,KAAK,GAAG,UAAU;AACpC,cAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,KAAK,IAAI,EAAE,QAAQ,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACnE,cAAQ,IAAI,OAAO,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,KAAK,EAAE;AAAA,IAC7C;AACA,YAAQ,IAAI;AAAA,EACd;AACF;AAEO,SAAS,SAAS,SAAwB;AAC/C,UAAQ,cAAc,EAAE,YAAY,MAAM,GAAG,CAAC;AAC9C,UAAQ,YAAY,YAAY,EAAE;AAClC,UAAQ,kBAAkB,MAAM;AAC9B,mCAAY;AACZ,qBAAiB;AACjB,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,7 +25,9 @@ var import_ui = require("../ui");
|
|
|
25
25
|
function register(program) {
|
|
26
26
|
program.command("query <search>").description("Search for symbols").option("--kind <kind>", "Filter by kind").option("--limit <n>", "Max results", "10").action(async (search, opts) => {
|
|
27
27
|
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
28
|
-
const
|
|
28
|
+
const { trackCliToolSaving } = await Promise.resolve().then(() => require("./utils.js"));
|
|
29
|
+
const cwd = process.cwd();
|
|
30
|
+
const cg = await KiroGraph.open(cwd);
|
|
29
31
|
const results = cg.searchNodes(search, opts.kind, parseInt(opts.limit));
|
|
30
32
|
if (results.length === 0) {
|
|
31
33
|
console.log(` ${import_ui.dim}No results for${import_ui.reset} ${import_ui.violet}${import_ui.bold}${search}${import_ui.reset}`);
|
|
@@ -37,6 +39,8 @@ function register(program) {
|
|
|
37
39
|
console.log(`
|
|
38
40
|
${import_ui.dim}${results.length} result(s)${import_ui.reset}`);
|
|
39
41
|
}
|
|
42
|
+
const output = results.map((r) => `${r.node.name} ${r.node.kind} ${r.node.filePath}:${r.node.startLine}`).join("\n");
|
|
43
|
+
trackCliToolSaving(cwd, "kirograph_search", output, { limit: parseInt(opts.limit) });
|
|
40
44
|
cg.close();
|
|
41
45
|
});
|
|
42
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/query.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('query <search>')\n .description('Search for symbols')\n .option('--kind <kind>', 'Filter by kind')\n .option('--limit <n>', 'Max results', '10')\n .action(async (search: string, opts: { kind?: string; limit: string }) => {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAyC;AAElC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,gBAAgB,EACxB,YAAY,oBAAoB,EAChC,OAAO,iBAAiB,gBAAgB,EACxC,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,OAAO,QAAgB,SAA2C;AACxE,UAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,UAAM,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { dim, reset, violet, bold } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('query <search>')\n .description('Search for symbols')\n .option('--kind <kind>', 'Filter by kind')\n .option('--limit <n>', 'Max results', '10')\n .action(async (search: string, opts: { kind?: string; limit: string }) => {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const { trackCliToolSaving } = await Promise.resolve().then(() => require('./utils.js'));\n\n const cwd = process.cwd();\n const cg = await KiroGraph.open(cwd);\n const results = cg.searchNodes(search, opts.kind as any, parseInt(opts.limit));\n if (results.length === 0) {\n console.log(` ${dim}No results for${reset} ${violet}${bold}${search}${reset}`);\n } else {\n console.log();\n for (const r of results) {\n console.log(` ${violet}${bold}${r.node.name}${reset} ${dim}${r.node.kind}${reset} ${dim}${r.node.filePath}:${r.node.startLine}${reset}`);\n }\n console.log(`\\n ${dim}${results.length} result(s)${reset}`);\n }\n\n // Track savings\n const output = results.map(r => `${r.node.name} ${r.node.kind} ${r.node.filePath}:${r.node.startLine}`).join('\\n');\n trackCliToolSaving(cwd, 'kirograph_search', output, { limit: parseInt(opts.limit) });\n\n cg.close();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAyC;AAElC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,gBAAgB,EACxB,YAAY,oBAAoB,EAChC,OAAO,iBAAiB,gBAAgB,EACxC,OAAO,eAAe,eAAe,IAAI,EACzC,OAAO,OAAO,QAAgB,SAA2C;AACxE,UAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,UAAM,EAAE,mBAAmB,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,YAAY,CAAC;AAEvF,UAAM,MAAM,QAAQ,IAAI;AACxB,UAAM,KAAK,MAAM,UAAU,KAAK,GAAG;AACnC,UAAM,UAAU,GAAG,YAAY,QAAQ,KAAK,MAAa,SAAS,KAAK,KAAK,CAAC;AAC7E,QAAI,QAAQ,WAAW,GAAG;AACxB,cAAQ,IAAI,KAAK,aAAG,iBAAiB,eAAK,IAAI,gBAAM,GAAG,cAAI,GAAG,MAAM,GAAG,eAAK,EAAE;AAAA,IAChF,OAAO;AACL,cAAQ,IAAI;AACZ,iBAAW,KAAK,SAAS;AACvB,gBAAQ,IAAI,KAAK,gBAAM,GAAG,cAAI,GAAG,EAAE,KAAK,IAAI,GAAG,eAAK,KAAK,aAAG,GAAG,EAAE,KAAK,IAAI,GAAG,eAAK,KAAK,aAAG,GAAG,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,SAAS,GAAG,eAAK,EAAE;AAAA,MAC5I;AACA,cAAQ,IAAI;AAAA,IAAO,aAAG,GAAG,QAAQ,MAAM,aAAa,eAAK,EAAE;AAAA,IAC7D;AAGA,UAAM,SAAS,QAAQ,IAAI,OAAK,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,SAAS,EAAE,EAAE,KAAK,IAAI;AACjH,uBAAmB,KAAK,oBAAoB,QAAQ,EAAE,OAAO,SAAS,KAAK,KAAK,EAAE,CAAC;AAEnF,OAAG,MAAM;AAAA,EACX,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -137,7 +137,7 @@ async function runUninit(projectPath, opts) {
|
|
|
137
137
|
}
|
|
138
138
|
function register(program) {
|
|
139
139
|
program.command("uninit [projectPath]").description("Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", "Integration target to clean up: kiro, claude, codex, or all", "kiro").action(runUninit);
|
|
140
|
-
program.command("uninstall [projectPath]").description("Alias for uninit
|
|
140
|
+
program.command("uninstall [projectPath]").description("Alias for uninit. Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", "Integration target to clean up: kiro, claude, codex, or all", "kiro").action(runUninit);
|
|
141
141
|
}
|
|
142
142
|
// Annotate the CommonJS export names for ESM import in node:
|
|
143
143
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/uninit.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\ntype UninitTarget = 'kiro' | 'claude' | 'codex' | 'all';\n\nconst UNINIT_TARGETS: UninitTarget[] = ['kiro', 'claude', 'codex', 'all'];\n\nasync function confirm(question: string): Promise<boolean> {\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n return new Promise<boolean>(resolve => rl.question(question, ans => {\n rl.close();\n resolve(ans.toLowerCase() === 'y');\n }));\n}\n\nasync function runUninit(projectPath: string | undefined, opts: { force?: boolean; target?: string }): Promise<void> {\n const target = path.resolve(projectPath ?? process.cwd());\n const integration = (opts.target ?? 'kiro').toLowerCase() as UninitTarget;\n if (!UNINIT_TARGETS.includes(integration)) {\n console.error(`Unknown uninit target: ${opts.target}. Choose from: kiro, claude, codex, all`);\n process.exit(1);\n }\n const dir = path.join(target, '.kirograph');\n if (!fs.existsSync(dir)) { console.log('Not initialized.'); return; }\n\n let removeIntegration = true;\n let removeGraph = opts.force === true;\n\n if (!opts.force) {\n printBanner();\n const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)]!;\n console.log(` ${violet}${bold}${farewell}${reset}`);\n console.log(`\\n ${dim}This can remove ${integration} integration files and, separately, the shared .kirograph/ data.${reset}`);\n console.log(` ${dim}Your source code is untouched.${reset}\\n`);\n\n removeIntegration = await confirm(` ${violet}Remove ${integration} integration files?${reset} ${dim}(y/N)${reset} `);\n removeGraph = await confirm(` ${violet}Remove shared .kirograph/ data too?${reset} ${dim}(y/N)${reset} `);\n\n if (!removeIntegration && !removeGraph) {\n console.log(`\\n ${dim}Cancelled. Nothing removed.${reset}\\n`);\n return;\n }\n console.log();\n }\n\n if (removeGraph) {\n fs.rmSync(dir, { recursive: true, force: true });\n console.log(` ${green}\u2713${reset} Removed .kirograph/`);\n }\n\n if (removeIntegration && (integration === 'kiro' || integration === 'all')) {\n // Remove .kiro hooks created by kirograph\n const kiroHooks = [\n 'kirograph-mark-dirty-on-save.json',\n 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-sync-if-dirty.json',\n 'kirograph-sync-on-save.json',\n 'kirograph-sync-on-create.json',\n ];\n const hooksDir = path.join(target, '.kiro', 'hooks');\n let removedHooks = 0;\n for (const hook of kiroHooks) {\n const p = path.join(hooksDir, hook);\n if (fs.existsSync(p)) { fs.unlinkSync(p); removedHooks++; }\n }\n if (removedHooks > 0) console.log(` ${green}\u2713${reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);\n\n // Remove .kiro/steering/kirograph.md\n const steeringPath = path.join(target, '.kiro', 'steering', 'kirograph.md');\n if (fs.existsSync(steeringPath)) {\n fs.unlinkSync(steeringPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/steering/kirograph.md`);\n }\n\n // Remove .kiro/agents/kirograph.json\n const agentPath = path.join(target, '.kiro', 'agents', 'kirograph.json');\n if (fs.existsSync(agentPath)) {\n fs.unlinkSync(agentPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/agents/kirograph.json`);\n }\n }\n\n if (removeIntegration && (integration === 'claude' || integration === 'all')) {\n const { uninitClaude } = await Promise.resolve().then(() => require('../installer/targets/claude.js'));\n uninitClaude(target);\n }\n\n if (removeIntegration && (integration === 'codex' || integration === 'all')) {\n const { uninitCodex } = await Promise.resolve().then(() => require('../installer/targets/codex.js'));\n uninitCodex(target);\n }\n\n console.log(`\\n ${dim}Done. Run ${violet}kirograph install --target ${integration === 'all' ? 'kiro' : integration}${reset}${dim} to come back anytime.${reset}\\n`);\n}\n\nexport function register(program: Command): void {\n program\n .command('uninit [projectPath]')\n .description('Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', 'Integration target to clean up: kiro, claude, codex, or all', 'kiro')\n .action(runUninit);\n\n program\n .command('uninstall [projectPath]')\n .description('Alias for uninit
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,oBAA4B;AAC5B,gBAAgD;AAEzC,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,MAAM,iBAAiC,CAAC,QAAQ,UAAU,SAAS,KAAK;AAExE,eAAe,QAAQ,UAAoC;AACzD,QAAM,WAAW,MAAM,OAAO,UAAU;AACxC,QAAM,KAAK,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO,CAAC;AACpF,SAAO,IAAI,QAAiB,aAAW,GAAG,SAAS,UAAU,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M,QAAQ,+BAA+B,CAAC;AACnG,gBAAY,MAAM;AAAA,EACpB;AAEA,UAAQ,IAAI;AAAA,IAAO,aAAG,aAAa,gBAAM,8BAA8B,gBAAgB,QAAQ,SAAS,WAAW,GAAG,eAAK,GAAG,aAAG,yBAAyB,eAAK;AAAA,CAAI;AACrK;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,sBAAsB,EAC9B,YAAY,iCAAiC,EAC7C,OAAO,WAAW,mBAAmB,EACrC,OAAO,qBAAqB,+DAA+D,MAAM,EACjG,OAAO,SAAS;AAEnB,UACG,QAAQ,yBAAyB,EACjC,YAAY,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\ntype UninitTarget = 'kiro' | 'claude' | 'codex' | 'all';\n\nconst UNINIT_TARGETS: UninitTarget[] = ['kiro', 'claude', 'codex', 'all'];\n\nasync function confirm(question: string): Promise<boolean> {\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n return new Promise<boolean>(resolve => rl.question(question, ans => {\n rl.close();\n resolve(ans.toLowerCase() === 'y');\n }));\n}\n\nasync function runUninit(projectPath: string | undefined, opts: { force?: boolean; target?: string }): Promise<void> {\n const target = path.resolve(projectPath ?? process.cwd());\n const integration = (opts.target ?? 'kiro').toLowerCase() as UninitTarget;\n if (!UNINIT_TARGETS.includes(integration)) {\n console.error(`Unknown uninit target: ${opts.target}. Choose from: kiro, claude, codex, all`);\n process.exit(1);\n }\n const dir = path.join(target, '.kirograph');\n if (!fs.existsSync(dir)) { console.log('Not initialized.'); return; }\n\n let removeIntegration = true;\n let removeGraph = opts.force === true;\n\n if (!opts.force) {\n printBanner();\n const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)]!;\n console.log(` ${violet}${bold}${farewell}${reset}`);\n console.log(`\\n ${dim}This can remove ${integration} integration files and, separately, the shared .kirograph/ data.${reset}`);\n console.log(` ${dim}Your source code is untouched.${reset}\\n`);\n\n removeIntegration = await confirm(` ${violet}Remove ${integration} integration files?${reset} ${dim}(y/N)${reset} `);\n removeGraph = await confirm(` ${violet}Remove shared .kirograph/ data too?${reset} ${dim}(y/N)${reset} `);\n\n if (!removeIntegration && !removeGraph) {\n console.log(`\\n ${dim}Cancelled. Nothing removed.${reset}\\n`);\n return;\n }\n console.log();\n }\n\n if (removeGraph) {\n fs.rmSync(dir, { recursive: true, force: true });\n console.log(` ${green}\u2713${reset} Removed .kirograph/`);\n }\n\n if (removeIntegration && (integration === 'kiro' || integration === 'all')) {\n // Remove .kiro hooks created by kirograph\n const kiroHooks = [\n 'kirograph-mark-dirty-on-save.json',\n 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-sync-if-dirty.json',\n 'kirograph-sync-on-save.json',\n 'kirograph-sync-on-create.json',\n ];\n const hooksDir = path.join(target, '.kiro', 'hooks');\n let removedHooks = 0;\n for (const hook of kiroHooks) {\n const p = path.join(hooksDir, hook);\n if (fs.existsSync(p)) { fs.unlinkSync(p); removedHooks++; }\n }\n if (removedHooks > 0) console.log(` ${green}\u2713${reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);\n\n // Remove .kiro/steering/kirograph.md\n const steeringPath = path.join(target, '.kiro', 'steering', 'kirograph.md');\n if (fs.existsSync(steeringPath)) {\n fs.unlinkSync(steeringPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/steering/kirograph.md`);\n }\n\n // Remove .kiro/agents/kirograph.json\n const agentPath = path.join(target, '.kiro', 'agents', 'kirograph.json');\n if (fs.existsSync(agentPath)) {\n fs.unlinkSync(agentPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/agents/kirograph.json`);\n }\n }\n\n if (removeIntegration && (integration === 'claude' || integration === 'all')) {\n const { uninitClaude } = await Promise.resolve().then(() => require('../installer/targets/claude.js'));\n uninitClaude(target);\n }\n\n if (removeIntegration && (integration === 'codex' || integration === 'all')) {\n const { uninitCodex } = await Promise.resolve().then(() => require('../installer/targets/codex.js'));\n uninitCodex(target);\n }\n\n console.log(`\\n ${dim}Done. Run ${violet}kirograph install --target ${integration === 'all' ? 'kiro' : integration}${reset}${dim} to come back anytime.${reset}\\n`);\n}\n\nexport function register(program: Command): void {\n program\n .command('uninit [projectPath]')\n .description('Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', 'Integration target to clean up: kiro, claude, codex, or all', 'kiro')\n .action(runUninit);\n\n program\n .command('uninstall [projectPath]')\n .description('Alias for uninit. Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', 'Integration target to clean up: kiro, claude, codex, or all', 'kiro')\n .action(runUninit);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,oBAA4B;AAC5B,gBAAgD;AAEzC,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,MAAM,iBAAiC,CAAC,QAAQ,UAAU,SAAS,KAAK;AAExE,eAAe,QAAQ,UAAoC;AACzD,QAAM,WAAW,MAAM,OAAO,UAAU;AACxC,QAAM,KAAK,SAAS,gB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,sBAAsB,gBAAgB,WAAW,gBAAgB,QAAQ;AAC3E,UAAM,EAAE,YAAY,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,+BAA+B,CAAC;AACnG,gBAAY,MAAM;AAAA,EACpB;AAEA,UAAQ,IAAI;AAAA,IAAO,aAAG,aAAa,gBAAM,8BAA8B,gBAAgB,QAAQ,SAAS,WAAW,GAAG,eAAK,GAAG,aAAG,yBAAyB,eAAK;AAAA,CAAI;AACrK;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,sBAAsB,EAC9B,YAAY,iCAAiC,EAC7C,OAAO,WAAW,mBAAmB,EACrC,OAAO,qBAAqB,+DAA+D,MAAM,EACjG,OAAO,SAAS;AAEnB,UACG,QAAQ,yBAAyB,EACjC,YAAY,mDAAmD,EAC/D,OAAO,WAAW,mBAAmB,EACrC,OAAO,qBAAqB,+DAA+D,MAAM,EACjG,OAAO,SAAS;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,6 +30,7 @@ var utils_exports = {};
|
|
|
30
30
|
__export(utils_exports, {
|
|
31
31
|
formatSyncCounts: () => formatSyncCounts,
|
|
32
32
|
openProject: () => openProject,
|
|
33
|
+
trackCliToolSaving: () => trackCliToolSaving,
|
|
33
34
|
warnFallback: () => warnFallback
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -47,10 +48,25 @@ function warnFallback(fallback) {
|
|
|
47
48
|
function formatSyncCounts(result) {
|
|
48
49
|
return ` ${import_ui.green}\u2713${import_ui.reset} ${import_ui.dim}added${import_ui.reset} ${(0, import_ui.value)(String(result.added.length))} ${import_ui.dim}modified${import_ui.reset} ${(0, import_ui.value)(String(result.modified.length))} ${import_ui.dim}removed${import_ui.reset} ${(0, import_ui.value)(String(result.removed.length))} ${import_ui.dim}(${result.duration}ms)${import_ui.reset}`;
|
|
49
50
|
}
|
|
51
|
+
function trackCliToolSaving(projectRoot, toolName, output, args) {
|
|
52
|
+
try {
|
|
53
|
+
const { TokenTracker } = require("../../compression/tracker");
|
|
54
|
+
const { estimateNaiveCost } = require("../../compression/naive-cost");
|
|
55
|
+
const { estimateTokens } = require("../../compression/index");
|
|
56
|
+
const outputTokens = estimateTokens(output);
|
|
57
|
+
const naiveCost = estimateNaiveCost(toolName, outputTokens, args);
|
|
58
|
+
if (naiveCost !== null && naiveCost > outputTokens) {
|
|
59
|
+
const tracker = new TokenTracker(projectRoot);
|
|
60
|
+
tracker.recordGraphSaving(toolName, outputTokens, naiveCost);
|
|
61
|
+
}
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
50
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
66
|
0 && (module.exports = {
|
|
52
67
|
formatSyncCounts,
|
|
53
68
|
openProject,
|
|
69
|
+
trackCliToolSaving,
|
|
54
70
|
warnFallback
|
|
55
71
|
});
|
|
56
72
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import * as path from 'path';\nimport { dim, reset, violet, bold, green, value } from '../ui';\n\nexport async function openProject(projectPath?: string): Promise<{ cg: any; target: string }> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const target = path.resolve(projectPath ?? process.cwd());\n const cg = await KiroGraph.open(target);\n return { cg, target };\n}\n\nexport function warnFallback(fallback: string | null): void {\n if (fallback) console.warn(` \\x1b[33m\u26A0 Engine fallback: ${fallback}\\x1b[0m`);\n}\n\nexport function formatSyncCounts(result: { added: unknown[]; modified: unknown[]; removed: unknown[]; duration: number }): string {\n return ` ${green}\u2713${reset} ${dim}added${reset} ${value(String(result.added.length))} ${dim}modified${reset} ${value(String(result.modified.length))} ${dim}removed${reset} ${value(String(result.removed.length))} ${dim}(${result.duration}ms)${reset}`;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AACtB,gBAAuD;AAEvD,eAAsB,YAAY,aAA4D;AAC5F,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,SAAO,EAAE,IAAI,OAAO;AACtB;AAEO,SAAS,aAAa,UAA+B;AAC1D,MAAI,SAAU,SAAQ,KAAK,qCAAgC,QAAQ,SAAS;AAC9E;AAEO,SAAS,iBAAiB,QAAiG;AAChI,SAAO,KAAK,eAAK,SAAI,eAAK,IAAI,aAAG,QAAQ,eAAK,QAAI,iBAAM,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,aAAG,WAAW,eAAK,QAAI,iBAAM,OAAO,OAAO,SAAS,MAAM,CAAC,CAAC,KAAK,aAAG,UAAU,eAAK,QAAI,iBAAM,OAAO,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,aAAG,IAAI,OAAO,QAAQ,MAAM,eAAK;AAC5P;",
|
|
4
|
+
"sourcesContent": ["import * as path from 'path';\nimport { dim, reset, violet, bold, green, value } from '../ui';\n\nexport async function openProject(projectPath?: string): Promise<{ cg: any; target: string }> {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const target = path.resolve(projectPath ?? process.cwd());\n const cg = await KiroGraph.open(target);\n return { cg, target };\n}\n\nexport function warnFallback(fallback: string | null): void {\n if (fallback) console.warn(` \\x1b[33m\u26A0 Engine fallback: ${fallback}\\x1b[0m`);\n}\n\nexport function formatSyncCounts(result: { added: unknown[]; modified: unknown[]; removed: unknown[]; duration: number }): string {\n return ` ${green}\u2713${reset} ${dim}added${reset} ${value(String(result.added.length))} ${dim}modified${reset} ${value(String(result.modified.length))} ${dim}removed${reset} ${value(String(result.removed.length))} ${dim}(${result.duration}ms)${reset}`;\n}\n\n/**\n * Track token savings for a CLI graph tool invocation.\n * Non-critical \u2014 silently ignores errors.\n */\nexport function trackCliToolSaving(projectRoot: string, toolName: string, output: string, args?: Record<string, unknown>): void {\n try {\n const { TokenTracker } = require('../../compression/tracker');\n const { estimateNaiveCost } = require('../../compression/naive-cost');\n const { estimateTokens } = require('../../compression/index');\n\n const outputTokens = estimateTokens(output);\n const naiveCost = estimateNaiveCost(toolName, outputTokens, args);\n if (naiveCost !== null && naiveCost > outputTokens) {\n const tracker = new TokenTracker(projectRoot);\n tracker.recordGraphSaving(toolName, outputTokens, naiveCost);\n }\n } catch { /* non-critical */ }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AACtB,gBAAuD;AAEvD,eAAsB,YAAY,aAA4D;AAC5F,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,SAAO,EAAE,IAAI,OAAO;AACtB;AAEO,SAAS,aAAa,UAA+B;AAC1D,MAAI,SAAU,SAAQ,KAAK,qCAAgC,QAAQ,SAAS;AAC9E;AAEO,SAAS,iBAAiB,QAAiG;AAChI,SAAO,KAAK,eAAK,SAAI,eAAK,IAAI,aAAG,QAAQ,eAAK,QAAI,iBAAM,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,aAAG,WAAW,eAAK,QAAI,iBAAM,OAAO,OAAO,SAAS,MAAM,CAAC,CAAC,KAAK,aAAG,UAAU,eAAK,QAAI,iBAAM,OAAO,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,aAAG,IAAI,OAAO,QAAQ,MAAM,eAAK;AAC5P;AAMO,SAAS,mBAAmB,aAAqB,UAAkB,QAAgB,MAAsC;AAC9H,MAAI;AACF,UAAM,EAAE,aAAa,IAAI,QAAQ,2BAA2B;AAC5D,UAAM,EAAE,kBAAkB,IAAI,QAAQ,8BAA8B;AACpE,UAAM,EAAE,eAAe,IAAI,QAAQ,yBAAyB;AAE5D,UAAM,eAAe,eAAe,MAAM;AAC1C,UAAM,YAAY,kBAAkB,UAAU,cAAc,IAAI;AAChE,QAAI,cAAc,QAAQ,YAAY,cAAc;AAClD,YAAM,UAAU,IAAI,aAAa,WAAW;AAC5C,cAAQ,kBAAkB,UAAU,cAAc,SAAS;AAAA,IAC7D;AAAA,EACF,QAAQ;AAAA,EAAqB;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,7 +62,7 @@ async function promptConfigOptions(rl) {
|
|
|
62
62
|
"Enable semantic embeddings for similarity search? (requires a local embedding model)",
|
|
63
63
|
"Enables semantic/similarity-based code search. Increases indexing time; the chosen embedding model is downloaded automatically on first use."
|
|
64
64
|
);
|
|
65
|
-
const patch = { enableEmbeddings, useVecIndex: false, semanticEngine: "cosine", typesenseDashboard: false, qdrantDashboard: false, extractDocstrings: true, trackCallSites: true, enableArchitecture: false, cavemanMode: "off" };
|
|
65
|
+
const patch = { enableEmbeddings, useVecIndex: false, semanticEngine: "cosine", typesenseDashboard: false, qdrantDashboard: false, extractDocstrings: true, trackCallSites: true, enableArchitecture: false, cavemanMode: "off", shellCompressionLevel: "normal" };
|
|
66
66
|
if (enableEmbeddings) {
|
|
67
67
|
const modelChoice = await (0, import_prompts.arrowSelect)(
|
|
68
68
|
rl,
|
|
@@ -141,13 +141,20 @@ async function promptConfigOptions(rl) {
|
|
|
141
141
|
"Enable architecture analysis (package graph + layer detection)?",
|
|
142
142
|
"Detects packages from manifests (package.json, go.mod, Cargo.toml, etc.) and architectural layers (api, service, data, ui, shared) from file structure. Enables kirograph_architecture, kirograph_coupling, and kirograph_package MCP tools."
|
|
143
143
|
);
|
|
144
|
-
const cavemanChoice = await (0, import_prompts.arrowSelect)(rl, "Caveman mode
|
|
144
|
+
const cavemanChoice = await (0, import_prompts.arrowSelect)(rl, "Caveman mode: agent communication style:", [
|
|
145
145
|
{ value: "off", label: "off", description: "Normal responses" },
|
|
146
146
|
{ value: "lite", label: "lite", description: "Compact, no filler, full sentences" },
|
|
147
147
|
{ value: "full", label: "full", description: "Fragments, no articles, short synonyms" },
|
|
148
148
|
{ value: "ultra", label: "ultra", description: "Max compression, abbreviations, \u2192 for causality" }
|
|
149
149
|
]);
|
|
150
150
|
patch.cavemanMode = cavemanChoice;
|
|
151
|
+
const compressionChoice = await (0, import_prompts.arrowSelect)(rl, "Shell compression: default level for kirograph_exec:", [
|
|
152
|
+
{ value: "off", label: "off", description: "No compression hook or steering (tool still available)" },
|
|
153
|
+
{ value: "normal", label: "normal", description: "Balanced: removes noise, keeps structure (recommended)" },
|
|
154
|
+
{ value: "aggressive", label: "aggressive", description: "More compact: groups by category, limits output" },
|
|
155
|
+
{ value: "ultra", label: "ultra", description: "Maximum compression: counts and summaries only" }
|
|
156
|
+
]);
|
|
157
|
+
patch.shellCompressionLevel = compressionChoice;
|
|
151
158
|
return patch;
|
|
152
159
|
}
|
|
153
160
|
// Annotate the CommonJS export names for ESM import in node:
|