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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Merge remote-tracking branch 'origin/main' into fix/1084-background-index-cpu
Martin Vogel173e11a9da61
diff --cc src/daemon/application.cindex 9900b5ee0,c431fe88f..0e9b7cd47--- a/src/daemon/application.c+++ b/src/daemon/application.c@@@ -4143,7 -4339,60 +4342,61 @@@ static int application_background_indexcbm_usleep(APPLICATION_JOB_POLL_US);}application_jobs_reap_completed(application);- return successful ? 0 : (cancelled ? 1 : -1);+ if (successful) {+ return APPLICATION_BACKGROUND_INDEX_SUCCESS;+ }+ return cancelled ? APPLICATION_BACKGROUND_INDEX_SKIPPED : APPLICATION_BACKGROUND_INDEX_FAILED;+ }++ static int application_background_index(cbm_daemon_application_t *application,+ const char *project_name, const char *root_path,+ bool require_live_watch) {+ if (!application || !project_name || !root_path) {+ return APPLICATION_BACKGROUND_INDEX_FAILED;+ }+ char canonical_root[APPLICATION_PATH_CAP];+ if (!cbm_canonical_path(root_path, canonical_root, sizeof(canonical_root)) ||+ !application_canonical_directory_exists(canonical_root)) {+ return APPLICATION_BACKGROUND_INDEX_FAILED;+ }+ yyjson_mut_doc *document = yyjson_mut_doc_new(NULL);+ yyjson_mut_val *root = document ? yyjson_mut_obj(document) : NULL;+ if (!document || !root) {+ yyjson_mut_doc_free(document);+ return APPLICATION_BACKGROUND_INDEX_FAILED;+ }+ yyjson_mut_doc_set_root(document, root);+ bool encoded = yyjson_mut_obj_add_strcpy(document, root, "repo_path", canonical_root) &&- application_index_args_add_policy(application, document, root);++ application_index_args_add_policy(application, document, root) &&++ yyjson_mut_obj_add_bool(document, root, "_cbm_background", true);+ char *default_project = cbm_project_name_from_path(canonical_root);+ bool custom_project =+ project_name[0] && (!default_project || strcmp(default_project, project_name) != 0);+ if (encoded && custom_project) {+ encoded = yyjson_mut_obj_add_strcpy(document, root, "name", project_name);+ }+ free(default_project);+ char *args = encoded ? yyjson_mut_write(document, 0, NULL) : NULL;+ if (!args) {+ yyjson_mut_doc_free(document);+ return APPLICATION_BACKGROUND_INDEX_FAILED;+ }+ char *project_key = application_index_project_key(canonical_root, args);+ if (!project_key) {+ free(args);+ yyjson_mut_doc_free(document);+ return APPLICATION_BACKGROUND_INDEX_FAILED;+ }++ int no_job_result = APPLICATION_BACKGROUND_INDEX_FAILED;+ cbm_daemon_application_job_t *job = application_background_index_admit(+ application, project_name, canonical_root, project_key, document, root, &args,+ require_live_watch, &no_job_result);+ free(project_key);+ free(args);+ yyjson_mut_doc_free(document);+ return job ? application_background_index_wait(application, job, require_live_watch)+ : no_job_result;}int cbm_daemon_application_index(cbm_daemon_application_t *application, const char *project_name,