Skip to content

Conversation

@CorentinLumineau
Copy link
Contributor

@CorentinLumineau CorentinLumineau commented Feb 2, 2026

Summary

When multiple versions of the same plugin are installed (e.g., my-plugin v1.0.0, v2.0.0, v3.0.0, v4.0.0), commands were displayed multiple times (e.g., /my-command appearing 4 times).

This PR adds deduplication logic in discoverInstalledPlugins() that:

  • Groups plugins by marketplace:name composite key
  • Compares versions using semver
  • Keeps only the highest version of each plugin per marketplace

Changes

  • Added safeParseVersion() helper for robust version parsing (handles v1.2, 1.2, invalid versions)
  • Added deduplicatePluginsByVersion() function
  • Added semver dependency for reliable version comparison
  • Modified discoverInstalledPlugins() to deduplicate before returning/caching

Edge Cases Handled

Case Handling
undefined/null version Default to "0.0.0"
Non-semver format (v1.2) Coerce to "1.2.0"
Invalid format (latest) Default to "0.0.0" + warning
Prerelease (1.0.0-alpha) Handled correctly (lower than 1.0.0)
Same name, different marketplaces Both kept (separate entities)

Test plan

  • Install multiple versions of the same plugin
  • Verify commands appear only once in the UI
  • Verify the highest version is used
  • Test with plugins from different marketplaces (both should appear)

When multiple versions of the same plugin are installed, commands were
displayed multiple times (e.g., /x:ask appearing 4 times for 4 versions
of ccsetup).

This fix adds deduplication logic in discoverInstalledPlugins() that:
- Groups plugins by marketplace:name composite key
- Compares versions using semver
- Keeps only the highest version of each plugin

Added:
- safeParseVersion() helper for robust version parsing
- deduplicatePluginsByVersion() function
- semver dependency for version comparison

Fixes duplicate plugin detection issue.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant