anomalyco / anomalyco/opencode
plugin: Git subdirectory package fails to install from GitHub
@jlongster is already working on this.
Since Sep 5, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
A plugin configured from a GitHub monorepo subdirectory fails to install in the OpenCode beta server. OpenCode accepts the ::path: package syntax, but the NPM staging step attempts to read package.json from the repository root instead of the requested subdirectory.
Environment
- opencode version: 0.0.0-beta-19151
- OS: Darwin 25.6.0 (darwin arm64)
- Terminal: Ghostty, TERM=xterm-256color, COLORTERM=truecolor
- Shell: /bin/zsh
- Install/channel: beta
- Active plugins: Other configured local plugins load; the failing package is
github:R44VC0RP/plugins#main::path:packages/ultra
Reproduction
-
Configure a plugin using a GitHub monorepo subdirectory:
{ "plugins": [ "github:R44VC0RP/plugins#main::path:packages/ultra" ] } -
Start or refresh the OpenCode server.
-
Alternatively, reproduce the package-manager failure directly:
mkdir -p /tmp/opencode-plugin-test cd /tmp/opencode-plugin-test npm pack --dry-run --json \ 'github:R44VC0RP/plugins#main::path:packages/ultra'
Expected Behavior
OpenCode should install and load the package from packages/ultra, using:
packages/ultra/package.json
The plugin should then be imported and activated.
Actual Behavior
The install fails before the plugin module is imported:
NpmInstallFailedError:
Could not read package.json:
ENOENT: no such file or directory,
open .../.npm/_cacache/tmp/git-clone.../package.json
OpenCode reports the generic error:
Plugin failed to load
Additional Context
The server log entry for this failure was:
role=server
target=github:R44VC0RP/plugins#main::path:packages/ultra
ref=err_2d4d239b
cause=NpmInstallFailedError
cause detail=ENOENT reading .../.npm/_cacache/tmp/git-clone.../package.json
The referenced GitHub repository is public and contains:
packages/ultra/package.json
packages/ultra/index.ts
It does not contain a package.json at the repository root.
The failure is reproducible with both the GitHub shorthand and a full git+https URL. The NPM package argument parser recognises the ::path:packages/ultra suffix as a Git subdirectory, but the subsequent remote Git staging/read step still looks for the root package.json.
The OpenCode server itself is healthy, and the package dependency @opencode-ai/plugin@0.0.0-dev-19114 is available from NPM. No GitHub or NPM credentials are required for this public repository, and no credential-related error appears in the logs.
OpenCode's source contains a test for Git subdirectory installs using a local Git fixture in packages/core/test/npm.test.ts, suggesting that remote GitHub subdirectory handling is either incomplete or incompatible with the current NPM/pacote implementation.
A workaround is to use a local checkout of the subdirectory or publish the plugin as a standalone registry package.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.