soulhubcli 1.0.16 → 1.0.18

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 +39 -19
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -19246,6 +19246,10 @@ function addAgentToOpenClawConfig(clawDir, agentId, agentName, isMain) {
19246
19246
  const existing = config.agents.list.find((a) => a.id === agentId);
19247
19247
  if (existing) {
19248
19248
  existing.name = agentName;
19249
+ if (!isMain) {
19250
+ existing.workspace = import_node_path11.default.join(clawDir, `workspace-${agentId}`);
19251
+ existing.agentDir = import_node_path11.default.join(clawDir, `agents/${agentId}/agent`);
19252
+ }
19249
19253
  return config;
19250
19254
  }
19251
19255
  if (isMain) {
@@ -19440,25 +19444,44 @@ function registerAgentToOpenClaw(agentName, workspaceDir, _clawDir) {
19440
19444
  } catch (cliError) {
19441
19445
  const stderr = cliError && typeof cliError === "object" && "stderr" in cliError ? String(cliError.stderr) : "";
19442
19446
  if (stderr.includes("already exists")) {
19447
+ logger.info(`Agent "${agentId}" already exists in CLI, updating config...`);
19448
+ try {
19449
+ const clawDir = _clawDir || import_node_path11.default.dirname(workspaceDir);
19450
+ addAgentToOpenClawConfig(clawDir, agentId, agentName, false);
19451
+ } catch {
19452
+ logger.warn(`Failed to update config for existing agent "${agentId}", skipping.`);
19453
+ }
19443
19454
  return {
19444
19455
  success: true,
19445
- message: `Agent "${agentId}" already registered.`
19456
+ message: `Agent "${agentId}" already registered, config updated.`
19446
19457
  };
19447
19458
  }
19448
- const isCommandNotFound = cliError && typeof cliError === "object" && "code" in cliError && cliError.code === "ENOENT" || stderr.includes("not found") || stderr.includes("not recognized");
19449
- if (isCommandNotFound) {
19450
- logger.error(`OpenClaw/LightClaw CLI not found`);
19459
+ const errMsg = cliError instanceof Error ? cliError.message : String(cliError);
19460
+ logger.warn(`CLI agents add failed, falling back to config file modification`, { agentId, stderr, error: errMsg });
19461
+ try {
19462
+ const clawDir = _clawDir || import_node_path11.default.dirname(workspaceDir);
19463
+ const configUpdated = addAgentToOpenClawConfig(clawDir, agentId, agentName, false);
19464
+ if (configUpdated) {
19465
+ logger.info(`Agent "${agentId}" registered via config file fallback.`);
19466
+ return {
19467
+ success: true,
19468
+ message: `Agent "${agentId}" registered via config file (CLI fallback).`
19469
+ };
19470
+ } else {
19471
+ logger.error(`Failed to update config file for agent "${agentId}"`);
19472
+ return {
19473
+ success: false,
19474
+ message: `Failed to register "${agentId}": CLI command failed and config file update also failed.`
19475
+ };
19476
+ }
19477
+ } catch (configError) {
19478
+ const configErrMsg = configError instanceof Error ? configError.message : String(configError);
19479
+ logger.error(`Config file fallback also failed`, { agentId, error: configErrMsg });
19451
19480
  return {
19452
19481
  success: false,
19453
- message: "OpenClaw/LightClaw CLI not found. Please install first."
19482
+ message: `Failed to register "${agentId}": CLI failed (${stderr || errMsg}), config fallback also failed (${configErrMsg}).`
19454
19483
  };
19455
19484
  }
19456
- const errMsg = cliError instanceof Error ? cliError.message : String(cliError);
19457
- logger.error(`openclaw agents add failed`, { agentId, stderr, error: errMsg });
19458
- return {
19459
- success: false,
19460
- message: `openclaw agents add failed: ${stderr || errMsg}`
19461
- };
19462
19485
  }
19463
19486
  }
19464
19487
  function detectClawCommand() {
@@ -19888,7 +19911,7 @@ async function installSingleAgentToClaw(name, selectedClawDir, targetDir, asMain
19888
19911
  addAgentToOpenClawConfig(selectedClawDir, "main", name, true);
19889
19912
  } else {
19890
19913
  spinner.text = `Registering ${source_default.cyan(agent.displayName)} as worker agent...`;
19891
- const regResult = registerAgentToOpenClaw(agentId, workspaceDir);
19914
+ const regResult = registerAgentToOpenClaw(agentId, workspaceDir, selectedClawDir || void 0);
19892
19915
  if (!regResult.success) {
19893
19916
  spinner.fail(`Failed to register ${agentId}: ${regResult.message}`);
19894
19917
  return;
@@ -20156,7 +20179,7 @@ async function installSingleAgentFromDirToClaw(packageDir, agentName, pkg, selec
20156
20179
  addAgentToOpenClawConfig(selectedClawDir, "main", agentName, true);
20157
20180
  } else {
20158
20181
  spinner.text = `Registering ${source_default.cyan(agentName)} as worker agent...`;
20159
- const regResult = registerAgentToOpenClaw(agentId, workspaceDir);
20182
+ const regResult = registerAgentToOpenClaw(agentId, workspaceDir, selectedClawDir || void 0);
20160
20183
  if (!regResult.success) {
20161
20184
  spinner.fail(`Failed to register ${agentId}: ${regResult.message}`);
20162
20185
  return;
@@ -20394,10 +20417,7 @@ async function tryRestartGateway() {
20394
20417
  if (result.success) {
20395
20418
  restartSpinner.succeed(`${brandName} Gateway restarted successfully.`);
20396
20419
  } else {
20397
- restartSpinner.warn(`Failed to restart ${brandName} Gateway.`);
20398
- console.log(source_default.yellow(` Reason: ${result.message}`));
20399
- console.log(source_default.dim(" Please restart manually:"));
20400
- console.log(source_default.dim(` ${clawCmd} gateway restart`));
20420
+ restartSpinner.warn(`Failed to restart ${brandName} Gateway. Please restart it manually.`);
20401
20421
  }
20402
20422
  }
20403
20423
 
@@ -20683,13 +20703,13 @@ function formatInstallType(type2) {
20683
20703
 
20684
20704
  // src/index.ts
20685
20705
  var program2 = new Command();
20686
- program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.16").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
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", () => {
20687
20707
  const opts = program2.opts();
20688
20708
  const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
20689
20709
  logger.init(verbose);
20690
20710
  logger.info("CLI started", {
20691
20711
  args: process.argv.slice(2),
20692
- version: "1.0.16",
20712
+ version: "1.0.18",
20693
20713
  node: process.version
20694
20714
  });
20695
20715
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulhubcli",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "SoulHub CLI - Install and manage AI agent persona templates for OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {