Skip to content

🀯 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.

♻️ refactor(cli): rename plugin command to legacy-plugin with plugin alias (#22366)

Lobehub Coderf7dfa248b761
diff --git a/.agents/skills/cli/SKILL.md b/.agents/skills/cli/SKILL.md
index bf6ee7aaaea..a41818ee4b7 100644
--- a/.agents/skills/cli/SKILL.md
+++ b/.agents/skills/cli/SKILL.md
@@ -58,7 +58,7 @@ apps/cli/src/
β”‚ β”œβ”€β”€ model.ts # AI model management
β”‚ β”œβ”€β”€ notification.ts # Notification delivery settings (personal / workspace)
β”‚ β”œβ”€β”€ notify.ts # Send a callback message to a topic to trigger the agent
-β”‚ β”œβ”€β”€ plugin.ts # Plugin management
+β”‚ β”œβ”€β”€ plugin.ts # Legacy 1.0 plugins (`lh legacy-plugin`)
β”‚ β”œβ”€β”€ project.ts # Goal-oriented project management
β”‚ β”œβ”€β”€ provider.ts # AI provider management
β”‚ β”œβ”€β”€ search.ts # Global search
@@ -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 plugin` | - | Plugin install, uninstall, update |
+| `lh legacy-plugin` | - | Legacy 1.0 plugins: list, install, 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.md
index 7f3c620fc46..bb64c98710b 100644
--- a/.agents/skills/cli/references/skills-plugins.md
+++ b/.agents/skills/cli/references/skills-plugins.md
@@ -111,24 +111,24 @@ lh skill read-resource <id> <path>
---
-## Plugin Management (`lh plugin`)
+## Legacy Plugin Management (`lh legacy-plugin`)
-Install and manage plugins (external tool integrations).
+Install and manage legacy 1.0 plugins stored in `user_installed_plugins`. For MCP connectors, use `lh connector`.
**Source**: `apps/cli/src/commands/plugin.ts`
-### `lh plugin list`
+### `lh legacy-plugin list`
```bash
-lh plugin list [--json [fields]]
+lh legacy-plugin list [--json [fields]]
```
**Table columns**: ID, IDENTIFIER, TYPE, TITLE
-### `lh plugin install`
+### `lh legacy-plugin install`
```bash
-lh plugin install -i <id> --manifest <json> [--type <type>] [--settings <json>]
+lh legacy-plugin install -i <id> --manifest <json> [--type <type>] [--settings <json>]
```
| Option | Description | Required |
@@ -138,16 +138,16 @@ lh plugin install -i <id> --manifest <json> [--type <type>] [--settings <json>]
| `--type <type>` | `plugin` or `customPlugin` | No (default: `plugin`) |
| `--settings <json>` | Plugin settings JSON | No |
-### `lh plugin uninstall <id>`
+### `lh legacy-plugin uninstall <id>`
```bash
-lh plugin uninstall <id> [--yes]
+lh legacy-plugin uninstall <id> [--yes]
```
-### `lh plugin update <id>`
+### `lh legacy-plugin update <id>`
Requires `--manifest` or `--settings` (at least one); errors if neither is specified.
```bash
-lh plugin update <id> [--manifest <json>] [--settings <json>]
+lh legacy-plugin update <id> [--manifest <json>] [--settings <json>]
```
diff --git a/apps/cli/e2e/plugin.e2e.test.ts b/apps/cli/e2e/plugin.e2e.test.ts
index 1b2e2514766..b5f5c45a5d6 100644
--- a/apps/cli/e2e/plugin.e2e.test.ts
+++ b/apps/cli/e2e/plugin.e2e.test.ts
@@ -3,7 +3,7 @@ import { execSync } from 'node:child_process';
import { describe, expect, it } from 'vitest';
/**
- * E2E tests for `lh plugin` plugin management commands.
+ * E2E tests for `lh legacy-plugin` plugin management commands.
*
* Prerequisites:
* - `lh` CLI is installed and linked globally
@@ -16,7 +16,7 @@ const TIMEOUT = 30_000;
function run(args: string): string {
return execSync(`${CLI} ${args}`, {
- encoding: 'utf-8',
+ encoding: 'utf8',
env: { ...process.env, PATH: `${process.env.HOME}/.bun/bin:${process.env.PATH}` },
timeout: TIMEOUT,
}).trim();
@@ -27,22 +27,22 @@ function runJson<T = any>(args: string): T {
return JSON.parse(output) as T;
}
-describe('lh plugin - E2E', () => {
+describe('lh legacy-plugin - E2E', () => {
// ── list ──────────────────────────────────────────────
describe('list', () => {
it('should list plugins or show empty message', () => {
- const output = run('plugin list');
+ const output = run('legacy-plugin list');
expect(output).toBeTruthy();
});
it('should output JSON', () => {
- const list = runJson<any[]>('plugin list --json');
+ const list = runJson<any[]>('legacy-plugin list --json');
expect(Array.isArray(list)).toBe(true);
});
it('should output JSON with field filtering', () => {
- const list = runJson<any[]>('plugin list --json id,identifier');
+ const list = runJson<any[]>('legacy-plugin list --json id,identifier');
expect(Array.isArray(list)).toBe(true);
if (list.length > 0) {
expect(list[0]).toHaveProperty('id');
@@ -57,17 +57,17 @@ describe('lh plugin - E2E', () => {
describe('install', () => {
it('should reject invalid manifest JSON', () => {
- expect(() => run('plugin install -i "test-plugin" --manifest "not-json"')).toThrow();
+ expect(() => run('legacy-plugin install -i "test-plugin" --manifest "not-json"')).toThrow();
});
});
describe('update', () => {
it('should error when no changes specified', () => {
- expect(() => run('plugin update nonexistent-id')).toThrow();
+ expect(() => run('legacy-plugin update nonexistent-id')).toThrow();
});
it('should reject invalid settings JSON', () => {
- expect(() => run('plugin update some-id --settings "not-json"')).toThrow();
+ expect(() => run('legacy-plugin update some-id --settings "not-json"')).toThrow();
});
});
});
diff --git a/apps/cli/src/commands/plugin.test.ts b/apps/cli/src/commands/plugin.test.ts
index 0a26b724ed1..97e44e01f2a 100644
--- a/apps/cli/src/commands/plugin.test.ts
+++ b/apps/cli/src/commands/plugin.test.ts
@@ -2,7 +2,7 @@ import { Command } from 'commander';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { log } from '../utils/logger';
-import { registerPluginCommand } from './plugin';
+import { registerLegacyPluginCommand } from './plugin';
const { mockTrpcClient } = vi.hoisted(() => ({
mockTrpcClient: {
@@ -24,7 +24,7 @@ const { getTrpcClient: mockGetTrpcClient } = vi.hoisted(() => ({
}));
vi.mock('../api/client', () => ({ getTrpcClient: mockGetTrpcClient }));
-describe('plugin command', () => {
+describe('legacy-plugin command', () => {
let exitSpy: ReturnType<typeof vi.spyOn>;
let consoleSpy: ReturnType<typeof vi.spyOn>;
@@ -50,10 +50,49 @@ describe('plugin command', () => {
function createProgram() {
const program = new Command();
program.exitOverride();
- registerPluginCommand(program);
+ registerLegacyPluginCommand(program);
return program;
}
+ describe('command name', () => {
+ it('should register legacy-plugin with a plugin alias and a legacy description', () => {
+ const program = createProgram();
+ const command = program.commands.find((c) => c.name() === 'legacy-plugin');
+
+ expect(command).toBeDefined();
+ expect(command!.aliases()).toEqual(['plugin']);
+ expect(command!.description()).toBe('Manage legacy 1.0 plugins (user_installed_plugins)');
+ expect(program.commands.some((c) => c.name() === 'plugin')).toBe(false);
+ });
+
+ it('should resolve legacy-plugin and its plugin alias to the same subcommands', async () => {
+ const program = createProgram();
+ const subcommands = (name: string) =>
+ program.commands
+ .find((c) => c.name() === name || c.aliases().includes(name))!
+ .commands.map((c) => c.name());
+
+ expect(subcommands('plugin')).toEqual(subcommands('legacy-plugin'));
+ expect(subcommands('legacy-plugin')).toEqual([
+ 'list',
+ 'search',
+ 'create',
+ 'install',
+ 'uninstall',
+ 'update',
+ ]);
+
+ mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([
+ { id: 'p1', identifier: 'search', type: 'plugin' },
+ ]);
+ await createProgram().parseAsync(['node', 'test', 'legacy-plugin', 'list', '--json']);
+ await createProgram().parseAsync(['node', 'test', 'plugin', 'list', '--json']);
+
+ expect(mockTrpcClient.plugin.getPlugins.query).toHaveBeenCalledTimes(2);
+ expect(consoleSpy.mock.calls[1]).toEqual(consoleSpy.mock.calls[0]);
+ });
+ });
+
describe('list', () => {
it('should list plugins', async () => {
mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([
@@ -61,7 +100,7 @@ describe('plugin command', () => {
]);
const program = createProgram();
- await program.parseAsync(['node', 'test', 'plugin', 'list']);
+ await program.parseAsync(['node', 'test', 'legacy-plugin', 'list']);
expect(consoleSpy).toHaveBeenCalledTimes(2);
});
@@ -71,7 +110,7 @@ describe('plugin command', () => {
mockTrpcClient.plugin.getPlugins.query.mockResolvedValue(plugins);
const program = createProgram();
- await program.parseAsync(['node', 'test', 'plugin', 'list', '--json']);
+ await program.parseAsync(['node', 'test', 'legacy-plugin', 'list', '--json']);
expect(consoleSpy).toHaveBeenCalledWith(JSON.stringify(plugins, null, 2));
});
@@ -92,7 +131,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'search',
'search',
'--category',
@@ -125,7 +164,7 @@ describe('plugin command', () => {
mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([]);
const program = createProgram();
- await program.parseAsync(['node', 'test', 'plugin', 'search']);
+ await program.parseAsync(['node', 'test', 'legacy-plugin', 'search']);
expect(mockTrpcClient.market.getMcpList.query).toHaveBeenCalledWith({
category: undefined,
@@ -144,7 +183,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'create',
'-i',
'my-plugin',
@@ -167,7 +206,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'create',
'-i',
'my-plugin',
@@ -188,7 +227,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'install',
'-i',
'my-plugin',
@@ -209,7 +248,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'install',
'-i',
'my-plugin',
@@ -227,7 +266,7 @@ describe('plugin command', () => {
mockTrpcClient.plugin.removePlugin.mutate.mockResolvedValue({});
const program = createProgram();
- await program.parseAsync(['node', 'test', 'plugin', 'uninstall', 'p1', '--yes']);
+ await program.parseAsync(['node', 'test', 'legacy-plugin', 'uninstall', 'p1', '--yes']);
expect(mockTrpcClient.plugin.removePlugin.mutate).toHaveBeenCalledWith({ id: 'p1' });
});
@@ -241,7 +280,7 @@ describe('plugin command', () => {
await program.parseAsync([
'node',
'test',
- 'plugin',
+ 'legacy-plugin',
'update',
'p1',
'--settings',
@@ -255,7 +294,7 @@ describe('plugin command', () => {
it('should exit when no changes', async () => {
const program = createProgram();
- await program.parseAsync(['node', 'test', 'plugin', 'update', 'p1']);
+ await program.parseAsync(['node', 'test', 'legacy-plugin', 'update', 'p1']);
expect(log.error).toHaveBeenCalledWith(expect.stringContaining('No changes'));
expect(exitSpy).toHaveBeenCalledWith(1);
diff --git a/apps/cli/src/commands/plugin.ts b/apps/cli/src/commands/plugin.ts
index 26257b13103..18e2780be9d 100644
--- a/apps/cli/src/commands/plugin.ts
+++ b/apps/cli/src/commands/plugin.ts
@@ -5,8 +5,11 @@ import { getTrpcClient } from '../api/client';
import { confirm, outputJson, printTable, truncate } from '../utils/format';
import { log } from '../utils/logger';
-export function registerPluginCommand(program: Command) {
- const plugin = program.command('plugin').description('Manage plugins');
+export function registerLegacyPluginCommand(program: Command) {
+ const plugin = program
+ .command('legacy-plugin')
+ .alias('plugin')
+ .description('Manage legacy 1.0 plugins (user_installed_plugins)');
// ── list ──────────────────────────────────────────────
diff --git a/apps/cli/src/modelFacingDocs.test.ts b/apps/cli/src/modelFacingDocs.test.ts
index ebda81faf41..1b1d5a92efe 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 plugin install -i <identifier> [--manifest <json>]')).toEqual([
- 'required option --manifest on "lh plugin install" is shown as optional',
+ 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 plugin install -i <identifier> --manifest <json>')).toEqual([]);
+ expect(checkSnippet('lh legacy-plugin install -i <identifier> --manifest <json>')).toEqual([]);
// A bare command name in prose is a reference, not an invocation.
expect(checkSnippet('lh kb view')).toEqual([]);
});
diff --git a/apps/cli/src/program.ts b/apps/cli/src/program.ts
index 7cbc53782ad..a2d9544c8e6 100644
--- a/apps/cli/src/program.ts
+++ b/apps/cli/src/program.ts
@@ -31,7 +31,7 @@ import { registerMigrateCommand } from './commands/migrate';
import { registerModelCommand } from './commands/model';
import { registerNotificationCommand } from './commands/notification';
import { registerNotifyCommand } from './commands/notify';
-import { registerPluginCommand } from './commands/plugin';
+import { registerLegacyPluginCommand } from './commands/plugin';
import { registerProjectCommand } from './commands/project';
import { registerProviderCommand } from './commands/provider';
import { registerReadCommand } from './commands/read';
@@ -119,7 +119,7 @@ export function createProgram() {
registerProjectCommand(program);
registerDashboardCommand(program);
registerWidgetCommand(program);
- registerPluginCommand(program);
+ registerLegacyPluginCommand(program);
registerConnectorCommand(program);
registerWorkspaceCommand(program);
registerUserCommand(program);
diff --git a/packages/builtin-skills/src/lobehub/content.ts b/packages/builtin-skills/src/lobehub/content.ts
index d84f8eb1ec4..c5c1253fd3e 100644
--- a/packages/builtin-skills/src/lobehub/content.ts
+++ b/packages/builtin-skills/src/lobehub/content.ts
@@ -64,7 +64,7 @@ run commands.
| \`lh skill\` | Skill management (install, create, manage) | \`references/skill\` |
| \`lh model\` | AI model management | \`references/model\` |
| \`lh provider\` | AI provider management | \`references/provider\` |
-| \`lh plugin\` | Plugin management | \`references/plugin\` |
+| \`lh legacy-plugin\` | Legacy 1.0 plugin management | \`references/plugin\` |
| \`lh bot\` | Bot integration management (Discord, Slack, Telegram, etc.) | \`references/bot\` |
| \`lh widget\` / \`lh dashboard\` | Monitoring widgets (sandboxed scripts) and the dashboards they sit on | \`references/dashboard\` |
| \`lh eval\` | Evaluation workflow management | \`references/eval\` |
diff --git a/packages/builtin-skills/src/lobehub/references/plugin.ts b/packages/builtin-skills/src/lobehub/references/plugin.ts
index 58da3b5ab0e..53ed9345334 100644
--- a/packages/builtin-skills/src/lobehub/references/plugin.ts
+++ b/packages/builtin-skills/src/lobehub/references/plugin.ts
@@ -1,13 +1,13 @@
-const content = `# lh plugin - Plugin Management
+const content = `# lh legacy-plugin - Legacy Plugin Management
-Manage installed plugins (external tool integrations).
+Manage legacy 1.0 plugins (stored in \`user_installed_plugins\`). For MCP connectors, use \`lh connector\` instead.
## Subcommands
-- \`lh plugin list\` - List installed plugins
-- \`lh plugin install -i <identifier> --manifest <json> [--type <type>] [--settings <json>]\` - Install plugin
-- \`lh plugin uninstall <id> [--yes]\` - Uninstall plugin
-- \`lh plugin update <id> [--manifest <url>] [--settings <json>]\` - Update plugin
+- \`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
## Tips
diff --git a/packages/heterogeneous-agents/src/protocol/lobeHubCliGuide.ts b/packages/heterogeneous-agents/src/protocol/lobeHubCliGuide.ts
index 75cadf0f503..5a9faab698c 100644
--- a/packages/heterogeneous-agents/src/protocol/lobeHubCliGuide.ts
+++ b/packages/heterogeneous-agents/src/protocol/lobeHubCliGuide.ts
@@ -90,7 +90,7 @@ const lobeHubCliGuideBody = [
'- **Talking to another conversation:** `lh topic send <tpc_id> -c "…"` delivers a message to that conversation and has its agent act on it (queued behind its current turn if it is busy). To hand work to a fresh conversation instead, `lh topic send --new -c "…"` opens one for you (or `--agent-id` another agent), optionally on a given machine with `--device <id|local>` and named with `--title`; `lh message send -c "…"` is the same thing spelled message-first: without `--topic-id` it opens a new conversation, with `--topic-id <tpc_id>` it sends to that one. Prefer these over `lh agent run` for handing off work. `lh message create` only writes a row β€” nobody sees or answers it. A message another agent sent you starts with an `<agent_sender>` header; answer it with `lh message reply <message_id> -c "…"`, which wakes the sender\'s conversation. Your ordinary response is not delivered to that agent.',
'- **If `lh` is too old** β€” `lh man` lacks a command you expect, or `lh` reports an unknown command or option β€” the shell may have found a stale global install first. When `LOBEHUB_CLI` is set it is the path of the CLI this app ships β€” run that path instead of `lh` for the rest of the session. Otherwise, or if that one is too old as well, run the latest CLI once without installing it: `pnpm --package @lobehub/cli@latest dlx lh …` (or `npx -y -p @lobehub/cli@latest lh …`). It reads the same environment and saved login as `lh`. If the user asks you to run `lh` this way, do so.',
'- **Look commands up, do not guess them.** `lh man` lists every command, and `lh man <command>` (e.g. `lh man doc create`) prints the manual for the CLI actually installed here, including exactly which flags that command takes. Many commands offer `--json` for structured output, but not all of them β€” the manual is what says so, and an invented flag just fails the call.',
- '- **What it reaches:** `lh kb` knowledge bases Β· `lh doc` documents Β· `lh file` files Β· `lh artifact` artifacts Β· `lh topic` / `lh message` past conversations Β· `lh agent` agents Β· `lh task` / `lh project` work Β· `lh widget` / `lh dashboard` monitoring widgets and dashboards Β· `lh search` local resources and the web Β· `lh recall` past messages, topics, goals and pages in a time window Β· `lh gen` text/image/video/TTS/ASR generation Β· `lh memory` user memory Β· `lh notify` notifications to the user Β· `lh model` / `lh provider` / `lh plugin` / `lh skill` platform configuration Β· `lh bot` chat-platform bots.',
+ '- **What it reaches:** `lh kb` knowledge bases Β· `lh doc` documents Β· `lh file` files Β· `lh artifact` artifacts Β· `lh topic` / `lh message` past conversations Β· `lh agent` agents Β· `lh task` / `lh project` work Β· `lh widget` / `lh dashboard` monitoring widgets and dashboards Β· `lh search` local resources and the web Β· `lh recall` past messages, topics, goals and pages in a time window Β· `lh gen` text/image/video/TTS/ASR generation Β· `lh memory` user memory Β· `lh notify` notifications to the user Β· `lh model` / `lh provider` / `lh legacy-plugin` / `lh skill` platform configuration Β· `lh bot` chat-platform bots.',
"- **Widgets run code with the user's credentials.** Before `lh widget dry-run` of a draft that declares connector credentials (`manifest.env`) or network hosts (`manifest.network.allow`), show the user that version id, what the script does and which credentials and hosts it uses, and wait for their explicit approval of that exact version before passing `--version <id> --yes`. Never publish (`lh widget publish`) without the user's confirmation.",
'- **If a command fails with an authentication or permission error**, tell the user what you were trying to do β€” do not work around it.',
'- **Leave these alone:** `lh hetero` and `lh connect` run the infrastructure that is executing you. And never change the persistent workspace scope with `lh workspace use` β€” it silently rewrites the target of every later command on this machine.',