soulhubcli 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +133 -21
  2. package/dist/index.cjs +2785 -310
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -34,14 +34,41 @@ npx soulhubcli <command>
34
34
 
35
35
  | 命令 | 说明 |
36
36
  |------|------|
37
- | `soulhub search <keyword>` | 搜索 Agent |
37
+ | `soulhub search [query]` | 搜索 Agent 模板(匹配名称、描述、标签) |
38
+ | `soulhub search -c <category>` | 按分类筛选搜索结果 |
39
+ | `soulhub search -n <number>` | 限制搜索结果数量(默认 20) |
40
+ | `soulhub search --json` | 以 JSON 格式输出搜索结果 |
38
41
  | `soulhub info <name>` | 查看 Agent 详细信息(identity、soul、skills 等) |
39
- | `soulhub install <name>` | Registry 安装 Agent 或团队(默认为 worker,安装到所有检测到的 claw) |
40
- | `soulhub install <name> --main` | 安装为主 Agent |
42
+ | `soulhub info <name> --identity` | 显示 IDENTITY.md 内容 |
43
+ | `soulhub info <name> --soul` | 显示 SOUL.md 内容 |
44
+ | `soulhub info <name> --json` | 以 JSON 格式输出 Agent 详情 |
45
+ | `soulhub install <name>` | 从 Registry 安装 Agent 或团队(交互式:选择角色和目标 claw) |
46
+ | `soulhub install <name> --role main` | 安装为主 Agent(跳过角色选择) |
47
+ | `soulhub install <name> --role worker` | 安装为 Worker Agent(跳过角色选择) |
48
+ | `soulhub install <name> --claw-type <type>` | 指定 claw 类型(跳过 claw 选择) |
49
+ | `soulhub install <name> --dir <path>` | 安装到指定目录(不依赖 claw 环境) |
50
+ | `soulhub install <name> -y` | 跳过所有确认提示(自动确认) |
41
51
  | `soulhub install --from <source>` | 从本地目录、ZIP 文件或 URL 安装 |
42
52
  | `soulhub list` | 列出已安装的 Agent |
43
- | `soulhub update [name]` | 更新已安装的 Agent |
44
- | `soulhub rollback` | 回滚到上一次安装状态 |
53
+ | `soulhub list --json` | JSON 格式输出已安装的 Agent |
54
+ | `soulhub update [name]` | 更新已安装的 Agent(不传名称则更新全部) |
55
+ | `soulhub uninstall <name>` | 卸载 Agent(同时删除相关备份) |
56
+ | `soulhub uninstall <name> --keep-files` | 卸载但保留 workspace 文件 |
57
+ | `soulhub uninstall <name> -y` | 卸载 Agent(跳过确认提示) |
58
+ | `soulhub rollback` | 交互式选择回滚到某次安装前的状态 |
59
+ | `soulhub rollback --list` | 列出所有可用的回滚记录 |
60
+ | `soulhub rollback --last <n>` | 回滚倒数第 n 次安装(1 = 最近一次) |
61
+ | `soulhub rollback --id <id>` | 按 ID 回滚到指定的备份记录 |
62
+ | `soulhub rollback --claw-type <type>` | 指定回滚的目标 claw 类型 |
63
+ | `soulhub rollback --last <n> -y` | 回滚并跳过确认提示 |
64
+
65
+ ### 全局选项
66
+
67
+ | 选项 | 说明 |
68
+ |------|------|
69
+ | `--verbose` | 启用详细调试日志 |
70
+ | `--version` | 显示版本号 |
71
+ | `--help` | 显示帮助信息 |
45
72
 
46
73
  ## 使用方法
47
74
 
@@ -50,22 +77,41 @@ npx soulhubcli <command>
50
77
  ```bash
51
78
  soulhub search python
52
79
  soulhub search "content writing"
80
+
81
+ # 按分类筛选
82
+ soulhub search -c development
83
+
84
+ # 限制结果数量
85
+ soulhub search writer -n 5
86
+
87
+ # JSON 格式输出(适合 CI/管道集成)
88
+ soulhub search writer --json
53
89
  ```
54
90
 
55
91
  ### 安装 Agent
56
92
 
57
93
  CLI 会自动识别目标是单 Agent 还是多 Agent 团队,无需手动区分。
58
94
 
