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

Function emit_kustomize_sequence

internal/cbm/extract_k8s.c:80–103  ·  view source on GitHub ↗

Walk a block_sequence node and emit one CBMImport per block_sequence_item scalar child, using key_name as the local_name.

Source from the content-addressed store, hash-verified

78// Walk a block_sequence node and emit one CBMImport per block_sequence_item
79// scalar child, using key_name as the local_name.
80static void emit_kustomize_sequence(CBMExtractCtx *ctx, TSNode seq_node, const char *key_name) {
81 CBMArena *a = ctx->arena;
82 uint32_t n = ts_node_child_count(seq_node);
83 for (uint32_t i = 0; i < n; i++) {
84 TSNode item = ts_node_child(seq_node, i);
85 if (strcmp(ts_node_type(item), "block_sequence_item") != 0) {
86 continue;
87 }
88 // block_sequence_item has one named child: the value
89 uint32_t ic = ts_node_child_count(item);
90 for (uint32_t j = 0; j < ic; j++) {
91 TSNode val = ts_node_child(item, j);
92 const char *scalar = get_scalar_text(a, val, ctx->source);
93 if (!scalar) {
94 continue;
95 }
96 CBMImport imp = {
97 .local_name = cbm_arena_strdup(a, key_name),
98 .module_path = cbm_arena_strdup(a, scalar),
99 };
100 cbm_imports_push(&ctx->result->imports, a, imp);
101 }
102 }
103}
104
105// Unwrap a YAML node through optional block_node wrapper to get block_mapping.
106// Returns null node if not a block_mapping.

Callers 1

process_kustomize_pairFunction · 0.85

Calls 3

get_scalar_textFunction · 0.85
cbm_imports_pushFunction · 0.85
cbm_arena_strdupFunction · 0.70

Tested by

no test coverage detected