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

Function lang_open_indexed

tests/test_lang_contract.c:69–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static cbm_store_t *lang_open_indexed(LangProj *lp) {
70 lp->project = cbm_project_name_from_path(lp->tmpdir);
71 if (!lp->project) {
72 return NULL;
73 }
74 const char *home = getenv("HOME");
75 if (!home) {
76 home = "/tmp";
77 }
78 char cache_dir[512];
79 snprintf(cache_dir, sizeof(cache_dir), "%s/.cache/codebase-memory-mcp", home);
80 cbm_mkdir(cache_dir);
81 snprintf(lp->dbpath, sizeof(lp->dbpath), "%s/%s.db", cache_dir, lp->project);
82 unlink(lp->dbpath);
83 lp->srv = cbm_mcp_server_new(NULL);
84 if (!lp->srv) {
85 return NULL;
86 }
87 char args[700];
88 snprintf(args, sizeof(args), "{\"repo_path\":\"%s\"}", lp->tmpdir);
89 char *resp = cbm_mcp_handle_tool(lp->srv, "index_repository", args);
90 if (resp) {
91 free(resp);
92 }
93 return cbm_store_open_path(lp->dbpath);
94}
95
96/* Write each fixture file into a fresh temp project, index it via the MCP
97 * production flow (discover -> extract -> registry -> resolve -> dump), and open

Callers 2

lang_index_filesFunction · 0.85

Calls 4

cbm_mcp_server_newFunction · 0.85
cbm_mcp_handle_toolFunction · 0.85
cbm_store_open_pathFunction · 0.85

Tested by

no test coverage detected