@elizaos/cli 1.3.1 → 1.4.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.
Files changed (198) hide show
  1. package/README.md +47 -1
  2. package/dist/{bun-exec-6CQHTS4F.js → bun-exec-ULMPAIQC.js} +1 -1
  3. package/dist/{chunk-2ALAPQLV.js → chunk-D3QSET5H.js} +342 -360
  4. package/dist/{chunk-FDEDLANP.js → chunk-FQYWRHLX.js} +1 -1
  5. package/dist/{chunk-RM6LUTKD.js → chunk-FSSUAWXQ.js} +3 -3
  6. package/dist/chunk-GXWWPFBO.js +39 -0
  7. package/dist/{chunk-D3Q2UZLZ.js → chunk-I4L4T7QX.js} +1 -1
  8. package/dist/{chunk-KDNV7EA5.js → chunk-SMZBJQJR.js} +1 -1
  9. package/dist/commands/agent/actions/index.d.ts +5 -0
  10. package/dist/commands/agent/actions/index.js +4 -4
  11. package/dist/commands/agent/index.d.ts +2 -2
  12. package/dist/commands/agent/index.js +4 -4
  13. package/dist/commands/create/actions/index.js +5 -5
  14. package/dist/commands/create/index.js +6 -6
  15. package/dist/commands/shared/index.d.ts +11 -28
  16. package/dist/commands/shared/index.js +7 -3
  17. package/dist/index.js +599 -483
  18. package/dist/{plugin-creator-H26ZLR6H.js → plugin-creator-TCUFII32.js} +2 -2
  19. package/dist/{registry-N626N4VG.js → registry-RF6PW3EN.js} +4 -4
  20. package/dist/templates/plugin-quick-starter/README.md +52 -10
  21. package/dist/templates/plugin-quick-starter/package.json +10 -3
  22. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  23. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  24. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +537 -146
  25. package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
  26. package/dist/templates/plugin-quick-starter/src/plugin.ts +20 -26
  27. package/dist/templates/plugin-starter/README.md +124 -49
  28. package/dist/templates/plugin-starter/package.json +10 -3
  29. package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  30. package/{templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → dist/templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  31. package/dist/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
  32. package/dist/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
  33. package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
  34. package/dist/templates/plugin-starter/src/plugin.ts +21 -27
  35. package/dist/templates/project-starter/README.md +25 -12
  36. package/dist/templates/project-starter/package.json +4 -4
  37. package/dist/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  38. package/dist/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  39. package/dist/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  40. package/dist/templates/project-starter/src/__tests__/env.test.ts +3 -1
  41. package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
  42. package/dist/templates/project-starter/src/__tests__/integration.test.ts +2 -2
  43. package/dist/templates/project-starter/src/__tests__/models.test.ts +3 -3
  44. package/dist/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  45. package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  46. package/dist/templates/project-starter/src/index.ts +4 -3
  47. package/dist/templates/project-starter/src/plugin.ts +5 -5
  48. package/dist/templates/project-starter/tsup.config.ts +2 -1
  49. package/dist/templates/project-tee-starter/.dockerignore +64 -14
  50. package/dist/templates/project-tee-starter/Dockerfile +9 -5
  51. package/dist/templates/project-tee-starter/GUIDE.md +103 -42
  52. package/dist/templates/project-tee-starter/README.md +83 -24
  53. package/dist/templates/project-tee-starter/docker-compose.yaml +5 -2
  54. package/dist/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
  55. package/dist/templates/project-tee-starter/package.json +34 -14
  56. package/dist/templates/project-tee-starter/postcss.config.js +3 -0
  57. package/dist/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
  58. package/dist/templates/project-tee-starter/scripts/test-all.sh +82 -0
  59. package/dist/templates/project-tee-starter/src/__tests__/build-order.test.ts +62 -0
  60. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/character.test.ts +20 -18
  61. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +11 -4
  62. package/dist/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  63. package/dist/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  64. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +3 -2
  65. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  66. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  67. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/file-structure.test.ts +16 -5
  68. package/dist/templates/project-tee-starter/src/__tests__/frontend.test.ts +459 -0
  69. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  70. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  71. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/plugin.test.ts +5 -3
  72. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/provider.test.ts +2 -2
  73. package/dist/templates/project-tee-starter/src/__tests__/routes.test.ts +30 -0
  74. package/dist/templates/project-tee-starter/src/__tests__/tee-validation.test.ts +295 -0
  75. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  76. package/dist/templates/project-tee-starter/src/__tests__/vite-config-utils.ts +51 -0
  77. package/dist/templates/project-tee-starter/src/frontend/index.css +106 -0
  78. package/dist/templates/project-tee-starter/src/frontend/index.html +20 -0
  79. package/dist/templates/project-tee-starter/src/frontend/index.tsx +370 -0
  80. package/dist/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
  81. package/dist/templates/project-tee-starter/src/frontend/utils.ts +6 -0
  82. package/dist/templates/project-tee-starter/src/index.ts +8 -6
  83. package/dist/templates/project-tee-starter/src/plugin.ts +223 -61
  84. package/dist/templates/project-tee-starter/tailwind.config.js +62 -0
  85. package/dist/templates/project-tee-starter/tsconfig.build.json +2 -2
  86. package/dist/templates/project-tee-starter/tsconfig.json +8 -5
  87. package/dist/templates/project-tee-starter/tsup.config.ts +3 -2
  88. package/dist/templates/project-tee-starter/vite.config.ts +39 -0
  89. package/dist/url-utils-CKc_Ebt_.d.ts +35 -0
  90. package/dist/{utils-H66532NB.js → utils-5HPZSIF6.js} +4 -4
  91. package/package.json +7 -6
  92. package/templates/plugin-quick-starter/README.md +52 -10
  93. package/templates/plugin-quick-starter/package.json +10 -3
  94. package/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  95. package/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  96. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +537 -146
  97. package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
  98. package/templates/plugin-quick-starter/src/plugin.ts +20 -26
  99. package/templates/plugin-starter/README.md +124 -49
  100. package/templates/plugin-starter/package.json +10 -3
  101. package/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  102. package/{dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  103. package/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
  104. package/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
  105. package/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
  106. package/templates/plugin-starter/src/plugin.ts +21 -27
  107. package/templates/project-starter/README.md +25 -12
  108. package/templates/project-starter/package.json +4 -4
  109. package/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  110. package/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  111. package/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  112. package/templates/project-starter/src/__tests__/env.test.ts +3 -1
  113. package/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
  114. package/templates/project-starter/src/__tests__/integration.test.ts +2 -2
  115. package/templates/project-starter/src/__tests__/models.test.ts +3 -3
  116. package/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  117. package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  118. package/templates/project-starter/src/index.ts +4 -3
  119. package/templates/project-starter/src/plugin.ts +5 -5
  120. package/templates/project-starter/tsup.config.ts +2 -1
  121. package/templates/project-tee-starter/.dockerignore +64 -14
  122. package/templates/project-tee-starter/Dockerfile +9 -5
  123. package/templates/project-tee-starter/GUIDE.md +103 -42
  124. package/templates/project-tee-starter/README.md +83 -24
  125. package/templates/project-tee-starter/docker-compose.yaml +5 -2
  126. package/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
  127. package/templates/project-tee-starter/package.json +34 -14
  128. package/templates/project-tee-starter/postcss.config.js +3 -0
  129. package/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
  130. package/templates/project-tee-starter/scripts/test-all.sh +82 -0
  131. package/templates/project-tee-starter/src/__tests__/build-order.test.ts +62 -0
  132. package/templates/project-tee-starter/{__tests__ → src/__tests__}/character.test.ts +20 -18
  133. package/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +11 -4
  134. package/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  135. package/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  136. package/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +3 -2
  137. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  138. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  139. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/file-structure.test.ts +16 -5
  140. package/templates/project-tee-starter/src/__tests__/frontend.test.ts +459 -0
  141. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  142. package/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  143. package/templates/project-tee-starter/{__tests__ → src/__tests__}/plugin.test.ts +5 -3
  144. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/provider.test.ts +2 -2
  145. package/templates/project-tee-starter/src/__tests__/routes.test.ts +30 -0
  146. package/templates/project-tee-starter/src/__tests__/tee-validation.test.ts +295 -0
  147. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  148. package/templates/project-tee-starter/src/__tests__/vite-config-utils.ts +51 -0
  149. package/templates/project-tee-starter/src/frontend/index.css +106 -0
  150. package/templates/project-tee-starter/src/frontend/index.html +20 -0
  151. package/templates/project-tee-starter/src/frontend/index.tsx +370 -0
  152. package/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
  153. package/templates/project-tee-starter/src/frontend/utils.ts +6 -0
  154. package/templates/project-tee-starter/src/index.ts +8 -6
  155. package/templates/project-tee-starter/src/plugin.ts +223 -61
  156. package/templates/project-tee-starter/tailwind.config.js +62 -0
  157. package/templates/project-tee-starter/tsconfig.build.json +2 -2
  158. package/templates/project-tee-starter/tsconfig.json +8 -5
  159. package/templates/project-tee-starter/tsup.config.ts +3 -2
  160. package/templates/project-tee-starter/vite.config.ts +39 -0
  161. package/dist/chunk-4O6EZU37.js +0 -14
  162. package/dist/migration-guides/advanced-migration-guide.md +0 -459
  163. package/dist/migration-guides/completion-requirements.md +0 -379
  164. package/dist/migration-guides/integrated-migration-loop.md +0 -392
  165. package/dist/migration-guides/migration-guide.md +0 -712
  166. package/dist/migration-guides/prompt-and-generation-guide.md +0 -702
  167. package/dist/migration-guides/state-and-providers-guide.md +0 -544
  168. package/dist/migration-guides/testing-guide.md +0 -1021
  169. package/dist/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
  170. package/dist/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
  171. package/dist/templates/plugin-starter/dist/index.js +0 -387
  172. package/dist/templates/plugin-starter/dist/index.js.map +0 -1
  173. package/dist/templates/plugin-starter/src/tests.ts +0 -6
  174. package/dist/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  175. package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  176. package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  177. package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  178. package/dist/templates/project-tee-starter/__tests__/routes.test.ts +0 -21
  179. package/dist/templates/project-tee-starter/e2e/project.test.ts +0 -38
  180. package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  181. package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
  182. package/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
  183. package/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
  184. package/templates/plugin-starter/dist/index.d.ts +0 -14
  185. package/templates/plugin-starter/dist/index.js +0 -387
  186. package/templates/plugin-starter/dist/index.js.map +0 -1
  187. package/templates/plugin-starter/src/tests.ts +0 -6
  188. package/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  189. package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  190. package/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  191. package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  192. package/templates/project-tee-starter/__tests__/routes.test.ts +0 -21
  193. package/templates/project-tee-starter/e2e/project.test.ts +0 -38
  194. package/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  195. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  196. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
  197. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  198. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  create
4
- } from "./chunk-RM6LUTKD.js";
4
+ } from "./chunk-FSSUAWXQ.js";
5
5
  import {
6
6
  getElizaCharacter
7
- } from "./chunk-KDNV7EA5.js";
7
+ } from "./chunk-SMZBJQJR.js";
8
8
  import {
9
9
  TestRunner,
10
10
  UserEnvironment,
@@ -38,23 +38,24 @@ import {
38
38
  provideLocalPluginGuidance,
39
39
  publishToGitHub,
40
40
  resolvePgliteDir,
41
+ runBunWithSpinner,
41
42
  saveRegistrySettings,
42
43
  testPublishToGitHub,
43
44
  testPublishToNpm,
44
45
  tryDelegateToLocalCli,
45
46
  validateDataDir
46
- } from "./chunk-2ALAPQLV.js";
47
+ } from "./chunk-D3QSET5H.js";
47
48
  import {
48
49
  configureEmojis,
49
50
  emoji,
50
51
  runBunCommand
51
- } from "./chunk-FDEDLANP.js";
52
- import "./chunk-4O6EZU37.js";
52
+ } from "./chunk-FQYWRHLX.js";
53
+ import "./chunk-GXWWPFBO.js";
53
54
  import {
54
55
  bunExec,
55
56
  bunExecInherit,
56
57
  bunExecSimple
57
- } from "./chunk-D3Q2UZLZ.js";
58
+ } from "./chunk-I4L4T7QX.js";
58
59
  import "./chunk-3RG5ZIWI.js";
59
60
 
60
61
  // src/commands/dev/index.ts
@@ -263,8 +264,8 @@ async function getLocalCliPath() {
263
264
  "index.js"
264
265
  );
265
266
  try {
266
- const fs14 = await import("fs");
267
- return fs14.existsSync(localCliPath) ? localCliPath : null;
267
+ const fs15 = await import("fs");
268
+ return fs15.existsSync(localCliPath) ? localCliPath : null;
268
269
  } catch {
269
270
  return null;
270
271
  }
@@ -410,10 +411,95 @@ async function stopServer() {
410
411
  return stopServerProcess();
411
412
  }
412
413
 
413
- // src/commands/dev/actions/dev-server.ts
414
+ // src/utils/dependency-manager.ts
415
+ import * as fs from "fs";
416
+ import * as path4 from "path";
414
417
  import { logger } from "@elizaos/core";