59
- **默认行为:安装为 Worker Agent,自动安装到所有检测到的 claw 目录。**
95
+ **默认行为:交互式安装。** CLI 会提示用户选择安装角色(主 Agent / Worker Agent)以及目标 claw 目录(支持多选)。通过命令行参数可跳过交互,实现完全非交互式安装。
60
96
 
61
97
  **从 Registry 安装:**
62
98
 
63
99
  ```bash
64
- # 安装单 Agent(默认为 worker,安装到所有检测到的 claw)
100
+ # 交互式安装(会提示选择角色和 claw 目录)
65
101
  soulhub install writer-wechat
66
102
 
67
- # 安装为主 Agent
68
- soulhub install writer-wechat --main
103
+ # 指定角色,仍交互选择 claw 目录
104
+ soulhub install writer-wechat --role main
105
+ soulhub install writer-wechat --role worker
106
+
107
+ # 指定 claw 类型,仍交互选择角色
108
+ soulhub install writer-wechat --claw-type LightClaw
109
+
110
+ # 完全非交互式安装
111
+ soulhub install writer-wechat --role worker --claw-type OpenClaw
112
+
113
+ # 完全非交互式安装(主 Agent,-y 跳过确认)
114
+ soulhub install writer-wechat --role main --claw-type OpenClaw -y
69
115
 
70
116
  # 安装多 Agent 团队(调度 Agent + 工作 Agent)
71
117
  soulhub install dev-squad
@@ -89,15 +135,27 @@ soulhub install --from https://example.com/agent-team.zip
89
135
  ```bash
90
136
  # 安装到自定义目录(不依赖 OpenClaw/LightClaw 环境)
91
137
  soulhub install writer-wechat --dir ./my-agents
138
+ ```
139
+
140
+ ### 查看 Agent 详情
92
141
 
93
- # 指定 claw 类型(只安装到该 claw)
94
- soulhub install writer-wechat --clawtype LightClaw
142
+ ```bash
143
+ soulhub info writer-xiaohongshu
144
+
145
+ # 查看 IDENTITY.md 和 SOUL.md 内容
146
+ soulhub info writer-xiaohongshu --identity --soul
147
+
148
+ # JSON 格式输出
149
+ soulhub info writer-xiaohongshu --json
95
150
  ```
96
151
 
97
152
  ### 列出已安装的 Agent
98
153
 
99
154
  ```bash
100
155
  soulhub list
156
+
157
+ # JSON 格式输出
158
+ soulhub list --json
101
159
  ```
102
160
 
103
161
  ### 更新 Agent
@@ -109,28 +167,81 @@ soulhub update ops-assistant # 更新指定 Agent
109
167
 
110
168
  ### 卸载 Agent
111
169
 
170
+ 卸载时,如果存在相关备份记录,CLI 会提示用户确认,因为卸载操作会同时删除该 Agent 的所有备份文件,删除后将无法回滚。使用 `-y` 参数可跳过确认。
171
+
112
172
  ```bash
113
173
  soulhub uninstall ops-assistant
