Repository navigation
Closed
Labels
pluginsPlugin system / discovery / marketplacePlugin system / discovery / marketplace
Description
Context
feat/npm-source-resolution (PR #3) lands npm source resolution: resolveSource({type:"npm", …}) → resolveNpm → defaultNpmFetcher (npm pack + tar), exact-version caching, version-as-sha pin, plus the npmPackArgs helper and an option-like-package injection guard. It is green (tsc, 100% coverage, eslint, quire) and smoke-tested live (npm pack is-number@7.0.0 resolved + cached). A /code-review pass found the non-blocking items below.
Tasks
- Medium — fragile npm-output parse.
defaultNpmFetcher(src/resolve.ts~lines 54–61) doesJSON.parse(out.slice(out.indexOf("[")))[0]. Aprepack/preparescript that prints a[(e.g.[build] done) makesindexOfland on the wrong bracket and the parse throws; if there is no[,indexOfreturns-1,slice(-1)yields the last char, andJSON.parse/[0]throw a cryptic error. Fix: parse npm's--jsonoutput robustly (e.g. take the last JSON value, or guardidx < 0/ empty-array and throw a descriptiveSourceError). Add a test with prepack-style noise / no-bracket output. - Medium — undocumented fetcher contract.
resolveNpmcache-hit (src/resolve.ts~lines 167–178) returnsdir: <cacheDir>/package, ignoring thedira customNpmFetcherreturned on the miss path. A custom fetcher that extracts elsewhere is authoritative on miss but silently overridden on later resolves. Fix: document that anNpmFetcherMUST extract to<destDir>/package, or persist + read the fetcher's returned dir. - Low — stale docs (now also npm). Update:
resolveSourcedocstring "git is the only side effect";ResolveOptions.cacheRootcomment (only mentions<cacheRoot>/git/<key>);ResolvedSource.shacomment "(git sources)". All now also apply to npm sources. - Low — disk accumulation. The unpinned-spec re-fetch path leaves the prior tarball in
cacheDir; clean it up.
Acceptance criteria
- Prepack-noise / no-bracket npm output handled gracefully (descriptive error, with a test).
- Fetcher
<destDir>/packagecontract documented (or the returned dir honored). - Docstrings updated;
src/resolve.tsstays at 100% coverage.
References
- PR: feat: resolve npm sources via npm pack #3 · branch
feat/npm-source-resolution - Spec:
spec/functional/FR-004-source-resolution.md - Related: the option-like-
packageguard already added in this PR (reqArginsrc/sources.ts, FR-004-CON-3) — see the git-hardening issue for extending it to git fields.
Metadata
Metadata
Assignees
Labels
pluginsPlugin system / discovery / marketplacePlugin system / discovery / marketplace
Activity
harden: robust npm pack parse, fetcher-dir contract, cache hygiene
kreneskyp commentedon Jun 28, 2026
Build-out complete — pushed to
feat/npm-source-resolution(PR #3), commitdfb3cd6. All four review follow-ups implemented with Red-Green TDD.parseNpmPackJson(out)that scans every candidate[and returns the first parsing to a non-empty JSON array, so prepack/prepare stdout noise (e.g.[build] done) no longer mis-parses; no-bracket / empty-array output now throws a descriptiveSourceErrorinstead of a cryptic crash. (+3 tests)NpmFetcherthat a fetcher MUST extract to<destDir>/package, and that an exact-version cache hit serves<cacheDir>/packagedirectly (customdirhonored on miss, ignored on later cached resolves).resolveSourceside-effect note,ResolveOptions.cacheRoot, andResolvedSource.shanow all cover npm sources.rmSynces the cache dir before re-extract so stale tarballs don't pile up. (+1 test)Gates: tests 31 passed (+4) ·
src/resolve.ts100% coverage ·tsc --noEmitclean · eslint + prettier clean ·quire validateclean (pre-existing warnings only).Note: the
make lintwrapper's nestedformat:checkfails on a pre-existing corepack version mismatch (configured pnpm@10.33.4 vs installed 11.5.2) — unrelated; eslint + prettier pass run directly. Worth aligningpackageManager.feat: resolve npm sources via npm pack (#3)
kreneskyp commentedon Jun 28, 2026
Merged. PR #3 (npm source resolution + these review follow-ups) squash-merged to
mainas4d7b41d. All four follow-ups (robust npm-pack parse, fetcher-dir contract, stale docs, cache hygiene) are in main, plus the spec backsync (FR-004-AC-12/13, CON-4, TC-027/028). First leg of the kit release train done.