anomalyco / anomalyco/opencode

Plugin package with a subpath export fails to install (pkg/subpath parsed as GitHub repo)

Open
#49,852 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

A plugin configured with an npm subpath export fails to install. opencode-pty ships a V2 entrypoint as opencode-pty/v2 (via exports: { "./v2": ... }), but the spec is parsed as a GitHub repo instead of an npm subpath.

Reproducing the parse directly:

$ bun add opencode-pty/v2
error: GET https://api.github.com/repos/opencode-pty/v2/tarball/ - 404
error: opencode-pty/v2 failed to resolve

Via the server (opencode plugin add opencode-pty/v2 or "plugins": [{"package": "opencode-pty/v2"}]) the log shows NpmInstallFailedError with An unknown git error occurred.

Cause: Npm.isInstallablePackage (packages/util/src/npm.ts) resolves package specs with npm-package-arg, which parses name/subpath as the GitHub shorthand github:name/subpath. Expected behaviour would be to install the registry root and import the full requested specifier (same gap as the closed #16586; related #47517).

Plugins

opencode-pty@0.4.0 (configured spec opencode-pty/v2)

OpenCode version

2.0.8

Steps to reproduce
  1. opencode plugin add opencode-pty/v2 (or add "plugins": [{"package": "opencode-pty/v2"}] to opencode.json)
  2. Server logs NpmInstallFailedError / An unknown git error occurred; the plugin never loads.
  3. Isolate the parse: bun add opencode-pty/v2GET https://api.github.com/repos/opencode-pty/v2/tarball/ - 404
Operating System

Fedora Linux (x64)

Terminal

not relevant to the bug (server-side install path)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/util/src/npm.ts at Npm.isInstallablePackage and inspect how npm-package-arg parses the plugin specifier. Reproduce the failure with bun add opencode-pty/v2 and trace the server-side plugin install path. Done means opencode-pty/v2 is treated as an npm package with a subpath rather than a GitHub repository, and the plugin installation succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.