Skip to content

mcp: pin npm pack contents with a files allowlist and a test - #89

Merged
minerva-sky merged 1 commit into
codenamev:mainfrom
minerva-sky:fix/npm-pack-contents
Oct 12, 2026
Merged

minerva-sky merged 1 commit into
codenamev:mainfrom
minerva-sky:fix/npm-pack-contents

Conversation

@minerva-sky

Copy link
Copy Markdown
Collaborator

What

  • `mcp/package.json` gains a `files` allowlist: `index.js` and `README.md` (npm always adds `package.json`). The published set is unchanged: `npm pack --dry-run` ships the same three files before and after.
  • New `mcp/test/pack-contents.test.js` runs `npm pack --dry-run --json` and asserts the exact shipped set, plus a negative check for `test/`, `node_modules/`, the lockfile, `.tgz` and `.test.js`. CI's existing `npm test` step in `mcp/` runs it on every PR, so no new workflow step.

Why

`.npmignore` was the only guard, and a denylist can only name mistakes it already knows about. A new fixture dir or a stray tarball would reach npm silently. With an allowlist, adding a shipped file is a deliberate edit to `EXPECTED_FILES` in the same PR. This is the sibling of the gem pack-contents gate in codenamev/agentic#62 from the same cross-repo pass.

Not touched: `mcp/.npmignore` is now redundant and can be deleted in a follow-up or in this PR by a maintainer. #85 itself (the package needing the framework files next to `index.js`) stays open; this PR only makes the tarball contents explicit so that fix lands with a test to update.

Test

```
cd mcp && node --test test/pack-contents.test.js
ℹ tests 3 pass 3 fail 0
```

🤖 Generated with Claude Code

Replace the .npmignore-only guard with an explicit package.json files
allowlist (index.js, README.md) and a node:test that runs
npm pack --dry-run and asserts the exact shipped set. CI's existing
`npm test` step in mcp/ picks it up, so any new file reaching the tarball
is a deliberate edit to EXPECTED_FILES rather than a publish-time surprise.

Refs codenamev#85 (published package contents).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants