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.
Files changed (67) hide show
  1. package/README.md +191 -8
  2. package/dist/bin/commands/caveman.js +7 -2
  3. package/dist/bin/commands/caveman.js.map +2 -2
  4. package/dist/bin/commands/compression.js +109 -0
  5. package/dist/bin/commands/compression.js.map +7 -0
  6. package/dist/bin/commands/context.js +31 -24
  7. package/dist/bin/commands/context.js.map +2 -2
  8. package/dist/bin/commands/exec.js +107 -0
  9. package/dist/bin/commands/exec.js.map +7 -0
  10. package/dist/bin/commands/gain.js +119 -0
  11. package/dist/bin/commands/gain.js.map +7 -0
  12. package/dist/bin/commands/help.js +10 -1
  13. package/dist/bin/commands/help.js.map +2 -2
  14. package/dist/bin/commands/query.js +5 -1
  15. package/dist/bin/commands/query.js.map +2 -2
  16. package/dist/bin/commands/uninit.js +1 -1
  17. package/dist/bin/commands/uninit.js.map +2 -2
  18. package/dist/bin/commands/utils.js +16 -0
  19. package/dist/bin/commands/utils.js.map +2 -2
  20. package/dist/bin/installer/config-prompt.js +9 -2
  21. package/dist/bin/installer/config-prompt.js.map +2 -2
  22. package/dist/bin/installer/hooks.js +19 -1
  23. package/dist/bin/installer/hooks.js.map +2 -2
  24. package/dist/bin/installer/index.js +6 -1
  25. package/dist/bin/installer/index.js.map +2 -2
  26. package/dist/bin/installer/steering.js +116 -40
  27. package/dist/bin/installer/steering.js.map +2 -2
  28. package/dist/bin/installer/targets/index.js.map +1 -1
  29. package/dist/bin/installer/targets/kiro.js +4 -2
  30. package/dist/bin/installer/targets/kiro.js.map +2 -2
  31. package/dist/bin/kirograph.js +7 -1
  32. package/dist/bin/kirograph.js.map +3 -3
  33. package/dist/compression/filters/aws.js +418 -0
  34. package/dist/compression/filters/aws.js.map +7 -0
  35. package/dist/compression/filters/docker.js +153 -0
  36. package/dist/compression/filters/docker.js.map +7 -0
  37. package/dist/compression/filters/files.js +150 -0
  38. package/dist/compression/filters/files.js.map +7 -0
  39. package/dist/compression/filters/generic.js +86 -0
  40. package/dist/compression/filters/generic.js.map +7 -0
  41. package/dist/compression/filters/git.js +272 -0
  42. package/dist/compression/filters/git.js.map +7 -0
  43. package/dist/compression/filters/github.js +137 -0
  44. package/dist/compression/filters/github.js.map +7 -0
  45. package/dist/compression/filters/lint.js +280 -0
  46. package/dist/compression/filters/lint.js.map +7 -0
  47. package/dist/compression/filters/misc.js +212 -0
  48. package/dist/compression/filters/misc.js.map +7 -0
  49. package/dist/compression/filters/package.js +151 -0
  50. package/dist/compression/filters/package.js.map +7 -0
  51. package/dist/compression/filters/test.js +266 -0
  52. package/dist/compression/filters/test.js.map +7 -0
  53. package/dist/compression/index.js +144 -0
  54. package/dist/compression/index.js.map +7 -0
  55. package/dist/compression/naive-cost.js +94 -0
  56. package/dist/compression/naive-cost.js.map +7 -0
  57. package/dist/compression/tracker.js +228 -0
  58. package/dist/compression/tracker.js.map +7 -0
  59. package/dist/compression/types.js +17 -0
  60. package/dist/compression/types.js.map +7 -0
  61. package/dist/config.js +18 -1
  62. package/dist/config.js.map +2 -2
  63. package/dist/mcp/tool-names.js +3 -1
  64. package/dist/mcp/tool-names.js.map +2 -2
  65. package/dist/mcp/tools.js +170 -4
  66. package/dist/mcp/tools.js.map +3 -3
  67. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/bin/installer/config-prompt.ts"],
