@@ -537,7 +537,9 @@ static yyjson_doc *read_json_file(const char *path) {
537537 // NOLINTNEXTLINE(clang-analyzer-security.ArrayBound)
538538 buf [nread ] = '\0' ;
539539
540- yyjson_doc * doc = yyjson_read (buf , nread , 0 );
540+ /* Allow JSONC (comments + trailing commas) — Zed settings.json uses this format */
541+ yyjson_read_flag flags = YYJSON_READ_ALLOW_COMMENTS | YYJSON_READ_ALLOW_TRAILING_COMMAS ;
542+ yyjson_doc * doc = yyjson_read (buf , nread , flags );
541543 free (buf );
542544 return doc ;
543545}
@@ -811,7 +813,7 @@ int cbm_remove_zed_mcp(const char *config_path) {
811813/* ── Agent detection ──────────────────────────────────────────── */
812814
813815cbm_detected_agents_t cbm_detect_agents (const char * home_dir ) {
814- cbm_detected_agents_t agents = {false, false, false, false, false, false, false};
816+ cbm_detected_agents_t agents = {false, false, false, false, false, false, false, false };
815817 if (!home_dir || !home_dir [0 ]) {
816818 return agents ;
817819 }
@@ -866,6 +868,12 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
866868 agents .aider = true;
867869 }
868870
871+ /* KiloCode: globalStorage dir */
872+ snprintf (path , sizeof (path ), "%s/.config/Code/User/globalStorage/kilocode.kilo-code" , home_dir );
873+ if (stat (path , & st ) == 0 && S_ISDIR (st .st_mode )) {
874+ agents .kilocode = true;
875+ }
876+
869877 return agents ;
870878}
871879
@@ -1808,8 +1816,11 @@ int cbm_cmd_install(int argc, char **argv) {
18081816 if (agents .aider ) {
18091817 printf (" Aider" );
18101818 }
1819+ if (agents .kilocode ) {
1820+ printf (" KiloCode" );
1821+ }
18111822 if (!agents .claude_code && !agents .codex && !agents .gemini && !agents .zed && !agents .opencode &&
1812- !agents .antigravity && !agents .aider ) {
1823+ !agents .antigravity && !agents .aider && ! agents . kilocode ) {
18131824 printf (" (none)" );
18141825 }
18151826 printf ("\n\n" );
@@ -1949,7 +1960,28 @@ int cbm_cmd_install(int argc, char **argv) {
19491960 printf (" instructions: %s\n" , instr_path );
19501961 }
19511962
1952- /* Step 11: Ensure PATH */
1963+ /* Step 11: Install KiloCode */
1964+ if (agents .kilocode ) {
1965+ printf ("KiloCode:\n" );
1966+ char config_path [1024 ];
1967+ snprintf (config_path , sizeof (config_path ),
1968+ "%s/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json" ,
1969+ home );
1970+ if (!dry_run ) {
1971+ cbm_install_editor_mcp (self_path , config_path );
1972+ }
1973+ printf (" mcp: %s\n" , config_path );
1974+
1975+ /* KiloCode uses ~/.kilocode/rules/ for global instructions */
1976+ char instr_path [1024 ];
1977+ snprintf (instr_path , sizeof (instr_path ), "%s/.kilocode/rules/codebase-memory-mcp.md" , home );
1978+ if (!dry_run ) {
1979+ cbm_upsert_instructions (instr_path , agent_instructions_content );
1980+ }
1981+ printf (" instructions: %s\n" , instr_path );
1982+ }
1983+
1984+ /* Step 12: Ensure PATH */
19531985 char bin_dir [1024 ];
19541986 snprintf (bin_dir , sizeof (bin_dir ), "%s/.local/bin" , home );
19551987 const char * rc = cbm_detect_shell_rc (home );
@@ -2105,6 +2137,24 @@ int cbm_cmd_uninstall(int argc, char **argv) {
21052137 printf ("Aider: removed instructions\n" );
21062138 }
21072139
2140+ if (agents .kilocode ) {
2141+ char config_path [1024 ];
2142+ snprintf (config_path , sizeof (config_path ),
2143+ "%s/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json" ,
2144+ home );
2145+ if (!dry_run ) {
2146+ cbm_remove_editor_mcp (config_path );
2147+ }
2148+ printf ("KiloCode: removed MCP config entry\n" );
2149+
2150+ char instr_path [1024 ];
2151+ snprintf (instr_path , sizeof (instr_path ), "%s/.kilocode/rules/codebase-memory-mcp.md" , home );
2152+ if (!dry_run ) {
2153+ cbm_remove_instructions (instr_path );
2154+ }
2155+ printf (" removed instructions\n" );
2156+ }
2157+
21082158 /* Step 2: Remove indexes */
21092159 int index_count = 0 ;
21102160 const char * cache_dir = get_cache_dir (home );
0 commit comments