feat: plugin auto-disable + CLI commands (Phase 2.5 & 3.1)#131
Conversation
- Add auto-disable after 3 crashes in PluginRegistry with resetErrors() and isAutoDisabled() methods - Add plugin CLI commands: list, install, uninstall, link - Cross-platform plugins directory resolution - Tests for auto-disable behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR introduces plugin lifecycle management and a comprehensive CLI suite. It adds crash-threshold auto-disable functionality to PluginRegistry with error reset/query APIs, and implements four new CLI commands (list, install, uninstall, link) for plugin management with supporting utilities for directory resolution and manifest validation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 658f750e36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const resolvedPluginsDir = resolve(pluginsDir); | ||
| if ( | ||
| !resolvedPluginDir.startsWith(resolvedPluginsDir + '/') && | ||
| resolvedPluginDir !== resolvedPluginsDir |
There was a problem hiding this comment.
Reject plugins root path in uninstall validation
The safety check allows resolvedPluginDir === resolvedPluginsDir, so readied-plugin uninstall . is treated as valid and the later rmSync(pluginDir, { recursive: true, force: true }) call removes the entire plugins directory instead of a single plugin. This is a destructive data-loss path reachable from normal CLI input and should be blocked by requiring the uninstall target to be a strict child of the plugins directory.
Useful? React with 👍 / 👎.
| const resolvedPluginDir = resolve(pluginDir); | ||
| const resolvedPluginsDir = resolve(pluginsDir); | ||
| if ( | ||
| !resolvedPluginDir.startsWith(resolvedPluginsDir + '/') && |
There was a problem hiding this comment.
Compare uninstall paths with OS-aware separator
The containment check hardcodes '/' in resolvedPluginsDir + '/', but on Windows resolve() returns backslash-separated paths, so valid plugin paths fail startsWith(...) and uninstall exits with "Invalid plugin ID." for every plugin. This makes the new uninstall command unusable on Windows.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const pluginsDir = getPluginsDir(); | ||
| const targetDir = join(pluginsDir, manifest.id); |
There was a problem hiding this comment.
Constrain manifest.id before deriving install target
The installer builds targetDir directly from join(pluginsDir, manifest.id) without validating that manifest.id is a safe path segment, while readManifest() accepts any non-empty string. A crafted manifest id like ../somewhere will resolve outside the plugins directory, allowing archive installs to copy files into arbitrary user-writable locations.
Useful? React with 👍 / 👎.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Summary
resetErrors()for manual re-enable andisAutoDisabled()querylist,install,uninstall, andlinkcommands toreadied-pluginCLI for managing community plugins from the terminalgetPluginsDir()resolves macOS/Win/Linux plugin directoriesTest Plan
pnpm test)readied-plugin listshows installed pluginsreadied-plugin link .creates symlink for dev plugins🤖 Generated with Claude Code
Summary by CodeRabbit
list(view installed plugins),install(add from archive or directory),uninstall(remove safely with confirmation), andlink(for local development)