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

Function issue704_make_db

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

8858 * name is `internal` (which may differ from the filename), holding one
8859 * Function node named `fn`. Returns true on success. */
8860static bool issue704_make_db(const char *dir, const char *filename, const char *internal,
8861 const char *fn) {
8862 char path[700];
8863 snprintf(path, sizeof(path), "%s/%s", dir, filename);
8864 cbm_store_t *st = cbm_store_open_path(path);
8865 if (!st) {
8866 return false;
8867 }
8868 bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK);
8869 if (ok) {
8870 char qn[256];
8871 snprintf(qn, sizeof(qn), "%s.%s", internal, fn);
8872 cbm_node_t n = {0};
8873 n.project = internal;
8874 n.label = "Function";
8875 n.name = fn;
8876 n.qualified_name = qn;
8877 n.file_path = "main.go";
8878 n.start_line = 1;
8879 n.end_line = 2;
8880 ok = (cbm_store_upsert_node(st, &n) > 0);
8881 }
8882 cbm_store_close(st);
8883 return ok;
8884}
8885
8886TEST(tool_resolve_store_by_internal_name_issue704) {
8887 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