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

Function cbm_find_cli

src/cli/cli.c:1160–1189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1158}
1159
1160const char *cbm_find_cli(const char *name, const char *home_dir) {
1161 static CBM_TLS char buf[CLI_BUF_512];
1162 if (!name || !name[0]) {
1163 return "";
1164 }
1165 if (find_in_path(name, buf, sizeof(buf))) {
1166 return buf;
1167 }
1168 if (!home_dir || !home_dir[0]) {
1169 return "";
1170 }
1171 enum { NUM_PATHS = 5 };
1172 char paths[NUM_PATHS][CLI_BUF_512];
1173 snprintf(paths[0], sizeof(paths[0]), "/usr/local/bin/%s", name);
1174 snprintf(paths[1], sizeof(paths[1]), "%s/.npm/bin/%s", home_dir, name);
1175 snprintf(paths[2], sizeof(paths[2]), "%s/.local/bin/%s", home_dir, name);
1176 snprintf(paths[3], sizeof(paths[3]), "%s/.cargo/bin/%s", home_dir, name);
1177#ifdef __APPLE__
1178 snprintf(paths[4], sizeof(paths[4]), "/opt/homebrew/bin/%s", name);
1179#else
1180 paths[4][0] = '\0';
1181#endif
1182 for (int i = 0; i < NUM_RETRIES; i++) {
1183 if (paths[i][0] && is_executable(paths[i])) {
1184 snprintf(buf, sizeof(buf), "%s", paths[i]);
1185 return buf;
1186 }
1187 }
1188 return "";
1189}
1190
1191/* Agent scans are also used for dry-run plans against an explicit/synthetic
1192 * home. In that mode, machine-global /usr/local and Homebrew fallbacks would

Callers 12

cbm_agent_cli_existsFunction · 0.85
ia_gitFunction · 0.85
test_cli.cFile · 0.85
cli_find_on_other_threadFunction · 0.85
mcp_test_gitFunction · 0.85
pt_initFunction · 0.85
gf_fixture_openFunction · 0.85
impact_test_gitFunction · 0.85
tie_open_filesFunction · 0.85
diff_git_runFunction · 0.85
app_test_gitFunction · 0.85
repro_issue221.cFile · 0.85

Calls 2

find_in_pathFunction · 0.85
is_executableFunction · 0.85

Tested by 8

cli_find_on_other_threadFunction · 0.68
mcp_test_gitFunction · 0.68
pt_initFunction · 0.68
gf_fixture_openFunction · 0.68
impact_test_gitFunction · 0.68
tie_open_filesFunction · 0.68
diff_git_runFunction · 0.68
app_test_gitFunction · 0.68