soulhubcli 1.0.18 → 1.0.20

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.
package/README.md CHANGED
@@ -90,8 +90,8 @@ soulhub install --from https://example.com/agent-team.zip
90
90
  # 安装到自定义目录(不依赖 OpenClaw/LightClaw 环境)
91
91
  soulhub install writer-wechat --dir ./my-agents
92
92
 
93
- # 指定 claw 安装目录(只安装到该 claw)
94
- soulhub install writer-wechat --claw-dir ~/.lightclaw
93
+ # 指定 claw 类型(只安装到该 claw)
94
+ soulhub install writer-wechat --clawtype LightClaw
95
95
  ```
96
96
 
97
97
  ### 列出已安装的 Agent
@@ -119,7 +119,7 @@ soulhub uninstall ops-assistant
119
119
 
120
120
  - **默认安装为 Worker Agent**(子 agent),部署到 `workspace-<agentId>/` 目录
121
121
  - 使用 `--main` 参数可安装为主 Agent,部署到 `workspace/` 目录
122
- - **自动安装到所有检测到的 claw 目录**(OpenClaw / LightClaw),使用 `--claw-dir` 可指定单个 claw
122
+ - **自动安装到所有检测到的 claw 目录**(OpenClaw / LightClaw),使用 `--clawtype` 可指定单个 claw
123
123
  - 如果目标目录已存在,CLI 会**自动备份**(复制到 `agentbackup/`)
124
124
  - 仅覆盖 `IDENTITY.md`、`SOUL.md` 等灵魂文件,不影响 workspace 中的其他运行时文件
125
125
  - 安装完成后自动重启 OpenClaw Gateway;若重启失败会提示手动重启
@@ -148,11 +148,11 @@ export SOULHUB_REGISTRY_URL=https://your-registry.example.com
148
148
 
149
149
  CLI 按以下优先级查找 claw 安装目录:
150
150
 
151
- 1. `--claw-dir` 命令行参数(指定时只安装到该 claw)
151
+ 1. `--clawtype` 命令行参数(指定时只安装到该 claw)
152
152
  2. `OPENCLAW_HOME` / `LIGHTCLAW_HOME` 环境变量
153
153
  3. 默认路径 `~/.openclaw`、`~/.lightclaw`
154
154
 
155
- 未指定 `--claw-dir` 时,CLI 会检测所有可用的 claw 目录并全部安装。
155
+ 未指定 `--clawtype` 时,CLI 会检测所有可用的 claw 目录并全部安装。
156
156
 
157
157
  ## 环境要求
158
158
 
package/dist/index.cjs CHANGED
@@ -19033,11 +19033,15 @@ function copyAgentFilesFromPackage(packageDir, targetDir) {
19033
19033
  }
19034
19034
  function findOpenClawDir(customDir) {
19035
19035
  if (customDir) {
19036
- const resolved = import_node_path11.default.resolve(customDir);
19037
- if (import_node_fs8.default.existsSync(resolved)) {
19038
- return resolved;
19036
+ const home2 = import_node_os2.default.homedir();
19037
+ const lower = customDir.toLowerCase();
19038
+ if (lower === "openclaw") {
19039
+ return import_node_path11.default.join(home2, ".openclaw");
19039
19040
  }
19040
- return resolved;
19041
+ if (lower === "lightclaw") {
19042
+ return import_node_path11.default.join(home2, ".lightclaw");
19043
+ }
19044
+ throw new Error(`Unsupported claw type: "${customDir}". Only "OpenClaw" or "LightClaw" is supported (case-insensitive).`);
19041
19045
  }
19042
19046
  const envHome = process.env.OPENCLAW_HOME || process.env.LIGHTCLAW_HOME;
19043
19047
  if (envHome) {
@@ -19063,8 +19067,15 @@ function findOpenClawDir(customDir) {
19063
19067
  }
19064
19068
  function findAllClawDirs(customDir) {
19065
19069
  if (customDir) {
19066
- const resolved = import_node_path11.default.resolve(customDir);
19067
- return import_node_fs8.default.existsSync(resolved) ? [resolved] : [resolved];
19070
+ const home2 = import_node_os2.default.homedir();
19071
+ const lower = customDir.toLowerCase();
19072
+ if (lower === "openclaw") {
19073
+ return [import_node_path11.default.join(home2, ".openclaw")];
19074
+ }
19075
+ if (lower === "lightclaw") {
19076
+ return [import_node_path11.default.join(home2, ".lightclaw")];
19077
+ }
19078
+ throw new Error(`Unsupported claw type: "${customDir}". Only "OpenClaw" or "LightClaw" is supported (case-insensitive).`);
19068
19079
  }
19069
19080
  const envHome = process.env.OPENCLAW_HOME || process.env.LIGHTCLAW_HOME;
19070
19081
  if (envHome) {
@@ -19207,9 +19218,10 @@ function writeOpenClawConfig(clawDir, config) {
19207
19218
  import_node_fs8.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
19208
19219
  }
19209
19220
  function updateOpenClawConfig(clawDir, updater) {
19210
- const config = readOpenClawConfig(clawDir);
19221
+ let config = readOpenClawConfig(clawDir);
19211
19222
  if (!config) {
19212
- return false;
19223
+ logger.info(`Config file not found in ${clawDir}, creating default config.`);
19224
+ config = { agents: { list: [] } };
19213
19225
  }
19214
19226
  const updated = updater(config);
19215
19227
  writeOpenClawConfig(clawDir, updated);
@@ -19765,15 +19777,15 @@ var installCommand = new Command("install").description("Install an agent or tea
19765
19777
  "--dir <path>",
19766
19778
  "Target directory (defaults to OpenClaw/LightClaw workspace)"
19767
19779
  ).option(
19768
- "--claw-dir <path>",
19769
- "OpenClaw/LightClaw installation directory (overrides OPENCLAW_HOME/LIGHTCLAW_HOME env var, defaults to ~/.openclaw or ~/.lightclaw)"
19780
+ "--clawtype <type>",
19781
+ "Specify claw type: OpenClaw or LightClaw (case-insensitive)"
19770
19782
  ).action(async (name, options) => {
19771
19783
  try {
19772
19784
  const asMain = !!options.main;
19773
19785
  if (options.from) {
19774
- await installFromSource(options.from, options.dir, options.clawDir, asMain);
19786
+ await installFromSource(options.from, options.dir, options.clawtype, asMain);
19775
19787
  } else if (name) {
19776
- await installFromRegistry(name, options.dir, options.clawDir, asMain);
19788
+ await installFromRegistry(name, options.dir, options.clawtype, asMain);
19777
19789
  } else {
19778
19790
  console.error(source_default.red("Please specify an agent or team name, or use --from to install from a local source."));
19779
19791
  console.log(source_default.dim(" Examples:"));
@@ -19781,7 +19793,7 @@ var installCommand = new Command("install").description("Install an agent or tea
19781
19793
  console.log(source_default.dim(" soulhub install writer-wechat --main # Install as main agent"));
19782
19794
  console.log(source_default.dim(" soulhub install dev-squad # Install a team from registry"));
19783
19795
  console.log(source_default.dim(" soulhub install --from ./agent-team/ # Install from local directory"));
19784
- console.log(source_default.dim(" soulhub install writer-wechat --claw-dir ~/.lightclaw # Install to specific claw"));
19796
+ console.log(source_default.dim(" soulhub install writer-wechat --clawtype LightClaw # Install to specific claw"));
19785
19797
  process.exit(1);
19786
19798
  }
19787
19799
  } catch (error) {
@@ -19834,7 +19846,13 @@ async function installSingleAgent(name, targetDir, clawDir, asMain = false) {
19834
19846
  spinner.text = `Downloading ${source_default.cyan(agent.displayName)} package...`;
19835
19847
  const pkgDir = await downloadAgentPackage(name, agent.version);
19836
19848
  spinner.succeed(`Package ${source_default.cyan(agent.displayName)} downloaded.`);
19849
+ const showClawHeader = allClawDirs.length > 1;
19837
19850
  for (const selectedClawDir of allClawDirs) {
19851
+ if (showClawHeader) {
19852
+ const brand = detectClawBrand(selectedClawDir);
19853
+ console.log();
19854
+ console.log(source_default.bold(`\u2500\u2500 ${brand} (${selectedClawDir}) \u2500\u2500`));
19855
+ }
19838
19856
  await installSingleAgentToClaw(name, selectedClawDir, void 0, asMain, pkgDir, agent);
19839
19857
  }
19840
19858
  import_node_fs9.default.rmSync(pkgDir, { recursive: true, force: true });
@@ -20120,7 +20138,13 @@ async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain
20120
20138
  printOpenClawInstallHelp();
20121
20139
  return;
20122
20140
  }
20141
+ const showClawHeader = allClawDirs.length > 1;
20123
20142
  for (const selectedClawDir of allClawDirs) {
20143
+ if (showClawHeader) {
20144
+ const brand = detectClawBrand(selectedClawDir);
20145
+ console.log();
20146
+ console.log(source_default.bold(`\u2500\u2500 ${brand} (${selectedClawDir}) \u2500\u2500`));
20147
+ }
20124
20148
  await installSingleAgentFromDirToClaw(packageDir, agentName, pkg, selectedClawDir, void 0, asMain);
20125
20149
  }
20126
20150
  }
@@ -20389,7 +20413,7 @@ async function extractZipToDir(zip, targetDir) {
20389
20413
  }
20390
20414
  function printOpenClawInstallHelp() {
20391
20415
  console.log(source_default.dim(" Please install OpenClaw or LightClaw first, or use one of the following options:"));
20392
- console.log(source_default.dim(" --claw-dir <path> Specify OpenClaw/LightClaw installation directory"));
20416
+ console.log(source_default.dim(" --clawtype <type> Specify claw type: OpenClaw or LightClaw"));
20393
20417
  console.log(source_default.dim(" --dir <path> Specify agent target directory directly"));
20394
20418
  console.log(source_default.dim(" OPENCLAW_HOME=<path> Set environment variable (for OpenClaw)"));
20395
20419
  console.log(source_default.dim(" LIGHTCLAW_HOME=<path> Set environment variable (for LightClaw)"));
@@ -20522,16 +20546,16 @@ var updateCommand = new Command("update").description("Update installed agents t
20522
20546
  var import_node_fs11 = __toESM(require("fs"), 1);
20523
20547
  var import_node_path13 = __toESM(require("path"), 1);
20524
20548
  var rollbackCommand = new Command("rollback").description("Rollback to a previous agent installation state").option("--list", "List available rollback records").option("--id <id>", "Rollback to a specific backup record by ID").option(
20525
- "--claw-dir <path>",
20526
- "OpenClaw/LightClaw installation directory (overrides OPENCLAW_HOME/LIGHTCLAW_HOME env var)"
20549
+ "--clawtype <type>",
20550
+ "Specify claw type: OpenClaw or LightClaw (case-insensitive)"
20527
20551
  ).action(async (options) => {
20528
20552
  try {
20529
20553
  if (options.list) {
20530
20554
  listBackupRecords();
20531
20555
  } else if (options.id) {
20532
- await performRollback(options.id, options.clawDir);
20556
+ await performRollback(options.id, options.clawtype);
20533
20557
  } else {
20534
- await performRollback(void 0, options.clawDir);
20558
+ await performRollback(void 0, options.clawtype);
20535
20559
  }
20536
20560
  } catch (error) {
20537
20561
  logger.errorObj("Rollback command failed", error);
@@ -20703,13 +20727,13 @@ function formatInstallType(type2) {
20703
20727
 
20704
20728
  // src/index.ts
20705
20729
  var program2 = new Command();
20706
- program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.18").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
20730
+ program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.20").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
20707
20731
  const opts = program2.opts();
20708
20732
  const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
20709
20733
  logger.init(verbose);
20710
20734
  logger.info("CLI started", {
20711
20735
  args: process.argv.slice(2),
20712
- version: "1.0.18",
20736
+ version: "1.0.20",
20713
20737
  node: process.version
20714
20738
  });
20715
20739
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulhubcli",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "SoulHub CLI - Install and manage AI agent persona templates for OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {