apero-kit-cli 2.4.6 → 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 +52 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1315,6 +1315,25 @@ function isOpenClawInstalled() {
|
|
|
1315
1315
|
return false;
|
|
1316
1316
|
}
|
|
1317
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
|
+
}
|
|
1318
1337
|
async function installOpenClaw() {
|
|
1319
1338
|
const { execSync: execSync3 } = __require("child_process");
|
|
1320
1339
|
try {
|
|
@@ -1346,6 +1365,36 @@ async function promptDiscordSetup() {
|
|
|
1346
1365
|
openclawInstalled = await installOpenClaw();
|
|
1347
1366
|
}
|
|
1348
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
|
+
}
|
|
1349
1398
|
console.log(pc.gray("Get your bot token from: https://discord.com/developers/applications"));
|
|
1350
1399
|
console.log("");
|
|
1351
1400
|
const token = await p.password({
|
|
@@ -1664,7 +1713,7 @@ async function initCommand(projectName, options) {
|
|
|
1664
1713
|
} else if (target === "discord") {
|
|
1665
1714
|
spinner.text = mergeMode ? `Merging config (${targetLabel})...` : `Copying config (${targetLabel})...`;
|
|
1666
1715
|
await copyDiscordBaseFiles(targetDir, mergeMode);
|
|
1667
|
-
if (discordConfig) {
|
|
1716
|
+
if (discordConfig && !discordConfig.restartOnly) {
|
|
1668
1717
|
spinner.text = "Configuring Discord bot...";
|
|
1669
1718
|
await updateDiscordConfig(targetDir, discordConfig.token, discordConfig.guildId);
|
|
1670
1719
|
if (discordConfig.autoSetup) {
|
|
@@ -1676,6 +1725,8 @@ async function initCommand(projectName, options) {
|
|
|
1676
1725
|
Note: ${result.message}`));
|
|
1677
1726
|
}
|
|
1678
1727
|
}
|
|
1728
|
+
} else if (discordConfig?.restartOnly) {
|
|
1729
|
+
openclawSetupSuccess = true;
|
|
1679
1730
|
}
|
|
1680
1731
|
}
|
|
1681
1732
|
}
|