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

Function collect

scripts/license-gate-check-npm.py:44–61  ·  view source on GitHub ↗
(ui_dir, dep_tree, out)

Source from the content-addressed store, hash-verified

42
43
44def collect(ui_dir, dep_tree, out):
45 for name, info in (dep_tree or {}).items():
46 version = info.get("version")
47 if not version:
48 continue
49 pkg_dir = os.path.join(ui_dir, "node_modules", *name.split("/"))
50 try:
51 with open(os.path.join(pkg_dir, "package.json"), encoding="utf-8") as fh:
52 meta = json.load(fh)
53 except (OSError, ValueError):
54 continue
55 if meta.get("os") or meta.get("cpu"):
56 continue # platform-restricted native build tooling, not bundled
57 lic = meta.get("license", "")
58 if isinstance(lic, dict):
59 lic = lic.get("type", "")
60 out[(name, version)] = (str(lic or ""), pkg_dir)
61 collect(ui_dir, info.get("dependencies"), out)
62
63
64def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected