Skip to content

Add BubblegumV2 to core collection plugin selector#98

Open
MarkSackerberg wants to merge 3 commits intomainfrom
feat/bubblegumV2Plugin
Open

Add BubblegumV2 to core collection plugin selector#98
MarkSackerberg wants to merge 3 commits intomainfrom
feat/bubblegumV2Plugin

Conversation

@MarkSackerberg
Copy link
Copy Markdown
Contributor

Adds BubblegumV2 as an available plugin when creating core collections, both via interactive wizard and --pluginsFile. Also sorts plugin list alphabetically.

This was a user request. Creating a collection with bubblegumV2 plugin is currently possible with "mplx bg collection create", but not with the ususal core command.

Adds BubblegumV2 as an available plugin when creating core collections,
both via interactive wizard and --pluginsFile. Also sorts plugin list
alphabetically.
BubblegumV2 only allows a subset of plugins (Attributes, Royalties,
UpdateDelegate, PermanentFreeze/Transfer/Burn). Validate compatibility
before creation and error early instead of failing on-chain.

The constraint system supports multiple plugins with allow lists via
pluginAllowLists in pluginSelector.ts.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Summary by CodeRabbit

  • New Features
    • BubblegumV2 plugin is now available when creating collections.
    • Plugin compatibility checks added across selection, file import, and configuration flows; users are prevented from choosing incompatible plugin combinations and receive clear error messages.
    • Plugin selection UI now considers compatibility constraints, reducing invalid choice combinations.

Walkthrough

Adds Bubblegum V2 plugin support and enforces plugin compatibility checks across selection and file-based flows; moves plugin validation earlier in creation flows and ensures getPluginData always returns the derived plugin data when present.

Changes

Cohort / File(s) Summary
Plugin Type Definitions
src/lib/types/pluginData.ts
Added bubblegumV2 to Plugin union and optional bubblegumV2?: { type: 'BubblegumV2' } to PluginData.
Plugin Selection & Utilities
src/prompts/pluginSelector.ts
Reworked plugin list metadata, added plugin allow-lists and compatibility logic; added pluginDataToPluginIds(data) and validatePluginCompatibility(selected) exports.
Plugin Configuration Prompt
src/prompts/pluginInquirer.ts
Added branch to configure bubblegumV2 (sets { type: 'BubblegumV2' } with no extra prompts).
Asset Prompt Integration
src/prompts/createAssetPrompt.ts
Now validates selected plugins via validatePluginCompatibility and throws on incompatibility before running configurator.
Collection Create Command
src/commands/core/collection/create.ts
Refactored getPluginData() to aggregate plugin data from flags/file, run compatibility validation (via validatePluginCompatibility and pluginDataToPluginIds), and return plugin data or error appropriately.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as Collection Create Command
    participant Selector as Plugin Selector
    participant Validator as Plugin Validator
    participant Config as Plugin Configurator

    User->>CLI: start collection create (--plugins / --pluginsFile)
    CLI->>Selector: retrieve selected plugin choices / parse plugins file
    Selector-->>CLI: selectedPlugins / pluginData
    CLI->>Validator: validatePluginCompatibility(plugin IDs)
    alt Compatible
        Validator-->>CLI: null
        CLI->>Config: pluginConfigurator(selectedPlugins / pluginData)
        Config-->>CLI: pluginData
        CLI-->>User: proceed with creation
    else Incompatible
        Validator-->>CLI: error message
        CLI-->>User: abort with error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Core Collection Wizard #20 — modifies collection creation plugin handling and selection/validation flow (closely related to compatibility and getPluginData changes).

