Fix OpenCode package file whitelist#1517
Open
solanab wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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