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

Function add_file_node

tests/test_doclinks.c:37–44  ·  view source on GitHub ↗

Create a File node the way pass_structure does: QN via fqn_compute with * "__file__", file_path = repo-relative path. Returns the node id. */

Source from the content-addressed store, hash-verified

35/* Create a File node the way pass_structure does: QN via fqn_compute with
36 * "__file__", file_path = repo-relative path. Returns the node id. */
37static int64_t add_file_node(cbm_gbuf_t *gb, const char *project, const char *rel) {
38 char *qn = cbm_pipeline_fqn_compute(project, rel, "__file__");
39 const char *slash = strrchr(rel, '/');
40 const char *basename = slash ? slash + 1 : rel;
41 int64_t id = cbm_gbuf_upsert_node(gb, "File", basename, qn, rel, 0, 0, NULL);
42 free(qn);
43 return id;
44}
45
46/* Find the REFERENCES_FILE edge between two node ids. NULL if absent. */
47static const cbm_gbuf_edge_t *find_ref_edge(cbm_gbuf_t *gb, int64_t src, int64_t tgt) {

Callers 1

test_doclinks.cFile · 0.85

Calls 2

cbm_pipeline_fqn_computeFunction · 0.85
cbm_gbuf_upsert_nodeFunction · 0.85

Tested by

no test coverage detected