@elizaos/cli 1.3.2 → 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 (122) hide show
  1. package/README.md +46 -0
  2. package/dist/{bun-exec-6CQHTS4F.js → bun-exec-ULMPAIQC.js} +1 -1
  3. package/dist/{chunk-E6XYTE3A.js → chunk-D3QSET5H.js} +69 -72
  4. package/dist/{chunk-FDEDLANP.js → chunk-FQYWRHLX.js} +1 -1
  5. package/dist/{chunk-T2QDIXGU.js → chunk-FSSUAWXQ.js} +3 -3
  6. package/dist/{chunk-D3Q2UZLZ.js → chunk-I4L4T7QX.js} +1 -1
  7. package/dist/{chunk-5GUS4CFO.js → chunk-SMZBJQJR.js} +1 -1
  8. package/dist/commands/agent/actions/index.js +3 -3
  9. package/dist/commands/agent/index.js +3 -3
  10. package/dist/commands/create/actions/index.js +4 -4
  11. package/dist/commands/create/index.js +5 -5
  12. package/dist/index.js +134 -109
  13. package/dist/{plugin-creator-H26ZLR6H.js → plugin-creator-TCUFII32.js} +2 -2
  14. package/dist/{registry-433S5F3Y.js → registry-RF6PW3EN.js} +3 -3
  15. package/dist/templates/plugin-quick-starter/README.md +52 -10
  16. package/dist/templates/plugin-quick-starter/package.json +2 -2
  17. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  18. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  19. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
  20. package/dist/templates/plugin-quick-starter/src/plugin.ts +14 -14
  21. package/dist/templates/plugin-starter/README.md +124 -49
  22. package/dist/templates/plugin-starter/package.json +2 -2
  23. package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  24. package/{templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → dist/templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  25. package/dist/templates/plugin-starter/src/plugin.ts +5 -7
  26. package/dist/templates/project-starter/README.md +24 -11
  27. package/dist/templates/project-starter/package.json +4 -4
  28. package/dist/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  29. package/dist/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  30. package/dist/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  31. package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  32. package/dist/templates/project-starter/src/__tests__/models.test.ts +3 -3
  33. package/dist/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  34. package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  35. package/dist/templates/project-starter/src/index.ts +4 -3
  36. package/dist/templates/project-starter/src/plugin.ts +5 -5
  37. package/dist/templates/project-tee-starter/README.md +44 -5
  38. package/dist/templates/project-tee-starter/package.json +4 -4
  39. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
  40. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
  41. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +1 -1
  42. package/dist/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  43. package/dist/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  44. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
  45. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  46. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  47. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
  48. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  49. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  50. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
  51. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
  52. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
  53. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
  54. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  55. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
  56. package/dist/templates/project-tee-starter/src/index.ts +2 -0
  57. package/dist/templates/project-tee-starter/src/plugin.ts +19 -7
  58. package/dist/{utils-DBLSDYBF.js → utils-5HPZSIF6.js} +3 -3
  59. package/package.json +6 -6
  60. package/templates/plugin-quick-starter/README.md +52 -10
  61. package/templates/plugin-quick-starter/package.json +2 -2
  62. package/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  63. package/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  64. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
  65. package/templates/plugin-quick-starter/src/plugin.ts +14 -14
  66. package/templates/plugin-starter/README.md +124 -49
  67. package/templates/plugin-starter/package.json +2 -2
  68. package/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  69. package/{dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  70. package/templates/plugin-starter/src/plugin.ts +5 -7
  71. package/templates/project-starter/README.md +24 -11
  72. package/templates/project-starter/package.json +4 -4
  73. package/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  74. package/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  75. package/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  76. package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  77. package/templates/project-starter/src/__tests__/models.test.ts +3 -3
  78. package/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  79. package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  80. package/templates/project-starter/src/index.ts +4 -3
  81. package/templates/project-starter/src/plugin.ts +5 -5
  82. package/templates/project-tee-starter/README.md +44 -5
  83. package/templates/project-tee-starter/package.json +4 -4
  84. package/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
  85. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
  86. package/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +1 -1
  87. package/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  88. package/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  89. package/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
  90. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  91. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  92. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
  93. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  94. package/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  95. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
  96. package/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
  97. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
  98. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
  99. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  100. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
  101. package/templates/project-tee-starter/src/index.ts +2 -0
  102. package/templates/project-tee-starter/src/plugin.ts +19 -7
  103. package/dist/templates/plugin-starter/src/tests.ts +0 -6
  104. package/dist/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  105. package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  106. package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  107. package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  108. package/dist/templates/project-tee-starter/e2e/project.test.ts +0 -38
  109. package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  110. package/templates/plugin-starter/src/tests.ts +0 -6
  111. package/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  112. package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  113. package/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  114. package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  115. package/templates/project-tee-starter/e2e/project.test.ts +0 -38
  116. package/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  117. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  118. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
  119. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
  120. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  121. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
  122. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
@@ -13,7 +13,6 @@ import type {
13
13
  } from '@elizaos/core';
14
14
  import { ModelType, Service, logger } from '@elizaos/core';
15
15
  import { z } from 'zod';
16
- import { StarterPluginTestSuite } from './tests';
17
16
 
18
17
  /**
19
18
  * Defines the configuration schema for a plugin, including the validation rules for the plugin name.
@@ -89,7 +88,7 @@ const helloWorldAction: Action = {
89
88
  },
90
89
  };
91
90
  } catch (error) {
92
- logger.error('Error in HelloWorld action:', error);
91
+ logger.error({ error }, 'Error in HelloWorld action:');
93
92
  return {
94
93
  success: false,
95
94
  error: error instanceof Error ? error : new Error(String(error)),
@@ -245,35 +244,34 @@ export const starterPlugin: Plugin = {
245
244
  async (params) => {
246
245
  logger.debug('MESSAGE_RECEIVED event received');
247
246
  // print the keys
248
- logger.debug(Object.keys(params));
247
+ logger.debug({ keys: Object.keys(params) }, 'MESSAGE_RECEIVED param keys');
249
248
  },
250
249
  ],
251
250
  VOICE_MESSAGE_RECEIVED: [
252
251
  async (params) => {
253
252
  logger.debug('VOICE_MESSAGE_RECEIVED event received');
254
253
  // print the keys
255
- logger.debug(Object.keys(params));
254
+ logger.debug({ keys: Object.keys(params) }, 'VOICE_MESSAGE_RECEIVED param keys');
256
255
  },
257
256
  ],
258
257
  WORLD_CONNECTED: [
259
258
  async (params) => {
260
259
  logger.debug('WORLD_CONNECTED event received');
261
260
  // print the keys
262
- logger.debug(Object.keys(params));
261
+ logger.debug({ keys: Object.keys(params) }, 'WORLD_CONNECTED param keys');
263
262
  },
264
263
  ],
265
264
  WORLD_JOINED: [
266
265
  async (params) => {
267
266
  logger.debug('WORLD_JOINED event received');
268
267
  // print the keys
269
- logger.debug(Object.keys(params));
268
+ logger.debug({ keys: Object.keys(params) }, 'WORLD_JOINED param keys');
270
269
  },
271
270
  ],
272
271
  },
273
272
  services: [StarterService],
274
273
  actions: [helloWorldAction],
275
274
  providers: [helloWorldProvider],
276
- tests: [StarterPluginTestSuite],
277
275
  // dependencies: ['@elizaos/plugin-knowledge'], <--- plugin dependencies go here (if requires another plugin)
278
276
  };
279
277
 
@@ -42,23 +42,36 @@ elizaos test
42
42
 
43
43
  ## Testing
44
44
 
45
- ElizaOS provides a comprehensive testing structure for projects:
45
+ ElizaOS employs a dual testing strategy:
46
46
 
47
- ### Test Structure
47
+ 1. **Component Tests** (`src/__tests__/*.test.ts`)
48
+
49
+ - Run with Bun's native test runner
50
+ - Fast, isolated tests using mocks
51
+ - Perfect for TDD and component logic
48
52
 
49
- - **Component Tests** (`__tests__/` directory):
53
+ 2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
54
+ - Run with ElizaOS custom test runner
55
+ - Real runtime with actual database (PGLite)
56
+ - Test complete user scenarios
50
57
 
51
- - **Unit Tests**: Test individual functions and components in isolation
52
- - **Integration Tests**: Test how components work together
53
- - Run with: `elizaos test component`
58
+ ### Test Structure
54
59
 
55
- - **End-to-End Tests** (`e2e/` directory):
60
+ ```
61
+ src/
62
+ __tests__/ # All tests live inside src
63
+ *.test.ts # Component tests (use Bun test runner)
64
+ e2e/ # E2E tests (use ElizaOS test runner)
65
+ project-starter.e2e.ts # E2E test suite
66
+ README.md # E2E testing documentation
67
+ index.ts # Export tests here: tests: [ProjectStarterTestSuite]
68
+ ```
56
69
 
57
- - Test the project within a full ElizaOS runtime
58
- - Run with: `elizaos test e2e`
70
+ ### Running Tests
59
71
 
60
- - **Running All Tests**:
61
- - `elizaos test` runs both component and e2e tests
72
+ - `elizaos test` - Run all tests (component + e2e)
73
+ - `elizaos test component` - Run only component tests
74
+ - `elizaos test e2e` - Run only E2E tests
62
75
 
63
76
  ### Writing Tests
64
77
 
@@ -28,10 +28,10 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@elizaos/cli": "1.3.2",
32
- "@elizaos/core": "1.3.2",
33
- "@elizaos/plugin-bootstrap": "1.3.2",
34
- "@elizaos/plugin-sql": "1.3.2",
31
+ "@elizaos/cli": "1.4.2",
32
+ "@elizaos/core": "1.4.2",
33
+ "@elizaos/plugin-bootstrap": "1.4.2",
34
+ "@elizaos/plugin-sql": "1.4.2",
35
35
  "@tanstack/react-query": "^5.29.0",
36
36
  "clsx": "^2.1.1",
37
37
  "react": "^18.3.1",
@@ -107,7 +107,7 @@ describe('Actions', () => {
107
107
  expect(result).toBe(true);
108
108
  } catch (e) {
109
109
  error = e as Error;
110
- logger.error('Validate function error:', e);
110
+ logger.error({ error: e }, 'Validate function error:');
111
111
  }
112
112
 
113
113
  documentTestResult('HELLO_WORLD action validate', result, error);
@@ -145,7 +145,7 @@ describe('Actions', () => {
145
145
  expect(callbackResponse).toHaveProperty('source', 'test');
146
146
  } catch (e) {
147
147
  error = e as Error;
148
- logger.error('Handler function error:', e);
148
+ logger.error({ error: e }, 'Handler function error:');
149
149
  }
150
150
 
151
151
  documentTestResult('HELLO_WORLD action handler', callbackResponse, error);
@@ -0,0 +1,103 @@
1
+ # E2E Tests for Project Starter
2
+
3
+ This directory contains end-to-end tests for the ElizaOS project starter template.
4
+
5
+ ## ElizaOS Testing Philosophy
6
+
7
+ ElizaOS employs a dual testing strategy:
8
+
9
+ 1. **Component Tests** (`src/__tests__/*.test.ts`)
10
+
11
+ - Run with Bun's native test runner
12
+ - Fast, isolated tests using mocks
13
+ - Perfect for TDD and component logic
14
+ - Command: `bun test`
15
+
16
+ 2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
17
+ - Run with ElizaOS custom test runner
18
+ - Real runtime with actual database (PGLite)
19
+ - Test complete user scenarios
20
+ - Command: `elizaos test --type e2e`
21
+
22
+ ## Overview
23
+
24
+ E2E tests run in a real ElizaOS runtime environment, allowing you to test your project's behavior as it would work in production. Unlike component tests, E2E tests provide access to a fully initialized runtime with all services, actions, and providers available.
25
+
26
+ ## Test Structure
27
+
28
+ - **ProjectStarterTestSuite** - Main test suite containing comprehensive e2e tests:
29
+ - **Core Project Tests**
30
+ - `project_should_initialize_correctly` - Verifies project and runtime initialization
31
+ - `character_should_be_loaded_correctly` - Validates all character configuration fields
32
+ - **Natural Language Processing Tests**
33
+ - `agent_should_respond_to_greeting` - Tests basic greeting interactions
34
+ - `agent_should_respond_to_hello_world` - Validates specific hello world response
35
+ - `agent_should_respond_to_casual_greetings` - Tests various casual greeting formats
36
+ - `agent_should_maintain_conversation_context` - Validates context retention
37
+ - **Action & Provider Tests**
38
+ - `hello_world_action_direct_execution` - Tests direct action execution
39
+ - `hello_world_provider_test` - Validates provider functionality
40
+ - **Service & System Tests**
41
+ - `starter_service_test` - Tests service lifecycle and configuration
42
+ - `memory_system_should_store_and_retrieve_messages` - Tests memory persistence
43
+ - `agent_should_handle_multiple_concurrent_messages` - Tests concurrent processing
44
+ - `project_configuration_should_be_valid` - Validates project configuration
45
+ - `plugin_initialization_test` - Tests plugin system integration
46
+
47
+ ## Integration with Project
48
+
49
+ E2E tests are integrated directly into your project through the main index.ts file:
50
+
51
+ ```typescript
52
+ // src/index.ts
53
+ import { ProjectStarterTestSuite } from './__tests__/e2e/project-starter.e2e';
54
+
55
+ export const project: Project = {
56
+ agents: [projectAgent],
57
+ tests: [ProjectStarterTestSuite], // Direct import!
58
+ };
59
+ ```
60
+
61
+ ## Running Tests
62
+
63
+ ```bash
64
+ # Run all tests (component + e2e)
65
+ elizaos test
66
+
67
+ # Run only e2e tests (slower, full integration)
68
+ elizaos test --type e2e
69
+
70
+ # Run only component tests (fast, for TDD)
71
+ bun test
72
+ # or
73
+ elizaos test --type component
74
+ ```
75
+
76
+ ## Implementation Details
77
+
78
+ 1. **Direct Import**: Tests are imported directly from the e2e test file - no intermediate export file needed
79
+ 2. **Project Integration**: The test suite is added to the project's `tests` array
80
+ 3. **Test Discovery**: The ElizaOS test runner automatically finds and executes tests from the project's `tests` array
81
+ 4. **Runtime Access**: Each test receives a real runtime instance with full access to:
82
+ - Agent character configuration
83
+ - Database and model access
84
+ - All registered plugins and services
85
+ - Memory and conversation history
86
+
87
+ ## Key Differences from Plugin Tests
88
+
89
+ - **Export Location**: Tests are exported from the `ProjectAgent` in `src/index.ts` (not directly from `Project`)
90
+ - **Test Focus**: Tests focus on agent behavior and character configuration rather than plugin functionality
91
+ - **Project Context**: Tests have access to the full project configuration including character settings
92
+
93
+ ## Writing New Tests
94
+
95
+ See the comprehensive documentation at the top of `project-starter.e2e.ts` for detailed instructions on adding new tests.
96
+
97
+ ## Best Practices
98
+
99
+ 1. **Test User Journeys**: Focus on complete user interactions with the agent
100
+ 2. **Character Validation**: Ensure character properties affect agent behavior as expected
101
+ 3. **Context Testing**: Verify the agent maintains context across conversations
102
+ 4. **Concurrent Operations**: Test how the agent handles multiple simultaneous requests
103
+ 5. **Configuration Validation**: Ensure all required settings are properly loaded