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 `
| 3147 | * no config file, no ~/.config/opencode and no `opencode` on PATH |
| 3148 | * (#1167, #1180). */ |
| 3149 | static 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 | |
| 3168 | cbm_detected_agents_t cbm_detect_agents(const char *home_dir) { |
| 3169 | cbm_detected_agents_t agents; |
no test coverage detected