From 404b5f822ce641bd2cc34555dc643397f263c611 Mon Sep 17 00:00:00 2001 From: test Date: Wed, 15 Apr 2026 20:47:20 +0200 Subject: [PATCH] feat: add Kiro CLI support (#96) Detect ~/.kiro/ directory, auto-configure MCP at ~/.kiro/settings/mcp.json using standard mcpServers format. Adds install, uninstall, detection, and test. Based on #174 by dLo999, rebased onto refactored install infrastructure. Co-Authored-By: Dustin Obrecht --- README.md | 3 ++- src/cli/cli.c | 22 ++++++++++++++++++++++ src/cli/cli.h | 1 + src/main.c | 3 ++- tests/test_cli.c | 19 +++++++++++++++++++ 5 files changed, 46 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e94a1e12d..f45ced0fd 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si - **Plug and play** — single static binary for macOS (arm64/amd64), Linux (arm64/amd64), and Windows (amd64). No Docker, no runtime dependencies, no API keys. Download → `install` → restart agent → done. - **66 languages** — vendored tree-sitter grammars compiled into the binary. Nothing to install, nothing that breaks. - **120x fewer tokens** — 5 structural queries: ~3,400 tokens vs ~412,000 via file-by-file search. One graph query replaces dozens of grep/read cycles. -- **10 agents, one command** — `install` auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, and OpenClaw — configures MCP entries, instruction files, and pre-tool hooks for each. +- **11 agents, one command** — `install` auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, and Kiro — configures MCP entries, instruction files, and pre-tool hooks for each. - **Built-in graph visualization** — 3D interactive UI at `localhost:9749` (optional UI binary variant). - **Infrastructure-as-code indexing** — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. `Resource` nodes for K8s kinds, `Module` nodes for Kustomize overlays with `IMPORTS` edges to referenced resources. - **14 MCP tools** — search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more. @@ -281,6 +281,7 @@ Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` | KiloCode | `mcp_settings.json` | `~/.kilocode/rules/` | — | | VS Code | `Code/User/mcp.json` | — | — | | OpenClaw | `openclaw.json` | — | — | +| Kiro | `.kiro/settings/mcp.json` | — | — | **Hooks** are advisory (exit code 0) — they remind agents to prefer MCP graph tools when they reach for grep/glob/read, without blocking the tool call. diff --git a/src/cli/cli.c b/src/cli/cli.c index 919c27b45..dd3e6d30a 100644 --- a/src/cli/cli.c +++ b/src/cli/cli.c @@ -1029,6 +1029,10 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) { snprintf(path, sizeof(path), "%s/.openclaw", home_dir); agents.openclaw = dir_exists(path); + /* Kiro: ~/.kiro/ */ + snprintf(path, sizeof(path), "%s/.kiro", home_dir); + agents.kiro = dir_exists(path); + return agents; } @@ -2602,6 +2606,7 @@ static void print_detected_agents(const cbm_detected_agents_t *a) { {a->kilocode, "KiloCode"}, {a->vscode, "VS-Code"}, {a->openclaw, "OpenClaw"}, + {a->kiro, "Kiro"}, }; printf("Detected agents:"); bool any = false; @@ -2777,6 +2782,17 @@ static void install_editor_agent_configs(const cbm_detected_agents_t *agents, co install_generic_agent_config("OpenClaw", binary_path, cp, NULL, dry_run, cbm_install_editor_mcp); } + if (agents->kiro) { + char cp[CLI_BUF_1K]; + char sd[CLI_BUF_1K]; + snprintf(cp, sizeof(cp), "%s/.kiro/settings/mcp.json", home); + snprintf(sd, sizeof(sd), "%s/.kiro/settings", home); + if (!dry_run) { + cbm_mkdir_p(sd, CLI_OCTAL_PERM); + } + install_generic_agent_config("Kiro", binary_path, cp, NULL, dry_run, + cbm_install_editor_mcp); + } } static void cbm_install_agent_configs(const char *home, const char *binary_path, bool force, @@ -3081,6 +3097,12 @@ static void uninstall_editor_agents(const cbm_detected_agents_t *agents, const c uninstall_agent_mcp_instr((mcp_uninstall_args_t){"OpenClaw", cp, NULL}, dry_run, cbm_remove_editor_mcp); } + if (agents->kiro) { + char cp[CLI_BUF_1K]; + snprintf(cp, sizeof(cp), "%s/.kiro/settings/mcp.json", home); + uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Kiro", cp, NULL}, dry_run, + cbm_remove_editor_mcp); + } } int cbm_cmd_uninstall(int argc, char **argv) { diff --git a/src/cli/cli.h b/src/cli/cli.h index 7f3f18cd3..0156c245a 100644 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -120,6 +120,7 @@ typedef struct { bool kilocode; /* KiloCode globalStorage dir exists */ bool vscode; /* VS Code User config dir exists */ bool openclaw; /* ~/.openclaw/ exists */ + bool kiro; /* ~/.kiro/ exists */ } cbm_detected_agents_t; /* Detect which coding agents are installed. diff --git a/src/main.c b/src/main.c index 54dbfb62a..95d37725f 100644 --- a/src/main.c +++ b/src/main.c @@ -249,7 +249,8 @@ static void print_help(void) { printf(" --ui=false Disable HTTP graph visualization (persisted)\n"); printf(" --port=N Set UI port (default 9749, persisted)\n"); printf("\nSupported agents (auto-detected):\n"); - printf(" Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode\n"); + printf(" Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode,\n"); + printf(" Antigravity, Aider, KiloCode, Kiro\n"); printf("\nTools: index_repository, search_graph, query_graph, trace_path,\n"); printf(" get_code_snippet, get_graph_schema, get_architecture, search_code,\n"); printf(" list_projects, delete_project, index_status, detect_changes,\n"); diff --git a/tests/test_cli.c b/tests/test_cli.c index deb015c62..f8e5b6549 100644 --- a/tests/test_cli.c +++ b/tests/test_cli.c @@ -1495,6 +1495,23 @@ TEST(cli_detect_agents_finds_kilocode) { PASS(); } +TEST(cli_detect_agents_finds_kiro) { + char tmpdir[256]; + snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX"); + if (!cbm_mkdtemp(tmpdir)) + SKIP("cbm_mkdtemp failed"); + + char dir[512]; + snprintf(dir, sizeof(dir), "%s/.kiro", tmpdir); + test_mkdirp(dir); + + cbm_detected_agents_t agents = cbm_detect_agents(tmpdir); + ASSERT_TRUE(agents.kiro); + + test_rmdir_r(tmpdir); + PASS(); +} + TEST(cli_detect_agents_none_found) { char tmpdir[256]; snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX"); @@ -1511,6 +1528,7 @@ TEST(cli_detect_agents_none_found) { ASSERT_FALSE(agents.zed); ASSERT_FALSE(agents.antigravity); ASSERT_FALSE(agents.kilocode); + ASSERT_FALSE(agents.kiro); rmdir(tmpdir); PASS(); @@ -2425,6 +2443,7 @@ SUITE(cli) { RUN_TEST(cli_detect_agents_finds_zed); RUN_TEST(cli_detect_agents_finds_antigravity); RUN_TEST(cli_detect_agents_finds_kilocode); + RUN_TEST(cli_detect_agents_finds_kiro); RUN_TEST(cli_detect_agents_none_found); /* Codex MCP config upsert (3 tests — group B) */