Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Create cache directory before SQLite dump in pipeline

Martin Vogeldc919b223131
diff --git a/src/pipeline/pipeline.c b/src/pipeline/pipeline.c
index 7be1335ad..bcb48c6fc 100644
--- a/src/pipeline/pipeline.c
+++ b/src/pipeline/pipeline.c
@@ -17,6 +17,7 @@
#include "graph_buffer/graph_buffer.h"
#include "discover/discover.h"
#include "foundation/platform.h"
+#include "foundation/compat_fs.h"
#include "foundation/log.h"
#include "foundation/hash_table.h"
#include "foundation/compat.h"
@@ -633,6 +634,15 @@ int cbm_pipeline_run(cbm_pipeline_t *p) {
p->project_name);
}
+ /* Ensure parent directory exists (e.g. ~/.cache/codebase-memory-mcp/) */
+ char db_dir[1024];
+ snprintf(db_dir, sizeof(db_dir), "%s", db_path);
+ char *last_slash = strrchr(db_dir, '/');
+ if (last_slash) {
+ *last_slash = '\0';
+ cbm_mkdir_p(db_dir, 0755);
+ }
+
rc = cbm_gbuf_dump_to_sqlite(p->gbuf, db_path);
if (rc != 0) {
cbm_log_error("pipeline.err", "phase", "dump");