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. */
| 7978 | * present → its cached store is invalidated) and the watcher re-index (srv NULL). |
| 7979 | * Returns the worker's response string (caller frees) or NULL to degrade. */ |
| 7980 | static char *index_run_supervised_path(cbm_mcp_server_t *srv, const char *root_path) { |
| 7981 | if (!root_path || !root_path[0]) { |
| 7982 | return NULL; |
| 7983 | } |
| 7984 | yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL); |
| 7985 | yyjson_mut_val *root = yyjson_mut_obj(doc); |
| 7986 | yyjson_mut_doc_set_root(doc, root); |
| 7987 | yyjson_mut_obj_add_strcpy(doc, root, "repo_path", root_path); |
| 7988 | char *args = yy_doc_to_str(doc); |
| 7989 | yyjson_mut_doc_free(doc); |
| 7990 | if (!args) { |
| 7991 | return NULL; |
| 7992 | } |
| 7993 | char *resp = index_run_supervised(srv, args); |
| 7994 | free(args); |
| 7995 | return resp; |
| 7996 | } |
| 7997 | |
| 7998 | /* Public entry (see mcp.h): the watcher re-index in main.c has no MCP server, so |
| 7999 | * it reaches the supervised runner through this srv-less wrapper. */ |
no test coverage detected