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 branch 'main' into fix/issue-2265-unresolved-call-coverage
Pcristinf1e059365357
diff --cc src/pipeline/pass_calls.cindex e8257f880,4d4d8fe03..cbf28dd87--- a/src/pipeline/pass_calls.c+++ b/src/pipeline/pass_calls.c@@@ -204,8 -213,169 +213,169 @@@ static void free_import_map(const char}}+ /* ── #1916: axios client-instance calls ─────────────────────────── */++ /* Copy the plain (unescaped) JSON string value of "key" in props into out.+ * False when absent, escaped, or too long — an unreadable base is unknown. */+ static bool pc_json_str_prop(const char *props, const char *key, char *out, size_t out_sz) {+ if (!props) {+ return false;+ }+ char pat[CBM_SZ_64];+ snprintf(pat, sizeof(pat), "\"%s\":\"", key);+ const char *p = strstr(props, pat);+ if (!p) {+ return false;+ }+ p += strlen(pat);+ const char *e = strchr(p, '"');+ if (!e) {+ return false;+ }+ size_t len = (size_t)(e - p);+ if (len >= out_sz || memchr(p, '\\', len) != NULL) {+ return false;+ }+ memcpy(out, p, len);+ out[len] = '\0';+ return true;+ }++ /* A node the extractor marked as an axios instance. `base` receives the+ * literal baseURL ("" when unknown). */+ static bool pc_node_is_http_client(const cbm_gbuf_node_t *n, char *base, size_t base_sz) {+ char client[CBM_SZ_32];+ if (!n || !pc_json_str_prop(n->properties_json, "http_client", client, sizeof(client))) {+ return false;+ }+ if (!pc_json_str_prop(n->properties_json, "http_base_url", base, base_sz)) {+ base[0] = '\0';+ }+ return true;+ }++ /* The module-level Variable `name` declared in file `file_rel`. */+ static const cbm_gbuf_node_t *pc_module_var(const cbm_gbuf_t *gbuf, const char *project,+ const char *file_rel, const char *name) {+ if (!file_rel) {+ return NULL;+ }+ const cbm_gbuf_node_t *n = pc_find_by_computed_qn(gbuf, project, file_rel, name);+ return (n && n->label && strcmp(n->label, "Variable") == 0) ? n : NULL;+ }++ /* Resolve the binding `recv` names in the calling file to a client node:+ * a same-file declaration first, then its ES import (default import → the+ * module's default export; named import → that module's Variable). */+ static bool pc_receiver_client_base(const cbm_gbuf_t *gbuf, const char *project, const char *rel,+ const CBMFileResult *result, const char **imp_keys,+ const char **imp_vals, int imp_count, const char *recv,+ char *base, size_t base_sz) {+ if (pc_node_is_http_client(pc_module_var(gbuf, project, rel, recv), base, base_sz)) {+ return true;+ }+ const CBMImport *imp = NULL;+ for (int i = 0; result && i < result->imports.count; i++) {+ const CBMImport *it = &result->imports.items[i];+ if (it->local_name && strcmp(it->local_name, recv) == 0) {+ imp = it;+ break;+ }+ }+ if (!imp) {+ return false;+ }+ for (int i = 0; i < imp_count; i++) {+ if (!imp_keys[i] || strcmp(imp_keys[i], recv) != 0 || !imp_vals[i]) {+ continue;+ }+ const cbm_gbuf_node_t *t = cbm_gbuf_find_by_qn(gbuf, imp_vals[i]);+ if (!t || !t->label) {+ return false;+ }+ if (strcmp(t->label, "Variable") == 0) {+ return pc_node_is_http_client(t, base, base_sz);+ }+ if (strcmp(t->label, "Module") != 0) {+ return false;+ }+ if (imp->is_default) {+ return pc_node_is_http_client(t, base, base_sz);+ }+ return pc_node_is_http_client(pc_module_var(gbuf, project, t->file_path, recv), base,+ base_sz);+ }+ return false;+ }++ /* axios instance request methods (the verb after the receiver). */+ static bool pc_is_axios_verb(const char *verb) {+ static const char *const verbs[] = {"get", "post", "put", "delete",+ "patch", "head", "options", NULL};+ for (int i = 0; verbs[i]; i++) {+ if (strcmp(verb, verbs[i]) == 0) {+ return true;+ }+ }+ return false;+ }++ /* Copy the plain-identifier receiver of `callee` (text before `dot`) into+ * recv. False for `this.api.get`, `a().get` and other non-binding receivers. */+ static bool pc_plain_receiver(const char *callee, const char *dot, char *recv, size_t recv_sz) {+ size_t rlen = (size_t)(dot - callee);+ if (rlen == 0 || rlen >= recv_sz) {+ return false;+ }+ for (size_t i = 0; i < rlen; i++) {+ char c = callee[i];+ bool ident = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ||+ c == '_' || c == '$';+ if (!ident) {+ return false;+ }+ }+ memcpy(recv, callee, rlen);+ recv[rlen] = '\0';+ return true;+ }++ bool cbm_pipeline_http_client_call_url(const cbm_gbuf_t *gbuf, const char *project, const char *rel,+ const CBMFileResult *result, const char **imp_keys,+ const char **imp_vals, int imp_count, const CBMCall *call,+ char *out, size_t out_sz) {+ const char *callee = call ? call->callee_name : NULL;+ const char *url = call ? call->first_string_arg : NULL;+ if (!gbuf || !project || !callee || !url || (url[0] != '/' && !strstr(url, "://"))) {+ return false;+ }+ const char *dot = strrchr(callee, '.');+ char recv[CBM_SZ_128];+ if (!dot || !pc_is_axios_verb(dot + SKIP_ONE) ||+ !pc_plain_receiver(callee, dot, recv, sizeof(recv))) {+ return false;+ }+ char base[CBM_SZ_256];+ if (!pc_receiver_client_base(gbuf, project, rel, result, imp_keys, imp_vals, imp_count, recv,+ base, sizeof(base))) {+ return false;+ }+ /* axios combineURLs: an absolute request URL ignores baseURL; otherwise+ * the base (trailing '/' trimmed) is joined with the '/'-leading path. */+ if (strstr(url, "://") || base[0] == '\0') {+ int n = snprintf(out, out_sz, "%s", url);+ return n > 0 && (size_t)n < out_sz;+ }+ size_t blen = strlen(base);+ while (blen > 0 && base[blen - SKIP_ONE] == '/') {+ base[--blen] = '\0';+ }+ int n = snprintf(out, out_sz, "%s%s", base, url);+ return n > 0 && (size_t)n < out_sz;+ }+/* Handle a route registration call: create Route node + HANDLES edge. */-static void handle_route_registration(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+static void handle_route_registration(cbm_pipeline_ctx_t *ctx, CBMCall *call,const cbm_gbuf_node_t *source_node, const char *module_qn,const char **imp_keys, const char **imp_vals, int imp_count) {const char *method = cbm_service_pattern_route_method(call->callee_name);