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

Function cbm_claude_code_detected

src/cli/cli.c:3126–3140  ·  view source on GitHub ↗

#1180: a bare ~/.claude directory is not a Claude Code install -- other * tools create it -- and treating it as one wrote hooks, skills and MCP * entries for a client the user never installed. Claude Code itself leaves * its user config .claude.json (under CLAUDE_CONFIG_DIR when set), its * settings.json, or the claude CLI. */

Source from the content-addressed store, hash-verified

3124 * its user config .claude.json (under CLAUDE_CONFIG_DIR when set), its
3125 * settings.json, or the claude CLI. */
3126static bool cbm_claude_code_detected(const char *home_dir) {
3127 char dir[CLI_BUF_1K];
3128 char path[CLI_BUF_1K];
3129 cbm_claude_config_dir(home_dir, dir, sizeof(dir));
3130 int written = snprintf(path, sizeof(path), "%s/settings.json", dir);
3131 if (dir[0] && written > 0 && (size_t)written < sizeof(path) && cbm_file_exists(path)) {
3132 return true;
3133 }
3134 cbm_claude_user_root(home_dir, dir, sizeof(dir));
3135 written = snprintf(path, sizeof(path), "%s/.claude.json", dir);
3136 if (dir[0] && written > 0 && (size_t)written < sizeof(path) && cbm_file_exists(path)) {
3137 return true;
3138 }
3139 return cbm_agent_cli_exists("claude", home_dir);
3140}
3141
3142/* OpenCode keeps its data (auth, logs, sessions; the global config itself on
3143 * older installs) in ~/.local/share/opencode on every OS --

Callers 1

cbm_detect_agentsFunction · 0.85

Calls 4

cbm_claude_config_dirFunction · 0.85
cbm_file_existsFunction · 0.85
cbm_claude_user_rootFunction · 0.85
cbm_agent_cli_existsFunction · 0.85

Tested by

no test coverage detected