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

Function resolve_kustomize_entry

src/pipeline/pass_pkgmap.c:2267–2293  ·  view source on GitHub ↗

A kustomization entry is a path relative to the kustomization's own * directory -- a manifest file or a directory -- or a remote base; it never * names a symbol. Resolve it exactly or not at all: the name-guess strategies * bound a remote base's URL segment `deploy` to a shell function, component * paths to Go structs, and an entry's basename to a same-named file beside * the importer. */

Source from the content-addressed store, hash-verified

2265 * paths to Go structs, and an entry's basename to a same-named file beside
2266 * the importer. */
2267static const cbm_gbuf_node_t *resolve_kustomize_entry(const cbm_pipeline_ctx_t *ctx,
2268 const char *source_rel, const char *entry) {
2269 if (!entry[0] || kustomize_remote_entry(entry)) {
2270 return NULL;
2271 }
2272 /* "x.yaml" and "./x.yaml" name the same file; make every entry relative. */
2273 bool dotted = entry[0] == '.' && (entry[1] == '/' || (entry[1] == '.' && entry[2] == '/'));
2274 char rel[PKGMAP_PATH_BUF];
2275 snprintf(rel, sizeof(rel), "%s%s", dotted ? "" : "./", entry);
2276 char *path = cbm_pipeline_resolve_relative_import(source_rel, rel);
2277 if (!path) {
2278 return NULL;
2279 }
2280 const cbm_gbuf_node_t *found = NULL;
2281 char *qn = cbm_pipeline_fqn_module(ctx->project_name, path);
2282 const cbm_gbuf_node_t *n = qn ? cbm_gbuf_find_by_qn(ctx->gbuf, qn) : NULL;
2283 free(qn);
2284 /* The Module must be the entry's own file: a directory entry `base`
2285 * beside `base.yaml` shares its module QN but names the directory. */
2286 if (n && kustomize_file_label(n->label) && n->file_path && strcmp(n->file_path, path) == 0) {
2287 found = n;
2288 } else {
2289 found = kustomize_folder(ctx, path);
2290 }
2291 free(path);
2292 return found;
2293}
2294
2295/* Language-generic strategies retain their ordering. PHP name imports with
2296 * no namespace information (and global uses) restrict candidates before any

Callers 1

Calls 6

kustomize_remote_entryFunction · 0.85
cbm_pipeline_fqn_moduleFunction · 0.85
cbm_gbuf_find_by_qnFunction · 0.85
kustomize_file_labelFunction · 0.85
kustomize_folderFunction · 0.85

Tested by

no test coverage detected