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

Function parse_pubspec_yaml

src/pipeline/pass_pkgmap.c:507–522  ·  view source on GitHub ↗

Dart: pubspec.yaml — name */

Source from the content-addressed store, hash-verified

505
506/* Dart: pubspec.yaml — name */
507static void parse_pubspec_yaml(const char *source, int source_len, const char *rel_path,
508 cbm_pkg_entries_t *entries) {
509 cbm_yaml_node_t *root = cbm_yaml_parse(source, source_len);
510 if (!root) {
511 return;
512 }
513 const char *name = cbm_yaml_get_str(root, "name");
514 if (name && name[0] != '\0') {
515 char *dir = path_dirname(rel_path);
516 char entry[PKGMAP_PATH_BUF];
517 snprintf(entry, sizeof(entry), "%s%slib", dir[0] ? dir : "", dir[0] ? "/" : "");
518 pkg_entries_push(entries, strdup(name), strdup(entry));
519 free(dir);
520 }
521 cbm_yaml_free(root);
522}
523
524/* Extract text content of an XML tag at position p. Returns heap string or NULL.
525 * p must point to the char after the opening tag's '>'. */

Callers 1

cbm_pkgmap_try_parseFunction · 0.85

Calls 5

cbm_yaml_parseFunction · 0.85
cbm_yaml_get_strFunction · 0.85
path_dirnameFunction · 0.85
pkg_entries_pushFunction · 0.85
cbm_yaml_freeFunction · 0.85

Tested by

no test coverage detected