418
+ function hasElizaOSCli(packageJsonPath) {
419
+ try {
420
+ if (!fs.existsSync(packageJsonPath)) {
421
+ return false;
422
+ }
423
+ let packageJson;
424
+ try {
425
+ packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
426
+ } catch (parseError) {
427
+ logger.debug({ error: parseError, packageJsonPath }, `Error parsing JSON in package.json`);
428
+ return false;
429
+ }
430
+ const dependencies = packageJson.dependencies || {};
431
+ const devDependencies = packageJson.devDependencies || {};
432
+ return "@elizaos/cli" in dependencies || "@elizaos/cli" in devDependencies;
433
+ } catch (error) {
434
+ logger.debug({ error, packageJsonPath }, `Error reading package.json`);
435
+ return false;
436
+ }
437
+ }
438
+ function shouldAutoInstallCli(cwd = process.cwd()) {
439
+ if (process.env.ELIZA_NO_AUTO_INSTALL === "true") {
440
+ logger.debug("Auto-install disabled via ELIZA_NO_AUTO_INSTALL");
441
+ return false;
442
+ }
443
+ if (process.env.CI === "true" || process.env.ELIZA_TEST_MODE === "true") {
444
+ logger.debug("Skipping auto-install in CI/test environment");
445
+ return false;
446
+ }
447
+ const dirInfo = detectDirectoryType(cwd);
448
+ if (dirInfo.type === "elizaos-monorepo" || dirInfo.monorepoRoot) {
449
+ logger.debug("Skipping auto-install in monorepo");
450
+ return false;
451
+ }
452
+ if (!dirInfo.hasPackageJson) {
453
+ logger.debug("No package.json found, skipping auto-install");
454
+ return false;
455
+ }
456
+ const packageJsonPath = path4.join(cwd, "package.json");
457
+ if (hasElizaOSCli(packageJsonPath)) {
458
+ logger.debug("@elizaos/cli already present, skipping auto-install");
459
+ return false;
460
+ }
461
+ return true;
462
+ }
463
+ async function installElizaOSCli(cwd = process.cwd()) {
464
+ try {
465
+ logger.info("Adding @elizaos/cli as dev dependency for enhanced development experience...");
466
+ const result = await runBunWithSpinner(["add", "--dev", "@elizaos/cli"], cwd, {
467
+ spinnerText: "Installing @elizaos/cli with bun...",
468
+ successText: "\u2713 @elizaos/cli installed successfully",
469
+ errorText: "Failed to install @elizaos/cli",
470
+ showOutputOnError: false
471
+ // Don't show verbose output for this
472
+ });
473
+ if (result.success) {
474
+ logger.info("\u2713 @elizaos/cli added as dev dependency");
475
+ return true;
476
+ } else {
477
+ logger.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
478
+ logger.debug({ error: result.error }, "Installation error:");
479
+ return false;
480
+ }
481
+ } catch (error) {
482
+ logger.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
483
+ logger.debug({ error }, "Installation error:");
484
+ return false;
485
+ }
486
+ }
487
+ async function ensureElizaOSCli(cwd = process.cwd()) {
488
+ if (!shouldAutoInstallCli(cwd)) {
489
+ return;
490
+ }
491
+ logger.debug("Auto-installing @elizaos/cli for enhanced development experience");
492
+ const success = await installElizaOSCli(cwd);
493
+ if (success) {
494
+ logger.info("Next time you can use the local CLI for better performance and consistency");
495
+ }
496
+ }
497
+
498
+ // src/commands/dev/actions/dev-server.ts
499
+ import { logger as logger2 } from "@elizaos/core";
415
500
  async function startDevMode(options) {
416
501
  const cwd = process.cwd();
502
+ await ensureElizaOSCli(cwd);
417
503
  const context = createDevContext(cwd);
418
504
  const serverManager2 = getServerManager();
419
505
  const { directoryType } = context;
@@ -444,13 +530,13 @@ async function startDevMode(options) {
444
530
  try {
445
531
  availablePort = await findNextAvailablePort(desiredPort);
446
532
  if (availablePort !== desiredPort) {
447
- logger.warn(`Port ${desiredPort} is in use, using port ${availablePort} instead`);
533
+ logger2.warn(`Port ${desiredPort} is in use, using port ${availablePort} instead`);
448
534
  }
449
535
  } catch (error) {
450
- logger.error(
536
+ logger2.error(
451
537
  `Failed to find available port starting from ${desiredPort}: ${error instanceof Error ? error.message : String(error)}`
452
538
  );
453
- logger.error("Please specify a different port using --port option");
539
+ logger2.error("Please specify a different port using --port option");
454
540
  throw new Error(`No available ports found starting from ${desiredPort}`);
455
541
  }
456
542
  cliArgs.push("--port", availablePort.toString());
@@ -524,15 +610,15 @@ import colors3 from "yoctocolors";
524
610
 
525
611
  // src/commands/env/actions/edit.ts
526
612
  import * as clack from "@clack/prompts";
527
- import { existsSync as existsSync4 } from "fs";
528
- import path5 from "path";
613
+ import { existsSync as existsSync5 } from "fs";
614
+ import path6 from "path";
529
615
 
530
616
  // src/commands/env/utils/file-operations.ts
531
- import { existsSync as existsSync3 } from "fs";
532
- import path4 from "path";
617
+ import { existsSync as existsSync4 } from "fs";
618
+ import path5 from "path";
533
619
  async function getLocalEnvPath() {
534
- const localEnvPath = path4.join(process.cwd(), ".env");
535
- return existsSync3(localEnvPath) ? localEnvPath : null;
620
+ const localEnvPath = path5.join(process.cwd(), ".env");
621
+ return existsSync4(localEnvPath) ? localEnvPath : null;
536
622
  }
537
623
  async function parseEnvFile(filePath) {
538
624
  const service = createEnvFileService(filePath);
@@ -547,7 +633,7 @@ async function writeEnvFile(filePath, envVars) {
547
633
  }
548
634
  async function resetEnvFile(filePath) {
549
635
  try {
550
- if (!existsSync3(filePath)) {
636
+ if (!existsSync4(filePath)) {
551
637
  return false;
552
638
  }
553
639
  const service = createEnvFileService(filePath);
@@ -586,9 +672,9 @@ function maskedValue(value) {
586
672
  async function editEnvVars(options, fromMainMenu = false) {
587
673
  const { yes } = options;
588
674
  const localEnvPath = await getLocalEnvPath();
589
- if (!localEnvPath || !existsSync4(localEnvPath)) {
590
- const exampleEnvPath = path5.join(process.cwd(), ".env.example");
591
- const hasExample = existsSync4(exampleEnvPath);
675
+ if (!localEnvPath || !existsSync5(localEnvPath)) {
676
+ const exampleEnvPath = path6.join(process.cwd(), ".env.example");
677
+ const hasExample = existsSync5(exampleEnvPath);
592
678
  if (hasExample) {
593
679
  console.log("No local .env file found. Create one with:");
594
680
  console.log(" cp .env.example .env");
@@ -739,8 +825,8 @@ async function addNewVariable(envPath, envVars, yes = false) {
739
825
  import * as clack3 from "@clack/prompts";
740
826
 
741
827
  // src/commands/env/actions/list.ts
742
- import { existsSync as existsSync5 } from "fs";
743
- import path6 from "path";
828
+ import { existsSync as existsSync6 } from "fs";
829
+ import path7 from "path";
744
830
  import colors from "yoctocolors";
745
831
  async function listEnvVars() {
746
832
  const envInfo = await UserEnvironment.getInstanceInfo();
@@ -753,11 +839,11 @@ async function listEnvVars() {
753
839
  );
754
840
  console.info(colors.bold("\nLocal Environment Variables:"));
755
841
  const localEnvFilePath = await getLocalEnvPath();
756
- console.info(`Path: ${localEnvFilePath ?? path6.join(process.cwd(), ".env")}`);
757
- if (!localEnvFilePath || !existsSync5(localEnvFilePath)) {
842
+ console.info(`Path: ${localEnvFilePath ?? path7.join(process.cwd(), ".env")}`);
843
+ if (!localEnvFilePath || !existsSync6(localEnvFilePath)) {
758
844
  console.info(colors.yellow(" No local .env file found"));
759
- const exampleEnvPath = path6.join(process.cwd(), ".env.example");
760
- if (existsSync5(exampleEnvPath)) {
845
+ const exampleEnvPath = path7.join(process.cwd(), ".env.example");
846
+ if (existsSync6(exampleEnvPath)) {
761
847
  console.info(colors.red(" [X] Missing .env file. Create one with:"));
762
848
  console.info(` ${colors.bold(colors.green("cp .env.example .env"))}`);
763
849
  } else {
@@ -797,7 +883,7 @@ async function handleListCommand(options) {
797
883
  } else if (options.local) {
798
884
  console.info(colors.bold("\nLocal Environment Variables:"));
799
885
  const localEnvPath = await getLocalEnvPath();
800
- if (!localEnvPath || !existsSync5(localEnvPath)) {
886
+ if (!localEnvPath || !existsSync6(localEnvPath)) {
801
887
  console.info(" No local .env file found in the current directory");
802
888
  return;
803
889
  }
@@ -816,21 +902,21 @@ async function handleListCommand(options) {
816
902
 
817
903
  // src/commands/env/actions/reset.ts
818
904
  import * as clack2 from "@clack/prompts";
819
- import { existsSync as existsSync7 } from "fs";
820
- import path7 from "path";
905
+ import { existsSync as existsSync8 } from "fs";
906
+ import path8 from "path";
821
907
  import colors2 from "yoctocolors";
822
908
 
823
909
  // src/commands/env/utils/directory-operations.ts
824
- import { existsSync as existsSync6 } from "fs";
910
+ import { existsSync as existsSync7 } from "fs";
825
911
  import { rimraf } from "rimraf";
826
912
  async function safeDeleteDirectory(dir, actions, label) {
827
- if (!existsSync6(dir)) {
913
+ if (!existsSync7(dir)) {
828
914
  actions.skipped.push(`${label} (not found)`);
829
915
  return false;
830
916
  }
831
917
  try {
832
918
  await rimraf(dir);
833
- if (!existsSync6(dir)) {
919
+ if (!existsSync7(dir)) {
834
920
  actions.deleted.push(label);
835
921
  return true;
836
922
  } else {
@@ -845,36 +931,36 @@ async function safeDeleteDirectory(dir, actions, label) {
845
931
 
846
932
  // src/commands/env/actions/reset.ts
847
933
  async function resolvePgliteDir2() {
848
- return path7.join(process.cwd(), ".eliza", "db");
934
+ return path8.join(process.cwd(), ".eliza", "db");
849
935
  }
850
936
  async function resetEnv(options) {
851
937
  const { yes } = options;
852
- const elizaDir = path7.join(process.cwd(), ".eliza");
853
- const cacheDir = path7.join(elizaDir, "cache");
854
- const localEnvPath = await getLocalEnvPath() ?? path7.join(process.cwd(), ".env");
938
+ const elizaDir = path8.join(process.cwd(), ".eliza");
939
+ const cacheDir = path8.join(elizaDir, "cache");
940
+ const localEnvPath = await getLocalEnvPath() ?? path8.join(process.cwd(), ".env");
855
941
  const localDbDir = await resolvePgliteDir2();
856
942
  const resetItems = [
857
943
  {
858
944
  title: "Local environment variables",
859
945
  value: "localEnv",
860
- description: existsSync7(localEnvPath) ? "Reset values in local .env file" : "Local .env file not found, nothing to reset",
861
- selected: existsSync7(localEnvPath)
946
+ description: existsSync8(localEnvPath) ? "Reset values in local .env file" : "Local .env file not found, nothing to reset",
947
+ selected: existsSync8(localEnvPath)
862
948
  },
863
949
  {
864
950
  title: "Cache folder",
865
951
  value: "cache",
866
- description: existsSync7(cacheDir) ? "Delete the cache folder" : "Cache folder not found, nothing to delete",
867
- selected: existsSync7(cacheDir)
952
+ description: existsSync8(cacheDir) ? "Delete the cache folder" : "Cache folder not found, nothing to delete",
953
+ selected: existsSync8(cacheDir)
868
954
  },
869
955
  {
870
956
  title: "Local database files",
871
957
  value: "localDb",
872
- description: existsSync7(localDbDir) ? "Delete local database files" : "Local database folder not found, nothing to delete",
873
- selected: existsSync7(localDbDir)
958
+ description: existsSync8(localDbDir) ? "Delete local database files" : "Local database folder not found, nothing to delete",
959
+ selected: existsSync8(localDbDir)
874
960
  }
875
961
  ];
876
962
  const validResetItems = resetItems.filter(
877
- (item) => item.value === "localEnv" && existsSync7(localEnvPath) || item.value === "cache" && existsSync7(cacheDir) || item.value === "localDb" && existsSync7(localDbDir)
963
+ (item) => item.value === "localEnv" && existsSync8(localEnvPath) || item.value === "cache" && existsSync8(cacheDir) || item.value === "localDb" && existsSync8(localDbDir)
878
964
  );
879
965
  let selectedValues = [];
880
966
  if (yes) {
@@ -1052,7 +1138,7 @@ env.action(() => {
1052
1138
  import { Command as Command3 } from "commander";
1053
1139
 
1054
1140
  // src/commands/plugins/actions/install.ts
1055
- import { logger as logger4 } from "@elizaos/core";
1141
+ import { logger as logger5 } from "@elizaos/core";
1056
1142
 
1057
1143
  // src/commands/plugins/utils/naming.ts
1058
1144
  var findPluginPackageName = (pluginInput, allDependencies) => {
@@ -1094,55 +1180,55 @@ var extractPackageName = (pluginInput) => {
1094
1180
  };
1095
1181
 
1096
1182
  // src/commands/plugins/utils/env-vars.ts
1097
- import { logger as logger2 } from "@elizaos/core";
1098
- import { existsSync as existsSync8, readFileSync, readdirSync as readdirSync2 } from "fs";
1099
- import path8 from "path";
1183
+ import { logger as logger3 } from "@elizaos/core";
1184
+ import { existsSync as existsSync9, readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
1185
+ import path9 from "path";
1100
1186
  import * as clack4 from "@clack/prompts";
1101
1187
  var extractPluginEnvRequirements = async (packageName, cwd) => {
1102
1188
  try {
1103
1189
  const possiblePaths = [
1104
1190
  // Direct path
1105
- path8.join(cwd, "node_modules", packageName, "package.json"),
1191
+ path9.join(cwd, "node_modules", packageName, "package.json"),
1106
1192
  // Scoped package path (e.g., @elizaos/plugin-discord)
1107
- path8.join(cwd, "node_modules", packageName.replace("/", path8.sep), "package.json")
1193
+ path9.join(cwd, "node_modules", packageName.replace("/", path9.sep), "package.json")
1108
1194
  ];
1109
1195
  if (!packageName.startsWith("@elizaos/")) {
1110
1196
  possiblePaths.push(
1111
- path8.join(cwd, "node_modules", "@elizaos", packageName, "package.json"),
1112
- path8.join(cwd, "node_modules", "@elizaos", `plugin-${packageName}`, "package.json")
1197
+ path9.join(cwd, "node_modules", "@elizaos", packageName, "package.json"),
1198
+ path9.join(cwd, "node_modules", "@elizaos", `plugin-${packageName}`, "package.json")
1113
1199
  );
1114
1200
  }
1115
1201
  let currentDir = cwd;
1116
1202
  for (let i = 0; i < 5; i++) {
1117
- const parentNodeModules = path8.join(currentDir, "node_modules");
1118
- if (existsSync8(parentNodeModules)) {
1203
+ const parentNodeModules = path9.join(currentDir, "node_modules");
1204
+ if (existsSync9(parentNodeModules)) {
1119
1205
  possiblePaths.push(
1120
- path8.join(parentNodeModules, packageName, "package.json"),
1121
- path8.join(parentNodeModules, packageName.replace("/", path8.sep), "package.json")
1206
+ path9.join(parentNodeModules, packageName, "package.json"),
1207
+ path9.join(parentNodeModules, packageName.replace("/", path9.sep), "package.json")
1122
1208
  );
1123
1209
  }
1124
- const parentDir = path8.dirname(currentDir);
1210
+ const parentDir = path9.dirname(currentDir);
1125
1211
  if (parentDir === currentDir) break;
1126
1212
  currentDir = parentDir;
1127
1213
  }
1128
1214
  let packageJsonPath = null;
1129
1215
  for (const possiblePath of possiblePaths) {
1130
- if (existsSync8(possiblePath)) {
1216
+ if (existsSync9(possiblePath)) {
1131
1217
  packageJsonPath = possiblePath;
1132
- logger2.debug(`Found plugin package.json at: ${packageJsonPath}`);
1218
+ logger3.debug({ packageJsonPath }, `Found plugin package.json at:`);
1133
1219
  break;
1134
1220
  }
1135
1221
  }
1136
1222
  if (!packageJsonPath) {
1137
- const nodeModulesPath = path8.join(cwd, "node_modules");
1138
- if (existsSync8(nodeModulesPath)) {
1223
+ const nodeModulesPath = path9.join(cwd, "node_modules");
1224
+ if (existsSync9(nodeModulesPath)) {
1139
1225
  const packages = readdirSync2(nodeModulesPath);
1140
1226
  for (const pkg of packages) {
1141
1227
  if (pkg.includes(packageName.replace("@elizaos/", "").replace("plugin-", ""))) {
1142
- const pkgJsonPath = path8.join(nodeModulesPath, pkg, "package.json");
1143
- if (existsSync8(pkgJsonPath)) {
1228
+ const pkgJsonPath = path9.join(nodeModulesPath, pkg, "package.json");
1229
+ if (existsSync9(pkgJsonPath)) {
1144
1230
  packageJsonPath = pkgJsonPath;
1145
- logger2.debug(`Found matching plugin package.json at: ${packageJsonPath}`);
1231
+ logger3.debug({ packageJsonPath }, `Found matching plugin package.json at:`);
1146
1232
  break;
1147
1233
  }
1148
1234
  }
@@ -1150,30 +1236,29 @@ var extractPluginEnvRequirements = async (packageName, cwd) => {
1150
1236
  }
1151
1237
  }
1152
1238
  if (!packageJsonPath) {
1153
- logger2.debug(`Plugin package.json not found for: ${packageName}`);
1154
- logger2.debug(`Searched paths: ${possiblePaths.join(", ")}`);
1239
+ logger3.debug({ packageName }, `Plugin package.json not found`);
1240
+ logger3.debug({ paths: possiblePaths }, `Searched paths:`);
1155
1241
  return {};
1156
1242
  }
1157
- const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
1243
+ const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
1158
1244
  const packageJson = JSON.parse(packageJsonContent);
1159
1245
  const agentConfig = packageJson.agentConfig;
1160
1246
  if (!agentConfig || !agentConfig.pluginParameters) {
1161
- logger2.debug(`No agentConfig.pluginParameters found in ${packageName} at ${packageJsonPath}`);
1247
+ logger3.debug(`No agentConfig.pluginParameters found in ${packageName} at ${packageJsonPath}`);
1162
1248
  return {};
1163
1249
  }
1164
- logger2.debug(
1165
- `Found environment variables for ${packageName}: ${Object.keys(agentConfig.pluginParameters).join(", ")}`
1250
+ logger3.debug(
1251
+ { packageName, vars: Object.keys(agentConfig.pluginParameters) },
1252
+ "Found environment variables"
1166
1253
  );
1167
1254
  return agentConfig.pluginParameters;
1168
1255
  } catch (error) {
1169
- logger2.debug(
1170
- `Error reading plugin package.json for ${packageName}: ${error instanceof Error ? error.message : String(error)}`
1171
- );
1256
+ logger3.debug({ error, packageName }, "Error reading plugin package.json");
1172
1257
  return {};
1173
1258
  }
1174
1259
  };
1175
1260
  var readEnvFile = async (cwd) => {
1176
- const envPath = path8.join(cwd, ".env");
1261
+ const envPath = path9.join(cwd, ".env");
1177
1262
  const envService = createEnvFileService(envPath);
1178
1263
  return envService.read();
1179
1264
  };
@@ -1360,7 +1445,7 @@ var promptForEnvVar = async (varName, config2) => {
1360
1445
  return finalValue.trim();
1361
1446
  };
1362
1447
  var updateEnvFile = async (cwd, varName, value) => {
1363
- const envPath = path8.join(cwd, ".env");
1448
+ const envPath = path9.join(cwd, ".env");
1364
1449
  const envService = createEnvFileService(envPath);
1365
1450
  await envService.update(varName, value, {
1366
1451
  preserveComments: true,
@@ -1378,7 +1463,7 @@ var promptForPluginEnvVars = async (packageName, cwd) => {
1378
1463
  }
1379
1464
  }
1380
1465
  if (Object.keys(envRequirements).length === 0) {
1381
- const nodeModulesPath = path8.join(cwd, "node_modules");
1466
+ const nodeModulesPath = path9.join(cwd, "node_modules");
1382
1467
  const possiblePackages = [
1383
1468
  packageName,
1384
1469
  `@elizaos/${packageName.replace("plugin-", "")}`,
@@ -1386,17 +1471,17 @@ var promptForPluginEnvVars = async (packageName, cwd) => {
1386
1471
  ];
1387
1472
  let packageFound = false;
1388
1473
  for (const pkg of possiblePackages) {
1389
- const pkgPath = path8.join(nodeModulesPath, ...pkg.split("/"));
1390
- if (existsSync8(path8.join(pkgPath, "package.json"))) {
1474
+ const pkgPath = path9.join(nodeModulesPath, ...pkg.split("/"));
1475
+ if (existsSync9(path9.join(pkgPath, "package.json"))) {
1391
1476
  packageFound = true;
1392
1477
  break;
1393
1478
  }
1394
1479
  }
1395
1480
  if (packageFound) {
1396
- logger2.debug(`Package ${packageName} found but has no environment variables defined`);
1481
+ logger3.debug(`Package ${packageName} found but has no environment variables defined`);
1397
1482
  clack4.log.success(`No environment variables required for ${packageName}`);
1398
1483
  } else {
1399
- logger2.debug(`Package ${packageName} not found in node_modules`);
1484
+ logger3.debug(`Package ${packageName} not found in node_modules`);
1400
1485
  clack4.log.warn(
1401
1486
  `Could not find ${packageName} in node_modules. Environment variables may need to be configured manually.`
1402
1487
  );
@@ -1537,26 +1622,26 @@ Restart your application after adding the variables.`
1537
1622
  };
1538
1623
 
1539
1624
  // src/commands/plugins/utils/directory.ts
1540
- import { logger as logger3 } from "@elizaos/core";
1541
- import { readFileSync as readFileSync2 } from "fs";
1542
- import path9 from "path";
1625
+ import { logger as logger4 } from "@elizaos/core";
1626
+ import { readFileSync as readFileSync3 } from "fs";
1627
+ import path10 from "path";
1543
1628
  var getDependenciesFromDirectory = (cwd) => {
1544
1629
  const directoryInfo = detectDirectoryType(cwd);
1545
1630
  if (!directoryInfo.hasPackageJson) {
1546
1631
  return null;
1547
1632
  }
1548
1633
  try {
1549
- const packageJsonPath = path9.join(cwd, "package.json");
1550
- const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
1634
+ const packageJsonPath = path10.join(cwd, "package.json");
1635
+ const packageJsonContent = readFileSync3(packageJsonPath, "utf-8");
1551
1636
  const packageJson = JSON.parse(packageJsonContent);
1552
1637
  const dependencies = packageJson.dependencies || {};
1553
1638
  const devDependencies = packageJson.devDependencies || {};
1554
1639
  return { ...dependencies, ...devDependencies };
1555
1640
  } catch (error) {
1556
1641
  if (error instanceof SyntaxError) {
1557
- logger3.warn(`Could not parse package.json: ${error.message}`);
1642
+ logger4.warn(`Could not parse package.json: ${error.message}`);
1558
1643
  } else {
1559
- logger3.warn(
1644
+ logger4.warn(
1560
1645
  `Error reading package.json: ${error instanceof Error ? error.message : String(error)}`
1561
1646
  );
1562
1647
  }
@@ -1591,7 +1676,7 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1591
1676
  const pluginNameForPostInstall = repo;
1592
1677
  const success = await installPlugin(githubSpecifier, cwd, void 0, opts.skipVerification);
1593
1678
  if (success) {
1594
- logger4.info(`Successfully installed ${pluginNameForPostInstall} from ${githubSpecifier}.`);
1679
+ logger5.info(`Successfully installed ${pluginNameForPostInstall} from ${githubSpecifier}.`);
1595
1680
  const packageName = extractPackageName(plugin);
1596
1681
  if (!opts.skipEnvPrompt) {
1597
1682
  await new Promise((resolve2) => setTimeout(resolve2, 500));
@@ -1600,7 +1685,7 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1600
1685
  try {
1601
1686
  await promptForPluginEnvVars(packageName, cwd);
1602
1687
  } catch (error) {
1603
- logger4.warn(
1688
+ logger5.warn(
1604
1689
  `Warning: Could not prompt for environment variables: ${error instanceof Error ? error.message : String(error)}`
1605
1690
  );
1606
1691
  }
@@ -1611,14 +1696,14 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1611
1696
  showInstallationSuccess(packageName);
1612
1697
  process.exit(0);
1613
1698
  } else {
1614
- logger4.error(`Failed to install plugin from ${githubSpecifier}.`);
1699
+ logger5.error(`Failed to install plugin from ${githubSpecifier}.`);
1615
1700
  process.exit(1);
1616
1701
  }
1617
1702
  }
1618
1703
  async function installPluginFromRegistry(plugin, cwd, opts) {
1619
1704
  const cachedRegistry = await fetchPluginRegistry();
1620
1705
  if (!cachedRegistry || !cachedRegistry.registry) {
1621
- logger4.error('Plugin registry cache not found. Please run "elizaos plugins update" first.');
1706
+ logger5.error('Plugin registry cache not found. Please run "elizaos plugins update" first.');
1622
1707
  process.exit(1);
1623
1708
  }
1624
1709
  const possibleNames = normalizePluginName(plugin);
@@ -1641,7 +1726,7 @@ async function installPluginFromRegistry(plugin, cwd, opts) {
1641
1726
  try {
1642
1727
  await promptForPluginEnvVars(actualPackageName, cwd);
1643
1728
  } catch (error) {
1644
- logger4.warn(
1729
+ logger5.warn(
1645
1730
  `Warning: Could not prompt for environment variables: ${error instanceof Error ? error.message : String(error)}`
1646
1731
  );
1647
1732
  }
@@ -1657,8 +1742,8 @@ async function installPluginFromRegistry(plugin, cwd, opts) {
1657
1742
  }
1658
1743
  async function addPlugin(pluginArg, opts) {
1659
1744
  if (!pluginArg || !pluginArg.trim()) {
1660
- logger4.error("Plugin name cannot be empty or whitespace-only.");
1661
- logger4.info(
1745
+ logger5.error("Plugin name cannot be empty or whitespace-only.");
1746
+ logger5.info(
1662
1747
  'Please provide a valid plugin name (e.g., "openai", "plugin-anthropic", "@elizaos/plugin-sql")'
1663
1748
  );
1664
1749
  process.exit(1);
@@ -1666,14 +1751,14 @@ async function addPlugin(pluginArg, opts) {
1666
1751
  const cwd = process.cwd();
1667
1752
  const directoryInfo = detectDirectoryType(cwd);
1668
1753
  if (!directoryInfo || !directoryInfo.hasPackageJson) {
1669
- logger4.error(
1754
+ logger5.error(
1670
1755
  `Command must be run inside an ElizaOS project directory. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
1671
1756
  );
1672
1757
  process.exit(1);
1673
1758
  }
1674
1759
  const allDependencies = getDependenciesFromDirectory(cwd);
1675
1760
  if (!allDependencies) {
1676
- logger4.error("Could not read dependencies from package.json");
1761
+ logger5.error("Could not read dependencies from package.json");
1677
1762
  process.exit(1);
1678
1763
  }
1679
1764
  let plugin = pluginArg;
@@ -1688,7 +1773,7 @@ async function addPlugin(pluginArg, opts) {
1688
1773
  }
1689
1774
  const installedPluginName = findPluginPackageName(plugin, allDependencies);
1690
1775
  if (installedPluginName) {
1691
- logger4.info(`Plugin "${installedPluginName}" is already added to this project.`);
1776
+ logger5.info(`Plugin "${installedPluginName}" is already added to this project.`);
1692
1777
  process.exit(0);
1693
1778
  }
1694
1779
  const githubRegex = /^(?:github:)?([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:#([a-zA-Z0-9_.-]+))?$/;
@@ -1700,9 +1785,9 @@ async function addPlugin(pluginArg, opts) {
1700
1785
  }
1701
1786
 
1702
1787
  // src/commands/plugins/actions/remove.ts
1703
- import { logger as logger5 } from "@elizaos/core";
1704
- import { existsSync as existsSync9, rmSync } from "fs";
1705
- import path10 from "path";
1788
+ import { logger as logger6 } from "@elizaos/core";
1789
+ import { existsSync as existsSync10, rmSync } from "fs";
1790
+ import path11 from "path";
1706
1791
  async function removePlugin(plugin) {
1707
1792
  const cwd = process.cwd();
1708
1793
  const directoryInfo = detectDirectoryType(cwd);
@@ -1721,7 +1806,7 @@ async function removePlugin(plugin) {
1721
1806
  }
1722
1807
  const packageNameToRemove = findPluginPackageName(plugin, allDependencies);
1723
1808
  if (!packageNameToRemove) {
1724
- logger5.warn(`Plugin matching "${plugin}" not found in project dependencies.`);
1809
+ logger6.warn(`Plugin matching "${plugin}" not found in project dependencies.`);
1725
1810
  console.info("\nCheck installed plugins using: elizaos plugins installed-plugins");
1726
1811
  process.exit(0);
1727
1812
  }
@@ -1731,11 +1816,11 @@ async function removePlugin(plugin) {
1731
1816
  cwd
1732
1817
  });
1733
1818
  } catch (execError) {
1734
- logger5.error(
1819
+ logger6.error(
1735
1820
  `Failed to run 'bun remove ${packageNameToRemove}': ${execError instanceof Error ? execError.message : String(execError)}`
1736
1821
  );
1737
1822
  if (execError && typeof execError === "object" && "stderr" in execError && typeof execError.stderr === "string" && execError.stderr.includes("not found")) {
1738
- logger5.info(
1823
+ logger6.info(
1739
1824
  `'bun remove' indicated package was not found. Continuing with directory removal attempt.`
1740
1825
  );
1741
1826
  } else {
@@ -1750,22 +1835,22 @@ async function removePlugin(plugin) {
1750
1835
  }
1751
1836
  baseName = baseName.replace(/^plugin-/, "");
1752
1837
  const dirNameToRemove = `plugin-${baseName}`;
1753
- const pluginDir = path10.join(cwd, dirNameToRemove);
1754
- if (existsSync9(pluginDir)) {
1838
+ const pluginDir = path11.join(cwd, dirNameToRemove);
1839
+ if (existsSync10(pluginDir)) {
1755
1840
  try {
1756
1841
  rmSync(pluginDir, { recursive: true, force: true });
1757
1842
  } catch (rmError) {
1758
- logger5.error(
1843
+ logger6.error(
1759
1844
  `Failed to remove directory ${pluginDir}: ${rmError instanceof Error ? rmError.message : String(rmError)}`
1760
1845
  );
1761
1846
  }
1762
1847
  } else {
1763
- const nonPrefixedDir = path10.join(cwd, baseName);
1764
- if (existsSync9(nonPrefixedDir)) {
1848
+ const nonPrefixedDir = path11.join(cwd, baseName);
1849
+ if (existsSync10(nonPrefixedDir)) {
1765
1850
  try {
1766
1851
  rmSync(nonPrefixedDir, { recursive: true, force: true });
1767
1852
  } catch (rmError) {
1768
- logger5.error(
1853
+ logger6.error(
1769
1854
  `Failed to remove directory ${nonPrefixedDir}: ${rmError instanceof Error ? rmError.message : String(rmError)}`
1770
1855
  );
1771
1856
  }
@@ -1775,11 +1860,11 @@ async function removePlugin(plugin) {
1775
1860
  }
1776
1861
 
1777
1862
  // src/commands/plugins/actions/list.ts
1778
- import { logger as logger6 } from "@elizaos/core";
1863
+ import { logger as logger7 } from "@elizaos/core";
1779
1864
  async function listAvailablePlugins(opts) {
1780
1865
  const cachedRegistry = await fetchPluginRegistry();
1781
1866
  if (!cachedRegistry || !cachedRegistry.registry || Object.keys(cachedRegistry.registry).length === 0) {
1782
- logger6.info("Plugin cache is empty or not found.");
1867
+ logger7.info("Plugin cache is empty or not found.");
1783
1868
  console.log('\nPlease run "elizaos plugins update" to fetch the latest plugin registry.');
1784
1869
  return;
1785
1870
  }
@@ -1857,20 +1942,20 @@ async function listInstalledPlugins() {
1857
1942
  }
1858
1943
 
1859
1944
  // src/commands/plugins/actions/upgrade.ts
1860
- import { logger as logger9 } from "@elizaos/core";
1861
- import path12 from "path";
1862
- import { existsSync as existsSync11 } from "fs";
1945
+ import { logger as logger10 } from "@elizaos/core";
1946
+ import path13 from "path";
1947
+ import { existsSync as existsSync12 } from "fs";
1863
1948
  import { fileURLToPath as fileURLToPath2 } from "url";
1864
- import fs from "fs-extra";
1949
+ import fs2 from "fs-extra";
1865
1950
 
1866
1951
  // src/utils/upgrade/simple-migration-agent.ts
1867
1952
  import { query } from "@anthropic-ai/claude-code";
1868
1953
 
1869
1954
  // src/utils/upgrade/migration-guide-loader.ts
1870
- import { existsSync as existsSync10, readFileSync as readFileSync3 } from "fs";
1871
- import path11 from "path";
1955
+ import { existsSync as existsSync11, readFileSync as readFileSync4 } from "fs";
1956
+ import path12 from "path";
1872
1957
  import { fileURLToPath } from "url";
1873
- import { logger as logger7 } from "@elizaos/core";
1958
+ import { logger as logger8 } from "@elizaos/core";
1874
1959
  var MigrationGuideLoader = class {
1875
1960
  guides = [];
1876
1961
  guidesDir;
@@ -1880,33 +1965,33 @@ var MigrationGuideLoader = class {
1880
1965
  }
1881
1966
  findGuidesDirectory(projectRoot) {
1882
1967
  if (projectRoot) {
1883
- const guidesPath = path11.join(projectRoot, "packages/docs/docs/plugins/migration/claude-code");
1884
- if (existsSync10(guidesPath)) {
1968
+ const guidesPath = path12.join(projectRoot, "packages/docs/docs/plugins/migration/claude-code");
1969
+ if (existsSync11(guidesPath)) {
1885
1970
  return guidesPath;
1886
1971
  }
1887
1972
  }
1888
1973
  let currentRoot = process.cwd();
1889
1974
  let previousRoot = "";
1890
- while (currentRoot !== previousRoot && !existsSync10(path11.join(currentRoot, "packages/docs"))) {
1975
+ while (currentRoot !== previousRoot && !existsSync11(path12.join(currentRoot, "packages/docs"))) {
1891
1976
  previousRoot = currentRoot;
1892
- currentRoot = path11.dirname(currentRoot);
1977
+ currentRoot = path12.dirname(currentRoot);
1893
1978
  }
1894
- const monorepoGuidesPath = path11.join(
1979
+ const monorepoGuidesPath = path12.join(
1895
1980
  currentRoot,
1896
1981
  "packages/docs/docs/plugins/migration/claude-code"
1897
1982
  );
1898
- if (existsSync10(monorepoGuidesPath)) {
1983
+ if (existsSync11(monorepoGuidesPath)) {
1899
1984
  return monorepoGuidesPath;
1900
1985
  }
1901
- const workingDirGuides = path11.join(process.cwd(), "migration-guides");
1902
- if (existsSync10(workingDirGuides)) {
1986
+ const workingDirGuides = path12.join(process.cwd(), "migration-guides");
1987
+ if (existsSync11(workingDirGuides)) {
1903
1988
  return workingDirGuides;
1904
1989
  }
1905
1990
  const currentFileUrl = import.meta.url;
1906
1991
  const currentFilePath = fileURLToPath(currentFileUrl);
1907
- const cliPackageRoot = path11.dirname(path11.dirname(path11.dirname(path11.dirname(currentFilePath))));
1908
- const bundledGuidesPath = path11.join(cliPackageRoot, "migration-guides");
1909
- if (existsSync10(bundledGuidesPath)) {
1992
+ const cliPackageRoot = path12.dirname(path12.dirname(path12.dirname(path12.dirname(currentFilePath))));
1993
+ const bundledGuidesPath = path12.join(cliPackageRoot, "migration-guides");
1994
+ if (existsSync11(bundledGuidesPath)) {
1910
1995
  return bundledGuidesPath;
1911
1996
  }
1912
1997
  return "";
@@ -2019,16 +2104,16 @@ var MigrationGuideLoader = class {
2019
2104
  ]
2020
2105
  }
2021
2106
  ];
2022
- if (!this.guidesDir || !existsSync10(this.guidesDir)) {
2023
- logger7.info("Using embedded migration guidance (external CLI mode)");
2107
+ if (!this.guidesDir || !existsSync11(this.guidesDir)) {
2108
+ logger8.info("Using embedded migration guidance (external CLI mode)");
2024
2109
  this.createEmbeddedGuides(guideConfigs);
2025
2110
  return;
2026
2111
  }
2027
2112
  for (const config2 of guideConfigs) {
2028
- const guidePath = path11.join(this.guidesDir, config2.name);
2029
- if (existsSync10(guidePath)) {
2113
+ const guidePath = path12.join(this.guidesDir, config2.name);
2114
+ if (existsSync11(guidePath)) {
2030
2115
  try {
2031
- const content = readFileSync3(guidePath, "utf-8");
2116
+ const content = readFileSync4(guidePath, "utf-8");
2032
2117
  this.guides.push({
2033
2118
  name: config2.name,
2034
2119
  path: guidePath,
@@ -2037,13 +2122,16 @@ var MigrationGuideLoader = class {
2037
2122
  keywords: config2.keywords
2038
2123
  });
2039
2124
  } catch (error) {
2040
- logger7.warn(`Failed to load migration guide: ${config2.name}`, error);
2125
+ logger8.warn({ error, guideName: config2.name }, `Failed to load migration guide`);
2041
2126
  }
2042
2127
  } else {
2043
- logger7.warn(`Migration guide not found: ${guidePath}`);
2128
+ logger8.warn({ guidePath }, `Migration guide not found`);
2044
2129
  }
2045
2130
  }
2046
- logger7.info(`Loaded ${this.guides.length} migration guides from ${this.guidesDir}`);
2131
+ logger8.info(
2132
+ { count: this.guides.length, guidesDir: this.guidesDir },
2133
+ `Loaded migration guides`
2134
+ );
2047
2135
  }
2048
2136
  createEmbeddedGuides(guideConfigs) {
2049
2137
  const embeddedGuides = {
@@ -2291,7 +2379,7 @@ function createMigrationGuideLoader(projectRoot) {
2291
2379
  }
2292
2380
 
2293
2381
  // src/utils/upgrade/simple-migration-agent.ts
2294
- import { logger as logger8 } from "@elizaos/core";
2382
+ import { logger as logger9 } from "@elizaos/core";
2295
2383
  var SimpleMigrationAgent = class extends EventTarget {
2296
2384
  handlers = /* @__PURE__ */ new Map();
2297
2385
  repoPath;
@@ -2315,10 +2403,10 @@ var SimpleMigrationAgent = class extends EventTarget {
2315
2403
  try {
2316
2404
  this.guideLoader = createMigrationGuideLoader();
2317
2405
  if (this.verbose) {
2318
- logger8.info("Migration guide loader initialized successfully");
2406
+ logger9.info("Migration guide loader initialized successfully");
2319
2407
  }
2320
2408
  } catch (error) {
2321
- logger8.warn("Failed to initialize migration guide loader", error);
2409
+ logger9.warn({ error }, "Failed to initialize migration guide loader");
2322
2410
  throw new Error("Cannot initialize migration system without guide access");
2323
2411
  }
2324
2412
  }
@@ -2926,13 +3014,13 @@ async function upgradePlugin(pluginPath, opts) {
2926
3014
  process.env.ANTHROPIC_API_KEY = opts.apiKey;
2927
3015
  }
2928
3016
  if (!process.env.ANTHROPIC_API_KEY) {
2929
- logger9.error("ANTHROPIC_API_KEY is required for plugin upgrade.");
3017
+ logger10.error("ANTHROPIC_API_KEY is required for plugin upgrade.");
2930
3018
  console.log("\nPlease set ANTHROPIC_API_KEY environment variable or use --api-key option.");
2931
3019
  console.log("Get your API key from: https://console.anthropic.com/");
2932
3020
  process.exit(1);
2933
3021
  }
2934
3022
  if (!process.env.ANTHROPIC_API_KEY.startsWith("sk-ant-")) {
2935
- logger9.error("Invalid ANTHROPIC_API_KEY format.");
3023
+ logger10.error("Invalid ANTHROPIC_API_KEY format.");
2936
3024
  console.log('\nThe API key should start with "sk-ant-"');
2937
3025
  console.log("Get your API key from: https://console.anthropic.com/");
2938
3026
  process.exit(1);
@@ -2952,41 +3040,41 @@ async function upgradePlugin(pluginPath, opts) {
2952
3040
  console.log("\nInstall the SDK: bun add @anthropic-ai/claude-code");
2953
3041
  process.exit(1);
2954
3042
  }
2955
- const workingDir = path12.resolve(pluginPath);
2956
- if (!existsSync11(workingDir)) {
3043
+ const workingDir = path13.resolve(pluginPath);
3044
+ if (!existsSync12(workingDir)) {
2957
3045
  throw new Error(`Plugin directory not found: ${workingDir}`);
2958
3046
  }
2959
3047
  console.log(chalk.cyan("\u{1F527} Setting up migration environment..."));
2960
3048
  let projectRoot = process.cwd();
2961
3049
  let guidesSource;
2962
3050
  let previousRoot = "";
2963
- while (projectRoot !== previousRoot && !existsSync11(path12.join(projectRoot, "packages/docs"))) {
3051
+ while (projectRoot !== previousRoot && !existsSync12(path13.join(projectRoot, "packages/docs"))) {
2964
3052
  previousRoot = projectRoot;
2965
- projectRoot = path12.dirname(projectRoot);
3053
+ projectRoot = path13.dirname(projectRoot);
2966
3054
  }
2967
- const monorepoGuidesPath = path12.join(
3055
+ const monorepoGuidesPath = path13.join(
2968
3056
  projectRoot,
2969
3057
  "packages/docs/docs/plugins/migration/claude-code"
2970
3058
  );
2971
- if (existsSync11(monorepoGuidesPath)) {
3059
+ if (existsSync12(monorepoGuidesPath)) {
2972
3060
  guidesSource = monorepoGuidesPath;
2973
3061
  } else {
2974
3062
  const currentFileUrl = import.meta.url;
2975
3063
  const currentFilePath = fileURLToPath2(currentFileUrl);
2976
- const cliPackageRoot = path12.dirname(
2977
- path12.dirname(path12.dirname(path12.dirname(currentFilePath)))
3064
+ const cliPackageRoot = path13.dirname(
3065
+ path13.dirname(path13.dirname(path13.dirname(currentFilePath)))
2978
3066
  );
2979
- const bundledGuidesPath = path12.join(cliPackageRoot, "migration-guides");
2980
- if (existsSync11(bundledGuidesPath)) {
3067
+ const bundledGuidesPath = path13.join(cliPackageRoot, "migration-guides");
3068
+ if (existsSync12(bundledGuidesPath)) {
2981
3069
  guidesSource = bundledGuidesPath;
2982
3070
  } else {
2983
3071
  guidesSource = "";
2984
3072
  }
2985
3073
  }
2986
- const guidesTarget = path12.join(workingDir, "migration-guides");
2987
- await fs.ensureDir(guidesTarget);
2988
- if (guidesSource && existsSync11(guidesSource)) {
2989
- await fs.copy(guidesSource, guidesTarget, { overwrite: true });
3074
+ const guidesTarget = path13.join(workingDir, "migration-guides");
3075
+ await fs2.ensureDir(guidesTarget);
3076
+ if (guidesSource && existsSync12(guidesSource)) {
3077
+ await fs2.copy(guidesSource, guidesTarget, { overwrite: true });
2990
3078
  if (opts.debug) {
2991
3079
  console.log(chalk.gray(`Copied guides from: ${guidesSource}`));
2992
3080
  }
@@ -3022,8 +3110,8 @@ Plugin: ${pluginPath}`));
3022
3110
  });
3023
3111
  const result = await agent2.migrate();
3024
3112
  try {
3025
- if (existsSync11(guidesTarget)) {
3026
- await fs.remove(guidesTarget);
3113
+ if (existsSync12(guidesTarget)) {
3114
+ await fs2.remove(guidesTarget);
3027
3115
  if (opts.debug) {
3028
3116
  console.log(chalk.gray("Cleaned up migration guides"));
3029
3117
  }
@@ -3036,7 +3124,7 @@ Plugin: ${pluginPath}`));
3036
3124
  if (result.success) {
3037
3125
  console.log(chalk.green("\nMigration completed successfully!"));
3038
3126
  console.log(chalk.gray("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
3039
- console.log(`Location: ${chalk.cyan(path12.basename(result.repoPath))}`);
3127
+ console.log(`Location: ${chalk.cyan(path13.basename(result.repoPath))}`);
3040
3128
  console.log(`Duration: ${chalk.yellow(Math.round(result.duration / 1e3) + "s")}`);
3041
3129
  console.log(`AI Operations: ${chalk.blue(result.messageCount)}`);
3042
3130
  if (result.guidesUsed && result.guidesUsed.length > 0) {
@@ -3046,7 +3134,7 @@ Plugin: ${pluginPath}`));
3046
3134
  }
3047
3135
  }
3048
3136
  console.log(chalk.bold("\nNext Steps:"));
3049
- console.log(`${chalk.gray("1.")} cd ${chalk.cyan(path12.basename(result.repoPath))}`);
3137
+ console.log(`${chalk.gray("1.")} cd ${chalk.cyan(path13.basename(result.repoPath))}`);
3050
3138
  console.log(
3051
3139
  `${chalk.gray("2.")} git checkout 1.x ${chalk.gray("# Review the migrated code")}`
3052
3140
  );
@@ -3075,9 +3163,9 @@ Plugin: ${pluginPath}`));
3075
3163
  }
3076
3164
  } catch (error) {
3077
3165
  try {
3078
- const guidesTarget = path12.join(path12.resolve(pluginPath), "migration-guides");
3079
- if (existsSync11(guidesTarget)) {
3080
- await fs.remove(guidesTarget);
3166
+ const guidesTarget = path13.join(path13.resolve(pluginPath), "migration-guides");
3167
+ if (existsSync12(guidesTarget)) {
3168
+ await fs2.remove(guidesTarget);
3081
3169
  if (opts.debug) {
3082
3170
  console.log(chalk.gray("Cleaned up migration guides after error"));
3083
3171
  }
@@ -3103,33 +3191,33 @@ Error: ${error instanceof Error ? error.message : String(error)}`));
3103
3191
  }
3104
3192
 
3105
3193
  // src/commands/plugins/actions/generate.ts
3106
- import { logger as logger10 } from "@elizaos/core";
3107
- import { readFileSync as readFileSync4 } from "fs";
3108
- import path13 from "path";
3194
+ import { logger as logger11 } from "@elizaos/core";
3195
+ import { readFileSync as readFileSync5 } from "fs";
3196
+ import path14 from "path";
3109
3197
  async function generatePlugin(opts) {
3110
3198
  try {
3111
- const { PluginCreator } = await import("./plugin-creator-H26ZLR6H.js");
3199
+ const { PluginCreator } = await import("./plugin-creator-TCUFII32.js");
3112
3200
  if (opts.apiKey) {
3113
3201
  process.env.ANTHROPIC_API_KEY = opts.apiKey;
3114
3202
  }
3115
3203
  if (!process.env.ANTHROPIC_API_KEY) {
3116
- logger10.error("ANTHROPIC_API_KEY is required for plugin generation.");
3204
+ logger11.error("ANTHROPIC_API_KEY is required for plugin generation.");
3117
3205
  console.log("\nPlease set ANTHROPIC_API_KEY environment variable or use --api-key option.");
3118
3206
  process.exit(1);
3119
3207
  }
3120
3208
  let spec = void 0;
3121
3209
  if (opts.specFile) {
3122
3210
  try {
3123
- const specContent = readFileSync4(opts.specFile, "utf-8");
3211
+ const specContent = readFileSync5(opts.specFile, "utf-8");
3124
3212
  spec = JSON.parse(specContent);
3125
3213
  } catch (error) {
3126
- logger10.error(
3214
+ logger11.error(
3127
3215
  `Failed to read or parse spec file: ${error instanceof Error ? error.message : String(error)}`
3128
3216
  );
3129
3217
  process.exit(1);
3130
3218
  }
3131
3219
  } else if (opts.skipPrompts) {
3132
- logger10.error("--skip-prompts requires --spec-file to be provided");
3220
+ logger11.error("--skip-prompts requires --spec-file to be provided");
3133
3221
  process.exit(1);
3134
3222
  }
3135
3223
  const creator = new PluginCreator({
@@ -3151,12 +3239,12 @@ ${emoji.success("Plugin successfully generated!")}`);
3151
3239
  The plugin has been created in your current directory.`);
3152
3240
  console.log(`
3153
3241
  Next steps:`);
3154
- console.log(`1. cd ${path13.basename(result.pluginPath ?? "")}`);
3242
+ console.log(`1. cd ${path14.basename(result.pluginPath ?? "")}`);
3155
3243
  console.log(`2. Review the generated code`);
3156
3244
  console.log(`3. Test the plugin: bun test`);
3157
3245
  console.log(`4. Add to your ElizaOS project`);
3158
3246
  } else {
3159
- logger10.error(`Plugin generation failed: ${result.error?.message}`);
3247
+ logger11.error(`Plugin generation failed: ${result.error?.message}`);
3160
3248
  process.exit(1);
3161
3249
  }
3162
3250
  } catch (error) {
@@ -3214,20 +3302,20 @@ plugins.command("generate").description("Generate a new plugin using AI-powered
3214
3302
 
3215
3303
  // src/commands/publish/index.ts
3216
3304
  import { Command as Command5 } from "commander";
3217
- import { promises as fs8 } from "fs";
3218
- import path19 from "path";
3305
+ import { promises as fs9 } from "fs";
3306
+ import path20 from "path";
3219
3307
  import * as clack10 from "@clack/prompts";
3220
3308
 
3221
3309
  // src/commands/publish/actions/npm-publish.ts
3222
- import { promises as fs2 } from "fs";
3223
- import path14 from "path";
3310
+ import { promises as fs3 } from "fs";
3311
+ import path15 from "path";
3224
3312
  async function publishToNpm(cwd, packageJson, npmUsername) {
3225
3313
  console.info(`Publishing as npm user: ${npmUsername}`);
3226
3314
  if (!packageJson.npmPackage || packageJson.npmPackage === "${NPM_PACKAGE}") {
3227
3315
  packageJson.npmPackage = packageJson.name;
3228
3316
  console.info(`Set npmPackage to: ${packageJson.npmPackage}`);
3229
- const packageJsonPath = path14.join(cwd, "package.json");
3230
- await fs2.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
3317
+ const packageJsonPath = path15.join(cwd, "package.json");
3318
+ await fs3.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
3231
3319
  }
3232
3320
  console.info("Building package...");
3233
3321
  await bunExecInherit("npm", ["run", "build"], { cwd });
@@ -3256,21 +3344,21 @@ async function publishToGitHubAction(cwd, packageJson, credentials, skipRegistry
3256
3344
  }
3257
3345
 
3258
3346
  // src/commands/publish/actions/registry-publish.ts
3259
- import { promises as fs3 } from "fs";
3260
- import path15 from "path";
3347
+ import { promises as fs4 } from "fs";
3348
+ import path16 from "path";
3261
3349
  var REGISTRY_PACKAGES_PATH = "packages";
3262
3350
  var LOCAL_REGISTRY_PATH = "packages/registry";
3263
3351
  async function updateRegistryIndex(packageMetadata, dryRun = false) {
3264
3352
  try {
3265
- const indexPath = dryRun ? path15.join(process.cwd(), LOCAL_REGISTRY_PATH, "index.json") : path15.join(process.cwd(), "temp-registry", "index.json");
3353
+ const indexPath = dryRun ? path16.join(process.cwd(), LOCAL_REGISTRY_PATH, "index.json") : path16.join(process.cwd(), "temp-registry", "index.json");
3266
3354
  try {
3267
- await fs3.access(path15.dirname(indexPath));
3355
+ await fs4.access(path16.dirname(indexPath));
3268
3356
  } catch {
3269
- await fs3.mkdir(path15.dirname(indexPath), { recursive: true });
3357
+ await fs4.mkdir(path16.dirname(indexPath), { recursive: true });
3270
3358
  try {
3271
- await fs3.access(indexPath);
3359
+ await fs4.access(indexPath);
3272
3360
  } catch {
3273
- await fs3.writeFile(
3361
+ await fs4.writeFile(
3274
3362
  indexPath,
3275
3363
  JSON.stringify(
3276
3364
  {
@@ -3285,7 +3373,7 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3285
3373
  }
3286
3374
  let indexContent;
3287
3375
  try {
3288
- indexContent = await fs3.readFile(indexPath, "utf-8");
3376
+ indexContent = await fs4.readFile(indexPath, "utf-8");
3289
3377
  } catch (error) {
3290
3378
  indexContent = JSON.stringify({
3291
3379
  v1: { packages: {} },
@@ -3317,7 +3405,7 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3317
3405
  publishedAt: packageMetadata.publishedAt,
3318
3406
  published: !dryRun
3319
3407
  };
3320
- await fs3.writeFile(indexPath, JSON.stringify(index, null, 2));
3408
+ await fs4.writeFile(indexPath, JSON.stringify(index, null, 2));
3321
3409
  console.info(
3322
3410
  `Registry index ${dryRun ? "(dry run) " : ""}updated with ${packageMetadata.name}@${packageMetadata.version}`
3323
3411
  );
@@ -3331,10 +3419,10 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3331
3419
  }
3332
3420
  async function savePackageToRegistry(packageMetadata, dryRun = false) {
3333
3421
  try {
3334
- const packageDir = dryRun ? path15.join(process.cwd(), LOCAL_REGISTRY_PATH, REGISTRY_PACKAGES_PATH, packageMetadata.name) : path15.join(process.cwd(), "temp-registry", REGISTRY_PACKAGES_PATH, packageMetadata.name);
3335
- const metadataPath = path15.join(packageDir, `${packageMetadata.version}.json`);
3336
- await fs3.mkdir(packageDir, { recursive: true });
3337
- await fs3.writeFile(metadataPath, JSON.stringify(packageMetadata, null, 2));
3422
+ const packageDir = dryRun ? path16.join(process.cwd(), LOCAL_REGISTRY_PATH, REGISTRY_PACKAGES_PATH, packageMetadata.name) : path16.join(process.cwd(), "temp-registry", REGISTRY_PACKAGES_PATH, packageMetadata.name);
3423
+ const metadataPath = path16.join(packageDir, `${packageMetadata.version}.json`);
3424
+ await fs4.mkdir(packageDir, { recursive: true });
3425
+ await fs4.writeFile(metadataPath, JSON.stringify(packageMetadata, null, 2));
3338
3426
  console.info(`Package metadata ${dryRun ? "(dry run) " : ""}saved to ${metadataPath}`);
3339
3427
  await updateRegistryIndex(packageMetadata, dryRun);
3340
3428
  return true;
@@ -3347,8 +3435,8 @@ async function savePackageToRegistry(packageMetadata, dryRun = false) {
3347
3435
  }
3348
3436
 
3349
3437
  // src/commands/publish/utils/validation.ts
3350
- import { promises as fs4 } from "fs";
3351
- import path16 from "path";
3438
+ import { promises as fs5 } from "fs";
3439
+ import path17 from "path";
3352
3440
  import * as clack6 from "@clack/prompts";
3353
3441
  async function validatePluginRequirements(cwd, packageJson) {
3354
3442
  const errors = [];
@@ -3359,23 +3447,23 @@ async function validatePluginRequirements(cwd, packageJson) {
3359
3447
  'Plugin name must start with "plugin-". Please update your package name and try again.'
3360
3448
  );
3361
3449
  }
3362
- const pluginDirName = path16.basename(cwd);
3450
+ const pluginDirName = path17.basename(cwd);
3363
3451
  const expectedDefaultDesc = `ElizaOS plugin for ${pluginDirName.replace("plugin-", "")}`;
3364
3452
  if (packageJson.description === expectedDefaultDesc || packageJson.description === "${PLUGINDESCRIPTION}") {
3365
3453
  warnings.push(
3366
3454
  "Description appears to be the default generated description. Consider writing a custom description."
3367
3455
  );
3368
3456
  }
3369
- const imagesDir = path16.join(cwd, "images");
3370
- const logoPath = path16.join(imagesDir, "logo.jpg");
3371
- const bannerPath = path16.join(imagesDir, "banner.jpg");
3457
+ const imagesDir = path17.join(cwd, "images");
3458
+ const logoPath = path17.join(imagesDir, "logo.jpg");
3459
+ const bannerPath = path17.join(imagesDir, "banner.jpg");
3372
3460
  try {
3373
- await fs4.access(logoPath);
3461
+ await fs5.access(logoPath);
3374
3462
  } catch {
3375
3463
  warnings.push("Missing required logo.jpg in images/ directory (400x400px, max 500KB).");
3376
3464
  }
3377
3465
  try {
3378
- await fs4.access(bannerPath);
3466
+ await fs5.access(bannerPath);
3379
3467
  } catch {
3380
3468
  warnings.push("Missing required banner.jpg in images/ directory (1280x640px, max 1MB).");
3381
3469
  }
@@ -3513,30 +3601,39 @@ async function getNpmUsername() {
3513
3601
  }
3514
3602
 
3515
3603
  // src/commands/publish/utils/version-check.ts
3516
- import { promises as fs7 } from "fs";
3517
- import path18 from "path";
3604
+ import { promises as fs8 } from "fs";
3605
+ import path19 from "path";
3518
3606
  import { fileURLToPath as fileURLToPath3 } from "url";
3519
3607
  import * as clack9 from "@clack/prompts";
3520
3608
 
3521
3609
  // src/commands/update/index.ts
3522
- import { logger as logger14 } from "@elizaos/core";
3610
+ import { logger as logger15 } from "@elizaos/core";
3523
3611
  import { Command as Command4 } from "commander";
3524
3612
 
3525
3613
  // src/commands/update/actions/cli-update.ts
3526
- import { logger as logger12 } from "@elizaos/core";
3614
+ import { logger as logger13 } from "@elizaos/core";
3527
3615
 
3528
3616
  // src/commands/update/utils/version-utils.ts
3529
- import { logger as logger11 } from "@elizaos/core";
3617
+ import { logger as logger12 } from "@elizaos/core";
3530
3618
  import * as semver from "semver";
3531
3619
  var SPECIAL_VERSION_TAGS = ["latest", "next", "canary", "rc", "dev", "nightly", "alpha"];
3532
3620
  var ELIZAOS_ORG = "@elizaos";
3533
3621
  var FALLBACK_VERSION = "0.0.0";
3534
3622
  async function getVersion2() {
3535
3623
  try {
3624
+ const directoryInfo = detectDirectoryType(process.cwd());
3625
+ const isMonorepo = directoryInfo.type === "elizaos-monorepo";
3626
+ if (isMonorepo) {
3627
+ return "monorepo";
3628
+ }
3536
3629
  const envInfo = await UserEnvironment.getInstance().getInfo();
3537
- return envInfo.cli.version;
3630
+ const version = envInfo.cli.version;
3631
+ if (isWorkspaceVersion(version)) {
3632
+ return "monorepo";
3633
+ }
3634
+ return version;
3538
3635
  } catch (error) {
3539
- logger11.error("Error getting CLI version:", error);
3636
+ logger12.error({ error }, "Error getting CLI version:");
3540
3637
  return FALLBACK_VERSION;
3541
3638
  }
3542
3639
  }
@@ -3576,10 +3673,10 @@ async function fetchLatestVersion(packageName) {
3576
3673
  env: { NODE_ENV: "production" }
3577
3674
  });
3578
3675
  const version = stdout.trim();
3579
- logger11.debug(`Latest version of ${packageName} from npm: ${version}`);
3676
+ logger12.debug(`Latest version of ${packageName} from npm: ${version}`);
3580
3677
  return version;
3581
3678
  } catch (error) {
3582
- logger11.error(
3679
+ logger12.error(
3583
3680
  `Failed to fetch version for ${packageName}: ${error instanceof Error ? error.message : String(error)}`
3584
3681
  );
3585
3682
  return null;
@@ -3610,14 +3707,14 @@ async function performCliUpdate(options = {}) {
3610
3707
  if (!options.skipBunMigration) {
3611
3708
  const npmInstallation = await isCliInstalledViaNpm();
3612
3709
  if (npmInstallation) {
3613
- logger12.info("Detected npm installation, migrating to bun...");
3710
+ logger13.info("Detected npm installation, migrating to bun...");
3614
3711
  try {
3615
3712
  await migrateCliToBun(latestVersion);
3616
3713
  console.log(`CLI updated successfully to version ${latestVersion} [\u2713]`);
3617
3714
  return true;
3618
3715
  } catch (migrationError) {
3619
- logger12.warn("Migration to bun failed, falling back to npm update...");
3620
- logger12.debug(
3716
+ logger13.warn("Migration to bun failed, falling back to npm update...");
3717
+ logger13.debug(
3621
3718
  "Migration error:",
3622
3719
  migrationError instanceof Error ? migrationError.message : String(migrationError)
3623
3720
  );
@@ -3642,7 +3739,10 @@ async function performCliUpdate(options = {}) {
3642
3739
  console.error(" curl -fsSL https://bun.sh/install | bash");
3643
3740
  console.error(" # or");
3644
3741
  console.error(" npm install -g bun");
3645
- logger12.debug("Bun error:", bunError instanceof Error ? bunError.message : String(bunError));
3742
+ logger13.debug(
3743
+ { error: bunError instanceof Error ? bunError.message : String(bunError) },
3744
+ "Bun error:"
3745
+ );
3646
3746
  return false;
3647
3747
  }
3648
3748
  } catch (error) {
@@ -3653,12 +3753,12 @@ async function performCliUpdate(options = {}) {
3653
3753
 
3654
3754
  // src/commands/update/actions/dependency-update.ts
3655
3755
  import * as clack8 from "@clack/prompts";
3656
- import { promises as fs6 } from "fs";
3657
- import * as path17 from "path";
3756
+ import { promises as fs7 } from "fs";
3757
+ import * as path18 from "path";
3658
3758
 
3659
3759
  // src/commands/update/utils/package-utils.ts
3660
- import fs5 from "fs/promises";
3661
- import { logger as logger13 } from "@elizaos/core";
3760
+ import fs6 from "fs/promises";
3761
+ import { logger as logger14 } from "@elizaos/core";
3662
3762
  async function checkForUpdates(dependencies) {
3663
3763
  const updates = {};
3664
3764
  const elizaPackages = Object.entries(dependencies).filter(([pkg]) => pkg.startsWith(ELIZAOS_ORG)).filter(([, version]) => !isWorkspaceVersion(version));
@@ -3669,7 +3769,7 @@ async function checkForUpdates(dependencies) {
3669
3769
  if (needsUpdate) {
3670
3770
  updates[pkg] = { current: currentVersion, latest: latestVersion };
3671
3771
  } else if (error) {
3672
- logger13.debug(`${pkg}: ${error}`);
3772
+ logger14.debug(`${pkg}: ${error}`);
3673
3773
  }
3674
3774
  }
3675
3775
  return { hasUpdates: Object.keys(updates).length > 0, updates };
@@ -3683,7 +3783,7 @@ function displayUpdateSummary(updates) {
3683
3783
  });
3684
3784
  }
3685
3785
  async function updatePackageJson(packageJsonPath, updates) {
3686
- const content = await fs5.readFile(packageJsonPath, "utf8");
3786
+ const content = await fs6.readFile(packageJsonPath, "utf8");
3687
3787
  const packageJson = JSON.parse(content);
3688
3788
  let modified = false;
3689
3789
  for (const [pkg, { latest }] of Object.entries(updates)) {
@@ -3697,7 +3797,7 @@ async function updatePackageJson(packageJsonPath, updates) {
3697
3797
  }
3698
3798
  }
3699
3799
  if (modified) {
3700
- await fs5.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
3800
+ await fs6.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
3701
3801
  console.log("Updated package.json with new versions");
3702
3802
  }
3703
3803
  }
@@ -3717,8 +3817,8 @@ async function installDependencies(cwd) {
3717
3817
  // src/commands/update/actions/dependency-update.ts
3718
3818
  async function updateDependencies(cwd, isPlugin2, options = {}) {
3719
3819
  const { dryRun = false, skipBuild = false } = options;
3720
- const packageJsonPath = path17.join(cwd, "package.json");
3721
- const content = await fs6.readFile(packageJsonPath, "utf8");
3820
+ const packageJsonPath = path18.join(cwd, "package.json");
3821
+ const content = await fs7.readFile(packageJsonPath, "utf8");
3722
3822
  const packageJson = JSON.parse(content);
3723
3823
  const allDependencies = {
3724
3824
  ...packageJson.dependencies,
@@ -3788,7 +3888,7 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3788
3888
  try {
3789
3889
  await displayBanner(true);
3790
3890
  } catch {
3791
- logger14.debug("Banner display failed, continuing with update");
3891
+ logger15.debug("Banner display failed, continuing with update");
3792
3892
  }
3793
3893
  }).action(async (options) => {
3794
3894
  try {
@@ -3820,7 +3920,7 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3820
3920
  console.info("To create a new ElizaOS project, use: elizaos create <project-name>");
3821
3921
  return;
3822
3922
  }
3823
- logger14.debug(`Detected ${directoryInfo.type}`);
3923
+ logger15.debug(`Detected ${directoryInfo.type}`);
3824
3924
  if (!isInProject) {
3825
3925
  handleInvalidDirectory(directoryInfo);
3826
3926
  return;
@@ -3857,11 +3957,11 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3857
3957
  // src/commands/publish/utils/version-check.ts
3858
3958
  async function checkCliVersion() {
3859
3959
  try {
3860
- const cliPackageJsonPath = path18.resolve(
3861
- path18.dirname(fileURLToPath3(import.meta.url)),
3960
+ const cliPackageJsonPath = path19.resolve(
3961
+ path19.dirname(fileURLToPath3(import.meta.url)),
3862
3962
  "../package.json"
3863
3963
  );
3864
- const cliPackageJsonContent = await fs7.readFile(cliPackageJsonPath, "utf-8");
3964
+ const cliPackageJsonContent = await fs8.readFile(cliPackageJsonPath, "utf-8");
3865
3965
  const cliPackageJson = JSON.parse(cliPackageJsonContent);
3866
3966
  const currentVersion = cliPackageJson.version || "0.0.0";
3867
3967
  const { stdout } = await bunExecSimple("npm", ["view", "@elizaos/cli", "time", "--json"]);
@@ -3919,7 +4019,7 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
3919
4019
  process.exit(1);
3920
4020
  }
3921
4021
  const cliVersion = await checkCliVersion();
3922
- const pluginDirName = path19.basename(process.cwd());
4022
+ const pluginDirName = path20.basename(process.cwd());
3923
4023
  if (!pluginDirName.startsWith("plugin-")) {
3924
4024
  console.error("This command must be run from a plugin directory (plugin-*)");
3925
4025
  process.exit(1);
@@ -3945,8 +4045,8 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
3945
4045
  }
3946
4046
  }
3947
4047
  }
3948
- const packageJsonPath = path19.join(cwd, "package.json");
3949
- const packageJsonContent = await fs8.readFile(packageJsonPath, "utf-8");
4048
+ const packageJsonPath = path20.join(cwd, "package.json");
4049
+ const packageJsonContent = await fs9.readFile(packageJsonPath, "utf-8");
3950
4050
  const packageJson = JSON.parse(packageJsonContent);
3951
4051
  if (!packageJson.name || !packageJson.version) {
3952
4052
  console.error("Invalid package.json: missing name or version.");
@@ -4087,7 +4187,7 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
4087
4187
  }
4088
4188
  });
4089
4189
  const finalPluginName = packageJson.name.startsWith("@") ? packageJson.name.split("/")[1] : packageJson.name;
4090
- await fs8.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
4190
+ await fs9.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
4091
4191
  await validatePluginRequirements(cwd, packageJson);
4092
4192
  const settings = await getRegistrySettings();
4093
4193
  const publishUsername = credentials ? credentials.username : npmUsername;
@@ -4211,8 +4311,8 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
4211
4311
  import { Command as Command6 } from "commander";
4212
4312
 
4213
4313
  // src/commands/monorepo/actions/clone.ts
4214
- import { existsSync as existsSync12, readdirSync as readdirSync3, mkdirSync } from "fs";
4215
- import path20 from "path";
4314
+ import { existsSync as existsSync13, readdirSync as readdirSync3, mkdirSync } from "fs";
4315
+ import path21 from "path";
4216
4316
  async function cloneRepository(repo, branch, destination) {
4217
4317
  try {
4218
4318
  const repoUrl = `https://github.com/${repo}`;
@@ -4236,8 +4336,8 @@ For a complete list of branches, visit: https://github.com/elizaOS/eliza/branche
4236
4336
  }
4237
4337
  }
4238
4338
  function prepareDestination(dir) {
4239
- const destinationDir = path20.resolve(process.cwd(), dir);
4240
- if (existsSync12(destinationDir)) {
4339
+ const destinationDir = path21.resolve(process.cwd(), dir);
4340
+ if (existsSync13(destinationDir)) {
4241
4341
  const files = readdirSync3(destinationDir);
4242
4342
  if (files.length > 0) {
4243
4343
  throw new Error(`Destination directory ${destinationDir} already exists and is not empty`);
@@ -4255,7 +4355,7 @@ async function cloneMonorepo(cloneInfo) {
4255
4355
  }
4256
4356
 
4257
4357
  // src/commands/monorepo/utils/setup-instructions.ts
4258
- import path21 from "path";
4358
+ import path22 from "path";
4259
4359
  function getBunInstallInstructions() {
4260
4360
  const platform = process.platform;
4261
4361
  if (platform === "win32") {
@@ -4310,7 +4410,7 @@ ${emoji.rocket("If you don't have Bun installed:")}`);
4310
4410
  console.log(" After installation, restart your terminal");
4311
4411
  }
4312
4412
  function displayNextSteps(targetDir) {
4313
- const cdPath = path21.relative(process.cwd(), targetDir);
4413
+ const cdPath = path22.relative(process.cwd(), targetDir);
4314
4414
  displayBasicSteps(cdPath);
4315
4415
  displayPrerequisites();
4316
4416
  displayBunInstructions();
@@ -4337,11 +4437,11 @@ var monorepo = new Command6().name("monorepo").description("Clone ElizaOS monore
4337
4437
 
4338
4438
  // src/project.ts
4339
4439
  import {
4340
- logger as logger15
4440
+ logger as logger16
4341
4441
  } from "@elizaos/core";
4342
4442
  import { stringToUuid } from "@elizaos/core";
4343
- import * as fs9 from "fs";
4344
- import path22 from "path";
4443
+ import * as fs10 from "fs";
4444
+ import path23 from "path";
4345
4445
  function isPlugin(module) {
4346
4446
  if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
4347
4447
  return true;
@@ -4376,10 +4476,10 @@ async function loadProject(dir) {
4376
4476
  if (!dirInfo.hasPackageJson) {
4377
4477
  throw new Error(`No package.json found in ${dir}`);
4378
4478
  }
4379
- const packageJson = JSON.parse(fs9.readFileSync(path22.join(dir, "package.json"), "utf8"));
4479
+ const packageJson = JSON.parse(fs10.readFileSync(path23.join(dir, "package.json"), "utf8"));
4380
4480
  const main2 = packageJson.main;
4381
4481
  if (!main2) {
4382
- logger15.warn("No main field found in package.json, using default character");
4482
+ logger16.warn("No main field found in package.json, using default character");
4383
4483
  const defaultCharacterName = "Eliza (Default)";
4384
4484
  const elizaCharacter = getElizaCharacter();
4385
4485
  const defaultAgent = {
@@ -4389,7 +4489,7 @@ async function loadProject(dir) {
4389
4489
  name: defaultCharacterName
4390
4490
  },
4391
4491
  init: async () => {
4392
- logger15.info("Initializing default Eliza character");
4492
+ logger16.info("Initializing default Eliza character");
4393
4493
  }
4394
4494
  };
4395
4495
  return {
@@ -4398,32 +4498,32 @@ async function loadProject(dir) {
4398
4498
  };
4399
4499
  }
4400
4500
  const entryPoints = [
4401
- path22.join(dir, main2),
4402
- path22.join(dir, "dist/index.js"),
4403
- path22.join(dir, "src/index.ts"),
4404
- path22.join(dir, "src/index.js"),
4405
- path22.join(dir, "index.ts"),
4406
- path22.join(dir, "index.js")
4501
+ path23.join(dir, main2),
4502
+ path23.join(dir, "dist/index.js"),
4503
+ path23.join(dir, "src/index.ts"),
4504
+ path23.join(dir, "src/index.js"),
4505
+ path23.join(dir, "index.ts"),
4506
+ path23.join(dir, "index.js")
4407
4507
  ];
4408
4508
  let projectModule = null;
4409
4509
  for (const entryPoint of entryPoints) {
4410
- if (fs9.existsSync(entryPoint)) {
4510
+ if (fs10.existsSync(entryPoint)) {
4411
4511
  try {
4412
- const importPath = path22.resolve(entryPoint);
4512
+ const importPath = path23.resolve(entryPoint);
4413
4513
  const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
4414
4514
  projectModule = await import(importUrl);
4415
- logger15.info(`Loaded project from ${entryPoint}`);
4515
+ logger16.info(`Loaded project from ${entryPoint}`);
4416
4516
  const exportKeys = Object.keys(projectModule);
4417
- logger15.debug(`Module exports: ${exportKeys.join(", ")}`);
4517
+ logger16.debug({ exportKeys }, `Module exports:`);
4418
4518
  if (exportKeys.includes("default")) {
4419
- logger15.debug(`Default export type: ${typeof projectModule.default}`);
4519
+ logger16.debug({ type: typeof projectModule.default }, `Default export type:`);
4420
4520
  if (typeof projectModule.default === "object" && projectModule.default !== null) {
4421
- logger15.debug(`Default export keys: ${Object.keys(projectModule.default).join(", ")}`);
4521
+ logger16.debug({ keys: Object.keys(projectModule.default) }, `Default export keys:`);
4422
4522
  }
4423
4523
  }
4424
4524
  break;
4425
4525
  } catch (error) {
4426
- logger15.warn(`Failed to import project from ${entryPoint}:`, error);
4526
+ logger16.warn({ error, entryPoint }, `Failed to import project`);
4427
4527
  }
4428
4528
  }
4429
4529
  }
@@ -4431,13 +4531,13 @@ async function loadProject(dir) {
4431
4531
  throw new Error("Could not find project entry point");
4432
4532
  }
4433
4533
  const moduleIsPlugin = isPlugin(projectModule);
4434
- logger15.debug(`Is this a plugin? ${moduleIsPlugin}`);
4534
+ logger16.debug({ moduleIsPlugin }, `Is this a plugin?`);
4435
4535
  if (moduleIsPlugin) {
4436
- logger15.info("Detected plugin module instead of project");
4536
+ logger16.info("Detected plugin module instead of project");
4437
4537
  try {
4438
4538
  const plugin = extractPlugin(projectModule);
4439
- logger15.debug(`Found plugin: ${plugin.name} - ${plugin.description}`);
4440
- logger15.debug(`Plugin has the following properties: ${Object.keys(plugin).join(", ")}`);
4539
+ logger16.debug({ name: plugin.name, description: plugin.description }, `Found plugin:`);
4540
+ logger16.debug({ keys: Object.keys(plugin) }, `Plugin has the following properties:`);
4441
4541
  const completePlugin = {
4442
4542
  // Copy all other properties from the original plugin first
4443
4543
  ...plugin,
@@ -4445,7 +4545,7 @@ async function loadProject(dir) {
4445
4545
  name: plugin.name || "unknown-plugin",
4446
4546
  description: plugin.description || "No description",
4447
4547
  init: plugin.init || (async () => {
4448
- logger15.info(`Dummy init for plugin: ${plugin.name}`);
4548
+ logger16.info(`Dummy init for plugin: ${plugin.name}`);
4449
4549
  })
4450
4550
  };
4451
4551
  const characterName = "Eliza (Test Mode)";
@@ -4456,13 +4556,13 @@ async function loadProject(dir) {
4456
4556
  name: characterName,
4457
4557
  system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
4458
4558
  };
4459
- logger15.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
4559
+ logger16.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
4460
4560
  const testAgent = {
4461
4561
  character: testCharacter,
4462
4562
  plugins: [completePlugin],
4463
4563
  // Only include the plugin being tested
4464
4564
  init: async () => {
4465
- logger15.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
4565
+ logger16.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
4466
4566
  }
4467
4567
  };
4468
4568
  return {
@@ -4472,24 +4572,24 @@ async function loadProject(dir) {
4472
4572
  pluginModule: completePlugin
4473
4573
  };
4474
4574
  } catch (error) {
4475
- logger15.error("Error extracting plugin from module:", error);
4575
+ logger16.error("Error extracting plugin from module:", error);
4476
4576
  throw error;
4477
4577
  }
4478
4578
  }
4479
4579
  const agents = [];
4480
4580
  if (projectModule.default && typeof projectModule.default === "object" && Array.isArray(projectModule.default.agents)) {
4481
4581
  agents.push(...projectModule.default.agents);
4482
- logger15.debug(`Found ${agents.length} agents in default export's agents array`);
4582
+ logger16.debug({ count: agents.length }, `Found agents in default export's agents array`);
4483
4583
  } else {
4484
4584
  for (const [key, value] of Object.entries(projectModule)) {
4485
4585
  if (key === "default" && value && typeof value === "object") {
4486
4586
  if (value.character && value.init) {
4487
4587
  agents.push(value);
4488
- logger15.debug(`Found agent in default export (single agent)`);
4588
+ logger16.debug(`Found agent in default export (single agent)`);
4489
4589
  }
4490
4590
  } else if (value && typeof value === "object" && value.character && value.init) {
4491
4591
  agents.push(value);
4492
- logger15.debug(`Found agent in named export: ${key}`);
4592
+ logger16.debug({ key }, `Found agent in named export`);
4493
4593
  }
4494
4594
  }
4495
4595
  }
@@ -4502,7 +4602,7 @@ async function loadProject(dir) {
4502
4602
  };
4503
4603
  return project;
4504
4604
  } catch (error) {
4505
- logger15.error("Error loading project:", error);
4605
+ logger16.error({ error }, "Error loading project:");
4506
4606
  throw error;
4507
4607
  }
4508
4608
  }
@@ -4517,19 +4617,19 @@ function validatePort(value) {
4517
4617
  }
4518
4618
 
4519
4619
  // src/commands/start/index.ts
4520
- import { logger as logger20 } from "@elizaos/core";
4620
+ import { logger as logger21 } from "@elizaos/core";
4521
4621
  import { Command as Command7 } from "commander";
4522
- import * as fs10 from "fs";
4523
- import * as path24 from "path";
4622
+ import * as fs11 from "fs";
4623
+ import * as path25 from "path";
4524
4624
 
4525
4625
  // src/commands/start/actions/server-start.ts
4526
- import { logger as logger19 } from "@elizaos/core";
4626
+ import { logger as logger20 } from "@elizaos/core";
4527
4627
 
4528
4628
  // src/commands/start/actions/agent-start.ts
4529
4629
  import {
4530
4630
  AgentRuntime as AgentRuntime2,
4531
4631
  encryptedCharacter,
4532
- logger as logger18,
4632
+ logger as logger19,
4533
4633
  stringToUuid as stringToUuid2
4534
4634
  } from "@elizaos/core";
4535
4635
  import { plugin as sqlPlugin } from "@elizaos/plugin-sql";
@@ -4572,19 +4672,19 @@ async function setDefaultSecretsFromEnv(character) {
4572
4672
  }
4573
4673
 
4574
4674
  // src/commands/start/utils/dependency-resolver.ts
4575
- import { logger as logger16 } from "@elizaos/core";
4675
+ import { logger as logger17 } from "@elizaos/core";
4576
4676
  function resolvePluginDependencies(availablePlugins, isTestMode = false) {
4577
4677
  const resolutionOrder = [];
4578
4678
  const visited = /* @__PURE__ */ new Set();
4579
4679
  const visiting = /* @__PURE__ */ new Set();
4580
4680
  function visit(pluginName) {
4581
4681
  if (!availablePlugins.has(pluginName)) {
4582
- logger16.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
4682
+ logger17.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
4583
4683
  return;
4584
4684
  }
4585
4685
  if (visited.has(pluginName)) return;
4586
4686
  if (visiting.has(pluginName)) {
4587
- logger16.error(`Circular dependency detected involving plugin: ${pluginName}`);
4687
+ logger17.error(`Circular dependency detected involving plugin: ${pluginName}`);
4588
4688
  return;
4589
4689
  }
4590
4690
  visiting.add(pluginName);
@@ -4608,12 +4708,12 @@ function resolvePluginDependencies(availablePlugins, isTestMode = false) {
4608
4708
  }
4609
4709
  }
4610
4710
  const finalPlugins = resolutionOrder.map((name) => availablePlugins.get(name)).filter((p) => p);
4611
- logger16.info(`Final plugins being loaded: ${finalPlugins.map((p) => p.name).join(", ")}`);
4711
+ logger17.info({ plugins: finalPlugins.map((p) => p.name) }, `Final plugins being loaded:`);
4612
4712
  return finalPlugins;
4613
4713
  }
4614
4714
 
4615
4715
  // src/commands/start/utils/plugin-utils.ts
4616
- import { logger as logger17 } from "@elizaos/core";
4716
+ import { logger as logger18 } from "@elizaos/core";
4617
4717
  function isValidPluginShape(obj) {
4618
4718
  if (!obj || typeof obj !== "object" || !obj.name) {
4619
4719
  return false;
@@ -4628,12 +4728,12 @@ async function loadAndPreparePlugin(pluginName) {
4628
4728
  try {
4629
4729
  pluginModule = await loadPluginModule(pluginName);
4630
4730
  if (!pluginModule) {
4631
- logger17.error(`Failed to load local plugin ${pluginName}.`);
4731
+ logger18.error(`Failed to load local plugin ${pluginName}.`);
4632
4732
  provideLocalPluginGuidance(pluginName, context);
4633
4733
  return null;
4634
4734
  }
4635
4735
  } catch (error) {
4636
- logger17.error(`Error loading local plugin ${pluginName}: ${error}`);
4736
+ logger18.error(`Error loading local plugin ${pluginName}: ${error}`);
4637
4737
  provideLocalPluginGuidance(pluginName, context);
4638
4738
  return null;
4639
4739
  }
@@ -4641,17 +4741,17 @@ async function loadAndPreparePlugin(pluginName) {
4641
4741
  try {
4642
4742
  pluginModule = await loadPluginModule(pluginName);
4643
4743
  if (!pluginModule) {
4644
- logger17.info(`Plugin ${pluginName} not available, installing...`);
4744
+ logger18.info(`Plugin ${pluginName} not available, installing...`);
4645
4745
  await installPlugin(pluginName, process.cwd(), version);
4646
4746
  pluginModule = await loadPluginModule(pluginName);
4647
4747
  }
4648
4748
  } catch (error) {
4649
- logger17.error(`Failed to process plugin ${pluginName}: ${error}`);
4749
+ logger18.error(`Failed to process plugin ${pluginName}: ${error}`);
4650
4750
  return null;
4651
4751
  }
4652
4752
  }
4653
4753
  if (!pluginModule) {
4654
- logger17.error(`Failed to load module for plugin ${pluginName}.`);
4754
+ logger18.error(`Failed to load module for plugin ${pluginName}.`);
4655
4755
  return null;
4656
4756
  }
4657
4757
  const expectedFunctionName = `${pluginName.replace(/^@elizaos\/plugin-/, "").replace(/^@elizaos\//, "").replace(/-./g, (match) => match[1].toUpperCase())}Plugin`;
@@ -4665,7 +4765,7 @@ async function loadAndPreparePlugin(pluginName) {
4665
4765
  return potentialPlugin;
4666
4766
  }
4667
4767
  }
4668
- logger17.warn(`Could not find a valid plugin export in ${pluginName}.`);
4768
+ logger18.warn(`Could not find a valid plugin export in ${pluginName}.`);
4669
4769
  return null;
4670
4770
  }
4671
4771
 
@@ -4676,7 +4776,6 @@ async function startAgent(character, server, init, plugins2 = [], options = {})
4676
4776
  await setDefaultSecretsFromEnv(character);
4677
4777
  }
4678
4778
  const loadedPlugins = /* @__PURE__ */ new Map();
4679
- loadedPlugins.set(sqlPlugin.name, sqlPlugin);
4680
4779
  const pluginsToLoad = new Set(character.plugins || []);
4681
4780
  for (const p of plugins2) {
4682
4781
  if (typeof p === "string") {
@@ -4701,6 +4800,16 @@ async function startAgent(character, server, init, plugins2 = [], options = {})
4701
4800
  }
4702
4801
  }
4703
4802
  }
4803
+ let haveSql = false;
4804
+ for (const n of allAvailablePlugins.keys()) {
4805
+ if (n === sqlPlugin.name || n === "mysql") {
4806
+ haveSql = true;
4807
+ break;
4808
+ }
4809
+ }
4810
+ if (!haveSql) {
4811
+ allAvailablePlugins.set(sqlPlugin.name, sqlPlugin);
4812
+ }
4704
4813
  const finalPlugins = resolvePluginDependencies(allAvailablePlugins, options.isTestMode);
4705
4814
  const runtime = new AgentRuntime2({
4706
4815
  character: encryptedCharacter(character),
@@ -4717,32 +4826,32 @@ async function startAgent(character, server, init, plugins2 = [], options = {})
4717
4826
  try {
4718
4827
  const migrationService = runtime.getService("database_migration");
4719
4828
  if (migrationService) {
4720
- logger18.info("Discovering plugin schemas for dynamic migration...");
4829
+ logger19.info("Discovering plugin schemas for dynamic migration...");
4721
4830
  migrationService.discoverAndRegisterPluginSchemas(finalPlugins);
4722
- logger18.info("Running all plugin migrations...");
4831
+ logger19.info("Running all plugin migrations...");
4723
4832
  await migrationService.runAllPluginMigrations();
4724
- logger18.info("All plugin migrations completed successfully");
4833
+ logger19.info("All plugin migrations completed successfully");
4725
4834
  } else {
4726
- logger18.warn("DatabaseMigrationService not found - plugin schema migrations skipped");
4835
+ logger19.warn("DatabaseMigrationService not found - plugin schema migrations skipped");
4727
4836
  }
4728
4837
  } catch (error) {
4729
- logger18.error("Failed to run plugin migrations:", error);
4838
+ logger19.error({ error }, "Failed to run plugin migrations:");
4730
4839
  throw error;
4731
4840
  }
4732
4841
  server.registerAgent(runtime);
4733
- logger18.log(`Started ${runtime.character.name} as ${runtime.agentId}`);
4842
+ logger19.log(`Started ${runtime.character.name} as ${runtime.agentId}`);
4734
4843
  return runtime;
4735
4844
  }
4736
4845
  async function stopAgent(runtime, server) {
4737
4846
  await runtime.close();
4738
4847
  server.unregisterAgent(runtime.agentId);
4739
- logger18.success(`Agent ${runtime.character.name} stopped successfully!`);
4848
+ logger19.success(`Agent ${runtime.character.name} stopped successfully!`);
4740
4849
  }
4741
4850
 
4742
4851
  // src/commands/start/actions/server-start.ts
4743
- import path23 from "path";
4852
+ import path24 from "path";
4744
4853
  import { fileURLToPath as fileURLToPath4 } from "url";
4745
- import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
4854
+ import { existsSync as existsSync15, readFileSync as readFileSync7 } from "fs";
4746
4855
  async function startAgents(options) {
4747
4856
  const postgresUrl = await configureDatabaseSettings(options.configure);
4748
4857
  if (postgresUrl) process.env.POSTGRES_URL = postgresUrl;
@@ -4751,19 +4860,19 @@ async function startAgents(options) {
4751
4860
  const serverModule = await moduleLoader.load("@elizaos/server");
4752
4861
  const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
4753
4862
  const __filename = fileURLToPath4(import.meta.url);
4754
- const __dirname = path23.dirname(__filename);
4755
- let cliDistPath = path23.resolve(__dirname, "../../../");
4756
- const indexPath = path23.join(cliDistPath, "index.html");
4757
- if (!existsSync14(indexPath)) {
4863
+ const __dirname = path24.dirname(__filename);
4864
+ let cliDistPath = path24.resolve(__dirname, "../../../");
4865
+ const indexPath = path24.join(cliDistPath, "index.html");
4866
+ if (!existsSync15(indexPath)) {
4758
4867
  let currentDir = __dirname;
4759
- while (currentDir !== path23.dirname(currentDir)) {
4760
- const packageJsonPath = path23.join(currentDir, "package.json");
4761
- if (existsSync14(packageJsonPath)) {
4868
+ while (currentDir !== path24.dirname(currentDir)) {
4869
+ const packageJsonPath = path24.join(currentDir, "package.json");
4870
+ if (existsSync15(packageJsonPath)) {
4762
4871
  try {
4763
- const packageJson = JSON.parse(readFileSync6(packageJsonPath, "utf-8"));
4872
+ const packageJson = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
4764
4873
  if (packageJson.name === "@elizaos/cli") {
4765
- const distPath = path23.join(currentDir, "dist");
4766
- if (existsSync14(path23.join(distPath, "index.html"))) {
4874
+ const distPath = path24.join(currentDir, "dist");
4875
+ if (existsSync15(path24.join(distPath, "index.html"))) {
4767
4876
  cliDistPath = distPath;
4768
4877
  break;
4769
4878
  }
@@ -4771,7 +4880,7 @@ async function startAgents(options) {
4771
4880
  } catch {
4772
4881
  }
4773
4882
  }
4774
- currentDir = path23.dirname(currentDir);
4883
+ currentDir = path24.dirname(currentDir);
4775
4884
  }
4776
4885
  }
4777
4886
  const server = new AgentServer();
@@ -4786,13 +4895,13 @@ async function startAgents(options) {
4786
4895
  const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
4787
4896
  const serverPort = await findNextAvailablePort(desiredPort);
4788
4897
  if (serverPort !== desiredPort) {
4789
- logger19.warn(`Port ${desiredPort} is in use, using port ${serverPort} instead`);
4898
+ logger20.warn({ desiredPort, serverPort }, "Port is in use, using alternate port");
4790
4899
  }
4791
4900
  process.env.SERVER_PORT = serverPort.toString();
4792
4901
  try {
4793
4902
  await server.start(serverPort);
4794
4903
  } catch (error) {
4795
- logger19.error(`Failed to start server on port ${serverPort}:`, error);
4904
+ logger20.error({ error, serverPort }, `Failed to start server on port:`);
4796
4905
  throw error;
4797
4906
  }
4798
4907
  if (options.projectAgents && options.projectAgents.length > 0) {
@@ -4820,15 +4929,16 @@ var start = new Command7().name("start").description("Build and start the Eliza
4820
4929
  }).action(async (options) => {
4821
4930
  try {
4822
4931
  await loadEnvConfig();
4823
- const localModulesPath = path24.join(process.cwd(), "node_modules");
4932
+ await ensureElizaOSCli();
4933
+ const localModulesPath = path25.join(process.cwd(), "node_modules");
4824
4934
  if (process.env.NODE_PATH) {
4825
- process.env.NODE_PATH = `${localModulesPath}${path24.delimiter}${process.env.NODE_PATH}`;
4935
+ process.env.NODE_PATH = `${localModulesPath}${path25.delimiter}${process.env.NODE_PATH}`;
4826
4936
  } else {
4827
4937
  process.env.NODE_PATH = localModulesPath;
4828
4938
  }
4829
- const localBinPath = path24.join(process.cwd(), "node_modules", ".bin");
4939
+ const localBinPath = path25.join(process.cwd(), "node_modules", ".bin");
4830
4940
  if (process.env.PATH) {
4831
- process.env.PATH = `${localBinPath}${path24.delimiter}${process.env.PATH}`;
4941
+ process.env.PATH = `${localBinPath}${path25.delimiter}${process.env.PATH}`;
4832
4942
  } else {
4833
4943
  process.env.PATH = localBinPath;
4834
4944
  }
@@ -4839,8 +4949,8 @@ var start = new Command7().name("start").description("Build and start the Eliza
4839
4949
  try {
4840
4950
  await buildProject(cwd, false);
4841
4951
  } catch (error) {
4842
- logger20.error(`Build error: ${error instanceof Error ? error.message : String(error)}`);
4843
- logger20.warn(
4952
+ logger21.error(`Build error: ${error instanceof Error ? error.message : String(error)}`);
4953
+ logger21.warn(
4844
4954
  "Build failed, but continuing with start. Some features may not work correctly."
4845
4955
  );
4846
4956
  }
@@ -4852,24 +4962,24 @@ var start = new Command7().name("start").description("Build and start the Eliza
4852
4962
  const serverModule = await moduleLoader.load("@elizaos/server");
4853
4963
  const { loadCharacterTryPath } = serverModule;
4854
4964
  for (const charPath of options.character) {
4855
- const resolvedPath = path24.resolve(charPath);
4856
- if (!fs10.existsSync(resolvedPath)) {
4857
- logger20.error(`Character file not found: ${resolvedPath}`);
4965
+ const resolvedPath = path25.resolve(charPath);
4966
+ if (!fs11.existsSync(resolvedPath)) {
4967
+ logger21.error(`Character file not found: ${resolvedPath}`);
4858
4968
  throw new Error(`Character file not found: ${resolvedPath}`);
4859
4969
  }
4860
4970
  try {
4861
4971
  const character = await loadCharacterTryPath(resolvedPath);
4862
4972
  if (character) {
4863
4973
  characters.push(character);
4864
- logger20.info(`Successfully loaded character: ${character.name}`);
4974
+ logger21.info(`Successfully loaded character: ${character.name}`);
4865
4975
  } else {
4866
- logger20.error(
4976
+ logger21.error(
4867
4977
  `Failed to load character from ${resolvedPath}: Invalid or empty character file`
4868
4978
  );
4869
4979
  throw new Error(`Invalid character file: ${resolvedPath}`);
4870
4980
  }
4871
4981
  } catch (e) {
4872
- logger20.error(`Failed to load character from ${resolvedPath}:`, e);
4982
+ logger21.error({ error: e, resolvedPath }, `Failed to load character from path:`);
4873
4983
  throw new Error(`Invalid character file: ${resolvedPath}`);
4874
4984
  }
4875
4985
  }
@@ -4878,20 +4988,20 @@ var start = new Command7().name("start").description("Build and start the Eliza
4878
4988
  const cwd2 = process.cwd();
4879
4989
  const dirInfo2 = detectDirectoryType(cwd2);
4880
4990
  if (dirInfo2.hasPackageJson && dirInfo2.type !== "non-elizaos-dir") {
4881
- logger20.info("No character files specified, attempting to load project agents...");
4991
+ logger21.info("No character files specified, attempting to load project agents...");
4882
4992
  const project = await loadProject(cwd2);
4883
4993
  if (project.agents && project.agents.length > 0) {
4884
- logger20.info(`Found ${project.agents.length} agent(s) in project configuration`);
4994
+ logger21.info(`Found ${project.agents.length} agent(s) in project configuration`);
4885
4995
  projectAgents = project.agents;
4886
4996
  for (const agent2 of project.agents) {
4887
4997
  if (agent2.character) {
4888
- logger20.info(`Loaded character: ${agent2.character.name}`);
4998
+ logger21.info(`Loaded character: ${agent2.character.name}`);
4889
4999
  }
4890
5000
  }
4891
5001
  }
4892
5002
  }
4893
5003
  } catch (e) {
4894
- logger20.debug("Failed to load project agents, will use default character:", e);
5004
+ logger21.debug({ error: e }, "Failed to load project agents, will use default character:");
4895
5005
  }
4896
5006
  }
4897
5007
  await startAgents({ ...options, characters, projectAgents });
@@ -4970,18 +5080,18 @@ ${emoji.error("Error: Failed to run Phala CLI")}`);
4970
5080
  var teeCommand = new Command9("tee").description("Manage TEE deployments").addCommand(phalaCliCommand);
4971
5081
 
4972
5082
  // src/commands/test/index.ts
4973
- import { logger as logger27 } from "@elizaos/core";
5083
+ import { logger as logger28 } from "@elizaos/core";
4974
5084
  import { Command as Command10, Option as Option2 } from "commander";
4975
5085
 
4976
5086
  // src/commands/test/actions/run-all-tests.ts
4977
- import { logger as logger25 } from "@elizaos/core";
5087
+ import { logger as logger26 } from "@elizaos/core";
4978
5088
 
4979
5089
  // src/commands/test/utils/project-utils.ts
4980
- import { logger as logger21 } from "@elizaos/core";
4981
- import * as fs11 from "fs";
4982
- import path25 from "path";
5090
+ import { logger as logger22 } from "@elizaos/core";
5091
+ import * as fs12 from "fs";
5092
+ import path26 from "path";
4983
5093
  function getProjectType(testPath) {
4984
- const targetPath = testPath ? path25.resolve(process.cwd(), testPath) : process.cwd();
5094
+ const targetPath = testPath ? path26.resolve(process.cwd(), testPath) : process.cwd();
4985
5095
  return detectDirectoryType(targetPath);
4986
5096
  }
4987
5097
  function processFilterName(name) {
@@ -5000,29 +5110,29 @@ async function installPluginDependencies(projectInfo) {
5000
5110
  }
5001
5111
  const project = await loadProject(process.cwd());
5002
5112
  if (project.isPlugin && project.pluginModule?.dependencies && project.pluginModule.dependencies.length > 0) {
5003
- const pluginsDir = path25.join(process.cwd(), ".eliza", "plugins");
5004
- if (!fs11.existsSync(pluginsDir)) {
5005
- await fs11.promises.mkdir(pluginsDir, { recursive: true });
5113
+ const pluginsDir = path26.join(process.cwd(), ".eliza", "plugins");
5114
+ if (!fs12.existsSync(pluginsDir)) {
5115
+ await fs12.promises.mkdir(pluginsDir, { recursive: true });
5006
5116
  }
5007
- const packageJsonPath = path25.join(pluginsDir, "package.json");
5008
- if (!fs11.existsSync(packageJsonPath)) {
5117
+ const packageJsonPath = path26.join(pluginsDir, "package.json");
5118
+ if (!fs12.existsSync(packageJsonPath)) {
5009
5119
  const packageJsonContent = {
5010
5120
  name: "test-plugin-dependencies",
5011
5121
  version: "1.0.0",
5012
5122
  description: "A temporary package for installing test plugin dependencies",
5013
5123
  dependencies: {}
5014
5124
  };
5015
- await fs11.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
5125
+ await fs12.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
5016
5126
  }
5017
- const { installPlugin: installPlugin2 } = await import("./utils-H66532NB.js");
5127
+ const { installPlugin: installPlugin2 } = await import("./utils-5HPZSIF6.js");
5018
5128
  for (const dependency of project.pluginModule.dependencies) {
5019
5129
  await installPlugin2(dependency, pluginsDir);
5020
- const dependencyPath = path25.join(pluginsDir, "node_modules", dependency);
5021
- if (fs11.existsSync(dependencyPath)) {
5130
+ const dependencyPath = path26.join(pluginsDir, "node_modules", dependency);
5131
+ if (fs12.existsSync(dependencyPath)) {
5022
5132
  try {
5023
5133
  await runBunCommand(["install"], dependencyPath);
5024
5134
  } catch (error) {
5025
- logger21.warn(
5135
+ logger22.warn(
5026
5136
  `[Test Command] Failed to install devDependencies for ${dependency}: ${error}`
5027
5137
  );
5028
5138
  }
@@ -5032,17 +5142,16 @@ async function installPluginDependencies(projectInfo) {
5032
5142
  }
5033
5143
 
5034
5144
  // src/commands/test/actions/component-tests.ts
5035
- import { logger as logger23 } from "@elizaos/core";
5036
- import { spawn as spawn2 } from "child_process";
5037
- import path27 from "path";
5145
+ import { logger as logger24 } from "@elizaos/core";
5146
+ import path28 from "path";
5038
5147
 
5039
5148
  // src/utils/testing/tsc-validator.ts
5040
- import { logger as logger22 } from "@elizaos/core";
5041
- import path26 from "path";
5042
- import { existsSync as existsSync17 } from "fs";
5149
+ import { logger as logger23 } from "@elizaos/core";
5150
+ import path27 from "path";
5151
+ import { existsSync as existsSync18 } from "fs";
5043
5152
  async function runTypeCheck(projectPath, strict = true) {
5044
- const tsconfigPath = path26.join(projectPath, "tsconfig.json");
5045
- if (!existsSync17(tsconfigPath)) {
5153
+ const tsconfigPath = path27.join(projectPath, "tsconfig.json");
5154
+ if (!existsSync18(tsconfigPath)) {
5046
5155
  return {
5047
5156
  success: false,
5048
5157
  errors: [`No tsconfig.json found at ${tsconfigPath}`],
@@ -5054,7 +5163,7 @@ async function runTypeCheck(projectPath, strict = true) {
5054
5163
  if (strict) {
5055
5164
  args.push("--strict");
5056
5165
  }
5057
- const result = await bunExec("tsc", args, {
5166
+ const result = await bunExec("bun", ["x", "tsc", ...args], {
5058
5167
  cwd: projectPath
5059
5168
  });
5060
5169
  const { stdout, stderr } = result;
@@ -5065,7 +5174,7 @@ async function runTypeCheck(projectPath, strict = true) {
5065
5174
  warnings: stderr.includes("warning") ? [stderr] : []
5066
5175
  };
5067
5176
  } catch (error) {
5068
- logger22.error("TypeScript validation failed:", error);
5177
+ logger23.error({ error }, "TypeScript validation failed:");
5069
5178
  return {
5070
5179
  success: false,
5071
5180
  errors: [`TypeScript validation error: ${error.message}`],
@@ -5079,78 +5188,72 @@ async function runComponentTests(testPath, options, projectInfo) {
5079
5188
  const cwd = process.cwd();
5080
5189
  const isPlugin2 = projectInfo.type === "elizaos-plugin";
5081
5190
  if (!options.skipTypeCheck) {
5082
- logger23.info("Running TypeScript validation...");
5191
+ logger24.info("Running TypeScript validation...");
5083
5192
  const typeCheckResult = await runTypeCheck(cwd, true);
5084
5193
  if (!typeCheckResult.success) {
5085
- logger23.error("TypeScript validation failed:");
5086
- typeCheckResult.errors.forEach((error) => logger23.error(error));
5194
+ logger24.error("TypeScript validation failed:");
5195
+ typeCheckResult.errors.forEach((error) => logger24.error(error));
5087
5196
  return { failed: true };
5088
5197
  }
5089
- logger23.success("TypeScript validation passed");
5198
+ logger24.success("TypeScript validation passed");
5090
5199
  }
5091
5200
  if (!options.skipBuild) {
5092
5201
  try {
5093
- logger23.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5202
+ logger24.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5094
5203
  await buildProject(cwd, isPlugin2);
5095
- logger23.success(`Build completed successfully`);
5204
+ logger24.success(`Build completed successfully`);
5096
5205
  } catch (buildError) {
5097
- logger23.error(`Build failed: ${buildError}`);
5206
+ logger24.error(`Build failed: ${buildError}`);
5098
5207
  return { failed: true };
5099
5208
  }
5100
5209
  }
5101
- logger23.info("Running component tests...");
5102
- return new Promise((resolve2) => {
5103
- const args = ["test", "--passWithNoTests"];
5104
- if (options.name) {
5105
- const baseName = processFilterName(options.name);
5106
- if (baseName) {
5107
- logger23.info(`Using test filter: ${baseName}`);
5108
- args.push("-t", baseName);
5109
- }
5210
+ logger24.info("Running component tests...");
5211
+ const args = ["test", "--passWithNoTests"];
5212
+ if (options.name) {
5213
+ const baseName = processFilterName(options.name);
5214
+ if (baseName) {
5215
+ logger24.info(`Using test filter: ${baseName}`);
5216
+ args.push("-t", baseName);
5110
5217
  }
5111
- const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
5112
- const baseDir = monorepoRoot ?? process.cwd();
5113
- const targetPath = testPath ? path27.resolve(baseDir, testPath) : process.cwd();
5114
- logger23.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
5115
- const child = spawn2("bun", args, {
5116
- stdio: "inherit",
5117
- shell: false,
5218
+ }
5219
+ const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
5220
+ const baseDir = monorepoRoot ?? process.cwd();
5221
+ const targetPath = testPath ? path28.resolve(baseDir, testPath) : process.cwd();
5222
+ logger24.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
5223
+ try {
5224
+ const result = await bunExecInherit("bun", args, {
5118
5225
  cwd: targetPath,
5119
5226
  env: {
5120
- ...process.env,
5121
5227
  FORCE_COLOR: "1",
5122
5228
  // Force color output
5123
- CI: "false"
5124
- // Ensure we're not in CI mode which might buffer
5229
+ CI: ""
5230
+ // Override CI to empty string (some tools check existence, but most check truthiness)
5125
5231
  }
5126
5232
  });
5127
- child.on("close", (code) => {
5128
- logger23.info("Component tests completed");
5129
- resolve2({ failed: code !== 0 });
5130
- });
5131
- child.on("error", (error) => {
5132
- logger23.error("Error running component tests:", error);
5133
- resolve2({ failed: true });
5134
- });
5135
- });
5233
+ logger24.info("Component tests completed");
5234
+ return { failed: !result.success };
5235
+ } catch (error) {
5236
+ logger24.error({ error }, "Error running component tests:");
5237
+ return { failed: true };
5238
+ }
5136
5239
  }
5137
5240
 
5138
5241
  // src/commands/test/actions/e2e-tests.ts
5139
- import { logger as logger24 } from "@elizaos/core";
5242
+ import { logger as logger25 } from "@elizaos/core";
5140
5243
  import * as dotenv2 from "dotenv";
5141
- import * as fs12 from "fs";
5142
- import path28 from "path";
5244
+ import * as fs13 from "fs";
5245
+ import path29 from "path";
5143
5246
  async function runE2eTests(testPath, options, projectInfo) {
5144
5247
  if (!options.skipBuild) {
5145
5248
  try {
5146
5249
  const cwd = process.cwd();
5147
5250
  const isPlugin2 = projectInfo.type === "elizaos-plugin";
5148
- logger24.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5251
+ logger25.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5149
5252
  await buildProject(cwd, isPlugin2);
5150
- logger24.info(`Build completed successfully`);
5253
+ logger25.info(`Build completed successfully`);
5151
5254
  } catch (buildError) {
5152
- logger24.error(`Build error: ${buildError}`);
5153
- logger24.warn(`Attempting to continue with tests despite build error`);
5255
+ logger25.error(`Build error: ${buildError}`);
5256
+ logger25.warn(`Attempting to continue with tests despite build error`);
5154
5257
  }
5155
5258
  }
5156
5259
  let server;
@@ -5160,10 +5263,10 @@ async function runE2eTests(testPath, options, projectInfo) {
5160
5263
  const moduleLoader = getModuleLoader();
5161
5264
  const serverModule = await moduleLoader.load("@elizaos/server");
5162
5265
  const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
5163
- const elizaDir = path28.join(process.cwd(), ".eliza");
5164
- const packageName = path28.basename(process.cwd());
5266
+ const elizaDir = path29.join(process.cwd(), ".eliza");
5267
+ const packageName = path29.basename(process.cwd());
5165
5268
  const timestamp = Date.now();
5166
- const uniqueDbDir = path28.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
5269
+ const uniqueDbDir = path29.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
5167
5270
  const elizaDbDir = uniqueDbDir;
5168
5271
  const envInfo = await UserEnvironment.getInstanceInfo();
5169
5272
  const envFilePath = envInfo.paths.envFilePath;
@@ -5172,88 +5275,88 @@ async function runE2eTests(testPath, options, projectInfo) {
5172
5275
  console.info(`Database directory: ${elizaDbDir}`);
5173
5276
  console.info(`Environment file: ${envFilePath}`);
5174
5277
  console.info(`Package name: ${packageName}, Timestamp: ${timestamp}`);
5175
- if (fs12.existsSync(elizaDbDir)) {
5278
+ if (fs13.existsSync(elizaDbDir)) {
5176
5279
  console.info(`Cleaning up existing database directory: ${elizaDbDir}`);
5177
5280
  try {
5178
- fs12.rmSync(elizaDbDir, { recursive: true, force: true });
5281
+ fs13.rmSync(elizaDbDir, { recursive: true, force: true });
5179
5282
  console.info(`Successfully cleaned up existing database directory`);
5180
5283
  } catch (error) {
5181
5284
  console.warn(`Failed to clean up existing database directory: ${error}`);
5182
5285
  }
5183
5286
  }
5184
5287
  console.info(`Creating fresh database directory: ${elizaDbDir}`);
5185
- fs12.mkdirSync(elizaDbDir, { recursive: true });
5288
+ fs13.mkdirSync(elizaDbDir, { recursive: true });
5186
5289
  console.info(`Created database directory: ${elizaDbDir}`);
5187
5290
  process.env.PGLITE_DATA_DIR = elizaDbDir;
5188
5291
  console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
5189
- if (fs12.existsSync(envFilePath)) {
5190
- logger24.info(`Loading environment variables from: ${envFilePath}`);
5292
+ if (fs13.existsSync(envFilePath)) {
5293
+ logger25.info(`Loading environment variables from: ${envFilePath}`);
5191
5294
  dotenv2.config({ path: envFilePath });
5192
- logger24.info("Environment variables loaded");
5295
+ logger25.info("Environment variables loaded");
5193
5296
  } else {
5194
- logger24.warn(`Environment file not found: ${envFilePath}`);
5297
+ logger25.warn(`Environment file not found: ${envFilePath}`);
5195
5298
  }
5196
5299
  const postgresUrl = process.env.POSTGRES_URL;
5197
- logger24.info(
5300
+ logger25.info(
5198
5301
  `PostgreSQL URL for e2e tests: ${postgresUrl ? "found" : "not found (will use PGlite)"}`
5199
5302
  );
5200
- logger24.info("Creating server instance...");
5303
+ logger25.info("Creating server instance...");
5201
5304
  server = new AgentServer();
5202
- logger24.info("Server instance created");
5203
- logger24.info("Initializing server...");
5305
+ logger25.info("Server instance created");
5306
+ logger25.info("Initializing server...");
5204
5307
  try {
5205
5308
  await server.initialize({
5206
5309
  dataDir: elizaDbDir,
5207
5310
  postgresUrl
5208
5311
  });
5209
- logger24.info("Server initialized successfully");
5312
+ logger25.info("Server initialized successfully");
5210
5313
  } catch (initError) {
5211
- logger24.error("Server initialization failed:", initError);
5314
+ logger25.error({ error: initError }, "Server initialization failed:");
5212
5315
  throw initError;
5213
5316
  }
5214
5317
  let project;
5215
5318
  try {
5216
- logger24.info("Attempting to load project or plugin...");
5319
+ logger25.info("Attempting to load project or plugin...");
5217
5320
  const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
5218
5321
  const baseDir = monorepoRoot ?? process.cwd();
5219
- const targetPath = testPath ? path28.resolve(baseDir, testPath) : process.cwd();
5322
+ const targetPath = testPath ? path29.resolve(baseDir, testPath) : process.cwd();
5220
5323
  project = await loadProject(targetPath);
5221
5324
  if (!project || !project.agents || project.agents.length === 0) {
5222
5325
  throw new Error("No agents found in project configuration");
5223
5326
  }
5224
- logger24.info(`Found ${project.agents.length} agents`);
5225
- logger24.info("Setting up server properties...");
5327
+ logger25.info(`Found ${project.agents.length} agents`);
5328
+ logger25.info("Setting up server properties...");
5226
5329
  server.startAgent = async (character) => {
5227
- logger24.info(`Starting agent for character ${character.name}`);
5330
+ logger25.info(`Starting agent for character ${character.name}`);
5228
5331
  return startAgent(character, server, void 0, [], { isTestMode: true });
5229
5332
  };
5230
5333
  server.loadCharacterTryPath = loadCharacterTryPath;
5231
5334
  server.jsonToCharacter = jsonToCharacter;
5232
- logger24.info("Server properties set up");
5335
+ logger25.info("Server properties set up");
5233
5336
  const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
5234
5337
  const serverPort = await findNextAvailablePort(desiredPort);
5235
5338
  if (serverPort !== desiredPort) {
5236
- logger24.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
5339
+ logger25.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
5237
5340
  }
5238
- logger24.info("Starting server...");
5341
+ logger25.info("Starting server...");
5239
5342
  try {
5240
5343
  await server.start(serverPort);
5241
- logger24.info("Server started successfully on port", serverPort);
5344
+ logger25.info({ serverPort }, "Server started successfully on port");
5242
5345
  } catch (error) {
5243
- logger24.error("Error starting server:", error);
5346
+ logger25.error({ error }, "Error starting server:");
5244
5347
  if (error instanceof Error) {
5245
- logger24.error("Error details:", error.message);
5246
- logger24.error("Stack trace:", error.stack);
5348
+ logger25.error({ message: error.message }, "Error details:");
5349
+ logger25.error({ stack: error.stack }, "Stack trace:");
5247
5350
  }
5248
5351
  throw error;
5249
5352
  }
5250
5353
  try {
5251
- logger24.info(
5354
+ logger25.info(
5252
5355
  `Found ${project.agents.length} agents in ${project.isPlugin ? "plugin" : "project"}`
5253
5356
  );
5254
5357
  if (project.isPlugin || project.agents.length === 0) {
5255
5358
  process.env.ELIZA_TESTING_PLUGIN = "true";
5256
- logger24.info("Using default Eliza character as test agent");
5359
+ logger25.info("Using default Eliza character as test agent");
5257
5360
  try {
5258
5361
  const pluginUnderTest = project.pluginModule;
5259
5362
  if (!pluginUnderTest) {
@@ -5276,16 +5379,16 @@ async function runE2eTests(testPath, options, projectInfo) {
5276
5379
  plugins: runtime.plugins
5277
5380
  // Pass all plugins, not just the one under test
5278
5381
  });
5279
- logger24.info("Default test agent started successfully");
5382
+ logger25.info("Default test agent started successfully");
5280
5383
  } catch (pluginError) {
5281
- logger24.error(`Error starting plugin test agent: ${pluginError}`);
5384
+ logger25.error({ error: pluginError }, `Error starting plugin test agent:`);
5282
5385
  throw pluginError;
5283
5386
  }
5284
5387
  } else {
5285
5388
  for (const agent2 of project.agents) {
5286
5389
  try {
5287
5390
  const originalCharacter = { ...agent2.character };
5288
- logger24.debug(`Starting agent: ${originalCharacter.name}`);
5391
+ logger25.debug(`Starting agent: ${originalCharacter.name}`);
5289
5392
  const runtime = await startAgent(
5290
5393
  originalCharacter,
5291
5394
  server,
@@ -5298,28 +5401,31 @@ async function runE2eTests(testPath, options, projectInfo) {
5298
5401
  projectAgents.push(agent2);
5299
5402
  await new Promise((resolve2) => setTimeout(resolve2, 1e3));
5300
5403
  } catch (agentError) {
5301
- logger24.error(`Error starting agent ${agent2.character.name}:`, agentError);
5404
+ logger25.error(
5405
+ { error: agentError, agentName: agent2.character.name },
5406
+ "Error starting agent"
5407
+ );
5302
5408
  if (agentError instanceof Error) {
5303
- logger24.error("Error details:", agentError.message);
5304
- logger24.error("Stack trace:", agentError.stack);
5409
+ logger25.error({ message: agentError.message }, "Error details:");
5410
+ logger25.error({ stack: agentError.stack }, "Stack trace:");
5305
5411
  }
5306
- logger24.warn(`Skipping agent ${agent2.character.name} due to startup error`);
5412
+ logger25.warn(`Skipping agent ${agent2.character.name} due to startup error`);
5307
5413
  }
5308
5414
  }
5309
5415
  }
5310
5416
  if (runtimes.length === 0) {
5311
5417
  throw new Error("Failed to start any agents from project");
5312
5418
  }
5313
- logger24.debug(`Successfully started ${runtimes.length} agents for testing`);
5419
+ logger25.debug(`Successfully started ${runtimes.length} agents for testing`);
5314
5420
  let totalFailed = 0;
5315
5421
  let anyTestsFound = false;
5316
5422
  for (let i = 0; i < runtimes.length; i++) {
5317
5423
  const runtime = runtimes[i];
5318
5424
  const projectAgent = projectAgents[i];
5319
5425
  if (project.isPlugin) {
5320
- logger24.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
5426
+ logger25.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
5321
5427
  } else {
5322
- logger24.debug(`Running tests for agent: ${runtime.character.name}`);
5428
+ logger25.debug(`Running tests for agent: ${runtime.character.name}`);
5323
5429
  }
5324
5430
  const testRunner = new TestRunner(runtime, projectAgent);
5325
5431
  const currentDirInfo = projectInfo;
@@ -5340,17 +5446,17 @@ async function runE2eTests(testPath, options, projectInfo) {
5340
5446
  }
5341
5447
  return { failed: anyTestsFound ? totalFailed > 0 : false };
5342
5448
  } catch (error) {
5343
- logger24.error("Error in runE2eTests:", error);
5449
+ logger25.error({ error }, "Error in runE2eTests:");
5344
5450
  if (error instanceof Error) {
5345
- logger24.error("Error details:", error.message);
5346
- logger24.error("Stack trace:", error.stack);
5451
+ logger25.error({ message: error.message }, "Error details:");
5452
+ logger25.error({ stack: error.stack }, "Stack trace:");
5347
5453
  } else {
5348
- logger24.error("Unknown error type:", typeof error);
5349
- logger24.error("Error value:", error);
5454
+ logger25.error({ type: typeof error }, "Unknown error type:");
5455
+ logger25.error({ error }, "Error value:");
5350
5456
  try {
5351
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5457
+ logger25.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
5352
5458
  } catch (e) {
5353
- logger24.error("Could not stringify error:", e);
5459
+ logger25.error({ error: e }, "Could not stringify error:");
5354
5460
  }
5355
5461
  }
5356
5462
  return { failed: true };
@@ -5359,47 +5465,47 @@ async function runE2eTests(testPath, options, projectInfo) {
5359
5465
  delete process.env.ELIZA_TESTING_PLUGIN;
5360
5466
  }
5361
5467
  try {
5362
- if (fs12.existsSync(elizaDbDir)) {
5468
+ if (fs13.existsSync(elizaDbDir)) {
5363
5469
  console.info(`Cleaning up test database directory: ${elizaDbDir}`);
5364
- fs12.rmSync(elizaDbDir, { recursive: true, force: true });
5470
+ fs13.rmSync(elizaDbDir, { recursive: true, force: true });
5365
5471
  console.info(`Successfully cleaned up test database directory`);
5366
5472
  }
5367
- const testDir = path28.dirname(elizaDbDir);
5368
- if (fs12.existsSync(testDir) && fs12.readdirSync(testDir).length === 0) {
5369
- fs12.rmSync(testDir, { recursive: true, force: true });
5473
+ const testDir = path29.dirname(elizaDbDir);
5474
+ if (fs13.existsSync(testDir) && fs13.readdirSync(testDir).length === 0) {
5475
+ fs13.rmSync(testDir, { recursive: true, force: true });
5370
5476
  }
5371
5477
  } catch (cleanupError) {
5372
5478
  console.warn(`Failed to clean up test database directory: ${cleanupError}`);
5373
5479
  }
5374
5480
  }
5375
5481
  } catch (error) {
5376
- logger24.error("Error in runE2eTests:", error);
5482
+ logger25.error({ error }, "Error in runE2eTests:");
5377
5483
  if (error instanceof Error) {
5378
- logger24.error("Error details:", error.message);
5379
- logger24.error("Stack trace:", error.stack);
5484
+ logger25.error({ message: error.message }, "Error details:");
5485
+ logger25.error({ stack: error.stack }, "Stack trace:");
5380
5486
  } else {
5381
- logger24.error("Unknown error type:", typeof error);
5382
- logger24.error("Error value:", error);
5487
+ logger25.error({ type: typeof error }, "Unknown error type:");
5488
+ logger25.error({ error }, "Error value:");
5383
5489
  try {
5384
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5490
+ logger25.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
5385
5491
  } catch (e) {
5386
- logger24.error("Could not stringify error:", e);
5492
+ logger25.error({ error: e }, "Could not stringify error:");
5387
5493
  }
5388
5494
  }
5389
5495
  return { failed: true };
5390
5496
  }
5391
5497
  } catch (error) {
5392
- logger24.error("Error in runE2eTests:", error);
5498
+ logger25.error({ error }, "Error in runE2eTests:");
5393
5499
  if (error instanceof Error) {
5394
- logger24.error("Error details:", error.message);
5395
- logger24.error("Stack trace:", error.stack);
5500
+ logger25.error({ message: error.message }, "Error details:");
5501
+ logger25.error({ stack: error.stack }, "Stack trace:");
5396
5502
  } else {
5397
- logger24.error("Unknown error type:", typeof error);
5398
- logger24.error("Error value:", error);
5503
+ logger25.error({ type: typeof error }, "Unknown error type:");
5504
+ logger25.error({ error }, "Error value:");
5399
5505
  try {
5400
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5506
+ logger25.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
5401
5507
  } catch (e) {
5402
- logger24.error("Could not stringify error:", e);
5508
+ logger25.error({ error: e }, "Could not stringify error:");
5403
5509
  }
5404
5510
  }
5405
5511
  return { failed: true };
@@ -5409,18 +5515,24 @@ async function runE2eTests(testPath, options, projectInfo) {
5409
5515
  // src/commands/test/actions/run-all-tests.ts
5410
5516
  async function runAllTests(testPath, options) {
5411
5517
  const projectInfo = getProjectType(testPath);
5518
+ let componentResult = { failed: false };
5412
5519
  if (!options.skipBuild) {
5413
- const componentResult = await runComponentTests(testPath, options, projectInfo);
5414
- if (componentResult.failed) {
5415
- logger25.error("Component tests failed. Continuing to e2e tests...");
5416
- }
5520
+ componentResult = await runComponentTests(testPath, options, projectInfo);
5521
+ } else {
5522
+ logger26.info("Skipping component tests due to --skip-build option");
5417
5523
  }
5418
5524
  const e2eResult = await runE2eTests(testPath, options, projectInfo);
5419
- if (e2eResult.failed) {
5420
- logger25.error("E2E tests failed.");
5525
+ if (componentResult.failed || e2eResult.failed) {
5526
+ if (componentResult.failed) {
5527
+ logger26.error("Component tests failed.");
5528
+ }
5529
+ if (e2eResult.failed) {
5530
+ logger26.error("E2E tests failed.");
5531
+ }
5532
+ logger26.error("Test suite failed.");
5421
5533
  process.exit(1);
5422
5534
  }
5423
- logger25.success("All tests passed successfully!");
5535
+ logger26.success("All tests passed successfully!");
5424
5536
  process.exit(0);
5425
5537
  }
5426
5538
 
@@ -5428,43 +5540,47 @@ async function runAllTests(testPath, options) {
5428
5540
  import * as net from "net";
5429
5541
 
5430
5542
  // src/commands/test/utils/plugin-utils.ts
5431
- import { logger as logger26 } from "@elizaos/core";
5432
- import * as fs13 from "fs";
5433
- import path29 from "path";
5543
+ import { logger as logger27 } from "@elizaos/core";
5544
+ import * as fs14 from "fs";
5545
+ import path30 from "path";
5434
5546
 
5435
5547
  // src/commands/test/index.ts
5436
5548
  var test = new Command10().name("test").description("Run tests for the current project or a specified plugin").argument("[path]", "Optional path to the project or plugin to test").addOption(
5437
5549
  new Option2("-t, --type <type>", "the type of test to run").choices(["component", "e2e", "all"]).default("all")
5438
5550
  ).option("--port <port>", "The port to run e2e tests on", validatePort).option("--name <name>", "Filter tests by name").option("--skip-build", "Skip building before running tests").option("--skip-type-check", "Skip TypeScript validation before running tests").hook("preAction", async (thisCommand) => {
5439
5551
  const testPath = thisCommand.args[0];
5552
+ const options = thisCommand.opts();
5553
+ if (options.type === "component") {
5554
+ return;
5555
+ }
5440
5556
  const projectInfo = getProjectType(testPath);
5441
5557
  await installPluginDependencies(projectInfo);
5442
5558
  }).action(async (testPath, options) => {
5443
- logger27.info("Starting tests...");
5559
+ logger28.info("Starting tests...");
5444
5560
  try {
5445
5561
  const projectInfo = getProjectType(testPath);
5446
5562
  switch (options.type) {
5447
5563
  case "component":
5448
- logger27.info("Running component tests only...");
5564
+ logger28.info("Running component tests only...");
5449
5565
  const componentResult = await runComponentTests(testPath, options, projectInfo);
5450
5566
  if (componentResult.failed) {
5451
- logger27.error("Component tests failed.");
5567
+ logger28.error("Component tests failed.");
5452
5568
  process.exit(1);
5453
5569
  }
5454
- logger27.success("Component tests passed successfully!");
5570
+ logger28.success("Component tests passed successfully!");
5455
5571
  break;
5456
5572
  case "e2e":
5457
- logger27.info("Running e2e tests only...");
5573
+ logger28.info("Running e2e tests only...");
5458
5574
  const e2eResult = await runE2eTests(testPath, options, projectInfo);
5459
5575
  if (e2eResult.failed) {
5460
- logger27.error("E2E tests failed.");
5576
+ logger28.error("E2E tests failed.");
5461
5577
  process.exit(1);
5462
5578
  }
5463
- logger27.success("E2E tests passed successfully!");
5579
+ logger28.success("E2E tests passed successfully!");
5464
5580
  break;
5465
5581
  case "all":
5466
5582
  default:
5467
- logger27.info("Running all tests...");
5583
+ logger28.info("Running all tests...");
5468
5584
  await runAllTests(testPath, options);
5469
5585
  break;
5470
5586
  }
@@ -5475,7 +5591,7 @@ var test = new Command10().name("test").description("Run tests for the current p
5475
5591
  });
5476
5592
 
5477
5593
  // src/index.ts
5478
- import { logger as logger28 } from "@elizaos/core";
5594
+ import { logger as logger29 } from "@elizaos/core";
5479
5595
  import { Command as Command11 } from "commander";
5480
5596
  process.env.NODE_OPTIONS = "--no-deprecation";
5481
5597
  process.env.NODE_NO_WARNINGS = "1";
@@ -5496,19 +5612,19 @@ var shutdownState = {
5496
5612
  };
5497
5613
  async function gracefulShutdown(signal) {
5498
5614
  if (!shutdownState.tryInitiateShutdown()) {
5499
- logger28.debug(`Ignoring ${signal} - shutdown already in progress`);
5615
+ logger29.debug(`Ignoring ${signal} - shutdown already in progress`);
5500
5616
  return;
5501
5617
  }
5502
- logger28.info(`Received ${signal}, shutting down gracefully...`);
5618
+ logger29.info(`Received ${signal}, shutting down gracefully...`);
5503
5619
  try {
5504
5620
  const serverWasStopped = await stopServer();
5505
5621
  if (serverWasStopped) {
5506
- logger28.info("Server stopped successfully");
5622
+ logger29.info("Server stopped successfully");
5507
5623
  }
5508
5624
  } catch (error) {
5509
5625
  const errorMessage = error instanceof Error ? error.message : String(error);
5510
- logger28.error(`Error stopping server: ${errorMessage}`);
5511
- logger28.debug("Full error details:", error);
5626
+ logger29.error(`Error stopping server: ${errorMessage}`);
5627
+ logger29.debug({ error }, "Full error details:");
5512
5628
  }
5513
5629
  const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
5514
5630
  process.exit(exitCode);
@@ -5542,6 +5658,6 @@ async function main() {
5542
5658
  await program.parseAsync();
5543
5659
  }
5544
5660
  main().catch((error) => {
5545
- logger28.error("An error occurred:", error);
5661
+ logger29.error({ error }, "An error occurred:");
5546
5662
  process.exit(1);
5547
5663
  });