@auto-engineer/cli 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +245 -0
- package/dist/bin/auto.d.ts +3 -0
- package/dist/bin/auto.d.ts.map +1 -0
- package/dist/bin/auto.js +12 -0
- package/dist/bin/auto.js.map +1 -0
- package/dist/src/commands/create-example.d.ts +5 -0
- package/dist/src/commands/create-example.d.ts.map +1 -0
- package/dist/src/commands/create-example.js +60 -0
- package/dist/src/commands/create-example.js.map +1 -0
- package/dist/src/commands/demo.d.ts +5 -0
- package/dist/src/commands/demo.d.ts.map +1 -0
- package/dist/src/commands/demo.js +171 -0
- package/dist/src/commands/demo.js.map +1 -0
- package/dist/src/commands/export-schema.d.ts +5 -0
- package/dist/src/commands/export-schema.d.ts.map +1 -0
- package/dist/src/commands/export-schema.js +49 -0
- package/dist/src/commands/export-schema.js.map +1 -0
- package/dist/src/commands/generate-client.d.ts +5 -0
- package/dist/src/commands/generate-client.d.ts.map +1 -0
- package/dist/src/commands/generate-client.js +63 -0
- package/dist/src/commands/generate-client.js.map +1 -0
- package/dist/src/commands/generate-gql-schema.d.ts +5 -0
- package/dist/src/commands/generate-gql-schema.d.ts.map +1 -0
- package/dist/src/commands/generate-gql-schema.js +57 -0
- package/dist/src/commands/generate-gql-schema.js.map +1 -0
- package/dist/src/commands/generate-ia.d.ts +5 -0
- package/dist/src/commands/generate-ia.d.ts.map +1 -0
- package/dist/src/commands/generate-ia.js +54 -0
- package/dist/src/commands/generate-ia.js.map +1 -0
- package/dist/src/commands/generate-server.d.ts +5 -0
- package/dist/src/commands/generate-server.d.ts.map +1 -0
- package/dist/src/commands/generate-server.js +50 -0
- package/dist/src/commands/generate-server.js.map +1 -0
- package/dist/src/commands/implement-client.d.ts +5 -0
- package/dist/src/commands/implement-client.d.ts.map +1 -0
- package/dist/src/commands/implement-client.js +59 -0
- package/dist/src/commands/implement-client.js.map +1 -0
- package/dist/src/commands/implement-server.d.ts +5 -0
- package/dist/src/commands/implement-server.d.ts.map +1 -0
- package/dist/src/commands/implement-server.js +69 -0
- package/dist/src/commands/implement-server.js.map +1 -0
- package/dist/src/commands/import-design-system.d.ts +5 -0
- package/dist/src/commands/import-design-system.d.ts.map +1 -0
- package/dist/src/commands/import-design-system.js +50 -0
- package/dist/src/commands/import-design-system.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +154 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/utils/analytics.d.ts +21 -0
- package/dist/src/utils/analytics.d.ts.map +1 -0
- package/dist/src/utils/analytics.js +41 -0
- package/dist/src/utils/analytics.js.map +1 -0
- package/dist/src/utils/config.d.ts +10 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/config.js +50 -0
- package/dist/src/utils/config.js.map +1 -0
- package/dist/src/utils/errors.d.ts +22 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +50 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/terminal.d.ts +13 -0
- package/dist/src/utils/terminal.d.ts.map +1 -0
- package/dist/src/utils/terminal.js +85 -0
- package/dist/src/utils/terminal.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +66 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @auto-engineer/cli
|
|
2
|
+
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bump versions to fix npm publish conflicts
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @auto-engineer/react-graphql-generator@0.1.1
|
|
11
|
+
- @auto-engineer/design-system-importer@0.1.1
|
|
12
|
+
- @auto-engineer/emmett-generator@0.2.1
|
|
13
|
+
- @auto-engineer/frontend-implementation@0.1.1
|
|
14
|
+
- @auto-engineer/information-architect@0.1.1
|
|
15
|
+
- @auto-engineer/message-bus@0.0.2
|
|
16
|
+
- @auto-engineer/flowlang@0.1.2
|
|
17
|
+
|
|
18
|
+
## 0.1.2
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- First publish
|
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Auto Engineer CLI
|
|
2
|
+
|
|
3
|
+
A powerful command-line interface for automating development workflows, following Node.js CLI best practices.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
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
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### npm (Recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @auto-engineer/cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Docker
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
docker pull auto-engineer/cli
|
|
32
|
+
docker run --rm auto-engineer/cli --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
1. **Generate** code templates:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
auto-engineer generate --type code
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. **Analyze** your code:
|
|
44
|
+
```bash
|
|
45
|
+
auto-engineer analyze --format json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
### `generate`
|
|
51
|
+
|
|
52
|
+
Generate code, documentation, or other artifacts.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
auto-engineer generate [options]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Options:**
|
|
59
|
+
|
|
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
|
|
64
|
+
|
|
65
|
+
**Examples:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Generate code templates
|
|
69
|
+
auto-engineer generate --type code
|
|
70
|
+
|
|
71
|
+
# Generate with custom output path
|
|
72
|
+
auto-engineer generate --type docs --output ./docs
|
|
73
|
+
|
|
74
|
+
# Generate from STDIN
|
|
75
|
+
echo "component" | auto-engineer generate --stdin
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `analyze`
|
|
79
|
+
|
|
80
|
+
Analyze code quality and provide insights.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
auto-engineer analyze [options]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Options:**
|
|
87
|
+
|
|
88
|
+
- `-p, --path <path>` - Path to analyze (default: current directory)
|
|
89
|
+
- `-f, --format <format>` - Output format (text, json)
|
|
90
|
+
- `--stdin` - Analyze content from STDIN
|
|
91
|
+
|
|
92
|
+
**Examples:**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Analyze current directory
|
|
96
|
+
auto-engineer analyze
|
|
97
|
+
|
|
98
|
+
# Analyze specific path in JSON format
|
|
99
|
+
auto-engineer analyze --path ./src --format json
|
|
100
|
+
|
|
101
|
+
# Analyze content from STDIN
|
|
102
|
+
cat file.js | auto-engineer analyze --stdin
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Global Options
|
|
106
|
+
|
|
107
|
+
- `-v, --version` - Show version number
|
|
108
|
+
- `-d, --debug` - Enable debug mode
|
|
109
|
+
- `--no-color` - Disable colored output
|
|
110
|
+
- `--json` - Output in JSON format
|
|
111
|
+
- `--api-token <token>` - API token for external services
|
|
112
|
+
- `--project-path <path>` - Project path to work with
|
|
113
|
+
|
|
114
|
+
## Environment Variables
|
|
115
|
+
|
|
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)
|
|
121
|
+
|
|
122
|
+
## Configuration
|
|
123
|
+
|
|
124
|
+
Auto-engineer follows configuration precedence:
|
|
125
|
+
|
|
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)
|
|
131
|
+
|
|
132
|
+
### Project Configuration
|
|
133
|
+
|
|
134
|
+
Create `.auto-engineer.json` in your project root:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"projectType": "node-ts",
|
|
139
|
+
"packageManager": "npm",
|
|
140
|
+
"testFramework": "vitest",
|
|
141
|
+
"enableLinting": true,
|
|
142
|
+
"enableGitHooks": true
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Error Codes
|
|
147
|
+
|
|
148
|
+
Auto-engineer uses standardized error codes for easy troubleshooting:
|
|
149
|
+
|
|
150
|
+
- `E4001` - Validation error
|
|
151
|
+
- `E4002` - Configuration error
|
|
152
|
+
- `E4003` - Invalid API token
|
|
153
|
+
- `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
|
+
- `E5001` - Runtime error
|
|
159
|
+
- `E9999` - Unknown error
|
|
160
|
+
|
|
161
|
+
## Analytics
|
|
162
|
+
|
|
163
|
+
Auto-engineer collects anonymous usage analytics to improve the tool. Analytics are:
|
|
164
|
+
|
|
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
|
|
169
|
+
|
|
170
|
+
To disable analytics:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
export AUTO_ENGINEER_ANALYTICS=false
|
|
174
|
+
```
|
|
175
|
+
|
|
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.
|
|
185
|
+
|
|
186
|
+
## Development
|
|
187
|
+
|
|
188
|
+
### Prerequisites
|
|
189
|
+
|
|
190
|
+
- Node.js 18.0.0 or higher
|
|
191
|
+
- npm, yarn, or pnpm
|
|
192
|
+
|
|
193
|
+
### Setup
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Install dependencies
|
|
197
|
+
npm install
|
|
198
|
+
|
|
199
|
+
# Build the project
|
|
200
|
+
npm run build
|
|
201
|
+
|
|
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
|
|
210
|
+
```
|
|
211
|
+
|
|
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
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT License - see LICENSE file for details.
|
|
240
|
+
|
|
241
|
+
## Support
|
|
242
|
+
|
|
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)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../bin/auto.ts"],"names":[],"mappings":""}
|
package/dist/bin/auto.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { resolve, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
const srcPath = resolve(__dirname, '..', 'src', 'index.js');
|
|
8
|
+
const node = spawn('node', [srcPath, ...process.argv.slice(2)], { stdio: 'inherit' });
|
|
9
|
+
node.on('exit', (code) => {
|
|
10
|
+
process.exit(code || 0);
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../../bin/auto.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAEtF,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;IACvB,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Config } from '../utils/config';
|
|
3
|
+
import { Analytics } from '../utils/analytics';
|
|
4
|
+
export declare const createCreateExampleCommand: (config: Config, analytics: Analytics) => Command;
|
|
5
|
+
//# sourceMappingURL=create-example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-example.d.ts","sourceRoot":"","sources":["../../../src/commands/create-example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAO,MAAM,0BAA0B,WAAY,MAAM,aAAa,SAAS,KAAG,OA+DjF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createOutput } from '../utils/terminal.js';
|
|
3
|
+
import { handleError } from '../utils/errors.js';
|
|
4
|
+
export const createCreateExampleCommand = (config, analytics) => {
|
|
5
|
+
const output = createOutput(config);
|
|
6
|
+
const command = new Command('create:example');
|
|
7
|
+
command
|
|
8
|
+
.description('Create an example project')
|
|
9
|
+
.argument('<example-name>', 'Name of the example to create')
|
|
10
|
+
.option('--directory <path>', 'Target directory (defaults to current directory)')
|
|
11
|
+
.action(async (exampleName, options) => {
|
|
12
|
+
try {
|
|
13
|
+
await analytics.track({ command: 'create:example:start', success: true });
|
|
14
|
+
const targetDirectory = options.directory ?? process.cwd();
|
|
15
|
+
output.info(`Creating example "${exampleName}" in ${targetDirectory}...`);
|
|
16
|
+
// Import the handler
|
|
17
|
+
const { handleCreateExampleCommand } = await import('@auto-engineer/flowlang/commands/create-example');
|
|
18
|
+
const createCommand = {
|
|
19
|
+
type: 'CreateExample',
|
|
20
|
+
data: {
|
|
21
|
+
exampleName,
|
|
22
|
+
targetDirectory,
|
|
23
|
+
},
|
|
24
|
+
timestamp: new Date(),
|
|
25
|
+
requestId: `create-example-${Date.now()}`,
|
|
26
|
+
};
|
|
27
|
+
// TODO use the bus
|
|
28
|
+
const result = await handleCreateExampleCommand(createCommand);
|
|
29
|
+
if (result.type === 'ExampleCreated') {
|
|
30
|
+
output.success(`✅ Example "${exampleName}" created successfully!`);
|
|
31
|
+
// output.info('');
|
|
32
|
+
// output.info('Files created:');
|
|
33
|
+
// result.data.filesCreated.forEach((file: string) => {
|
|
34
|
+
// output.info(` - ${file}`);
|
|
35
|
+
// });
|
|
36
|
+
output.info('');
|
|
37
|
+
output.info('Next steps:');
|
|
38
|
+
output.info('1. Review the generated files');
|
|
39
|
+
output.info('2. Install dependencies: npm install');
|
|
40
|
+
output.info('3. Start development: npm run dev');
|
|
41
|
+
await analytics.track({ command: 'create:example', success: true });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
output.error(`❌ Failed to create example: ${result.data.error}`);
|
|
45
|
+
await analytics.track({ command: 'create:example', success: false, errorCode: result.data.error });
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
await analytics.track({
|
|
51
|
+
command: 'create:example',
|
|
52
|
+
success: false,
|
|
53
|
+
errorCode: error instanceof Error ? error.message : String(error),
|
|
54
|
+
});
|
|
55
|
+
handleError(error instanceof Error ? error : new Error(String(error)));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return command;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=create-example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-example.js","sourceRoot":"","sources":["../../../src/commands/create-example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAc,EAAE,SAAoB,EAAW,EAAE;IAC1F,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,gBAA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AAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAgC/C,eAAO,MAAM,iBAAiB,WAAY,MAAM,aAAa,SAAS,YAqJrE,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { createOutput } from '../utils/terminal.js';
|
|
6
|
+
import { handleError } from '../utils/errors.js';
|
|
7
|
+
import markedTerminal from 'marked-terminal';
|
|
8
|
+
import { marked } from 'marked';
|
|
9
|
+
// Color constants
|
|
10
|
+
const COLORS = {
|
|
11
|
+
SPECS_TEXT: chalk.hex('#A0A0A0'),
|
|
12
|
+
SPECS_LABEL: chalk.italic,
|
|
13
|
+
EVENTS: chalk.hex('#FFA500'),
|
|
14
|
+
COMMANDS: chalk.hex('#7FDBFF'),
|
|
15
|
+
STATE: chalk.green,
|
|
16
|
+
FLOW_TEXT: chalk.bold.blue,
|
|
17
|
+
STREAM_BRACKETS: chalk.yellow,
|
|
18
|
+
INTEGRATIONS_BRACKETS: chalk.magenta,
|
|
19
|
+
SOURCE_BRACKETS: chalk.gray,
|
|
20
|
+
SLICE_TEXT: chalk.white.bold,
|
|
21
|
+
CLIENT_SERVER: chalk.hex('#4ECDC4'),
|
|
22
|
+
};
|
|
23
|
+
// Configure marked to use marked-terminal with custom styles
|
|
24
|
+
marked.setOptions({
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
|
26
|
+
renderer: new markedTerminal({
|
|
27
|
+
heading: chalk.hex('#00BFFF').bold, // h1
|
|
28
|
+
firstHeading: chalk.hex('#00BFFF').bold, // h1
|
|
29
|
+
strong: chalk.bold,
|
|
30
|
+
em: chalk.italic,
|
|
31
|
+
listitem: chalk.hex('#90EE90'), // bullets
|
|
32
|
+
codespan: chalk.yellow,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
export const createDemoCommand = (config, analytics) => {
|
|
36
|
+
const output = createOutput(config);
|
|
37
|
+
return new Command('demo').description('Start demo mode to build something').action(async () => {
|
|
38
|
+
try {
|
|
39
|
+
output.debug('Demo command initiated');
|
|
40
|
+
while (true) {
|
|
41
|
+
const { buildPrompt } = await inquirer.prompt([
|
|
42
|
+
{
|
|
43
|
+
type: 'input',
|
|
44
|
+
name: 'buildPrompt',
|
|
45
|
+
message: 'What would you like to build?',
|
|
46
|
+
validate: (input) => {
|
|
47
|
+
if (input.trim().length === 0) {
|
|
48
|
+
return "Please enter something you'd like to build";
|
|
49
|
+
}
|
|
50
|
+
if (input.trim().length < 3) {
|
|
51
|
+
return 'Please provide a more detailed description (at least 3 characters)';
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
},
|
|
55
|
+
transformer: (input) => input.trim(),
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
output.debug(`User wants to build: ${buildPrompt}`);
|
|
59
|
+
const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
60
|
+
const spinnerColors = [
|
|
61
|
+
COLORS.EVENTS,
|
|
62
|
+
COLORS.COMMANDS,
|
|
63
|
+
COLORS.STATE,
|
|
64
|
+
COLORS.CLIENT_SERVER,
|
|
65
|
+
COLORS.STREAM_BRACKETS,
|
|
66
|
+
COLORS.INTEGRATIONS_BRACKETS,
|
|
67
|
+
];
|
|
68
|
+
const coloredFrames = spinnerFrames.map((frame, i) => {
|
|
69
|
+
const color = spinnerColors[i % spinnerColors.length];
|
|
70
|
+
return color(frame);
|
|
71
|
+
});
|
|
72
|
+
const spinner = ora({
|
|
73
|
+
text: chalk.gray('Thinking...'),
|
|
74
|
+
spinner: {
|
|
75
|
+
interval: 80,
|
|
76
|
+
frames: coloredFrames,
|
|
77
|
+
},
|
|
78
|
+
}).start();
|
|
79
|
+
// Simulate thinking time
|
|
80
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
81
|
+
spinner.stop();
|
|
82
|
+
console.log();
|
|
83
|
+
const buildSummaryLines = [
|
|
84
|
+
'# **Flow: Guest books a listing** [source: <root>/src/flows/guest-booking-flow.ts]',
|
|
85
|
+
'* **Slice:** Search for available listings [stream: listing]',
|
|
86
|
+
' * **Client:** Listing Search Screen',
|
|
87
|
+
' should have location filter',
|
|
88
|
+
' should have price range slider',
|
|
89
|
+
' should have guest count filter',
|
|
90
|
+
' * **Server:** Search listings by location and price',
|
|
91
|
+
' Events.ListingCreated => State.AvailableListings',
|
|
92
|
+
'',
|
|
93
|
+
'* **Slice:** Book listing [stream: booking]',
|
|
94
|
+
' * **Client:** Booking Form',
|
|
95
|
+
' should have check-in & checkout date picker',
|
|
96
|
+
' should have guest count selector',
|
|
97
|
+
' * **Server:** Process booking request',
|
|
98
|
+
' Commands.BookListing => Events.BookingConfirmed',
|
|
99
|
+
'',
|
|
100
|
+
'* **Slice:** Host is notified',
|
|
101
|
+
' * **Server:** Host is notified when booking request is received',
|
|
102
|
+
' Events.BookingConfirmed => Commands.NotifyHost',
|
|
103
|
+
'',
|
|
104
|
+
'* **Slice:** Notify host [integrations: MailChimp, Twilio]',
|
|
105
|
+
' * **Server:** Send notification using the specified integrations',
|
|
106
|
+
' Commands.NotifyHost => Events.HostNotified',
|
|
107
|
+
'',
|
|
108
|
+
'⏱️ Time: ~2-3 min | 💰 Cost: ~$2',
|
|
109
|
+
];
|
|
110
|
+
console.log(buildSummaryLines.join('\\n'));
|
|
111
|
+
console.log(); // Add blank line
|
|
112
|
+
const { confirm } = await inquirer.prompt([
|
|
113
|
+
{
|
|
114
|
+
type: 'confirm',
|
|
115
|
+
name: 'confirm',
|
|
116
|
+
message: 'Do you want to proceed?',
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
if (!confirm) {
|
|
120
|
+
console.log(chalk.yellow('Going back to build prompt...'));
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
// Second thinking phase
|
|
124
|
+
const spinner2 = ora({
|
|
125
|
+
text: chalk.gray('Building...'),
|
|
126
|
+
spinner: {
|
|
127
|
+
interval: 80,
|
|
128
|
+
frames: coloredFrames,
|
|
129
|
+
},
|
|
130
|
+
}).start();
|
|
131
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
132
|
+
spinner2.stop();
|
|
133
|
+
// Show deployment success message
|
|
134
|
+
console.log(chalk.green('✅ Your app has been deployed!'));
|
|
135
|
+
console.log(chalk.cyan('🌐 Access it at: http://localhost:3000'));
|
|
136
|
+
const { action } = await inquirer.prompt([
|
|
137
|
+
{
|
|
138
|
+
type: 'list',
|
|
139
|
+
name: 'action',
|
|
140
|
+
message: 'What would you like to do?',
|
|
141
|
+
choices: ['Accept', 'Reject', 'Retry'],
|
|
142
|
+
},
|
|
143
|
+
]);
|
|
144
|
+
if (action === 'Accept') {
|
|
145
|
+
console.log(chalk.green('Build accepted!'));
|
|
146
|
+
// Continue the loop to ask for help again
|
|
147
|
+
}
|
|
148
|
+
else if (action === 'Reject') {
|
|
149
|
+
console.log(chalk.red('Build rejected.'));
|
|
150
|
+
// Continue the loop to ask for help again
|
|
151
|
+
}
|
|
152
|
+
else if (action === 'Retry') {
|
|
153
|
+
console.log(chalk.blue('Retrying...'));
|
|
154
|
+
// Continue the loop to ask for help again
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
await analytics.trackCommand('demo', true);
|
|
158
|
+
output.debug('Demo command completed successfully');
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
await analytics.trackCommand('demo', false, error instanceof Error ? error.message : 'unknown');
|
|
162
|
+
if (error instanceof Error) {
|
|
163
|
+
handleError(error);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
handleError(new Error(String(error)));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=demo.js.map
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0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Config } from '../utils/config';
|
|
3
|
+
import { Analytics } from '../utils/analytics';
|
|
4
|
+
export declare const createExportSchemaCommand: (config: Config, analytics: Analytics) => Command;
|
|
5
|
+
//# sourceMappingURL=export-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-schema.d.ts","sourceRoot":"","sources":["../../../src/commands/export-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAO,MAAM,yBAAyB,WAAY,MAAM,aAAa,SAAS,KAAG,OAoDhF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createOutput } from '../utils/terminal.js';
|
|
3
|
+
import { handleError } from '../utils/errors.js';
|
|
4
|
+
export const createExportSchemaCommand = (config, analytics) => {
|
|
5
|
+
const output = createOutput(config);
|
|
6
|
+
const command = new Command('export:schema');
|
|
7
|
+
command
|
|
8
|
+
.description('Export flow schema to .context/schema.json')
|
|
9
|
+
.option('--directory <path>', 'Target directory (defaults to current directory)')
|
|
10
|
+
.action(async (options) => {
|
|
11
|
+
try {
|
|
12
|
+
await analytics.track({ command: 'export:schema:start', success: true });
|
|
13
|
+
const directory = options.directory ?? process.cwd();
|
|
14
|
+
output.info(`Exporting flow schema from ${directory}/flows...`);
|
|
15
|
+
// Import dynamically to avoid TypeScript module resolution issues
|
|
16
|
+
const { handleExportSchemaCommand } = await import('@auto-engineer/flowlang');
|
|
17
|
+
const exportCommand = {
|
|
18
|
+
type: 'ExportSchema',
|
|
19
|
+
data: {
|
|
20
|
+
directory,
|
|
21
|
+
},
|
|
22
|
+
timestamp: new Date(),
|
|
23
|
+
requestId: `export-schema-${Date.now()}`,
|
|
24
|
+
};
|
|
25
|
+
// TODO use the bus
|
|
26
|
+
const result = await handleExportSchemaCommand(exportCommand);
|
|
27
|
+
if (result.type === 'SchemaExported') {
|
|
28
|
+
output.success(`✅ Flow schema exported successfully!`);
|
|
29
|
+
output.info(`Schema written to: ${result.data.outputPath}`);
|
|
30
|
+
await analytics.track({ command: 'export:schema', success: true });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
output.error(`❌ Failed to export schema: ${result.data.error}`);
|
|
34
|
+
await analytics.track({ command: 'export:schema', success: false, errorCode: result.data.error });
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
await analytics.track({
|
|
40
|
+
command: 'export:schema',
|
|
41
|
+
success: false,
|
|
42
|
+
errorCode: error instanceof Error ? error.message : String(error),
|
|
43
|
+
});
|
|
44
|
+
handleError(error instanceof Error ? error : new Error(String(error)));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return command;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=export-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-schema.js","sourceRoot":"","sources":["../../../src/commands/export-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAc,EAAE,SAAoB,EAAW,EAAE;IACzF,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7C,OAAO;SACJ,WAAW,CAAC,4CAA4C,CAAC;SACzD,MAAM,CAAC,oBAAoB,EAAE,kDAAkD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K,EAAE,CAAC,CAAC;gBAClG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,SAAS,CAAC,KAAK,CAAC;gBACpB,OAAO,EAAE,eAAe;gBACxB,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAClE,CAAC,CAAC;YACH,WAAW,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Config } from '../utils/config';
|
|
3
|
+
import { Analytics } from '../utils/analytics';
|
|
4
|
+
export declare const createGenerateClientCommand: (config: Config, analytics: Analytics) => Command;
|
|
5
|
+
//# sourceMappingURL=generate-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-client.d.ts","sourceRoot":"","sources":["../../../src/commands/generate-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,eAAO,MAAM,2BAA2B,WAAY,MAAM,aAAa,SAAS,KAAG,OAwElF,CAAC"}
|