Skip to content

fix: support scoped npm plugins - #3785

Merged
rekram1-node merged 4 commits into
anomalyco:devfrom
riatzukiza:feat/allow-scoped-npm-plugins
Nov 4, 2025
Merged

rekram1-node merged 4 commits into
anomalyco:devfrom
riatzukiza:feat/allow-scoped-npm-plugins

Conversation

@riatzukiza

@riatzukiza riatzukiza commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

Scoped Plugin Bug

  • Loader currently does plugin.split("@") (packages/opencode/src/plugin/index.ts:37), so a scoped name like @promethean-os/opencode-openai-codex-auth becomes pkg === "" and version === "promethean-os/opencode-openai-codex-auth".
  • BunProc.install then records that empty package key in the cache manifest (packages/opencode/src/bun/index.ts:60-94), producing "": "promethean-os/opencode-openai-codex-auth" and never installing the real module. The follow-up import resolves to /home/err/.cache/opencode/node_modules, triggering the “Cannot find module …” error you’re seeing.
  • Parse plugin strings from the rightmost @ (or use npm-package-arg) so scoped packages stay intact, e.g. const at = plugin.lastIndexOf("@"); const pkg = at > 0 ? plugin.slice(0, at) : plugin; const version = at > 0 ? plugin.slice(at + 1) : "latest";.
  • After patching, clear ~/.cache/opencode and restart so the dependency file is regenerated with the correct scoped package key.
    Next step: adjust the loader parsing logic and rebuild; rerun with the scoped plugin to confirm it resolves.

closes: #3392

Comment thread .gitignore
@@ -11,3 +11,5 @@ playground
tmp
dist
.turbo
**/.serena

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these because my bot would have dumped a load of memory files you may not want, and this is a common/popular agent framework that people should be able to/allowed to use on this project with out polluting the git.

@rekram1-node rekram1-node self-assigned this Nov 3, 2025
@rekram1-node rekram1-node changed the title Feat/allow scoped npm plugins fix: support scoped npm plugins Nov 3, 2025
@rekram1-node
rekram1-node force-pushed the feat/allow-scoped-npm-plugins branch from 4ead262 to 823ed63 Compare November 4, 2025 15:10
@rekram1-node
rekram1-node merged commit 6f00286 into anomalyco:dev Nov 4, 2025
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
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.

[bug] Add scoped npm package as plugin shows error on startup

2 participants