Suggested reviewers

  • tonyboylehub
  • blockiosaurus
  • nhanphan
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding BubblegumV2 as an available plugin in the core collection plugin selector.
Description check ✅ Passed The description is relevant to the changeset, explaining that BubblegumV2 is now available for core collection creation, responding to a user request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/bubblegumV2Plugin

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/commands/core/collection/create.ts`:
- Around line 111-117: The code is validating compatibility using raw pluginData
object keys (pluginData) which may be misspelled or non-canonical (e.g.,
"pTranfer" from pluginInquirer.ts) so update create.ts to derive canonical
Plugin ids from each pluginData entry's type discriminator (the property defined
in the PluginData type) instead of Object.keys(pluginData); map each entry to
its entry.type (or normalize via a canonical plugin id map) and pass that array
of Plugin ids to validatePluginCompatibility; alternatively, if you must accept
external keys, first validate/normalize the keys against the canonical plugin id
map before calling validatePluginCompatibility to prevent bypasses.
- Around line 89-119: In the createAssetPrompt.ts wizard flow, after calling
pluginConfigurator(...) capture the configured plugin list and run
validatePluginCompatibility(...) on it (same as done in create.ts) and handle
any returned error by failing the flow (e.g., this.error(...) or throwing the
error); specifically, after pluginConfigurator(selectedPlugins) returns, call
validatePluginCompatibility(selectedPlugins or the configured plugin keys) and
abort with the same error handling used in the --plugins/--pluginsFile branches
if an incompatibility is reported.
- Around line 100-105: The branch handling flags.pluginsFile uses direct
fs.existsSync and fs.readFileSync to populate pluginData; replace that logic
with the project's file utility functions (the repository file helper used
elsewhere) to perform existence checks, read and JSON-parse the file and
centralize error handling instead of direct fs calls; update the code in the
flags.pluginsFile branch to call the shared file utility (returning PluginData)
and surface errors via the same error patterns used elsewhere so pluginData is
assigned from the utility rather than from fs.readFileSync.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1a20e950-0d1c-4115-b4f3-92883584618b

📥 Commits

Reviewing files that changed from the base of the PR and between 1c81bea and 3bc4e46.

📒 Files selected for processing (4)
  • src/commands/core/collection/create.ts
  • src/lib/types/pluginData.ts
  • src/prompts/pluginInquirer.ts
  • src/prompts/pluginSelector.ts

Derive canonical Plugin IDs from each entry's type field instead of
relying on PluginData object keys (which have a pTranfer typo).
Also add validation to the wizard flow in createAssetPrompt.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/commands/core/collection/create.ts (1)

100-108: 🧹 Nitpick | 🔵 Trivial

Route --pluginsFile reads through the shared file helper.

Line 105 uses direct fs.readFileSync. As per coding guidelines, src/**/*.ts: "Use utilities in src/lib/file.ts for file handling operations". Consider using the repository's file utility for consistency and centralized error handling.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/core/collection/create.ts` around lines 100 - 108, Replace
direct fs calls in the --pluginsFile branch with the repository's file utilities
from src/lib/file.ts: use the file helper's existence check and read function
(e.g., fileExists/readFile or equivalent exports) instead of fs.existsSync and
fs.readFileSync when populating pluginData, and preserve the current error path
by catching and passing the helper error into this.error(`Failed to read plugin
data from file: ${err}`); update imports in create.ts accordingly and keep
references to flags.pluginsFile, pluginData, and this.error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/commands/core/collection/create.ts`:
- Around line 86-119: Update the getPluginData() in asset/create.ts to mirror
collection/create.ts by validating plugin compatibility: after plugin selection
(when flags.plugins and selectedPlugins is truthy) call
validatePluginCompatibility(selectedPlugins as Plugin[]) and error on
incompatibility before pluginConfigurator, and when loading from
flags.pluginsFile, validate file contents by parsing into PluginData then call
validatePluginCompatibility(pluginDataToPluginIds(pluginData)) and error on
incompatibility; also add a final check that if pluginData exists run
validatePluginCompatibility(pluginDataToPluginIds(pluginData)) to prevent
incompatible plugins from being used.

---

Duplicate comments:
In `@src/commands/core/collection/create.ts`:
- Around line 100-108: Replace direct fs calls in the --pluginsFile branch with
the repository's file utilities from src/lib/file.ts: use the file helper's
existence check and read function (e.g., fileExists/readFile or equivalent
exports) instead of fs.existsSync and fs.readFileSync when populating
pluginData, and preserve the current error path by catching and passing the
helper error into this.error(`Failed to read plugin data from file: ${err}`);
update imports in create.ts accordingly and keep references to
flags.pluginsFile, pluginData, and this.error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7e9ba7fa-6138-45e4-9fa4-d768d4f01a6f

📥 Commits

Reviewing files that changed from the base of the PR and between 3bc4e46 and 840ab2a.

📒 Files selected for processing (3)
  • src/commands/core/collection/create.ts
  • src/prompts/createAssetPrompt.ts
  • src/prompts/pluginSelector.ts

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