Fix OpenCode package file whitelist#1517
Conversation
|
Review note after reading the PR body and diff: The packaging problem is concrete and a One thing reviewers should check carefully after rebasing: current So I would not merge this exact diff without first answering one packaging question:
If the latter, the whitelist likely needs to include the Pi extension path as well. If the former, the PR body/test should probably say explicitly that Pi does not consume this packed artifact, so reviewers know the whitelist is not narrowing another supported harness by accident. Also mechanical: this targets |
What problem are you trying to solve?
OpenCode installs Superpowers from the git-backed npm package spec documented in
docs/README.opencode.md:{ "plugin": ["superpowers@git+https://github.com/obra/superpowers.git"] }In a clean OpenCode 1.14.48 run using that plugin spec, the resolved package landed at:
~/.cache/opencode/packages/superpowers@git+https:/github.com/obra/superpowers.git/node_modules/superpowersThat package included repo and harness files that OpenCode does not need at runtime, including
.github/,docs/,hooks/,scripts/,tests/,.claude-plugin/,.codex-plugin/, and.cursor-plugin/.npm pack --dry-run --json git+https://github.com/obra/superpowers.gitreproduced the same issue and warned that no.npmignorewas present, so npm fell back to.gitignore.What does this PR change?
This PR adds a
package.jsonfileswhitelist for the OpenCode npm package so only the plugin entrypoint, assets, and skills are packed. It also adds an OpenCode packaging regression test that rejects top-level repo/test/docs/hook/harness files while ensuring required runtime files and nested skill scripts remain present.Is this change appropriate for the core library?
Yes. This is core packaging infrastructure for the documented OpenCode install path. It is not project-specific, does not add a new skill, and does not integrate a third-party service.
What alternatives did you consider?
I considered adding
.npmignore, but that is easier to accidentally drift because it must blacklist every non-runtime path. Afileswhitelist is smaller and makes the intended runtime artifact explicit.I also considered excluding all
scripts/paths, but that would break skill-owned scripts such asskills/brainstorming/scripts/server.cjs. The whitelist keepsskills/intact and only removes top-level non-runtime paths.Does this PR contain multiple unrelated changes?
No. The package whitelist and the regression test cover one packaging boundary issue.
Existing PRs
Searches reviewed included
npmignore,npm pack,package size,package.json files, andopencode package files. Related-but-different OpenCode PRs included OpenCode plugin loading/caching/docs changes; they did not address package contents.Environment tested
New harness support (required if this PR adds a new harness)
Not applicable. This does not add a new harness.
Clean-session transcript for "Let's make a react todo list"
Not applicable. This PR does not add a new harness.
Evaluation
npm pack --dry-run --json git+https://github.com/obra/superpowers.gitproduced 145 entries and included top-level.github/,docs/,hooks/,scripts/, andtests/paths. OpenCode also resolved the git plugin into cache with those same non-runtime paths.npm pack --dry-run --jsonproduces 52 entries:.opencode/plugins/superpowers.js,assets/,skills/,package.json,README.md, andLICENSE. OpenCode successfully loaded the local package path and initialized skills.Verification run:
bash tests/opencode/test-package-files.sh npm pack --dry-run --json OPENCODE_CONFIG_DIR=/tmp/opencode/superpowers-pr-local opencode run --print-logs "Tell me about your superpowers"Rigor
superpowers:writing-skillsand completed adversarial pressure testing (paste results below)This is not a skills content change. The regression test includes negative checks for forbidden top-level paths and positive checks for required runtime files, including nested skill scripts.
Human review