@auto-engineer/cli 0.5.20 → 0.6.1

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 (71) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +10 -0
  3. package/README.md +185 -151
  4. package/dist/src/index.js +254 -93
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/manifest-types.d.ts +21 -0
  7. package/dist/src/manifest-types.d.ts.map +1 -0
  8. package/dist/src/manifest-types.js +2 -0
  9. package/dist/src/manifest-types.js.map +1 -0
  10. package/dist/src/plugin-loader.d.ts +49 -0
  11. package/dist/src/plugin-loader.d.ts.map +1 -0
  12. package/dist/src/plugin-loader.js +383 -0
  13. package/dist/src/plugin-loader.js.map +1 -0
  14. package/dist/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +29 -28
  16. package/dist/src/commands/check-client.d.ts +0 -6
  17. package/dist/src/commands/check-client.d.ts.map +0 -1
  18. package/dist/src/commands/check-client.js +0 -69
  19. package/dist/src/commands/check-client.js.map +0 -1
  20. package/dist/src/commands/check-lint.d.ts +0 -5
  21. package/dist/src/commands/check-lint.d.ts.map +0 -1
  22. package/dist/src/commands/check-lint.js +0 -96
  23. package/dist/src/commands/check-lint.js.map +0 -1
  24. package/dist/src/commands/check-tests.d.ts +0 -5
  25. package/dist/src/commands/check-tests.d.ts.map +0 -1
  26. package/dist/src/commands/check-tests.js +0 -87
  27. package/dist/src/commands/check-tests.js.map +0 -1
  28. package/dist/src/commands/check-types.d.ts +0 -5
  29. package/dist/src/commands/check-types.d.ts.map +0 -1
  30. package/dist/src/commands/check-types.js +0 -83
  31. package/dist/src/commands/check-types.js.map +0 -1
  32. package/dist/src/commands/copy-example.d.ts +0 -5
  33. package/dist/src/commands/copy-example.d.ts.map +0 -1
  34. package/dist/src/commands/copy-example.js +0 -54
  35. package/dist/src/commands/copy-example.js.map +0 -1
  36. package/dist/src/commands/create-example.d.ts +0 -5
  37. package/dist/src/commands/create-example.d.ts.map +0 -1
  38. package/dist/src/commands/create-example.js +0 -60
  39. package/dist/src/commands/create-example.js.map +0 -1
  40. package/dist/src/commands/export-schema.d.ts +0 -5
  41. package/dist/src/commands/export-schema.d.ts.map +0 -1
  42. package/dist/src/commands/export-schema.js +0 -49
  43. package/dist/src/commands/export-schema.js.map +0 -1
  44. package/dist/src/commands/generate-client.d.ts +0 -5
  45. package/dist/src/commands/generate-client.d.ts.map +0 -1
  46. package/dist/src/commands/generate-client.js +0 -77
  47. package/dist/src/commands/generate-client.js.map +0 -1
  48. package/dist/src/commands/generate-gql-schema.d.ts +0 -5
  49. package/dist/src/commands/generate-gql-schema.d.ts.map +0 -1
  50. package/dist/src/commands/generate-gql-schema.js +0 -57
  51. package/dist/src/commands/generate-gql-schema.js.map +0 -1
  52. package/dist/src/commands/generate-ia.d.ts +0 -5
  53. package/dist/src/commands/generate-ia.d.ts.map +0 -1
  54. package/dist/src/commands/generate-ia.js +0 -54
  55. package/dist/src/commands/generate-ia.js.map +0 -1
  56. package/dist/src/commands/generate-server.d.ts +0 -5
  57. package/dist/src/commands/generate-server.d.ts.map +0 -1
  58. package/dist/src/commands/generate-server.js +0 -50
  59. package/dist/src/commands/generate-server.js.map +0 -1
  60. package/dist/src/commands/implement-client.d.ts +0 -5
  61. package/dist/src/commands/implement-client.d.ts.map +0 -1
  62. package/dist/src/commands/implement-client.js +0 -70
  63. package/dist/src/commands/implement-client.js.map +0 -1
  64. package/dist/src/commands/implement-server.d.ts +0 -5
  65. package/dist/src/commands/implement-server.d.ts.map +0 -1
  66. package/dist/src/commands/implement-server.js +0 -69
  67. package/dist/src/commands/implement-server.js.map +0 -1
  68. package/dist/src/commands/import-design-system.d.ts +0 -5
  69. package/dist/src/commands/import-design-system.d.ts.map +0 -1
  70. package/dist/src/commands/import-design-system.js +0 -62
  71. package/dist/src/commands/import-design-system.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @auto-engineer/cli
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - • All cli commands now use commands and emit events on the bus
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @auto-engineer/message-bus@0.4.0
13
+
3
14
  ## 0.5.20
