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

Function cbm_detect_agents

src/cli/cli.c:2537–2681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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