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

Function cbm_opencode_detected

src/cli/cli.c:3149–3166  ·  view source on GitHub ↗

OpenCode keeps its data (auth, logs, sessions; the global config itself on * older installs) in ~/.local/share/opencode on every OS -- * %USERPROFILE%\.local\share\opencode on Windows (opencode.ai/docs/ * troubleshooting, "Storage"). The CLI and the Desktop app's bundled * opencode-cli server both create it, so it identifies an install that has * no config file, no ~/.config/opencode and no `

Source from the content-addressed store, hash-verified

3147 * no config file, no ~/.config/opencode and no `opencode` on PATH
3148 * (#1167, #1180). */
3149static bool cbm_opencode_detected(const char *home_dir) {
3150 char path[CLI_BUF_1K];
3151 cbm_opencode_config_path(home_dir, path, sizeof(path));
3152 if (cbm_file_exists(path) || cbm_agent_cli_exists("opencode", home_dir)) {
3153 return true;
3154 }
3155 snprintf(path, sizeof(path), "%s/.config/opencode", home_dir);
3156 if (dir_exists(path)) {
3157 return true;
3158 }
3159 char env_buf[CLI_BUF_1K];
3160 const char *config_dir = cbm_safe_getenv("OPENCODE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
3161 if (config_dir && config_dir[0] && dir_exists(config_dir)) {
3162 return true;
3163 }
3164 snprintf(path, sizeof(path), "%s/.local/share/opencode", home_dir);
3165 return dir_exists(path);
3166}
3167
3168cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
3169 cbm_detected_agents_t agents;

Callers 1

cbm_detect_agentsFunction · 0.85

Calls 5

cbm_opencode_config_pathFunction · 0.85
cbm_file_existsFunction · 0.85
cbm_agent_cli_existsFunction · 0.85
dir_existsFunction · 0.85
cbm_safe_getenvFunction · 0.85

Tested by

no test coverage detected