apero-kit-cli 2.4.2 → 2.4.4
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 +42 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
6
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
7
|
+
}) : x)(function(x) {
|
|
8
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
9
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
});
|
|
5
11
|
var __esm = (fn, res) => function __init() {
|
|
6
12
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
13
|
};
|
|
@@ -1299,9 +1305,24 @@ async function promptUpdateConfirm(updates) {
|
|
|
1299
1305
|
console.log("");
|
|
1300
1306
|
return promptConfirm("Apply these updates?", true);
|
|
1301
1307
|
}
|
|
1308
|
+
function isOpenClawInstalled() {
|
|
1309
|
+
try {
|
|
1310
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1311
|
+
execSync3("which openclaw", { stdio: "ignore" });
|
|
1312
|
+
return true;
|
|
1313
|
+
} catch {
|
|
1314
|
+
return false;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1302
1317
|
async function promptDiscordSetup() {
|
|
1303
1318
|
console.log("");
|
|
1304
1319
|
console.log(pc.cyan("\u2501\u2501\u2501 Discord Bot Setup \u2501\u2501\u2501"));
|
|
1320
|
+
const openclawInstalled = isOpenClawInstalled();
|
|
1321
|
+
if (!openclawInstalled) {
|
|
1322
|
+
console.log(pc.yellow("\u26A0 OpenClaw CLI not found. Install it first:"));
|
|
1323
|
+
console.log(pc.white(" npm install -g openclaw"));
|
|
1324
|
+
console.log("");
|
|
1325
|
+
}
|
|
1305
1326
|
console.log(pc.gray("Get your bot token from: https://discord.com/developers/applications"));
|
|
1306
1327
|
console.log("");
|
|
1307
1328
|
const token = await p.password({
|
|
@@ -1423,6 +1444,7 @@ async function initCommand(projectName, options) {
|
|
|
1423
1444
|
cliTargets = await promptCliTargets();
|
|
1424
1445
|
}
|
|
1425
1446
|
let discordConfig = null;
|
|
1447
|
+
let openclawSetupSuccess = false;
|
|
1426
1448
|
if (cliTargets.includes("discord") && process.stdin.isTTY && !options.yes) {
|
|
1427
1449
|
discordConfig = await promptDiscordSetup();
|
|
1428
1450
|
}
|
|
@@ -1620,6 +1642,7 @@ async function initCommand(projectName, options) {
|
|
|
1620
1642
|
if (discordConfig.autoSetup) {
|
|
1621
1643
|
spinner.text = "Setting up OpenClaw...";
|
|
1622
1644
|
const result = await setupOpenClawConfig(discordConfig.token);
|
|
1645
|
+
openclawSetupSuccess = result.success;
|
|
1623
1646
|
if (!result.success) {
|
|
1624
1647
|
console.log(pc2.yellow(`
|
|
1625
1648
|
Note: ${result.message}`));
|
|
@@ -1668,12 +1691,26 @@ async function initCommand(projectName, options) {
|
|
|
1668
1691
|
if (cliTargets.includes("discord")) {
|
|
1669
1692
|
console.log("");
|
|
1670
1693
|
console.log(pc2.cyan("Discord Bot Setup:"));
|
|
1671
|
-
|
|
1672
|
-
|
|
1694
|
+
let openclawInstalled = false;
|
|
1695
|
+
try {
|
|
1696
|
+
const { execSync: execSync3 } = await import("child_process");
|
|
1697
|
+
execSync3("which openclaw", { stdio: "ignore" });
|
|
1698
|
+
openclawInstalled = true;
|
|
1699
|
+
} catch {
|
|
1700
|
+
}
|
|
1701
|
+
if (!openclawInstalled) {
|
|
1702
|
+
console.log(pc2.yellow(" 0. npm install -g openclaw - Install OpenClaw CLI first!"));
|
|
1703
|
+
console.log(pc2.white(" 1. openclaw gateway - Start the bot"));
|
|
1704
|
+
console.log(pc2.white(" 2. Invite bot to server - Use OAuth2 URL from Discord Portal"));
|
|
1705
|
+
console.log(pc2.white(" 3. DM the bot to pair - Approve with: openclaw pairing approve discord <code>"));
|
|
1706
|
+
} else {
|
|
1707
|
+
if (openclawSetupSuccess) {
|
|
1708
|
+
console.log(pc2.green(" \u2713 OpenClaw configured"));
|
|
1709
|
+
}
|
|
1710
|
+
console.log(pc2.white(" 1. openclaw gateway - Start the bot"));
|
|
1711
|
+
console.log(pc2.white(" 2. Invite bot to server - Use OAuth2 URL from Discord Portal"));
|
|
1712
|
+
console.log(pc2.white(" 3. DM the bot to pair - Approve with: openclaw pairing approve discord <code>"));
|
|
1673
1713
|
}
|
|
1674
|
-
console.log(pc2.white(" 1. openclaw gateway - Start the bot"));
|
|
1675
|
-
console.log(pc2.white(" 2. Invite bot to server - Use OAuth2 URL from Discord Portal"));
|
|
1676
|
-
console.log(pc2.white(" 3. DM the bot to pair - Approve with: openclaw pairing approve discord <code>"));
|
|
1677
1714
|
console.log(pc2.gray(" See .discord/README.md for full guide"));
|
|
1678
1715
|
}
|
|
1679
1716
|
console.log("");
|