← Back to PRs

#2556: fix(plugin-install): handle existing plugins and filter workspace deps

by longmaba open 2026-01-27 03:43 View on GitHub →
commands
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