soulhubcli 1.0.20 → 1.0.21
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/dist/index.cjs +28 -23
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19440,11 +19440,12 @@ var CATEGORY_LABELS = {
|
|
|
19440
19440
|
education: "Education",
|
|
19441
19441
|
dispatcher: "Dispatcher"
|
|
19442
19442
|
};
|
|
19443
|
-
function registerAgentToOpenClaw(agentName, workspaceDir,
|
|
19443
|
+
function registerAgentToOpenClaw(agentName, workspaceDir, clawDir) {
|
|
19444
19444
|
const agentId = agentName.toLowerCase().replace(/[\s_]+/g, "-");
|
|
19445
|
-
|
|
19445
|
+
const brandName = clawDir ? detectClawBrand(clawDir) : "OpenClaw/LightClaw";
|
|
19446
|
+
logger.debug(`Registering agent to ${brandName}`, { agentId, workspaceDir });
|
|
19446
19447
|
try {
|
|
19447
|
-
const clawCmd = detectClawCommand();
|
|
19448
|
+
const clawCmd = detectClawCommand(clawDir);
|
|
19448
19449
|
(0, import_node_child_process.execSync)(
|
|
19449
19450
|
`${clawCmd} agents add "${agentId}" --workspace "${workspaceDir}" --non-interactive --json`,
|
|
19450
19451
|
{ stdio: "pipe", timeout: 15e3 }
|
|
@@ -19458,8 +19459,8 @@ function registerAgentToOpenClaw(agentName, workspaceDir, _clawDir) {
|
|
|
19458
19459
|
if (stderr.includes("already exists")) {
|
|
19459
19460
|
logger.info(`Agent "${agentId}" already exists in CLI, updating config...`);
|
|
19460
19461
|
try {
|
|
19461
|
-
const
|
|
19462
|
-
addAgentToOpenClawConfig(
|
|
19462
|
+
const resolvedClawDir = clawDir || import_node_path11.default.dirname(workspaceDir);
|
|
19463
|
+
addAgentToOpenClawConfig(resolvedClawDir, agentId, agentName, false);
|
|
19463
19464
|
} catch {
|
|
19464
19465
|
logger.warn(`Failed to update config for existing agent "${agentId}", skipping.`);
|
|
19465
19466
|
}
|
|
@@ -19471,8 +19472,8 @@ function registerAgentToOpenClaw(agentName, workspaceDir, _clawDir) {
|
|
|
19471
19472
|
const errMsg = cliError instanceof Error ? cliError.message : String(cliError);
|
|
19472
19473
|
logger.warn(`CLI agents add failed, falling back to config file modification`, { agentId, stderr, error: errMsg });
|
|
19473
19474
|
try {
|
|
19474
|
-
const
|
|
19475
|
-
const configUpdated = addAgentToOpenClawConfig(
|
|
19475
|
+
const resolvedClawDir = clawDir || import_node_path11.default.dirname(workspaceDir);
|
|
19476
|
+
const configUpdated = addAgentToOpenClawConfig(resolvedClawDir, agentId, agentName, false);
|
|
19476
19477
|
if (configUpdated) {
|
|
19477
19478
|
logger.info(`Agent "${agentId}" registered via config file fallback.`);
|
|
19478
19479
|
return {
|
|
@@ -19496,7 +19497,11 @@ function registerAgentToOpenClaw(agentName, workspaceDir, _clawDir) {
|
|
|
19496
19497
|
}
|
|
19497
19498
|
}
|
|
19498
19499
|
}
|
|
19499
|
-
function detectClawCommand() {
|
|
19500
|
+
function detectClawCommand(clawDir) {
|
|
19501
|
+
if (clawDir) {
|
|
19502
|
+
const brand = detectClawBrand(clawDir);
|
|
19503
|
+
return brand === "LightClaw" ? "lightclaw" : "openclaw";
|
|
19504
|
+
}
|
|
19500
19505
|
try {
|
|
19501
19506
|
(0, import_node_child_process.execSync)("which lightclaw 2>/dev/null || where lightclaw 2>nul", { stdio: "pipe" });
|
|
19502
19507
|
return "lightclaw";
|
|
@@ -19509,8 +19514,8 @@ function detectClawCommand() {
|
|
|
19509
19514
|
}
|
|
19510
19515
|
return "openclaw";
|
|
19511
19516
|
}
|
|
19512
|
-
function restartOpenClawGateway() {
|
|
19513
|
-
const clawCmd = detectClawCommand();
|
|
19517
|
+
function restartOpenClawGateway(clawDir) {
|
|
19518
|
+
const clawCmd = detectClawCommand(clawDir);
|
|
19514
19519
|
logger.debug(`Restarting ${clawCmd} Gateway`);
|
|
19515
19520
|
try {
|
|
19516
19521
|
(0, import_node_child_process.execSync)(`${clawCmd} gateway restart`, {
|
|
@@ -19963,7 +19968,7 @@ async function installSingleAgentToClaw(name, selectedClawDir, targetDir, asMain
|
|
|
19963
19968
|
console.log(` ${source_default.dim("Version:")} ${agent.version}`);
|
|
19964
19969
|
console.log(` ${source_default.dim("Type:")} ${typeLabel}`);
|
|
19965
19970
|
if (!targetDir) {
|
|
19966
|
-
await tryRestartGateway();
|
|
19971
|
+
await tryRestartGateway(selectedClawDir || void 0);
|
|
19967
19972
|
}
|
|
19968
19973
|
console.log();
|
|
19969
19974
|
}
|
|
@@ -20024,7 +20029,7 @@ async function installRecipeFromRegistry(name, recipe, targetDir, clawDir) {
|
|
|
20024
20029
|
const agentId = worker.name;
|
|
20025
20030
|
const workerDir = targetDir ? import_node_path12.default.join(resolvedClawDir, `workspace-${agentId}`) : getWorkspaceDir(resolvedClawDir, agentId);
|
|
20026
20031
|
if (!targetDir) {
|
|
20027
|
-
const regResult = registerAgentToOpenClaw(agentId, workerDir,
|
|
20032
|
+
const regResult = registerAgentToOpenClaw(agentId, workerDir, resolvedClawDir);
|
|
20028
20033
|
if (!regResult.success) {
|
|
20029
20034
|
console.log(source_default.yellow(` \u26A0 Failed to register ${agentId}: ${regResult.message}`));
|
|
20030
20035
|
continue;
|
|
@@ -20056,7 +20061,7 @@ async function installRecipeFromRegistry(name, recipe, targetDir, clawDir) {
|
|
|
20056
20061
|
);
|
|
20057
20062
|
printTeamSummary(pkg, workerIds);
|
|
20058
20063
|
if (!targetDir) {
|
|
20059
|
-
await tryRestartGateway();
|
|
20064
|
+
await tryRestartGateway(resolvedClawDir);
|
|
20060
20065
|
}
|
|
20061
20066
|
}
|
|
20062
20067
|
async function installFromSource(source, targetDir, clawDir, asMain) {
|
|
@@ -20229,7 +20234,7 @@ async function installSingleAgentFromDirToClaw(packageDir, agentName, pkg, selec
|
|
|
20229
20234
|
console.log(` ${source_default.dim("Source:")} ${packageDir}`);
|
|
20230
20235
|
console.log(` ${source_default.dim("Type:")} ${typeLabel}`);
|
|
20231
20236
|
if (!targetDir) {
|
|
20232
|
-
await tryRestartGateway();
|
|
20237
|
+
await tryRestartGateway(selectedClawDir || void 0);
|
|
20233
20238
|
}
|
|
20234
20239
|
console.log();
|
|
20235
20240
|
}
|
|
@@ -20315,7 +20320,7 @@ async function installTeamFromDir(packageDir, targetDir, clawDir) {
|
|
|
20315
20320
|
spinner.text = `Installing worker ${source_default.cyan(agentId)}...`;
|
|
20316
20321
|
const workerWorkspace = targetDir ? import_node_path12.default.join(resolvedClawDir, `workspace-${agentId}`) : getWorkspaceDir(resolvedClawDir, agentId);
|
|
20317
20322
|
if (!targetDir) {
|
|
20318
|
-
const regResult = registerAgentToOpenClaw(agentId, workerWorkspace,
|
|
20323
|
+
const regResult = registerAgentToOpenClaw(agentId, workerWorkspace, resolvedClawDir);
|
|
20319
20324
|
if (!regResult.success) {
|
|
20320
20325
|
console.log(source_default.yellow(` \u26A0 Failed to register ${agentId}: ${regResult.message}`));
|
|
20321
20326
|
continue;
|
|
@@ -20345,7 +20350,7 @@ async function installTeamFromDir(packageDir, targetDir, clawDir) {
|
|
|
20345
20350
|
);
|
|
20346
20351
|
printTeamSummary(pkg, workerIds);
|
|
20347
20352
|
if (!targetDir) {
|
|
20348
|
-
await tryRestartGateway();
|
|
20353
|
+
await tryRestartGateway(resolvedClawDir);
|
|
20349
20354
|
}
|
|
20350
20355
|
}
|
|
20351
20356
|
function copyAgentFilesFromDir(sourceDir, targetDir) {
|
|
@@ -20433,11 +20438,11 @@ function printTeamSummary(pkg, workerIds) {
|
|
|
20433
20438
|
}
|
|
20434
20439
|
console.log();
|
|
20435
20440
|
}
|
|
20436
|
-
async function tryRestartGateway() {
|
|
20437
|
-
const clawCmd = detectClawCommand();
|
|
20441
|
+
async function tryRestartGateway(clawDir) {
|
|
20442
|
+
const clawCmd = detectClawCommand(clawDir);
|
|
20438
20443
|
const brandName = clawCmd === "lightclaw" ? "LightClaw" : "OpenClaw";
|
|
20439
20444
|
const restartSpinner = createSpinner(`Restarting ${brandName} Gateway...`).start();
|
|
20440
|
-
const result = restartOpenClawGateway();
|
|
20445
|
+
const result = restartOpenClawGateway(clawDir);
|
|
20441
20446
|
if (result.success) {
|
|
20442
20447
|
restartSpinner.succeed(`${brandName} Gateway restarted successfully.`);
|
|
20443
20448
|
} else {
|
|
@@ -20696,10 +20701,10 @@ async function performRollback(recordId, clawDir) {
|
|
|
20696
20701
|
spinner.succeed(
|
|
20697
20702
|
`Rolled back ${source_default.cyan.bold(record.packageName)} successfully! (${restoredCount} item(s) restored)`
|
|
20698
20703
|
);
|
|
20699
|
-
const clawCmd = detectClawCommand();
|
|
20704
|
+
const clawCmd = detectClawCommand(resolvedClawDir);
|
|
20700
20705
|
const brandName = clawCmd === "lightclaw" ? "LightClaw" : "OpenClaw";
|
|
20701
20706
|
const restartSpinner = createSpinner(`Restarting ${brandName} Gateway...`).start();
|
|
20702
|
-
const result = restartOpenClawGateway();
|
|
20707
|
+
const result = restartOpenClawGateway(resolvedClawDir);
|
|
20703
20708
|
if (result.success) {
|
|
20704
20709
|
restartSpinner.succeed(`${brandName} Gateway restarted successfully.`);
|
|
20705
20710
|
} else {
|
|
@@ -20727,13 +20732,13 @@ function formatInstallType(type2) {
|
|
|
20727
20732
|
|
|
20728
20733
|
// src/index.ts
|
|
20729
20734
|
var program2 = new Command();
|
|
20730
|
-
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.
|
|
20735
|
+
program2.name("soulhub").description("SoulHub CLI - Discover, install and manage AI agent souls").version("1.0.21").option("--verbose", "Enable verbose debug logging").hook("preAction", () => {
|
|
20731
20736
|
const opts = program2.opts();
|
|
20732
20737
|
const verbose = opts.verbose || process.env.SOULHUB_DEBUG === "1";
|
|
20733
20738
|
logger.init(verbose);
|
|
20734
20739
|
logger.info("CLI started", {
|
|
20735
20740
|
args: process.argv.slice(2),
|
|
20736
|
-
version: "1.0.
|
|
20741
|
+
version: "1.0.21",
|
|
20737
20742
|
node: process.version
|
|
20738
20743
|
});
|
|
20739
20744
|
});
|