soulhubcli 1.0.14 → 1.0.15

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 (2) hide show
  1. package/dist/index.cjs +70 -17
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -19725,13 +19725,40 @@ function createSpinner(initialText = "") {
19725
19725
  // src/commands/install.ts
19726
19726
  var import_node_fs9 = __toESM(require("fs"), 1);
19727
19727
  var import_node_path12 = __toESM(require("path"), 1);
19728
+ var import_node_readline2 = __toESM(require("readline"), 1);
19728
19729
  async function resolveClawDir(clawDir) {
19729
19730
  if (clawDir) {
19730
19731
  return findOpenClawDir(clawDir);
19731
19732
  }
19732
19733
  return promptSelectClawDir();
19733
19734
  }
19734
- var installCommand = new Command("install").description("Install an agent or team from the SoulHub registry (default: as worker)").argument("[name]", "Agent or team name to install").option("--from <source>", "Install from a local directory, ZIP file, or URL").option("--main", "Install as main agent (default is worker/sub-agent)").option(
19735
+ async function promptInstallRole(agentName) {
19736
+ console.log();
19737
+ console.log(` How would you like to install ${source_default.cyan(agentName)}?`);
19738
+ console.log();
19739
+ console.log(` 1) ${source_default.blue("Main Agent")} Install as main agent (workspace/)`);
19740
+ console.log(` 2) ${source_default.green("Worker Agent")} Install as worker agent (workspace-${agentName}/)`);
19741
+ console.log();
19742
+ const rl = import_node_readline2.default.createInterface({
19743
+ input: process.stdin,
19744
+ output: process.stdout
19745
+ });
19746
+ return new Promise((resolve) => {
19747
+ rl.question(" Please select (1-2, default: 2): ", (answer) => {
19748
+ rl.close();
19749
+ const trimmed = answer.trim();
19750
+ if (trimmed === "" || trimmed === "2") {
19751
+ resolve(false);
19752
+ } else if (trimmed === "1") {
19753
+ resolve(true);
19754
+ } else {
19755
+ console.log(" Invalid selection, operation cancelled.");
19756
+ resolve(null);
19757
+ }
19758
+ });
19759
+ });
19760
+ }
19761
+ var installCommand = new Command("install").description("Install an agent or team from the SoulHub registry (default: as worker)").argument("[name]", "Agent or team name to install").option("--from <source>", "Install from a local directory, ZIP file, or URL").option("--main", "Install as main agent (non-interactive)").option("--worker", "Install as worker/sub-agent (non-interactive)").option(
19735
19762
  "--dir <path>",
19736
19763
  "Target directory (defaults to OpenClaw/LightClaw workspace)"
19737
19764
  ).option(
@@ -19739,7 +19766,13 @@ var installCommand = new Command("install").description("Install an agent or tea
19739
19766
  "OpenClaw/LightClaw installation directory (overrides OPENCLAW_HOME/LIGHTCLAW_HOME env var, defaults to ~/.openclaw or ~/.lightclaw)"
19740
19767
  ).action(async (name, options) => {
19741
19768
  try {
19742
- const asMain = !!options.main;
19769
+ let asMain;
19770
+ if (options.main && options.worker) {
19771
+ console.error(source_default.red("Error: --main and --worker cannot be used together."));
19772
+ process.exit(1);
19773
+ }
19774
+ if (options.main) asMain = true;
19775
+ if (options.worker) asMain = false;
19743
19776
  if (options.from) {
19744
19777
  await installFromSource(options.from, options.dir, options.clawDir, asMain);
19745
19778
  } else if (name) {
@@ -19747,10 +19780,12 @@ var installCommand = new Command("install").description("Install an agent or tea
19747
19780
  } else {
19748
19781
  console.error(source_default.red("Please specify an agent or team name, or use --from to install from a local source."));
19749
19782
  console.log(source_default.dim(" Examples:"));
19750
- console.log(source_default.dim(" soulhub install writer-wechat # \u5B89\u88C5\u4E3A\u5B50 agent (workspace-writer-wechat/)"));
19751
- console.log(source_default.dim(" soulhub install writer-wechat --main # \u5B89\u88C5\u4E3A\u4E3B agent (workspace/)"));
19752
- console.log(source_default.dim(" soulhub install dev-squad # \u4ECE registry \u5B89\u88C5\u56E2\u961F"));
19753
- console.log(source_default.dim(" soulhub install --from ./agent-team/ # \u4ECE\u672C\u5730\u76EE\u5F55\u5B89\u88C5"));
19783
+ console.log(source_default.dim(" soulhub install writer-wechat # \u4EA4\u4E92\u5F0F\u9009\u62E9\u5B89\u88C5\u4E3A\u4E3B/\u5B50 agent"));
19784
+ console.log(source_default.dim(" soulhub install writer-wechat --main # \u975E\u4EA4\u4E92\u5F0F\uFF0C\u5B89\u88C5\u4E3A\u4E3B agent (workspace/)"));
19785
+ console.log(source_default.dim(" soulhub install writer-wechat --worker # \u975E\u4EA4\u4E92\u5F0F\uFF0C\u5B89\u88C5\u4E3A\u5B50 agent (workspace-xxx/)"));
19786
+ console.log(source_default.dim(" soulhub install dev-squad # \u4ECE registry \u5B89\u88C5\u56E2\u961F"));
19787
+ console.log(source_default.dim(" soulhub install --from ./agent-team/ # \u4ECE\u672C\u5730\u76EE\u5F55\u5B89\u88C5"));
19788
+ console.log(source_default.dim(" soulhub install writer-wechat --claw-dir ~/.lightclaw # \u975E\u4EA4\u4E92\u5F0F\u6307\u5B9A claw \u76EE\u5F55"));
19754
19789
  process.exit(1);
19755
19790
  }
19756
19791
  } catch (error) {
@@ -19762,14 +19797,14 @@ var installCommand = new Command("install").description("Install an agent or tea
19762
19797
  process.exit(1);
19763
19798
  }
19764
19799
  });
19765
- async function installFromRegistry(name, targetDir, clawDir, asMain = false) {
19800
+ async function installFromRegistry(name, targetDir, clawDir, asMain) {
19766
19801
  const spinner = createSpinner(`Checking registry for ${source_default.cyan(name)}...`).start();
19767
19802
  const index = await fetchIndex();
19768
19803
  const agent = index.agents.find((a) => a.name === name);
19769
19804
  const recipe = index.recipes.find((r) => r.name === name);
19770
19805
  if (agent && !recipe) {
19771
19806
  spinner.stop();
19772
- logger.info(`Installing single agent from registry: ${name}, asMain=${asMain}`);
19807
+ logger.info(`Installing single agent from registry: ${name}, asMain=${asMain ?? "interactive"}`);
19773
19808
  await installSingleAgent(name, targetDir, clawDir, asMain);
19774
19809
  } else if (recipe) {
19775
19810
  spinner.stop();
@@ -19781,7 +19816,7 @@ async function installFromRegistry(name, targetDir, clawDir, asMain = false) {
19781
19816
  console.log(source_default.dim(" Use 'soulhub search' to find available agents and teams."));
19782
19817
  }
19783
19818
  }
19784
- async function installSingleAgent(name, targetDir, clawDir, asMain = false) {
19819
+ async function installSingleAgent(name, targetDir, clawDir, asMain) {
19785
19820
  const spinner = createSpinner(`Checking environment...`).start();
19786
19821
  let selectedClawDir = null;
19787
19822
  if (!targetDir) {
@@ -19792,9 +19827,18 @@ async function installSingleAgent(name, targetDir, clawDir, asMain = false) {
19792
19827
  printOpenClawInstallHelp();
19793
19828
  return;
19794
19829
  }
19795
- spinner.start();
19796
19830
  const brand = detectClawBrand(selectedClawDir);
19797
- spinner.text = source_default.dim(`${brand} detected: ${selectedClawDir}`);
19831
+ console.log(source_default.dim(` ${brand} detected: ${selectedClawDir}`));
19832
+ }
19833
+ const agentId = name.toLowerCase().replace(/[\s_]+/g, "-");
19834
+ if (asMain === void 0) {
19835
+ const choice = await promptInstallRole(agentId);
19836
+ if (choice === null) return;
19837
+ asMain = choice;
19838
+ }
19839
+ logger.info(`Install role resolved: asMain=${asMain}`);
19840
+ if (!targetDir) {
19841
+ spinner.start();
19798
19842
  }
19799
19843
  spinner.text = `Fetching agent ${source_default.cyan(name)}...`;
19800
19844
  const index = await fetchIndex();
@@ -19805,7 +19849,6 @@ async function installSingleAgent(name, targetDir, clawDir, asMain = false) {
19805
19849
  return;
19806
19850
  }
19807
19851
  let workspaceDir;
19808
- const agentId = name.toLowerCase().replace(/[\s_]+/g, "-");
19809
19852
  if (targetDir) {
19810
19853
  workspaceDir = import_node_path12.default.resolve(targetDir);
19811
19854
  } else if (asMain) {
@@ -19990,7 +20033,7 @@ async function installRecipeFromRegistry(name, recipe, targetDir, clawDir) {
19990
20033
  await tryRestartGateway();
19991
20034
  }
19992
20035
  }
19993
- async function installFromSource(source, targetDir, clawDir, asMain = false) {
20036
+ async function installFromSource(source, targetDir, clawDir, asMain) {
19994
20037
  const spinner = createSpinner("Analyzing package...").start();
19995
20038
  let packageDir;
19996
20039
  let tempDir = null;
@@ -20056,7 +20099,7 @@ async function installFromSource(source, targetDir, clawDir, asMain = false) {
20056
20099
  import_node_fs9.default.rmSync(tempDir, { recursive: true, force: true });
20057
20100
  }
20058
20101
  }
20059
- async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain = false) {
20102
+ async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain) {
20060
20103
  const spinner = createSpinner("Installing single agent...").start();
20061
20104
  const pkg = readSoulHubPackage(packageDir);
20062
20105
  const agentName = pkg?.name || import_node_path12.default.basename(packageDir);
@@ -20069,10 +20112,20 @@ async function installSingleAgentFromDir(packageDir, targetDir, clawDir, asMain
20069
20112
  printOpenClawInstallHelp();
20070
20113
  return;
20071
20114
  }
20115
+ const brand = detectClawBrand(selectedClawDir);
20116
+ console.log(source_default.dim(` ${brand} detected: ${selectedClawDir}`));
20117
+ }
20118
+ const agentId = agentName.toLowerCase().replace(/[\s_]+/g, "-");
20119
+ if (asMain === void 0) {
20120
+ const choice = await promptInstallRole(agentId);
20121
+ if (choice === null) return;
20122
+ asMain = choice;
20123
+ }
20124
+ logger.info(`Install role resolved: asMain=${asMain}`);
20125
+ if (!targetDir) {
20072
20126
  spinner.start();
20073
20127
  }
20074
20128
  let workspaceDir;
20075
- const agentId = agentName.toLowerCase().replace(/[\s_]+/g, "-");
20076
20129
  if (targetDir) {
20077
20130
  workspaceDir = import_node_path12.default.resolve(targetDir);
20078
20131
  } else if (asMain) {
@@ -20649,13 +20702,13 @@ function formatInstallType(type2) {
20649
20702
 
20650
20703
  // src/index.ts
20651
20704
  var program2 = new Command();
20652
- program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.14").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
20705
+ program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.15").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
20653
20706
  const opts = program2.opts();
20654
20707
  const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
20655
20708
  logger.init(verbose);
20656
20709
  logger.info("CLI started", {
20657
20710
  args: process.argv.slice(2),
20658
- version: "1.0.14",
20711
+ version: "1.0.15",
20659
20712
  node: process.version
20660
20713
  });
20661
20714
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulhubcli",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "SoulHub CLI - Install and manage AI agent persona templates for OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {