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

Function issue704_make_db

tests/test_mcp.c:8175–8199  ·  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

8173 * name is `internal` (which may differ from the filename), holding one
8174 * Function node named `fn`. Returns true on success. */
8175static bool issue704_make_db(const char *dir, const char *filename, const char *internal,
8176 const char *fn) {
8177 char path[700];
8178 snprintf(path, sizeof(path), "%s/%s", dir, filename);
8179 cbm_store_t *st = cbm_store_open_path(path);
8180 if (!st) {
8181 return false;
8182 }
8183 bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK);
8184 if (ok) {
8185 char qn[256];
8186 snprintf(qn, sizeof(qn), "%s.%s", internal, fn);
8187 cbm_node_t n = {0};
8188 n.project = internal;
8189 n.label = "Function";
8190 n.name = fn;
8191 n.qualified_name = qn;
8192 n.file_path = "main.go";
8193 n.start_line = 1;
8194 n.end_line = 2;
8195 ok = (cbm_store_upsert_node(st, &n) > 0);
8196 }
8197 cbm_store_close(st);
8198 return ok;
8199}
8200
8201TEST(tool_resolve_store_by_internal_name_issue704) {
8202 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