#2556: fix(plugin-install): handle existing plugins and filter workspace deps
commands
Cluster:
Plugin Management Enhancements
Fix for #1839
fix(plugin-install): handle existing plugins and filter workspace deps
Description: This PR addresses two issues encountered during plugin installation and onboarding:
1. Existing Plugin Detection:
- Problem: Onboarding would attempt to re-install plugins even if they were already present in the workspace or config, leading to ID conflicts.
- Fix: Added findExistingPluginOrigin in src/commands/onboarding/plugin-install.ts to check if a plugin exists (in config, workspace, global, or bundled) before attempting installation. If found (and not a bundled plugin requiring a local copy), it simply enables the existing plugin.
2. Workspace Protocol Support:
- Problem: Installing plugins that depend on workspace:* versions (like clawdbot ) failed with EUNSUPPORTEDPROTOCOL when installed via npm in a standalone environment.
- Fix: Modified src/plugins/install.ts to filter out workspace:* dependencies from the temporary package.json before running npm install . The runtime relies on the clawdbot/plugin-sdk alias, so the direct workspace dependency is not needed for the installed artifact.
Verification:
- Verified that onboarding correctly identifies existing plugins (e.g., Zalo) and skips unnecessary installation.
- Verified that npm install succeeds for plugins with workspace:* dependencies by stripping them from the manifest.
- Ran pnpm test to ensure no regressions.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates onboarding plugin installation to detect and enable an existing plugin (from config/workspace/global/bundled) instead of attempting a reinstall, and adjusts plugin package installation to strip `workspace:*` dependencies from the copied `package.json` before running `npm install` in the installed artifact.
The changes primarily touch the onboarding flow (`src/commands/onboarding/plugin-install.ts`) and the plugin installer (`src/plugins/install.ts`), with a small test update to mock the new manifest registry dependency.
<h3>Confidence Score: 3/5</h3>
- Mostly safe to merge, but there is at least one build-blocking type issue to fix first.
- The behavioral changes are localized and align with the PR intent, but `src/commands/onboarding/plugin-install.ts` introduces an undefined `ClawdbotConfig` type that should break typechecking/compilation. After that is corrected, the remaining concern is mostly semantic (`installed` flag meaning) rather than correctness.
- src/commands/onboarding/plugin-install.ts
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7090: fix: plugin install uses manifest ID for folder name (#2796)
by dial481 · 2026-02-02
83.8%
#7204: Plugins: default non-bundled plugins off
by veganmosfet · 2026-02-02
81.5%
#11096: fix(plugins): require explicit trust for workspace and external plu...
by T1mn · 2026-02-07
81.5%
#20424: Fix plugin extension path traversal in discovery/install
by markmusson · 2026-02-18
80.2%
#8073: fix(plugins): add --ignore-scripts to npm install
by yubrew · 2026-02-03
79.7%
#11454: fix(plugins): remove workspace:* from extension dependencies
by AnonO6 · 2026-02-07
79.7%
#12849: fix(plugins): fallback bundled channel specs when npm install retur...
by vincentkoc · 2026-02-09
79.1%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
78.9%
#9196: Fix: Use local plugins for unpublished npm packages
by vishaltandale00 · 2026-02-05
78.6%
#20055: fix(plugins): strip workspace:* dev-deps before npm install
by openperf · 2026-02-18
78.5%