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

Function issue704_make_db

tests/test_mcp.c:8323–8347  ·  view source on GitHub ↗

Create a file-backed project db at / whose INTERNAL project * name is `internal` (which may differ from the filename), holding one * Function node named `fn`. Returns true on success. */

Source from the content-addressed store, hash-verified

8321 * name is `internal` (which may differ from the filename), holding one
8322 * Function node named `fn`. Returns true on success. */
8323static bool issue704_make_db(const char *dir, const char *filename, const char *internal,
8324 const char *fn) {
8325 char path[700];
8326 snprintf(path, sizeof(path), "%s/%s", dir, filename);
8327 cbm_store_t *st = cbm_store_open_path(path);
8328 if (!st) {
8329 return false;
8330 }
8331 bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK);
8332 if (ok) {
8333 char qn[256];
8334 snprintf(qn, sizeof(qn), "%s.%s", internal, fn);
8335 cbm_node_t n = {0};
8336 n.project = internal;
8337 n.label = "Function";
8338 n.name = fn;
8339 n.qualified_name = qn;
8340 n.file_path = "main.go";
8341 n.start_line = 1;
8342 n.end_line = 2;
8343 ok = (cbm_store_upsert_node(st, &n) > 0);
8344 }
8345 cbm_store_close(st);
8346 return ok;
8347}
8348
8349TEST(tool_resolve_store_by_internal_name_issue704) {
8350 char cache[256];

Callers 1

test_mcp.cFile · 0.85

Calls 4

cbm_store_open_pathFunction · 0.85
cbm_store_upsert_projectFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85
cbm_store_closeFunction · 0.85

Tested by

no test coverage detected