MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / template_path_after_base

Function template_path_after_base

internal/cbm/extract_calls.c:2857–2865  ·  view source on GitHub ↗

`${BASE}/route` -- the JS/TS twin of #1249's `base + "/route"`. A template * that opens with one substitution and continues with a literal path is a * configurable base URL (`${process.env.BACKEND_URL}/wallet`), so the route is * the literal path after it. Anything else (`${a}${b}`, `${BASE}/`, a template * that opens with text) comes back unchanged: no path is fabricated (#2291). */

Source from the content-addressed store, hash-verified

2855 * the literal path after it. Anything else (`${a}${b}`, `${BASE}/`, a template
2856 * that opens with text) comes back unchanged: no path is fabricated (#2291). */
2857static const char *template_path_after_base(TSNode tpl, const char *flat) {
2858 if (ts_node_named_child_count(tpl) < PAIR_LEN ||
2859 strcmp(ts_node_type(ts_node_named_child(tpl, 0)), "template_substitution") != 0) {
2860 return flat;
2861 }
2862 const char *path = flat + PAIR_LEN; /* past the base's "{}" placeholder */
2863 /* `${base}/${tail}` has no literal path to recover: "/{}" is not a route. */
2864 return (path[0] == '/' && cbm_url_has_literal_path(path)) ? path : flat;
2865}
2866
2867static const char *extract_positional_url(CBMExtractCtx *ctx, TSNode arg, const char *ak,
2868 url_context_t *uc) {

Callers 1

extract_positional_urlFunction · 0.85

Calls 1

cbm_url_has_literal_pathFunction · 0.85

Tested by

no test coverage detected