4
15
 
5
16
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Elastic License 2.0
2
+
3
+ Copyright 2024 Sam Hatoum
4
+
5
+ This software and associated documentation files (the "Software") are licensed under the Elastic License 2.0 (the "License"). You may not use this file except in compliance with the License.
6
+
7
+ You may obtain a copy of the License at:
8
+ https://www.elastic.co/licensing/elastic-license
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,106 +1,170 @@
1
- # Auto Engineer CLI
1
+ # @auto-engineer/cli
2
2
 
3
- A powerful command-line interface for automating development workflows, following Node.js CLI best practices.
3
+ CLI interface for Auto Engineer - a plugin-based command-line tool for building applications with AI assistance.
4
4
 
5
5
  ## Features
6
6
 
7
- - **POSIX-compliant** command line arguments
8
- - **Empathic CLI** with interactive prompts and helpful error messages
9
- - **Colorful output** with graceful degradation
10
- - **Rich interactions** with progress spinners and prompts
11
- - **STDIN support** for piping data
12
- - ✅ **Structured output** in JSON format
13
- - ✅ **Cross-platform** compatibility
14
- - ✅ **Configuration precedence** (CLI args > env vars > config files)
15
- - **Containerized** distribution via Docker
16
- - **Analytics** with strict opt-in
17
- - **Proper error handling** with error codes
18
- - ✅ **Debug mode** for troubleshooting
7
+ - Plugin-based architecture - Install only the functionality you need
8
+ - POSIX-compliant command line arguments
9
+ - Interactive prompts and error messages
10
+ - Colored output with graceful degradation
11
+ - Progress spinners and prompts
12
+ - Structured output in JSON format
13
+ - Cross-platform compatibility
14
+ - Configuration precedence (CLI args > env vars > config files)
15
+ - Analytics with opt-in
16
+ - Error handling with error codes
17
+ - Debug mode for troubleshooting
19
18
 
20
19
  ## Installation
21
20
 
22
- ### npm (Recommended)
23
-
24
21
  ```bash
22
+ # Install globally
25
23
  npm install -g @auto-engineer/cli
24
+
25
+ # Or use with npx
26
+ npx @auto-engineer/cli
27
+
28
+ # Or with pnpm
29
+ pnpm install -g @auto-engineer/cli
26
30
  ```
27
31
 
28
- ### Docker
32
+ ## Plugin System
33
+
34
+ The CLI uses a plugin-based architecture. Install only the functionality you need:
35
+
36
+ ### Quick Start
37
+
38
+ 1. Install the CLI:
29
39
 
30
40
  ```bash
31
- docker pull auto-engineer/cli
32
- docker run --rm auto-engineer/cli --help
41
+ npm install -g @auto-engineer/cli
33
42
  ```
34
43
 
35
- ## Quick Start
44
+ 2. Install plugins for your use case:
45
+
46
+ ```bash
47
+ # For backend development
48
+ npm install @auto-engineer/flowlang @auto-engineer/emmett-generator @auto-engineer/server-implementer
36
49
 
37
- 1. **Generate** code templates:
50
+ # For frontend development
51
+ npm install @auto-engineer/react-graphql-generator @auto-engineer/frontend-implementation
38
52
 
39
- ```bash
40
- auto-engineer generate --type code
41
- ```
53
+ # For validation and testing
54
+ npm install @auto-engineer/backend-checks @auto-engineer/frontend-checks
55
+ ```
42
56
 
43
- 2. **Analyze** your code:
44
- ```bash
45
- auto-engineer analyze --format json
46
- ```
57
+ 3. Create configuration (`auto.config.ts`):
47
58
 
48
- ## Commands
59
+ ```typescript
60
+ export default {
61
+ plugins: ['@auto-engineer/flowlang', '@auto-engineer/emmett-generator', '@auto-engineer/server-implementer'],
49
62
 
50
- ### `generate`
63
+ // Optional: Handle command conflicts
64
+ aliases: {
65
+ // 'command:alias': '@auto-engineer/package-name'
66
+ },
67
+ };
68
+ ```
51
69
 
