| 67 | } |
| 68 | |
| 69 | static 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 |
no test coverage detected