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

Function parse_composer_json

src/pipeline/pass_pkgmap.c:477–504  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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