52
- Generate code, documentation, or other artifacts.
70
+ 4. Run commands:
53
71
 
54
72
  ```bash
55
- auto-engineer generate [options]
73
+ auto create:example shopping-assistant
74
+ auto export:schema ./.context ./flows
75
+ auto generate:server .context/schema.json .
56
76
  ```
57
77
 
58
- **Options:**
78
+ ## Available Plugins
59
79
 
60
- - `-t, --type <type>` - Type of generation (code, docs, tests)
61
- - `-o, --output <path>` - Output path for generated files
62
- - `-f, --force` - Overwrite existing files
63
- - `--stdin` - Read input from STDIN
80
+ | Plugin | Commands | Description |
81
+ | ---------------------------------------- | ------------------------------------------ | ----------------------------------- |
82
+ | `@auto-engineer/flowlang` | `create:example`, `export:schema` | Flow modeling and schema export |
83
+ | `@auto-engineer/emmett-generator` | `generate:server` | Server code generation |
84
+ | `@auto-engineer/server-implementer` | `implement:server`, `implement:slice` | AI server implementation |
85
+ | `@auto-engineer/react-graphql-generator` | `generate:client`, `copy:example` | React client scaffolding |
86
+ | `@auto-engineer/frontend-implementation` | `implement:client` | AI client implementation |
87
+ | `@auto-engineer/information-architect` | `generate:ia` | Information architecture generation |
88
+ | `@auto-engineer/design-system-importer` | `import:design-system` | Figma design system import |
89
+ | `@auto-engineer/backend-checks` | `check:types`, `check:lint`, `check:tests` | Backend validation |
90
+ | `@auto-engineer/frontend-checks` | `check:client` | Frontend validation |
64
91
 
65
- **Examples:**
92
+ ## Configuration
66
93
 
67
- ```bash
68
- # Generate code templates
69
- auto-engineer generate --type code
94
+ ### Plugin Configuration
95
+
96
+ The CLI looks for an `auto.config.ts` file in your project root:
97
+
98
+ ```typescript
99
+ // auto.config.ts
100
+ export default {
101
+ // List of npm packages to load as plugins
102
+ plugins: [
103
+ '@auto-engineer/flowlang',
104
+ '@auto-engineer/emmett-generator',
105
+ // ... more plugins
106
+ ],
107
+
108
+ // Optional: Override command aliases when conflicts occur
109
+ aliases: {
110
+ 'create:example': '@auto-engineer/flowlang',
111
+ // ... more overrides
112
+ },
113
+ };
114
+ ```
70
115
 
71
- # Generate with custom output path
72
- auto-engineer generate --type docs --output ./docs
116
+ ### Handling Conflicts
73
117
 
74
- # Generate from STDIN
75
- echo "component" | auto-engineer generate --stdin
118
+ When multiple plugins register the same command alias, you'll receive an error with instructions:
119
+
120
+ ```
121
+ Command alias conflicts detected!
122
+
123
+ Multiple packages are trying to register the same command aliases.
124
+ Please add alias overrides to your auto.config.ts file:
125
+
126
+ export default {
127
+ plugins: [
128
+ '@auto-engineer/package-a',
129
+ '@auto-engineer/package-b',
130
+ ],
131
+ aliases: {
132
+ // Map the conflicting command to the package that should handle it
133
+ 'conflicting:command': '@auto-engineer/package-a',
134
+ }
135
+ };
76
136
  ```
77
137
 
78
- ### `analyze`
138
+ The alias resolution works per command, not per package. Each package can expose multiple commands, and you resolve conflicts for specific command aliases. For example, if both `backend-checks` and `another-package` provide a `check:types` command, you specify which package handles that specific command.
79
139
 
80
- Analyze code quality and provide insights.
140
+ ## Commands
81
141
 
82
- ```bash
83
- auto-engineer analyze [options]
84
- ```
142
+ Commands are provided by installed plugins. Run `auto --help` to see available commands based on your configuration.
85
143
 
86
- **Options:**
144
+ ### Common Plugin Commands
87
145
 
88
- - `-p, --path <path>` - Path to analyze (default: current directory)
89
- - `-f, --format <format>` - Output format (text, json)
90
- - `--stdin` - Analyze content from STDIN
146
+ Flow Development (requires `@auto-engineer/flowlang`)
91
147
 
92
- **Examples:**
148
+ - `create:example <name>` - Create an example project
149
+ - `export:schema <context> <flows>` - Export flow schemas
93
150
 
94
- ```bash
95
- # Analyze current directory
96
- auto-engineer analyze
151
+ Backend Generation (requires respective plugins)
97
152
 
98
- # Analyze specific path in JSON format
99
- auto-engineer analyze --path ./src --format json
153
+ - `generate:server <schema> <dest>` - Generate server from schema
154
+ - `implement:server <server-dir>` - AI implements server
100
155
 
101
- # Analyze content from STDIN
102
- cat file.js | auto-engineer analyze --stdin
103
- ```
156
+ Frontend Generation (requires respective plugins)
157
+
158
+ - `generate:ia <context> <flows...>` - Generate Information Architecture
159
+ - `generate:client <starter> <client> <ia> <gql> [vars]` - Generate React client
160
+ - `implement:client <client> <context> <principles> <design>` - AI implements client
161
+
162
+ Validation & Testing (requires check plugins)
163
+
164
+ - `check:types <directory>` - TypeScript type checking
165
+ - `check:tests <directory>` - Run test suites
166
+ - `check:lint <directory> [--fix]` - Linting with optional auto-fix
167
+ - `check:client <client-dir>` - Full frontend validation
104
168
 
105
169
  ## Global Options
106
170
 
@@ -113,36 +177,57 @@ cat file.js | auto-engineer analyze --stdin
113
177
 
114
178
  ## Environment Variables
115
179
 
116
- - `DEBUG=auto-engineer` - Enable debug mode
117
- - `NO_COLOR=1` - Disable colored output
118
- - `OUTPUT_FORMAT=json` - Set output format
119
- - `AUTO_ENGINEER_API_TOKEN=<token>` - Set API token
120
- - `AUTO_ENGINEER_ANALYTICS=false` - Disable analytics (enabled by default)
180
+ Set these in your `.env` file or environment:
121
181
 
122
- ## Configuration
182
+ ```bash
183
+ # AI Provider Keys (need at least one)
184
+ ANTHROPIC_API_KEY=sk-ant-...
185
+ OPENAI_API_KEY=sk-...
186
+ GEMINI_API_KEY=...
187
+ XAI_API_KEY=...
188
+
189
+ # Debugging
190
+ DEBUG=cli:* # Debug CLI operations
191
+ DEBUG=cli:plugin-loader # Debug plugin loading
192
+
193
+ # Configuration
194
+ NO_COLOR=1 # Disable colored output
195
+ AUTO_ENGINEER_ANALYTICS=false # Disable usage analytics
196
+ ```
123
197
 
124
- Auto-engineer follows configuration precedence:
198
+ ## Creating a Plugin
125
199
 
126
- 1. **Command line arguments** (highest priority)
127
- 2. **Environment variables**
128
- 3. **Project configuration** (`.auto-engineer.json`)
129
- 4. **User configuration** (`~/.auto-engineer.json`)
130
- 5. **System configuration** (defaults)
200
+ Plugins are npm packages that export a `CLI_MANIFEST`:
131
201
 
132
- ### Project Configuration
202
+ ```typescript
203
+ // your-plugin/src/cli-manifest.ts
204
+ export const CLI_MANIFEST = {
205
+ commands: {
206
+ 'your:command': {
207
+ handler: () => import('./commands/your-command'),
208
+ description: 'Description of your command',
209
+ },
210
+ },
211
+ };
133
212
 
