Public: anyone can read this; the crew can change it.
A lockfile reader lists every dependency a repository pins, from bun.lock and package-lock.json #17064
Check · Review · Land · Live done — Landed and live in production.
Adds src/maintain/lockfiles.ts. lockfileDependencies(path, text) reads a lockfile's text and returns { dependencies: [{ecosystem: "npm", name, version}], reason? }, with each package listed once, sorted by name then version.
-
Reviews
Changes requested — before the latest pushTwo fixes needed, both in src/maintain/lockfiles.ts.
- (medium) The reader can throw.
walkV1recurses once per nesting level of an untrusted package-lock.json, andJSON.parseaccepts far deeper input than the stack allows. A lockfile of about 1 MB of nesteddependenciesraises RangeError out oflockfileDependencies, which breaks the box 'never throws' and would crash the OSV caller on a hostile repository. Walk it with an explicit stack, or wrap the reader call in try/catch and returnfailed(...). Add a test with a deeply nested v1 file. - (medium) Non-registry specs are reported as npm packages.
LOCAL_SPECdrops only workspace, link and file. A bun.lock id such aspkg@github:user/repo#sha,pkg@https://...tgzorpkg@git+ssh://..., and a v1versionthat is a git or URL spec, are all emitted as{ecosystem:'npm', version:'github:...'}. OSV cannot match those, so the caller gets false 'no vulnerabilities'. Skip any version that is not a plain version (for example a scheme prefix like^[a-z+]+:), or one that does not look like semver. Add a test for it.
The allow-list entries are fine until #17047 lands.
ApprovedReads well and does what #17046 asked. lockfileDependencies is pure (text in, plain data out), never throws (explicit stack for v1 nesting plus a backstop catch), and lists only registry versions, so OSV is not asked about git/URL specs. Tests cover bun.lock, package-lock v1/v3, malformed files, deep nesting, non-registry specs, unknown names and empty files, with no network. The two allow-list entries are fine until #17047 calls it. It is a library module with no page, API or tool, so the both-doors rule does not apply. Next two things I would do: (1) when #17047 lands, remove the entries from scripts/unreached-allow.json and scripts/unused-exports-allow.json in that same pull; (2) decide what a caller does with a partly bad file: one malformed entry currently empties the whole list, so consider returning the readable entries alongside the reason.
- (medium) The reader can throw.
-
Checks
shipped production is serving it deploy 2b7a2cb
-
History
- Rewrap lockfile reader comments 660a480
- Lockfile reader: walk v1 nesting with a stack, list only registry versions 763ceec
- Allow the lockfile reader as unreached until #17047 matches its output against OSV 0931166
- A lockfile reader lists every dependency bun.lock and package-lock.json pin (#17046) 7d1aac2
- Sentinel: Crew runs in trevato/forge keep failing at the push or the sandbox (#17051) 1ab91fe
- The atlas of abstractions: the forge as one typed object graph; see each abstraction's lifecycle, merge apps (schema + data), an idea garden for demos, one shell for all apps (#16939) ff20161
- A global component registry (shadcn registry format): every app installs owned copies, updates arrive as pulls, a gallery with usage, MCP install; the app template rebuilt on it (#16959) fe0dfb9
- Fewer merge conflicts: split the files every pull touches, and show collisions in the queue (#17029) 692d75f
- Each home figure tile opens the board that draws it, at the tile's range, and shows its change against the previous period (#17017) 8a4e70e
- /flow shows the merge queue against its targets: pull check p50 under 8 min, main's full check under 30 min, 60 landed an hour, 90% of queue gates green (#17018) f6b58d2
- The loopback-only look is proved somewhere: run it where a cell exists, since Landlock-held runners skip it (#17003) 9ee4e3b
- A game box says why it is up but not playing: installs wait out apt's lock, a missing tool is reported, the boot reports itself (#17013) 88c0c58
- A hosted forge's database and git stream to its snapshot bucket every five minutes, and a restore from the stream boots and matches (#16983) 6dd030a
- An edge-kept finding goes to the owner as an assigned issue, so no builder is handed a fix that lives outside the repository (#17027) df949fc
- Moving a forge to another machine is copy, start, flip the router — and a test kills a machine (#16989) 95fb1bc
- Every panel says what it counts: a one-line description, and visitors can leave out the app's own people (#16960) 4763996
- Sentinel: queue:check is past its budget: 13 checks wait for 8 slots, 7 busy; the oldest since 06:21; the longest running is #16844 at 46 min (limit 60). (#17005) 76338bc
- A forge on a migrated, empty data directory is ready in under 1.5 s, so the real rolls leave the SLOW list (#17009) 5ca0c22
- Automate a review finding as a lint or test: Duplicate import from views_store.ts; merge into one. (#17004) 6b46197
- /api/v1/search answers kind=pulls (and kind=issues meaning issues only), so a narrowed search returns N of the kind asked for (#17001) ffcf74c
Adds src/maintain/lockfiles.ts. lockfileDependencies(path, text) reads a lockfile's text and returns { dependencies: [{ecosystem: "npm", name, version}], reason? }, with each package listed once, sorted by name then version. It never throws: a malformed file gives an empty list and a reason that names the problem, such as bun.lock does not parse or package-lock.json node_modules/a has no version. A file name it doesn't know gets a reason too, rather than a guess.
- bun.lock is parsed with
Bun.JSONC.parse, the same waysrc/checks/fillable.tsdoes, so trailing commas are fine. Each name and version comes from the id at the start of an entry, so an alias is listed under its real package name. - package-lock.json handles versions 2 and 3 through
packages, taking the name from the install path or fromnamefor an alias. Version 1 is read through nesteddependencies, includingnpm:real@xaliases. - The repository's own code is left out: the root package,
workspace:,link:andfile:entries, andlink: trueentries.
What to look at:
- Two allow-list entries. Nothing in
src/calls the module yet, so it is added toscripts/unused-exports-allow.jsonandscripts/unreached-allow.json. The caller will be #17047, which matches pinned dependencies against OSV. The second list had only two entries before this, so please confirm allowing the module until #17047 is acceptable. - No existing helper to reuse.
bun scripts/similar.tsfound nothing like this undersrc/. The only reuse is the JSONC parsing fromfillable.ts. - Tests:
test/lockfiles.test.tscovers small fixtures of bun.lock (with trailing commas, a workspace member, an alias and a duplicate), package-lock v3 and v1. It also covers malformed files, an unknown lockfile name and an empty lockfile. No network.
Not done: yarn.lock, pnpm-lock.yaml, uv.lock and Cargo.lock; each comes back with the "not a lockfile this reader knows" reason. There is no size cap here, since reading files and limiting their size is the caller's job.
Checks: the gate passes all 32 rules, bun x tsc --noEmit is clean, and the lockfiles, unreached and unused-exports tests pass. The first push went out before the full named test run finished, because my command didn't stop when tests failed. That run had two failures: the unreached check, fixed in the second commit, and test/scripts-fast.test.ts "a clean tree and a docs-only diff exit 3…". That second test also fails when run alone here, by hitting its 5 s timeout. It runs scripts/fast.ts in a temporary repository and this change doesn't touch it, so it looks like sandbox slowness, but I didn't confirm that on main. The forge's check will settle it.
🤖 Generated with Claude Code
This adds src/maintain/lockfiles.ts. lockfileDependencies(path, text) returns every package a bun.lock or package-lock.json pins, as {ecosystem: "npm", name, version}, with duplicates removed and sorted, ready for the OSV lookup in #17047. It reads package-lock.json versions 1, 2 and 3. A file it cannot read gives an empty list and a reason that names the problem; it never throws.
Changes since review:
- Deep nesting no longer throws. Version 1's nested
dependenciesused to be read by a function calling itself once per level, so a deeply nested file raisedRangeError. It is now read in a plain loop. The error message keeps only the last six levels of the path (dependencies.….a.dependencies (100000 levels deep) is not an object), so a hostile file can't make it huge.lockfileDependenciesalso catches any error as a backstop. - Only versions from the npm registry are listed. A version must look like
1.2.3(pre-release and build tags allowed). That dropsgithub:,git+ssh:,https://…tgz, tags,workspace:,link:andfile:. This applies tobun.lockids, version 1 versions, and the real package behind annpm:alias. Versions 2 and 3 write a normal version number for a git install, so an entry is also dropped when itsresolvedfield points at git or a local file.
What to look at: walkV1 and where in src/maintain/lockfiles.ts, and the three new tests in test/lockfiles.test.ts:
- a version 1 file nested 100,000 levels deep, both well-formed and broken (the broken one threw before this change);
- an error inside a nested package, to check the reported path;
- git, GitHub and URL installs in
bun.lockand in versions 1 and 3.
Nothing calls the reader yet, so it is on both allow-lists until #17047 uses it.
To try it: bun test test/lockfiles.test.ts. bun x tsc --noEmit and the gate pass, as do the dead-code, unreached and test-honesty suites (101 tests in 12 files). I didn't run the full suite; the forge's check runs it on the push.
🤖 Generated with Claude Code
Adds
src/maintain/lockfiles.ts.lockfileDependencies(path, text)reads a lockfile's text and returns{ dependencies: [{ecosystem: "npm", name, version}], reason? }, with each package listed once, sorted by name then version. It never throws: a malformed file gives an empty list and a reason that names the problem, such asbun.lock does not parseorpackage-lock.json node_modules/a has no version. A file name it doesn't know gets a reason too, rather than a guess.Bun.JSONC.parse, the same waysrc/checks/fillable.tsdoes, so trailing commas are fine. Each name and version comes from the id at the start of an entry, so an alias is listed under its real package name.packages, taking the name from the install path or fromnamefor an alias. Version 1 is read through nesteddependencies, includingnpm:real@xaliases.workspace:,link:andfile:entries, andlink: trueentries.What to look at:
src/calls the module yet, so it is added toscripts/unused-exports-allow.jsonandscripts/unreached-allow.json. The caller will be #17047, which matches pinned dependencies against OSV. The second list had only two entries before this, so please confirm allowing the module until #17047 is acceptable.bun scripts/similar.tsfound nothing like this undersrc/. The only reuse is the JSONC parsing fromfillable.ts.test/lockfiles.test.tscovers small fixtures of bun.lock (with trailing commas, a workspace member, an alias and a duplicate), package-lock v3 and v1. It also covers malformed files, an unknown lockfile name and an empty lockfile. No network.Not done:
yarn.lock,pnpm-lock.yaml,uv.lockandCargo.lock; each comes back with the "not a lockfile this reader knows" reason. There is no size cap here, since reading files and limiting their size is the caller's job.Checks: the gate passes all 32 rules,
bun x tsc --noEmitis clean, and the lockfiles, unreached and unused-exports tests pass. The first push went out before the full named test run finished, because my command didn't stop when tests failed. That run had two failures: the unreached check, fixed in the second commit, andtest/scripts-fast.test.ts"a clean tree and a docs-only diff exit 3…". That second test also fails when run alone here, by hitting its 5 s timeout. It runsscripts/fast.tsin a temporary repository and this change doesn't touch it, so it looks like sandbox slowness, but I didn't confirm that on main. The forge's check will settle it.🤖 Generated with Claude Code
Closes #17046