apero-kit-cli 2.4.4 → 2.4.6
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 +41 -17
- 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,14 +1315,36 @@ function isOpenClawInstalled() {
|
|
|
1314
1315
|
return false;
|
|
1315
1316
|
}
|
|
1316
1317
|
}
|
|
1318
|
+
async function installOpenClaw() {
|
|
1319
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1320
|
+
try {
|
|
1321
|
+
console.log(pc.cyan("Installing OpenClaw CLI..."));
|
|
1322
|
+
execSync3("npm install -g openclaw", { stdio: "inherit" });
|
|
1323
|
+
console.log(pc.green("\u2713 OpenClaw CLI installed successfully!"));
|
|
1324
|
+
console.log("");
|
|
1325
|
+
return true;
|
|
1326
|
+
} catch (error) {
|
|
1327
|
+
console.log(pc.red("\u2717 Failed to install OpenClaw CLI"));
|
|
1328
|
+
console.log(pc.gray(" Try manually: npm install -g openclaw"));
|
|
1329
|
+
console.log("");
|
|
1330
|
+
return false;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1317
1333
|
async function promptDiscordSetup() {
|
|
1318
1334
|
console.log("");
|
|
1319
1335
|
console.log(pc.cyan("\u2501\u2501\u2501 Discord Bot Setup \u2501\u2501\u2501"));
|
|
1320
|
-
|
|
1336
|
+
let openclawInstalled = isOpenClawInstalled();
|
|
1321
1337
|
if (!openclawInstalled) {
|
|
1322
|
-
console.log(pc.yellow("\u26A0 OpenClaw CLI not found.
|
|
1323
|
-
console.log(pc.white(" npm install -g openclaw"));
|
|
1338
|
+
console.log(pc.yellow("\u26A0 OpenClaw CLI not found."));
|
|
1324
1339
|
console.log("");
|
|
1340
|
+
const shouldInstall = await p.confirm({
|
|
1341
|
+
message: "Install OpenClaw CLI now? (npm install -g openclaw)",
|
|
1342
|
+
initialValue: true
|
|
1343
|
+
});
|
|
1344
|
+
if (p.isCancel(shouldInstall)) process.exit(0);
|
|
1345
|
+
if (shouldInstall) {
|
|
1346
|
+
openclawInstalled = await installOpenClaw();
|
|
1347
|
+
}
|
|
1325
1348
|
}
|
|
1326
1349
|
console.log(pc.gray("Get your bot token from: https://discord.com/developers/applications"));
|
|
1327
1350
|
console.log("");
|
|
@@ -1352,15 +1375,20 @@ async function promptDiscordSetup() {
|
|
|
1352
1375
|
if (p.isCancel(guild)) process.exit(0);
|
|
1353
1376
|
guildId = guild;
|
|
1354
1377
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1378
|
+
let autoSetup = false;
|
|
1379
|
+
if (openclawInstalled) {
|
|
1380
|
+
const shouldAutoSetup = await p.confirm({
|
|
1381
|
+
message: "Auto-setup OpenClaw config?",
|
|
1382
|
+
initialValue: true
|
|
1383
|
+
});
|
|
1384
|
+
if (p.isCancel(shouldAutoSetup)) process.exit(0);
|
|
1385
|
+
autoSetup = shouldAutoSetup;
|
|
1386
|
+
}
|
|
1360
1387
|
return {
|
|
1361
1388
|
token,
|
|
1362
1389
|
guildId,
|
|
1363
|
-
autoSetup
|
|
1390
|
+
autoSetup,
|
|
1391
|
+
openclawInstalled
|
|
1364
1392
|
};
|
|
1365
1393
|
}
|
|
1366
1394
|
var init_prompts = __esm({
|
|
@@ -1691,13 +1719,7 @@ async function initCommand(projectName, options) {
|
|
|
1691
1719
|
if (cliTargets.includes("discord")) {
|
|
1692
1720
|
console.log("");
|
|
1693
1721
|
console.log(pc2.cyan("Discord Bot Setup:"));
|
|
1694
|
-
|
|
1695
|
-
try {
|
|
1696
|
-
const { execSync: execSync3 } = await import("child_process");
|
|
1697
|
-
execSync3("which openclaw", { stdio: "ignore" });
|
|
1698
|
-
openclawInstalled = true;
|
|
1699
|
-
} catch {
|
|
1700
|
-
}
|
|
1722
|
+
const openclawInstalled = discordConfig?.openclawInstalled ?? false;
|
|
1701
1723
|
if (!openclawInstalled) {
|
|
1702
1724
|
console.log(pc2.yellow(" 0. npm install -g openclaw - Install OpenClaw CLI first!"));
|
|
1703
1725
|
console.log(pc2.white(" 1. openclaw gateway - Start the bot"));
|
|
@@ -1705,7 +1727,9 @@ async function initCommand(projectName, options) {
|
|
|
1705
1727
|
console.log(pc2.white(" 3. DM the bot to pair - Approve with: openclaw pairing approve discord <code>"));
|
|
1706
1728
|
} else {
|
|
1707
1729
|
if (openclawSetupSuccess) {
|
|
1708
|
-
console.log(pc2.green(" \u2713 OpenClaw configured"));
|
|
1730
|
+
console.log(pc2.green(" \u2713 OpenClaw installed & configured"));
|
|
1731
|
+
} else {
|
|
1732
|
+
console.log(pc2.green(" \u2713 OpenClaw installed"));
|
|
1709
1733
|
}
|
|
1710
1734
|
console.log(pc2.white(" 1. openclaw gateway - Start the bot"));
|
|
1711
1735
|
console.log(pc2.white(" 2. Invite bot to server - Use OAuth2 URL from Discord Portal"));
|