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

Function parse_composer_json

src/pipeline/pass_pkgmap.c:473–500  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

471
472/* PHP: composer.json — name + PSR-4 autoload */
473static void parse_composer_json(const char *source, int source_len, const char *rel_path,
474 cbm_pkg_entries_t *entries) {
475 yyjson_doc *doc = yyjson_read(source, (size_t)source_len, 0);
476 if (!doc) {
477 return;
478 }
479 yyjson_val *root = yyjson_doc_get_root(doc);
480 if (!yyjson_is_obj(root)) {
481 yyjson_doc_free(doc);
482 return;
483 }
484
485 char *dir = path_dirname(rel_path);
486
487 /* Register package name → directory */
488 yyjson_val *name_val = yyjson_obj_get(root, "name");
489 if (yyjson_is_str(name_val)) {
490 const char *name = yyjson_get_str(name_val);
491 if (name && name[0] != '\0') {
492 pkg_entries_push(entries, strdup(name), strdup(dir));
493 }
494 }
495
496 extract_psr4(root, dir, entries);
497
498 free(dir);
499 yyjson_doc_free(doc);
500}
501
502/* Dart: pubspec.yaml — name */
503static 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