4
- "sourcesContent": ["/**\n * KiroGraph Installer \u2014 configuration prompting\n */\n\nimport * as readline from 'readline';\nimport { KiroGraphConfig } from '../../config';\ntype CavemanMode = 'lite' | 'full' | 'ultra';\nimport { ask, askBool, arrowSelect, dim, reset, violet } from './prompts';\nexport type ConfigPatch = Pick<KiroGraphConfig, 'enableEmbeddings' | 'useVecIndex' | 'semanticEngine' | 'typesenseDashboard' | 'qdrantDashboard' | 'extractDocstrings' | 'trackCallSites' | 'enableArchitecture' | 'cavemanMode'> & { embeddingModel?: string; embeddingDim?: number };\nexport type SemanticEngine = KiroGraphConfig['semanticEngine'];\n\nexport const DEFAULT_EMBEDDING_MODEL = 'nomic-ai/nomic-embed-text-v1.5';\n\n/** Well-known embedding models with their output dimensions. */\nconst PRESET_MODELS = [\n {\n value: 'nomic-ai/nomic-embed-text-v1.5',\n label: 'nomic-embed-text-v1.5',\n dim: 768,\n description: '768-dim \u00B7 ~130MB \u00B7 Best quality for code search (recommended)',\n },\n {\n value: 'onnx-community/embeddinggemma-300m-ONNX',\n label: 'embeddinggemma-300m',\n dim: 768,\n description: '768-dim \u00B7 ~300MB \u00B7 Google Gemma-based, multilingual, 2048-token context',\n },\n {\n value: 'Xenova/all-MiniLM-L6-v2',\n label: 'all-MiniLM-L6-v2',\n dim: 384,\n description: '384-dim \u00B7 ~23MB \u00B7 Fast and lightweight, lower accuracy',\n },\n {\n value: 'BAAI/bge-base-en-v1.5',\n label: 'bge-base-en-v1.5',\n dim: 768,\n description: '768-dim \u00B7 ~110MB \u00B7 Strong general-purpose alternative to nomic',\n },\n {\n value: '__other__',\n label: 'Other',\n dim: 768,\n description: 'Enter a custom HuggingFace model ID and embedding dimension',\n },\n] as const;\n\nexport async function promptConfigOptions(rl: readline.Interface): Promise<ConfigPatch> {\n const enableEmbeddings = await askBool(\n rl,\n 'Enable semantic embeddings for similarity search? (requires a local embedding model)',\n 'Enables semantic/similarity-based code search. Increases indexing time; the chosen embedding model is downloaded automatically on first use.',\n );\n\n const patch: ConfigPatch = { enableEmbeddings, useVecIndex: false, semanticEngine: 'cosine', typesenseDashboard: false, qdrantDashboard: false, extractDocstrings: true, trackCallSites: true, enableArchitecture: false, cavemanMode: 'off' };\n\n if (enableEmbeddings) {\n // \u2500\u2500 Model selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const modelChoice = await arrowSelect<string>(\n rl,\n 'Choose an embedding model:',\n PRESET_MODELS.map(m => ({ value: m.value, label: m.label, description: m.description })),\n );\n\n let embeddingModel: string;\n let embeddingDim: number;\n\n if (modelChoice === '__other__') {\n console.log(`\\n ${dim}Enter a HuggingFace model ID in the format org/model-name.${reset}`);\n while (true) {\n const raw = (await ask(rl, ` ${violet}Model identifier:${reset} `)).trim();\n if (raw.includes('/')) { embeddingModel = raw; break; }\n console.log(` Expected a HuggingFace model ID in the format org/model-name (e.g. nomic-ai/nomic-embed-text-v1.5).`);\n }\n console.log(`\\n ${dim}Enter the embedding output dimension for this model (check the model card on HuggingFace).${reset}`);\n while (true) {\n const raw = (await ask(rl, ` ${violet}Embedding dimension (e.g. 768, 384):${reset} `)).trim();\n const n = parseInt(raw, 10);\n if (!isNaN(n) && n > 0) { embeddingDim = n; break; }\n console.log(` Expected a positive integer (e.g. 768, 384, 1536).`);\n }\n } else {\n const preset = PRESET_MODELS.find(m => m.value === modelChoice)!;\n embeddingModel = preset.value;\n embeddingDim = preset.dim;\n }\n\n patch.embeddingModel = embeddingModel;\n patch.embeddingDim = embeddingDim;\n\n // \u2500\u2500 Engine selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const semanticEngine = await arrowSelect<SemanticEngine>(rl, 'Choose the semantic search engine:', [\n { value: 'cosine', label: 'cosine', description: 'In-process cosine similarity. No extra deps. Best for small/medium projects.' },\n { value: 'sqlite-vec', label: 'sqlite-vec', description: 'ANN index. Sub-linear search. Best for large codebases. Needs: better-sqlite3, sqlite-vec (native).' },\n { value: 'orama', label: 'orama', description: 'Hybrid search (full-text + vector). Pure JS. Needs: @orama/orama, @orama/plugin-data-persistence.' },\n { value: 'pglite', label: 'pglite', description: 'Hybrid search via PostgreSQL + pgvector. Exact results. Pure WASM. Needs: @electric-sql/pglite.' },\n { value: 'lancedb', label: 'lancedb', description: 'ANN search via LanceDB (Apache Lance columnar format). Pure JS. Needs: @lancedb/lancedb.' },\n { value: 'qdrant', label: 'qdrant', description: 'ANN search via Qdrant embedded binary (HNSW index, Cosine). Needs: qdrant-local.' },\n { value: 'typesense', label: 'typesense', description: 'ANN search via Typesense (auto-downloaded binary, HNSW, Cosine). Needs: typesense.' },\n ]);\n patch.semanticEngine = semanticEngine;\n patch.useVecIndex = semanticEngine === 'sqlite-vec';\n\n if (semanticEngine === 'typesense') {\n patch.typesenseDashboard = await askBool(\n rl,\n 'Open Typesense dashboard after indexing?',\n 'Serves the Typesense Dashboard locally and opens it in your browser after indexing completes.',\n );\n }\n\n if (semanticEngine === 'qdrant') {\n patch.qdrantDashboard = await askBool(\n rl,\n 'Open Qdrant dashboard after indexing?',\n 'Downloads the Qdrant Web UI (first time only) and opens it in your browser after indexing completes.',\n );\n }\n }\n\n patch.extractDocstrings = await askBool(\n rl,\n 'Extract docstrings from source files?',\n 'Enriches symbol metadata and improves context quality. Slightly increases indexing time.',\n );\n\n patch.trackCallSites = await askBool(\n rl,\n 'Track call sites to enable caller/callee graph traversal?',\n 'Enables the kirograph_callers and kirograph_callees MCP tools for graph traversal. Increases index size.',\n );\n\n patch.enableArchitecture = await askBool(\n rl,\n 'Enable architecture analysis (package graph + layer detection)?',\n '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.',\n );\n\n const cavemanChoice = await arrowSelect(rl, 'Caveman mode \u2014 agent communication style:', [\n { value: 'off', label: 'off', description: 'Normal responses' },\n { value: 'lite', label: 'lite', description: 'Compact, no filler, full sentences' },\n { value: 'full', label: 'full', description: 'Fragments, no articles, short synonyms' },\n { value: 'ultra', label: 'ultra', description: 'Max compression, abbreviations, \u2192 for causality' },\n ]);\n patch.cavemanMode = cavemanChoice as CavemanMode | 'off';\n\n return patch;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8D;AAIvD,MAAM,0BAA0B;AAGvC,MAAM,gBAAgB;AAAA,EACpB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AACF;AAEA,eAAsB,oBAAoB,IAA8C;AACtF,QAAM,mBAAmB,UAAM;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAqB,EAAE,kBAAkB,aAAa,OAAO,gBAAgB,UAAU,oBAAoB,OAAO,iBAAiB,OAAO,mBAAmB,MAAM,gBAAgB,MAAM,oBAAoB,OAAO,aAAa,MAAM;AAE7O,MAAI,kBAAkB;AAEpB,UAAM,cAAc,UAAM;AAAA,MACxB;AAAA,MACA;AAAA,MACA,cAAc,IAAI,QAAM,EAAE,OAAO,EAAE,OAAO,OAAO,EAAE,OAAO,aAA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F;AAAA,MAC5I,EAAE,OAAO,aAAc,OAAO,aAAc,aAAa,qFAAqF;AAAA,IAChJ,CAAC;AACD,UAAM,iBAAiB;AACvB,UAAM,cAAc,mBAAmB;AAEvC,QAAI,mBAAmB,aAAa;AAClC,YAAM,qBAAqB,UAAM;AAAA,QAC/B;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,QAAI,mBAAmB,UAAU;AAC/B,YAAM,kBAAkB,UAAM;AAAA,QAC5B;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,oBAAoB,UAAM;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAAiB,UAAM;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBAAqB,UAAM;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,gBAAgB,UAAM,4BAAY,IAAI,kDAA6C;AAAA,IACvF,EAAE,OAAO,OAAS,OAAO,OAAS,aAAa,mBAAmB;AAAA,IAClE,EAAE,OAAO,QAAS,OAAO,QAAS,aAAa,qCAAqC;AAAA,IACpF,EAAE,OAAO,QAAS,OAAO,QAAS,aAAa,yCAAyC;AAAA,IACxF,EAAE,OAAO,SAAS,OAAO,SAAS,aAAa,uDAAkD;AAAA,EACnG,CAAC;AACD,QAAM,cAAc;AAEpB,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * KiroGraph Installer \u2014 configuration prompting\n */\n\nimport * as readline from 'readline';\nimport { KiroGraphConfig } from '../../config';\ntype CavemanMode = 'lite' | 'full' | 'ultra';\nimport { ask, askBool, arrowSelect, dim, reset, violet } from './prompts';\nexport type ConfigPatch = Pick<KiroGraphConfig, 'enableEmbeddings' | 'useVecIndex' | 'semanticEngine' | 'typesenseDashboard' | 'qdrantDashboard' | 'extractDocstrings' | 'trackCallSites' | 'enableArchitecture' | 'cavemanMode' | 'shellCompressionLevel'> & { embeddingModel?: string; embeddingDim?: number };\nexport type SemanticEngine = KiroGraphConfig['semanticEngine'];\n\nexport const DEFAULT_EMBEDDING_MODEL = 'nomic-ai/nomic-embed-text-v1.5';\n\n/** Well-known embedding models with their output dimensions. */\nconst PRESET_MODELS = [\n {\n value: 'nomic-ai/nomic-embed-text-v1.5',\n label: 'nomic-embed-text-v1.5',\n dim: 768,\n description: '768-dim \u00B7 ~130MB \u00B7 Best quality for code search (recommended)',\n },\n {\n value: 'onnx-community/embeddinggemma-300m-ONNX',\n label: 'embeddinggemma-300m',\n dim: 768,\n description: '768-dim \u00B7 ~300MB \u00B7 Google Gemma-based, multilingual, 2048-token context',\n },\n {\n value: 'Xenova/all-MiniLM-L6-v2',\n label: 'all-MiniLM-L6-v2',\n dim: 384,\n description: '384-dim \u00B7 ~23MB \u00B7 Fast and lightweight, lower accuracy',\n },\n {\n value: 'BAAI/bge-base-en-v1.5',\n label: 'bge-base-en-v1.5',\n dim: 768,\n description: '768-dim \u00B7 ~110MB \u00B7 Strong general-purpose alternative to nomic',\n },\n {\n value: '__other__',\n label: 'Other',\n dim: 768,\n description: 'Enter a custom HuggingFace model ID and embedding dimension',\n },\n] as const;\n\nexport async function promptConfigOptions(rl: readline.Interface): Promise<ConfigPatch> {\n const enableEmbeddings = await askBool(\n rl,\n 'Enable semantic embeddings for similarity search? (requires a local embedding model)',\n 'Enables semantic/similarity-based code search. Increases indexing time; the chosen embedding model is downloaded automatically on first use.',\n );\n\n const patch: ConfigPatch = { enableEmbeddings, useVecIndex: false, semanticEngine: 'cosine', typesenseDashboard: false, qdrantDashboard: false, extractDocstrings: true, trackCallSites: true, enableArchitecture: false, cavemanMode: 'off', shellCompressionLevel: 'normal' };\n\n if (enableEmbeddings) {\n // \u2500\u2500 Model selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const modelChoice = await arrowSelect<string>(\n rl,\n 'Choose an embedding model:',\n PRESET_MODELS.map(m => ({ value: m.value, label: m.label, description: m.description })),\n );\n\n let embeddingModel: string;\n let embeddingDim: number;\n\n if (modelChoice === '__other__') {\n console.log(`\\n ${dim}Enter a HuggingFace model ID in the format org/model-name.${reset}`);\n while (true) {\n const raw = (await ask(rl, ` ${violet}Model identifier:${reset} `)).trim();\n if (raw.includes('/')) { embeddingModel = raw; break; }\n console.log(` Expected a HuggingFace model ID in the format org/model-name (e.g. nomic-ai/nomic-embed-text-v1.5).`);\n }\n console.log(`\\n ${dim}Enter the embedding output dimension for this model (check the model card on HuggingFace).${reset}`);\n while (true) {\n const raw = (await ask(rl, ` ${violet}Embedding dimension (e.g. 768, 384):${reset} `)).trim();\n const n = parseInt(raw, 10);\n if (!isNaN(n) && n > 0) { embeddingDim = n; break; }\n console.log(` Expected a positive integer (e.g. 768, 384, 1536).`);\n }\n } else {\n const preset = PRESET_MODELS.find(m => m.value === modelChoice)!;\n embeddingModel = preset.value;\n embeddingDim = preset.dim;\n }\n\n patch.embeddingModel = embeddingModel;\n patch.embeddingDim = embeddingDim;\n\n // \u2500\u2500 Engine selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const semanticEngine = await arrowSelect<SemanticEngine>(rl, 'Choose the semantic search engine:', [\n { value: 'cosine', label: 'cosine', description: 'In-process cosine similarity. No extra deps. Best for small/medium projects.' },\n { value: 'sqlite-vec', label: 'sqlite-vec', description: 'ANN index. Sub-linear search. Best for large codebases. Needs: better-sqlite3, sqlite-vec (native).' },\n { value: 'orama', label: 'orama', description: 'Hybrid search (full-text + vector). Pure JS. Needs: @orama/orama, @orama/plugin-data-persistence.' },\n { value: 'pglite', label: 'pglite', description: 'Hybrid search via PostgreSQL + pgvector. Exact results. Pure WASM. Needs: @electric-sql/pglite.' },\n { value: 'lancedb', label: 'lancedb', description: 'ANN search via LanceDB (Apache Lance columnar format). Pure JS. Needs: @lancedb/lancedb.' },\n { value: 'qdrant', label: 'qdrant', description: 'ANN search via Qdrant embedded binary (HNSW index, Cosine). Needs: qdrant-local.' },\n { value: 'typesense', label: 'typesense', description: 'ANN search via Typesense (auto-downloaded binary, HNSW, Cosine). Needs: typesense.' },\n ]);\n patch.semanticEngine = semanticEngine;\n patch.useVecIndex = semanticEngine === 'sqlite-vec';\n\n if (semanticEngine === 'typesense') {\n patch.typesenseDashboard = await askBool(\n rl,\n 'Open Typesense dashboard after indexing?',\n 'Serves the Typesense Dashboard locally and opens it in your browser after indexing completes.',\n );\n }\n\n if (semanticEngine === 'qdrant') {\n patch.qdrantDashboard = await askBool(\n rl,\n 'Open Qdrant dashboard after indexing?',\n 'Downloads the Qdrant Web UI (first time only) and opens it in your browser after indexing completes.',\n );\n }\n }\n\n patch.extractDocstrings = await askBool(\n rl,\n 'Extract docstrings from source files?',\n 'Enriches symbol metadata and improves context quality. Slightly increases indexing time.',\n );\n\n patch.trackCallSites = await askBool(\n rl,\n 'Track call sites to enable caller/callee graph traversal?',\n 'Enables the kirograph_callers and kirograph_callees MCP tools for graph traversal. Increases index size.',\n );\n\n patch.enableArchitecture = await askBool(\n rl,\n 'Enable architecture analysis (package graph + layer detection)?',\n '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.',\n );\n\n const cavemanChoice = await arrowSelect(rl, 'Caveman mode: agent communication style:', [\n { value: 'off', label: 'off', description: 'Normal responses' },\n { value: 'lite', label: 'lite', description: 'Compact, no filler, full sentences' },\n { value: 'full', label: 'full', description: 'Fragments, no articles, short synonyms' },\n { value: 'ultra', label: 'ultra', description: 'Max compression, abbreviations, \u2192 for causality' },\n ]);\n patch.cavemanMode = cavemanChoice as CavemanMode | 'off';\n\n const compressionChoice = await arrowSelect(rl, 'Shell compression: default level for kirograph_exec:', [\n { value: 'off', label: 'off', description: 'No compression hook or steering (tool still available)' },\n { value: 'normal', label: 'normal', description: 'Balanced: removes noise, keeps structure (recommended)' },\n { value: 'aggressive', label: 'aggressive', description: 'More compact: groups by category, limits output' },\n { value: 'ultra', label: 'ultra', description: 'Maximum compression: counts and summaries only' },\n ]);\n patch.shellCompressionLevel = compressionChoice as KiroGraphConfig['shellCompressionLevel'];\n\n return patch;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8D;AAIvD,MAAM,0BAA0B;AAGvC,MAAM,gBAAgB;AAAA,EACpB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AACF;AAEA,eAAsB,oBAAoB,IAA8C;AACtF,QAAM,mBAAmB,UAAM;AAAA,IAC7B;AAA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AAoB,UAAM,4BAAY,IAAI,wDAAwD;AAAA,IACtG,EAAE,OAAO,OAAc,OAAO,OAAc,aAAa,yDAAyD;AAAA,IAClH,EAAE,OAAO,UAAc,OAAO,UAAc,aAAa,yDAAyD;AAAA,IAClH,EAAE,OAAO,cAAc,OAAO,cAAc,aAAa,kDAAkD;AAAA,IAC3G,EAAE,OAAO,SAAc,OAAO,SAAc,aAAa,iDAAiD;AAAA,EAC5G,CAAC;AACD,QAAM,wBAAwB;AAE9B,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -112,6 +112,19 @@ const HOOKS = [
112
112
  when: { type: "agentStop" },
113
113
  then: { type: "runCommand", command: "kirograph sync-if-dirty --quiet 2>/dev/null || true" }
114
114
  }
