kirograph 0.27.1 → 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 +35 -2
- 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/callees.js +76 -0
- package/dist/bin/commands/callees.js.map +7 -0
- package/dist/bin/commands/callers.js +76 -0
- package/dist/bin/commands/callers.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/circular-deps.js +68 -0
- package/dist/bin/commands/circular-deps.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/impact.js +76 -0
- package/dist/bin/commands/impact.js.map +7 -0
- 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/type-hierarchy.js +76 -0
- package/dist/bin/commands/type-hierarchy.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 +19 -9
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +147 -12
- package/dist/bin/installer/config-prompt.js.map +3 -3
- package/dist/bin/installer/index.js +62 -6
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +14 -25
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.js.map +2 -2
- package/dist/bin/installer/steering.js +569 -100
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.js +4 -4
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.js +3 -3
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.js +4 -4
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.js +4 -4
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.js +4 -4
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.js +4 -4
- package/dist/bin/installer/targets/copilot-cli.js.map +2 -2
- package/dist/bin/installer/targets/copilot.js +4 -4
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.js +5 -5
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.js +4 -4
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.js +4 -4
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.js +2 -2
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.js +3 -4
- package/dist/bin/installer/targets/goose.js.map +3 -3
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/junie.js +4 -4
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.js +4 -4
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.js +27 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.js +3 -3
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.js +2 -2
- package/dist/bin/installer/targets/qoder.js.map +2 -2
- package/dist/bin/installer/targets/qwen.js +2 -2
- package/dist/bin/installer/targets/qwen.js.map +2 -2
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.js +4 -4
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.js +3 -3
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.js +4 -4
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.js +4 -4
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +83 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/config.js +30 -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/cache.js +1 -1
- package/dist/mcp/cache.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 +136 -10
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +846 -3019
- package/dist/mcp/tools.js.map +3 -3
- package/dist/types.js.map +2 -2
- package/package.json +36 -10
|
@@ -0,0 +1,76 @@
|
|
|
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 type_hierarchy_exports = {};
|
|
30
|
+
__export(type_hierarchy_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(type_hierarchy_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_ui = require("../ui");
|
|
36
|
+
function register(program) {
|
|
37
|
+
program.command("type-hierarchy <symbol>").description("Traverse the type hierarchy of a class or interface (base types and derived types)").option("--direction <dir>", "Direction: up (base types), down (derived types), both (default)", "both").option("-j, --json", "Output as JSON").option("-p, --path <path>", "Project path").action(async (symbol, opts) => {
|
|
38
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
39
|
+
const target = path.resolve(opts.path ?? process.cwd());
|
|
40
|
+
const cg = await KiroGraph.open(target);
|
|
41
|
+
const results = cg.searchNodes(symbol, void 0, 5);
|
|
42
|
+
if (results.length === 0) {
|
|
43
|
+
console.error(` \u2716 Symbol "${symbol}" not found in index.`);
|
|
44
|
+
cg.close();
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
const node = results[0].node;
|
|
48
|
+
const direction = ["up", "down", "both"].includes(opts.direction) ? opts.direction : "both";
|
|
49
|
+
const hierarchy = cg.getTypeHierarchy(node.id, direction);
|
|
50
|
+
if (opts.json) {
|
|
51
|
+
console.log(JSON.stringify({ symbol: node.name, direction, hierarchy }));
|
|
52
|
+
cg.close();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (hierarchy.length === 0) {
|
|
56
|
+
console.log(`
|
|
57
|
+
${import_ui.dim}No type hierarchy found for \`${node.name}\`.${import_ui.reset}
|
|
58
|
+
`);
|
|
59
|
+
cg.close();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
console.log(`
|
|
63
|
+
${import_ui.violet}${import_ui.bold}Type hierarchy of \`${node.name}\`${import_ui.reset} ${import_ui.dim}(direction: ${direction})${import_ui.reset}
|
|
64
|
+
`);
|
|
65
|
+
for (const n of hierarchy) {
|
|
66
|
+
console.log(` ${import_ui.violet}${n.name}${import_ui.reset} ${import_ui.dim}${n.kind} ${n.filePath}:${n.startLine}${import_ui.reset}`);
|
|
67
|
+
}
|
|
68
|
+
console.log();
|
|
69
|
+
cg.close();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
register
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=type-hierarchy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/type-hierarchy.ts"],
|
|
4
|
+
"sourcesContent": ["import * as path from 'path';\nimport { Command } from 'commander';\nimport { bold, dim, reset, violet } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('type-hierarchy <symbol>')\n .description('Traverse the type hierarchy of a class or interface (base types and derived types)')\n .option('--direction <dir>', 'Direction: up (base types), down (derived types), both (default)', 'both')\n .option('-j, --json', 'Output as JSON')\n .option('-p, --path <path>', 'Project path')\n .action(async (symbol: string, opts: { direction: string; json?: boolean; path?: string }) => {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n const target = path.resolve(opts.path ?? process.cwd());\n const cg = await KiroGraph.open(target);\n\n const results = cg.searchNodes(symbol, undefined, 5);\n if (results.length === 0) {\n console.error(` \u2716 Symbol \"${symbol}\" not found in index.`);\n cg.close(); process.exit(1);\n }\n\n const node = results[0].node;\n const direction = (['up', 'down', 'both'].includes(opts.direction) ? opts.direction : 'both') as 'up' | 'down' | 'both';\n const hierarchy = cg.getTypeHierarchy(node.id, direction);\n\n if (opts.json) {\n console.log(JSON.stringify({ symbol: node.name, direction, hierarchy }));\n cg.close(); return;\n }\n\n if (hierarchy.length === 0) {\n console.log(`\\n ${dim}No type hierarchy found for \\`${node.name}\\`.${reset}\\n`);\n cg.close(); return;\n }\n\n console.log(`\\n ${violet}${bold}Type hierarchy of \\`${node.name}\\`${reset} ${dim}(direction: ${direction})${reset}\\n`);\n for (const n of hierarchy) {\n console.log(` ${violet}${n.name}${reset} ${dim}${n.kind} ${n.filePath}:${n.startLine}${reset}`);\n }\n console.log();\n cg.close();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAEtB,gBAAyC;AAElC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,yBAAyB,EACjC,YAAY,oFAAoF,EAChG,OAAO,qBAAqB,oEAAoE,MAAM,EACtG,OAAO,cAAc,gBAAgB,EACrC,OAAO,qBAAqB,cAAc,EAC1C,OAAO,OAAO,QAAgB,SAA+D;AAC5F,UAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,UAAM,SAAS,KAAK,QAAQ,KAAK,QAAQ,QAAQ,IAAI,CAAC;AACtD,UAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AAEtC,UAAM,UAAU,GAAG,YAAY,QAAQ,QAAW,CAAC;AACnD,QAAI,QAAQ,WAAW,GAAG;AACxB,cAAQ,MAAM,oBAAe,MAAM,uBAAuB;AAC1D,SAAG,MAAM;AAAG,cAAQ,KAAK,CAAC;AAAA,IAC5B;AAEA,UAAM,OAAO,QAAQ,CAAC,EAAE;AACxB,UAAM,YAAa,CAAC,MAAM,QAAQ,MAAM,EAAE,SAAS,KAAK,SAAS,IAAI,KAAK,YAAY;AACtF,UAAM,YAAY,GAAG,iBAAiB,KAAK,IAAI,SAAS;AAExD,QAAI,KAAK,MAAM;AACb,cAAQ,IAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,MAAM,WAAW,UAAU,CAAC,CAAC;AACvE,SAAG,MAAM;AAAG;AAAA,IACd;AAEA,QAAI,UAAU,WAAW,GAAG;AAC1B,cAAQ,IAAI;AAAA,IAAO,aAAG,iCAAiC,KAAK,IAAI,MAAM,eAAK;AAAA,CAAI;AAC/E,SAAG,MAAM;AAAG;AAAA,IACd;AAEA,YAAQ,IAAI;AAAA,IAAO,gBAAM,GAAG,cAAI,uBAAuB,KAAK,IAAI,KAAK,eAAK,KAAK,aAAG,eAAe,SAAS,IAAI,eAAK;AAAA,CAAI;AACvH,eAAW,KAAK,WAAW;AACzB,cAAQ,IAAI,KAAK,gBAAM,GAAG,EAAE,IAAI,GAAG,eAAK,KAAK,aAAG,GAAG,EAAE,IAAI,KAAK,EAAE,QAAQ,IAAI,EAAE,SAAS,GAAG,eAAK,EAAE;AAAA,IACnG;AACA,YAAQ,IAAI;AACZ,OAAG,MAAM;AAAA,EACX,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 unused_imports_exports = {};
|
|
30
|
+
__export(unused_imports_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(unused_imports_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("unused-imports [projectPath]").description("Find import nodes with zero resolved downstream edges").option("--limit <n>", "Max results (default: 50)", "50").action(async (projectPath, opts) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
await runTool(target, "kirograph_unused_imports", { limit: parseInt(opts.limit) });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
register
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=unused-imports.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/unused-imports.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('unused-imports [projectPath]')\n .description('Find import nodes with zero resolved downstream edges')\n .option('--limit <n>', 'Max results (default: 50)', '50')\n .action(async (projectPath: string | undefined, opts: { limit: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n await runTool(target, 'kirograph_unused_imports', { limit: parseInt(opts.limit) });\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAGtB,eAAe,QAAQ,QAAgB,UAAkB,MAA8C;AACrG,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,gBAAgB,CAAC,GAAG;AAClF,QAAM,EAAE,YAAY,IAAK,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,sBAAsB,CAAC;AAC3F,QAAM,KAAK,MAAM,UAAU,KAAK,MAAM;AACtC,QAAM,UAAU,IAAI,YAAY,EAAE;AAClC,QAAM,SAAS,MAAM,QAAQ,OAAO,UAAU,EAAE,GAAG,MAAM,aAAa,OAAO,CAAC;AAC9E,KAAG,MAAM;AACT,QAAM,OAAe,OAAO,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK,EAAE;AACnE,UAAQ,IAAI,IAAI;AAClB;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,8BAA8B,EACtC,YAAY,uDAAuD,EACnE,OAAO,eAAe,6BAA6B,IAAI,EACvD,OAAO,OAAO,aAAiC,SAA4B;AAC1E,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,QAAQ,QAAQ,4BAA4B,EAAE,OAAO,SAAS,KAAK,KAAK,EAAE,CAAC;AAAA,EACnF,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 upgrade_exports = {};
|
|
20
|
+
__export(upgrade_exports, {
|
|
21
|
+
register: () => register
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(upgrade_exports);
|
|
24
|
+
var import_child_process = require("child_process");
|
|
25
|
+
function detectInstaller() {
|
|
26
|
+
try {
|
|
27
|
+
const npmOut = (0, import_child_process.execSync)("npm list -g --depth=0 kirograph 2>/dev/null", { stdio: "pipe" }).toString();
|
|
28
|
+
if (npmOut.includes("kirograph")) return "npm";
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const bunOut = (0, import_child_process.execSync)("bun pm ls -g 2>/dev/null | grep kirograph", { stdio: "pipe" }).toString();
|
|
33
|
+
if (bunOut.includes("kirograph")) return "bun";
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const pnpmOut = (0, import_child_process.execSync)("pnpm list -g --depth=0 kirograph 2>/dev/null", { stdio: "pipe" }).toString();
|
|
38
|
+
if (pnpmOut.includes("kirograph")) return "pnpm";
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return "unknown";
|
|
42
|
+
}
|
|
43
|
+
function register(program) {
|
|
44
|
+
program.command("upgrade").description("Update KiroGraph to the latest version").option("--dry-run", "Show what would be run without executing").action((opts) => {
|
|
45
|
+
const installer = detectInstaller();
|
|
46
|
+
const commands = {
|
|
47
|
+
npm: "npm update -g kirograph",
|
|
48
|
+
bun: "bun update -g kirograph",
|
|
49
|
+
pnpm: "pnpm update -g kirograph",
|
|
50
|
+
yarn: "yarn global upgrade kirograph"
|
|
51
|
+
};
|
|
52
|
+
if (installer === "unknown") {
|
|
53
|
+
console.log(" Could not detect package manager. Try one of:");
|
|
54
|
+
for (const [mgr, cmd2] of Object.entries(commands)) {
|
|
55
|
+
console.log(" " + mgr + ": " + cmd2);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const cmd = commands[installer];
|
|
60
|
+
console.log(" Detected installer: " + installer);
|
|
61
|
+
console.log(" Running: " + cmd);
|
|
62
|
+
if (opts.dryRun) {
|
|
63
|
+
console.log(" (dry run \u2014 not executing)");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const result = (0, import_child_process.spawnSync)(cmd.split(" ")[0], cmd.split(" ").slice(1), { stdio: "inherit" });
|
|
67
|
+
if (result.status !== 0) {
|
|
68
|
+
console.error(" Upgrade failed (exit " + result.status + ")");
|
|
69
|
+
process.exit(result.status ?? 1);
|
|
70
|
+
}
|
|
71
|
+
console.log(" Done.");
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
register
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/upgrade.ts"],
|
|
4
|
+
"sourcesContent": ["import { execSync, spawnSync } from 'child_process';\nimport { Command } from 'commander';\n\nfunction detectInstaller(): 'npm' | 'bun' | 'pnpm' | 'yarn' | 'unknown' {\n try {\n const npmOut = execSync('npm list -g --depth=0 kirograph 2>/dev/null', { stdio: 'pipe' }).toString();\n if (npmOut.includes('kirograph')) return 'npm';\n } catch { /* */ }\n try {\n const bunOut = execSync('bun pm ls -g 2>/dev/null | grep kirograph', { stdio: 'pipe' }).toString();\n if (bunOut.includes('kirograph')) return 'bun';\n } catch { /* */ }\n try {\n const pnpmOut = execSync('pnpm list -g --depth=0 kirograph 2>/dev/null', { stdio: 'pipe' }).toString();\n if (pnpmOut.includes('kirograph')) return 'pnpm';\n } catch { /* */ }\n return 'unknown';\n}\n\nexport function register(program: Command): void {\n program.command('upgrade')\n .description('Update KiroGraph to the latest version')\n .option('--dry-run', 'Show what would be run without executing')\n .action((opts: { dryRun?: boolean }) => {\n const installer = detectInstaller();\n const commands: Record<string, string> = {\n npm: 'npm update -g kirograph',\n bun: 'bun update -g kirograph',\n pnpm: 'pnpm update -g kirograph',\n yarn: 'yarn global upgrade kirograph',\n };\n\n if (installer === 'unknown') {\n console.log(' Could not detect package manager. Try one of:');\n for (const [mgr, cmd] of Object.entries(commands)) {\n console.log(' ' + mgr + ': ' + cmd);\n }\n return;\n }\n\n const cmd = commands[installer];\n console.log(' Detected installer: ' + installer);\n console.log(' Running: ' + cmd);\n\n if (opts.dryRun) {\n console.log(' (dry run \u2014 not executing)');\n return;\n }\n\n const result = spawnSync(cmd.split(' ')[0], cmd.split(' ').slice(1), { stdio: 'inherit' });\n if (result.status !== 0) {\n console.error(' Upgrade failed (exit ' + result.status + ')');\n process.exit(result.status ?? 1);\n }\n console.log(' Done.');\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAoC;AAGpC,SAAS,kBAA+D;AACtE,MAAI;AACF,UAAM,aAAS,+BAAS,+CAA+C,EAAE,OAAO,OAAO,CAAC,EAAE,SAAS;AACnG,QAAI,OAAO,SAAS,WAAW,EAAG,QAAO;AAAA,EAC3C,QAAQ;AAAA,EAAQ;AAChB,MAAI;AACF,UAAM,aAAS,+BAAS,6CAA6C,EAAE,OAAO,OAAO,CAAC,EAAE,SAAS;AACjG,QAAI,OAAO,SAAS,WAAW,EAAG,QAAO;AAAA,EAC3C,QAAQ;AAAA,EAAQ;AAChB,MAAI;AACF,UAAM,cAAU,+BAAS,gDAAgD,EAAE,OAAO,OAAO,CAAC,EAAE,SAAS;AACrG,QAAI,QAAQ,SAAS,WAAW,EAAG,QAAO;AAAA,EAC5C,QAAQ;AAAA,EAAQ;AAChB,SAAO;AACT;AAEO,SAAS,SAAS,SAAwB;AAC/C,UAAQ,QAAQ,SAAS,EACtB,YAAY,wCAAwC,EACpD,OAAO,aAAa,0CAA0C,EAC9D,OAAO,CAAC,SAA+B;AACtC,UAAM,YAAY,gBAAgB;AAClC,UAAM,WAAmC;AAAA,MACvC,KAAK;AAAA,MACL,KAAK;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAEA,QAAI,cAAc,WAAW;AAC3B,cAAQ,IAAI,iDAAiD;AAC7D,iBAAW,CAAC,KAAKA,IAAG,KAAK,OAAO,QAAQ,QAAQ,GAAG;AACjD,gBAAQ,IAAI,SAAS,MAAM,OAAOA,IAAG;AAAA,MACvC;AACA;AAAA,IACF;AAEA,UAAM,MAAM,SAAS,SAAS;AAC9B,YAAQ,IAAI,2BAA2B,SAAS;AAChD,YAAQ,IAAI,gBAAgB,GAAG;AAE/B,QAAI,KAAK,QAAQ;AACf,cAAQ,IAAI,kCAA6B;AACzC;AAAA,IACF;AAEA,UAAM,aAAS,gCAAU,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,MAAM,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,UAAU,CAAC;AACzF,QAAI,OAAO,WAAW,GAAG;AACvB,cAAQ,MAAM,4BAA4B,OAAO,SAAS,GAAG;AAC7D,cAAQ,KAAK,OAAO,UAAU,CAAC;AAAA,IACjC;AACA,YAAQ,IAAI,SAAS;AAAA,EACvB,CAAC;AACL;",
|
|
6
|
+
"names": ["cmd"]
|
|
7
|
+
}
|
|
@@ -148,16 +148,26 @@ function removeGeneratedBlock(filePath, blockId) {
|
|
|
148
148
|
function escapeRegExp(s) {
|
|
149
149
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
150
150
|
}
|
|
151
|
-
function buildInstructionOpts(
|
|
151
|
+
function buildInstructionOpts(opts, hasHooks) {
|
|
152
152
|
return {
|
|
153
|
-
cavemanMode,
|
|
154
|
-
shellCompressionLevel: shellCompressionLevel ?? void 0,
|
|
155
|
-
enableArchitecture: enableArchitecture ?? false,
|
|
156
|
-
enableMemory: enableMemory ?? false,
|
|
157
|
-
enableDocs: enableDocs ?? false,
|
|
158
|
-
enableData: enableData ?? false,
|
|
159
|
-
enableSecurity: enableSecurity ?? false,
|
|
160
|
-
enablePatterns: enablePatterns ?? false,
|
|
153
|
+
cavemanMode: opts.cavemanMode,
|
|
154
|
+
shellCompressionLevel: opts.shellCompressionLevel ?? void 0,
|
|
155
|
+
enableArchitecture: opts.enableArchitecture ?? false,
|
|
156
|
+
enableMemory: opts.enableMemory ?? false,
|
|
157
|
+
enableDocs: opts.enableDocs ?? false,
|
|
158
|
+
enableData: opts.enableData ?? false,
|
|
159
|
+
enableSecurity: opts.enableSecurity ?? false,
|
|
160
|
+
enablePatterns: opts.enablePatterns ?? false,
|
|
161
|
+
enableWiki: opts.enableWiki ?? false,
|
|
162
|
+
enableCodeHealth: opts.enableCodeHealth ?? false,
|
|
163
|
+
enableNavigation: opts.enableNavigation ?? false,
|
|
164
|
+
enableComplexity: opts.enableComplexity ?? false,
|
|
165
|
+
enableGitContext: opts.enableGitContext ?? false,
|
|
166
|
+
enableEditPrimitives: opts.enableEditPrimitives ?? false,
|
|
167
|
+
enableBranch: opts.enableBranch ?? false,
|
|
168
|
+
enableAgentUtils: opts.enableAgentUtils ?? false,
|
|
169
|
+
enableGeneralCompression: opts.enableGeneralCompression ?? false,
|
|
170
|
+
trackCallSites: opts.trackCallSites ?? false,
|
|
161
171
|
hasHooks: hasHooks ?? false
|
|
162
172
|
};
|
|
163
173
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/common.ts"],
|
|
4
|
-
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_TOOL_NAMES } from '../../mcp/tool-names';\nimport type { InstructionOptions } from './instructions';\nimport type { CavemanMode } from './caveman';\n\nexport type InstallTarget = 'kiro' | 'claude' | 'codex' | 'cursor' | 'antigravity' | 'opencode' | 'windsurf' | 'cline' | 'copilot' | 'copilot-cli' | 'junie' | 'gemini-cli' | 'continue' | 'roo' | 'warp' | 'aider' | 'trae' | 'augment' | 'kilo' | 'amp' | 'devin' | 'replit' | 'goose' | 'openhands' | 'tabnine' | 'mistral-vibe' | 'ibm-bob' | 'crush' | 'droid-factory' | 'forgecode' | 'iflow' | 'qwen' | 'rovo' | 'qoder';\n\nexport const KIROGRAPH_SERVER_NAME = 'kirograph';\nexport const KIROGRAPH_COMMAND = 'kirograph';\nexport const KIROGRAPH_MCP_ARGS = ['serve', '--mcp'];\nexport const KIROGRAPH_SYNC_CMD = 'kirograph sync-if-dirty --quiet 2>/dev/null || true';\nexport const KIROGRAPH_TOOLS = KIROGRAPH_TOOL_NAMES;\nexport const KIROGRAPH_SCOPED_TOOLS = KIROGRAPH_TOOL_NAMES.map(name => `@kirograph/${name}`);\n\nexport function ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nexport function readJson(p: string): any {\n try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return {}; }\n}\n\nexport function writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/**\n * Write MCP server config to a JSON file under the mcpServers key.\n * Returns true if the config was written, false if already configured (idempotent).\n */\nexport function writeMcpServersConfig(configPath: string, serverConfig: object): boolean {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n if (existing.mcpServers[KIROGRAPH_SERVER_NAME]) {\n return false; // Already configured\n }\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n return true;\n}\n\n/**\n * Always write (overwrite) the MCP server config entry, regardless of whether it already exists.\n * Used when the final state is known upfront and idempotency would cause stale data.\n */\nexport function overwriteMcpServersConfig(configPath: string, serverConfig: object): void {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n}\n\nexport function removeMcpServersConfig(configPath: string): boolean {\n if (!fs.existsSync(configPath)) return false;\n const existing = readJson(configPath);\n if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;\n delete existing.mcpServers[KIROGRAPH_SERVER_NAME];\n writeJson(configPath, existing);\n return true;\n}\n\nexport function appendImportLine(filePath: string, line: string, heading: string): boolean {\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n if (existing.includes(line)) return false;\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + heading + '\\n' + line + '\\n');\n return true;\n}\n\nexport function removeImportLine(filePath: string, line: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const original = fs.readFileSync(filePath, 'utf8');\n const next = original\n .split('\\n')\n .filter(l => l.trim() !== line)\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nexport function upsertGeneratedBlock(filePath: string, blockId: string, heading: string, content: string): boolean {\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const block = `${start}\\n${heading}\\n\\n${content.trim()}\\n${end}`;\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n const pattern = new RegExp(`${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}`);\n\n if (pattern.test(existing)) {\n const next = existing.replace(pattern, block);\n if (next === existing) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n }\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + block + '\\n');\n return true;\n}\n\nexport function removeGeneratedBlock(filePath: string, blockId: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const original = fs.readFileSync(filePath, 'utf8');\n const pattern = new RegExp(`\\\\n?${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}\\\\n?`);\n const next = original.replace(pattern, '\\n').replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Build InstructionOptions from the installLate parameters.\n * Used by all targets to pass full feature config to buildAgentInstructions.\n */\nexport function buildInstructionOpts(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,wBAAqC;
|
|
4
|
+
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_TOOL_NAMES } from '../../mcp/tool-names';\nimport type { InstructionOptions } from './instructions';\nimport type { CavemanMode } from './caveman';\n\n/** Single options object passed to every target's installLate(). */\nexport interface LateInstallOptions {\n cavemanMode?: CavemanMode | 'off';\n shellCompressionLevel?: string;\n enableMemory?: boolean;\n enableDocs?: boolean;\n enableData?: boolean;\n enableSecurity?: boolean;\n enableArchitecture?: boolean;\n enablePatterns?: boolean;\n enableWatchmen?: boolean;\n watchmenSynthesisMode?: 'local' | 'agent';\n enableWiki?: boolean;\n wikiSynthesisMode?: 'local' | 'agent';\n wikiLocalModel?: string;\n enableCodeHealth?: boolean;\n enableNavigation?: boolean;\n enableComplexity?: boolean;\n enableGitContext?: boolean;\n enableEditPrimitives?: boolean;\n enableBranch?: boolean;\n enableAgentUtils?: boolean;\n enableGeneralCompression?: boolean;\n trackCallSites?: boolean;\n kiroHookFormat?: 'v1-legacy' | 'v2';\n}\n\nexport type InstallTarget = 'kiro' | 'claude' | 'codex' | 'cursor' | 'antigravity' | 'opencode' | 'windsurf' | 'cline' | 'copilot' | 'copilot-cli' | 'junie' | 'gemini-cli' | 'continue' | 'roo' | 'warp' | 'aider' | 'trae' | 'augment' | 'kilo' | 'amp' | 'devin' | 'replit' | 'goose' | 'openhands' | 'tabnine' | 'mistral-vibe' | 'ibm-bob' | 'crush' | 'droid-factory' | 'forgecode' | 'iflow' | 'qwen' | 'rovo' | 'qoder';\n\nexport const KIROGRAPH_SERVER_NAME = 'kirograph';\nexport const KIROGRAPH_COMMAND = 'kirograph';\nexport const KIROGRAPH_MCP_ARGS = ['serve', '--mcp'];\nexport const KIROGRAPH_SYNC_CMD = 'kirograph sync-if-dirty --quiet 2>/dev/null || true';\nexport const KIROGRAPH_TOOLS = KIROGRAPH_TOOL_NAMES;\nexport const KIROGRAPH_SCOPED_TOOLS = KIROGRAPH_TOOL_NAMES.map(name => `@kirograph/${name}`);\n\nexport function ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nexport function readJson(p: string): any {\n try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return {}; }\n}\n\nexport function writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/**\n * Write MCP server config to a JSON file under the mcpServers key.\n * Returns true if the config was written, false if already configured (idempotent).\n */\nexport function writeMcpServersConfig(configPath: string, serverConfig: object): boolean {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n if (existing.mcpServers[KIROGRAPH_SERVER_NAME]) {\n return false; // Already configured\n }\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n return true;\n}\n\n/**\n * Always write (overwrite) the MCP server config entry, regardless of whether it already exists.\n * Used when the final state is known upfront and idempotency would cause stale data.\n */\nexport function overwriteMcpServersConfig(configPath: string, serverConfig: object): void {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n}\n\nexport function removeMcpServersConfig(configPath: string): boolean {\n if (!fs.existsSync(configPath)) return false;\n const existing = readJson(configPath);\n if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;\n delete existing.mcpServers[KIROGRAPH_SERVER_NAME];\n writeJson(configPath, existing);\n return true;\n}\n\nexport function appendImportLine(filePath: string, line: string, heading: string): boolean {\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n if (existing.includes(line)) return false;\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + heading + '\\n' + line + '\\n');\n return true;\n}\n\nexport function removeImportLine(filePath: string, line: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const original = fs.readFileSync(filePath, 'utf8');\n const next = original\n .split('\\n')\n .filter(l => l.trim() !== line)\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nexport function upsertGeneratedBlock(filePath: string, blockId: string, heading: string, content: string): boolean {\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const block = `${start}\\n${heading}\\n\\n${content.trim()}\\n${end}`;\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n const pattern = new RegExp(`${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}`);\n\n if (pattern.test(existing)) {\n const next = existing.replace(pattern, block);\n if (next === existing) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n }\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + block + '\\n');\n return true;\n}\n\nexport function removeGeneratedBlock(filePath: string, blockId: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const original = fs.readFileSync(filePath, 'utf8');\n const pattern = new RegExp(`\\\\n?${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}\\\\n?`);\n const next = original.replace(pattern, '\\n').replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Build InstructionOptions from the installLate parameters.\n * Used by all targets to pass full feature config to buildAgentInstructions.\n */\nexport function buildInstructionOpts(opts: LateInstallOptions, hasHooks?: boolean): InstructionOptions {\n return {\n cavemanMode: opts.cavemanMode,\n shellCompressionLevel: (opts.shellCompressionLevel as InstructionOptions['shellCompressionLevel']) ?? undefined,\n enableArchitecture: opts.enableArchitecture ?? false,\n enableMemory: opts.enableMemory ?? false,\n enableDocs: opts.enableDocs ?? false,\n enableData: opts.enableData ?? false,\n enableSecurity: opts.enableSecurity ?? false,\n enablePatterns: opts.enablePatterns ?? false,\n enableWiki: opts.enableWiki ?? false,\n enableCodeHealth: opts.enableCodeHealth ?? false,\n enableNavigation: opts.enableNavigation ?? false,\n enableComplexity: opts.enableComplexity ?? false,\n enableGitContext: opts.enableGitContext ?? false,\n enableEditPrimitives: opts.enableEditPrimitives ?? false,\n enableBranch: opts.enableBranch ?? false,\n enableAgentUtils: opts.enableAgentUtils ?? false,\n enableGeneralCompression: opts.enableGeneralCompression ?? false,\n trackCallSites: opts.trackCallSites ?? false,\n hasHooks: hasHooks ?? false,\n };\n}\n\nconst violet = '\\x1b[38;5;99m';\nconst resetAnsi = '\\x1b[0m';\nconst dimAnsi = '\\x1b[2m';\nconst boldAnsi = '\\x1b[1m';\n\n/**\n * Print a highlighted MCP config JSON block for targets that need user-scoped setup.\n */\nexport function printMcpSetup(configPath: string, projectRoot: string): void {\n const escapedPath = projectRoot.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n console.log(`\\n ${dimAnsi}Add the MCP server manually:${resetAnsi}`);\n console.log(` ${dimAnsi}Edit${resetAnsi} ${violet}${boldAnsi}${configPath}${resetAnsi} ${dimAnsi}and add:${resetAnsi}`);\n console.log(` ${violet}{${resetAnsi}`);\n console.log(` ${violet} \"mcpServers\": {${resetAnsi}`);\n console.log(` ${violet} \"kirograph\": {${resetAnsi}`);\n console.log(` ${violet} \"command\": \"kirograph\",${resetAnsi}`);\n console.log(` ${violet} \"args\": [\"serve\", \"--mcp\", \"--path\", \"${escapedPath}\"]${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet}}${resetAnsi}\\n`);\n}\n\n/**\n * Print a highlighted CLI command for MCP registration.\n */\nexport function printMcpCommand(command: string): void {\n console.log(`\\n ${dimAnsi}Add the MCP server with:${resetAnsi}`);\n console.log(` ${violet}${boldAnsi}${command}${resetAnsi}\\n`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,wBAAq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CAAI;AAC9D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -24,6 +24,33 @@ __export(config_prompt_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(config_prompt_exports);
|
|
25
25
|
var import_prompts = require("./prompts");
|
|
26
26
|
var import_import_prompt = require("../../hooks/import-prompt");
|
|
27
|
+
const PROFILES = {
|
|
28
|
+
developer: {
|
|
29
|
+
label: "Developer",
|
|
30
|
+
description: "Code health, navigation, complexity, call-site tracking",
|
|
31
|
+
patch: { enableCodeHealth: true, enableNavigation: true, enableComplexity: true, trackCallSites: true }
|
|
32
|
+
},
|
|
33
|
+
team: {
|
|
34
|
+
label: "Team",
|
|
35
|
+
description: "Developer + architecture, git context, wiki",
|
|
36
|
+
patch: { enableCodeHealth: true, enableNavigation: true, enableComplexity: true, trackCallSites: true, enableArchitecture: true, enableGitContext: true, enableWiki: true, wikiSynthesisMode: "agent" }
|
|
37
|
+
},
|
|
38
|
+
security: {
|
|
39
|
+
label: "Security",
|
|
40
|
+
description: "Security analysis, patterns, architecture, code health",
|
|
41
|
+
patch: { enableSecurity: true, enableArchitecture: true, enablePatterns: true, enableCodeHealth: true }
|
|
42
|
+
},
|
|
43
|
+
data: {
|
|
44
|
+
label: "Data & Docs",
|
|
45
|
+
description: "Tabular data indexing and documentation navigation",
|
|
46
|
+
patch: { enableData: true, enableDocs: true }
|
|
47
|
+
},
|
|
48
|
+
ai: {
|
|
49
|
+
label: "AI / LLM Agent",
|
|
50
|
+
description: "Memory, watchmen, agent utils, wiki, general compression",
|
|
51
|
+
patch: { enableMemory: true, enableWatchmen: true, enableAgentUtils: true, enableWiki: true, wikiSynthesisMode: "agent", enableGeneralCompression: true }
|
|
52
|
+
}
|
|
53
|
+
};
|
|
27
54
|
const DEFAULT_EMBEDDING_MODEL = "nomic-ai/nomic-embed-text-v1.5";
|
|
28
55
|
const PRESET_MODELS = [
|
|
29
56
|
{
|
|
@@ -58,13 +85,99 @@ const PRESET_MODELS = [
|
|
|
58
85
|
}
|
|
59
86
|
];
|
|
60
87
|
async function promptConfigOptions(rl, opts = {}) {
|
|
88
|
+
const installMode = await (0, import_prompts.arrowSelect)(rl, "Installation mode:", [
|
|
89
|
+
{ value: "core", label: "Core only", description: "3 always-on tools (search, context, node) \u2014 ~170 tok. Zero config." },
|
|
90
|
+
{ value: "full", label: "Full", description: "Enable every feature with sensible defaults. Best for a fresh project." },
|
|
91
|
+
{ value: "profiles", label: "Profiles", description: "Choose a preset bundle (Developer, Team, Security, Data & Docs, AI/LLM)." },
|
|
92
|
+
{ value: "custom", label: "Custom", description: "Answer each question individually. Maximum control." }
|
|
93
|
+
]);
|
|
94
|
+
const basePatch = {
|
|
95
|
+
enableEmbeddings: false,
|
|
96
|
+
useVecIndex: false,
|
|
97
|
+
semanticEngine: "cosine",
|
|
98
|
+
turboquantMemDocs: false,
|
|
99
|
+
turboquantBits: 3,
|
|
100
|
+
turbovecMemDocs: false,
|
|
101
|
+
turbovecBits: 4,
|
|
102
|
+
typesenseDashboard: false,
|
|
103
|
+
qdrantDashboard: false,
|
|
104
|
+
extractDocstrings: false,
|
|
105
|
+
trackCallSites: false,
|
|
106
|
+
enableArchitecture: false,
|
|
107
|
+
cavemanMode: "off",
|
|
108
|
+
shellCompressionLevel: "off",
|
|
109
|
+
enableMemory: false,
|
|
110
|
+
enableWatchmen: false,
|
|
111
|
+
watchmenThreshold: 5,
|
|
112
|
+
watchmenSynthesisMode: "local",
|
|
113
|
+
watchmenLocalModel: "onnx-community/gemma-4-E4B-it-ONNX",
|
|
114
|
+
enableDocs: false,
|
|
115
|
+
docsContextLimit: 0,
|
|
116
|
+
enableData: false,
|
|
117
|
+
dataContextLimit: 0,
|
|
118
|
+
enableSecurity: false,
|
|
119
|
+
enablePatterns: false,
|
|
120
|
+
enableWiki: false,
|
|
121
|
+
wikiSynthesisMode: "agent",
|
|
122
|
+
wikiLocalModel: "onnx-community/gemma-4-E4B-it-ONNX",
|
|
123
|
+
enableCodeHealth: false,
|
|
124
|
+
enableNavigation: false,
|
|
125
|
+
enableComplexity: false,
|
|
126
|
+
enableGitContext: false,
|
|
127
|
+
enableEditPrimitives: false,
|
|
128
|
+
enableBranch: false,
|
|
129
|
+
enableAgentUtils: false,
|
|
130
|
+
enableGeneralCompression: false
|
|
131
|
+
};
|
|
132
|
+
if (installMode === "core") {
|
|
133
|
+
return { patch: basePatch, hooksToImport: null };
|
|
134
|
+
}
|
|
135
|
+
if (installMode === "full") {
|
|
136
|
+
const fullPatch = {
|
|
137
|
+
...basePatch,
|
|
138
|
+
enableEmbeddings: true,
|
|
139
|
+
embeddingModel: DEFAULT_EMBEDDING_MODEL,
|
|
140
|
+
embeddingDim: 768,
|
|
141
|
+
extractDocstrings: true,
|
|
142
|
+
trackCallSites: true,
|
|
143
|
+
enableArchitecture: true,
|
|
144
|
+
shellCompressionLevel: "normal",
|
|
145
|
+
enableCodeHealth: true,
|
|
146
|
+
enableNavigation: true,
|
|
147
|
+
enableComplexity: true,
|
|
148
|
+
enableGitContext: true,
|
|
149
|
+
enableEditPrimitives: true,
|
|
150
|
+
enableBranch: true,
|
|
151
|
+
enableAgentUtils: true,
|
|
152
|
+
enableGeneralCompression: true,
|
|
153
|
+
enableSecurity: true,
|
|
154
|
+
enablePatterns: true,
|
|
155
|
+
enableDocs: true,
|
|
156
|
+
enableData: true,
|
|
157
|
+
enableMemory: true,
|
|
158
|
+
enableWatchmen: true,
|
|
159
|
+
enableWiki: true,
|
|
160
|
+
wikiSynthesisMode: "agent"
|
|
161
|
+
};
|
|
162
|
+
return { patch: fullPatch, hooksToImport: null };
|
|
163
|
+
}
|
|
164
|
+
if (installMode === "profiles") {
|
|
165
|
+
const profileKey = await (0, import_prompts.arrowSelect)(rl, "Select a profile:", Object.entries(PROFILES).map(([key, p]) => ({
|
|
166
|
+
value: key,
|
|
167
|
+
label: p.label,
|
|
168
|
+
description: p.description
|
|
169
|
+
})));
|
|
170
|
+
const profile = PROFILES[profileKey];
|
|
171
|
+
const patch2 = { ...basePatch, ...profile.patch };
|
|
172
|
+
return { patch: patch2, hooksToImport: null };
|
|
173
|
+
}
|
|
61
174
|
(0, import_prompts.printSection)("\u{1F50D}", "Semantic Search");
|
|
62
175
|
const enableEmbeddings = await (0, import_prompts.askToggle)(
|
|
63
176
|
rl,
|
|
64
177
|
"Semantic embeddings (similarity search):",
|
|
65
178
|
"Enables natural-language code search via vector embeddings. A local model (~130MB) is downloaded on first use."
|
|
66
179
|
);
|
|
67
|
-
const patch = {
|
|
180
|
+
const patch = { ...basePatch, enableEmbeddings };
|
|
68
181
|
if (enableEmbeddings) {
|
|
69
182
|
const modelChoice = await (0, import_prompts.arrowSelect)(
|
|
70
183
|
rl,
|
|
@@ -115,7 +228,7 @@ async function promptConfigOptions(rl, opts = {}) {
|
|
|
115
228
|
]);
|
|
116
229
|
patch.semanticEngine = semanticEngine;
|
|
117
230
|
patch.useVecIndex = semanticEngine === "sqlite-vec";
|
|
118
|
-
if (semanticEngine === "
|
|
231
|
+
if (semanticEngine === "turboquant") {
|
|
119
232
|
patch.turboquantMemDocs = await (0, import_prompts.askToggle)(
|
|
120
233
|
rl,
|
|
121
234
|
"TurboQuant for memory & docs search (optional):",
|
|
@@ -172,19 +285,35 @@ async function promptConfigOptions(rl, opts = {}) {
|
|
|
172
285
|
"Detects packages from manifests and architectural layers. Enables kirograph_architecture, kirograph_coupling, kirograph_package.",
|
|
173
286
|
false
|
|
174
287
|
);
|
|
175
|
-
if (patch.enableArchitecture) {
|
|
176
|
-
patch.enableAdvancedAnalysis = await (0, import_prompts.askToggle)(
|
|
177
|
-
rl,
|
|
178
|
-
"Advanced graph analysis (type hierarchies, flows, communities, refactor):",
|
|
179
|
-
"Enables kirograph_type_hierarchy, kirograph_flows, kirograph_communities, kirograph_refactor. Most useful alongside architecture analysis.",
|
|
180
|
-
false
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
288
|
(0, import_prompts.printSection)("\u{1F4CA}", "Graph Tools");
|
|
289
|
+
patch.enableNavigation = await (0, import_prompts.askToggle)(
|
|
290
|
+
rl,
|
|
291
|
+
"Navigation tools (status, files, impact):",
|
|
292
|
+
"Enables kirograph_status, kirograph_files, kirograph_impact.",
|
|
293
|
+
false
|
|
294
|
+
);
|
|
184
295
|
patch.enableCodeHealth = await (0, import_prompts.askToggle)(
|
|
185
296
|
rl,
|
|
186
|
-
"Code health tools (hotspots, dead code,
|
|
187
|
-
"Enables kirograph_hotspots, kirograph_surprising, kirograph_diff, kirograph_dead_code, kirograph_circular_deps.",
|
|
297
|
+
"Code health tools (hotspots, dead code, path analysis, type hierarchy):",
|
|
298
|
+
"Enables kirograph_hotspots, kirograph_surprising, kirograph_diff, kirograph_dead_code, kirograph_circular_deps, kirograph_path, kirograph_affected, kirograph_type_hierarchy.",
|
|
299
|
+
false
|
|
300
|
+
);
|
|
301
|
+
patch.enableComplexity = await (0, import_prompts.askToggle)(
|
|
302
|
+
rl,
|
|
303
|
+
"Complexity metrics tools:",
|
|
304
|
+
"Enables complexity analysis, simplify scan, health score, DSM, test risk.",
|
|
305
|
+
false
|
|
306
|
+
);
|
|
307
|
+
patch.enableGitContext = await (0, import_prompts.askToggle)(
|
|
308
|
+
rl,
|
|
309
|
+
"Git context tools (diff context, commit context, flows):",
|
|
310
|
+
"Enables kirograph_flows, kirograph_diff_context, kirograph_commit_context, kirograph_pr_context, kirograph_changelog, kirograph_test_map, kirograph_test_coverage.",
|
|
311
|
+
false
|
|
312
|
+
);
|
|
313
|
+
patch.enableEditPrimitives = await (0, import_prompts.askToggle)(
|
|
314
|
+
rl,
|
|
315
|
+
"Edit primitive tools (str_replace, insert_at, refactor):",
|
|
316
|
+
"Enables kirograph_refactor, kirograph_str_replace, kirograph_multi_str_replace, kirograph_insert_at, kirograph_ast_grep_rewrite.",
|
|
188
317
|
false
|
|
189
318
|
);
|
|
190
319
|
patch.enableAgentUtils = await (0, import_prompts.askToggle)(
|
|
@@ -278,6 +407,12 @@ async function promptConfigOptions(rl, opts = {}) {
|
|
|
278
407
|
if (compressionChoice === "off") {
|
|
279
408
|
console.log(" \u2139 kirograph_exec disabled (shell compression is off)");
|
|
280
409
|
}
|
|
410
|
+
patch.enableGeneralCompression = await (0, import_prompts.askToggle)(
|
|
411
|
+
rl,
|
|
412
|
+
"General-purpose compression tool (kirograph_compress):",
|
|
413
|
+
"Enables kirograph_compress \u2014 an on-demand MCP tool that compresses arbitrary text before it reaches the model. Two engines: rtk-style structural filters for shell output (git, npm, test logs) when a command hint is provided, or caveman grammar rules for prose and observations otherwise. Useful when the agent pastes large content, receives a fat RAG chunk, or wants to explicitly compress before storing. Independent from automatic shell compression (kirograph_exec) and caveman mode \u2014 those apply in the background; this gives the model an explicit, on-demand compression action.",
|
|
414
|
+
false
|
|
415
|
+
);
|
|
281
416
|
let hooksToImport = null;
|
|
282
417
|
if (opts.offerHookImport && opts.projectRoot) {
|
|
283
418
|
(0, import_prompts.printSection)("\u{1FA9D}", "Hooks");
|