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

Function cbm_detect_agents

src/cli/cli.c:2738–2882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2736}
2737
2738cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
2739 cbm_detected_agents_t agents;
2740 memset(&agents, 0, sizeof(agents));
2741 if (!home_dir || !home_dir[0]) {
2742 return agents;
2743 }
2744
2745 char path[CLI_BUF_1K];
2746
2747 cbm_claude_config_dir(home_dir, path, sizeof(path));
2748 agents.claude_code = path[0] != '\0' && dir_exists(path);
2749
2750 cbm_codex_config_dir(home_dir, path, sizeof(path));
2751 agents.codex = path[0] != '\0' && dir_exists(path);
2752
2753 snprintf(path, sizeof(path), "%s/.gemini/antigravity-cli", home_dir);
2754 agents.antigravity = dir_exists(path) || cbm_agent_cli_exists("antigravity", home_dir);
2755
2756 snprintf(path, sizeof(path), "%s/.gemini/settings.json", home_dir);
2757 agents.gemini = cbm_file_exists(path) || cbm_agent_cli_exists("gemini", home_dir);
2758
2759 cbm_zed_config_dir(home_dir, path, sizeof(path));
2760 agents.zed = dir_exists(path);
2761
2762 cbm_opencode_config_path(home_dir, path, sizeof(path));
2763 agents.opencode = cbm_file_exists(path) || cbm_agent_cli_exists("opencode", home_dir);
2764 if (!agents.opencode) {
2765 snprintf(path, sizeof(path), "%s/.config/opencode", home_dir);
2766 agents.opencode = dir_exists(path);
2767 }
2768 if (!agents.opencode) {
2769 char env_buf[CLI_BUF_1K];
2770 const char *config_dir =
2771 cbm_safe_getenv("OPENCODE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
2772 agents.opencode = config_dir && config_dir[0] && dir_exists(config_dir);
2773 }
2774
2775 agents.aider = cbm_agent_cli_exists("aider", home_dir);
2776
2777#ifdef __APPLE__
2778 snprintf(path, sizeof(path),
2779 "%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2780#elif defined(_WIN32)
2781 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code",
2782 home_dir);
2783#else
2784 snprintf(path, sizeof(path), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2785#endif
2786 agents.kilocode = dir_exists(path);
2787 snprintf(path, sizeof(path), "%s/.config/kilo", home_dir);
2788 agents.kilocode = agents.kilocode || dir_exists(path) || cbm_agent_cli_exists("kilo", home_dir);
2789
2790#ifdef __APPLE__
2791 snprintf(path, sizeof(path), "%s/Library/Application Support/Code/User", home_dir);
2792#elif defined(_WIN32)
2793 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User", home_dir);
2794#else
2795 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