[PR #5957] feat(config): deduplicate plugins by name with priority-based resolution #11668

Closed
opened 2026-02-16 18:16:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5957

State: closed
Merged: Yes


Summary

Problem

Previously, if the same plugin existed in both opencode.json and .opencode/plugin/ directory, both would be loaded.

  • Example: oh-my-opencode@2.4.3 (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)

  1. Local plugin/ directory
  2. Local opencode.json
  3. Global plugin/ directory
  4. 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
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5957 **State:** closed **Merged:** Yes --- ## Summary - Deduplicate plugins by name so that when the same plugin is loaded from multiple sources, only the highest priority one is used - Closes https://github.com/anomalyco/opencode/issues/7427 ## Problem Previously, if the same plugin existed in both `opencode.json` and `.opencode/plugin/` directory, both would be loaded. - Example: `oh-my-opencode@2.4.3` (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) 1. Local `plugin/` directory 2. Local `opencode.json` 3. Global `plugin/` directory 4. 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
yindo added the pull-request label 2026-02-16 18:16:34 -05:00
yindo closed this issue 2026-02-16 18:16:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11668