fix: export only default for opencode plugin loader compatibility#1
fix: export only default for opencode plugin loader compatibility#1bhodgens wants to merge 1 commit intodeiviuds:mainfrom
Conversation
Summary of ChangesHello @bhodgens, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical compatibility issue with the OpenCode plugin loader by streamlining the module's export structure. By removing all named exports and exclusively providing a default export, the change ensures that the plugin can be correctly loaded and utilized within the OpenCode environment, preventing runtime errors related to module resolution. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 Summary by CodeRabbit
WalkthroughThe public API of the module is restructured to export only the default plugin export from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses a compatibility issue with the OpenCode plugin loader by ensuring that the main entry point only has a default export. The change is simple and effective for its stated purpose. My review includes a suggestion to preserve the library's API by moving the removed named exports to a secondary entry point, which would prevent a breaking change for users who might be consuming this package as a library.
| // Plugin default export — must be the ONLY export for opencode plugin loader compatibility | ||
| export { default } from "./plugin.js" |
There was a problem hiding this comment.
This change correctly fixes the plugin compatibility issue. However, it removes all named exports, which is a breaking change for any consumers using this package as a library.
To avoid this, you could move the removed exports to a secondary entry point, for example src/lib.ts. This would preserve the library API.
You would then need to configure package.json to expose this new entry point, allowing imports like import { Mind } from 'opencode-brain/lib'.
This approach maintains both plugin compatibility and the library's usability.
Summary
OpenCode's Bun-based plugin loader fails to resolve the default export when the module has mixed named + default exports.
Problem
The plugin fails to load with:
The built output currently exports the default alongside 12+ named exports:
Working plugins (e.g. oh-my-opencode) export only default:
Fix
Changed
src/index.tsto only re-export the default plugin function, matching the pattern used by working OpenCode plugins.Testing