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