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

Function parse_composer_json

src/pipeline/pass_pkgmap.c:490–518  ·  view source on GitHub ↗

PHP: composer.json — name + PSR-4 autoload */

Source from the content-addressed store, hash-verified

488
489/* PHP: composer.json — name + PSR-4 autoload */
490static void parse_composer_json(const char *source, int source_len, const char *rel_path,
491 cbm_pkg_entries_t *entries) {
492 yyjson_doc *doc = yyjson_read(source, (size_t)source_len, 0);
493 if (!doc) {
494 return;
495 }
496 yyjson_val *root = yyjson_doc_get_root(doc);
497 if (!yyjson_is_obj(root)) {
498 yyjson_doc_free(doc);
499 return;
500 }
501
502 char *dir = path_dirname(rel_path);
503
504 /* Register package name → directory */
505 yyjson_val *name_val = yyjson_obj_get(root, "name");
506 if (yyjson_is_str(name_val)) {
507 const char *name = yyjson_get_str(name_val);
508 if (name && name[0] != '\0') {
509 pkg_entries_push(entries, strdup(name), strdup(dir));
510 }
511 }
512
513 extract_psr4(root, "autoload", dir, entries);
514 extract_psr4(root, "autoload-dev", dir, entries);
515
516 free(dir);
517 yyjson_doc_free(doc);
518}
519
520/* Dart: pubspec.yaml — name */
521static void parse_pubspec_yaml(const char *source, int source_len, const char *rel_path,

Callers 1

cbm_pkgmap_try_parseFunction · 0.85

Calls 3

path_dirnameFunction · 0.85
pkg_entries_pushFunction · 0.85
extract_psr4Function · 0.85

Tested by

no test coverage detected