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

Function cbm_detect_agents

src/cli/cli.c:2543–2687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2541}
2542
2543cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
2544 cbm_detected_agents_t agents;
2545 memset(&agents, 0, sizeof(agents));
2546 if (!home_dir || !home_dir[0]) {
2547 return agents;
2548 }
2549
2550 char path[CLI_BUF_1K];
2551
2552 cbm_claude_config_dir(home_dir, path, sizeof(path));
2553 agents.claude_code = path[0] != '\0' && dir_exists(path);
2554
2555 cbm_codex_config_dir(home_dir, path, sizeof(path));
2556 agents.codex = path[0] != '\0' && dir_exists(path);
2557
2558 snprintf(path, sizeof(path), "%s/.gemini/antigravity-cli", home_dir);
2559 agents.antigravity = dir_exists(path) || cbm_agent_cli_exists("antigravity", home_dir);
2560
2561 snprintf(path, sizeof(path), "%s/.gemini/settings.json", home_dir);
2562 agents.gemini = cbm_file_exists(path) || cbm_agent_cli_exists("gemini", home_dir);
2563
2564 cbm_zed_config_dir(home_dir, path, sizeof(path));
2565 agents.zed = dir_exists(path);
2566
2567 cbm_opencode_config_path(home_dir, path, sizeof(path));
2568 agents.opencode = cbm_file_exists(path) || cbm_agent_cli_exists("opencode", home_dir);
2569 if (!agents.opencode) {
2570 snprintf(path, sizeof(path), "%s/.config/opencode", home_dir);
2571 agents.opencode = dir_exists(path);
2572 }
2573 if (!agents.opencode) {
2574 char env_buf[CLI_BUF_1K];
2575 const char *config_dir =
2576 cbm_safe_getenv("OPENCODE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
2577 agents.opencode = config_dir && config_dir[0] && dir_exists(config_dir);
2578 }
2579
2580 agents.aider = cbm_agent_cli_exists("aider", home_dir);
2581
2582#ifdef __APPLE__
2583 snprintf(path, sizeof(path),
2584 "%s/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2585#elif defined(_WIN32)
2586 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User/globalStorage/kilocode.kilo-code",
2587 home_dir);
2588#else
2589 snprintf(path, sizeof(path), "%s/.config/Code/User/globalStorage/kilocode.kilo-code", home_dir);
2590#endif
2591 agents.kilocode = dir_exists(path);
2592 snprintf(path, sizeof(path), "%s/.config/kilo", home_dir);
2593 agents.kilocode = agents.kilocode || dir_exists(path) || cbm_agent_cli_exists("kilo", home_dir);
2594
2595#ifdef __APPLE__
2596 snprintf(path, sizeof(path), "%s/Library/Application Support/Code/User", home_dir);
2597#elif defined(_WIN32)
2598 snprintf(path, sizeof(path), "%s/AppData/Roaming/Code/User", home_dir);
2599#else
2600 snprintf(path, sizeof(path), "%s/.config/Code/User", home_dir);

Callers 5

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