kirograph 0.12.2 → 0.13.1
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 +197 -87
- package/dist/architecture/layers/index.js +9 -1
- package/dist/architecture/layers/index.js.map +2 -2
- package/dist/architecture/layers/ocaml.js +105 -0
- package/dist/architecture/layers/ocaml.js.map +7 -0
- package/dist/architecture/layers/scala.js +120 -0
- package/dist/architecture/layers/scala.js.map +7 -0
- package/dist/architecture/layers/solidity.js +105 -0
- package/dist/architecture/layers/solidity.js.map +7 -0
- package/dist/architecture/layers/vue.js +111 -0
- package/dist/architecture/layers/vue.js.map +7 -0
- package/dist/architecture/manifest/elm.js +91 -0
- package/dist/architecture/manifest/elm.js.map +7 -0
- package/dist/architecture/manifest/index.js +13 -2
- package/dist/architecture/manifest/index.js.map +2 -2
- package/dist/architecture/manifest/ocaml.js +166 -0
- package/dist/architecture/manifest/ocaml.js.map +7 -0
- package/dist/architecture/manifest/scala.js +117 -0
- package/dist/architecture/manifest/scala.js.map +7 -0
- package/dist/bin/commands/caveman.js +12 -0
- package/dist/bin/commands/caveman.js.map +2 -2
- package/dist/bin/commands/help.js +6 -4
- 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/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/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/hooks.js +21 -1
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.js +99 -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/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 +61 -0
- package/dist/bin/installer/targets/kiro.js.map +7 -0
- package/dist/bin/kirograph.js +1 -1
- package/dist/extraction/extractor.js +65 -2
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +22 -0
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.js +39 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/wasm/tree-sitter-hcl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scss.wasm +0 -0
- package/dist/frameworks/amplify.js +175 -0
- package/dist/frameworks/amplify.js.map +7 -0
- package/dist/frameworks/angular.js +132 -0
- package/dist/frameworks/angular.js.map +7 -0
- package/dist/frameworks/ansible.js +151 -0
- package/dist/frameworks/ansible.js.map +7 -0
- package/dist/frameworks/cloudformation.js +148 -0
- package/dist/frameworks/cloudformation.js.map +7 -0
- package/dist/frameworks/docker.js +149 -0
- package/dist/frameworks/docker.js.map +7 -0
- package/dist/frameworks/iac.js +401 -0
- package/dist/frameworks/iac.js.map +7 -0
- package/dist/frameworks/index.js +81 -3
- package/dist/frameworks/index.js.map +3 -3
- package/dist/frameworks/kubernetes.js +176 -0
- package/dist/frameworks/kubernetes.js.map +7 -0
- package/dist/frameworks/pulumi.js +93 -0
- package/dist/frameworks/pulumi.js.map +7 -0
- package/dist/frameworks/scala.js +124 -0
- package/dist/frameworks/scala.js.map +7 -0
- package/dist/frameworks/solidity.js +93 -0
- package/dist/frameworks/solidity.js.map +7 -0
- package/dist/frameworks/terraform.js +278 -0
- package/dist/frameworks/terraform.js.map +7 -0
- package/dist/frameworks/vue.js +163 -0
- package/dist/frameworks/vue.js.map +7 -0
- package/dist/graph/queries.js +1 -1
- package/dist/graph/queries.js.map +1 -1
- package/dist/mcp/tool-names.js +48 -0
- package/dist/mcp/tool-names.js.map +7 -0
- package/dist/mcp/tools.js +3 -0
- package/dist/mcp/tools.js.map +2 -2
- package/dist/types.js.map +2 -2
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/help.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { printBanner } from '../banner';\n\ntype CommandEntry = { name: string; args?: string; desc: string; opts?: string[] };\ntype Group = { title: string; commands: CommandEntry[] };\n\nexport function printColoredHelp(): void {\n const c = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n dim: '\\x1b[2m',\n violet: '\\x1b[38;5;99m',\n purple: '\\x1b[38;5;135m',\n lavender: '\\x1b[38;5;141m',\n paleLavender: '\\x1b[38;5;183m',\n gray: '\\x1b[90m',\n brown: '\\x1b[38;5;130m',\n };\n\n const groups: Group[] = [\n {\n title: '\uD83D\uDD27 Workspace Setup',\n commands: [\n { name: 'install', desc: 'Wire up MCP + hooks + steering for the current Kiro workspace' },\n { name: 'init', args: '[path]', desc: 'Initialize KiroGraph in a project', opts: ['-i, --index Index immediately after init'] },\n { name: 'uninit', args: '[path]', desc: 'Remove KiroGraph from a project', opts: ['--force Skip confirmation'] },\n { name: 'uninstall', args: '[path]', desc: 'Alias for uninit', opts: ['--force Skip confirmation'] },\n ],\n },\n {\n title: '\uD83D\uDCE6 Indexing',\n commands: [\n { name: 'index', args: '[path]', desc: 'Full re-index of a project', opts: ['--force Force re-index all files'] },\n { name: 'sync', args: '[path]', desc: 'Incremental sync of changed files', opts: ['--files <f> Specific files to sync'] },\n { name: 'sync-if-dirty', args: '[path]', desc: 'Sync only if a dirty marker is present', opts: ['-q, --quiet Suppress output'] },\n { name: 'mark-dirty', args: '[path]', desc: 'Write a dirty marker for deferred sync' },\n { name: 'unlock', args: '[path]', desc: 'Force-release a stale lock file' },\n ],\n },\n {\n title: '\uD83D\uDD0D Search & Exploration',\n commands: [\n { name: 'status', args: '[path]', desc: 'Show index statistics and health' },\n { name: 'query', args: '<search>', desc: 'Search for symbols by name', opts: ['--kind <k> Filter by kind', '--limit <n> Max results (default 10)'] },\n { name: 'context', args: '<task>', desc: 'Build relevant code context for a task', opts: ['--max-nodes <n> Max symbols (default 20)', '--no-code Exclude code snippets', '--format <fmt> markdown | json'] },\n { name: 'files', args: '[path]', desc: 'Show project file structure from the index', opts: ['--format <fmt> tree | flat | grouped', '--filter <path> Filter by directory prefix', '--pattern <glob> Filter by glob', '--max-depth <n> Limit tree depth', '--json Output as JSON'] },\n { name: 'path', args: '<from> <to>', desc: 'Find the shortest path between two symbols', opts: ['--format <fmt> table | json'] },\n { name: 'export build', args: '[path]', desc: 'Generate the interactive graph dashboard (.kirograph/export/)', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'export start', args: '[path]', desc: 'Generate and open the dashboard in the browser', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'affected', args: '[files...]', desc: 'Find test files affected by changed source files', opts: ['--stdin Read file list from stdin', '-d, --depth <n> Max traversal depth (default 5)', '-f, --filter <g> Custom test file glob', '-j, --json Output as JSON', '-q, --quiet File paths only'] },\n ],\n },\n {\n title: '\uD83D\uDCCA Graph Insights',\n commands: [\n { name: 'hotspots', args: '[path]', desc: 'Find most-connected symbols by edge degree', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'surprising', args: '[path]', desc: 'Find non-obvious cross-file connections', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'dead-code', args: '[path]', desc: 'Find unexported symbols with no incoming references', opts: ['--limit <n> Max results (default 50)', '--format <f> table | json'] },\n { name: 'snapshot', desc: 'Save or list graph snapshots for structural diffing', opts: ['save [label] Save current graph state', 'list List saved snapshots', 'diff [label] Diff current graph vs a snapshot --format summary|full|json'] },\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture Analysis',\n commands: [\n { name: 'architecture', args: '[path]', desc: 'Show package graph and layer map', opts: ['--packages Show packages only', '--layers Show layers only', '--format <f> json'] },\n { name: 'coupling', args: '[path]', desc: 'Show coupling metrics per package', opts: ['--sort <s> instability | ca | ce | name', '--package <n> Detail view for one package', '--format <f> json'] },\n { name: 'package', args: '<name>', desc: 'Inspect a package: deps, files, metrics', opts: ['--no-files Omit file list', '--format <f> json'] },\n ],\n },\n {\n title: '\u2699\uFE0F Agent & Configuration',\n commands: [\n { name: 'caveman', args: '[mode]', desc: 'Set agent communication style (off | lite | full | ultra)' },\n { name: 'serve', desc: 'Start the MCP server', opts: ['--mcp Run as MCP stdio server', '--path <p> Project path'] },\n { name: 'dashboard', desc: 'Manage the Qdrant or Typesense dashboard server', opts: ['start [path] Start server and open dashboard', 'stop [path] Stop the running server'] },\n ],\n },\n ];\n\n console.log(`\\n${c.bold}${c.paleLavender}USAGE${c.reset}`);\n console.log(` ${c.lavender}kirograph${c.reset} ${c.gray}<command>${c.reset} ${c.dim}[options]${c.reset}\\n`);\n\n // Compute max name+args width across ALL groups for alignment\n const allCmds = groups.flatMap(g => g.commands);\n const nameWidth = Math.max(...allCmds.map(cmd => (cmd.name + (cmd.args ? ' ' + cmd.args : '')).length)) + 2;\n\n for (const group of groups) {\n console.log(`${c.bold}${c.paleLavender}${group.title.toUpperCase()}${c.reset}\\n`);\n for (const cmd of group.commands) {\n const signature = cmd.name + (cmd.args ? ' ' + cmd.args : '');\n const isCaveman = cmd.name === 'caveman';\n const nameColor = isCaveman ? c.brown : c.lavender;\n const prefix = isCaveman ? '\uD83E\uDEA8 ' : ' ';\n const namePart = `${nameColor}${cmd.name}${c.reset}${cmd.args ? ' ' + c.dim + cmd.args + c.reset : ''}`;\n const pad = ' '.repeat(Math.max(0, nameWidth - signature.length));\n console.log(`${prefix}${namePart}${pad}${c.gray}${cmd.desc}${c.reset}`);\n if (isCaveman) {\n // desc starts at: emoji prefix (3 display cols: \uD83E\uDEA8 + space) + nameWidth\n const inspiredPad = ' '.repeat(3 + nameWidth);\n console.log(`${inspiredPad}${c.dim}Inspired by Caveman \u2014 original idea by github.com/JuliusBrussee/caveman${c.reset}`);\n console.log();\n }\n if (cmd.opts) {\n for (const opt of cmd.opts) {\n const [flag, ...rest] = opt.split(/ +/);\n const optPad = ' '.repeat(nameWidth + 2);\n console.log(` ${optPad}${c.purple}${flag}${c.reset}${rest.length ? ' ' + c.dim + rest.join(' ') + c.reset : ''}`);\n }\n console.log();\n }\n }\n if (!groups[groups.length - 1].commands.includes(group.commands[group.commands.length - 1])) {\n // extra spacing between groups handled by opts blank line; add one if no opts\n const lastHasOpts = group.commands[group.commands.length - 1].opts;\n if (!lastHasOpts) console.log();\n }\n }\n\n console.log(`${c.bold}${c.paleLavender}GLOBAL FLAGS${c.reset}\\n`);\n console.log(` ${c.purple}-h, --help${c.reset} ${c.gray}Show this help${c.reset}`);\n console.log(` ${c.purple}-V, --version${c.reset} ${c.gray}Show version number${c.reset}\\n`);\n\n console.log(`${c.bold}${c.paleLavender}EXAMPLES${c.reset}\\n`);\n\n const exampleGroups: Array<{ title: string; examples: [string, string][] }> = [\n {\n title: '\uD83D\uDD27 Setup & indexing',\n examples: [\n ['kirograph install', 'Wire up MCP + hooks + steering for the current workspace'],\n ['kirograph init --index', 'Init and immediately index the project'],\n ['kirograph sync', 'Incremental sync of changed files'],\n ],\n },\n {\n title: '\uD83D\uDD0D Search & exploration',\n examples: [\n ['kirograph query useState', 'Find all symbols named useState'],\n ['kirograph context \"add dark mode\"', 'Get relevant code context for a task'],\n ['kirograph files --format grouped', 'Show files grouped by directory'],\n ['kirograph path LoginController DatabasePool', 'Find how two symbols are connected'],\n ['kirograph affected src/auth.ts', 'Find tests affected by a change'],\n ['git diff --name-only | kirograph affected --stdin', 'Affected tests from a git diff'],\n ['kirograph export start', 'Open the interactive graph dashboard in the browser'],\n ['kirograph export build -o /tmp/graph', 'Export the dashboard to a custom directory'],\n ],\n },\n {\n title: '\uD83D\uDCCA Graph insights',\n examples: [\n ['kirograph hotspots --limit 10', 'Top 10 most-connected symbols'],\n ['kirograph surprising', 'Find unexpected cross-module connections'],\n ['kirograph dead-code', 'Find unreferenced unexported symbols'],\n ['kirograph snapshot save pre-refactor', 'Save a named snapshot before a refactor'],\n ['kirograph snapshot diff pre-refactor', 'Diff current graph vs the named snapshot'],\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture',\n examples: [\n ['kirograph architecture --packages', 'List all detected packages'],\n ['kirograph coupling --sort instability', 'Show packages ranked by instability'],\n ['kirograph package src/auth', 'Inspect the auth package'],\n ],\n },\n {\n title: '\u2699\uFE0F Agent',\n examples: [\n ['kirograph caveman full', 'Enable full caveman mode for the agent'],\n ['kirograph caveman off', 'Disable caveman mode'],\n ['kirograph serve --mcp', 'Start the MCP server'],\n ],\n },\n ];\n\n for (const eg of exampleGroups) {\n console.log(` ${c.dim}${eg.title}${c.reset}`);\n for (const [ex, desc] of eg.examples) {\n console.log(` ${c.violet}$${c.reset} ${c.lavender}${ex}${c.reset}`);\n console.log(` ${c.dim}${desc}${c.reset}`);\n }\n console.log();\n }\n}\n\nexport function register(program: Command): void {\n program.configureHelp({ formatHelp: () => '' });\n program.addHelpText('afterAll', '');\n program.helpInformation = () => {\n printBanner();\n printColoredHelp();\n return '';\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA4B;AAKrB,SAAS,mBAAyB;AACvC,QAAM,IAAI;AAAA,IACR,OAAc;AAAA,IACd,MAAc;AAAA,IACd,KAAc;AAAA,IACd,QAAc;AAAA,IACd,QAAc;AAAA,IACd,UAAc;AAAA,IACd,cAAc;AAAA,IACd,MAAc;AAAA,IACd,OAAc;AAAA,EAChB;AAEA,QAAM,SAAkB;AAAA,IACtB;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR,EAAE,MAAM,WAAiB,MAAM,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { printBanner } from '../banner';\n\ntype CommandEntry = { name: string; args?: string; desc: string; opts?: string[] };\ntype Group = { title: string; commands: CommandEntry[] };\n\nexport function printColoredHelp(): void {\n const c = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n dim: '\\x1b[2m',\n violet: '\\x1b[38;5;99m',\n purple: '\\x1b[38;5;135m',\n lavender: '\\x1b[38;5;141m',\n paleLavender: '\\x1b[38;5;183m',\n gray: '\\x1b[90m',\n brown: '\\x1b[38;5;130m',\n };\n\n const groups: Group[] = [\n {\n title: '\uD83D\uDD27 Workspace Setup',\n commands: [\n { name: 'install', desc: 'Wire up MCP/instructions for an agent workspace', opts: ['--target <t> kiro | claude | codex'] },\n { name: 'init', args: '[path]', desc: 'Initialize KiroGraph in a project', opts: ['-i, --index Index immediately after init'] },\n { name: 'uninit', args: '[path]', desc: 'Remove KiroGraph from a project', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n { name: 'uninstall', args: '[path]', desc: 'Alias for uninit', opts: ['--force Skip confirmation', '--target <t> kiro | claude | codex | all'] },\n ],\n },\n {\n title: '\uD83D\uDCE6 Indexing',\n commands: [\n { name: 'index', args: '[path]', desc: 'Full re-index of a project', opts: ['--force Force re-index all files'] },\n { name: 'sync', args: '[path]', desc: 'Incremental sync of changed files', opts: ['--files <f> Specific files to sync'] },\n { name: 'sync-if-dirty', args: '[path]', desc: 'Sync only if a dirty marker is present', opts: ['-q, --quiet Suppress output'] },\n { name: 'mark-dirty', args: '[path]', desc: 'Write a dirty marker for deferred sync' },\n { name: 'unlock', args: '[path]', desc: 'Force-release a stale lock file' },\n ],\n },\n {\n title: '\uD83D\uDD0D Search & Exploration',\n commands: [\n { name: 'status', args: '[path]', desc: 'Show index statistics and health' },\n { name: 'query', args: '<search>', desc: 'Search for symbols by name', opts: ['--kind <k> Filter by kind', '--limit <n> Max results (default 10)'] },\n { name: 'context', args: '<task>', desc: 'Build relevant code context for a task', opts: ['--max-nodes <n> Max symbols (default 20)', '--no-code Exclude code snippets', '--format <fmt> markdown | json'] },\n { name: 'files', args: '[path]', desc: 'Show project file structure from the index', opts: ['--format <fmt> tree | flat | grouped', '--filter <path> Filter by directory prefix', '--pattern <glob> Filter by glob', '--max-depth <n> Limit tree depth', '--json Output as JSON'] },\n { name: 'path', args: '<from> <to>', desc: 'Find the shortest path between two symbols', opts: ['--format <fmt> table | json'] },\n { name: 'export build', args: '[path]', desc: 'Generate the interactive graph dashboard (.kirograph/export/)', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'export start', args: '[path]', desc: 'Generate and open the dashboard in the browser', opts: ['-o, --output <dir> Custom output directory', '--include-contains Include structural contains edges'] },\n { name: 'affected', args: '[files...]', desc: 'Find test files affected by changed source files', opts: ['--stdin Read file list from stdin', '-d, --depth <n> Max traversal depth (default 5)', '-f, --filter <g> Custom test file glob', '-j, --json Output as JSON', '-q, --quiet File paths only'] },\n ],\n },\n {\n title: '\uD83D\uDCCA Graph Insights',\n commands: [\n { name: 'hotspots', args: '[path]', desc: 'Find most-connected symbols by edge degree', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'surprising', args: '[path]', desc: 'Find non-obvious cross-file connections', opts: ['--limit <n> Max results (default 20)', '--format <f> table | json'] },\n { name: 'dead-code', args: '[path]', desc: 'Find unexported symbols with no incoming references', opts: ['--limit <n> Max results (default 50)', '--format <f> table | json'] },\n { name: 'snapshot', desc: 'Save or list graph snapshots for structural diffing', opts: ['save [label] Save current graph state', 'list List saved snapshots', 'diff [label] Diff current graph vs a snapshot --format summary|full|json'] },\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture Analysis',\n commands: [\n { name: 'architecture', args: '[path]', desc: 'Show package graph and layer map', opts: ['--packages Show packages only', '--layers Show layers only', '--format <f> json'] },\n { name: 'coupling', args: '[path]', desc: 'Show coupling metrics per package', opts: ['--sort <s> instability | ca | ce | name', '--package <n> Detail view for one package', '--format <f> json'] },\n { name: 'package', args: '<name>', desc: 'Inspect a package: deps, files, metrics', opts: ['--no-files Omit file list', '--format <f> json'] },\n ],\n },\n {\n title: '\u2699\uFE0F Agent & Configuration',\n commands: [\n { name: 'caveman', args: '[mode]', desc: 'Set agent communication style (off | lite | full | ultra)' },\n { name: 'serve', desc: 'Start the MCP server', opts: ['--mcp Run as MCP stdio server', '--path <p> Project path'] },\n { name: 'dashboard', desc: 'Manage the Qdrant or Typesense dashboard server', opts: ['start [path] Start server and open dashboard', 'stop [path] Stop the running server'] },\n ],\n },\n ];\n\n console.log(`\\n${c.bold}${c.paleLavender}USAGE${c.reset}`);\n console.log(` ${c.lavender}kirograph${c.reset} ${c.gray}<command>${c.reset} ${c.dim}[options]${c.reset}\\n`);\n\n // Compute max name+args width across ALL groups for alignment\n const allCmds = groups.flatMap(g => g.commands);\n const nameWidth = Math.max(...allCmds.map(cmd => (cmd.name + (cmd.args ? ' ' + cmd.args : '')).length)) + 2;\n\n for (const group of groups) {\n console.log(`${c.bold}${c.paleLavender}${group.title.toUpperCase()}${c.reset}\\n`);\n for (const cmd of group.commands) {\n const signature = cmd.name + (cmd.args ? ' ' + cmd.args : '');\n const isCaveman = cmd.name === 'caveman';\n const nameColor = isCaveman ? c.brown : c.lavender;\n const prefix = isCaveman ? '\uD83E\uDEA8 ' : ' ';\n const namePart = `${nameColor}${cmd.name}${c.reset}${cmd.args ? ' ' + c.dim + cmd.args + c.reset : ''}`;\n const pad = ' '.repeat(Math.max(0, nameWidth - signature.length));\n console.log(`${prefix}${namePart}${pad}${c.gray}${cmd.desc}${c.reset}`);\n if (isCaveman) {\n // desc starts at: emoji prefix (3 display cols: \uD83E\uDEA8 + space) + nameWidth\n const inspiredPad = ' '.repeat(3 + nameWidth);\n console.log(`${inspiredPad}${c.dim}Inspired by Caveman \u2014 original idea by github.com/JuliusBrussee/caveman${c.reset}`);\n console.log();\n }\n if (cmd.opts) {\n for (const opt of cmd.opts) {\n const [flag, ...rest] = opt.split(/ +/);\n const optPad = ' '.repeat(nameWidth + 2);\n console.log(` ${optPad}${c.purple}${flag}${c.reset}${rest.length ? ' ' + c.dim + rest.join(' ') + c.reset : ''}`);\n }\n console.log();\n }\n }\n if (!groups[groups.length - 1].commands.includes(group.commands[group.commands.length - 1])) {\n // extra spacing between groups handled by opts blank line; add one if no opts\n const lastHasOpts = group.commands[group.commands.length - 1].opts;\n if (!lastHasOpts) console.log();\n }\n }\n\n console.log(`${c.bold}${c.paleLavender}GLOBAL FLAGS${c.reset}\\n`);\n console.log(` ${c.purple}-h, --help${c.reset} ${c.gray}Show this help${c.reset}`);\n console.log(` ${c.purple}-V, --version${c.reset} ${c.gray}Show version number${c.reset}\\n`);\n\n console.log(`${c.bold}${c.paleLavender}EXAMPLES${c.reset}\\n`);\n\n const exampleGroups: Array<{ title: string; examples: [string, string][] }> = [\n {\n title: '\uD83D\uDD27 Setup & indexing',\n examples: [\n ['kirograph install', 'Wire up Kiro MCP + hooks + steering for the current workspace'],\n ['kirograph install --target claude', 'Wire up Claude Code MCP + project memory'],\n ['kirograph install --target codex', 'Install Codex project instructions and print MCP config'],\n ['kirograph init --index', 'Init and immediately index the project'],\n ['kirograph sync', 'Incremental sync of changed files'],\n ],\n },\n {\n title: '\uD83D\uDD0D Search & exploration',\n examples: [\n ['kirograph query useState', 'Find all symbols named useState'],\n ['kirograph context \"add dark mode\"', 'Get relevant code context for a task'],\n ['kirograph files --format grouped', 'Show files grouped by directory'],\n ['kirograph path LoginController DatabasePool', 'Find how two symbols are connected'],\n ['kirograph affected src/auth.ts', 'Find tests affected by a change'],\n ['git diff --name-only | kirograph affected --stdin', 'Affected tests from a git diff'],\n ['kirograph export start', 'Open the interactive graph dashboard in the browser'],\n ['kirograph export build -o /tmp/graph', 'Export the dashboard to a custom directory'],\n ],\n },\n {\n title: '\uD83D\uDCCA Graph insights',\n examples: [\n ['kirograph hotspots --limit 10', 'Top 10 most-connected symbols'],\n ['kirograph surprising', 'Find unexpected cross-module connections'],\n ['kirograph dead-code', 'Find unreferenced unexported symbols'],\n ['kirograph snapshot save pre-refactor', 'Save a named snapshot before a refactor'],\n ['kirograph snapshot diff pre-refactor', 'Diff current graph vs the named snapshot'],\n ],\n },\n {\n title: '\uD83C\uDFDB\uFE0F Architecture',\n examples: [\n ['kirograph architecture --packages', 'List all detected packages'],\n ['kirograph coupling --sort instability', 'Show packages ranked by instability'],\n ['kirograph package src/auth', 'Inspect the auth package'],\n ],\n },\n {\n title: '\u2699\uFE0F Agent',\n examples: [\n ['kirograph caveman full', 'Enable full caveman mode for the agent'],\n ['kirograph caveman off', 'Disable caveman mode'],\n ['kirograph serve --mcp', 'Start the MCP server'],\n ],\n },\n ];\n\n for (const eg of exampleGroups) {\n console.log(` ${c.dim}${eg.title}${c.reset}`);\n for (const [ex, desc] of eg.examples) {\n console.log(` ${c.violet}$${c.reset} ${c.lavender}${ex}${c.reset}`);\n console.log(` ${c.dim}${desc}${c.reset}`);\n }\n console.log();\n }\n}\n\nexport function register(program: Command): void {\n program.configureHelp({ formatHelp: () => '' });\n program.addHelpText('afterAll', '');\n program.helpInformation = () => {\n printBanner();\n printColoredHelp();\n return '';\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA4B;AAKrB,SAAS,mBAAyB;AACvC,QAAM,IAAI;AAAA,IACR,OAAc;AAAA,IACd,MAAc;AAAA,IACd,KAAc;AAAA,IACd,QAAc;AAAA,IACd,QAAc;AAAA,IACd,UAAc;AAAA,IACd,cAAc;AAAA,IACd,MAAc;AAAA,IACd,OAAc;AAAA,EAChB;AAEA,QAAM,SAAkB;AAAA,IACtB;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR,EAAE,MAAM,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AC9B,YAAQ,IAAI,KAAK,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC7C,eAAW,CAAC,IAAI,IAAI,KAAK,GAAG,UAAU;AACpC,cAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,KAAK,IAAI,EAAE,QAAQ,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACnE,cAAQ,IAAI,OAAO,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,KAAK,EAAE;AAAA,IAC7C;AACA,YAAQ,IAAI;AAAA,EACd;AACF;AAEO,SAAS,SAAS,SAAwB;AAC/C,UAAQ,cAAc,EAAE,YAAY,MAAM,GAAG,CAAC;AAC9C,UAAQ,YAAY,YAAY,EAAE;AAClC,UAAQ,kBAAkB,MAAM;AAC9B,mCAAY;AACZ,qBAAiB;AACjB,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,10 +21,16 @@ __export(install_exports, {
|
|
|
21
21
|
register: () => register
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(install_exports);
|
|
24
|
+
const INSTALL_TARGETS = ["kiro", "claude", "codex"];
|
|
24
25
|
function register(program) {
|
|
25
|
-
program.command("install").description("Configure KiroGraph for
|
|
26
|
+
program.command("install").description("Configure KiroGraph for an agent workspace").option("--target <target>", "Integration target: kiro, claude, or codex", "kiro").action(async (opts) => {
|
|
27
|
+
const target = opts.target.toLowerCase();
|
|
28
|
+
if (!INSTALL_TARGETS.includes(target)) {
|
|
29
|
+
console.error(`Unknown install target: ${opts.target}. Choose from: kiro, claude, codex`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
26
32
|
const { runInstaller } = await Promise.resolve().then(() => require("../installer/index.js"));
|
|
27
|
-
await runInstaller();
|
|
33
|
+
await runInstaller(target);
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
36
|
// 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/commands/install.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\n\nexport function register(program: Command): void {\n program\n .command('install')\n .description('Configure KiroGraph for
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\n\nconst INSTALL_TARGETS = ['kiro', 'claude', 'codex'];\n\nexport function register(program: Command): void {\n program\n .command('install')\n .description('Configure KiroGraph for an agent workspace')\n .option('--target <target>', 'Integration target: kiro, claude, or codex', 'kiro')\n .action(async (opts: { target: string }) => {\n const target = opts.target.toLowerCase();\n if (!INSTALL_TARGETS.includes(target)) {\n console.error(`Unknown install target: ${opts.target}. Choose from: kiro, claude, codex`);\n process.exit(1);\n }\n const { runInstaller } = await Promise.resolve().then(() => require('../installer/index.js'));\n await runInstaller(target as 'kiro' | 'claude' | 'codex');\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,kBAAkB,CAAC,QAAQ,UAAU,OAAO;AAE3C,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,SAAS,EACjB,YAAY,4CAA4C,EACxD,OAAO,qBAAqB,8CAA8C,MAAM,EAChF,OAAO,OAAO,SAA6B;AAC1C,UAAM,SAAS,KAAK,OAAO,YAAY;AACvC,QAAI,CAAC,gBAAgB,SAAS,MAAM,GAAG;AACrC,cAAQ,MAAM,2BAA2B,KAAK,MAAM,oCAAoC;AACxF,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,UAAM,EAAE,aAAa,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,uBAAuB,CAAC;AAC5F,UAAM,aAAa,MAAqC;AAAA,EAC1D,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,11 +37,11 @@ function register(program) {
|
|
|
37
37
|
program.command("serve").description("Start the MCP server").option("--mcp", "Run as MCP stdio server").option("--path <path>", "Project path").action(async (opts) => {
|
|
38
38
|
if (!opts.mcp) {
|
|
39
39
|
console.log(`
|
|
40
|
-
${import_ui.dim}Start the KiroGraph MCP server
|
|
40
|
+
${import_ui.dim}Start the KiroGraph MCP server.${import_ui.reset}`);
|
|
41
41
|
console.log(`
|
|
42
42
|
${import_ui.dim}Usage:${import_ui.reset} ${import_ui.violet}${import_ui.bold}kirograph serve --mcp${import_ui.reset}`);
|
|
43
43
|
console.log(`
|
|
44
|
-
${import_ui.dim}Add to
|
|
44
|
+
${import_ui.dim}Add to your MCP client config:${import_ui.reset}
|
|
45
45
|
`);
|
|
46
46
|
console.log(` ${import_ui.dim}${JSON.stringify({ mcpServers: { kirograph: { command: "kirograph", args: ["serve", "--mcp"] } } }, null, 2).split("\n").join("\n ")}${import_ui.reset}
|
|
47
47
|
`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/serve.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { dim, reset, violet, bold } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('serve')\n .description('Start the MCP server')\n .option('--mcp', 'Run as MCP stdio server')\n .option('--path <path>', 'Project path')\n .action(async (opts: { mcp?: boolean; path?: string }) => {\n if (!opts.mcp) {\n console.log(`\\n ${dim}Start the KiroGraph MCP server
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,gBAAyC;AAElC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,OAAO,EACf,YAAY,sBAAsB,EAClC,OAAO,SAAS,yBAAyB,EACzC,OAAO,iBAAiB,cAAc,EACtC,OAAO,OAAO,SAA2C;AACxD,QAAI,CAAC,KAAK,KAAK;AACb,cAAQ,IAAI;AAAA,IAAO,aAAG,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { dim, reset, violet, bold } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('serve')\n .description('Start the MCP server')\n .option('--mcp', 'Run as MCP stdio server')\n .option('--path <path>', 'Project path')\n .action(async (opts: { mcp?: boolean; path?: string }) => {\n if (!opts.mcp) {\n console.log(`\\n ${dim}Start the KiroGraph MCP server.${reset}`);\n console.log(`\\n ${dim}Usage:${reset} ${violet}${bold}kirograph serve --mcp${reset}`);\n console.log(`\\n ${dim}Add to your MCP client config:${reset}\\n`);\n console.log(` ${dim}${JSON.stringify({ mcpServers: { kirograph: { command: 'kirograph', args: ['serve', '--mcp'] } } }, null, 2).split('\\n').join('\\n ')}${reset}\\n`);\n return;\n }\n const { MCPServer } = await Promise.resolve().then(() => require('../../mcp/server.js'));\n const server = new MCPServer(opts.path ? path.resolve(opts.path) : process.cwd());\n await server.start();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,gBAAyC;AAElC,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,OAAO,EACf,YAAY,sBAAsB,EAClC,OAAO,SAAS,yBAAyB,EACzC,OAAO,iBAAiB,cAAc,EACtC,OAAO,OAAO,SAA2C;AACxD,QAAI,CAAC,KAAK,KAAK;AACb,cAAQ,IAAI;AAAA,IAAO,aAAG,kCAAkC,eAAK,EAAE;AAC/D,cAAQ,IAAI;AAAA,IAAO,aAAG,SAAS,eAAK,KAAK,gBAAM,GAAG,cAAI,wBAAwB,eAAK,EAAE;AACrF,cAAQ,IAAI;AAAA,IAAO,aAAG,iCAAiC,eAAK;AAAA,CAAI;AAChE,cAAQ,IAAI,KAAK,aAAG,GAAG,KAAK,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,aAAa,MAAM,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,EAAE,MAAM,IAAI,EAAE,KAAK,MAAM,CAAC,GAAG,eAAK;AAAA,CAAI;AACtK;AAAA,IACF;AACA,UAAM,EAAE,UAAU,IAAI,MAAM,QAAQ,QAAQ,EAAE,KAAK,MAAM,QAAQ,qBAAqB,CAAC;AACvF,UAAM,SAAS,IAAI,UAAU,KAAK,OAAO,KAAK,QAAQ,KAAK,IAAI,IAAI,QAAQ,IAAI,CAAC;AAChF,UAAM,OAAO,MAAM;AAAA,EACrB,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -48,72 +48,96 @@ const UNINIT_FAREWELLS = [
|
|
|
48
48
|
"574 embeddings. Gone. Just like that.",
|
|
49
49
|
"See you on the other side of `kirograph install`."
|
|
50
50
|
];
|
|
51
|
+
const UNINIT_TARGETS = ["kiro", "claude", "codex", "all"];
|
|
52
|
+
async function confirm(question) {
|
|
53
|
+
const readline = await import("readline");
|
|
54
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
55
|
+
return new Promise((resolve) => rl.question(question, (ans) => {
|
|
56
|
+
rl.close();
|
|
57
|
+
resolve(ans.toLowerCase() === "y");
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
51
60
|
async function runUninit(projectPath, opts) {
|
|
52
61
|
const target = path.resolve(projectPath ?? process.cwd());
|
|
62
|
+
const integration = (opts.target ?? "kiro").toLowerCase();
|
|
63
|
+
if (!UNINIT_TARGETS.includes(integration)) {
|
|
64
|
+
console.error(`Unknown uninit target: ${opts.target}. Choose from: kiro, claude, codex, all`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
53
67
|
const dir = path.join(target, ".kirograph");
|
|
54
68
|
if (!fs.existsSync(dir)) {
|
|
55
69
|
console.log("Not initialized.");
|
|
56
70
|
return;
|
|
57
71
|
}
|
|
72
|
+
let removeIntegration = true;
|
|
73
|
+
let removeGraph = opts.force === true;
|
|
58
74
|
if (!opts.force) {
|
|
59
75
|
(0, import_banner.printBanner)();
|
|
60
76
|
const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)];
|
|
61
77
|
console.log(` ${import_ui.violet}${import_ui.bold}${farewell}${import_ui.reset}`);
|
|
62
78
|
console.log(`
|
|
63
|
-
${import_ui.dim}This
|
|
79
|
+
${import_ui.dim}This can remove ${integration} integration files and, separately, the shared .kirograph/ data.${import_ui.reset}`);
|
|
64
80
|
console.log(` ${import_ui.dim}Your source code is untouched.${import_ui.reset}
|
|
65
81
|
`);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.log(`
|
|
72
|
-
${import_ui.dim}Cancelled. The graph lives on.${import_ui.reset}
|
|
82
|
+
removeIntegration = await confirm(` ${import_ui.violet}Remove ${integration} integration files?${import_ui.reset} ${import_ui.dim}(y/N)${import_ui.reset} `);
|
|
83
|
+
removeGraph = await confirm(` ${import_ui.violet}Remove shared .kirograph/ data too?${import_ui.reset} ${import_ui.dim}(y/N)${import_ui.reset} `);
|
|
84
|
+
if (!removeIntegration && !removeGraph) {
|
|
85
|
+
console.log(`
|
|
86
|
+
${import_ui.dim}Cancelled. Nothing removed.${import_ui.reset}
|
|
73
87
|
`);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
resolve();
|
|
77
|
-
}));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
78
90
|
console.log();
|
|
79
91
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
if (removeGraph) {
|
|
93
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
94
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kirograph/`);
|
|
95
|
+
}
|
|
96
|
+
if (removeIntegration && (integration === "kiro" || integration === "all")) {
|
|
97
|
+
const kiroHooks = [
|
|
98
|
+
"kirograph-mark-dirty-on-save.json",
|
|
99
|
+
"kirograph-mark-dirty-on-create.json",
|
|
100
|
+
"kirograph-sync-on-delete.json",
|
|
101
|
+
"kirograph-sync-if-dirty.json",
|
|
102
|
+
"kirograph-sync-on-save.json",
|
|
103
|
+
"kirograph-sync-on-create.json"
|
|
104
|
+
];
|
|
105
|
+
const hooksDir = path.join(target, ".kiro", "hooks");
|
|
106
|
+
let removedHooks = 0;
|
|
107
|
+
for (const hook of kiroHooks) {
|
|
108
|
+
const p = path.join(hooksDir, hook);
|
|
109
|
+
if (fs.existsSync(p)) {
|
|
110
|
+
fs.unlinkSync(p);
|
|
111
|
+
removedHooks++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (removedHooks > 0) console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);
|
|
115
|
+
const steeringPath = path.join(target, ".kiro", "steering", "kirograph.md");
|
|
116
|
+
if (fs.existsSync(steeringPath)) {
|
|
117
|
+
fs.unlinkSync(steeringPath);
|
|
118
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/steering/kirograph.md`);
|
|
119
|
+
}
|
|
120
|
+
const agentPath = path.join(target, ".kiro", "agents", "kirograph.json");
|
|
121
|
+
if (fs.existsSync(agentPath)) {
|
|
122
|
+
fs.unlinkSync(agentPath);
|
|
123
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/agents/kirograph.json`);
|
|
97
124
|
}
|
|
98
125
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
fs.unlinkSync(steeringPath);
|
|
103
|
-
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/steering/kirograph.md`);
|
|
126
|
+
if (removeIntegration && (integration === "claude" || integration === "all")) {
|
|
127
|
+
const { uninitClaude } = await Promise.resolve().then(() => require("../installer/targets/claude.js"));
|
|
128
|
+
uninitClaude(target);
|
|
104
129
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/agents/kirograph.json`);
|
|
130
|
+
if (removeIntegration && (integration === "codex" || integration === "all")) {
|
|
131
|
+
const { uninitCodex } = await Promise.resolve().then(() => require("../installer/targets/codex.js"));
|
|
132
|
+
uninitCodex(target);
|
|
109
133
|
}
|
|
110
134
|
console.log(`
|
|
111
|
-
${import_ui.dim}Done. Run ${import_ui.violet}kirograph install${import_ui.reset}${import_ui.dim} to come back anytime.${import_ui.reset}
|
|
135
|
+
${import_ui.dim}Done. Run ${import_ui.violet}kirograph install --target ${integration === "all" ? "kiro" : integration}${import_ui.reset}${import_ui.dim} to come back anytime.${import_ui.reset}
|
|
112
136
|
`);
|
|
113
137
|
}
|
|
114
138
|
function register(program) {
|
|
115
|
-
program.command("uninit [projectPath]").description("Remove KiroGraph from a project").option("--force", "Skip confirmation").action(runUninit);
|
|
116
|
-
program.command("uninstall [projectPath]").description("Alias for uninit \u2014 remove KiroGraph from a project").option("--force", "Skip confirmation").action(runUninit);
|
|
139
|
+
program.command("uninit [projectPath]").description("Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", "Integration target to clean up: kiro, claude, codex, or all", "kiro").action(runUninit);
|
|
140
|
+
program.command("uninstall [projectPath]").description("Alias for uninit \u2014 remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", "Integration target to clean up: kiro, claude, codex, or all", "kiro").action(runUninit);
|
|
117
141
|
}
|
|
118
142
|
// Annotate the CommonJS export names for ESM import in node:
|
|
119
143
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/uninit.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\nasync function runUninit(projectPath: string | undefined, opts: { force?: boolean }): Promise<void> {\n const target = path.resolve(projectPath ?? process.cwd());\n const dir = path.join(target, '.kirograph');\n if (!fs.existsSync(dir)) { console.log('Not initialized.'); return; }\n if (!opts.force) {\n printBanner();\n const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)]!;\n console.log(` ${violet}${bold}${farewell}${reset}`);\n console.log(`\\n ${dim}This
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,oBAA4B;AAC5B,gBAAgD;AAEzC,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,eAAe,UAAU,aAAiC,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\ntype UninitTarget = 'kiro' | 'claude' | 'codex' | 'all';\n\nconst UNINIT_TARGETS: UninitTarget[] = ['kiro', 'claude', 'codex', 'all'];\n\nasync function confirm(question: string): Promise<boolean> {\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n return new Promise<boolean>(resolve => rl.question(question, ans => {\n rl.close();\n resolve(ans.toLowerCase() === 'y');\n }));\n}\n\nasync function runUninit(projectPath: string | undefined, opts: { force?: boolean; target?: string }): Promise<void> {\n const target = path.resolve(projectPath ?? process.cwd());\n const integration = (opts.target ?? 'kiro').toLowerCase() as UninitTarget;\n if (!UNINIT_TARGETS.includes(integration)) {\n console.error(`Unknown uninit target: ${opts.target}. Choose from: kiro, claude, codex, all`);\n process.exit(1);\n }\n const dir = path.join(target, '.kirograph');\n if (!fs.existsSync(dir)) { console.log('Not initialized.'); return; }\n\n let removeIntegration = true;\n let removeGraph = opts.force === true;\n\n if (!opts.force) {\n printBanner();\n const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)]!;\n console.log(` ${violet}${bold}${farewell}${reset}`);\n console.log(`\\n ${dim}This can remove ${integration} integration files and, separately, the shared .kirograph/ data.${reset}`);\n console.log(` ${dim}Your source code is untouched.${reset}\\n`);\n\n removeIntegration = await confirm(` ${violet}Remove ${integration} integration files?${reset} ${dim}(y/N)${reset} `);\n removeGraph = await confirm(` ${violet}Remove shared .kirograph/ data too?${reset} ${dim}(y/N)${reset} `);\n\n if (!removeIntegration && !removeGraph) {\n console.log(`\\n ${dim}Cancelled. Nothing removed.${reset}\\n`);\n return;\n }\n console.log();\n }\n\n if (removeGraph) {\n fs.rmSync(dir, { recursive: true, force: true });\n console.log(` ${green}\u2713${reset} Removed .kirograph/`);\n }\n\n if (removeIntegration && (integration === 'kiro' || integration === 'all')) {\n // Remove .kiro hooks created by kirograph\n const kiroHooks = [\n 'kirograph-mark-dirty-on-save.json',\n 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-sync-if-dirty.json',\n 'kirograph-sync-on-save.json',\n 'kirograph-sync-on-create.json',\n ];\n const hooksDir = path.join(target, '.kiro', 'hooks');\n let removedHooks = 0;\n for (const hook of kiroHooks) {\n const p = path.join(hooksDir, hook);\n if (fs.existsSync(p)) { fs.unlinkSync(p); removedHooks++; }\n }\n if (removedHooks > 0) console.log(` ${green}\u2713${reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);\n\n // Remove .kiro/steering/kirograph.md\n const steeringPath = path.join(target, '.kiro', 'steering', 'kirograph.md');\n if (fs.existsSync(steeringPath)) {\n fs.unlinkSync(steeringPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/steering/kirograph.md`);\n }\n\n // Remove .kiro/agents/kirograph.json\n const agentPath = path.join(target, '.kiro', 'agents', 'kirograph.json');\n if (fs.existsSync(agentPath)) {\n fs.unlinkSync(agentPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/agents/kirograph.json`);\n }\n }\n\n if (removeIntegration && (integration === 'claude' || integration === 'all')) {\n const { uninitClaude } = await Promise.resolve().then(() => require('../installer/targets/claude.js'));\n uninitClaude(target);\n }\n\n if (removeIntegration && (integration === 'codex' || integration === 'all')) {\n const { uninitCodex } = await Promise.resolve().then(() => require('../installer/targets/codex.js'));\n uninitCodex(target);\n }\n\n console.log(`\\n ${dim}Done. Run ${violet}kirograph install --target ${integration === 'all' ? 'kiro' : integration}${reset}${dim} to come back anytime.${reset}\\n`);\n}\n\nexport function register(program: Command): void {\n program\n .command('uninit [projectPath]')\n .description('Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', 'Integration target to clean up: kiro, claude, codex, or all', 'kiro')\n .action(runUninit);\n\n program\n .command('uninstall [projectPath]')\n .description('Alias for uninit \u2014 remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', 'Integration target to clean up: kiro, claude, codex, or all', 'kiro')\n .action(runUninit);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,oBAA4B;AAC5B,gBAAgD;AAEzC,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,MAAM,iBAAiC,CAAC,QAAQ,UAAU,SAAS,KAAK;AAExE,eAAe,QAAQ,UAAoC;AACzD,QAAM,WAAW,MAAM,OAAO,UAAU;AACxC,QAAM,KAAK,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO,CAAC;AACpF,SAAO,IAAI,QAAiB,aAAW,GAAG,SAAS,UAAU,SAAO;AAClE,OAAG,MAAM;AACT,YAAQ,IAAI,YAAY,MAAM,GAAG;AAAA,EACnC,CAAC,CAAC;AACJ;AAEA,eAAe,UAAU,aAAiC,MAA2D;AACnH,QAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,QAAM,eAAe,KAAK,UAAU,QAAQ,YAAY;AACxD,MAAI,CAAC,eAAe,SAAS,WAAW,GAAG;AACzC,YAAQ,MAAM,0BAA0B,KAAK,MAAM,yCAAyC;AAC5F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,QAAM,MAAM,KAAK,KAAK,QAAQ,YAAY;AAC1C,MAAI,CAAC,GAAG,WAAW,GAAG,GAAG;AAAE,YAAQ,IAAI,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,MAAM,EACjG,OAAO,SAAS;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,39 +33,19 @@ __export(cli_agent_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(cli_agent_exports);
|
|
34
34
|
var fs = __toESM(require("fs"));
|
|
35
35
|
var path = __toESM(require("path"));
|
|
36
|
-
|
|
37
|
-
"@kirograph/kirograph_search",
|
|
38
|
-
"@kirograph/kirograph_context",
|
|
39
|
-
"@kirograph/kirograph_callers",
|
|
40
|
-
"@kirograph/kirograph_callees",
|
|
41
|
-
"@kirograph/kirograph_impact",
|
|
42
|
-
"@kirograph/kirograph_node",
|
|
43
|
-
"@kirograph/kirograph_status",
|
|
44
|
-
"@kirograph/kirograph_files",
|
|
45
|
-
"@kirograph/kirograph_dead_code",
|
|
46
|
-
"@kirograph/kirograph_circular_deps",
|
|
47
|
-
"@kirograph/kirograph_path",
|
|
48
|
-
"@kirograph/kirograph_type_hierarchy",
|
|
49
|
-
"@kirograph/kirograph_architecture",
|
|
50
|
-
"@kirograph/kirograph_package",
|
|
51
|
-
"@kirograph/kirograph_coupling",
|
|
52
|
-
"@kirograph/kirograph_hotspots",
|
|
53
|
-
"@kirograph/kirograph_surprising",
|
|
54
|
-
"@kirograph/kirograph_diff"
|
|
55
|
-
];
|
|
56
|
-
const SYNC_CMD = "kirograph sync-if-dirty --quiet 2>/dev/null || true";
|
|
36
|
+
var import_common = require("./common");
|
|
57
37
|
function buildAgentConfig() {
|
|
58
38
|
return {
|
|
59
39
|
name: "kirograph",
|
|
60
40
|
description: "KiroGraph-aware agent \u2014 uses the semantic code graph for faster, smarter exploration.",
|
|
61
41
|
resources: ["file://.kiro/steering/kirograph.md"],
|
|
62
42
|
tools: ["@builtin", "@kirograph"],
|
|
63
|
-
allowedTools:
|
|
43
|
+
allowedTools: import_common.KIROGRAPH_SCOPED_TOOLS,
|
|
64
44
|
useLegacyMcpJson: true,
|
|
65
45
|
hooks: {
|
|
66
|
-
agentSpawn: [{ command:
|
|
67
|
-
userPromptSubmit: [{ command:
|
|
68
|
-
stop: [{ command:
|
|
46
|
+
agentSpawn: [{ command: import_common.KIROGRAPH_SYNC_CMD }],
|
|
47
|
+
userPromptSubmit: [{ command: import_common.KIROGRAPH_SYNC_CMD }],
|
|
48
|
+
stop: [{ command: import_common.KIROGRAPH_SYNC_CMD }]
|
|
69
49
|
}
|
|
70
50
|
};
|
|
71
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/cli-agent.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro CLI agent config\n *\n * Writes .kiro/agents/kirograph.json \u2014 a workspace custom agent that wires up:\n * - MCP server (kirograph tools)\n * - steering file as resource (single source of truth for instructions + caveman rules)\n * - hooks: sync on agentSpawn, userPromptSubmit, stop\n *\n * Sync strategy (CLI has no file-watch events unlike the IDE):\n * - agentSpawn: sync-if-dirty \u2014 catches edits made between sessions\n * - userPromptSubmit: sync-if-dirty \u2014 keeps graph fresh within a session\n * - stop: sync-if-dirty --quiet \u2014 deferred flush, mirrors IDE agentStop\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,SAAoB;AACpB,WAAsB;
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro CLI agent config\n *\n * Writes .kiro/agents/kirograph.json \u2014 a workspace custom agent that wires up:\n * - MCP server (kirograph tools)\n * - steering file as resource (single source of truth for instructions + caveman rules)\n * - hooks: sync on agentSpawn, userPromptSubmit, stop\n *\n * Sync strategy (CLI has no file-watch events unlike the IDE):\n * - agentSpawn: sync-if-dirty \u2014 catches edits made between sessions\n * - userPromptSubmit: sync-if-dirty \u2014 keeps graph fresh within a session\n * - stop: sync-if-dirty --quiet \u2014 deferred flush, mirrors IDE agentStop\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_SCOPED_TOOLS, KIROGRAPH_SYNC_CMD } from './common';\n\nfunction buildAgentConfig() {\n return {\n name: 'kirograph',\n description: 'KiroGraph-aware agent \u2014 uses the semantic code graph for faster, smarter exploration.',\n resources: ['file://.kiro/steering/kirograph.md'],\n tools: ['@builtin', '@kirograph'],\n allowedTools: KIROGRAPH_SCOPED_TOOLS,\n useLegacyMcpJson: true,\n hooks: {\n agentSpawn: [{ command: KIROGRAPH_SYNC_CMD }],\n userPromptSubmit: [{ command: KIROGRAPH_SYNC_CMD }],\n stop: [{ command: KIROGRAPH_SYNC_CMD }],\n },\n };\n}\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\nexport function writeCliAgent(kiroDir: string): void {\n const agentsDir = path.join(kiroDir, 'agents');\n ensureDir(agentsDir);\n const agentPath = path.join(agentsDir, 'kirograph.json');\n writeJson(agentPath, buildAgentConfig());\n console.log(` \u2713 CLI agent config written to ${agentPath}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,SAAoB;AACpB,WAAsB;AACtB,oBAA2D;AAE3D,SAAS,mBAAmB;AAC1B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW,CAAC,oCAAoC;AAAA,IAChD,OAAO,CAAC,YAAY,YAAY;AAAA,IAChC,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,OAAO;AAAA,MACL,YAAY,CAAC,EAAE,SAAS,iCAAmB,CAAC;AAAA,MAC5C,kBAAkB,CAAC,EAAE,SAAS,iCAAmB,CAAC;AAAA,MAClD,MAAM,CAAC,EAAE,SAAS,iCAAmB,CAAC;AAAA,IACxC;AAAA,EACF;AACF;AAEA,SAAS,UAAU,GAAiB;AAClC,KAAG,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AACrC;AAEA,SAAS,UAAU,GAAW,MAAqB;AACjD,KAAG,cAAc,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,IAAI;AAC1D;AAEO,SAAS,cAAc,SAAuB;AACnD,QAAM,YAAY,KAAK,KAAK,SAAS,QAAQ;AAC7C,YAAU,SAAS;AACnB,QAAM,YAAY,KAAK,KAAK,WAAW,gBAAgB;AACvD,YAAU,WAAW,iBAAiB,CAAC;AACvC,UAAQ,IAAI,wCAAmC,SAAS,EAAE;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var common_exports = {};
|
|
30
|
+
__export(common_exports, {
|
|
31
|
+
KIROGRAPH_COMMAND: () => KIROGRAPH_COMMAND,
|
|
32
|
+
KIROGRAPH_MCP_ARGS: () => KIROGRAPH_MCP_ARGS,
|
|
33
|
+
KIROGRAPH_SCOPED_TOOLS: () => KIROGRAPH_SCOPED_TOOLS,
|
|
34
|
+
KIROGRAPH_SERVER_NAME: () => KIROGRAPH_SERVER_NAME,
|
|
35
|
+
KIROGRAPH_SYNC_CMD: () => KIROGRAPH_SYNC_CMD,
|
|
36
|
+
KIROGRAPH_TOOLS: () => KIROGRAPH_TOOLS,
|
|
37
|
+
appendImportLine: () => appendImportLine,
|
|
38
|
+
ensureDir: () => ensureDir,
|
|
39
|
+
readJson: () => readJson,
|
|
40
|
+
removeGeneratedBlock: () => removeGeneratedBlock,
|
|
41
|
+
removeImportLine: () => removeImportLine,
|
|
42
|
+
removeMcpServersConfig: () => removeMcpServersConfig,
|
|
43
|
+
upsertGeneratedBlock: () => upsertGeneratedBlock,
|
|
44
|
+
writeJson: () => writeJson,
|
|
45
|
+
writeMcpServersConfig: () => writeMcpServersConfig
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(common_exports);
|
|
48
|
+
var fs = __toESM(require("fs"));
|
|
49
|
+
var path = __toESM(require("path"));
|
|
50
|
+
var import_tool_names = require("../../mcp/tool-names");
|
|
51
|
+
const KIROGRAPH_SERVER_NAME = "kirograph";
|
|
52
|
+
const KIROGRAPH_COMMAND = "kirograph";
|
|
53
|
+
const KIROGRAPH_MCP_ARGS = ["serve", "--mcp"];
|
|
54
|
+
const KIROGRAPH_SYNC_CMD = "kirograph sync-if-dirty --quiet 2>/dev/null || true";
|
|
55
|
+
const KIROGRAPH_TOOLS = import_tool_names.KIROGRAPH_TOOL_NAMES;
|
|
56
|
+
const KIROGRAPH_SCOPED_TOOLS = import_tool_names.KIROGRAPH_TOOL_NAMES.map((name) => `@kirograph/${name}`);
|
|
57
|
+
function ensureDir(p) {
|
|
58
|
+
fs.mkdirSync(p, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
function readJson(p) {
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(fs.readFileSync(p, "utf8"));
|
|
63
|
+
} catch {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function writeJson(p, data) {
|
|
68
|
+
fs.writeFileSync(p, JSON.stringify(data, null, 2) + "\n");
|
|
69
|
+
}
|
|
70
|
+
function writeMcpServersConfig(configPath, serverConfig) {
|
|
71
|
+
ensureDir(path.dirname(configPath));
|
|
72
|
+
const existing = readJson(configPath);
|
|
73
|
+
existing.mcpServers = existing.mcpServers ?? {};
|
|
74
|
+
existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;
|
|
75
|
+
writeJson(configPath, existing);
|
|
76
|
+
}
|
|
77
|
+
function removeMcpServersConfig(configPath) {
|
|
78
|
+
if (!fs.existsSync(configPath)) return false;
|
|
79
|
+
const existing = readJson(configPath);
|
|
80
|
+
if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;
|
|
81
|
+
delete existing.mcpServers[KIROGRAPH_SERVER_NAME];
|
|
82
|
+
writeJson(configPath, existing);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
function appendImportLine(filePath, line, heading) {
|
|
86
|
+
const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : "";
|
|
87
|
+
if (existing.includes(line)) return false;
|
|
88
|
+
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
89
|
+
const separator = existing.trim().length > 0 ? "\n" : "";
|
|
90
|
+
fs.writeFileSync(filePath, existing + prefix + separator + heading + "\n" + line + "\n");
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function removeImportLine(filePath, line) {
|
|
94
|
+
if (!fs.existsSync(filePath)) return false;
|
|
95
|
+
const original = fs.readFileSync(filePath, "utf8");
|
|
96
|
+
const next = original.split("\n").filter((l) => l.trim() !== line).join("\n").replace(/\n{3,}/g, "\n\n");
|
|
97
|
+
if (next === original) return false;
|
|
98
|
+
fs.writeFileSync(filePath, next.endsWith("\n") ? next : next + "\n");
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function upsertGeneratedBlock(filePath, blockId, heading, content) {
|
|
102
|
+
const start = `<!-- kirograph:${blockId}:start -->`;
|
|
103
|
+
const end = `<!-- kirograph:${blockId}:end -->`;
|
|
104
|
+
const block = `${start}
|
|
105
|
+
${heading}
|
|
106
|
+
|
|
107
|
+
${content.trim()}
|
|
108
|
+
${end}`;
|
|
109
|
+
const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : "";
|
|
110
|
+
const pattern = new RegExp(`${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}`);
|
|
111
|
+
if (pattern.test(existing)) {
|
|
112
|
+
const next = existing.replace(pattern, block);
|
|
113
|
+
if (next === existing) return false;
|
|
114
|
+
fs.writeFileSync(filePath, next.endsWith("\n") ? next : next + "\n");
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
118
|
+
const separator = existing.trim().length > 0 ? "\n" : "";
|
|
119
|
+
fs.writeFileSync(filePath, existing + prefix + separator + block + "\n");
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
function removeGeneratedBlock(filePath, blockId) {
|
|
123
|
+
if (!fs.existsSync(filePath)) return false;
|
|
124
|
+
const start = `<!-- kirograph:${blockId}:start -->`;
|
|
125
|
+
const end = `<!-- kirograph:${blockId}:end -->`;
|
|
126
|
+
const original = fs.readFileSync(filePath, "utf8");
|
|
127
|
+
const pattern = new RegExp(`\\n?${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}\\n?`);
|
|
128
|
+
const next = original.replace(pattern, "\n").replace(/\n{3,}/g, "\n\n");
|
|
129
|
+
if (next === original) return false;
|
|
130
|
+
fs.writeFileSync(filePath, next.endsWith("\n") ? next : next + "\n");
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
function escapeRegExp(s) {
|
|
134
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
135
|
+
}
|
|
136
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
+
0 && (module.exports = {
|
|
138
|
+
KIROGRAPH_COMMAND,
|
|
139
|
+
KIROGRAPH_MCP_ARGS,
|
|
140
|
+
KIROGRAPH_SCOPED_TOOLS,
|
|
141
|
+
KIROGRAPH_SERVER_NAME,
|
|
142
|
+
KIROGRAPH_SYNC_CMD,
|
|
143
|
+
KIROGRAPH_TOOLS,
|
|
144
|
+
appendImportLine,
|
|
145
|
+
ensureDir,
|
|
146
|
+
readJson,
|
|
147
|
+
removeGeneratedBlock,
|
|
148
|
+
removeImportLine,
|
|
149
|
+
removeMcpServersConfig,
|
|
150
|
+
upsertGeneratedBlock,
|
|
151
|
+
writeJson,
|
|
152
|
+
writeMcpServersConfig
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/installer/common.ts"],
|
|
4
|
+
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_TOOL_NAMES } from '../../mcp/tool-names';\n\nexport type InstallTarget = 'kiro' | 'claude' | 'codex';\n\nexport const KIROGRAPH_SERVER_NAME = 'kirograph';\nexport const KIROGRAPH_COMMAND = 'kirograph';\nexport const KIROGRAPH_MCP_ARGS = ['serve', '--mcp'];\nexport const KIROGRAPH_SYNC_CMD = 'kirograph sync-if-dirty --quiet 2>/dev/null || true';\nexport const KIROGRAPH_TOOLS = KIROGRAPH_TOOL_NAMES;\nexport const KIROGRAPH_SCOPED_TOOLS = KIROGRAPH_TOOL_NAMES.map(name => `@kirograph/${name}`);\n\nexport function ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nexport function readJson(p: string): any {\n try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return {}; }\n}\n\nexport function writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\nexport function writeMcpServersConfig(configPath: string, serverConfig: object): void {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n}\n\nexport function removeMcpServersConfig(configPath: string): boolean {\n if (!fs.existsSync(configPath)) return false;\n const existing = readJson(configPath);\n if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;\n delete existing.mcpServers[KIROGRAPH_SERVER_NAME];\n writeJson(configPath, existing);\n return true;\n}\n\nexport function appendImportLine(filePath: string, line: string, heading: string): boolean {\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n if (existing.includes(line)) return false;\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + heading + '\\n' + line + '\\n');\n return true;\n}\n\nexport function removeImportLine(filePath: string, line: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const original = fs.readFileSync(filePath, 'utf8');\n const next = original\n .split('\\n')\n .filter(l => l.trim() !== line)\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nexport function upsertGeneratedBlock(filePath: string, blockId: string, heading: string, content: string): boolean {\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const block = `${start}\\n${heading}\\n\\n${content.trim()}\\n${end}`;\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n const pattern = new RegExp(`${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}`);\n\n if (pattern.test(existing)) {\n const next = existing.replace(pattern, block);\n if (next === existing) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n }\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + block + '\\n');\n return true;\n}\n\nexport function removeGeneratedBlock(filePath: string, blockId: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const original = fs.readFileSync(filePath, 'utf8');\n const pattern = new RegExp(`\\\\n?${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}\\\\n?`);\n const next = original.replace(pattern, '\\n').replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WA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