MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_detect_agents

Function cbm_detect_agents

src/cli/cli.c:2607–2751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2605}
2606
2607cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
2608 cbm_detected_agents_t agents;
2609 memset(&agents, 0, sizeof(agents));
2610 if (!home_dir || !home_dir[0]) {
2611 return agents;
2612 }
2613
2614 char path[CLI_BUF_1K];
2615
2616 cbm_claude_config_dir(home_dir, path, sizeof(path));
2617 agents.claude_code = path[0] != '\0' && dir_exists(path);
2618
2619 cbm_codex_config_dir(home_dir, path, sizeof(path));
2620 agents.codex = path[0] != '\0' && dir_exists(path);
2621
2622 snprintf(path, sizeof(path), "%s/.gemini/antigravity-cli", home_dir);
2623 agents.antigravity = dir_exists(path) || cbm_agent_cli_exists("antigravity", home_dir);
2624
2625 snprintf(path, sizeof(path), "%s/.gemini/settings.json", home_dir);
2626 agents.gemini = cbm_file_exists(path) || cbm_agent_cli_exists("gemini", home_dir);
2627
2628 cbm_zed_config_dir(home_dir, path, sizeof(path));
2629 agents.zed = dir_exists(path);
2630
2631 cbm_opencode_config_path(home_dir, path, sizeof(path));
2632 agents.opencode = cbm_file_exists(path) || cbm_agent_cli_exists("opencode", home_dir);
2633 if (!agents.opencode) {
2634 snprintf(path, sizeof(path), "%s/.config/opencode", home_dir);
2635 agents.opencode = dir_exists(path);
2636 }
2637 if (!agents.opencode) {
2638 char env_buf[CLI_BUF_1K];
2639 const char *config_dir =
2640 cbm_safe_getenv("OPENCODE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
2641 agents.opencode = config_dir && config_dir[0] && dir_exists(config_dir);
2642 }
2643
2644 agents.aider = cbm_agent_cli_exists("aider", home_dir);
2645
2646#ifdef __APPLE__
2647 snprintf(path, sizeof(path),
2648 "%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2649#elif defined(_WIN32)
2650 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code",
2651 home_dir);
2652#else
2653 snprintf(path, sizeof(path), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2654#endif
2655 agents.kilocode = dir_exists(path);
2656 snprintf(path, sizeof(path), "%s/.config/kilo", home_dir);
2657 agents.kilocode = agents.kilocode || dir_exists(path) || cbm_agent_cli_exists("kilo", home_dir);
2658
2659#ifdef __APPLE__
2660 snprintf(path, sizeof(path), "%s/Library/Application Support/Code/User", home_dir);
2661#elif defined(_WIN32)
2662 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User", home_dir);
2663#else
2664 snprintf(path, sizeof(path), "%s/.config/Code/User", home_dir);

Callers 6

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85
test_cli.cFile · 0.85
repro_issue431.cFile · 0.85

Calls 15

cbm_claude_config_dirFunction · 0.85
dir_existsFunction · 0.85
cbm_codex_config_dirFunction · 0.85
cbm_agent_cli_existsFunction · 0.85
cbm_file_existsFunction · 0.85
cbm_zed_config_dirFunction · 0.85
cbm_opencode_config_pathFunction · 0.85
cbm_safe_getenvFunction · 0.85
cbm_openclaw_config_pathFunction · 0.85
cbm_openclaw_state_dirFunction · 0.85
cbm_kiro_home_dirFunction · 0.85
cbm_hermes_home_dirFunction · 0.85

Tested by

no test coverage detected