soulhubcli 1.0.16 → 1.0.17

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 +36 -13
  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() {
@@ -20683,13 +20706,13 @@ function formatInstallType(type2) {
20683
20706
 
20684
20707
  // src/index.ts
20685
20708
  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", () => {
20709
+ program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.17").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
20687
20710
  const opts = program2.opts();
20688
20711
  const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
20689
20712
  logger.init(verbose);
20690
20713
  logger.info("CLI started", {
20691
20714
  args: process.argv.slice(2),
20692
- version: "1.0.16",
20715
+ version: "1.0.17",
20693
20716
  node: process.version
20694
20717
  });
20695
20718
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulhubcli",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "SoulHub CLI - Install and manage AI agent persona templates for OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {