Skip to content

fix: resolve plugin host root from published dist layout#851

Closed
KehaoC wants to merge 1 commit intojackwener:mainfrom
KehaoC:codex/fix-plugin-host-root
Closed

fix: resolve plugin host root from published dist layout#851
KehaoC wants to merge 1 commit intojackwener:mainfrom
KehaoC:codex/fix-plugin-host-root

Conversation

@KehaoC
Copy link
Copy Markdown
Contributor

@KehaoC KehaoC commented Apr 7, 2026

Summary

Fixes plugin host package linking for published builds by resolving the real @jackwener/opencli package root from the running module path instead of assuming it is always one directory up.

In published installs, src/plugin.ts compiles under dist/src/plugin.js, so the old dirname + '..' logic could point plugin node_modules/@jackwener/opencli at dist/ instead of the package root. That breaks package export resolution for imports like @jackwener/opencli/registry.

Changes

  • Add resolveHostOpencliRoot() to walk upward until it finds the host package package.json.
  • Use that helper for plugin host symlinking and esbuild binary lookup.
  • Add a regression test for resolving from a compiled dist/src/plugin.js layout.

Validation

  • npm test -- --run src/plugin.test.ts
  • npm run typecheck

Fixes #843
Refs #722

@KehaoC KehaoC closed this Apr 7, 2026
@KehaoC KehaoC deleted the codex/fix-plugin-host-root branch April 7, 2026 06:51
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]: install plugins get a warning, cannot find @jackwener/opencli/registry

1 participant