Skip to content

Commit 80e2752

Browse files
committed
Fix KiloCode config paths on Windows and macOS
KiloCode is a VS Code extension — uses the same base config dir. Apply same platform-aware paths as Zed/VS Code: macOS uses $HOME/Library/Application Support/Code/, Windows uses %APPDATA%/Code/.
1 parent 9b302ee commit 80e2752

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

src/cli/cli.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,17 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
10021002

10031003
agents.aider = cbm_find_cli("aider", home_dir)[0] != '\0';
10041004

1005-
snprintf(path, sizeof(path), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", home_dir);
1005+
#ifdef __APPLE__
1006+
snprintf(path, sizeof(path),
1007+
"%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", home_dir);
1008+
#else
1009+
{
1010+
const char *kc_cfg = cbm_app_config_dir();
1011+
if (kc_cfg) {
1012+
snprintf(path, sizeof(path), "%s/Code/User/globalStorage/kilocode.kilo-code", kc_cfg);
1013+
}
1014+
}
1015+
#endif
10061016
agents.kilocode = dir_exists(path);
10071017

10081018
#ifdef __APPLE__
@@ -2738,9 +2748,16 @@ static void install_editor_agent_configs(const cbm_detected_agents_t *agents, co
27382748
if (agents->kilocode) {
27392749
char cp[CLI_BUF_1K];
27402750
char ip[CLI_BUF_1K];
2751+
#ifdef __APPLE__
27412752
snprintf(cp, sizeof(cp),
2742-
"%s/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json",
2753+
"%s/Library/Application Support/Code/User/globalStorage/"
2754+
"kilocode.kilo-code/settings/mcp_settings.json",
27432755
home);
2756+
#else
2757+
snprintf(cp, sizeof(cp),
2758+
"%s/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json",
2759+
cbm_app_config_dir());
2760+
#endif
27442761
snprintf(ip, sizeof(ip), "%s/.kilocode/rules/codebase-memory-mcp.md", home);
27452762
install_generic_agent_config("KiloCode", binary_path, cp, ip, dry_run,
27462763
cbm_install_editor_mcp);
@@ -3013,9 +3030,16 @@ static void uninstall_editor_agents(const cbm_detected_agents_t *agents, const c
30133030
if (agents->kilocode) {
30143031
char cp[CLI_BUF_1K];
30153032
char ip[CLI_BUF_1K];
3033+
#ifdef __APPLE__
30163034
snprintf(cp, sizeof(cp),
3017-
"%s/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json",
3035+
"%s/Library/Application Support/Code/User/globalStorage/"
3036+
"kilocode.kilo-code/settings/mcp_settings.json",
30183037
home);
3038+
#else
3039+
snprintf(cp, sizeof(cp),
3040+
"%s/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json",
3041+
cbm_app_config_dir());
3042+
#endif
30193043
snprintf(ip, sizeof(ip), "%s/.kilocode/rules/codebase-memory-mcp.md", home);
30203044
uninstall_agent_mcp_instr((mcp_uninstall_args_t){"KiloCode", cp, ip}, dry_run,
30213045
cbm_remove_editor_mcp);

tests/test_cli.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,12 @@ TEST(cli_detect_agents_finds_kilocode) {
14751475
SKIP("cbm_mkdtemp failed");
14761476

14771477
char dir[512];
1478+
#ifdef __APPLE__
1479+
snprintf(dir, sizeof(dir),
1480+
"%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", tmpdir);
1481+
#else
14781482
snprintf(dir, sizeof(dir), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", tmpdir);
1483+
#endif
14791484
test_mkdirp(dir);
14801485

14811486
cbm_detected_agents_t agents = cbm_detect_agents(tmpdir);

0 commit comments

Comments
 (0)