Skip to content

fix(plugin): support package subpath exports - #49863

Draft
Dante-dan wants to merge 1 commit into
anomalyco:v2from
Dante-dan:plugin-subpath
Draft

Dante-dan wants to merge 1 commit into
anomalyco:v2from
Dante-dan:plugin-subpath

Conversation

@Dante-dan

@Dante-dan Dante-dan commented Sep 18, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #49852
Closes #49852

Issue: #49852

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Treats bare package subpaths such as opencode-pty/v2 as npm registry packages, installs their package root, and preserves the full requested specifier when resolving the plugin entrypoint. Explicit Git package specs remain supported.

How did you verify your code works?

  • packages/core: bun test test/npm.test.ts — 17 passed
  • packages/plugin: bun test test/host.test.ts — 10 passed
  • bun run typecheck in packages/util, packages/plugin, and packages/core
  • oxlint on the changed files — 0 warnings and 0 errors

Screenshots / recordings

No UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@Dante-dan

Copy link
Copy Markdown
Author

Reviewing this branch against the latest report on #49852 exposed an ambiguity: registrySubpath() also rewrites valid GitHub shorthand. On this head, Npm.isRegistryPackage("anomalyco/opencode") returns true and its cache key is anomalyco@latest; npm-package-arg classifies the same input as Git. The existing tests pass (17 npm, 10 host), but do not cover that compatibility case.

I propose preserving bare Git shorthand and using an explicit registry selector, for example npm:opencode-pty/v2, to install the root package and resolve ./v2. Alternatively, bare name/path would need a defined registry-versus-Git precedence and registry validation. Could a maintainer approve the explicit-selector approach or confirm the intended precedence before I revise this PR? The 2.0.22 report describes the released loader, not a test of this branch.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant