Add BubblegumV2 to core collection plugin selector#98
Add BubblegumV2 to core collection plugin selector#98MarkSackerberg wants to merge 3 commits intomainfrom
Conversation
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.
Summary by CodeRabbit
WalkthroughAdds 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
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
📒 Files selected for processing (4)
src/commands/core/collection/create.tssrc/lib/types/pluginData.tssrc/prompts/pluginInquirer.tssrc/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.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/commands/core/collection/create.ts (1)
100-108: 🧹 Nitpick | 🔵 TrivialRoute
--pluginsFilereads 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
📒 Files selected for processing (3)
src/commands/core/collection/create.tssrc/prompts/createAssetPrompt.tssrc/prompts/pluginSelector.ts
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.