kirograph 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +332 -93
- package/dist/bin/commands/caveman.js +19 -2
- package/dist/bin/commands/caveman.js.map +2 -2
- package/dist/bin/commands/compression.js +109 -0
- package/dist/bin/commands/compression.js.map +7 -0
- package/dist/bin/commands/context.js +31 -24
- package/dist/bin/commands/context.js.map +2 -2
- package/dist/bin/commands/exec.js +107 -0
- package/dist/bin/commands/exec.js.map +7 -0
- package/dist/bin/commands/gain.js +119 -0
- package/dist/bin/commands/gain.js.map +7 -0
- package/dist/bin/commands/help.js +16 -5
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/install.js +8 -2
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/query.js +5 -1
- package/dist/bin/commands/query.js.map +2 -2
- package/dist/bin/commands/serve.js +2 -2
- package/dist/bin/commands/serve.js.map +2 -2
- package/dist/bin/commands/uninit.js +65 -41
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/utils.js +16 -0
- package/dist/bin/commands/utils.js.map +2 -2
- package/dist/bin/installer/cli-agent.js +5 -25
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.js +154 -0
- package/dist/bin/installer/common.js.map +7 -0
- package/dist/bin/installer/config-prompt.js +9 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/hooks.js +19 -1
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.js +104 -86
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +60 -0
- package/dist/bin/installer/instructions.js.map +7 -0
- package/dist/bin/installer/mcp.js +6 -36
- package/dist/bin/installer/mcp.js.map +2 -2
- package/dist/bin/installer/steering.js +116 -40
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/claude.js +79 -0
- package/dist/bin/installer/targets/claude.js.map +7 -0
- package/dist/bin/installer/targets/codex.js +77 -0
- package/dist/bin/installer/targets/codex.js.map +7 -0
- package/dist/bin/installer/targets/index.js +57 -0
- package/dist/bin/installer/targets/index.js.map +7 -0
- package/dist/bin/installer/targets/kiro.js +63 -0
- package/dist/bin/installer/targets/kiro.js.map +7 -0
- package/dist/bin/kirograph.js +7 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/compression/filters/aws.js +418 -0
- package/dist/compression/filters/aws.js.map +7 -0
- package/dist/compression/filters/docker.js +153 -0
- package/dist/compression/filters/docker.js.map +7 -0
- package/dist/compression/filters/files.js +150 -0
- package/dist/compression/filters/files.js.map +7 -0
- package/dist/compression/filters/generic.js +86 -0
- package/dist/compression/filters/generic.js.map +7 -0
- package/dist/compression/filters/git.js +272 -0
- package/dist/compression/filters/git.js.map +7 -0
- package/dist/compression/filters/github.js +137 -0
- package/dist/compression/filters/github.js.map +7 -0
- package/dist/compression/filters/lint.js +280 -0
- package/dist/compression/filters/lint.js.map +7 -0
- package/dist/compression/filters/misc.js +212 -0
- package/dist/compression/filters/misc.js.map +7 -0
- package/dist/compression/filters/package.js +151 -0
- package/dist/compression/filters/package.js.map +7 -0
- package/dist/compression/filters/test.js +266 -0
- package/dist/compression/filters/test.js.map +7 -0
- package/dist/compression/index.js +144 -0
- package/dist/compression/index.js.map +7 -0
- package/dist/compression/naive-cost.js +94 -0
- package/dist/compression/naive-cost.js.map +7 -0
- package/dist/compression/tracker.js +228 -0
- package/dist/compression/tracker.js.map +7 -0
- package/dist/compression/types.js +17 -0
- package/dist/compression/types.js.map +7 -0
- package/dist/config.js +18 -1
- package/dist/config.js.map +2 -2
- package/dist/mcp/tool-names.js +50 -0
- package/dist/mcp/tool-names.js.map +7 -0
- package/dist/mcp/tools.js +173 -4
- package/dist/mcp/tools.js.map +3 -3
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer for Kiro\n *\n * Wires up:\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 path from 'path';\nimport * as readline from 'readline';\nimport { spawnSync } from 'child_process';\nimport { 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 { writeMcpConfig } from './mcp';\nimport { writeHooks } from './hooks';\nimport { writeSteering } from './steering';\nimport { writeCliAgent } from './cli-agent';\nimport { openTypesenseDashboard } from './dashboard';\nimport { ensureQdrantUI, openQdrantDashboard } from './qdrant-dashboard';\n\nexport async function runInstaller(): 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 kiroDir = path.join(cwd, '.kiro');\n\n console.log(` Workspace: ${cwd}\\n`);\n\n const proceed = await ask(rl, ' Install KiroGraph for this Kiro workspace? (Y/n) ');\n if (proceed.toLowerCase() === 'n') { console.log(' Cancelled.'); rl.close(); return; }\n console.log();\n\n // 1. MCP config\n writeMcpConfig(kiroDir);\n\n // 2. IDE hooks\n writeHooks(kiroDir);\n\n // 3. Steering written after config prompt (needs cavemanMode) \u2014 deferred below\n\n // 3b. Prompt for config options and persist\n const patch = await promptConfigOptions(rl);\n try {\n await updateConfig(cwd, patch);\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: ${patch.cavemanMode ?? 'off'}`);\n\n // 3. Steering + CLI agent \u2014 written here so they include cavemanMode\n writeSteering(kiroDir, patch.cavemanMode ?? 'off');\n\n // 4. CLI agent config\n writeCliAgent(kiroDir);\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 (patch.qdrantDashboard) {\n await ensureQdrantUI(cwd);\n }\n\n // 6. Optionally init + index\n const doIndex = await ask(rl, '\\n Initialize and index this project now? (Y/n) ');\n if (doIndex.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 (patch.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 (patch.qdrantDashboard) {\n await openQdrantDashboard(cwd);\n }\n }\n\n console.log('\\n Done! Restart Kiro IDE for the MCP server to load.');\n console.log(' For Kiro CLI, use the \"kirograph\" agent: kiro-cli --agent kirograph\\n');\n } finally {\n rl.close();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,WAAsB;AACtB,
|
|
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,Q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,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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 instructions_exports = {};
|
|
20
|
+
__export(instructions_exports, {
|
|
21
|
+
buildAgentInstructions: () => buildAgentInstructions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(instructions_exports);
|
|
24
|
+
var import_caveman = require("./caveman");
|
|
25
|
+
function buildAgentInstructions(cavemanMode) {
|
|
26
|
+
const content = `# KiroGraph
|
|
27
|
+
|
|
28
|
+
KiroGraph builds a local semantic knowledge graph of this codebase. When the \`kirograph\` MCP server is available, prefer its tools over broad grep/glob/file-read exploration.
|
|
29
|
+
|
|
30
|
+
## Tool selection
|
|
31
|
+
|
|
32
|
+
- Start code tasks with \`kirograph_context\`.
|
|
33
|
+
- Find symbols by name with \`kirograph_search\`.
|
|
34
|
+
- Inspect a symbol with \`kirograph_node\`; set \`includeCode: true\` only when source is needed.
|
|
35
|
+
- Trace call flow with \`kirograph_callers\` and \`kirograph_callees\`.
|
|
36
|
+
- Check blast radius before edits with \`kirograph_impact\`.
|
|
37
|
+
- Use \`kirograph_path\` to explain how two symbols connect.
|
|
38
|
+
- Use \`kirograph_type_hierarchy\` for inheritance/interface questions.
|
|
39
|
+
- Use \`kirograph_files\` to inspect indexed file structure.
|
|
40
|
+
- Use \`kirograph_status\` if results seem stale or incomplete.
|
|
41
|
+
- Use \`kirograph_architecture\`, \`kirograph_coupling\`, and \`kirograph_package\` for package/layer questions when architecture analysis is enabled.
|
|
42
|
+
- Use \`kirograph_hotspots\`, \`kirograph_surprising\`, and \`kirograph_diff\` for refactor planning and review.
|
|
43
|
+
|
|
44
|
+
## Workflow
|
|
45
|
+
|
|
46
|
+
1. Call \`kirograph_context\` for orientation.
|
|
47
|
+
2. Drill into specific symbols with \`kirograph_node\`.
|
|
48
|
+
3. Use graph traversal tools before reading unrelated files.
|
|
49
|
+
4. Fall back to normal filesystem tools only when the graph is missing, stale, or lacks the needed detail.
|
|
50
|
+
|
|
51
|
+
If \`.kirograph/\` does not exist, ask whether to run \`kirograph init --index\`.
|
|
52
|
+
`;
|
|
53
|
+
const caveman = cavemanMode && cavemanMode !== "off" ? import_caveman.CAVEMAN_RULES[cavemanMode] : null;
|
|
54
|
+
return caveman ? content.trimEnd() + "\n\n" + caveman + "\n" : content;
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
buildAgentInstructions
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/installer/instructions.ts"],
|
|
4
|
+
"sourcesContent": ["import { CAVEMAN_RULES, CavemanMode } from './caveman';\n\nexport function buildAgentInstructions(cavemanMode?: CavemanMode | 'off'): string {\n const content = `# KiroGraph\n\nKiroGraph builds a local semantic knowledge graph of this codebase. When the \\`kirograph\\` MCP server is available, prefer its tools over broad grep/glob/file-read exploration.\n\n## Tool selection\n\n- Start code tasks with \\`kirograph_context\\`.\n- Find symbols by name with \\`kirograph_search\\`.\n- Inspect a symbol with \\`kirograph_node\\`; set \\`includeCode: true\\` only when source is needed.\n- Trace call flow with \\`kirograph_callers\\` and \\`kirograph_callees\\`.\n- Check blast radius before edits with \\`kirograph_impact\\`.\n- Use \\`kirograph_path\\` to explain how two symbols connect.\n- Use \\`kirograph_type_hierarchy\\` for inheritance/interface questions.\n- Use \\`kirograph_files\\` to inspect indexed file structure.\n- Use \\`kirograph_status\\` if results seem stale or incomplete.\n- Use \\`kirograph_architecture\\`, \\`kirograph_coupling\\`, and \\`kirograph_package\\` for package/layer questions when architecture analysis is enabled.\n- Use \\`kirograph_hotspots\\`, \\`kirograph_surprising\\`, and \\`kirograph_diff\\` for refactor planning and review.\n\n## Workflow\n\n1. Call \\`kirograph_context\\` for orientation.\n2. Drill into specific symbols with \\`kirograph_node\\`.\n3. Use graph traversal tools before reading unrelated files.\n4. Fall back to normal filesystem tools only when the graph is missing, stale, or lacks the needed detail.\n\nIf \\`.kirograph/\\` does not exist, ask whether to run \\`kirograph init --index\\`.\n`;\n\n const caveman = cavemanMode && cavemanMode !== 'off' ? CAVEMAN_RULES[cavemanMode] : null;\n return caveman ? content.trimEnd() + '\\n\\n' + caveman + '\\n' : content;\n}\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2C;AAEpC,SAAS,uBAAuB,aAA2C;AAChF,QAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BhB,QAAM,UAAU,eAAe,gBAAgB,QAAQ,6BAAc,WAAW,IAAI;AACpF,SAAO,UAAU,QAAQ,QAAQ,IAAI,SAAS,UAAU,OAAO;AACjE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -31,46 +31,16 @@ __export(mcp_exports, {
|
|
|
31
31
|
writeMcpConfig: () => writeMcpConfig
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(mcp_exports);
|
|
34
|
-
var fs = __toESM(require("fs"));
|
|
35
34
|
var path = __toESM(require("path"));
|
|
36
|
-
|
|
37
|
-
fs.mkdirSync(p, { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
function readJson(p) {
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(fs.readFileSync(p, "utf8"));
|
|
42
|
-
} catch {
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function writeJson(p, data) {
|
|
47
|
-
fs.writeFileSync(p, JSON.stringify(data, null, 2) + "\n");
|
|
48
|
-
}
|
|
35
|
+
var import_common = require("./common");
|
|
49
36
|
function writeMcpConfig(kiroDir) {
|
|
50
37
|
const mcpPath = path.join(kiroDir, "settings", "mcp.json");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
existing.mcpServers.kirograph = {
|
|
55
|
-
command: "kirograph",
|
|
56
|
-
args: ["serve", "--mcp"],
|
|
38
|
+
(0, import_common.writeMcpServersConfig)(mcpPath, {
|
|
39
|
+
command: import_common.KIROGRAPH_COMMAND,
|
|
40
|
+
args: import_common.KIROGRAPH_MCP_ARGS,
|
|
57
41
|
disabled: false,
|
|
58
|
-
autoApprove:
|
|
59
|
-
|
|
60
|
-
"kirograph_context",
|
|
61
|
-
"kirograph_callers",
|
|
62
|
-
"kirograph_callees",
|
|
63
|
-
"kirograph_impact",
|
|
64
|
-
"kirograph_node",
|
|
65
|
-
"kirograph_status",
|
|
66
|
-
"kirograph_files",
|
|
67
|
-
"kirograph_dead_code",
|
|
68
|
-
"kirograph_circular_deps",
|
|
69
|
-
"kirograph_path",
|
|
70
|
-
"kirograph_type_hierarchy"
|
|
71
|
-
]
|
|
72
|
-
};
|
|
73
|
-
writeJson(mcpPath, existing);
|
|
42
|
+
autoApprove: import_common.KIROGRAPH_TOOLS
|
|
43
|
+
});
|
|
74
44
|
console.log(` \u2713 MCP server registered in ${mcpPath}`);
|
|
75
45
|
}
|
|
76
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/mcp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 MCP server registration\n */\n\nimport * as
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 MCP server registration\n */\n\nimport * as path from 'path';\nimport { KIROGRAPH_COMMAND, KIROGRAPH_MCP_ARGS, KIROGRAPH_TOOLS, writeMcpServersConfig } from './common';\n\nexport function writeMcpConfig(kiroDir: string): void {\n const mcpPath = path.join(kiroDir, 'settings', 'mcp.json');\n writeMcpServersConfig(mcpPath, {\n command: KIROGRAPH_COMMAND,\n args: KIROGRAPH_MCP_ARGS,\n disabled: false,\n autoApprove: KIROGRAPH_TOOLS,\n });\n console.log(` \u2713 MCP server registered in ${mcpPath}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,WAAsB;AACtB,oBAA8F;AAEvF,SAAS,eAAe,SAAuB;AACpD,QAAM,UAAU,KAAK,KAAK,SAAS,YAAY,UAAU;AACzD,2CAAsB,SAAS;AAAA,IAC7B,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,aAAa;AAAA,EACf,CAAC;AACD,UAAQ,IAAI,qCAAgC,OAAO,EAAE;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -64,12 +64,14 @@ KiroGraph builds a semantic 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
215
|
+
### \`kirograph_coupling\`: stability metrics per package
|
|
214
216
|
|
|
215
|
-
Returns Ca (afferent
|
|
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
|
|
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
|
|
240
|
-
2. \`kirograph_node\` with \`includeCode: true
|
|
241
|
-
3. \`kirograph_callers\` / \`kirograph_callees
|
|
242
|
-
4. \`kirograph_impact
|
|
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
|
|
246
|
-
2. \`kirograph_surprising
|
|
247
|
-
3. \`kirograph_impact\` on specific targets
|
|
248
|
-
4. \`kirograph_diff\` after the refactor
|
|
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
|
|
252
|
-
2. \`kirograph_coupling
|
|
253
|
-
3. \`kirograph_package
|
|
254
|
-
4. \`kirograph_circular_deps
|
|
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
|
|
258
|
-
2. \`kirograph_circular_deps
|
|
259
|
-
3. \`kirograph_surprising
|
|
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
|
-
|
|
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 (
|
|
270
|
-
|
|
342
|
+
if (caveman) {
|
|
343
|
+
content = content.trimEnd() + "\n\n" + caveman + "\n";
|
|
344
|
+
}
|
|
345
|
+
return content;
|
|
271
346
|
}
|
|
272
|
-
function writeSteering(kiroDir,
|
|
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
|
-
|
|
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:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/steering.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro steering file\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { CAVEMAN_RULES, CavemanMode } from './caveman';\n\nconst STEERING_CONTENT = `---\ninclusion: always\n---\n\n# KiroGraph\n\nKiroGraph builds a semantic knowledge graph of your codebase. Use its MCP tools instead of grep/glob/file reads whenever \\`.kirograph/\\` exists in the project.\n\n## Quick decision guide\n\n| Question | Tool |\n|----------|------|\n| Where do I start on this task? | \\`kirograph_context\\` |\n| What is this symbol / show me its code | \\`kirograph_node\\` with \\`includeCode: true\\` |\n| Find a symbol by name | \\`kirograph_search\\` |\n| Who calls function X? | \\`kirograph_callers\\` |\n| What does function X call? | \\`kirograph_callees\\` |\n| What breaks if I change X? | \\`kirograph_impact\\` |\n| How are X and Y connected? | \\`kirograph_path\\` |\n| What extends / implements this type? | \\`kirograph_type_hierarchy\\` |\n| Which code is never called? | \\`kirograph_dead_code\\` |\n| Are there import cycles? | \\`kirograph_circular_deps\\` |\n| What files are indexed? | \\`kirograph_files\\` |\n| Is the index healthy? | \\`kirograph_status\\` |\n| What are the most critical symbols? | \\`kirograph_hotspots\\` |\n| Any unexpected cross-module coupling? | \\`kirograph_surprising\\` |\n| What changed since the last snapshot? | \\`kirograph_diff\\` |\n| What packages/layers exist? | \\`kirograph_architecture\\` |\n| How coupled is package X? | \\`kirograph_coupling\\` |\n| What does package X depend on? | \\`kirograph_package\\` |\n\n---\n\n## Tool reference\n\n### \\`kirograph_context\\` \u2014 **start here for any code task**\n\nReturns entry points, related symbols, and code snippets for a natural-language task description. Usually enough to orient without any additional tool calls.\n\n\\`\\`\\`\nkirograph_context(task: \"fix the auth token expiry bug\")\nkirograph_context(task: \"add dark mode\", maxNodes: 30)\nkirograph_context(task: \"refactor payment service\", includeCode: false)\n\\`\\`\\`\n\n### \\`kirograph_search\\` \u2014 find symbols by name\n\nExact match \u2192 FTS \u2192 LIKE fallback \u2192 vector (last resort). Use instead of grep.\n\n\\`\\`\\`\nkirograph_search(query: \"signIn\")\nkirograph_search(query: \"UserService\", kind: \"class\")\nkirograph_search(query: \"auth\", limit: 20)\n\\`\\`\\`\n\nSupported kinds: \\`function\\`, \\`method\\`, \\`class\\`, \\`interface\\`, \\`type_alias\\`, \\`variable\\`, \\`route\\`, \\`component\\`\n\n### \\`kirograph_node\\` \u2014 inspect a symbol\n\nReturns kind, file, signature, docstring. Add \\`includeCode: true\\` to get the full source.\n\n\\`\\`\\`\nkirograph_node(symbol: \"validateToken\")\nkirograph_node(symbol: \"AuthService\", includeCode: true)\n\\`\\`\\`\n\n### \\`kirograph_callers\\` \u2014 who calls this?\n\nBFS over incoming \\`calls\\` edges (depth 1).\n\n\\`\\`\\`\nkirograph_callers(symbol: \"processPayment\", limit: 30)\n\\`\\`\\`\n\n### \\`kirograph_callees\\` \u2014 what does this call?\n\nBFS over outgoing \\`calls\\` edges (depth 1).\n\n\\`\\`\\`\nkirograph_callees(symbol: \"handleRequest\")\n\\`\\`\\`\n\n### \\`kirograph_impact\\` \u2014 blast radius before a change\n\nTraverses all incoming edges up to \\`depth\\` hops. Call this before editing a symbol.\n\n\\`\\`\\`\nkirograph_impact(symbol: \"UserRepository\", depth: 3)\n\\`\\`\\`\n\n### \\`kirograph_path\\` \u2014 how are two symbols connected?\n\nBFS shortest path across all edge types.\n\n\\`\\`\\`\nkirograph_path(from: \"LoginController\", to: \"DatabasePool\")\n\\`\\`\\`\n\n### \\`kirograph_type_hierarchy\\` \u2014 class/interface inheritance\n\n\\`\\`\\`\nkirograph_type_hierarchy(symbol: \"BaseRepository\", direction: \"down\") // derived types\nkirograph_type_hierarchy(symbol: \"PaymentService\", direction: \"up\") // base types\nkirograph_type_hierarchy(symbol: \"IUserStore\", direction: \"both\") // all\n\\`\\`\\`\n\n### \\`kirograph_dead_code\\` \u2014 unreferenced symbols\n\nReturns unexported symbols with zero incoming edges. Good first step when cleaning up.\n\n\\`\\`\\`\nkirograph_dead_code(limit: 50)\n\\`\\`\\`\n\n### \\`kirograph_circular_deps\\` \u2014 import cycles\n\nRuns Tarjan's SCC over import edges. No parameters needed.\n\n\\`\\`\\`\nkirograph_circular_deps()\n\\`\\`\\`\n\n### \\`kirograph_files\\` \u2014 indexed file structure\n\n\\`\\`\\`\nkirograph_files(format: \"tree\") // default\nkirograph_files(format: \"flat\") // one path per line\nkirograph_files(format: \"grouped\") // by directory\nkirograph_files(filterPath: \"src/auth\", maxDepth: 2)\nkirograph_files(pattern: \"**/*.test.ts\")\n\\`\\`\\`\n\n### \\`kirograph_status\\` \u2014 index health\n\nReturns file count, symbol count, edge count, embedding coverage, DB size. Call when something feels off.\n\n### \\`kirograph_hotspots\\` \u2014 most-connected symbols\n\nReturns 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.\n\n\\`\\`\\`\nkirograph_hotspots(limit: 20)\n\\`\\`\\`\n\n### \\`kirograph_surprising\\` \u2014 unexpected cross-module coupling\n\nFinds direct edges between symbols in structurally distant files, scored by path distance \u00D7 edge-kind weight. Use before a refactor to discover hidden dependencies that will break. High score = more unexpected.\n\n\\`\\`\\`\nkirograph_surprising(limit: 20)\n\\`\\`\\`\n\n### \\`kirograph_diff\\` \u2014 what changed since a snapshot?\n\nCompares 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.\n\n\\`\\`\\`\nkirograph_diff() // vs latest snapshot\nkirograph_diff(snapshot: \"pre-refactor\") // vs named snapshot\n\\`\\`\\`\n\n---\n\n## Architecture tools *(require \\`enableArchitecture: true\\` in config)*\n\n### \\`kirograph_architecture\\` \u2014 **start here for architectural questions**\n\nReturns the full package graph, detected layers (api/service/data/ui/shared), and their dependency edges.\n\n\\`\\`\\`\nkirograph_architecture() // packages + layers\nkirograph_architecture(level: \"packages\")\nkirograph_architecture(level: \"layers\")\nkirograph_architecture(includeFiles: true) // add file\u2192package assignments\n\\`\\`\\`\n\n### \\`kirograph_coupling\\` \u2014 stability metrics per package\n\nReturns Ca (afferent \u2014 depended on by), Ce (efferent \u2014 depends on), and instability (Ce/(Ca+Ce)).\n- High Ca + low instability = load-bearing, safe to depend on, risky to change interface.\n- High Ce + high instability = depends on many things, safe to refactor internals.\n\n\\`\\`\\`\nkirograph_coupling() // all packages, sorted by instability\nkirograph_coupling(sortBy: \"afferent\") // most depended-on first\nkirograph_coupling(sortBy: \"efferent\") // most outgoing deps first\n\\`\\`\\`\n\n### \\`kirograph_package\\` \u2014 drill into one package\n\nReturns metadata, coupling metrics, outgoing deps, incoming dependents, and file list.\n\n\\`\\`\\`\nkirograph_package(package: \"auth\")\nkirograph_package(package: \"src/services\", includeFiles: false)\n\\`\\`\\`\n\n---\n\n## Workflows\n\n**Bug fix or feature:**\n1. \\`kirograph_context\\` \u2014 orient, find entry points.\n2. \\`kirograph_node\\` with \\`includeCode: true\\` \u2014 read the relevant symbol.\n3. \\`kirograph_callers\\` / \\`kirograph_callees\\` \u2014 trace the call flow.\n4. \\`kirograph_impact\\` \u2014 check blast radius before editing.\n\n**Refactor planning:**\n1. \\`kirograph_hotspots\\` \u2014 identify the most-connected symbols; changing these is risky.\n2. \\`kirograph_surprising\\` \u2014 surface hidden coupling that will break.\n3. \\`kirograph_impact\\` on specific targets \u2014 confirm blast radius.\n4. \\`kirograph_diff\\` after the refactor \u2014 verify the structural change matches intent.\n\n**Architectural review:**\n1. \\`kirograph_architecture\\` \u2014 get the package and layer map.\n2. \\`kirograph_coupling\\` \u2014 find the most stable (high Ca) and most volatile (high instability) packages.\n3. \\`kirograph_package\\` \u2014 drill into any package of interest.\n4. \\`kirograph_circular_deps\\` \u2014 check for import cycles.\n\n**Code cleanup:**\n1. \\`kirograph_dead_code\\` \u2014 find unreferenced unexported symbols.\n2. \\`kirograph_circular_deps\\` \u2014 find import cycles to untangle.\n3. \\`kirograph_surprising\\` \u2014 find unexpected coupling to decouple.\n\n---\n\n## If \\`.kirograph/\\` does NOT exist\n\nAsk the user: \"This project doesn't have KiroGraph initialized. Run \\`kirograph init -i\\` to build a code knowledge graph for faster exploration?\"\n`;\n\nfunction buildSteeringContent(cavemanMode?: CavemanMode | 'off'): string {\n const caveman = cavemanMode && cavemanMode !== 'off' ? CAVEMAN_RULES[cavemanMode] : null;\n if (!caveman) return STEERING_CONTENT;\n return STEERING_CONTENT.trimEnd() + '\\n\\n' + caveman + '\\n';\n}\n\nexport function writeSteering(kiroDir: string, cavemanMode?: CavemanMode | 'off'): void {\n const steeringDir = path.join(kiroDir, 'steering');\n fs.mkdirSync(steeringDir, { recursive: true });\n const steeringPath = path.join(steeringDir, 'kirograph.md');\n fs.writeFileSync(steeringPath, buildSteeringContent(cavemanMode));\n console.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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Installer: Kiro steering file\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { CAVEMAN_RULES, CavemanMode } from './caveman';\n\nconst STEERING_CONTENT = `---\ninclusion: always\n---\n\n# KiroGraph\n\nKiroGraph builds a semantic knowledge graph of your codebase. Use its MCP tools instead of grep/glob/file reads whenever \\`.kirograph/\\` exists in the project.\n\n## Quick decision guide\n\n| Question | Tool |\n|----------|------|\n| Where do I start on this task? | \\`kirograph_context\\` |\n| What is this symbol / show me its code | \\`kirograph_node\\` with \\`includeCode: true\\` |\n| Find a symbol by name | \\`kirograph_search\\` |\n| Who calls function X? | \\`kirograph_callers\\` |\n| What does function X call? | \\`kirograph_callees\\` |\n| What breaks if I change X? | \\`kirograph_impact\\` |\n| How are X and Y connected? | \\`kirograph_path\\` |\n| What extends / implements this type? | \\`kirograph_type_hierarchy\\` |\n| Which code is never called? | \\`kirograph_dead_code\\` |\n| Are there import cycles? | \\`kirograph_circular_deps\\` |\n| What files are indexed? | \\`kirograph_files\\` |\n| Is the index healthy? | \\`kirograph_status\\` |\n| What are the most critical symbols? | \\`kirograph_hotspots\\` |\n| Any unexpected cross-module coupling? | \\`kirograph_surprising\\` |\n| What changed since the last snapshot? | \\`kirograph_diff\\` |\n| What packages/layers exist? | \\`kirograph_architecture\\` |\n| How coupled is package X? | \\`kirograph_coupling\\` |\n| What does package X depend on? | \\`kirograph_package\\` |\n| Run a command with token savings | \\`kirograph_exec\\` |\n| Check token savings stats | \\`kirograph_gain\\` |\n\n---\n\n## Tool reference\n\n### \\`kirograph_context\\`: **start here for any code task**\n\nReturns entry points, related symbols, and code snippets for a natural-language task description. Usually enough to orient without any additional tool calls.\n\n\\`\\`\\`\nkirograph_context(task: \"fix the auth token expiry bug\")\nkirograph_context(task: \"add dark mode\", maxNodes: 30)\nkirograph_context(task: \"refactor payment service\", includeCode: false)\n\\`\\`\\`\n\n### \\`kirograph_search\\`: find symbols by name\n\nExact match \u2192 FTS \u2192 LIKE fallback \u2192 vector (last resort). Use instead of grep.\n\n\\`\\`\\`\nkirograph_search(query: \"signIn\")\nkirograph_search(query: \"UserService\", kind: \"class\")\nkirograph_search(query: \"auth\", limit: 20)\n\\`\\`\\`\n\nSupported kinds: \\`function\\`, \\`method\\`, \\`class\\`, \\`interface\\`, \\`type_alias\\`, \\`variable\\`, \\`route\\`, \\`component\\`\n\n### \\`kirograph_node\\`: inspect a symbol\n\nReturns kind, file, signature, docstring. Add \\`includeCode: true\\` to get the full source.\n\n\\`\\`\\`\nkirograph_node(symbol: \"validateToken\")\nkirograph_node(symbol: \"AuthService\", includeCode: true)\n\\`\\`\\`\n\n### \\`kirograph_callers\\`: who calls this?\n\nBFS over incoming \\`calls\\` edges (depth 1).\n\n\\`\\`\\`\nkirograph_callers(symbol: \"processPayment\", limit: 30)\n\\`\\`\\`\n\n### \\`kirograph_callees\\`: what does this call?\n\nBFS over outgoing \\`calls\\` edges (depth 1).\n\n\\`\\`\\`\nkirograph_callees(symbol: \"handleRequest\")\n\\`\\`\\`\n\n### \\`kirograph_impact\\`: blast radius before a change\n\nTraverses all incoming edges up to \\`depth\\` hops. Call this before editing a symbol.\n\n\\`\\`\\`\nkirograph_impact(symbol: \"UserRepository\", depth: 3)\n\\`\\`\\`\n\n### \\`kirograph_path\\`: how are two symbols connected?\n\nBFS shortest path across all edge types.\n\n\\`\\`\\`\nkirograph_path(from: \"LoginController\", to: \"DatabasePool\")\n\\`\\`\\`\n\n### \\`kirograph_type_hierarchy\\`: class/interface inheritance\n\n\\`\\`\\`\nkirograph_type_hierarchy(symbol: \"BaseRepository\", direction: \"down\") // derived types\nkirograph_type_hierarchy(symbol: \"PaymentService\", direction: \"up\") // base types\nkirograph_type_hierarchy(symbol: \"IUserStore\", direction: \"both\") // all\n\\`\\`\\`\n\n### \\`kirograph_dead_code\\`: unreferenced symbols\n\nReturns unexported symbols with zero incoming edges. Good first step when cleaning up.\n\n\\`\\`\\`\nkirograph_dead_code(limit: 50)\n\\`\\`\\`\n\n### \\`kirograph_circular_deps\\`: import cycles\n\nRuns Tarjan's SCC over import edges. No parameters needed.\n\n\\`\\`\\`\nkirograph_circular_deps()\n\\`\\`\\`\n\n### \\`kirograph_files\\`: indexed file structure\n\n\\`\\`\\`\nkirograph_files(format: \"tree\") // default\nkirograph_files(format: \"flat\") // one path per line\nkirograph_files(format: \"grouped\") // by directory\nkirograph_files(filterPath: \"src/auth\", maxDepth: 2)\nkirograph_files(pattern: \"**/*.test.ts\")\n\\`\\`\\`\n\n### \\`kirograph_status\\`: index health\n\nReturns file count, symbol count, edge count, embedding coverage, DB size. Call when something feels off.\n\n### \\`kirograph_hotspots\\`: most-connected symbols\n\nReturns 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.\n\n\\`\\`\\`\nkirograph_hotspots(limit: 20)\n\\`\\`\\`\n\n### \\`kirograph_surprising\\`: unexpected cross-module coupling\n\nFinds direct edges between symbols in structurally distant files, scored by path distance \u00D7 edge-kind weight. Use before a refactor to discover hidden dependencies that will break. High score = more unexpected.\n\n\\`\\`\\`\nkirograph_surprising(limit: 20)\n\\`\\`\\`\n\n### \\`kirograph_diff\\`: what changed since a snapshot?\n\nCompares 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.\n\n\\`\\`\\`\nkirograph_diff() // vs latest snapshot\nkirograph_diff(snapshot: \"pre-refactor\") // vs named snapshot\n\\`\\`\\`\n\n---\n\n## Architecture tools *(require \\`enableArchitecture: true\\` in config)*\n\n### \\`kirograph_architecture\\`: **start here for architectural questions**\n\nReturns the full package graph, detected layers (api/service/data/ui/shared), and their dependency edges.\n\n\\`\\`\\`\nkirograph_architecture() // packages + layers\nkirograph_architecture(level: \"packages\")\nkirograph_architecture(level: \"layers\")\nkirograph_architecture(includeFiles: true) // add file\u2192package assignments\n\\`\\`\\`\n\n### \\`kirograph_coupling\\`: stability metrics per package\n\nReturns Ca (afferent: depended on by), Ce (efferent: depends on), and instability (Ce/(Ca+Ce)).\n- High Ca + low instability = load-bearing, safe to depend on, risky to change interface.\n- High Ce + high instability = depends on many things, safe to refactor internals.\n\n\\`\\`\\`\nkirograph_coupling() // all packages, sorted by instability\nkirograph_coupling(sortBy: \"afferent\") // most depended-on first\nkirograph_coupling(sortBy: \"efferent\") // most outgoing deps first\n\\`\\`\\`\n\n### \\`kirograph_package\\`: drill into one package\n\nReturns metadata, coupling metrics, outgoing deps, incoming dependents, and file list.\n\n\\`\\`\\`\nkirograph_package(package: \"auth\")\nkirograph_package(package: \"src/services\", includeFiles: false)\n\\`\\`\\`\n\n---\n\n## Workflows\n\n**Bug fix or feature:**\n1. \\`kirograph_context\\`: orient, find entry points.\n2. \\`kirograph_node\\` with \\`includeCode: true\\`: read the relevant symbol.\n3. \\`kirograph_callers\\` / \\`kirograph_callees\\`: trace the call flow.\n4. \\`kirograph_impact\\`: check blast radius before editing.\n\n**Refactor planning:**\n1. \\`kirograph_hotspots\\`: identify the most-connected symbols; changing these is risky.\n2. \\`kirograph_surprising\\`: surface hidden coupling that will break.\n3. \\`kirograph_impact\\` on specific targets: confirm blast radius.\n4. \\`kirograph_diff\\` after the refactor: verify the structural change matches intent.\n\n**Architectural review:**\n1. \\`kirograph_architecture\\`: get the package and layer map.\n2. \\`kirograph_coupling\\`: find the most stable (high Ca) and most volatile (high instability) packages.\n3. \\`kirograph_package\\`: drill into any package of interest.\n4. \\`kirograph_circular_deps\\`: check for import cycles.\n\n**Code cleanup:**\n1. \\`kirograph_dead_code\\`: find unreferenced unexported symbols.\n2. \\`kirograph_circular_deps\\`: find import cycles to untangle.\n3. \\`kirograph_surprising\\`: find unexpected coupling to decouple.\n\n---\n\n## If \\`.kirograph/\\` does NOT exist\n\nAsk the user: \"This project doesn't have KiroGraph initialized. Run \\`kirograph init -i\\` to build a code knowledge graph for faster exploration?\"\n`;\n\n// \u2500\u2500 Compression section builder (level-aware) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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 LEVEL_DESCRIPTIONS: Record<string, string> = {\n normal: 'Balanced: removes noise, keeps structure.',\n aggressive: 'Compact: groups by category, limits output.',\n ultra: 'Maximum compression: counts and summaries only.',\n};\n\nconst LEVEL_EXAMPLES: Record<string, string> = {\n normal: `\\\\\\`\\\\\\`\\\\\\`\nkirograph_exec(command: \"git status\")\nkirograph_exec(command: \"npm test\")\nkirograph_exec(command: \"cargo build\")\nkirograph_exec(command: \"ls -la src/\")\n\\\\\\`\\\\\\`\\\\\\``,\n aggressive: `\\\\\\`\\\\\\`\\\\\\`\nkirograph_exec(command: \"git status\", level: \"aggressive\")\nkirograph_exec(command: \"npm test\", level: \"aggressive\")\nkirograph_exec(command: \"eslint .\", level: \"aggressive\")\nkirograph_exec(command: \"find . -name '*.ts'\", level: \"aggressive\")\n\\\\\\`\\\\\\`\\\\\\``,\n ultra: `\\\\\\`\\\\\\`\\\\\\`\nkirograph_exec(command: \"git status\", level: \"ultra\")\nkirograph_exec(command: \"npm test\", level: \"ultra\")\nkirograph_exec(command: \"docker ps\", level: \"ultra\")\nkirograph_exec(command: \"ls -la src/\", level: \"ultra\")\n\\\\\\`\\\\\\`\\\\\\``,\n};\n\nfunction buildCompressionSection(level: 'normal' | 'aggressive' | 'ultra'): string {\n return `\n---\n\n## Shell Compression (\\\\\\`kirograph_exec\\\\\\`)\n\nWhen running shell commands, prefer \\\\\\`kirograph_exec\\\\\\` over raw shell execution for:\n- **git** operations (status, log, diff, push, pull, commit, add, fetch, branch)\n- **GitHub CLI** (gh pr list/view, gh issue list, gh run list)\n- **test runners** (jest, vitest, pytest, cargo test, go test, rspec, minitest, playwright)\n- **linters/build** (eslint, tsc, ruff, clippy, cargo build, prettier, biome, golangci-lint, rubocop, next build)\n- **file listings** (ls, find, tree)\n- **search** (grep, rg/ripgrep: grouped by file)\n- **diff** (diff file1 file2: condensed context)\n- **docker/k8s** (docker ps, images, logs, compose ps, kubectl pods, logs, services)\n- **package managers** (npm/pnpm install/list, pip list/install, bundle install, prisma generate)\n- **AWS CLI** (sts, ec2, lambda, logs, cloudformation, dynamodb, iam, s3, ecs, sqs, sns)\n- **network** (curl, wget: strip progress bars and headers)\n\nThis saves 60-90% of tokens compared to raw output.\n\nCompression level: **${level}**: ${LEVEL_DESCRIPTIONS[level]}\n\n${LEVEL_EXAMPLES[level]}\n\n**Important:** Error details are always preserved. Failed commands show full diagnostic output regardless of level.\n\n**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.\n\nUse \\\\\\`kirograph_gain\\\\\\` to check token savings statistics.`;\n}\n\nexport interface SteeringOptions {\n cavemanMode?: CavemanMode | 'off';\n enableCompression?: boolean;\n shellCompressionLevel?: 'off' | 'normal' | 'aggressive' | 'ultra';\n}\n\nfunction buildSteeringContent(opts?: SteeringOptions): string {\n const cavemanMode = opts?.cavemanMode;\n const enableCompression = opts?.enableCompression !== false && opts?.shellCompressionLevel !== 'off';\n const shellCompressionLevel = opts?.shellCompressionLevel ?? 'normal';\n\n let content = STEERING_CONTENT;\n\n // Insert compression section before the \"If .kirograph/ does NOT exist\" section\n if (enableCompression && shellCompressionLevel !== 'off') {\n const section = buildCompressionSection(shellCompressionLevel as 'normal' | 'aggressive' | 'ultra');\n content = content.replace(\n '---\\n\\n## If `.kirograph/` does NOT exist',\n section.trim() + '\\n\\n---\\n\\n## If `.kirograph/` does NOT exist',\n );\n }\n\n // Remove compression tools from decision guide if disabled\n if (!enableCompression) {\n content = content.replace('| Run a command with token savings | `kirograph_exec` |\\n', '');\n content = content.replace('| Check token savings stats | `kirograph_gain` |\\n', '');\n }\n\n const caveman = cavemanMode && cavemanMode !== 'off' ? CAVEMAN_RULES[cavemanMode] : null;\n if (caveman) {\n content = content.trimEnd() + '\\n\\n' + caveman + '\\n';\n }\n\n return content;\n}\n\nexport function writeSteering(kiroDir: string, opts?: SteeringOptions | CavemanMode | 'off'): void {\n const steeringDir = path.join(kiroDir, 'steering');\n fs.mkdirSync(steeringDir, { recursive: true });\n const steeringPath = path.join(steeringDir, 'kirograph.md');\n\n // Support both old signature (cavemanMode string) and new signature (options object)\n const resolvedOpts: SteeringOptions = typeof opts === 'string'\n ? { cavemanMode: opts }\n : opts ?? {};\n\n fs.writeFileSync(steeringPath, buildSteeringContent(resolvedOpts));\n console.log(` \u2713 Steering file written to ${steeringPath}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AACtB,qBAA2C;AAE3C,MAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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