apero-kit-cli 2.4.5 → 2.4.7
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.js +53 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -865,6 +865,7 @@ async function setupOpenClawConfig(token) {
|
|
|
865
865
|
try {
|
|
866
866
|
execSync3(`openclaw config set channels.discord.token '"${token}"' --json`, { stdio: "ignore" });
|
|
867
867
|
execSync3("openclaw config set channels.discord.enabled true --json", { stdio: "ignore" });
|
|
868
|
+
execSync3("openclaw config set gateway.mode local", { stdio: "ignore" });
|
|
868
869
|
return { success: true, message: "OpenClaw configured successfully!" };
|
|
869
870
|
} catch (error) {
|
|
870
871
|
return { success: false, message: `Failed to configure OpenClaw: ${error.message}` };
|
|
@@ -1314,6 +1315,25 @@ function isOpenClawInstalled() {
|
|
|
1314
1315
|
return false;
|
|
1315
1316
|
}
|
|
1316
1317
|
}
|
|
1318
|
+
function isDiscordConfigured() {
|
|
1319
|
+
try {
|
|
1320
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1321
|
+
const result = execSync3("openclaw config get channels.discord.token 2>/dev/null", { encoding: "utf-8" });
|
|
1322
|
+
return result && result.trim().length > 10;
|
|
1323
|
+
} catch {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
function restartGateway() {
|
|
1328
|
+
try {
|
|
1329
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1330
|
+
console.log(pc.cyan("Restarting OpenClaw gateway..."));
|
|
1331
|
+
execSync3("openclaw gateway restart", { stdio: "inherit" });
|
|
1332
|
+
return true;
|
|
1333
|
+
} catch {
|
|
1334
|
+
return false;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1317
1337
|
async function installOpenClaw() {
|
|
1318
1338
|
const { execSync: execSync3 } = __require("child_process");
|
|
1319
1339
|
try {
|
|
@@ -1345,6 +1365,36 @@ async function promptDiscordSetup() {
|
|
|
1345
1365
|
openclawInstalled = await installOpenClaw();
|
|
1346
1366
|
}
|
|
1347
1367
|
}
|
|
1368
|
+
if (openclawInstalled && isDiscordConfigured()) {
|
|
1369
|
+
console.log(pc.green("\u2713 Discord bot token already configured."));
|
|
1370
|
+
console.log("");
|
|
1371
|
+
const action = await p.select({
|
|
1372
|
+
message: "What do you want to do?",
|
|
1373
|
+
options: [
|
|
1374
|
+
{ value: "restart", label: "Restart gateway", hint: "Use existing config" },
|
|
1375
|
+
{ value: "reconfigure", label: "Reconfigure", hint: "Enter new token" },
|
|
1376
|
+
{ value: "skip", label: "Skip setup", hint: "Continue without changes" }
|
|
1377
|
+
]
|
|
1378
|
+
});
|
|
1379
|
+
if (p.isCancel(action)) process.exit(0);
|
|
1380
|
+
if (action === "restart") {
|
|
1381
|
+
restartGateway();
|
|
1382
|
+
return {
|
|
1383
|
+
token: "",
|
|
1384
|
+
autoSetup: false,
|
|
1385
|
+
openclawInstalled: true,
|
|
1386
|
+
restartOnly: true
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
if (action === "skip") {
|
|
1390
|
+
return {
|
|
1391
|
+
token: "",
|
|
1392
|
+
autoSetup: false,
|
|
1393
|
+
openclawInstalled: true,
|
|
1394
|
+
restartOnly: true
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1348
1398
|
console.log(pc.gray("Get your bot token from: https://discord.com/developers/applications"));
|
|
1349
1399
|
console.log("");
|
|
1350
1400
|
const token = await p.password({
|
|
@@ -1663,7 +1713,7 @@ async function initCommand(projectName, options) {
|
|
|
1663
1713
|
} else if (target === "discord") {
|
|
1664
1714
|
spinner.text = mergeMode ? `Merging config (${targetLabel})...` : `Copying config (${targetLabel})...`;
|
|
1665
1715
|
await copyDiscordBaseFiles(targetDir, mergeMode);
|
|
1666
|
-
if (discordConfig) {
|
|
1716
|
+
if (discordConfig && !discordConfig.restartOnly) {
|
|
1667
1717
|
spinner.text = "Configuring Discord bot...";
|
|
1668
1718
|
await updateDiscordConfig(targetDir, discordConfig.token, discordConfig.guildId);
|
|
1669
1719
|
if (discordConfig.autoSetup) {
|
|
@@ -1675,6 +1725,8 @@ async function initCommand(projectName, options) {
|
|
|
1675
1725
|
Note: ${result.message}`));
|
|
1676
1726
|
}
|
|
1677
1727
|
}
|
|
1728
|
+
} else if (discordConfig?.restartOnly) {
|
|
1729
|
+
openclawSetupSuccess = true;
|
|
1678
1730
|
}
|
|
1679
1731
|
}
|
|
1680
1732
|
}
|