Build a minimal {"repo_path": " "} args object (path safely escaped) and * run it through index_run_supervised. Shared by the session auto-index (srv * present → its cached store is invalidated) and the watcher re-index (srv NULL). * Returns the worker's response string (caller frees) or NULL to degrade. */
| 3819 | * present → its cached store is invalidated) and the watcher re-index (srv NULL). |
| 3820 | * Returns the worker's response string (caller frees) or NULL to degrade. */ |
| 3821 | static char *index_run_supervised_path(cbm_mcp_server_t *srv, const char *root_path) { |
| 3822 | if (!root_path || !root_path[0]) { |
| 3823 | return NULL; |
| 3824 | } |
| 3825 | yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL); |
| 3826 | yyjson_mut_val *root = yyjson_mut_obj(doc); |
| 3827 | yyjson_mut_doc_set_root(doc, root); |
| 3828 | yyjson_mut_obj_add_strcpy(doc, root, "repo_path", root_path); |
| 3829 | char *args = yy_doc_to_str(doc); |
| 3830 | yyjson_mut_doc_free(doc); |
| 3831 | if (!args) { |
| 3832 | return NULL; |
| 3833 | } |
| 3834 | char *resp = index_run_supervised(srv, args); |
| 3835 | free(args); |
| 3836 | return resp; |
| 3837 | } |
| 3838 | |
| 3839 | /* Public entry (see mcp.h): the watcher re-index in main.c has no MCP server, so |
| 3840 | * it reaches the supervised runner through this srv-less wrapper. */ |
no test coverage detected