115
+ },
116
+ {
117
+ filename: "kirograph-compress-hint.json",
118
+ hook: {
119
+ name: "KiroGraph Compression Hint",
120
+ version: "1.0.0",
121
+ description: "Remind the agent to use kirograph_exec for shell commands that benefit from token compression (git, gh, test, lint, build, docker, aws, grep).",
122
+ when: { type: "preToolUse", toolTypes: ["shell"] },
123
+ then: {
124
+ type: "askAgent",
125
+ prompt: "If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details."
126
+ }
127
+ }
115
128
  }
116
129
  ];
117
130
  function ensureDir(p) {
@@ -154,7 +167,7 @@ function migrateOnIdleHooks(hooksDir) {
154
167
  }
155
168
  }
156
169
  }
157
- function writeHooks(kiroDir) {
170
+ function writeHooks(kiroDir, opts) {
158
171
  const hooksDir = path.join(kiroDir, "hooks");
159
172
  ensureDir(hooksDir);
160
173
  migrateOnIdleHooks(hooksDir);
@@ -164,6 +177,11 @@ function writeHooks(kiroDir) {
164
177
  if (fs.existsSync(p)) fs.unlinkSync(p);
165
178
  }
166
179
  for (const { filename, hook } of HOOKS) {
180
+ if (filename === "kirograph-compress-hint.json" && opts?.enableCompression === false) {
181
+ const p = path.join(hooksDir, filename);
182
+ if (fs.existsSync(p)) fs.unlinkSync(p);
183
+ continue;
184
+ }
167
185
  writeJson(path.join(hooksDir, filename), hook);
168
186
  }
169
187
  console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/bin/installer/hooks.ts"],
4
- "sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { logWarn } from '../../errors';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst FILE_PATTERNS = [\n '**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx',\n '**/*.py', '**/*.go', '**/*.rs', '**/*.java',\n '**/*.cs', '**/*.rb', '**/*.php', '**/*.swift',\n '**/*.kt', '**/*.dart',\n '**/*.ex', '**/*.exs',\n '**/*.scala', '**/*.sc', '**/*.lua', '**/*.zig',\n '**/*.sh', '**/*.bash', '**/*.ml', '**/*.mli',\n '**/*.elm', '**/*.sol', '**/*.vue', '**/*.m',\n '**/*.yaml', '**/*.yml',\n '**/*.tf', '**/*.tfvars',\n '**/*.css', '**/*.scss', '**/*.sass',\n '**/*.html',\n];\n\nconst HOOKS: Array<{ filename: string; hook: object }> = [\n {\n filename: 'kirograph-mark-dirty-on-save.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Save',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are saved. Sync is deferred to agent idle.',\n when: { type: 'fileEdited', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-mark-dirty-on-create.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Create',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are created.',\n when: { type: 'fileCreated', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-on-delete.json',\n hook: {\n name: 'KiroGraph Sync on Delete',\n version: '1.0.0',\n description: 'Remove deleted files from the KiroGraph index immediately.',\n when: { type: 'fileDeleted', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-if-dirty.json',\n hook: {\n name: 'KiroGraph Deferred Sync',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent is idle and a dirty marker is present. Batches multiple rapid saves into one sync.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty --quiet 2>/dev/null || true' },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\nfunction migrateOnIdleHooks(hooksDir: string): void {\n if (!fs.existsSync(hooksDir)) return;\n let files: string[];\n try {\n files = fs.readdirSync(hooksDir).filter(f => f.endsWith('.json'));\n } catch {\n return;\n }\n for (const file of files) {\n const filePath = path.join(hooksDir, file);\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, 'utf8');\n } catch {\n logWarn(`KiroGraph installer: could not read hook file ${filePath}`);\n continue;\n }\n let obj: any;\n try {\n obj = JSON.parse(raw);\n } catch {\n logWarn(`KiroGraph installer: could not parse hook file ${filePath}`);\n continue;\n }\n if (obj?.when?.type === 'onIdle') {\n obj.when.type = 'agentStop';\n try {\n fs.writeFileSync(filePath, JSON.stringify(obj, null, 2) + '\\n');\n } catch {\n logWarn(`KiroGraph installer: could not write migrated hook file ${filePath}`);\n }\n }\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function writeHooks(kiroDir: string): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n migrateOnIdleHooks(hooksDir);\n\n const oldHooks = ['kirograph-sync-on-save.json', 'kirograph-sync-on-create.json'];\n for (const old of oldHooks) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const { filename, hook } of HOOKS) {\n writeJson(path.join(hooksDir, filename), hook);\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;A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C,+BAA+B,+BAA+B;AAChF,aAAW,OAAO,UAAU;AAC1B,UAAM,IAAI,KAAK,KAAK,UAAU,GAAG;AACjC,QAAI,GAAG,WAAW,CAAC,EAAG,IAAG,WAAW,CAAC;AAAA,EACvC;AAEA,aAAW,EAAE,UAAU,KAAK,KAAK,OAAO;AACtC,cAAU,KAAK,KAAK,UAAU,QAAQ,GAAG,IAAI;AAAA,EAC/C;AAEA,UAAQ,IAAI,uCAAkC,QAAQ,EAAE;AAC1D;",
4
+ "sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { logWarn } from '../../errors';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst FILE_PATTERNS = [\n '**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx',\n '**/*.py', '**/*.go', '**/*.rs', '**/*.java',\n '**/*.cs', '**/*.rb', '**/*.php', '**/*.swift',\n '**/*.kt', '**/*.dart',\n '**/*.ex', '**/*.exs',\n '**/*.scala', '**/*.sc', '**/*.lua', '**/*.zig',\n '**/*.sh', '**/*.bash', '**/*.ml', '**/*.mli',\n '**/*.elm', '**/*.sol', '**/*.vue', '**/*.m',\n '**/*.yaml', '**/*.yml',\n '**/*.tf', '**/*.tfvars',\n '**/*.css', '**/*.scss', '**/*.sass',\n '**/*.html',\n];\n\nconst HOOKS: Array<{ filename: string; hook: object }> = [\n {\n filename: 'kirograph-mark-dirty-on-save.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Save',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are saved. Sync is deferred to agent idle.',\n when: { type: 'fileEdited', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-mark-dirty-on-create.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Create',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are created.',\n when: { type: 'fileCreated', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-on-delete.json',\n hook: {\n name: 'KiroGraph Sync on Delete',\n version: '1.0.0',\n description: 'Remove deleted files from the KiroGraph index immediately.',\n when: { type: 'fileDeleted', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-if-dirty.json',\n hook: {\n name: 'KiroGraph Deferred Sync',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent is idle and a dirty marker is present. Batches multiple rapid saves into one sync.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty --quiet 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-compress-hint.json',\n hook: {\n name: 'KiroGraph Compression Hint',\n version: '1.0.0',\n description: 'Remind the agent to use kirograph_exec for shell commands that benefit from token compression (git, gh, test, lint, build, docker, aws, grep).',\n when: { type: 'preToolUse', toolTypes: ['shell'] },\n then: {\n type: 'askAgent',\n prompt: 'If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details.',\n },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\nfunction migrateOnIdleHooks(hooksDir: string): void {\n if (!fs.existsSync(hooksDir)) return;\n let files: string[];\n try {\n files = fs.readdirSync(hooksDir).filter(f => f.endsWith('.json'));\n } catch {\n return;\n }\n for (const file of files) {\n const filePath = path.join(hooksDir, file);\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, 'utf8');\n } catch {\n logWarn(`KiroGraph installer: could not read hook file ${filePath}`);\n continue;\n }\n let obj: any;\n try {\n obj = JSON.parse(raw);\n } catch {\n logWarn(`KiroGraph installer: could not parse hook file ${filePath}`);\n continue;\n }\n if (obj?.when?.type === 'onIdle') {\n obj.when.type = 'agentStop';\n try {\n fs.writeFileSync(filePath, JSON.stringify(obj, null, 2) + '\\n');\n } catch {\n logWarn(`KiroGraph installer: could not write migrated hook file ${filePath}`);\n }\n }\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function writeHooks(kiroDir: string, opts?: { enableCompression?: boolean }): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n migrateOnIdleHooks(hooksDir);\n\n const oldHooks = ['kirograph-sync-on-save.json', 'kirograph-sync-on-create.json'];\n for (const old of oldHooks) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const { filename, hook } of HOOKS) {\n // Skip compression hook if compression is disabled\n if (filename === 'kirograph-compress-hint.json' && opts?.enableCompression === false) {\n // Remove the hook file if it exists from a previous install\n const p = path.join(hooksDir, filename);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n continue;\n }\n writeJson(path.join(hooksDir, filename), hook);\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AACtB,oBAAwB;AAIxB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EAAW;AAAA,EAAY;AAAA,EAAW;AAAA,EAClC;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACjC;AAAA,EAAW;AAAA,EAAW;AAAA,EAAY;AAAA,EAClC;AAAA,EAAW;AAAA,EACX;AAAA,EAAW;AAAA,EACX;AAAA,EAAc;AAAA,EAAW;AAAA,EAAY;AAAA,EACrC;AAAA,EAAW;AAAA,EAAa;AAAA,EAAW;AAAA,EACnC;AAAA,EAAY;AAAA,EAAY;AAAA,EAAY;AAAA,EACpC;AAAA,EAAa;AAAA,EACb;AAAA,EAAW;AAAA,EACX;AAAA,EAAY;AAAA,EAAa;AAAA,EACzB;AACF;AAEA,MAAM,QAAmD;AAAA,EACvD;AAAA,IACE,UAAU;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,EAAE,MAA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AAAA,EAC/C;AAEA,UAAQ,IAAI,uCAAkC,QAAQ,EAAE;AAC1D;",
6
6
  "names": []
7
7
  }
@@ -62,6 +62,7 @@ async function runInstaller(target = "kiro") {
62
62
  installer.installEarly(cwd);
63
63
  const alreadyInitialized = fs.existsSync(path.join(cwd, ".kirograph"));
64
64
  let cavemanMode = "off";
65
+ let shellCompressionLevel = "normal";
65
66
  let shouldOfferIndex = false;
66
67
  let typesenseDashboard = false;
67
68
  let qdrantDashboard = false;
@@ -69,16 +70,19 @@ async function runInstaller(target = "kiro") {
69
70
  if (alreadyInitialized) {
70
71
  const config = await (0, import_config.loadConfig)(cwd);
71
72
  cavemanMode = config.cavemanMode ?? "off";
73
+ shellCompressionLevel = config.shellCompressionLevel ?? "normal";
72
74
  console.log(` \u2713 Reusing existing KiroGraph data in ${cwd}/.kirograph/`);
73
75
  console.log(` \u2022 semanticEngine: ${config.semanticEngine}`);
74
76
  console.log(` \u2022 enableEmbeddings: ${config.enableEmbeddings}`);
75
77
  console.log(` \u2022 enableArchitecture: ${config.enableArchitecture}`);
76
78
  console.log(` \u2022 cavemanMode: ${cavemanMode}`);
79
+ console.log(` \u2022 shellCompressionLevel: ${shellCompressionLevel}`);
77
80
  } else {
78
81
  shouldOfferIndex = true;
79
82
  const patch = await (0, import_config_prompt.promptConfigOptions)(rl);
80
83
  await (0, import_config.updateConfig)(cwd, patch);
81
84
  cavemanMode = patch.cavemanMode ?? "off";
85
+ shellCompressionLevel = patch.shellCompressionLevel ?? "normal";
82
86
  typesenseDashboard = patch.typesenseDashboard;
83
87
  qdrantDashboard = patch.qdrantDashboard;
84
88
  console.log(`
@@ -156,8 +160,9 @@ async function runInstaller(target = "kiro") {
156
160
  console.log(` \u2022 trackCallSites: ${patch.trackCallSites}`);
157
161
  console.log(` \u2022 enableArchitecture: ${patch.enableArchitecture}`);
158
162
  console.log(` \u2022 cavemanMode: ${cavemanMode}`);
163
+ console.log(` \u2022 shellCompressionLevel: ${shellCompressionLevel}`);
159
164
  }
160
- installer.installLate(cwd, cavemanMode);
165
+ installer.installLate(cwd, cavemanMode, shellCompressionLevel);
161
166
  } catch (err) {
162
167
  const reason = err instanceof Error ? err.message : String(err);
163
168
  console.error(`
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/bin/installer/index.ts"],
4
- "sourcesContent": ["/**\n * KiroGraph Installer\n *\n * The default target wires up Kiro:\n * 1. .kiro/settings/mcp.json \u2014 registers the MCP server (IDE + CLI)\n * 2. .kiro/hooks/*.json \u2014 auto-sync hooks for Kiro IDE\n * 3. .kiro/steering/kirograph.md \u2014 teaches Kiro to use the graph tools (IDE + CLI)\n * 4. .kiro/agents/kirograph.json \u2014 custom agent config for Kiro CLI\n */\n\nimport * as readline from 'readline';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { spawnSync } from 'child_process';\nimport { loadConfig, updateConfig } from '../../config';\nimport { printBanner } from '../banner';\nimport { renderIndexProgress } from '../progress';\nimport { dim, reset } from '../ui';\nimport { ask } from './prompts';\nimport { promptConfigOptions } from './config-prompt';\nimport { openTypesenseDashboard } from './dashboard';\nimport { ensureQdrantUI, openQdrantDashboard } from './qdrant-dashboard';\nimport type { InstallTarget } from './common';\nimport { getTargetInstaller } from './targets';\nimport type { CavemanMode } from './caveman';\n\nexport async function runInstaller(target: InstallTarget = 'kiro'): Promise<void> {\n printBanner();\n\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\n try {\n const cwd = process.cwd();\n const installer = getTargetInstaller(target);\n\n console.log(` Workspace: ${cwd}\\n`);\n\n const proceed = await ask(rl, ` Install KiroGraph for ${installer.label}? (Y/n) `);\n if (proceed.toLowerCase() === 'n') { console.log(' Cancelled.'); rl.close(); return; }\n console.log();\n\n installer.installEarly(cwd);\n\n const alreadyInitialized = fs.existsSync(path.join(cwd, '.kirograph'));\n let cavemanMode: CavemanMode | 'off' = 'off';\n let shouldOfferIndex = false;\n let typesenseDashboard = false;\n let qdrantDashboard = false;\n\n try {\n if (alreadyInitialized) {\n const config = await loadConfig(cwd);\n cavemanMode = config.cavemanMode ?? 'off';\n console.log(` \u2713 Reusing existing KiroGraph data in ${cwd}/.kirograph/`);\n console.log(` \u2022 semanticEngine: ${config.semanticEngine}`);\n console.log(` \u2022 enableEmbeddings: ${config.enableEmbeddings}`);\n console.log(` \u2022 enableArchitecture: ${config.enableArchitecture}`);\n console.log(` \u2022 cavemanMode: ${cavemanMode}`);\n } else {\n shouldOfferIndex = true;\n const patch = await promptConfigOptions(rl);\n await updateConfig(cwd, patch);\n cavemanMode = patch.cavemanMode ?? 'off';\n typesenseDashboard = patch.typesenseDashboard;\n qdrantDashboard = patch.qdrantDashboard;\n\n console.log(`\\n Configuration saved to ${cwd}/.kirograph/config.json`);\n console.log(` \u2022 enableEmbeddings: ${patch.enableEmbeddings}`);\n if ('embeddingModel' in patch) {\n console.log(` \u2022 embeddingModel: ${patch.embeddingModel} ${dim}(${patch.embeddingDim}-dim)${reset}`);\n }\n if (patch.enableEmbeddings) {\n console.log(` \u2022 semanticEngine: ${patch.semanticEngine}`);\n if (patch.semanticEngine === 'sqlite-vec') {\n console.log(`\\n Installing sqlite-vec dependencies...`);\n const result = spawnSync('npm', ['install', 'better-sqlite3', 'sqlite-vec'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 better-sqlite3 and sqlite-vec installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install better-sqlite3 sqlite-vec`);\n }\n } else if (patch.semanticEngine === 'orama') {\n console.log(`\\n Installing Orama dependencies...`);\n const result = spawnSync('npm', ['install', '@orama/orama', '@orama/plugin-data-persistence'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @orama/orama and @orama/plugin-data-persistence installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @orama/orama @orama/plugin-data-persistence`);\n }\n } else if (patch.semanticEngine === 'pglite') {\n console.log(`\\n Installing PGlite dependencies...`);\n const result = spawnSync('npm', ['install', '@electric-sql/pglite'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @electric-sql/pglite installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @electric-sql/pglite`);\n }\n } else if (patch.semanticEngine === 'lancedb') {\n console.log(`\\n Installing LanceDB dependencies...`);\n const result = spawnSync('npm', ['install', '@lancedb/lancedb'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @lancedb/lancedb installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @lancedb/lancedb`);\n }\n } else if (patch.semanticEngine === 'qdrant') {\n console.log(`\\n Installing Qdrant dependencies...`);\n const result = spawnSync('npm', ['install', 'qdrant-local'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 qdrant-local installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install qdrant-local`);\n }\n } else if (patch.semanticEngine === 'typesense') {\n console.log(`\\n Installing Typesense dependencies...`);\n const result = spawnSync('npm', ['install', 'typesense'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 typesense installed`);\n console.log(` \u2139 The Typesense binary (~37MB) will be auto-downloaded on first index run.`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install typesense`);\n }\n }\n }\n console.log(` \u2022 extractDocstrings: ${patch.extractDocstrings}`);\n console.log(` \u2022 trackCallSites: ${patch.trackCallSites}`);\n console.log(` \u2022 enableArchitecture: ${patch.enableArchitecture}`);\n console.log(` \u2022 cavemanMode: ${cavemanMode}`);\n }\n\n installer.installLate(cwd, cavemanMode);\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n console.error(`\\n \u2717 Failed to write configuration: ${reason}`);\n process.exit(1);\n }\n\n // 5. Pre-download Qdrant UI before indexing so Qdrant starts with static content dir\n if (qdrantDashboard) {\n await ensureQdrantUI(cwd);\n }\n\n // 6. Optionally init + index\n if (shouldOfferIndex && (await ask(rl, '\\n Initialize and index this project now? (Y/n) ')).toLowerCase() !== 'n') {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n\n const fileBytes = new Map<string, { loaded: number; total: number }>();\n const modelProgress = (file: string, loaded: number, total: number, done: boolean): void => {\n const entry = fileBytes.get(file) ?? { loaded: 0, total: 0 };\n if (total > 0) entry.total = total;\n entry.loaded = done ? entry.total : loaded;\n fileBytes.set(file, entry);\n\n // Only count files where we know the size (content-length was present)\n const knownFiles = Array.from(fileBytes.values()).filter(f => f.total > 0);\n const totalLoaded = knownFiles.reduce((s, f) => s + f.loaded, 0);\n const totalBytes = knownFiles.reduce((s, f) => s + f.total, 0);\n const pct = totalBytes > 0 ? Math.min((totalLoaded / totalBytes) * 100, 100) : 0;\n\n const filled = Math.round(pct / 5);\n const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(20 - filled);\n const mb = (totalLoaded / 1024 / 1024).toFixed(1);\n const totalMb = (totalBytes / 1024 / 1024).toFixed(1);\n process.stdout.write(`\\r [${bar}] ${pct.toFixed(0).padStart(3)}% ${mb} / ${totalMb} MB `);\n };\n\n // Suppress noisy internal warnings from @huggingface/transformers during download\n const originalStderrWrite = process.stderr.write.bind(process.stderr);\n const stderrFilter = (chunk: unknown, ...args: unknown[]): boolean => {\n const str = typeof chunk === 'string' ? chunk : String(chunk);\n if (str.includes('content-length') || str.includes('dtype not specified')) return true;\n return (originalStderrWrite as (...a: unknown[]) => boolean)(chunk, ...args);\n };\n process.stderr.write = stderrFilter as typeof process.stderr.write;\n\n let cg;\n try {\n if (!KiroGraph.isInitialized(cwd)) {\n process.stdout.write(' Downloading embedding model\u2026\\n');\n cg = await KiroGraph.init(cwd, undefined, modelProgress);\n process.stdout.write('\\n');\n console.log(' \u2713 Created .kirograph/');\n } else {\n cg = await KiroGraph.open(cwd, modelProgress);\n if (fileBytes.size > 0) process.stdout.write('\\n');\n }\n } finally {\n process.stderr.write = originalStderrWrite;\n }\n console.log(' Indexing...');\n const result = await cg.indexAll({ onProgress: renderIndexProgress });\n process.stdout.write('\\n');\n console.log(` \u2713 Indexed ${result.filesIndexed} files, ${result.nodesCreated} symbols, ${result.edgesCreated} edges`);\n cg.close();\n\n if (typesenseDashboard) {\n const dashboardServer = await openTypesenseDashboard(cwd);\n console.log(` ${dim}Press Ctrl+C to stop the dashboard server when done.${reset}`);\n await new Promise<void>(resolve => {\n process.on('SIGINT', () => {\n if (dashboardServer) {\n dashboardServer.close(() => resolve());\n } else {\n resolve();\n }\n });\n });\n return; // rl.close() handled in finally\n }\n\n if (qdrantDashboard) {\n await openQdrantDashboard(cwd);\n }\n }\n\n installer.printNextSteps(cwd);\n } finally {\n rl.close();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,eAA0B;AAC1B,SAAoB;AACpB,WAAsB;AACtB,2BAA0B;AAC1B,oBAAyC;AACzC,oBAA4B;AAC5B,sBAAoC;AACpC,gBAA2B;AAC3B,qBAAoB;AACpB,2BAAoC;AACpC,uBAAuC;AACvC,8BAAoD;AAEpD,qBAAmC;AAGnC,eAAsB,aAAa,SAAwB,QAAuB;AAChF,iCAAY;AAEZ,QAAM,KAAK,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO,CAAC;AAEpF,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,UAAM,gBAAY,mCAAmB,MAAM;AAE3C,YAAQ,IAAI,gBAAgB,GAAG;AAAA,CAAI;AAEnC,UAAM,UAAU,UAAM,oBAAI,IAAI,2BAA2B,UAAU,KAAK,UAAU;AAClF,QAAI,QAAQ,YAAY,MAAM,KAAK;AAAE,cAAQ,IAAI,cAAc;AAAG,S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AQ,OAAO,QAAQ;AAEvB,UAAI;AACJ,UAAI;AACF,YAAI,CAAC,UAAU,cAAc,GAAG,GAAG;AACjC,kBAAQ,OAAO,MAAM,uCAAkC;AACvD,eAAK,MAAM,UAAU,KAAK,KAAK,QAAW,aAAa;AACvD,kBAAQ,OAAO,MAAM,IAAI;AACzB,kBAAQ,IAAI,8BAAyB;AAAA,QACvC,OAAO;AACL,eAAK,MAAM,UAAU,KAAK,KAAK,aAAa;AAC5C,cAAI,UAAU,OAAO,EAAG,SAAQ,OAAO,MAAM,IAAI;AAAA,QACnD;AAAA,MACF,UAAE;AACA,gBAAQ,OAAO,QAAQ;AAAA,MACzB;AACA,cAAQ,IAAI,eAAe;AAC3B,YAAM,SAAS,MAAM,GAAG,SAAS,EAAE,YAAY,oCAAoB,CAAC;AACpE,cAAQ,OAAO,MAAM,IAAI;AACzB,cAAQ,IAAI,oBAAe,OAAO,YAAY,WAAW,OAAO,YAAY,aAAa,OAAO,YAAY,QAAQ;AACpH,SAAG,MAAM;AAET,UAAI,oBAAoB;AACtB,cAAM,kBAAkB,UAAM,yCAAuB,GAAG;AACxD,gBAAQ,IAAI,KAAK,aAAG,uDAAuD,eAAK,EAAE;AAClF,cAAM,IAAI,QAAc,aAAW;AACjC,kBAAQ,GAAG,UAAU,MAAM;AACzB,gBAAI,iBAAiB;AACnB,8BAAgB,MAAM,MAAM,QAAQ,CAAC;AAAA,YACvC,OAAO;AACL,sBAAQ;AAAA,YACV;AAAA,UACF,CAAC;AAAA,QACH,CAAC;AACD;AAAA,MACF;AAEA,UAAI,iBAAiB;AACnB,kBAAM,6CAAoB,GAAG;AAAA,MAC/B;AAAA,IACF;AAEA,cAAU,eAAe,GAAG;AAAA,EAC9B,UAAE;AACA,OAAG,MAAM;AAAA,EACX;AACF;",
4
+ "sourcesContent": ["/**\n * KiroGraph Installer\n *\n * The default target wires up Kiro:\n * 1. .kiro/settings/mcp.json \u2014 registers the MCP server (IDE + CLI)\n * 2. .kiro/hooks/*.json \u2014 auto-sync hooks for Kiro IDE\n * 3. .kiro/steering/kirograph.md \u2014 teaches Kiro to use the graph tools (IDE + CLI)\n * 4. .kiro/agents/kirograph.json \u2014 custom agent config for Kiro CLI\n */\n\nimport * as readline from 'readline';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { spawnSync } from 'child_process';\nimport { loadConfig, updateConfig } from '../../config';\nimport { printBanner } from '../banner';\nimport { renderIndexProgress } from '../progress';\nimport { dim, reset } from '../ui';\nimport { ask } from './prompts';\nimport { promptConfigOptions } from './config-prompt';\nimport { openTypesenseDashboard } from './dashboard';\nimport { ensureQdrantUI, openQdrantDashboard } from './qdrant-dashboard';\nimport type { InstallTarget } from './common';\nimport { getTargetInstaller } from './targets';\nimport type { CavemanMode } from './caveman';\n\nexport async function runInstaller(target: InstallTarget = 'kiro'): Promise<void> {\n printBanner();\n\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\n try {\n const cwd = process.cwd();\n const installer = getTargetInstaller(target);\n\n console.log(` Workspace: ${cwd}\\n`);\n\n const proceed = await ask(rl, ` Install KiroGraph for ${installer.label}? (Y/n) `);\n if (proceed.toLowerCase() === 'n') { console.log(' Cancelled.'); rl.close(); return; }\n console.log();\n\n installer.installEarly(cwd);\n\n const alreadyInitialized = fs.existsSync(path.join(cwd, '.kirograph'));\n let cavemanMode: CavemanMode | 'off' = 'off';\n let shellCompressionLevel: 'off' | 'normal' | 'aggressive' | 'ultra' = 'normal';\n let shouldOfferIndex = false;\n let typesenseDashboard = false;\n let qdrantDashboard = false;\n\n try {\n if (alreadyInitialized) {\n const config = await loadConfig(cwd);\n cavemanMode = config.cavemanMode ?? 'off';\n shellCompressionLevel = config.shellCompressionLevel ?? 'normal';\n console.log(` \u2713 Reusing existing KiroGraph data in ${cwd}/.kirograph/`);\n console.log(` \u2022 semanticEngine: ${config.semanticEngine}`);\n console.log(` \u2022 enableEmbeddings: ${config.enableEmbeddings}`);\n console.log(` \u2022 enableArchitecture: ${config.enableArchitecture}`);\n console.log(` \u2022 cavemanMode: ${cavemanMode}`);\n console.log(` \u2022 shellCompressionLevel: ${shellCompressionLevel}`);\n } else {\n shouldOfferIndex = true;\n const patch = await promptConfigOptions(rl);\n await updateConfig(cwd, patch);\n cavemanMode = patch.cavemanMode ?? 'off';\n shellCompressionLevel = patch.shellCompressionLevel ?? 'normal';\n typesenseDashboard = patch.typesenseDashboard;\n qdrantDashboard = patch.qdrantDashboard;\n\n console.log(`\\n Configuration saved to ${cwd}/.kirograph/config.json`);\n console.log(` \u2022 enableEmbeddings: ${patch.enableEmbeddings}`);\n if ('embeddingModel' in patch) {\n console.log(` \u2022 embeddingModel: ${patch.embeddingModel} ${dim}(${patch.embeddingDim}-dim)${reset}`);\n }\n if (patch.enableEmbeddings) {\n console.log(` \u2022 semanticEngine: ${patch.semanticEngine}`);\n if (patch.semanticEngine === 'sqlite-vec') {\n console.log(`\\n Installing sqlite-vec dependencies...`);\n const result = spawnSync('npm', ['install', 'better-sqlite3', 'sqlite-vec'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 better-sqlite3 and sqlite-vec installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install better-sqlite3 sqlite-vec`);\n }\n } else if (patch.semanticEngine === 'orama') {\n console.log(`\\n Installing Orama dependencies...`);\n const result = spawnSync('npm', ['install', '@orama/orama', '@orama/plugin-data-persistence'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @orama/orama and @orama/plugin-data-persistence installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @orama/orama @orama/plugin-data-persistence`);\n }\n } else if (patch.semanticEngine === 'pglite') {\n console.log(`\\n Installing PGlite dependencies...`);\n const result = spawnSync('npm', ['install', '@electric-sql/pglite'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @electric-sql/pglite installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @electric-sql/pglite`);\n }\n } else if (patch.semanticEngine === 'lancedb') {\n console.log(`\\n Installing LanceDB dependencies...`);\n const result = spawnSync('npm', ['install', '@lancedb/lancedb'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 @lancedb/lancedb installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install @lancedb/lancedb`);\n }\n } else if (patch.semanticEngine === 'qdrant') {\n console.log(`\\n Installing Qdrant dependencies...`);\n const result = spawnSync('npm', ['install', 'qdrant-local'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 qdrant-local installed`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install qdrant-local`);\n }\n } else if (patch.semanticEngine === 'typesense') {\n console.log(`\\n Installing Typesense dependencies...`);\n const result = spawnSync('npm', ['install', 'typesense'], { stdio: 'inherit', shell: true });\n if (result.status === 0) {\n console.log(` \u2713 typesense installed`);\n console.log(` \u2139 The Typesense binary (~37MB) will be auto-downloaded on first index run.`);\n } else {\n console.warn(` \u2717 npm install failed (exit ${result.status}). Run manually:`);\n console.warn(` npm install typesense`);\n }\n }\n }\n console.log(` \u2022 extractDocstrings: ${patch.extractDocstrings}`);\n console.log(` \u2022 trackCallSites: ${patch.trackCallSites}`);\n console.log(` \u2022 enableArchitecture: ${patch.enableArchitecture}`);\n console.log(` \u2022 cavemanMode: ${cavemanMode}`);\n console.log(` \u2022 shellCompressionLevel: ${shellCompressionLevel}`);\n }\n\n installer.installLate(cwd, cavemanMode, shellCompressionLevel);\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n console.error(`\\n \u2717 Failed to write configuration: ${reason}`);\n process.exit(1);\n }\n\n // 5. Pre-download Qdrant UI before indexing so Qdrant starts with static content dir\n if (qdrantDashboard) {\n await ensureQdrantUI(cwd);\n }\n\n // 6. Optionally init + index\n if (shouldOfferIndex && (await ask(rl, '\\n Initialize and index this project now? (Y/n) ')).toLowerCase() !== 'n') {\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n\n const fileBytes = new Map<string, { loaded: number; total: number }>();\n const modelProgress = (file: string, loaded: number, total: number, done: boolean): void => {\n const entry = fileBytes.get(file) ?? { loaded: 0, total: 0 };\n if (total > 0) entry.total = total;\n entry.loaded = done ? entry.total : loaded;\n fileBytes.set(file, entry);\n\n // Only count files where we know the size (content-length was present)\n const knownFiles = Array.from(fileBytes.values()).filter(f => f.total > 0);\n const totalLoaded = knownFiles.reduce((s, f) => s + f.loaded, 0);\n const totalBytes = knownFiles.reduce((s, f) => s + f.total, 0);\n const pct = totalBytes > 0 ? Math.min((totalLoaded / totalBytes) * 100, 100) : 0;\n\n const filled = Math.round(pct / 5);\n const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(20 - filled);\n const mb = (totalLoaded / 1024 / 1024).toFixed(1);\n const totalMb = (totalBytes / 1024 / 1024).toFixed(1);\n process.stdout.write(`\\r [${bar}] ${pct.toFixed(0).padStart(3)}% ${mb} / ${totalMb} MB `);\n };\n\n // Suppress noisy internal warnings from @huggingface/transformers during download\n const originalStderrWrite = process.stderr.write.bind(process.stderr);\n const stderrFilter = (chunk: unknown, ...args: unknown[]): boolean => {\n const str = typeof chunk === 'string' ? chunk : String(chunk);\n if (str.includes('content-length') || str.includes('dtype not specified')) return true;\n return (originalStderrWrite as (...a: unknown[]) => boolean)(chunk, ...args);\n };\n process.stderr.write = stderrFilter as typeof process.stderr.write;\n\n let cg;\n try {\n if (!KiroGraph.isInitialized(cwd)) {\n process.stdout.write(' Downloading embedding model\u2026\\n');\n cg = await KiroGraph.init(cwd, undefined, modelProgress);\n process.stdout.write('\\n');\n console.log(' \u2713 Created .kirograph/');\n } else {\n cg = await KiroGraph.open(cwd, modelProgress);\n if (fileBytes.size > 0) process.stdout.write('\\n');\n }\n } finally {\n process.stderr.write = originalStderrWrite;\n }\n console.log(' Indexing...');\n const result = await cg.indexAll({ onProgress: renderIndexProgress });\n process.stdout.write('\\n');\n console.log(` \u2713 Indexed ${result.filesIndexed} files, ${result.nodesCreated} symbols, ${result.edgesCreated} edges`);\n cg.close();\n\n if (typesenseDashboard) {\n const dashboardServer = await openTypesenseDashboard(cwd);\n console.log(` ${dim}Press Ctrl+C to stop the dashboard server when done.${reset}`);\n await new Promise<void>(resolve => {\n process.on('SIGINT', () => {\n if (dashboardServer) {\n dashboardServer.close(() => resolve());\n } else {\n resolve();\n }\n });\n });\n return; // rl.close() handled in finally\n }\n\n if (qdrantDashboard) {\n await openQdrantDashboard(cwd);\n }\n }\n\n installer.printNextSteps(cwd);\n } finally {\n rl.close();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,eAA0B;AAC1B,SAAoB;AACpB,WAAsB;AACtB,2BAA0B;AAC1B,oBAAyC;AACzC,oBAA4B;AAC5B,sBAAoC;AACpC,gBAA2B;AAC3B,qBAAoB;AACpB,2BAAoC;AACpC,uBAAuC;AACvC,8BAAoD;AAEpD,qBAAmC;AAGnC,eAAsB,aAAa,SAAwB,QAAuB;AAChF,iCAAY;AAEZ,QAAM,KAAK,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO,CAAC;AAEpF,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,UAAM,gBAAY,mCAAmB,MAAM;AAE3C,YAAQ,IAAI,gBAAgB,GAAG;AAAA,CAAI;AAEnC,UAAM,UAAU,UAAM,oBAAI,IAAI,2BAA2B,UAAU,KAAK,UAAU;AAClF,QAAI,QAAQ,YAAY,MAAM,KAAK;AAAE,cAAQ,IAAI,cAAc;AAAG,SAAG,MAAM;AAAG;AAAA,IAAQ;AACtF,YAAQ,IAAI;AAEZ,cAAU,aAAa,GAAG;AAE1B,UAAM,qBAAqB,GAAG,WA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ic knowledge graph of your codebase. Use its MCP tools
64
64
  | What packages/layers exist? | \`kirograph_architecture\` |
65
65
  | How coupled is package X? | \`kirograph_coupling\` |
66
66
  | What does package X depend on? | \`kirograph_package\` |
67
+ | Run a command with token savings | \`kirograph_exec\` |
68
+ | Check token savings stats | \`kirograph_gain\` |
67
69
 
68
70
  ---
69
71
 
70
72
  ## Tool reference
71
73
 
72
- ### \`kirograph_context\` \u2014 **start here for any code task**
74
+ ### \`kirograph_context\`: **start here for any code task**
73
75
 
74
76
  Returns entry points, related symbols, and code snippets for a natural-language task description. Usually enough to orient without any additional tool calls.
75
77
 
@@ -79,7 +81,7 @@ kirograph_context(task: "add dark mode", maxNodes: 30)
79
81
  kirograph_context(task: "refactor payment service", includeCode: false)
80
82
  \`\`\`
81
83
 
82
- ### \`kirograph_search\` \u2014 find symbols by name
84
+ ### \`kirograph_search\`: find symbols by name
83
85
 
84
86
  Exact match \u2192 FTS \u2192 LIKE fallback \u2192 vector (last resort). Use instead of grep.
85
87
 
@@ -91,7 +93,7 @@ kirograph_search(query: "auth", limit: 20)
91
93
 
92
94
  Supported kinds: \`function\`, \`method\`, \`class\`, \`interface\`, \`type_alias\`, \`variable\`, \`route\`, \`component\`
93
95
 
94
- ### \`kirograph_node\` \u2014 inspect a symbol
96
+ ### \`kirograph_node\`: inspect a symbol
95
97
 
96
98
  Returns kind, file, signature, docstring. Add \`includeCode: true\` to get the full source.
97
99
 
@@ -100,7 +102,7 @@ kirograph_node(symbol: "validateToken")
100
102
  kirograph_node(symbol: "AuthService", includeCode: true)
101
103
  \`\`\`
102
104
 
103
- ### \`kirograph_callers\` \u2014 who calls this?
105
+ ### \`kirograph_callers\`: who calls this?
104
106
 
105
107
  BFS over incoming \`calls\` edges (depth 1).
106
108
 
@@ -108,7 +110,7 @@ BFS over incoming \`calls\` edges (depth 1).
108
110
  kirograph_callers(symbol: "processPayment", limit: 30)
109
111
  \`\`\`
110
112
 
111
- ### \`kirograph_callees\` \u2014 what does this call?
113
+ ### \`kirograph_callees\`: what does this call?
112
114
 
113
115
  BFS over outgoing \`calls\` edges (depth 1).
114
116
 
@@ -116,7 +118,7 @@ BFS over outgoing \`calls\` edges (depth 1).
116
118
  kirograph_callees(symbol: "handleRequest")
117
119
  \`\`\`
118
120
 
119
- ### \`kirograph_impact\` \u2014 blast radius before a change
121
+ ### \`kirograph_impact\`: blast radius before a change
120
122
 
121
123
  Traverses all incoming edges up to \`depth\` hops. Call this before editing a symbol.
122
124
 
@@ -124,7 +126,7 @@ Traverses all incoming edges up to \`depth\` hops. Call this before editing a sy
124
126
  kirograph_impact(symbol: "UserRepository", depth: 3)
125
127
  \`\`\`
126
128
 
127
- ### \`kirograph_path\` \u2014 how are two symbols connected?
129
+ ### \`kirograph_path\`: how are two symbols connected?
128
130
 
129
131
  BFS shortest path across all edge types.
130
132
 
@@ -132,7 +134,7 @@ BFS shortest path across all edge types.
132
134
  kirograph_path(from: "LoginController", to: "DatabasePool")
133
135
  \`\`\`
134
136
 
135
- ### \`kirograph_type_hierarchy\` \u2014 class/interface inheritance
137
+ ### \`kirograph_type_hierarchy\`: class/interface inheritance
136
138
 
137
139
  \`\`\`
138
140
  kirograph_type_hierarchy(symbol: "BaseRepository", direction: "down") // derived types
@@ -140,7 +142,7 @@ kirograph_type_hierarchy(symbol: "PaymentService", direction: "up") // base t
140
142
  kirograph_type_hierarchy(symbol: "IUserStore", direction: "both") // all
141
143
  \`\`\`
142
144
 
143
- ### \`kirograph_dead_code\` \u2014 unreferenced symbols
145
+ ### \`kirograph_dead_code\`: unreferenced symbols
144
146
 
145
147
  Returns unexported symbols with zero incoming edges. Good first step when cleaning up.
146
148
 
@@ -148,7 +150,7 @@ Returns unexported symbols with zero incoming edges. Good first step when cleani
148
150
  kirograph_dead_code(limit: 50)
149
151
  \`\`\`
150
152
 
151
- ### \`kirograph_circular_deps\` \u2014 import cycles
153
+ ### \`kirograph_circular_deps\`: import cycles
152
154
 
153
155
  Runs Tarjan's SCC over import edges. No parameters needed.
154
156
 
@@ -156,7 +158,7 @@ Runs Tarjan's SCC over import edges. No parameters needed.
156
158
  kirograph_circular_deps()
157
159
  \`\`\`
158
160
 
159
- ### \`kirograph_files\` \u2014 indexed file structure
161
+ ### \`kirograph_files\`: indexed file structure
160
162
 
161
163
  \`\`\`
162
164
  kirograph_files(format: "tree") // default
@@ -166,11 +168,11 @@ kirograph_files(filterPath: "src/auth", maxDepth: 2)
166
168
  kirograph_files(pattern: "**/*.test.ts")
167
169
  \`\`\`
168
170
 
169
- ### \`kirograph_status\` \u2014 index health
171
+ ### \`kirograph_status\`: index health
170
172
 
171
173
  Returns file count, symbol count, edge count, embedding coverage, DB size. Call when something feels off.
172
174
 
173
- ### \`kirograph_hotspots\` \u2014 most-connected symbols
175
+ ### \`kirograph_hotspots\`: most-connected symbols
174
176
 
175
177
  Returns the top-N symbols by total edge degree (in + out, excluding structural \`contains\` edges). Use to find core abstractions, identify high blast-radius symbols before a refactor, or understand what the codebase revolves around.
176
178
 
@@ -178,7 +180,7 @@ Returns the top-N symbols by total edge degree (in + out, excluding structural \
178
180
  kirograph_hotspots(limit: 20)
179
181
  \`\`\`
180
182
 
181
- ### \`kirograph_surprising\` \u2014 unexpected cross-module coupling
183
+ ### \`kirograph_surprising\`: unexpected cross-module coupling
182
184
 
183
185
  Finds direct edges between symbols in structurally distant files, scored by path distance \xD7 edge-kind weight. Use before a refactor to discover hidden dependencies that will break. High score = more unexpected.
184
186
 
@@ -186,9 +188,9 @@ Finds direct edges between symbols in structurally distant files, scored by path
186
188
  kirograph_surprising(limit: 20)
187
189
  \`\`\`
188
190
 
189
- ### \`kirograph_diff\` \u2014 what changed since a snapshot?
191
+ ### \`kirograph_diff\`: what changed since a snapshot?
190
192
 
191
- Compares the current graph against a saved snapshot. Shows added/removed symbols and edges. A snapshot must exist \u2014 the user saves one with \`kirograph snapshot save <label>\` before making changes.
193
+ Compares the current graph against a saved snapshot. Shows added/removed symbols and edges. A snapshot must exist: the user saves one with \`kirograph snapshot save <label>\` before making changes.
192
194
 
193
195
  \`\`\`
194
196
  kirograph_diff() // vs latest snapshot
@@ -199,7 +201,7 @@ kirograph_diff(snapshot: "pre-refactor") // vs named snapshot
199
201
 
200
202
  ## Architecture tools *(require \`enableArchitecture: true\` in config)*
201
203
 
202
- ### \`kirograph_architecture\` \u2014 **start here for architectural questions**
204
+ ### \`kirograph_architecture\`: **start here for architectural questions**
203
205
 
204
206
  Returns the full package graph, detected layers (api/service/data/ui/shared), and their dependency edges.
205
207
 
@@ -210,9 +212,9 @@ kirograph_architecture(level: "layers")
210
212
  kirograph_architecture(includeFiles: true) // add file\u2192package assignments
211
213
  \`\`\`
212
214
 
213
- ### \`kirograph_coupling\` \u2014 stability metrics per package
215
+ ### \`kirograph_coupling\`: stability metrics per package
214
216
 
215
- Returns Ca (afferent \u2014 depended on by), Ce (efferent \u2014 depends on), and instability (Ce/(Ca+Ce)).
217
+ Returns Ca (afferent: depended on by), Ce (efferent: depends on), and instability (Ce/(Ca+Ce)).
216
218
  - High Ca + low instability = load-bearing, safe to depend on, risky to change interface.
217
219
  - High Ce + high instability = depends on many things, safe to refactor internals.
218
220
 
@@ -222,7 +224,7 @@ kirograph_coupling(sortBy: "afferent") // most depended-on first
222
224
  kirograph_coupling(sortBy: "efferent") // most outgoing deps first
223
225
  \`\`\`
224
226
 
225
- ### \`kirograph_package\` \u2014 drill into one package
227
+ ### \`kirograph_package\`: drill into one package
226
228
 
227
229
  Returns metadata, coupling metrics, outgoing deps, incoming dependents, and file list.
228
230
 
@@ -236,27 +238,27 @@ kirograph_package(package: "src/services", includeFiles: false)
236
238
  ## Workflows
237
239
 
238
240
  **Bug fix or feature:**
239
- 1. \`kirograph_context\` \u2014 orient, find entry points.
240
- 2. \`kirograph_node\` with \`includeCode: true\` \u2014 read the relevant symbol.
241
- 3. \`kirograph_callers\` / \`kirograph_callees\` \u2014 trace the call flow.
242
- 4. \`kirograph_impact\` \u2014 check blast radius before editing.
241
+ 1. \`kirograph_context\`: orient, find entry points.
242
+ 2. \`kirograph_node\` with \`includeCode: true\`: read the relevant symbol.
243
+ 3. \`kirograph_callers\` / \`kirograph_callees\`: trace the call flow.
244
+ 4. \`kirograph_impact\`: check blast radius before editing.
243
245
 
244
246
  **Refactor planning:**
245
- 1. \`kirograph_hotspots\` \u2014 identify the most-connected symbols; changing these is risky.
246
- 2. \`kirograph_surprising\` \u2014 surface hidden coupling that will break.
247
- 3. \`kirograph_impact\` on specific targets \u2014 confirm blast radius.
248
- 4. \`kirograph_diff\` after the refactor \u2014 verify the structural change matches intent.
247
+ 1. \`kirograph_hotspots\`: identify the most-connected symbols; changing these is risky.
248
+ 2. \`kirograph_surprising\`: surface hidden coupling that will break.
249
+ 3. \`kirograph_impact\` on specific targets: confirm blast radius.
250
+ 4. \`kirograph_diff\` after the refactor: verify the structural change matches intent.
249
251
 
250
252
  **Architectural review:**
251
- 1. \`kirograph_architecture\` \u2014 get the package and layer map.
252
- 2. \`kirograph_coupling\` \u2014 find the most stable (high Ca) and most volatile (high instability) packages.
253
- 3. \`kirograph_package\` \u2014 drill into any package of interest.
254
- 4. \`kirograph_circular_deps\` \u2014 check for import cycles.
253
+ 1. \`kirograph_architecture\`: get the package and layer map.
254
+ 2. \`kirograph_coupling\`: find the most stable (high Ca) and most volatile (high instability) packages.
255
+ 3. \`kirograph_package\`: drill into any package of interest.
256
+ 4. \`kirograph_circular_deps\`: check for import cycles.
255
257
 
256
258
  **Code cleanup:**
257
- 1. \`kirograph_dead_code\` \u2014 find unreferenced unexported symbols.
258
- 2. \`kirograph_circular_deps\` \u2014 find import cycles to untangle.
259
- 3. \`kirograph_surprising\` \u2014 find unexpected coupling to decouple.
259
+ 1. \`kirograph_dead_code\`: find unreferenced unexported symbols.
260
+ 2. \`kirograph_circular_deps\`: find import cycles to untangle.
261
+ 3. \`kirograph_surprising\`: find unexpected coupling to decouple.
260
262
 
261
263
  ---
262
264
 
@@ -264,16 +266,90 @@ kirograph_package(package: "src/services", includeFiles: false)
264
266
 
265
267
  Ask the user: "This project doesn't have KiroGraph initialized. Run \`kirograph init -i\` to build a code knowledge graph for faster exploration?"
266
268
  `;
267
- function buildSteeringContent(cavemanMode) {
269
+ const LEVEL_DESCRIPTIONS = {
270
+ normal: "Balanced: removes noise, keeps structure.",
271
+ aggressive: "Compact: groups by category, limits output.",
272
+ ultra: "Maximum compression: counts and summaries only."
273
+ };
274
+ const LEVEL_EXAMPLES = {
275
+ normal: `\\\`\\\`\\\`
276
+ kirograph_exec(command: "git status")
277
+ kirograph_exec(command: "npm test")
278
+ kirograph_exec(command: "cargo build")
279
+ kirograph_exec(command: "ls -la src/")
280
+ \\\`\\\`\\\``,
281
+ aggressive: `\\\`\\\`\\\`
282
+ kirograph_exec(command: "git status", level: "aggressive")
283
+ kirograph_exec(command: "npm test", level: "aggressive")
284
+ kirograph_exec(command: "eslint .", level: "aggressive")
285
+ kirograph_exec(command: "find . -name '*.ts'", level: "aggressive")
286
+ \\\`\\\`\\\``,
287
+ ultra: `\\\`\\\`\\\`
288
+ kirograph_exec(command: "git status", level: "ultra")
289
+ kirograph_exec(command: "npm test", level: "ultra")
290
+ kirograph_exec(command: "docker ps", level: "ultra")
291
+ kirograph_exec(command: "ls -la src/", level: "ultra")
292
+ \\\`\\\`\\\``
293
+ };
294
+ function buildCompressionSection(level) {
295
+ return `
296
+ ---
297
+
298
+ ## Shell Compression (\\\`kirograph_exec\\\`)
299
+
300
+ When running shell commands, prefer \\\`kirograph_exec\\\` over raw shell execution for:
301
+ - **git** operations (status, log, diff, push, pull, commit, add, fetch, branch)
302
+ - **GitHub CLI** (gh pr list/view, gh issue list, gh run list)
303
+ - **test runners** (jest, vitest, pytest, cargo test, go test, rspec, minitest, playwright)
304
+ - **linters/build** (eslint, tsc, ruff, clippy, cargo build, prettier, biome, golangci-lint, rubocop, next build)
305
+ - **file listings** (ls, find, tree)
306
+ - **search** (grep, rg/ripgrep: grouped by file)
307
+ - **diff** (diff file1 file2: condensed context)
308
+ - **docker/k8s** (docker ps, images, logs, compose ps, kubectl pods, logs, services)
309
+ - **package managers** (npm/pnpm install/list, pip list/install, bundle install, prisma generate)
310
+ - **AWS CLI** (sts, ec2, lambda, logs, cloudformation, dynamodb, iam, s3, ecs, sqs, sns)
311
+ - **network** (curl, wget: strip progress bars and headers)
312
+
313
+ This saves 60-90% of tokens compared to raw output.
314
+
315
+ Compression level: **${level}**: ${LEVEL_DESCRIPTIONS[level]}
316
+
317
+ ${LEVEL_EXAMPLES[level]}
318
+
319
+ **Important:** Error details are always preserved. Failed commands show full diagnostic output regardless of level.
320
+
321
+ **Do NOT re-run commands:** When \\\`kirograph_exec\\\` returns a result, treat it as the final answer. Never re-run the same command with raw shell execution to "get more details." The compressed output preserves all essential information. If you genuinely need something missing from the output, explain what's missing before making a second call.
322
+
323
+ Use \\\`kirograph_gain\\\` to check token savings statistics.`;
324
+ }
325
+ function buildSteeringContent(opts) {
326
+ const cavemanMode = opts?.cavemanMode;
327
+ const enableCompression = opts?.enableCompression !== false && opts?.shellCompressionLevel !== "off";
328
+ const shellCompressionLevel = opts?.shellCompressionLevel ?? "normal";
329
+ let content = STEERING_CONTENT;
330
+ if (enableCompression && shellCompressionLevel !== "off") {
331
+ const section = buildCompressionSection(shellCompressionLevel);
332
+ content = content.replace(
333
+ "---\n\n## If `.kirograph/` does NOT exist",
334
+ section.trim() + "\n\n---\n\n## If `.kirograph/` does NOT exist"
335
+ );
336
+ }
337
+ if (!enableCompression) {
338
+ content = content.replace("| Run a command with token savings | `kirograph_exec` |\n", "");
339
+ content = content.replace("| Check token savings stats | `kirograph_gain` |\n", "");
340
+ }
268
341
  const caveman = cavemanMode && cavemanMode !== "off" ? import_caveman.CAVEMAN_RULES[cavemanMode] : null;
269
- if (!caveman) return STEERING_CONTENT;
270
- return STEERING_CONTENT.trimEnd() + "\n\n" + caveman + "\n";
342
+ if (caveman) {
343
+ content = content.trimEnd() + "\n\n" + caveman + "\n";
344
+ }
345
+ return content;
271
346
  }
272
- function writeSteering(kiroDir, cavemanMode) {
347
+ function writeSteering(kiroDir, opts) {
273
348
  const steeringDir = path.join(kiroDir, "steering");
274
349
  fs.mkdirSync(steeringDir, { recursive: true });
275
350
  const steeringPath = path.join(steeringDir, "kirograph.md");
276
- fs.writeFileSync(steeringPath, buildSteeringContent(cavemanMode));
351
+ const resolvedOpts = typeof opts === "string" ? { cavemanMode: opts } : opts ?? {};
352
+ fs.writeFileSync(steeringPath, buildSteeringContent(resolvedOpts));
277
353
  console.log(` \u2713 Steering file written to ${steeringPath}`);
278
354
  }
279
355
  // Annotate the CommonJS export names for ESM import in node: