feat(config): deduplicate plugins by name with priority-based resolution
Summary
- Deduplicate plugins by name so that when the same plugin is loaded from multiple sources, only the highest priority one is used
Problem
Previously, if the same plugin existed in both opencode.json and .opencode/plugin/ directory, both would be loaded.
- Example:
[email protected](npm) +oh-my-opencode.js(local) → both executed
Solution
-
getPluginName: Extract canonical name from plugin specifier (supports file:// URLs, npm packages, scoped packages) -
deduplicatePlugins: Deduplicate by name, later entries (higher priority) win
Priority (highest to lowest)
- Local
plugin/directory - Local
opencode.json - Global
plugin/directory - Global
opencode.json
Tests
- Unit tests for
getPluginName(file URLs, npm packages, scoped packages) - Unit tests for
deduplicatePlugins(priority resolution, order preservation) - Integration test for local plugin overriding global config
@rekram1-node Thanks for the review. I updated some implementation. Feel free to check when you're available!
Just rebased the latest dev branch and resolved conflicts.
this pr is genius
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number>orCloses #<number>to this PR description
See CONTRIBUTING.md for details.
Fixes #7427
/review
lgtm
can u rebase this? looks like a bunch of random commits got picked up
can u rebase this? looks like a bunch of random commits got picked up
sure thing, just rebased @rekram1-node
/review
lgtm