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

Function emit_yaml_leaf_value

internal/cbm/extract_unified.c:604–637  ·  view source on GitHub ↗

Recursively walk YAML block_mapping_pair nodes, building dotted key paths. * Emits string_refs with key_path for leaf values that are URLs or config values. * Example: body.operational_info.post_url → "https://..." */ Classify and emit a YAML leaf value as a string_ref with key_path.

Source from the content-addressed store, hash-verified

602 * Example: body.operational_info.post_url → "https://..." */
603// Classify and emit a YAML leaf value as a string_ref with key_path.
604static void emit_yaml_leaf_value(CBMExtractCtx *ctx, TSNode val, const char *path) {
605 char *val_text = cbm_node_text(ctx->arena, val, ctx->source);
606 if (!val_text || !val_text[0]) {
607 return;
608 }
609
610 int vlen = (int)strlen(val_text);
611 const char *content = val_text;
612 if (vlen >= CBM_QUOTE_PAIR && (val_text[0] == '"' || val_text[0] == '\'')) {
613 content = val_text + SKIP_ONE;
614 vlen -= PAIR_LEN;
615 if (vlen <= 0) {
616 return;
617 }
618 }
619
620 int kind_val = cbm_classify_string(content, vlen);
621 if (kind_val < 0) {
622 return;
623 }
624
625 char *stored = cbm_arena_strndup(ctx->arena, content, (size_t)vlen);
626 if (!stored) {
627 return;
628 }
629
630 CBMStringRef ref = {
631 .value = stored,
632 .enclosing_func_qn = ctx->module_qn,
633 .key_path = path,
634 .kind = (CBMStringRefKind)kind_val,
635 };
636 cbm_stringref_push(&ctx->result->string_refs, ctx->arena, ref);
637}
638
639typedef struct {
640 TSNode node;

Callers 1

walk_yaml_mappingFunction · 0.85

Calls 4

cbm_node_textFunction · 0.85
cbm_classify_stringFunction · 0.85
cbm_stringref_pushFunction · 0.85
cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected