π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π₯ refactor(cli): remove legacy-plugin create and install subcommands (#22372)
Lobehub Coder3492696ffec6
diff --git a/.agents/skills/cli/SKILL.md b/.agents/skills/cli/SKILL.mdindex a41818ee4b7..52f47b6684e 100644--- a/.agents/skills/cli/SKILL.md+++ b/.agents/skills/cli/SKILL.md@@ -124,7 +124,7 @@ apps/cli/src/| `lh skill` | - | Skill CRUD + import (GitHub/URL/market) || `lh model` | - | Model CRUD, toggle, batch-toggle, clear || `lh provider` | - | Provider CRUD, config, test, toggle |-| `lh legacy-plugin` | - | Legacy 1.0 plugins: list, install, uninstall, update |+| `lh legacy-plugin` | - | Legacy 1.0 plugins: list, search, uninstall, update || `lh search` | - | Global search across all types || `lh session-group` | - | Manage agent session groups || `lh workspace` | `ws` | Workspace list, scope switch, members, invites, usage |diff --git a/.agents/skills/cli/references/skills-plugins.md b/.agents/skills/cli/references/skills-plugins.mdindex bb64c98710b..2c2ae58b76b 100644--- a/.agents/skills/cli/references/skills-plugins.md+++ b/.agents/skills/cli/references/skills-plugins.md@@ -113,7 +113,7 @@ lh skill read-resource <id> <path>## Legacy Plugin Management (`lh legacy-plugin`)-Install and manage legacy 1.0 plugins stored in `user_installed_plugins`. For MCP connectors, use `lh connector`.+List, update and uninstall legacy 1.0 plugins stored in `user_installed_plugins`. New plugins cannot be created here: add an MCP server with `lh connector add --url <url>`, and re-sync an existing connection with `lh connector refresh <idOrIdentifier>`.**Source**: `apps/cli/src/commands/plugin.ts`@@ -125,19 +125,6 @@ lh legacy-plugin list [--json [fields]]**Table columns**: ID, IDENTIFIER, TYPE, TITLE-### `lh legacy-plugin install`--```bash-lh legacy-plugin install -i <id> --manifest <json> [--type <type>] [--settings <json>]-```--| Option | Description | Required |-| ----------------------- | -------------------------- | ---------------------- |-| `-i, --identifier <id>` | Plugin identifier | Yes |-| `--manifest <json>` | Plugin manifest JSON | Yes |-| `--type <type>` | `plugin` or `customPlugin` | No (default: `plugin`) |-| `--settings <json>` | Plugin settings JSON | No |-### `lh legacy-plugin uninstall <id>````bashdiff --git a/apps/cli/e2e/plugin.e2e.test.ts b/apps/cli/e2e/plugin.e2e.test.tsindex b5f5c45a5d6..3582b751846 100644--- a/apps/cli/e2e/plugin.e2e.test.ts+++ b/apps/cli/e2e/plugin.e2e.test.ts@@ -51,15 +51,7 @@ describe('lh legacy-plugin - E2E', () => {});});- // ββ install / update / uninstall ββββββββββββββββββββββ- // Note: Full CRUD requires a valid manifest JSON which is complex.- // We test error handling for invalid inputs instead.-- describe('install', () => {- it('should reject invalid manifest JSON', () => {- expect(() => run('legacy-plugin install -i "test-plugin" --manifest "not-json"')).toThrow();- });- });+ // ββ update ββββββββββββββββββββββββββββββββββββββββdescribe('update', () => {it('should error when no changes specified', () => {diff --git a/apps/cli/src/commands/plugin.test.ts b/apps/cli/src/commands/plugin.test.tsindex 97e44e01f2a..5089a7cedfe 100644--- a/apps/cli/src/commands/plugin.test.ts+++ b/apps/cli/src/commands/plugin.test.ts@@ -10,8 +10,6 @@ const { mockTrpcClient } = vi.hoisted(() => ({getMcpList: { query: vi.fn() },},plugin: {- createOrInstallPlugin: { mutate: vi.fn() },- createPlugin: { mutate: vi.fn() },getPlugins: { query: vi.fn() },removePlugin: { mutate: vi.fn() },updatePlugin: { mutate: vi.fn() },@@ -61,7 +59,9 @@ describe('legacy-plugin command', () => {expect(command).toBeDefined();expect(command!.aliases()).toEqual(['plugin']);- expect(command!.description()).toBe('Manage legacy 1.0 plugins (user_installed_plugins)');+ expect(command!.description()).toBe(+ 'Manage legacy 1.0 plugins (user_installed_plugins). Add new MCP servers with lh connector add',+ );expect(program.commands.some((c) => c.name() === 'plugin')).toBe(false);});@@ -73,14 +73,7 @@ describe('legacy-plugin command', () => {.commands.map((c) => c.name());expect(subcommands('plugin')).toEqual(subcommands('legacy-plugin'));- expect(subcommands('legacy-plugin')).toEqual([- 'list',- 'search',- 'create',- 'install',- 'uninstall',- 'update',- ]);+ expect(subcommands('legacy-plugin')).toEqual(['list', 'search', 'uninstall', 'update']);mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([{ id: 'p1', identifier: 'search', type: 'plugin' },@@ -175,92 +168,6 @@ describe('legacy-plugin command', () => {});});- describe('create', () => {- it('should create a plugin', async () => {- mockTrpcClient.plugin.createPlugin.mutate.mockResolvedValue({ identifier: 'my-plugin' });-- const program = createProgram();- await program.parseAsync([- 'node',- 'test',- 'legacy-plugin',- 'create',- '-i',- 'my-plugin',- '--manifest',- '{"name":"test"}',- ]);-- expect(mockTrpcClient.plugin.createPlugin.mutate).toHaveBeenCalledWith(- expect.objectContaining({- identifier: 'my-plugin',- manifest: { name: 'test' },- type: 'plugin',- }),- );- expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Created plugin'));- });-- it('should reject invalid manifest JSON', async () => {- const program = createProgram();- await program.parseAsync([- 'node',- 'test',- 'legacy-plugin',- 'create',- '-i',- 'my-plugin',- '--manifest',- 'not-json',- ]);-- expect(log.error).toHaveBeenCalledWith('Invalid manifest JSON.');- expect(exitSpy).toHaveBeenCalledWith(1);- });- });-- describe('install', () => {- it('should install a plugin', async () => {- mockTrpcClient.plugin.createOrInstallPlugin.mutate.mockResolvedValue({});-- const program = createProgram();- await program.parseAsync([- 'node',- 'test',- 'legacy-plugin',- 'install',- '-i',- 'my-plugin',- '--manifest',- '{"name":"test"}',- ]);-- expect(mockTrpcClient.plugin.createOrInstallPlugin.mutate).toHaveBeenCalledWith(- expect.objectContaining({- identifier: 'my-plugin',- manifest: { name: 'test' },- }),- );- });-- it('should reject invalid manifest JSON', async () => {- const program = createProgram();- await program.parseAsync([- 'node',- 'test',- 'legacy-plugin',- 'install',- '-i',- 'my-plugin',- '--manifest',- 'not-json',- ]);-- expect(log.error).toHaveBeenCalledWith('Invalid manifest JSON.');- expect(exitSpy).toHaveBeenCalledWith(1);- });- });-describe('uninstall', () => {it('should uninstall with --yes', async () => {mockTrpcClient.plugin.removePlugin.mutate.mockResolvedValue({});diff --git a/apps/cli/src/commands/plugin.ts b/apps/cli/src/commands/plugin.tsindex 18e2780be9d..8a69088d0ce 100644--- a/apps/cli/src/commands/plugin.ts+++ b/apps/cli/src/commands/plugin.ts@@ -9,7 +9,9 @@ export function registerLegacyPluginCommand(program: Command) {const plugin = program.command('legacy-plugin').alias('plugin')- .description('Manage legacy 1.0 plugins (user_installed_plugins)');+ .description(+ 'Manage legacy 1.0 plugins (user_installed_plugins). Add new MCP servers with lh connector add',+ );// ββ list ββββββββββββββββββββββββββββββββββββββββββββββ@@ -98,103 +100,6 @@ export function registerLegacyPluginCommand(program: Command) {},);- // ββ create ββββββββββββββββββββββββββββββββββββββββββ-- plugin- .command('create')- .description('Create a new plugin (without settings)')- .requiredOption('-i, --identifier <id>', 'Plugin identifier')- .requiredOption('--manifest <json>', 'Plugin manifest JSON')- .option('--type <type>', 'Plugin type: plugin or customPlugin', 'plugin')- .option('--custom-params <json>', 'Custom parameters JSON')- .action(- async (options: {- customParams?: string;- identifier: string;- manifest: string;- type: string;- }) => {- let manifest: any;- let customParams: any = {};- try {- manifest = JSON.parse(options.manifest);- } catch {- log.error('Invalid manifest JSON.');- process.exit(1);- return;- }- if (options.customParams) {- try {- customParams = JSON.parse(options.customParams);- } catch {- log.error('Invalid custom-params JSON.');- process.exit(1);- return;- }- }-- const client = await getTrpcClient();- const result = await client.plugin.createPlugin.mutate({- customParams,- identifier: options.identifier,- manifest,- type: options.type as 'plugin' | 'customPlugin',- });-- const r = result as any;- console.log(- `${pc.green('β')} Created plugin ${pc.bold(r.identifier || options.identifier)}`,- );- },- );-- // ββ install βββββββββββββββββββββββββββββββββββββββββββ-- plugin- .command('install')- .description('Install a plugin')- .requiredOption('-i, --identifier <id>', 'Plugin identifier')- .requiredOption('--manifest <json>', 'Plugin manifest JSON')- .option('--type <type>', 'Plugin type: plugin or customPlugin', 'plugin')- .option('--settings <json>', 'Plugin settings JSON')- .action(- async (options: {- identifier: string;- manifest: string;- settings?: string;- type: string;- }) => {- const client = await getTrpcClient();-- let manifest: any;- let settings: any;- try {- manifest = JSON.parse(options.manifest);- } catch {- log.error('Invalid manifest JSON.');- process.exit(1);- }- if (options.settings) {- try {- settings = JSON.parse(options.settings);- } catch {- log.error('Invalid settings JSON.');- process.exit(1);- }- }-- await client.plugin.createOrInstallPlugin.mutate({- customParams: {},- identifier: options.identifier,- manifest,- settings,- type: options.type as 'plugin' | 'customPlugin',- });-- console.log(`${pc.green('β')} Installed plugin ${pc.bold(options.identifier)}`);- },- );-// ββ uninstall βββββββββββββββββββββββββββββββββββββββββplugindiff --git a/apps/cli/src/modelFacingDocs.test.ts b/apps/cli/src/modelFacingDocs.test.tsindex 1b1d5a92efe..a9dcad95aec 100644--- a/apps/cli/src/modelFacingDocs.test.ts+++ b/apps/cli/src/modelFacingDocs.test.ts@@ -173,10 +173,10 @@ describe('model-facing lh CLI docs', () => {'missing required argument on "lh kb upload" (expects 2, got 1)',]);// A mandatory flag inside `[...]` reads as optional to the model.- expect(checkSnippet('lh legacy-plugin install -i <identifier> [--manifest <json>]')).toEqual([- 'required option --manifest on "lh legacy-plugin install" is shown as optional',+ expect(checkSnippet('lh agent-group create [-t <title>]')).toEqual([+ 'required option --title on "lh agent-group create" is shown as optional',]);- expect(checkSnippet('lh legacy-plugin install -i <identifier> --manifest <json>')).toEqual([]);+ expect(checkSnippet('lh agent-group create -t <title>')).toEqual([]);// A bare command name in prose is a reference, not an invocation.expect(checkSnippet('lh kb view')).toEqual([]);});diff --git a/packages/builtin-skills/src/lobehub/references/plugin.ts b/packages/builtin-skills/src/lobehub/references/plugin.tsindex 53ed9345334..7c1271ce509 100644--- a/packages/builtin-skills/src/lobehub/references/plugin.ts+++ b/packages/builtin-skills/src/lobehub/references/plugin.ts@@ -1,18 +1,29 @@const content = `# lh legacy-plugin - Legacy Plugin Management-Manage legacy 1.0 plugins (stored in \`user_installed_plugins\`). For MCP connectors, use \`lh connector\` instead.+Manage legacy 1.0 plugins (stored in \`user_installed_plugins\`). New plugins cannot be installed or created here, and \`update\` only edits a plugin that is already installed. To install an MCP server or plugin, add it as a connector (see below).## Subcommands- \`lh legacy-plugin list\` - List installed plugins-- \`lh legacy-plugin install -i <identifier> --manifest <json> [--type <type>] [--settings <json>]\` - Install plugin- \`lh legacy-plugin uninstall <id> [--yes]\` - Uninstall plugin-- \`lh legacy-plugin update <id> [--manifest <url>] [--settings <json>]\` - Update plugin+- \`lh legacy-plugin update <id> [--manifest <url>] [--settings <json>]\` - Update an installed plugin++## Install an MCP server (connector)++- \`lh connector add --url <url> [--name <name>]\` - Add an HTTP / SSE MCP server and sync its tools+- \`lh connector add --url <url> --auth bearer --token <token>\` - Server that needs a bearer token+- \`lh connector add --url <url> --header <key:value>\` - Custom request header (repeatable)+- \`lh connector add --url <url> --auth oauth2\` - OAuth server; prints an authorization URL and syncs the tools once the user authorizes. If \`lh connector list\` then shows \`error\` or 0 tools, run \`lh connector refresh <identifier>\`+- \`lh connector add --stdio-cmd <command> [--stdio-arg <arg>]\` - Local stdio MCP server+- \`lh connector refresh <idOrIdentifier>\` - Re-sync the tool list of an existing connection+- \`lh connector list\` - List connectors++Full \`lh connector\` options and tool-sync behavior: \`references/connector\`.## Tips-- Plugins extend agent capabilities with external tools-- Use \`--settings\` to pass JSON configuration during install/update+- A request to install a plugin from a manifest, with no MCP server URL or command, cannot be fulfilled: ask for the MCP server URL instead+- Use \`--settings\` to pass JSON configuration when updating an installed legacy plugin`;export default content;