@elizaos/cli 1.2.0 → 1.2.2
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/{chunk-7F7J7V7K.js → chunk-5RHJRZKW.js} +6 -6
- package/dist/chunk-GRPGGUED.js +2262 -0
- package/dist/{chunk-IMVD3V75.js → chunk-J5E77VTL.js} +2 -2
- package/dist/{chunk-GDP7OWFE.js → chunk-PMV25BM7.js} +2 -2
- package/dist/chunk-XB5JBFO6.js +41 -0
- package/dist/{chunk-RXPGZT6Z.js → chunk-YKFBLIQD.js} +154 -137
- package/dist/commands/agent/actions/index.js +3 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/create/actions/index.js +5 -5
- package/dist/commands/create/index.js +6 -6
- package/dist/commands/shared/index.js +1 -1
- package/dist/index.js +35 -32
- package/dist/{plugin-creator-35CAJF4O.js → plugin-creator-KFTUVFYX.js} +10 -7
- package/dist/{registry-3LKJUU3X.js → registry-WOGFPQNY.js} +3 -3
- package/dist/{setup-JDB67JV2.js → setup-KAJWYH6P.js} +4 -4
- package/dist/templates/plugin-starter/dist/index.js +12 -2
- package/dist/templates/plugin-starter/dist/index.js.map +1 -1
- package/dist/templates/plugin-starter/package.json +1 -1
- package/dist/templates/plugin-starter/src/plugin.ts +16 -4
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/plugin.ts +29 -3
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/{utils-SV7PQSFH.js → utils-Q5OUIPQH.js} +3 -3
- package/package.json +5 -6
- package/templates/plugin-starter/dist/.vite/manifest.json +1 -1
- package/templates/plugin-starter/dist/index.js +12 -2
- package/templates/plugin-starter/dist/index.js.map +1 -1
- package/templates/plugin-starter/package.json +1 -1
- package/templates/plugin-starter/src/plugin.ts +16 -4
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/plugin.ts +29 -3
- package/templates/project-tee-starter/package.json +3 -3
- package/dist/chunk-7PPBVSWE.js +0 -166
- package/dist/chunk-AQ6OMR2A.js +0 -14
|
@@ -3,22 +3,27 @@ import { createRequire } from 'module';
|
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
bunExec,
|
|
7
|
+
bunExecInherit,
|
|
8
|
+
bunExecSimple,
|
|
9
|
+
commandExists,
|
|
6
10
|
displayBunInstallationTipCompact,
|
|
7
11
|
emoji,
|
|
12
|
+
require_execa,
|
|
8
13
|
runBunCommand
|
|
9
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GRPGGUED.js";
|
|
10
15
|
import {
|
|
11
16
|
getAgentRuntimeUrl,
|
|
12
17
|
getAgentsBaseUrl
|
|
13
18
|
} from "./chunk-F24MS2YR.js";
|
|
14
19
|
import {
|
|
15
|
-
__require
|
|
16
|
-
|
|
20
|
+
__require,
|
|
21
|
+
__toESM
|
|
22
|
+
} from "./chunk-XB5JBFO6.js";
|
|
17
23
|
|
|
18
24
|
// src/utils/build-project.ts
|
|
19
25
|
import * as fs3 from "fs";
|
|
20
26
|
import * as path4 from "path";
|
|
21
|
-
import { execa as execa3 } from "execa";
|
|
22
27
|
|
|
23
28
|
// src/utils/directory-detection.ts
|
|
24
29
|
import * as fs2 from "fs";
|
|
@@ -30,7 +35,7 @@ import fs from "fs/promises";
|
|
|
30
35
|
import path2 from "path";
|
|
31
36
|
import * as semver from "semver";
|
|
32
37
|
import { fileURLToPath } from "url";
|
|
33
|
-
import { logger as
|
|
38
|
+
import { logger as logger2 } from "@elizaos/core";
|
|
34
39
|
import { existsSync as existsSync2, statSync, readFileSync } from "fs";
|
|
35
40
|
import { execSync } from "child_process";
|
|
36
41
|
|
|
@@ -87,65 +92,80 @@ async function resolvePgliteDir(dir, fallbackDir, targetProjectDir) {
|
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
// src/utils/auto-install-bun.ts
|
|
90
|
-
import { logger
|
|
91
|
-
import {
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
import { logger } from "@elizaos/core";
|
|
96
|
+
import { homedir } from "os";
|
|
97
|
+
import { join } from "path";
|
|
98
|
+
var INSTALLATION_VERIFICATION_DELAY_MS = 2e3;
|
|
99
|
+
function updatePathForBun() {
|
|
100
|
+
const home = homedir();
|
|
101
|
+
const bunBinPath = join(home, ".bun", "bin");
|
|
102
|
+
const currentPath = process.env.PATH || "";
|
|
103
|
+
const pathSeparator = process.platform === "win32" ? ";" : ":";
|
|
104
|
+
const pathDirs = currentPath.split(pathSeparator);
|
|
105
|
+
const bunBinPathNormalized = bunBinPath.replace(/[/\\]+$/, "");
|
|
106
|
+
const isInPath = pathDirs.some((dir) => {
|
|
107
|
+
const dirNormalized = dir.replace(/[/\\]+$/, "");
|
|
108
|
+
return dirNormalized === bunBinPathNormalized;
|
|
109
|
+
});
|
|
110
|
+
if (!isInPath) {
|
|
111
|
+
process.env.PATH = `${bunBinPath}${pathSeparator}${currentPath}`;
|
|
112
|
+
logger.debug(`Added ${bunBinPath} to PATH for current process`);
|
|
113
|
+
} else {
|
|
114
|
+
logger.debug(`${bunBinPath} is already in PATH`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function isBunInstalled() {
|
|
94
118
|
try {
|
|
95
|
-
await
|
|
119
|
+
const exists = await commandExists("bun");
|
|
120
|
+
if (!exists) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const result = await bunExec("bun", ["--version"], { stdio: "ignore" });
|
|
124
|
+
return result.success;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
logger.debug("Error checking if Bun is installed:", error);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async function autoInstallBun() {
|
|
131
|
+
if (await isBunInstalled()) {
|
|
132
|
+
logger.info("Bun is already installed.");
|
|
96
133
|
return true;
|
|
97
|
-
} catch {
|
|
98
134
|
}
|
|
99
|
-
|
|
135
|
+
const platform = process.platform;
|
|
100
136
|
try {
|
|
101
137
|
if (platform === "win32") {
|
|
102
|
-
|
|
103
|
-
await execa("powershell", ["-c", "irm bun.sh/install.ps1 | iex"], {
|
|
104
|
-
stdio: "inherit"
|
|
105
|
-
});
|
|
138
|
+
await bunExecInherit("powershell", ["-c", "irm bun.sh/install.ps1 | iex"]);
|
|
106
139
|
} else {
|
|
107
|
-
|
|
108
|
-
await execa("sh", ["-c", "curl -fsSL https://bun.sh/install | bash"], {
|
|
109
|
-
stdio: "inherit"
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
const bunPath = platform === "win32" ? `${process.env.USERPROFILE}\\.bun\\bin` : `${process.env.HOME}/.bun/bin`;
|
|
113
|
-
if (bunPath && !process.env.PATH?.includes(bunPath)) {
|
|
114
|
-
process.env.PATH = `${bunPath}${platform === "win32" ? ";" : ":"}${process.env.PATH}`;
|
|
140
|
+
await bunExecInherit("sh", ["-c", "curl -fsSL https://bun.sh/install | bash"]);
|
|
115
141
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
logger2.info(`
|
|
123
|
-
${emoji.info("Please install Bun manually:")}`);
|
|
124
|
-
if (platform === "win32") {
|
|
125
|
-
logger2.info(' Windows: powershell -c "irm bun.sh/install.ps1 | iex"');
|
|
142
|
+
logger.info("Bun installation script executed successfully.");
|
|
143
|
+
updatePathForBun();
|
|
144
|
+
await new Promise((resolve2) => setTimeout(resolve2, INSTALLATION_VERIFICATION_DELAY_MS));
|
|
145
|
+
if (await isBunInstalled()) {
|
|
146
|
+
logger.success("Bun has been successfully installed!");
|
|
147
|
+
return true;
|
|
126
148
|
} else {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
149
|
+
logger.error("Bun installation completed but the command is not available in PATH.");
|
|
150
|
+
logger.error("Please restart your terminal or source your shell profile.");
|
|
151
|
+
return false;
|
|
131
152
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
`
|
|
136
|
-
${emoji.tip("After installation, restart your terminal or source your shell profile")}`
|
|
153
|
+
} catch (error) {
|
|
154
|
+
logger.error(
|
|
155
|
+
`Failed to auto-install Bun: ${error instanceof Error ? error.message : String(error)}`
|
|
137
156
|
);
|
|
138
157
|
return false;
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
function shouldAutoInstall() {
|
|
142
|
-
|
|
161
|
+
const autoInstallEnv = process.env.ELIZA_AUTO_INSTALL_BUN;
|
|
162
|
+
if (autoInstallEnv === "false" || autoInstallEnv === "0") {
|
|
143
163
|
return false;
|
|
144
164
|
}
|
|
145
|
-
if (process.env.
|
|
165
|
+
if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) {
|
|
146
166
|
return false;
|
|
147
167
|
}
|
|
148
|
-
if (process.
|
|
168
|
+
if (process.env.CONTAINER || process.env.DOCKER_CONTAINER) {
|
|
149
169
|
return false;
|
|
150
170
|
}
|
|
151
171
|
return true;
|
|
@@ -164,7 +184,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
164
184
|
* Gets operating system information
|
|
165
185
|
*/
|
|
166
186
|
async getOSInfo() {
|
|
167
|
-
|
|
187
|
+
logger2.debug("[UserEnvironment] Detecting OS information");
|
|
168
188
|
return {
|
|
169
189
|
platform: os.platform(),
|
|
170
190
|
release: os.release(),
|
|
@@ -178,7 +198,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
178
198
|
* Gets CLI version and package information
|
|
179
199
|
*/
|
|
180
200
|
async getCLIInfo() {
|
|
181
|
-
|
|
201
|
+
logger2.debug("[UserEnvironment] Getting CLI information");
|
|
182
202
|
try {
|
|
183
203
|
const __filename2 = fileURLToPath(import.meta.url);
|
|
184
204
|
const __dirname2 = path2.dirname(__filename2);
|
|
@@ -194,7 +214,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
194
214
|
path: process.argv[1] || ""
|
|
195
215
|
};
|
|
196
216
|
} catch (error) {
|
|
197
|
-
|
|
217
|
+
logger2.warn(
|
|
198
218
|
`[UserEnvironment] Error getting CLI info: ${error instanceof Error ? error.message : String(error)}`
|
|
199
219
|
);
|
|
200
220
|
return {
|
|
@@ -208,30 +228,28 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
208
228
|
* Detects the active package manager - always returns bun for ElizaOS CLI
|
|
209
229
|
*/
|
|
210
230
|
async getPackageManagerInfo() {
|
|
211
|
-
|
|
231
|
+
logger2.debug("[UserEnvironment] Using bun as the package manager for ElizaOS CLI");
|
|
212
232
|
const isNpx = process.env.npm_execpath?.includes("npx");
|
|
213
233
|
const isBunx = process.argv[0]?.includes("bun");
|
|
214
234
|
let version = null;
|
|
215
235
|
try {
|
|
216
|
-
const { stdout } = await
|
|
236
|
+
const { stdout } = await bunExecSimple("bun", ["--version"]);
|
|
217
237
|
version = stdout.trim();
|
|
218
|
-
|
|
238
|
+
logger2.debug(`[UserEnvironment] Bun version: ${version}`);
|
|
219
239
|
} catch (e) {
|
|
220
|
-
|
|
240
|
+
logger2.debug(
|
|
221
241
|
`[UserEnvironment] Could not get bun version: ${e instanceof Error ? e.message : String(e)}`
|
|
222
242
|
);
|
|
223
243
|
if (shouldAutoInstall()) {
|
|
224
|
-
|
|
244
|
+
logger2.info(`${emoji.info("Attempting to automatically install Bun...")}`);
|
|
225
245
|
const installSuccess = await autoInstallBun();
|
|
226
246
|
if (installSuccess) {
|
|
227
247
|
try {
|
|
228
|
-
const { stdout } = await
|
|
229
|
-
({ execa: execa10 }) => execa10("bun", ["--version"])
|
|
230
|
-
);
|
|
248
|
+
const { stdout } = await bunExecSimple("bun", ["--version"]);
|
|
231
249
|
version = stdout.trim();
|
|
232
|
-
|
|
250
|
+
logger2.debug(`[UserEnvironment] Bun version after auto-install: ${version}`);
|
|
233
251
|
} catch (retryError) {
|
|
234
|
-
|
|
252
|
+
logger2.error(
|
|
235
253
|
`Failed to verify Bun installation after auto-install: ${retryError instanceof Error ? retryError.message : String(retryError)}`
|
|
236
254
|
);
|
|
237
255
|
}
|
|
@@ -239,27 +257,27 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
239
257
|
}
|
|
240
258
|
if (!version) {
|
|
241
259
|
const platform = process.platform;
|
|
242
|
-
|
|
260
|
+
logger2.error(
|
|
243
261
|
`${emoji.error("Bun is required for ElizaOS CLI but is not installed or not found in PATH.")}`
|
|
244
262
|
);
|
|
245
|
-
|
|
246
|
-
|
|
263
|
+
logger2.error("");
|
|
264
|
+
logger2.error(
|
|
247
265
|
`${emoji.rocket("Install Bun using the appropriate command for your system:")}`
|
|
248
266
|
);
|
|
249
|
-
|
|
267
|
+
logger2.error("");
|
|
250
268
|
if (platform === "win32") {
|
|
251
|
-
|
|
269
|
+
logger2.error(' Windows: powershell -c "irm bun.sh/install.ps1 | iex"');
|
|
252
270
|
} else {
|
|
253
|
-
|
|
271
|
+
logger2.error(" Linux/macOS: curl -fsSL https://bun.sh/install | bash");
|
|
254
272
|
if (platform === "darwin") {
|
|
255
|
-
|
|
273
|
+
logger2.error(" macOS (Homebrew): brew install bun");
|
|
256
274
|
}
|
|
257
275
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
276
|
+
logger2.error("");
|
|
277
|
+
logger2.error(" More options: https://bun.sh/docs/installation");
|
|
278
|
+
logger2.error(" After installation, restart your terminal or source your shell profile");
|
|
279
|
+
logger2.error("");
|
|
280
|
+
logger2.error("\u{1F534} Exiting: Bun installation is required to continue.");
|
|
263
281
|
process.exit(1);
|
|
264
282
|
}
|
|
265
283
|
}
|
|
@@ -326,7 +344,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
326
344
|
const projectRootForPaths = monorepoRoot || process.cwd();
|
|
327
345
|
const elizaDir = path2.join(projectRootForPaths, ".eliza");
|
|
328
346
|
const envFilePath = resolveEnvFile(process.cwd(), monorepoRoot ?? void 0);
|
|
329
|
-
|
|
347
|
+
logger2.debug("[UserEnvironment] Detected monorepo root:", monorepoRoot || "Not in monorepo");
|
|
330
348
|
return {
|
|
331
349
|
elizaDir,
|
|
332
350
|
envFilePath,
|
|
@@ -344,7 +362,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
344
362
|
if (this.cachedInfo[cacheKey]) {
|
|
345
363
|
return this.cachedInfo[cacheKey];
|
|
346
364
|
}
|
|
347
|
-
|
|
365
|
+
logger2.debug(`[UserEnvironment] Gathering environment information for directory: ${cacheKey}`);
|
|
348
366
|
const [os2, cli, packageManager, paths, env] = await Promise.all([
|
|
349
367
|
this.getOSInfo(),
|
|
350
368
|
this.getCLIInfo(),
|
|
@@ -398,7 +416,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
398
416
|
if (minVer) {
|
|
399
417
|
return minVer.version;
|
|
400
418
|
} else {
|
|
401
|
-
|
|
419
|
+
logger2.warn(
|
|
402
420
|
`Could not parse semver range '${versionRange}' for package ${packageName}. Falling back to original string.`
|
|
403
421
|
);
|
|
404
422
|
return versionRange;
|
|
@@ -406,18 +424,17 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
406
424
|
}
|
|
407
425
|
}
|
|
408
426
|
try {
|
|
409
|
-
const {
|
|
410
|
-
const { stdout } = await execa10("npm", ["view", packageName, "version"]);
|
|
427
|
+
const { stdout } = await bunExecSimple("npm", ["view", packageName, "version"]);
|
|
411
428
|
if (stdout?.trim()) {
|
|
412
|
-
|
|
429
|
+
logger2.info(`Found latest version of ${packageName} from npm: ${stdout.trim()}`);
|
|
413
430
|
return stdout.trim();
|
|
414
431
|
}
|
|
415
432
|
} catch (npmError) {
|
|
416
|
-
|
|
433
|
+
logger2.warn(`Could not get latest version from npm: ${npmError}`);
|
|
417
434
|
}
|
|
418
435
|
return "0.25.9";
|
|
419
436
|
} catch (error) {
|
|
420
|
-
|
|
437
|
+
logger2.warn(`Error getting package version for ${packageName}: ${error}`);
|
|
421
438
|
return "0.25.9";
|
|
422
439
|
}
|
|
423
440
|
}
|
|
@@ -434,7 +451,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
434
451
|
const pluginPackages = packagesDirEntries.filter((entry) => entry.isDirectory() && entry.name.startsWith("plugin-")).map((entry) => `@elizaos/${entry.name}`);
|
|
435
452
|
return pluginPackages;
|
|
436
453
|
} catch (error) {
|
|
437
|
-
|
|
454
|
+
logger2.warn(`Error getting local packages: ${error}`);
|
|
438
455
|
return [];
|
|
439
456
|
}
|
|
440
457
|
}
|
|
@@ -613,10 +630,10 @@ function isValidForUpdates(info) {
|
|
|
613
630
|
}
|
|
614
631
|
|
|
615
632
|
// src/utils/spinner-utils.ts
|
|
616
|
-
|
|
633
|
+
var import_execa = __toESM(require_execa(), 1);
|
|
617
634
|
import * as clack from "@clack/prompts";
|
|
618
635
|
import colors from "yoctocolors";
|
|
619
|
-
import { parseBooleanFromText } from "@elizaos/core";
|
|
636
|
+
import { parseBooleanFromText, logger as logger3 } from "@elizaos/core";
|
|
620
637
|
function isQuietMode() {
|
|
621
638
|
return parseBooleanFromText(process.env.QUIET_MODE);
|
|
622
639
|
}
|
|
@@ -624,7 +641,7 @@ async function runCommandWithSpinner(command, args, options) {
|
|
|
624
641
|
const spinner3 = clack.spinner();
|
|
625
642
|
try {
|
|
626
643
|
spinner3.start(options.spinnerText);
|
|
627
|
-
const result = await
|
|
644
|
+
const result = await (0, import_execa.execa)(command, args, {
|
|
628
645
|
cwd: options.cwd || process.cwd(),
|
|
629
646
|
stdio: "pipe",
|
|
630
647
|
reject: false
|
|
@@ -710,7 +727,7 @@ async function installPluginWithSpinner(pluginName, targetDir, purpose = "") {
|
|
|
710
727
|
const spinner3 = clack.spinner();
|
|
711
728
|
spinner3.start(`Installing ${packageName}${purposeText}...`);
|
|
712
729
|
try {
|
|
713
|
-
const result = await
|
|
730
|
+
const result = await (0, import_execa.execa)("bun", ["add", packageName], {
|
|
714
731
|
cwd: targetDir,
|
|
715
732
|
stdio: "pipe",
|
|
716
733
|
reject: false
|
|
@@ -719,7 +736,7 @@ async function installPluginWithSpinner(pluginName, targetDir, purpose = "") {
|
|
|
719
736
|
spinner3.stop(colors.green(`\u2713 ${packageName} installed successfully`));
|
|
720
737
|
} else {
|
|
721
738
|
spinner3.stop(colors.yellow(`\u26A0 Failed to install ${packageName} (optional)`));
|
|
722
|
-
|
|
739
|
+
logger3.debug(`Plugin installation failed: ${packageName}`, {
|
|
723
740
|
exitCode: result.exitCode,
|
|
724
741
|
stderr: result.stderr,
|
|
725
742
|
stdout: result.stdout
|
|
@@ -727,7 +744,7 @@ async function installPluginWithSpinner(pluginName, targetDir, purpose = "") {
|
|
|
727
744
|
}
|
|
728
745
|
} catch (error) {
|
|
729
746
|
spinner3.stop(colors.yellow(`\u26A0 Failed to install ${packageName} (optional)`));
|
|
730
|
-
|
|
747
|
+
logger3.debug(`Plugin installation error: ${packageName}`, error);
|
|
731
748
|
}
|
|
732
749
|
}
|
|
733
750
|
function createTask(title, fn) {
|
|
@@ -780,12 +797,10 @@ async function buildProject(cwd = process.cwd(), isPlugin = false) {
|
|
|
780
797
|
const tsconfigPath = path4.join(cwd, "tsconfig.json");
|
|
781
798
|
if (fs3.existsSync(tsconfigPath)) {
|
|
782
799
|
try {
|
|
783
|
-
const result = await
|
|
784
|
-
cwd
|
|
785
|
-
stdio: "pipe",
|
|
786
|
-
reject: false
|
|
800
|
+
const result = await bunExec("bunx", ["tsc", "--build"], {
|
|
801
|
+
cwd
|
|
787
802
|
});
|
|
788
|
-
if (result.
|
|
803
|
+
if (result.success) {
|
|
789
804
|
return;
|
|
790
805
|
} else {
|
|
791
806
|
throw new Error(`bunx tsc build failed: ${result.stderr || result.stdout}`);
|
|
@@ -801,11 +816,11 @@ async function buildProject(cwd = process.cwd(), isPlugin = false) {
|
|
|
801
816
|
}
|
|
802
817
|
|
|
803
818
|
// src/utils/cli-bun-migration.ts
|
|
819
|
+
var import_execa2 = __toESM(require_execa(), 1);
|
|
804
820
|
import { logger as logger4 } from "@elizaos/core";
|
|
805
|
-
import { execa as execa4 } from "execa";
|
|
806
821
|
async function isBunAvailable() {
|
|
807
822
|
try {
|
|
808
|
-
await
|
|
823
|
+
await (0, import_execa2.execa)("bun", ["--version"], { stdio: "ignore" });
|
|
809
824
|
return true;
|
|
810
825
|
} catch (error) {
|
|
811
826
|
return false;
|
|
@@ -813,13 +828,13 @@ async function isBunAvailable() {
|
|
|
813
828
|
}
|
|
814
829
|
async function isCliInstalledViaNpm() {
|
|
815
830
|
try {
|
|
816
|
-
const { stdout } = await
|
|
831
|
+
const { stdout } = await (0, import_execa2.execa)("npm", ["list", "-g", "@elizaos/cli", "--depth=0"], {
|
|
817
832
|
stdio: "pipe"
|
|
818
833
|
});
|
|
819
834
|
return stdout.includes("@elizaos/cli");
|
|
820
835
|
} catch (error) {
|
|
821
836
|
try {
|
|
822
|
-
const { stdout: whichOutput } = await
|
|
837
|
+
const { stdout: whichOutput } = await (0, import_execa2.execa)("which", ["elizaos"], { stdio: "pipe" });
|
|
823
838
|
return whichOutput.includes("node_modules") || whichOutput.includes(".nvm");
|
|
824
839
|
} catch {
|
|
825
840
|
return false;
|
|
@@ -828,15 +843,15 @@ async function isCliInstalledViaNpm() {
|
|
|
828
843
|
}
|
|
829
844
|
async function removeNpmInstallation() {
|
|
830
845
|
logger4.info("Removing npm installation of @elizaos/cli...");
|
|
831
|
-
await
|
|
846
|
+
await (0, import_execa2.execa)("npm", ["uninstall", "-g", "@elizaos/cli"], { stdio: "inherit" });
|
|
832
847
|
}
|
|
833
848
|
async function installCliWithBun(version) {
|
|
834
849
|
logger4.info("Installing CLI with bun...");
|
|
835
|
-
await
|
|
850
|
+
await (0, import_execa2.execa)("bun", ["add", "-g", `@elizaos/cli@${version}`], { stdio: "inherit" });
|
|
836
851
|
}
|
|
837
852
|
async function verifyCliInstallation(expectedVersion) {
|
|
838
853
|
try {
|
|
839
|
-
const { stdout } = await
|
|
854
|
+
const { stdout } = await (0, import_execa2.execa)("elizaos", ["-v"], { stdio: "pipe" });
|
|
840
855
|
const output = stdout.trim();
|
|
841
856
|
const versionMatch = output.match(/(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?)/);
|
|
842
857
|
if (!versionMatch) {
|
|
@@ -871,7 +886,7 @@ async function migrateCliToBun(targetVersion) {
|
|
|
871
886
|
logger4.error("Your original npm installation is still intact.");
|
|
872
887
|
try {
|
|
873
888
|
logger4.info("Cleaning up failed bun installation...");
|
|
874
|
-
await
|
|
889
|
+
await (0, import_execa2.execa)("bun", ["remove", "-g", "@elizaos/cli"], { stdio: "ignore" });
|
|
875
890
|
} catch {
|
|
876
891
|
}
|
|
877
892
|
throw error;
|
|
@@ -1171,7 +1186,6 @@ async function replacePluginNameInFiles(targetDir, pluginName) {
|
|
|
1171
1186
|
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
|
|
1172
1187
|
import path7, { dirname } from "path";
|
|
1173
1188
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1174
|
-
import { execa as execa5 } from "execa";
|
|
1175
1189
|
function isRunningFromNodeModules() {
|
|
1176
1190
|
const __filename2 = fileURLToPath3(import.meta.url);
|
|
1177
1191
|
return __filename2.includes("node_modules");
|
|
@@ -1229,7 +1243,7 @@ async function getLatestCliVersion(currentVersion) {
|
|
|
1229
1243
|
if (versionCheckCache && Date.now() - versionCheckCache.timestamp < CACHE_DURATION) {
|
|
1230
1244
|
return versionCheckCache.latestVersion;
|
|
1231
1245
|
}
|
|
1232
|
-
const { stdout } = await
|
|
1246
|
+
const { stdout } = await bunExecSimple("npm", ["view", "@elizaos/cli", "time", "--json"]);
|
|
1233
1247
|
const timeData = JSON.parse(stdout);
|
|
1234
1248
|
delete timeData.created;
|
|
1235
1249
|
delete timeData.modified;
|
|
@@ -2377,11 +2391,11 @@ async function getPackageInfo() {
|
|
|
2377
2391
|
}
|
|
2378
2392
|
|
|
2379
2393
|
// src/utils/github.ts
|
|
2394
|
+
var import_execa3 = __toESM(require_execa(), 1);
|
|
2380
2395
|
import { promises as fs8 } from "fs";
|
|
2381
2396
|
import path10 from "path";
|
|
2382
2397
|
import { logger as logger10 } from "@elizaos/core";
|
|
2383
2398
|
import { existsSync as existsSync9 } from "fs";
|
|
2384
|
-
import { execa as execa6 } from "execa";
|
|
2385
2399
|
import * as clack4 from "@clack/prompts";
|
|
2386
2400
|
var GITHUB_API_URL = "https://api.github.com";
|
|
2387
2401
|
async function validateGitHubToken(token) {
|
|
@@ -2757,7 +2771,7 @@ async function getGitHubCredentials() {
|
|
|
2757
2771
|
}
|
|
2758
2772
|
logger10.warn("Invalid GitHub token found in environment variables");
|
|
2759
2773
|
}
|
|
2760
|
-
const { getGitHubToken: getGitHubToken2 } = await import("./registry-
|
|
2774
|
+
const { getGitHubToken: getGitHubToken2 } = await import("./registry-WOGFPQNY.js");
|
|
2761
2775
|
const token = await getGitHubToken2() || void 0;
|
|
2762
2776
|
if (token) {
|
|
2763
2777
|
const isValid2 = await validateGitHubToken(token);
|
|
@@ -2976,7 +2990,7 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
2976
2990
|
let hasCorrectRemote = false;
|
|
2977
2991
|
if (gitDirExists) {
|
|
2978
2992
|
try {
|
|
2979
|
-
const { stdout: remoteUrl } = await
|
|
2993
|
+
const { stdout: remoteUrl } = await (0, import_execa3.execa)("git", ["remote", "get-url", "origin"], { cwd });
|
|
2980
2994
|
const sanitizedRepoUrl = repoUrl.replace(/https:\/\/.*?@/, "https://");
|
|
2981
2995
|
const sanitizedRemoteUrl = remoteUrl.replace(/https:\/\/.*?@/, "https://");
|
|
2982
2996
|
hasCorrectRemote = sanitizedRemoteUrl.includes(
|
|
@@ -2989,39 +3003,39 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
2989
3003
|
if (!gitDirExists || !hasCorrectRemote) {
|
|
2990
3004
|
if (gitDirExists) {
|
|
2991
3005
|
logger10.info("Existing git repository has incorrect remote, reinitializing...");
|
|
2992
|
-
await
|
|
3006
|
+
await (0, import_execa3.execa)("rm", ["-rf", ".git"], { cwd });
|
|
2993
3007
|
}
|
|
2994
|
-
await
|
|
2995
|
-
await
|
|
3008
|
+
await (0, import_execa3.execa)("git", ["init"], { cwd });
|
|
3009
|
+
await (0, import_execa3.execa)("git", ["checkout", "-b", "main"], { cwd });
|
|
2996
3010
|
logger10.info("Git repository initialized with main branch");
|
|
2997
|
-
await
|
|
3011
|
+
await (0, import_execa3.execa)("git", ["remote", "add", "origin", repoUrl], { cwd });
|
|
2998
3012
|
logger10.info(`Added remote: ${repoUrl.replace(/\/\/.*?@/, "//***@")}`);
|
|
2999
3013
|
} else {
|
|
3000
3014
|
try {
|
|
3001
|
-
await
|
|
3002
|
-
await
|
|
3015
|
+
await (0, import_execa3.execa)("git", ["rev-parse", "--verify", branch], { cwd });
|
|
3016
|
+
await (0, import_execa3.execa)("git", ["checkout", branch], { cwd });
|
|
3003
3017
|
} catch (error) {
|
|
3004
|
-
await
|
|
3018
|
+
await (0, import_execa3.execa)("git", ["checkout", "-b", branch], { cwd });
|
|
3005
3019
|
logger10.info(`Created and switched to ${branch} branch`);
|
|
3006
3020
|
}
|
|
3007
3021
|
}
|
|
3008
|
-
await
|
|
3022
|
+
await (0, import_execa3.execa)("git", ["add", "."], { cwd });
|
|
3009
3023
|
logger10.info("Added files to git");
|
|
3010
3024
|
try {
|
|
3011
|
-
await
|
|
3025
|
+
await (0, import_execa3.execa)("git", ["config", "user.email"], { cwd });
|
|
3012
3026
|
} catch (error) {
|
|
3013
|
-
await
|
|
3014
|
-
await
|
|
3027
|
+
await (0, import_execa3.execa)("git", ["config", "user.email", "plugindev@elizaos.com"], { cwd });
|
|
3028
|
+
await (0, import_execa3.execa)("git", ["config", "user.name", "ElizaOS Plugin Dev"], { cwd });
|
|
3015
3029
|
logger10.info("Set git user info for commit");
|
|
3016
3030
|
}
|
|
3017
3031
|
try {
|
|
3018
|
-
await
|
|
3032
|
+
await (0, import_execa3.execa)("git", ["commit", "-m", "Initial commit from ElizaOS CLI"], { cwd });
|
|
3019
3033
|
logger10.info("Committed changes");
|
|
3020
3034
|
} catch (error) {
|
|
3021
3035
|
logger10.info("No changes to commit");
|
|
3022
3036
|
}
|
|
3023
3037
|
try {
|
|
3024
|
-
await
|
|
3038
|
+
await (0, import_execa3.execa)("git", ["push", "-u", "origin", branch], { cwd });
|
|
3025
3039
|
logger10.success(`Pushed to GitHub repository: ${repoUrl}`);
|
|
3026
3040
|
return true;
|
|
3027
3041
|
} catch (error) {
|
|
@@ -3030,7 +3044,7 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
3030
3044
|
);
|
|
3031
3045
|
try {
|
|
3032
3046
|
logger10.info("Attempting force push...");
|
|
3033
|
-
await
|
|
3047
|
+
await (0, import_execa3.execa)("git", ["push", "-u", "origin", "main", "--force-with-lease"], {
|
|
3034
3048
|
cwd,
|
|
3035
3049
|
stdio: "pipe"
|
|
3036
3050
|
});
|
|
@@ -3919,7 +3933,6 @@ async function loadPluginModule(repository) {
|
|
|
3919
3933
|
import { logger as logger16 } from "@elizaos/core";
|
|
3920
3934
|
import { existsSync as existsSync13 } from "fs";
|
|
3921
3935
|
import path16 from "path";
|
|
3922
|
-
import { execa as execa7 } from "execa";
|
|
3923
3936
|
async function getPackageManager() {
|
|
3924
3937
|
logger16.debug("[PackageManager] Using bun as the package manager for ElizaOS CLI");
|
|
3925
3938
|
return "bun";
|
|
@@ -3946,18 +3959,22 @@ async function removeFromBunLock(packageName, directory) {
|
|
|
3946
3959
|
return;
|
|
3947
3960
|
}
|
|
3948
3961
|
try {
|
|
3949
|
-
await
|
|
3950
|
-
cwd: directory
|
|
3951
|
-
stdio: "pipe"
|
|
3952
|
-
// Don't show output for cleanup operation
|
|
3962
|
+
const result = await bunExec("bun", ["remove", packageName], {
|
|
3963
|
+
cwd: directory
|
|
3953
3964
|
});
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
if (error.message?.includes("not found") || error.message?.includes("No such package")) {
|
|
3957
|
-
logger16.debug(`Package ${packageName} not found in lockfile (expected for cleanup)`);
|
|
3965
|
+
if (result.success) {
|
|
3966
|
+
logger16.debug(`Successfully removed ${packageName} from bun.lock`);
|
|
3958
3967
|
} else {
|
|
3959
|
-
|
|
3968
|
+
if (result.stderr?.includes("not found") || result.stderr?.includes("No such package")) {
|
|
3969
|
+
logger16.debug(`Package ${packageName} not found in lockfile (expected for cleanup)`);
|
|
3970
|
+
} else {
|
|
3971
|
+
logger16.warn(
|
|
3972
|
+
`Failed to remove ${packageName} from bun.lock: ${result.stderr || "Unknown error"}`
|
|
3973
|
+
);
|
|
3974
|
+
}
|
|
3960
3975
|
}
|
|
3976
|
+
} catch (error) {
|
|
3977
|
+
logger16.warn(`Unexpected error removing ${packageName} from bun.lock: ${error.message}`);
|
|
3961
3978
|
}
|
|
3962
3979
|
}
|
|
3963
3980
|
async function executeInstallation(packageName, versionOrTag = "", directory = process.cwd()) {
|
|
@@ -4193,16 +4210,16 @@ async function findNextAvailablePort(startPort) {
|
|
|
4193
4210
|
}
|
|
4194
4211
|
|
|
4195
4212
|
// src/utils/publisher.ts
|
|
4196
|
-
|
|
4213
|
+
var import_execa4 = __toESM(require_execa(), 1);
|
|
4197
4214
|
import { logger as logger19 } from "@elizaos/core";
|
|
4198
4215
|
async function testPublishToNpm(cwd) {
|
|
4199
4216
|
try {
|
|
4200
|
-
await
|
|
4217
|
+
await (0, import_execa4.execa)("npm", ["whoami"]);
|
|
4201
4218
|
logger19.info("[\u2713] Logged in to npm");
|
|
4202
4219
|
logger19.info("Testing build...");
|
|
4203
|
-
await
|
|
4220
|
+
await (0, import_execa4.execa)("npm", ["run", "build", "--dry-run"], { cwd });
|
|
4204
4221
|
logger19.info("[\u2713] Build test successful");
|
|
4205
|
-
await
|
|
4222
|
+
await (0, import_execa4.execa)("npm", ["access", "ls-packages"], { cwd });
|
|
4206
4223
|
logger19.info("[\u2713] Have publish permissions");
|
|
4207
4224
|
return true;
|
|
4208
4225
|
} catch (error) {
|
|
@@ -4297,11 +4314,11 @@ async function testPublishToGitHub(packageJson, username) {
|
|
|
4297
4314
|
}
|
|
4298
4315
|
async function publishToNpm(cwd) {
|
|
4299
4316
|
try {
|
|
4300
|
-
await
|
|
4317
|
+
await (0, import_execa4.execa)("npm", ["whoami"]);
|
|
4301
4318
|
logger19.info("Building package...");
|
|
4302
|
-
await
|
|
4319
|
+
await (0, import_execa4.execa)("npm", ["run", "build"], { cwd, stdio: "inherit" });
|
|
4303
4320
|
logger19.info("Publishing to npm...");
|
|
4304
|
-
await
|
|
4321
|
+
await (0, import_execa4.execa)("npm", ["publish"], { cwd, stdio: "inherit" });
|
|
4305
4322
|
return true;
|
|
4306
4323
|
} catch (error) {
|
|
4307
4324
|
logger19.error("Failed to publish to npm:", error);
|
|
@@ -4807,9 +4824,9 @@ Test Summary: ${this.stats.passed} passed, ${this.stats.failed} failed, ${this.s
|
|
|
4807
4824
|
};
|
|
4808
4825
|
|
|
4809
4826
|
// src/utils/registry/index.ts
|
|
4827
|
+
var import_execa5 = __toESM(require_execa(), 1);
|
|
4810
4828
|
import { logger as logger21 } from "@elizaos/core";
|
|
4811
4829
|
import dotenv3 from "dotenv";
|
|
4812
|
-
import { execa as execa9 } from "execa";
|
|
4813
4830
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
4814
4831
|
import { existsSync as existsSync16, promises as fs10 } from "fs";
|
|
4815
4832
|
import path19 from "path";
|
|
@@ -5102,7 +5119,7 @@ async function getPluginRepository(pluginName) {
|
|
|
5102
5119
|
}
|
|
5103
5120
|
async function repoHasBranch(repoUrl, branchName) {
|
|
5104
5121
|
try {
|
|
5105
|
-
const { stdout } = await
|
|
5122
|
+
const { stdout } = await (0, import_execa5.execa)("git", ["ls-remote", "--heads", repoUrl, branchName]);
|
|
5106
5123
|
return stdout.includes(branchName);
|
|
5107
5124
|
} catch (error) {
|
|
5108
5125
|
logger21.warn(
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
setAgentConfig,
|
|
10
10
|
startAgent,
|
|
11
11
|
stopAgent
|
|
12
|
-
} from "../../../chunk-
|
|
13
|
-
import "../../../chunk-
|
|
12
|
+
} from "../../../chunk-YKFBLIQD.js";
|
|
13
|
+
import "../../../chunk-GRPGGUED.js";
|
|
14
14
|
import "../../../chunk-F24MS2YR.js";
|
|
15
|
-
import "../../../chunk-
|
|
15
|
+
import "../../../chunk-XB5JBFO6.js";
|
|
16
16
|
export {
|
|
17
17
|
clearAgentMemories,
|
|
18
18
|
getAgent,
|