174
+
175
+ # 跳过确认提示
176
+ soulhub uninstall ops-assistant -y
177
+ ```
178
+
179
+ 使用 `--keep-files` 参数可保留 workspace 文件,仅从安装记录中移除:
180
+
181
+ ```bash
182
+ soulhub uninstall ops-assistant --keep-files
183
+ ```
184
+
185
+ ### 回滚安装
186
+
187
+ 每次安装操作都会自动创建备份记录,支持回滚到安装前的状态。
188
+
189
+ ```bash
190
+ # 交互式选择:展示所有备份记录,选择要回滚的项
191
+ soulhub rollback
192
+
193
+ # 查看所有可用的回滚记录
194
+ soulhub rollback --list
195
+
196
+ # 非交互式:回滚最近一次安装
197
+ soulhub rollback --last 1
198
+
199
+ # 非交互式:回滚最近一次安装(跳过确认)
200
+ soulhub rollback --last 1 -y
201
+
202
+ # 非交互式:回滚倒数第 2 次安装
203
+ soulhub rollback --last 2
204
+
205
+ # 按 ID 回滚到指定记录
206
+ soulhub rollback --id <record-id>
114
207
  ```
115
208
 
116
209
  ## 安装行为说明
117
210
 
211
+ ### 交互式安装流程
212
+
213
+ 未指定 `--role` 和 `--claw-type` 参数时,CLI 进入交互式安装:
214
+
215
+ 1. 展示 Agent 基本信息(名称、版本、描述、分类、标签)
216
+ 2. 提示选择安装角色:**Main Agent** 或 **Worker Agent**
217
+ 3. 安装为 Main Agent 时,警告将覆盖当前 workspace 内容(人格文件会被替换,记忆不受影响),需用户确认(或使用 `-y` 跳过)
218
+ 4. 提示多选目标 claw 目录(OpenClaw / LightClaw),可同时安装到多个 claw
219
+ 5. 执行安装、注册、重启
220
+
118
221
  ### 单 Agent 安装
119
222
 
120
- - **默认安装为 Worker Agent**(子 agent),部署到 `workspace-<agentId>/` 目录
121
- - 使用 `--main` 参数可安装为主 Agent,部署到 `workspace/` 目录
122
- - **自动安装到所有检测到的 claw 目录**(OpenClaw / LightClaw),使用 `--clawtype` 可指定单个 claw
123
- - 如果目标目录已存在,CLI 会**自动备份**(复制到 `agentbackup/`)
223
+ - 安装为 **Worker Agent** 时,部署到 `workspace-<agentId>/` 目录
224
+ - 安装为 **Main Agent** 时,部署到 `workspace/` 目录,会覆盖已有人格文件
225
+ - 安装前自动备份已有内容到 `~/.soulhub/backups/<claw>/`(按 claw 类型分目录存储)
124
226
  - 仅覆盖 `IDENTITY.md`、`SOUL.md` 等灵魂文件,不影响 workspace 中的其他运行时文件
125
- - 安装完成后自动重启 OpenClaw Gateway;若重启失败会提示手动重启
227
+ - 安装完成后自动重启 OpenClaw/LightClaw Gateway;若重启失败会提示手动重启
126
228
 
127
229
  ### 多 Agent 团队安装
128
230
 
129
231
  - **调度 Agent(Dispatcher)** 作为主 Agent 安装到 `workspace/` 目录
130
232
  - **工作 Agent(Worker)** 安装到各自的 `workspace-<agentId>/` 目录
233
+ - 安装前自动备份存量子 Agent(mv 方式移走已有 worker 目录)
131
234
  - 自动配置多 Agent 之间的通信
132
235
  - Worker Agent 自动注册到 claw 配置中
133
- - 安装完成后自动重启 OpenClaw Gateway
236
+ - 安装完成后自动重启 OpenClaw/LightClaw Gateway
237
+
238
+ ### 备份与回滚
239
+
240
+ - 备份文件存储在 `~/.soulhub/backups/<claw>/` 目录下,按 claw 类型(如 `openclaw`、`lightclaw`)分目录管理
241
+ - 备份清单记录在 `~/.soulhub/backup-manifest.json` 中
242
+ - 每次安装都会自动创建备份记录,包含 agent 文件和 claw 配置快照
243
+ - 回滚时自动恢复备份文件和 claw 配置,并重启 Gateway
244
+ - 卸载 Agent 时会同时清理相关备份记录和备份文件
134
245
 
135
246
  ## 配置
136
247
 
@@ -148,11 +259,12 @@ export SOULHUB_REGISTRY_URL=https://your-registry.example.com
148
259
 
149
260
  CLI 按以下优先级查找 claw 安装目录:
150
261
 
151
- 1. `--clawtype` 命令行参数(指定时只安装到该 claw)
152
- 2. `OPENCLAW_HOME` / `LIGHTCLAW_HOME` 环境变量
153
- 3. 默认路径 `~/.openclaw`、`~/.lightclaw`
262
+ 1. `--claw-type` 命令行参数(指定时只安装到该 claw)
263
+ 2. `--dir` 命令行参数(直接指定目标目录,不依赖 claw 环境)
264
+ 3. `OPENCLAW_HOME` / `LIGHTCLAW_HOME` 环境变量
265
+ 4. 默认路径 `~/.openclaw`、`~/.lightclaw`
154
266
 
155
- 未指定 `--clawtype` 时,CLI 会检测所有可用的 claw 目录并全部安装。
267
+ 未指定 `--claw-type` 或 `--dir` 时,CLI 会检测所有可用的 claw 目录,多个时交互式多选。
156
268
 
157
269
  ## 环境要求
158
270