openwork-agent 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -1,436 +1,205 @@
1
- # OpenWork Agent
2
-
3
1
  <div align="center">
4
2
 
5
- ![OpenWork Agent Logo](https://img.shields.io/badge/OpenWork-Agent-blue?style=for-the-badge&logo=code)
6
- ![NPM Version](https://img.shields.io/npm/v/openwork-agent?style=for-the-badge&logo=npm)
7
- ![License](https://img.shields.io/npm/l/openwork-agent?style=for-the-badge&logo=open-source-initiative)
8
- ![Downloads](https://img.shields.io/npm/dt/openwork-agent?style=for-the-badge&logo=npm)
9
-
10
- **AI-powered backend code generator for any technology stack**
11
-
12
- Create complete backend projects with just a few commands! šŸš€
13
-
14
- [Install](#-installation) • [Quick Start](#-quick-start) • [Documentation](#-documentation) • [Contributing](#-contributing)
15
-
16
- </div>
17
-
18
- ---
19
-
20
- ## ✨ Features
21
-
22
- - šŸŒ **Multiple Technologies**: Node.js, Python, Java, Go, Rust, PHP, and more
23
- - šŸŽÆ **Popular Frameworks**: Express, FastAPI, Spring Boot, Gin, Actix, Laravel, etc.
24
- - šŸ—„ļø **Database Support**: MongoDB, PostgreSQL, MySQL, SQLite, Redis
25
- - 🐳 **Docker Support**: Automatic Dockerfile and docker-compose generation
26
- - šŸš€ **CI/CD Ready**: GitHub Actions workflow generation
27
- - šŸ’¬ **Interactive Mode**: Guided project setup with prompts
28
- - šŸ“‹ **Template System**: Customizable templates for any stack
29
- - šŸ” **Technology Detection**: Analyze existing projects
30
- - šŸ›”ļø **Best Practices**: Security, logging, error handling, CORS
31
-
32
- ## šŸ“¦ Installation
33
-
34
- ### Global Installation (Recommended)
35
-
36
- ```bash
37
- npm install -g openwork-agent
38
- ```
39
-
40
- ### Local Installation
41
-
42
- ```bash
43
- npm install openwork-agent
44
- ```
45
-
46
- ### Using Yarn
47
-
48
- ```bash
49
- yarn global add openwork-agent
50
- ```
51
-
52
- ### Using pnpm
53
-
54
- ```bash
55
- pnpm add -g openwork-agent
56
- ```
57
-
58
- ## šŸš€ Quick Start
3
+ <h1>šŸš€ OpenWork Agent</h1>
59
4
 
60
- ### 1. Create a New Project (Interactive Mode)
5
+ <p>
6
+ <img src="https://img.shields.io/npm/v/openwork-agent" />
7
+ <img src="https://img.shields.io/npm/dw/openwork-agent" />
8
+ <img src="https://img.shields.io/npm/l/openwork-agent" />
9
+ </p>
61
10
 
62
- ```bash
63
- openwork-agent create my-awesome-api
64
- ```
11
+ <p>
12
+ <strong>AI-powered backend code generator for any technology stack</strong>
13
+ </p>
65
14
 
66
- ### 2. Create with Specific Technology
15
+ <p>
16
+ Generate <strong>production-ready backend projects in seconds</strong><br/>
17
+ with Docker, CI/CD, authentication, security, and best practices.
18
+ </p>
67
19
 
68
- ```bash
69
- openwork-agent create my-fastapi-app --tech python --framework fastapi --database postgresql
70
- ```
20
+ <pre><code>npx openwork-agent create my-api</code></pre>
71
21
 
72
- ### 3. Create with Docker and Tests
22
+ <p>
23
+ <a href="#installation">Installation</a> •
24
+ <a href="#quick-start">Quick Start</a> •
25
+ <a href="#supported-technologies">Technologies</a> •
26
+ <a href="#contributing">Contributing</a>
27
+ </p>
73
28
 
74
- ```bash
75
- openwork-agent create my-enterprise-app --tech node --framework express --database mongodb --docker --tests
76
- ```
77
-
78
- ### 4. List Available Templates
79
-
80
- ```bash
81
- openwork-agent templates
82
- ```
83
-
84
- ### 5. Analyze Existing Project
85
-
86
- ```bash
87
- cd existing-project
88
- openwork-agent analyze
89
- ```
90
-
91
- ## šŸ“‹ Supported Technologies
29
+ </div>
92
30
 
93
- ### JavaScript/Node.js
94
- - **Frameworks**: Express.js, NestJS, Fastify, Koa, Hapi
95
- - **Databases**: MongoDB (Mongoose), PostgreSQL, MySQL, SQLite
96
- - **Features**: TypeScript, JWT auth, validation, testing
31
+ <hr/>
97
32
 
98
- ### Python
99
- - **Frameworks**: FastAPI, Django, Flask, Tornado, AioHTTP
100
- - **Databases**: MongoDB (Motor), PostgreSQL (asyncpg), MySQL, SQLite
101
- - **Features**: Pydantic validation, async/await, Swagger docs
33
+ <h2>ā“ What Problem Does OpenWork Agent Solve?</h2>
102
34
 
103
- ### Java
104
- - **Frameworks**: Spring Boot, Quarkus, Micronaut, Vert.x
105
- - **Databases**: MongoDB, PostgreSQL, MySQL, Oracle
106
- - **Features**: Spring Data, REST controllers, JPA, testing
35
+ <p>Backend setup usually means:</p>
107
36
 
108
- ### Go
109
- - **Frameworks**: Gin, Echo, Fiber, Chi, Gorilla Mux
110
- - **Databases**: MongoDB, PostgreSQL, MySQL, SQLite
111
- - **Features**: Structured logging, middleware, validation
37
+ <ul>
38
+ <li>Copy-pasting boilerplate from random GitHub repositories</li>
39
+ <li>Manually configuring Docker, databases, and CI/CD</li>
40
+ <li>Forgetting security, testing, or best practices</li>
41
+ </ul>
112
42
 
113
- ### Rust
114
- - **Frameworks**: Actix-web, Rocket, Warp, Axum
115
- - **Databases**: PostgreSQL, SQLite
116
- - **Features**: Diesel ORM, async, error handling
117
-
118
- ### PHP
119
- - **Frameworks**: Laravel, Symfony, Slim
120
- - **Databases**: MySQL, PostgreSQL, SQLite
121
- - **Features**: Eloquent ORM, middleware, routing
122
-
123
- ## šŸ“– Usage Examples
124
-
125
- ### Node.js with Express and MongoDB
126
-
127
- ```bash
128
- openwork-agent create blog-api --tech node --framework express --database mongodb --docker
129
- ```
43
+ <p>
44
+ <strong>OpenWork Agent solves this in one command.</strong><br/>
45
+ You get a clean, scalable, and secure backend instantly — ready for development or production.
46
+ </p>
130
47
 
131
- **Generated:**
132
- - Express.js server with TypeScript
133
- - MongoDB integration with Mongoose
134
- - User CRUD operations
135
- - Docker setup
136
- - JWT authentication
137
- - Error handling middleware
138
-
139
- ### Python FastAPI with PostgreSQL
140
-
141
- ```bash
142
- openwork-agent create data-api --tech python --framework fastapi --database postgresql --tests
143
- ```
144
-
145
- **Generated:**
146
- - FastAPI application
147
- - PostgreSQL integration
148
- - Pydantic models
149
- - Async database operations
150
- - API documentation (Swagger)
151
- - Unit tests with pytest
152
-
153
- ### Java Spring Boot Microservice
154
-
155
- ```bash
156
- openwork-agent create user-service --tech java --framework spring --database mysql --ci
157
- ```
158
-
159
- **Generated:**
160
- - Spring Boot application
161
- - MySQL integration with JPA
162
- - REST controllers
163
- - Service layer
164
- - Unit tests with JUnit
165
- - GitHub Actions workflow
166
-
167
- ### Go Gin Web Service
168
-
169
- ```bash
170
- openwork-agent create go-api --tech go --framework gin --database postgresql --docker
171
- ```
172
-
173
- **Generated:**
174
- - Gin web framework setup
175
- - PostgreSQL with GORM
176
- - Structured logging
177
- - Configuration management
178
- - Docker multi-stage build
179
-
180
- ## šŸ—‚ļø Project Structure
181
-
182
- Generated projects follow best practices:
183
-
184
- ```
185
- my-project/
186
- ā”œā”€ā”€ src/ # Source code
187
- │ ā”œā”€ā”€ controllers/ # Route controllers
188
- │ ā”œā”€ā”€ models/ # Data models
189
- │ ā”œā”€ā”€ routes/ # API routes
190
- │ ā”œā”€ā”€ middleware/ # Middleware
191
- │ ā”œā”€ā”€ services/ # Business logic
192
- │ ā”œā”€ā”€ utils/ # Utilities
193
- │ └── config/ # Configuration
194
- ā”œā”€ā”€ tests/ # Test files
195
- ā”œā”€ā”€ docs/ # Documentation
196
- ā”œā”€ā”€ Dockerfile # Docker configuration
197
- ā”œā”€ā”€ docker-compose.yml # Development environment
198
- ā”œā”€ā”€ .github/workflows/ # CI/CD workflows
199
- ā”œā”€ā”€ package.json # Dependencies
200
- ā”œā”€ā”€ .env.example # Environment template
201
- └── README.md # Project documentation
202
- ```
203
-
204
- ## šŸ”§ Configuration
205
-
206
- ### CLI Options
207
-
208
- ```bash
209
- Options:
210
- -t, --tech <technology> Specify technology (node, python, java, go, rust, php)
211
- -d, --database <database> Specify database (mongodb, postgresql, mysql, sqlite, redis)
212
- -f, --framework <framework> Specify framework (express, fastapi, spring, gin, etc.)
213
- --template <template> Use specific template
214
- --no-interactive Skip interactive prompts
215
- --docker Include Docker configuration
216
- --tests Include test setup
217
- --ci Include CI/CD configuration
218
- ```
219
-
220
- ### Environment Variables
221
-
222
- ```bash
223
- # Server
224
- PORT=3000
225
- NODE_ENV=development
226
-
227
- # Database
228
- DATABASE_URL=mongodb://localhost:27017/myapp
229
- DB_NAME=myapp
230
-
231
- # Security
232
- JWT_SECRET=your-secret-key
233
- CORS_ORIGINS=http://localhost:3000
234
-
235
- # Logging
236
- LOG_LEVEL=info
237
- ```
238
-
239
- ## šŸ“” API Endpoints
240
-
241
- Every generated project includes these standard endpoints:
242
-
243
- ### Health Check
244
- ```http
245
- GET /health
246
- ```
247
-
248
- ### User Management
249
- ```http
250
- GET /api/users # Get all users
251
- GET /api/users/:id # Get user by ID
252
- POST /api/users # Create new user
253
- PUT /api/users/:id # Update user
254
- DELETE /api/users/:id # Delete user
255
- ```
256
-
257
- ## 🐳 Docker Support
258
-
259
- Generated projects include:
260
-
261
- ### Multi-stage Dockerfile
262
- Optimized for production builds with security best practices.
263
-
264
- ### Docker Compose
265
- Complete development environment with database and services.
266
-
267
- ### Example docker-compose.yml
268
- ```yaml
269
- version: '3.8'
270
- services:
271
- api:
272
- build: .
273
- ports:
274
- - "3000:3000"
275
- depends_on:
276
- - mongodb
277
- environment:
278
- - DATABASE_URL=mongodb://mongodb:27017/myapp
279
-
280
- mongodb:
281
- image: mongo:7.0
282
- ports:
283
- - "27017:27017"
284
- volumes:
285
- - mongodb_data:/data/db
286
-
287
- volumes:
288
- mongodb_data:
289
- ```
290
-
291
- ## 🧪 Testing
292
-
293
- Generated projects include comprehensive test setups:
294
-
295
- ### Node.js
296
- ```bash
297
- npm test # Run tests
298
- npm run test:watch # Watch mode
299
- npm run test:coverage # Coverage report
300
- ```
301
-
302
- ### Python
303
- ```bash
304
- pytest # Run tests
305
- pytest --cov # Coverage report
306
- pytest -v # Verbose output
307
- ```
308
-
309
- ### Java
310
- ```bash
311
- mvn test # Run tests
312
- mvn verify # Run with integration tests
313
- ```
314
-
315
- ### Go
316
- ```bash
317
- go test ./... # Run all tests
318
- go test -v ./... # Verbose output
319
- go test -cover ./... # Coverage report
320
- ```
321
-
322
- ### Rust
323
- ```bash
324
- cargo test # Run tests
325
- cargo test -- --nocapture # Verbose output
326
- ```
327
-
328
- ## šŸ”’ Security Features
329
-
330
- - **Input Validation**: Comprehensive validation using appropriate libraries
331
- - **SQL Injection Prevention**: ORM usage with parameterized queries
332
- - **XSS Protection**: Content Security Policy and input sanitization
333
- - **CORS Configuration**: Proper CORS setup for APIs
334
- - **Security Headers**: Helmet.js (Node.js) or equivalent
335
- - **JWT Authentication**: Secure token-based authentication
336
- - **Rate Limiting**: Built-in rate limiting support
337
-
338
- ## šŸ“ˆ Performance Features
339
-
340
- - **Connection Pooling**: Database connection management
341
- - **Caching**: Redis integration support
342
- - **Async Operations**: Full async/await support where applicable
343
- - **Compression**: Gzip/Brotli compression
344
- - **Error Handling**: Comprehensive error handling and logging
345
- - **Health Checks**: Application health monitoring
346
-
347
- ## šŸš€ Deployment
348
-
349
- ### Heroku
350
- ```bash
351
- heroku create your-app-name
352
- git push heroku main
353
- ```
354
-
355
- ### Vercel
356
- ```bash
357
- npm i -g vercel
358
- vercel --prod
359
- ```
360
-
361
- ### Railway
362
- ```bash
363
- railway login
364
- railway init
365
- railway up
366
- ```
367
-
368
- ### AWS
369
- ```bash
370
- # Using Docker
371
- docker build -t my-app .
372
- docker run -p 3000:3000 my-app
373
- ```
374
-
375
- ## šŸ¤ Contributing
376
-
377
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
378
-
379
- ### Development Setup
380
-
381
- ```bash
382
- git clone https://github.com/openwork-agent/openwork-agent.git
48
+ <hr/>
49
+
50
+ <h2>✨ Key Features</h2>
51
+
52
+ <ul>
53
+ <li>šŸŒ Multi-language & multi-framework support</li>
54
+ <li>šŸŽÆ Production-ready project structure</li>
55
+ <li>šŸ—„ļø Database integration out of the box</li>
56
+ <li>🐳 Docker & docker-compose included</li>
57
+ <li>šŸš€ CI/CD with GitHub Actions</li>
58
+ <li>šŸ” Authentication, validation & security defaults</li>
59
+ <li>šŸ’¬ Interactive & CLI-based usage</li>
60
+ <li>šŸ“‹ Customizable template system</li>
61
+ </ul>
62
+
63
+ <hr/>
64
+
65
+ <h2 id="installation">šŸ“¦ Installation</h2>
66
+
67
+ <h3>Quick Run (Recommended)</h3>
68
+ <pre><code>npx openwork-agent create my-api</code></pre>
69
+
70
+ <h3>Global Install</h3>
71
+ <pre><code>npm install -g openwork-agent</code></pre>
72
+
73
+ <h3>Yarn / pnpm</h3>
74
+ <pre><code>yarn global add openwork-agent
75
+ pnpm add -g openwork-agent</code></pre>
76
+
77
+ <hr/>
78
+
79
+ <h2 id="quick-start">šŸš€ Quick Start</h2>
80
+
81
+ <h3>Interactive Mode</h3>
82
+ <pre><code>openwork-agent create my-awesome-api</code></pre>
83
+
84
+ <h3>Specific Tech Stack</h3>
85
+ <pre><code>openwork-agent create my-fastapi-app \
86
+ --tech python \
87
+ --framework fastapi \
88
+ --database postgresql
89
+ </code></pre>
90
+
91
+ <h3>Docker + Tests</h3>
92
+ <pre><code>openwork-agent create enterprise-api \
93
+ --tech node \
94
+ --framework express \
95
+ --database mongodb \
96
+ --docker \
97
+ --tests
98
+ </code></pre>
99
+
100
+ <hr/>
101
+
102
+ <h2 id="supported-technologies">🧰 Supported Technologies</h2>
103
+
104
+ <h3>JavaScript / Node.js</h3>
105
+ <ul>
106
+ <li>Express, NestJS, Fastify</li>
107
+ <li>MongoDB, PostgreSQL, MySQL</li>
108
+ </ul>
109
+
110
+ <h3>Python</h3>
111
+ <ul>
112
+ <li>FastAPI, Django, Flask</li>
113
+ <li>PostgreSQL, MongoDB</li>
114
+ </ul>
115
+
116
+ <h3>Java</h3>
117
+ <ul>
118
+ <li>Spring Boot, Quarkus</li>
119
+ <li>MySQL, PostgreSQL</li>
120
+ </ul>
121
+
122
+ <h3>Go</h3>
123
+ <ul>
124
+ <li>Gin, Echo</li>
125
+ </ul>
126
+
127
+ <h3>Rust</h3>
128
+ <ul>
129
+ <li>Actix-web, Axum</li>
130
+ </ul>
131
+
132
+ <h3>PHP</h3>
133
+ <ul>
134
+ <li>Laravel, Symfony</li>
135
+ </ul>
136
+
137
+ <hr/>
138
+
139
+ <h2>šŸ†š Why Choose OpenWork Agent?</h2>
140
+
141
+ <table>
142
+ <thead>
143
+ <tr>
144
+ <th>Feature</th>
145
+ <th>OpenWork Agent</th>
146
+ <th>Yeoman</th>
147
+ <th>Manual Setup</th>
148
+ </tr>
149
+ </thead>
150
+ <tbody>
151
+ <tr>
152
+ <td>Multi-language</td>
153
+ <td>āœ…</td>
154
+ <td>āŒ</td>
155
+ <td>āŒ</td>
156
+ </tr>
157
+ <tr>
158
+ <td>Docker ready</td>
159
+ <td>āœ…</td>
160
+ <td>āŒ</td>
161
+ <td>āŒ</td>
162
+ </tr>
163
+ <tr>
164
+ <td>CI/CD included</td>
165
+ <td>āœ…</td>
166
+ <td>āŒ</td>
167
+ <td>āŒ</td>
168
+ </tr>
169
+ <tr>
170
+ <td>Security defaults</td>
171
+ <td>āœ…</td>
172
+ <td>āŒ</td>
173
+ <td>āŒ</td>
174
+ </tr>
175
+ <tr>
176
+ <td>AI-assisted</td>
177
+ <td>āœ…</td>
178
+ <td>āŒ</td>
179
+ <td>āŒ</td>
180
+ </tr>
181
+ </tbody>
182
+ </table>
183
+
184
+ <hr/>
185
+
186
+ <h2 id="contributing">šŸ¤ Contributing</h2>
187
+
188
+ <pre><code>git clone https://github.com/openwork-agent/openwork-agent.git
383
189
  cd openwork-agent
384
190
  npm install
385
191
  npm test
386
192
  npm link
387
- ```
388
-
389
- ### Adding New Templates
390
-
391
- 1. Create template files in `src/templates/{technology}/`
392
- 2. Add framework support in `TechDetector.js`
393
- 3. Update configuration in generators
394
- 4. Add tests and documentation
395
-
396
- ## šŸ“ License
193
+ </code></pre>
397
194
 
398
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
399
-
400
- ## šŸ™ Acknowledgments
401
-
402
- - Built with ā¤ļø for the developer community
403
- - Thanks to all the amazing open-source projects
404
- - Inspired by the need for rapid backend development
405
-
406
- ## šŸ“ž Support
407
-
408
- - šŸ“§ Email: [manoj.sharma@example.com](mailto:manoj.sharma@example.com)
409
- - šŸ’¼ LinkedIn: [Manoj Sharma](https://linkedin.com/in/manoj-sharma)
410
- - šŸ› Issues: [GitHub Issues](https://github.com/manoj1234-ms/openwork-agent/issues)
411
- - šŸ“– Documentation: [GitHub README](https://github.com/manoj1234-ms/openwork-agent#readme)
412
-
413
- ## šŸ—ŗļø Roadmap
414
-
415
- - [ ] GraphQL template support
416
- - [ ] Frontend template generation
417
- - [ ] Microservice templates
418
- - [ ] Real-time features (WebSocket)
419
- - [ ] Advanced authentication patterns
420
- - [ ] Monitoring and observability
421
- - [ ] Cloud deployment templates
422
- - [ ] Template marketplace
423
-
424
- ---
195
+ <hr/>
425
196
 
426
197
  <div align="center">
427
198
 
428
- **⭐ Star this repo if it helped you!**
199
+ <p><strong>⭐ Star this repo if it helped you!</strong></p>
429
200
 
430
- Built with ā¤ļø by [Manoj Sharma](https://github.com/manoj1234-ms)
201
+ <p>
202
+ Built with ā¤ļø by <strong>Manoj Sharma</strong>
203
+ </p>
431
204
 
432
- [![GitHub stars](https://img.shields.io/github/stars/openwork-agent/openwork-agent?style=social)](https://github.com/openwork-agent/openwork-agent)
433
- [![GitHub forks](https://img.shields.io/github/forks/openwork-agent/openwork-agent?style=social)](https://github.com/openwork-agent/openwork-agent)
434
- [![GitHub issues](https://img.shields.io/github/issues/openwork-agent/openwork-agent)](https://github.com/openwork-agent/openwork-agent/issues)
435
-
436
- </div>
205
+ </div>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../src/index');
package/package.json CHANGED
@@ -1,43 +1,40 @@
1
1
  {
2
2
  "name": "openwork-agent",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "AI-powered backend code generator for any technology stack. Create complete backend projects with just a few commands!",
5
- "main": "src/index.js",
5
+ "bin": {
6
+ "openwork-agent": "./bin/openwork-agent.js"
7
+ },
6
8
  "files": [
7
- "bin/",
8
9
  "src/",
9
10
  "templates/",
10
11
  "README.md",
11
12
  "LICENSE"
12
13
  ],
13
14
  "scripts": {
14
- "start": "node src/index.js",
15
- "dev": "node src/index.js",
15
+ "start": "node src/main.js",
16
+ "dev": "node src/main.js",
16
17
  "test": "jest",
17
18
  "lint": "eslint src/**/*.js",
18
- "prepare": "echo 'Package ready for publishing'"
19
+ "prepare": "echo \"Package ready for publishing\""
19
20
  },
20
21
  "keywords": [
21
- "generator",
22
+ "cli",
22
23
  "backend",
23
- "api",
24
+ "code-generator",
24
25
  "scaffold",
25
- "cli",
26
+ "boilerplate",
27
+ "starter",
28
+ "api",
26
29
  "nodejs",
27
30
  "python",
28
31
  "java",
29
32
  "go",
30
33
  "rust",
31
34
  "typescript",
32
- "mern",
33
- "mean",
34
35
  "fullstack",
35
- "starter",
36
- "boilerplate",
37
- "template",
38
- "code-generator",
39
- "automation",
40
- "developer-tools"
36
+ "developer-tools",
37
+ "automation"
41
38
  ],
42
39
  "author": {
43
40
  "name": "Manoj Sharma",
@@ -65,12 +62,11 @@
65
62
  "yaml": "^2.3.1"
66
63
  },
67
64
  "devDependencies": {
68
- "@babel/core": "^7.28.6",
69
- "@babel/preset-env": "^7.28.6",
70
- "babel-jest": "^30.2.0",
71
- "dotenv": "^17.2.3",
72
65
  "eslint": "^8.42.0",
73
- "jest": "^29.5.0"
66
+ "jest": "^29.5.0",
67
+ "babel-jest": "^29.5.0",
68
+ "@babel/core": "^7.28.6",
69
+ "@babel/preset-env": "^7.28.6"
74
70
  },
75
71
  "engines": {
76
72
  "node": ">=14.0.0"
@@ -1,4 +1,4 @@
1
- const inquirer = require('inquirer');
1
+ const inquirer = require('inquirer').default;
2
2
  const chalk = require('chalk');
3
3
  const ora = require('ora');
4
4
  const fs = require('fs-extra');
@@ -31,7 +31,7 @@ class ProjectGenerator {
31
31
  name: `${tech.toUpperCase()} - ${recommended[tech]?.reason || 'Popular backend technology'}`,
32
32
  value: tech
33
33
  })),
34
- new inquirer.Separator()
34
+ { name: '──────────────', disabled: true }
35
35
  ]
36
36
  });
37
37
  }
package/src/index.js CHANGED
@@ -1,152 +1,108 @@
1
- #!/usr/bin/env node
2
-
3
1
  const { Command } = require('commander');
4
- const inquirer = require('inquirer');
5
2
  const chalk = require('chalk');
6
- const fs = require('fs-extra');
7
- const path = require('path');
8
3
 
9
- const ProjectGenerator = require('./generators');
4
+ const ProjectGenerator = require('./generators/ProjectGenerator');
10
5
  const TechDetector = require('./core/TechDetector');
11
- const FileManager = require('./utils/FileManager');
12
6
 
13
7
  const program = new Command();
14
8
 
9
+ /**
10
+ * CLI metadata
11
+ */
15
12
  program
16
13
  .name('openwork-agent')
17
14
  .description('AI-powered backend code generator for any technology stack')
18
15
  .version('1.0.0');
19
16
 
17
+ /**
18
+ * CREATE COMMAND
19
+ */
20
20
  program
21
- .command('create <project-name>')
21
+ .command('create <projectName>')
22
22
  .description('Create a new backend project')
23
- .option('-t, --tech <technology>', 'Specify technology (node, python, java, go, rust, php, etc.)')
24
- .option('-d, --database <database>', 'Specify database (mongodb, postgresql, mysql, sqlite, etc.)')
25
- .option('-f, --framework <framework>', 'Specify framework (express, fastapi, spring, gin, etc.)')
26
- .option('--template <template>', 'Use specific template')
27
- .option('--no-interactive', 'Skip interactive prompts')
28
- .option('--docker', 'Include Docker configuration')
29
- .option('--tests', 'Include test setup')
23
+ .option('-t, --tech <technology>', 'Technology (node, python, java, etc)')
24
+ .option('-d, --database <database>', 'Database (postgresql, mongodb, mysql, etc)')
25
+ .option('-f, --framework <framework>', 'Framework (express, fastapi, nestjs, etc)')
26
+ .option('--template <template>', 'Project template')
27
+ .option('--no-interactive', 'Disable interactive mode')
28
+ .option('--docker', 'Include Docker setup')
29
+ .option('--tests', 'Include tests')
30
+ .option('--ci', 'Include CI/CD')
30
31
  .action(async (projectName, options) => {
31
32
  try {
32
- console.log(chalk.blue.bold('\nšŸš€ OpenWork Agent - Backend Code Generator'));
33
- console.log(chalk.gray('Creating your backend project...\n'));
33
+ console.log(chalk.blue.bold('\nšŸš€ OpenWork Agent'));
34
34
 
35
35
  const generator = new ProjectGenerator();
36
-
36
+
37
37
  let config = {
38
38
  projectName,
39
39
  technology: options.tech,
40
40
  database: options.database,
41
41
  framework: options.framework,
42
42
  template: options.template,
43
- interactive: options.interactive,
44
- includeDocker: options.docker,
45
- includeTests: options.tests
43
+ interactive: options.interactive !== false,
44
+ includeDocker: !!options.docker,
45
+ includeTests: !!options.tests,
46
+ includeCI: !!options.ci
46
47
  };
47
48
 
49
+ // Interactive prompt (only if enabled and missing values)
48
50
  if (config.interactive && !config.technology) {
49
51
  config = await generator.promptForConfiguration(config);
50
52
  }
51
53
 
52
54
  await generator.createProject(config);
53
-
55
+
54
56
  console.log(chalk.green.bold('\nāœ… Project created successfully!'));
55
- console.log(chalk.cyan(`\nNext steps:`));
56
- console.log(chalk.white(` cd ${projectName}`));
57
-
58
- // Show setup commands based on technology
59
- const setupCommands = generator.getSetupCommands(config.technology);
60
- setupCommands.forEach(cmd => {
61
- console.log(chalk.white(` ${cmd}`));
62
- });
63
-
64
- } catch (error) {
65
- console.error(chalk.red.bold('\nāŒ Error:'), error.message);
57
+ } catch (err) {
58
+ console.error(chalk.red('\nāŒ Error:'), err.message);
66
59
  process.exit(1);
67
60
  }
68
61
  });
69
62
 
63
+ /**
64
+ * ANALYZE COMMAND
65
+ */
70
66
  program
71
67
  .command('analyze')
72
- .description('Analyze current directory and suggest technology stack')
68
+ .description('Analyze current directory and detect technology')
73
69
  .action(async () => {
74
- try {
75
- const detector = new TechDetector();
76
- const analysis = await detector.analyzeCurrentDirectory();
77
-
78
- console.log(chalk.blue.bold('\nšŸ“Š Technology Analysis'));
79
-
80
- if (analysis.technologies.length > 0) {
81
- console.log(chalk.yellow('\nDetected Technologies:'));
82
- analysis.technologies.forEach(tech => {
83
- const confidence = Math.round(analysis.confidence[tech] * 100);
84
- console.log(chalk.white(` ${tech}: ${confidence}% confidence`));
85
- });
86
- }
87
-
88
- if (analysis.frameworks.length > 0) {
89
- console.log(chalk.yellow('\nDetected Frameworks:'));
90
- analysis.frameworks.forEach(fw => {
91
- console.log(chalk.white(` ${fw.technology}: ${fw.framework}`));
92
- });
93
- }
94
-
95
- if (analysis.databases.length > 0) {
96
- console.log(chalk.yellow('\nDetected Databases:'));
97
- analysis.databases.forEach(db => {
98
- console.log(chalk.white(` ${db}`));
99
- });
100
- }
101
-
102
- } catch (error) {
103
- console.error(chalk.red.bold('\nāŒ Error:'), error.message);
104
- process.exit(1);
105
- }
70
+ const detector = new TechDetector();
71
+ const result = await detector.analyzeCurrentDirectory();
72
+ console.log(result);
106
73
  });
107
74
 
75
+ /**
76
+ * LIST TECHNOLOGIES
77
+ */
108
78
  program
109
- .command('templates')
110
- .description('List available templates')
79
+ .command('list')
80
+ .description('List supported technologies')
111
81
  .action(() => {
112
- const templates = [
113
- { name: 'express-api', tech: 'node', description: 'Express.js REST API with TypeScript' },
114
- { name: 'fastapi-crud', tech: 'python', description: 'FastAPI CRUD operations with SQLAlchemy' },
115
- { name: 'spring-boot', tech: 'java', description: 'Spring Boot microservice with JPA' },
116
- { name: 'go-gin', tech: 'go', description: 'Go Gin web service with GORM' },
117
- { name: 'rust-actix', tech: 'rust', description: 'Actix-web API with Diesel ORM' },
118
- { name: 'django-api', tech: 'python', description: 'Django REST API' },
119
- { name: 'nestjs-api', tech: 'node', description: 'NestJS API with PostgreSQL' },
120
- { name: 'laravel-api', tech: 'php', description: 'Laravel REST API' }
121
- ];
122
-
123
- console.log(chalk.blue.bold('\nšŸ“‹ Available Templates'));
124
- templates.forEach((template, index) => {
125
- console.log(chalk.cyan(`${index + 1}. ${template.name}`));
126
- console.log(chalk.gray(` Tech: ${template.tech} - ${template.description}`));
127
- });
82
+ const detector = new TechDetector();
83
+ console.log(detector.getAvailableTechnologies());
128
84
  });
129
85
 
86
+ /**
87
+ * TEMPLATES
88
+ */
130
89
  program
131
- .command('list')
132
- .description('List supported technologies and frameworks')
90
+ .command('templates')
91
+ .description('List available templates')
133
92
  .action(() => {
134
- const detector = new TechDetector();
135
- const technologies = detector.getAvailableTechnologies();
136
-
137
- console.log(chalk.blue.bold('\nšŸ”§ Supported Technologies:'));
138
- technologies.forEach(tech => {
139
- const frameworks = detector.getFrameworksForTechnology(tech);
140
- console.log(chalk.cyan(`\n${tech}:`));
141
- frameworks.forEach(fw => {
142
- console.log(chalk.white(` - ${fw}`));
143
- });
144
- });
145
-
146
- console.log(chalk.green.bold('\nšŸ’¾ Supported Databases:'));
147
- detector.getAvailableDatabases().forEach(db => {
148
- console.log(chalk.white(` - ${db}`));
149
- });
93
+ console.log([
94
+ 'api',
95
+ 'crud',
96
+ 'microservice',
97
+ 'graphql',
98
+ 'minimal'
99
+ ]);
150
100
  });
151
101
 
152
- program.parse();
102
+ /**
103
+ * IMPORTANT:
104
+ * parse() must be here and ONLY here
105
+ */
106
+ program.parse(process.argv);
107
+
108
+ module.exports = program;
package/src/main.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // Fix the ProjectGenerator import issue
4
- const ProjectGenerator = require('./generators/ProjectGenerator');
5
- require('./generators/ProjectGeneratorExtensions');
6
-
7
- // Re-export the main entry point
8
- require('./index');