-
Notifications
You must be signed in to change notification settings - Fork 0
Add plugin/marketplace commands #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Export function to allow reuse in marketplace.ts - Use HOME env var with homedir() fallback for consistency
- Add enablePlugin() to add plugins to .construct.json - Add disablePlugin() to remove plugins from config - Add listEnabledPlugins() to show enabled plugins - Include comprehensive test coverage
- Add addMarketplace() to clone GitHub marketplaces - Add removeMarketplace() to unregister and optionally delete - Add updateMarketplace() to git pull updates - Add listMarketplaces() to show known marketplaces - Support GitHub URL and owner/repo shorthand formats - Include comprehensive test coverage
- Add 'construct plugin' command for plugin management - Add 'plugin enable/disable' for toggling plugins - Add 'plugin --list-enabled' flag - Add 'plugin marketplace' with add/remove/update/list subcommands - Add mutual exclusivity for update [name] and --all flags - Improve error messages for invalid subcommand usage
Document the plugin and marketplace commands including: - CLI usage examples - Implementation details - Error handling behavior - Testing strategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds CLI commands for managing plugins and marketplaces externally from Claude, allowing users to enable/disable plugins and add/remove/update marketplaces via the command line.
Changes:
- Added plugin management commands (enable, disable, list-enabled)
- Added marketplace management commands (add, remove, update, list)
- Extended CLI argument parsing to support nested subcommands using yargs
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scanner.ts | Exported getKnownMarketplacesPath() and added HOME environment variable fallback |
| src/plugin.ts | New file implementing plugin enable/disable/list operations |
| src/plugin.test.ts | Comprehensive unit tests for plugin operations |
| src/marketplace.ts | New file implementing marketplace add/remove/update/list operations with git integration |
| src/marketplace.test.ts | Comprehensive unit tests for marketplace operations |
| src/cli.ts | Extended to support nested subcommands for plugin and marketplace management |
| plugin.md | Detailed documentation of the plugin management implementation |
| index.ts | Added command routing for new plugin and marketplace subcommands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@scaryrawr I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@scaryrawr I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```typescript | ||
| export interface CliArgs { | ||
| command: "run" | "operator" | "plugin"; | ||
| // ... existing fields ... | ||
| pluginSubcommand?: "enable" | "disable"; | ||
| listEnabled?: boolean; | ||
| marketplaceSubcommand?: "list" | "add" | "remove" | "update"; | ||
| pluginName?: string; | ||
| marketplaceTarget?: string; // marketplace name or URL | ||
| updateAll?: boolean; | ||
| } |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CliArgs interface documentation in plugin.md shows listEnabled as an optional boolean field, but the actual implementation in src/cli.ts uses listEnabledPlugins instead. This inconsistency could confuse developers reading the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
| await saveConfig({ | ||
| enabledPlugins: [...enabledPlugins, pluginName], | ||
| lastUsed: new Date().toISOString(), | ||
| }); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The saveConfig call is missing proper error handling. If the file write fails (due to permissions or disk space issues), the config object will be partially modified in memory but not persisted. Consider wrapping this in a try-catch block and handling errors appropriately, or let the error propagate up to be handled by the caller in index.ts.
| .command( | ||
| "update [name]", | ||
| "Update marketplaces", | ||
| (updateYargs) => | ||
| updateYargs | ||
| .positional("name", { | ||
| type: "string", | ||
| conflicts: "all", | ||
| }) | ||
| .option("all", { | ||
| type: "boolean", | ||
| alias: "a", | ||
| description: "Update all git-based marketplaces", | ||
| default: false, | ||
| }), | ||
| (args) => { | ||
| command = "plugin"; | ||
| marketplaceSubcommand = "update"; | ||
| marketplaceTarget = args.name as string | undefined; | ||
| updateAll = args.all as boolean; | ||
| }, |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The yargs configuration uses "conflicts" between "name" positional and "all" option for the update command. However, the logic in index.ts (lines 62-73) doesn't handle the case where neither is provided gracefully before reaching the error message. Consider adding validation or documentation to make the expected behavior clearer.
| export async function updateAllMarketplaces( | ||
| paths?: MarketplacePaths, | ||
| ): Promise<void> { | ||
| const knownMarketplaces = await readKnownMarketplaces(paths); | ||
| const githubMarketplaces = Object.entries(knownMarketplaces).filter( | ||
| ([, info]) => info.source.source === "github", | ||
| ); | ||
|
|
||
| for (const [name] of githubMarketplaces) { | ||
| await updateMarketplace(name, paths); | ||
| } | ||
|
|
||
| console.log(`Updated ${githubMarketplaces.length} marketplace(s)`); | ||
| } |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateAllMarketplaces function updates marketplaces sequentially but prints a summary message about the count after all updates complete. However, if any individual update fails (which calls process.exit(1) in runGitCommand), the summary message will never be printed. Consider either handling errors more gracefully or documenting this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
| if ( | ||
| args.listEnabledPlugins && | ||
| !args.pluginSubcommand && | ||
| !args.marketplaceSubcommand | ||
| ) { | ||
| await listEnabledPlugins(); | ||
| process.exit(0); | ||
| } |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional logic that checks for list-enabled only when no subcommands are present could lead to confusing behavior. If a user runs "construct plugin enable foo --list-enabled", the --list-enabled flag will be silently ignored. Consider either making these mutually exclusive in the yargs configuration or providing a warning when incompatible options are used together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
* Initial plan * fix: add check for empty marketplace list in updateAllMarketplaces Co-authored-by: scaryrawr <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: scaryrawr <[email protected]>
* Initial plan * fix: preserve all config fields when saving in plugin enable/disable Co-authored-by: scaryrawr <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: scaryrawr <[email protected]>
|
@scaryrawr I've opened a new pull request, #7, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@scaryrawr I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@scaryrawr I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return; | ||
| } | ||
|
|
||
| await saveConfig({ |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate await saveConfig({ statement on lines 45-47. Line 45 appears to be leftover code that should be removed. The try-catch block starting at line 46 is the intended implementation.
| await saveConfig({ |
Make it easier to manage marketplaces and plugins from outside of claude