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

Function collect

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

Source from the content-addressed store, hash-verified

45
46
47def collect(ui_dir, dep_tree, out):
48 for name, info in (dep_tree or {}).items():
49 version = info.get("version")
50 if not version:
51 continue
52 pkg_dir = os.path.join(ui_dir, "node_modules", *name.split("/"))
53 try:
54 with open(os.path.join(pkg_dir, "package.json"), encoding="utf-8") as fh:
55 meta = json.load(fh)
56 except (OSError, ValueError):
57 continue
58 # Platform-restricted packages (os/cpu) are checked like any other:
59 # skipping them is how sharp's LGPL libvips binaries passed unseen.
60 lic = meta.get("license", "")
61 if isinstance(lic, dict):
62 lic = lic.get("type", "")
63 out[(name, version)] = (str(lic or ""), pkg_dir)
64 collect(ui_dir, info.get("dependencies"), out)
65
66
67def main():

Callers 1

mainFunction · 0.70

Calls 4

strFunction · 0.85
loadMethod · 0.80
getMethod · 0.65
openFunction · 0.50

Tested by

no test coverage detected