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

Function cbm_detect_agents

src/cli/cli.c:2628–2772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2626}
2627
2628cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
2629 cbm_detected_agents_t agents;
2630 memset(&agents, 0, sizeof(agents));
2631 if (!home_dir || !home_dir[0]) {
2632 return agents;
2633 }
2634
2635 char path[CLI_BUF_1K];
2636
2637 cbm_claude_config_dir(home_dir, path, sizeof(path));
2638 agents.claude_code = path[0] != '\0' && dir_exists(path);
2639
2640 cbm_codex_config_dir(home_dir, path, sizeof(path));
2641 agents.codex = path[0] != '\0' && dir_exists(path);
2642
2643 snprintf(path, sizeof(path), "%s/.gemini/antigravity-cli", home_dir);
2644 agents.antigravity = dir_exists(path) || cbm_agent_cli_exists("antigravity", home_dir);
2645
2646 snprintf(path, sizeof(path), "%s/.gemini/settings.json", home_dir);
2647 agents.gemini = cbm_file_exists(path) || cbm_agent_cli_exists("gemini", home_dir);
2648
2649 cbm_zed_config_dir(home_dir, path, sizeof(path));
2650 agents.zed = dir_exists(path);
2651
2652 cbm_opencode_config_path(home_dir, path, sizeof(path));
2653 agents.opencode = cbm_file_exists(path) || cbm_agent_cli_exists("opencode", home_dir);
2654 if (!agents.opencode) {
2655 snprintf(path, sizeof(path), "%s/.config/opencode", home_dir);
2656 agents.opencode = dir_exists(path);
2657 }
2658 if (!agents.opencode) {
2659 char env_buf[CLI_BUF_1K];
2660 const char *config_dir =
2661 cbm_safe_getenv("OPENCODE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
2662 agents.opencode = config_dir && config_dir[0] && dir_exists(config_dir);
2663 }
2664
2665 agents.aider = cbm_agent_cli_exists("aider", home_dir);
2666
2667#ifdef __APPLE__
2668 snprintf(path, sizeof(path),
2669 "%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2670#elif defined(_WIN32)
2671 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code",
2672 home_dir);
2673#else
2674 snprintf(path, sizeof(path), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2675#endif
2676 agents.kilocode = dir_exists(path);
2677 snprintf(path, sizeof(path), "%s/.config/kilo", home_dir);
2678 agents.kilocode = agents.kilocode || dir_exists(path) || cbm_agent_cli_exists("kilo", home_dir);
2679
2680#ifdef __APPLE__
2681 snprintf(path, sizeof(path), "%s/Library/Application Support/Code/User", home_dir);
2682#elif defined(_WIN32)
2683 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User", home_dir);
2684#else
2685 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