134
- Create `.auto-engineer.json` in your project root:
213
+ // your-plugin/src/index.ts
214
+ export { CLI_MANIFEST } from './cli-manifest';
215
+ export * from './commands/your-command';
216
+ ```
135
217
 
136
- ```json
137
- {
138
- "projectType": "node-ts",
139
- "packageManager": "npm",
140
- "testFramework": "vitest",
141
- "enableLinting": true,
142
- "enableGitHooks": true
218
+ The command handler should export a function that handles the command:
219
+
220
+ ```typescript
221
+ // your-plugin/src/commands/your-command.ts
222
+ export async function handleYourCommand(command: { type: string; data: any; timestamp: Date; requestId: string }) {
223
+ // Implementation
143
224
  }
144
225
  ```
145
226
 
227
+ ## Built-in Commands
228
+
229
+ When no `auto.config.ts` is present, the CLI falls back to built-in commands that work with locally available packages.
230
+
146
231
  ## Error Codes
147
232
 
148
233
  Auto-engineer uses standardized error codes for easy troubleshooting:
@@ -151,21 +236,16 @@ Auto-engineer uses standardized error codes for easy troubleshooting:
151
236
  - `E4002` - Configuration error
152
237
  - `E4003` - Invalid API token
153
238
  - `E4004` - Invalid project path
154
- - `E4005` - Missing generation type
155
- - `E4006` - Missing output path
156
- - `E4007` - Invalid path type
157
- - `E4008` - Path does not exist
158
239
  - `E5001` - Runtime error
159
240
  - `E9999` - Unknown error
160
241
 
161
242
  ## Analytics
162
243
 
163
- Auto-engineer collects anonymous usage analytics to improve the tool. Analytics are:
244
+ Auto-engineer collects anonymous usage analytics to improve the tool:
164
245
 
165
- - **Enabled by default** - Analytics are collected to help improve the tool
166
- - **Anonymous** - No personal information is collected
167
- - **Transparent** - You can see what data is collected in debug mode
168
- - **Controllable** - You can disable anytime
246
+ - Anonymous - No personal information is collected
247
+ - Transparent - You can see what data is collected in debug mode
248
+ - Controllable - You can disable anytime
169
249
 
170
250
  To disable analytics:
171
251
 
@@ -173,73 +253,27 @@ To disable analytics:
173
253
  export AUTO_ENGINEER_ANALYTICS=false
174
254
  ```
175
255
 
176
- Analytics data includes:
177
-
178
- - Command usage (which commands are run)
179
- - Success/failure rates
180
- - Error codes (for debugging)
181
- - Platform information (Node.js version, OS)
182
- - Tool version
183
-
184
- This data helps us understand usage patterns and improve the tool's reliability and features.
256
+ ## Debugging
185
257
 
186
- ## Development
187
-
188
- ### Prerequisites
189
-
190
- - Node.js 18.0.0 or higher
191
- - npm, yarn, or pnpm
192
-
193
- ### Setup
258
+ Enable debug output to troubleshoot issues:
194
259
 
195
260
  ```bash
196
- # Install dependencies
197
- npm install
261
+ # Debug everything
262
+ DEBUG=* auto create:example test
198
263
 
199
- # Build the project
200
- npm run build
264
+ # Debug plugin loading
265
+ DEBUG=cli:plugin-loader auto --help
201
266
 
202
- # Run in development mode
203
- npm run dev
204
-
205
- # Run tests
206
- npm test
207
-
208
- # Run with coverage
209
- npm run test:coverage
267
+ # Debug specific plugins
268
+ DEBUG=flowlang:* auto export:schema ./context ./flows
210
269
  ```
211
270
 
212
- ### Project Structure
213
-
214
- ```
215
- src/
216
- ├── commands/ # Command implementations
217
- │ ├── generate.ts
218
- │ ├── analyze.ts
219
- │ └── demo.ts
220
- ├── utils/ # Utility functions
221
- │ ├── config.ts # Configuration management
222
- │ ├── errors.ts # Error handling
223
- │ ├── terminal.ts # Terminal utilities
224
- │ └── analytics.ts # Analytics
225
- └── index.ts # Main entry point
226
- ```
227
-
228
- ## Contributing
229
-
230
- 1. Fork the repository
231
- 2. Create a feature branch
232
- 3. Make your changes
233
- 4. Add tests
234
- 5. Run the test suite
235
- 6. Submit a pull request
236
-
237
271
  ## License
238
272
 
239
- MIT License - see LICENSE file for details.
273
+ Part of the Auto Engineer monorepo. Licensed under [Elastic License 2.0](../../LICENSE.md).
240
274
 
241
275
  ## Support
242
276
 
243
- - **Documentation**: [GitHub Wiki](https://github.com/your-repo/auto-engineer/wiki)
244
- - **Issues**: [GitHub Issues](https://github.com/your-repo/auto-engineer/issues)
245
- - **Discussions**: [GitHub Discussions](https://github.com/your-repo/auto-engineer/discussions)
277
+ - Discord: [Join our community](https://discord.gg/B8BKcKMRm8)
278
+ - Documentation: [GitHub Wiki](https://github.com/SamHatoum/auto-engineer/wiki)
279
+ - Issues: [GitHub Issues](https://github.com/SamHatoum/auto-engineer/issues)