@diagramers/cli 4.0.0 β†’ 4.0.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 (2) hide show
  1. package/README.md +413 -642
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,31 +1,60 @@
1
- # Diagramers CLI
1
+ # @diagramers/cli
2
2
 
3
- A powerful command-line interface for managing Diagramers projects, generating modules, and extending functionality with a comprehensive template system.
3
+ A powerful command-line interface for scaffolding and managing Diagramers projects. The CLI provides comprehensive tools for creating, managing, and extending API and admin dashboard projects with advanced features and automation.
4
4
 
5
5
  ## πŸš€ Features
6
6
 
7
- ### Core Capabilities
8
- - **Project Initialization** - Create new projects from templates
9
- - **Module Generation** - Generate complete modules with CRUD operations
10
- - **Table Generation** - Add database tables to existing modules
11
- - **Endpoint Generation** - Add custom endpoints to existing modules
12
- - **Relation Management** - Generate database relations within modules
13
- - **Feature Extension** - Add features to existing projects
14
- - **Template Management** - Download and update project templates
15
-
16
- ### Supported Templates
17
- - **API Projects** - Full-featured Node.js API with TypeScript
18
- - **Admin Projects** - Modern admin dashboard with React/Vue/Angular support
19
- - **Custom Templates** - Extensible template system
20
-
21
- ### Database Support
22
- - **MongoDB** - Primary database with Mongoose schemas
23
- - **SQL Databases** - MySQL, PostgreSQL, SQLite support
24
- - **Schema Generation** - Automatic schema and relation creation
7
+ ### Project Management
8
+ - **Project Scaffolding** - Create new API and admin projects from templates
9
+ - **Template Management** - Manage and update project templates
10
+ - **Project Initialization** - Automated project setup and configuration
11
+ - **Environment Setup** - Automatic environment variable configuration
12
+ - **Git Integration** - Automatic Git repository initialization
13
+
14
+ ### Module & Feature Generation
15
+ - **Module Generation** - Create complete modules with CRUD operations
16
+ - **Table Generation** - Generate database tables with relationships
17
+ - **Endpoint Generation** - Create custom API endpoints
18
+ - **Relation Generation** - Set up database relationships (one-to-one, one-to-many, many-to-many)
19
+ - **Feature Extension** - Extend existing modules with new functionality
20
+
21
+ ### Database Management
22
+ - **Database Seeding** - Generate and run database seeders
23
+ - **Migration Support** - Create and manage database migrations
24
+ - **Schema Generation** - Auto-generate database schemas
25
+ - **Relationship Management** - Handle complex database relationships
26
+ - **Data Validation** - Generate validation rules and schemas
27
+
28
+ ### Development Tools
29
+ - **Code Generation** - Generate TypeScript interfaces, services, and controllers
30
+ - **API Documentation** - Auto-generate Swagger/OpenAPI documentation
31
+ - **Testing Setup** - Generate test files and testing configurations
32
+ - **Linting & Formatting** - Set up code quality tools
33
+ - **Build Configuration** - Generate build and deployment configurations
34
+
35
+ ### Authentication & Security
36
+ - **Auth Module Generation** - Generate authentication modules
37
+ - **Provider Integration** - Set up OAuth, SMS, and email providers
38
+ - **Security Configuration** - Configure JWT, CORS, and security headers
39
+ - **Role & Permission System** - Generate role-based access control
40
+ - **Multi-factor Authentication** - Set up MFA providers
41
+
42
+ ### Communication Services
43
+ - **Email System Setup** - Configure email providers and templates
44
+ - **SMS Integration** - Set up SMS providers for notifications
45
+ - **Push Notifications** - Configure push notification services
46
+ - **Webhook Management** - Set up webhook endpoints and handlers
47
+
48
+ ### Deployment & DevOps
49
+ - **Docker Configuration** - Generate Docker and Docker Compose files
50
+ - **CI/CD Setup** - Create GitHub Actions and other CI/CD configurations
51
+ - **Environment Management** - Manage multiple environment configurations
52
+ - **Monitoring Setup** - Configure logging and monitoring tools
53
+ - **Backup Configuration** - Set up automated backup systems
25
54
 
26
55
  ## πŸ“¦ Installation
27
56
 
28
- ### Global Installation
57
+ ### Global Installation (Recommended)
29
58
  ```bash
30
59
  npm install -g @diagramers/cli
31
60
  ```
@@ -33,805 +62,547 @@ npm install -g @diagramers/cli
33
62
  ### Local Installation
34
63
  ```bash
35
64
  npm install @diagramers/cli
36
- npx diagramers --help
65
+ npx diagramers-cli --help
37
66
  ```
38
67
 
39
- ## πŸš€ Quick Start
40
-
68
+ ### Development Installation
41
69
  ```bash
42
- # Install the CLI globally
43
- npm install -g @diagramers/cli
70
+ git clone https://github.com/diagramers/diagramers-cli.git
71
+ cd diagramers-cli
72
+ npm install
73
+ npm link
74
+ ```
75
+
76
+ ## πŸ› οΈ Quick Start
44
77
 
78
+ ### 1. Create a New API Project
79
+ ```bash
45
80
  # Create a new API project
46
- diagramers init api my-new-api
81
+ diagramers init api my-api-project
47
82
 
48
83
  # Navigate to the project
49
- cd my-new-api
50
-
51
- # Set up environment variables
52
- cp .env.example .env
84
+ cd my-api-project
53
85
 
54
86
  # Install dependencies
55
- npm install
56
-
57
- # Start development
58
- npm start
59
- ```
60
-
61
- ## πŸ“‹ Commands
62
-
63
- ### Project Management
87
+ npm install --legacy-peer-deps
64
88
 
65
- #### Initialize New Project
66
- ```bash
67
- diagramers init <template-type> <project-name> [options]
89
+ # Start development server
90
+ npm run dev
68
91
  ```
69
92
 
70
- **Options:**
71
- - `-v, --version <version>` - Specific version of the template to use (e.g., 1.1.17, latest)
72
- - `-t, --template <template>` - Template version to use (deprecated, use --version)
73
- - `-y, --yes` - Skip prompts and use defaults
74
-
75
- **Examples:**
93
+ ### 2. Create a New Admin Dashboard
76
94
  ```bash
77
- # Create API project with latest version
78
- diagramers init api my-api-project
79
-
80
- # Create API project with specific version
81
- diagramers init api my-api-project -v 1.1.17
82
-
83
- # Create admin project with specific version
84
- diagramers admin init react-typescript my-admin-dashboard -v 1.0.0
85
- ```
95
+ # Create a new admin dashboard
96
+ diagramers init admin my-admin-dashboard
86
97
 
87
- #### Update Project
98
+ # Navigate to the project
99
+ cd my-admin-dashboard
88
100
 
89
- Update an existing project with the latest template features:
101
+ # Install dependencies
102
+ npm install --legacy-peer-deps
90
103
 
91
- ```bash
92
- diagramers update [options]
104
+ # Start development server
105
+ npm start
93
106
  ```
94
107
 
95
- **Options:**
96
- - `-v, --version <version>` - Specific version to update to (e.g., 1.1.27, latest)
97
- - `-f, --force` - Force update even if conflicts detected
98
- - `-b, --backup` - Create backup before updating
99
-
100
- **Examples:**
108
+ ### 3. Generate Your First Module
101
109
  ```bash
102
- # Update to latest version
103
- diagramers update
104
-
105
- # Update to specific version
106
- diagramers update -v 1.1.27
110
+ # Generate a products module with CRUD operations
111
+ diagramers extend --module products --crud
107
112
 
108
- # Force update (overwrite conflicts)
109
- diagramers update --force
113
+ # Add categories table to products module
114
+ diagramers extend --table products:categories --fields name,description,slug
110
115
 
111
- # Create backup before updating
112
- diagramers update --backup
116
+ # Add products table to products module
117
+ diagramers extend --table products:products --fields name,price,description,category_id
113
118
 
114
- # Combine options
115
- diagramers update -v 1.1.27 --backup --force
119
+ # Create relationship between categories and products
120
+ diagramers extend --relation products:category-product:one-to-many
116
121
  ```
117
122
 
118
- #### What Gets Updated
119
-
120
- The update command intelligently updates the following:
121
-
122
- - **Core Files**: `src/core/`, `src/shared/`, `src/plugins/`
123
- - **Configuration**: `config/` folder, `webpack.config.js`, `tsconfig.json`
124
- - **Scripts**: `scripts/` folder with utility scripts
125
- - **Documentation**: `README.md`, `DEVELOPER_GUIDE.md`
126
- - **Environment**: `.env.example` template
127
- - **Package.json**: Updates dependencies and scripts while preserving project-specific fields
123
+ ### 4. Add Custom Endpoints
124
+ ```bash
125
+ # Add search endpoint
126
+ diagramers extend --endpoint products:search --method GET --description "Search products"
128
127
 
129
- #### Version Management
128
+ # Add featured products endpoint
129
+ diagramers extend --endpoint products:featured --method GET --description "Get featured products"
130
+ ```
130
131
 
131
- - **Automatic Version Sync**: Project version is updated to match template version
132
- - **Project Preservation**: Project-specific fields (name, description, repository, etc.) are preserved
133
- - **Conflict Detection**: Detects conflicts and allows force overwrite
134
- - **Backup Support**: Creates timestamped backups before updating
132
+ ## πŸ“š CLI Commands
135
133
 
136
- #### Update Process
134
+ ### Project Management Commands
137
135
 
138
- 1. **Validation**: Checks if current directory is a valid project
139
- 2. **Version Check**: Shows current project version vs target version
140
- 3. **Backup**: Creates backup if requested
141
- 4. **Download**: Downloads latest template from npm
142
- 5. **Conflict Check**: Identifies files with conflicts
143
- 6. **Update**: Updates files while preserving project-specific settings
144
- 7. **Cleanup**: Removes temporary files
136
+ #### Initialize Projects
137
+ ```bash
138
+ # Initialize API project
139
+ diagramers init api <project-name> [options]
145
140
 
146
- #### Example Output
141
+ # Initialize admin dashboard
142
+ diagramers init admin <project-name> [options]
147
143
 
148
- ```bash
149
- πŸ”„ Checking for template updates...
150
- πŸ“¦ Current project version: 1.1.26
151
- πŸ“Œ Updating to latest version
152
- πŸ“¦ Downloading latest template: @diagramers/api
153
- βœ… Template downloaded from npm: @diagramers/api
154
- πŸ“ Updating project files...
155
- βœ… Updated: src/core/config/index.ts
156
- βœ… Updated: scripts/env-debug.js
157
- βœ… Updated: package.json (version: 1.1.27)
158
- βœ… Project updated successfully!
159
- πŸ“¦ Template version: 1.1.27
160
- πŸ“ Review the changes and test your application
161
- πŸ’‘ Run "npm install" to update dependencies if needed
162
- ```
144
+ # Initialize both API and admin projects
145
+ diagramers init <project-name> --api --admin
163
146
 
164
- #### List Available Versions
165
- ```bash
166
- diagramers versions [options]
147
+ # Initialize with specific template version
148
+ diagramers init api <project-name> --version 4.0.1
167
149
  ```
168
150
 
169
- **Options:**
170
- - `-a, --all` - Show all versions (default: show last 10)
171
-
172
- **Examples:**
151
+ #### Project Options
173
152
  ```bash
174
- # Show last 10 versions
175
- diagramers versions
153
+ # Initialize with custom configuration
154
+ diagramers init api <project-name> \
155
+ --database mongodb \
156
+ --auth internal,oauth,sms \
157
+ --email sendgrid \
158
+ --deploy firebase
176
159
 
177
- # Show all available versions
178
- diagramers versions --all
160
+ # Initialize with specific features
161
+ diagramers init api <project-name> \
162
+ --features auth,email,sms,notifications,file-upload \
163
+ --providers google,github,twilio,sendgrid
179
164
  ```
180
165
 
181
- ### Module Management
182
-
183
- #### Generate Module
184
- ```bash
185
- diagramers extend --module <module-name> [options]
186
- ```
166
+ ### Module Management Commands
187
167
 
188
- **Examples:**
168
+ #### Generate Modules
189
169
  ```bash
190
170
  # Generate basic module
191
- diagramers extend --module products
171
+ diagramers extend --module <module-name>
192
172
 
193
173
  # Generate module with CRUD operations
194
- diagramers extend --module products --crud
174
+ diagramers extend --module <module-name> --crud
195
175
 
196
- # Generate module with custom fields
197
- diagramers extend --module products --fields name,price,description --crud
198
- ```
176
+ # Generate module with specific fields
177
+ diagramers extend --module users --fields email,username,role,is_active --crud
199
178
 
200
- ### Table Management
179
+ # Generate module with authentication
180
+ diagramers extend --module auth --auth --providers internal,oauth,sms
201
181
 
202
- #### Add Table to Module
203
- ```bash
204
- diagramers extend --table <module:table> --fields <field1,field2,...>
182
+ # Generate module with custom configuration
183
+ diagramers extend --module products \
184
+ --fields name,price,description,category_id \
185
+ --crud \
186
+ --validation \
187
+ --tests \
188
+ --docs
205
189
  ```
206
190
 
207
- **Examples:**
191
+ #### Module Options
208
192
  ```bash
209
- # Add categories table to products module
210
- diagramers extend --table products:categories --fields name,description,slug
211
-
212
- # Add products table to products module
213
- diagramers extend --table products:products --fields name,price,category_id
193
+ # Generate with specific features
194
+ diagramers extend --module <module-name> \
195
+ --crud \
196
+ --validation \
197
+ --tests \
198
+ --docs \
199
+ --migrations \
200
+ --seeders
214
201
 
215
- # Add user profiles table to users module
216
- diagramers extend --table users:profiles --fields bio,avatar,social_links
202
+ # Generate with custom paths
203
+ diagramers extend --module <module-name> \
204
+ --path src/modules/custom \
205
+ --template custom-template
217
206
  ```
218
207
 
219
- **Field Types (Auto-detected):**
220
- - `name`, `title`, `description` β†’ String
221
- - `email`, `phone` β†’ String
222
- - `price`, `count`, `age` β†’ Number
223
- - `created_at`, `updated_at` β†’ Date
224
- - `is_active`, `verified` β†’ Boolean
225
- - `*_id` β†’ ObjectId
226
- - `status` β†’ Number
227
-
228
- ### Endpoint Management
229
-
230
- #### Add Endpoint to Module
231
- ```bash
232
- diagramers extend --endpoint <module:endpoint> [options]
233
- ```
208
+ ### Table Generation Commands
234
209
 
235
- **Examples:**
210
+ #### Generate Tables
236
211
  ```bash
237
- # Add GET endpoint
238
- diagramers extend --endpoint products:search --method GET
212
+ # Add table to existing module
213
+ diagramers extend --table <module>:<table> --fields <field1>,<field2>
239
214
 
240
- # Add POST endpoint
241
- diagramers extend --endpoint users:reset-password --method POST
215
+ # Generate table with various field types
216
+ diagramers extend --table users:profiles \
217
+ --fields bio,avatar,birth_date,is_verified,preferences
242
218
 
243
- # Add endpoint with custom path
244
- diagramers extend --endpoint products:featured --method GET --path /featured --description "Get featured products"
245
- ```
246
-
247
- **Supported Methods:**
248
- - `GET` - Retrieve data
249
- - `POST` - Create data
250
- - `PUT` - Update data
251
- - `DELETE` - Delete data
252
-
253
- ### Relation Management
219
+ # Generate table with relationships
220
+ diagramers extend --table products:categories \
221
+ --fields name,description,slug,parent_id \
222
+ --relations parent:categories:one-to-many
254
223
 
255
- #### Create Relations Within Module
256
- ```bash
257
- diagramers extend --relation <module:table1-table2[:type]>
224
+ # Generate table with indexes
225
+ diagramers extend --table products:products \
226
+ --fields name,price,description,category_id,sku \
227
+ --indexes name,sku,category_id
258
228
  ```
259
229
 
260
- **Examples:**
230
+ #### Field Types
261
231
  ```bash
262
- # One-to-many relation (default)
263
- diagramers extend --relation products:category-product
232
+ # String fields
233
+ diagramers extend --table users:profiles \
234
+ --fields name:string,email:string,phone:string
264
235
 
265
- # One-to-one relation
266
- diagramers extend --relation users:user-profile:one-to-one
236
+ # Numeric fields
237
+ diagramers extend --table products:products \
238
+ --fields price:number,stock:integer,rating:float
267
239
 
268
- # Many-to-many relation
269
- diagramers extend --relation products:product-tag:many-to-many
270
- ```
240
+ # Date fields
241
+ diagramers extend --table orders:orders \
242
+ --fields created_at:date,updated_at:date,delivery_date:datetime
271
243
 
272
- **Relation Types:**
273
- - `one-to-one` - Single record relations
274
- - `one-to-many` - Parent-child relations (default)
275
- - `many-to-many` - Junction table relations
244
+ # Boolean fields
245
+ diagramers extend --table users:users \
246
+ --fields is_active:boolean,email_verified:boolean
276
247
 
277
- ### Feature Management
248
+ # Object/JSON fields
249
+ diagramers extend --table users:profiles \
250
+ --fields preferences:object,metadata:json
278
251
 
279
- #### List Available Features
280
- ```bash
281
- diagramers extend --list
252
+ # Array fields
253
+ diagramers extend --table products:products \
254
+ --fields tags:array,images:array
282
255
  ```
283
256
 
284
- #### Add Feature
257
+ ### Endpoint Generation Commands
258
+
259
+ #### Generate Endpoints
285
260
  ```bash
286
- diagramers extend --feature <feature-name>
287
- ```
261
+ # Add GET endpoint
262
+ diagramers extend --endpoint <module>:<endpoint> --method GET
288
263
 
289
- ## 🎨 Admin Dashboard Management
264
+ # Add POST endpoint with custom path
265
+ diagramers extend --endpoint users:reset-password --method POST --path /reset-password
290
266
 
291
- The CLI provides comprehensive support for managing admin dashboard projects with modern frameworks and features.
267
+ # Add endpoint with validation
268
+ diagramers extend --endpoint products:create --method POST \
269
+ --validation name:required,price:required:number
292
270
 
293
- ### Admin Project Initialization
271
+ # Add endpoint with authentication
272
+ diagramers extend --endpoint users:profile --method GET \
273
+ --auth required --roles user,admin
294
274
 
295
- #### Initialize New Admin Project
296
- ```bash
297
- diagramers admin init <template-type> <project-name> [options]
275
+ # Add endpoint with custom logic
276
+ diagramers extend --endpoint products:search --method GET \
277
+ --description "Search products with filters" \
278
+ --query name,price_min,price_max,category_id
298
279
  ```
299
280
 
300
- **Template Types:**
301
- - `react-typescript` - React 18 + TypeScript + Tailwind CSS
302
- - `vue-typescript` - Vue 3 + TypeScript + Tailwind CSS
303
- - `angular` - Angular 17 + TypeScript + Tailwind CSS
304
-
305
- **Options:**
306
- - `-f, --framework <framework>` - Framework to use (react, vue, angular)
307
- - `-t, --template <template>` - Template package name
308
- - `-v, --version <version>` - Template version to use
309
- - `-y, --yes` - Skip prompts and use defaults
310
- - `--typescript` - Use TypeScript (default: true)
311
- - `--tailwind` - Use Tailwind CSS (default: true)
312
- - `--api-url <url>` - API URL for the backend
313
- - `--socket-url <url>` - Socket.IO URL for real-time features
314
-
315
- **Examples:**
281
+ #### Endpoint Options
316
282
  ```bash
317
- # Create React admin project
318
- diagramers admin init react-typescript my-admin-app
319
-
320
- # Create Vue admin project with specific version
321
- diagramers admin init vue-typescript my-vue-admin --version 1.0.0
322
-
323
- # Create Angular admin project with custom API URL
324
- diagramers admin init angular my-angular-admin --api-url http://localhost:3000
325
-
326
- # Create with all options
327
- diagramers admin init react-typescript my-admin-app \
328
- --framework react \
329
- --typescript \
330
- --tailwind \
331
- --api-url http://localhost:3000 \
332
- --socket-url http://localhost:3000
333
- ```
334
-
335
- ### Admin Project Extension
283
+ # Generate with specific features
284
+ diagramers extend --endpoint <module>:<endpoint> \
285
+ --method GET \
286
+ --auth required \
287
+ --roles admin \
288
+ --validation \
289
+ --tests \
290
+ --docs \
291
+ --rate-limit 100:1m
336
292
 
337
- #### Extend Admin Project
338
- ```bash
339
- diagramers admin extend [options]
293
+ # Generate with custom response
294
+ diagramers extend --endpoint products:featured \
295
+ --method GET \
296
+ --response "Product[]" \
297
+ --description "Get featured products"
340
298
  ```
341
299
 
342
- **Options:**
343
- - `-p, --page <name>` - Generate a new page
344
- - `-c, --component <name>` - Generate a new component
345
- - `-s, --service <name>` - Generate a new service
346
- - `-h, --hook <name>` - Generate a new custom hook
347
- - `-m, --module <name>` - Generate a complete module with CRUD
348
- - `--crud` - Include CRUD operations for module
349
- - `--api` - Include API integration for module
350
- - `--socket` - Include Socket.IO integration for module
351
- - `--table` - Include data table for module
352
- - `--form` - Include form components for module
353
- - `--chart` - Include chart components for module
354
- - `--auth` - Include authentication for module
355
- - `--path <path>` - Custom path for generated files
356
-
357
- **Examples:**
358
- ```bash
359
- # Generate a new module with CRUD operations
360
- diagramers admin extend --module products --crud --api --table
300
+ ### Relationship Generation Commands
361
301
 
362
- # Generate a new page
363
- diagramers admin extend --page analytics
302
+ #### Generate Relationships
303
+ ```bash
304
+ # One-to-many relation (default)
305
+ diagramers extend --relation <module>:<relation-name>
364
306
 
365
- # Generate a new component
366
- diagramers admin extend --component ProductCard
307
+ # One-to-one relation
308
+ diagramers extend --relation users:user-profile:one-to-one
367
309
 
368
- # Generate a new service
369
- diagramers admin extend --service orderService
310
+ # Many-to-many relation
311
+ diagramers extend --relation products:product-tag:many-to-many
370
312
 
371
- # Generate a new custom hook
372
- diagramers admin extend --hook useOrders
313
+ # Complex relationships
314
+ diagramers extend --relation orders:order-items:one-to-many \
315
+ --through products \
316
+ --fields quantity,price
373
317
 
374
- # Generate complete module with all features
375
- diagramers admin extend --module orders --crud --api --socket --table --form --chart --auth
318
+ # Self-referencing relationships
319
+ diagramers extend --relation categories:parent-child:one-to-many \
320
+ --self-referencing
376
321
  ```
377
322
 
378
- ### Admin Project Updates
323
+ ### Authentication Commands
379
324
 
380
- #### Update Admin Project
325
+ #### Generate Auth Modules
381
326
  ```bash
382
- diagramers admin update [options]
383
- ```
327
+ # Generate basic authentication
328
+ diagramers extend --auth --providers internal
384
329
 
385
- **Options:**
386
- - `-t, --template <template>` - Template to update
387
- - `-v, --version <version>` - Version to update to
388
- - `--force` - Force update even if conflicts exist
389
- - `--backup` - Create backup before updating
330
+ # Generate multi-provider authentication
331
+ diagramers extend --auth --providers internal,oauth,sms,email
390
332
 
391
- **Examples:**
392
- ```bash
393
- # Update to latest version
394
- diagramers admin update
333
+ # Generate OAuth providers
334
+ diagramers extend --auth --providers oauth \
335
+ --oauth google,github,facebook,twitter
395
336
 
396
- # Update to specific version
397
- diagramers admin update --version 1.0.0
337
+ # Generate SMS authentication
338
+ diagramers extend --auth --providers sms \
339
+ --sms twilio,aws-sns,vonage
398
340
 
399
- # Force update with backup
400
- diagramers admin update --force --backup
341
+ # Generate email authentication
342
+ diagramers extend --auth --providers email \
343
+ --email sendgrid,aws-ses,mailgun
401
344
  ```
402
345
 
403
- ### Admin Version Management
404
-
405
- #### Check Admin Version
346
+ #### Auth Configuration
406
347
  ```bash
407
- diagramers admin version [options]
348
+ # Generate with specific features
349
+ diagramers extend --auth \
350
+ --providers internal,oauth,sms \
351
+ --features registration,login,logout,password-reset,email-verification \
352
+ --oauth google,github \
353
+ --sms twilio \
354
+ --jwt \
355
+ --refresh-tokens \
356
+ --rate-limiting
408
357
  ```
409
358
 
410
- **Options:**
411
- - `-c, --check <version>` - Check if specific version exists
359
+ ### Communication Commands
412
360
 
413
- **Examples:**
361
+ #### Generate Email System
414
362
  ```bash
415
- # Show current version info
416
- diagramers admin version
363
+ # Generate email module
364
+ diagramers extend --email --providers sendgrid,aws-ses,mailgun
417
365
 
418
- # Check specific version
419
- diagramers admin version --check 1.0.0
420
- ```
366
+ # Generate email templates
367
+ diagramers extend --email-templates \
368
+ --templates welcome,password-reset,verification,notification
421
369
 
422
- #### List Available Admin Versions
423
- ```bash
424
- diagramers admin versions [options]
370
+ # Generate email configuration
371
+ diagramers extend --email-config \
372
+ --providers sendgrid,aws-ses \
373
+ --templates handlebars
425
374
  ```
426
375
 
427
- **Options:**
428
- - `-a, --all` - Show all versions (default: show last 10)
429
-
430
- **Examples:**
376
+ #### Generate SMS System
431
377
  ```bash
432
- # Show last 10 versions
433
- diagramers admin versions
378
+ # Generate SMS module
379
+ diagramers extend --sms --providers twilio,aws-sns,vonage
434
380
 
435
- # Show all available versions
436
- diagramers admin versions --all
437
- ```
381
+ # Generate SMS templates
382
+ diagramers extend --sms-templates \
383
+ --templates verification,notification,alert
438
384
 
439
- ### Admin Project Features
440
-
441
- #### Available Templates
442
- - **React TypeScript Admin** - React 18 + TypeScript + Tailwind CSS
443
- - **Vue TypeScript Admin** - Vue 3 + TypeScript + Tailwind CSS
444
- - **Angular Admin** - Angular 17 + TypeScript + Tailwind CSS
445
-
446
- #### Built-in Features
447
- - **Authentication System** - Login, register, password reset, JWT management
448
- - **Dashboard** - Analytics overview, metric cards, chart widgets
449
- - **User Management** - User CRUD, profiles, role management, activity tracking
450
- - **Real-time Updates** - Socket.IO integration, live notifications
451
- - **Data Tables** - Advanced filtering, sorting, pagination, bulk actions
452
- - **Charts & Analytics** - Line, bar, pie, area charts with real-time data
453
- - **Form Builder** - Dynamic forms, validation, file uploads, multi-step forms
454
- - **File Upload** - Drag & drop, progress tracking, file preview
455
- - **Notifications** - Toast notifications, notification center, push notifications
456
- - **Settings Panel** - Application settings, user preferences, theme customization
457
-
458
- #### Project Structure
459
- ```
460
- my-admin-app/
461
- β”œβ”€β”€ src/
462
- β”‚ β”œβ”€β”€ components/ # Reusable UI components
463
- β”‚ β”‚ β”œβ”€β”€ ui/ # Base UI components
464
- β”‚ β”‚ └── layout/ # Layout components
465
- β”‚ β”œβ”€β”€ features/ # Feature modules
466
- β”‚ β”‚ β”œβ”€β”€ auth/ # Authentication
467
- β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard
468
- β”‚ β”‚ β”œβ”€β”€ users/ # User management
469
- β”‚ β”‚ └── [modules]/ # Generated modules
470
- β”‚ β”œβ”€β”€ hooks/ # Custom React hooks
471
- β”‚ β”œβ”€β”€ services/ # API services
472
- β”‚ β”œβ”€β”€ lib/ # Utilities and configurations
473
- β”‚ β”œβ”€β”€ types/ # TypeScript type definitions
474
- β”‚ β”œβ”€β”€ styles/ # Global styles
475
- β”‚ └── assets/ # Static assets
476
- β”œβ”€β”€ public/ # Public assets
477
- β”œβ”€β”€ package.json # Dependencies and scripts
478
- β”œβ”€β”€ tsconfig.json # TypeScript configuration
479
- β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
480
- β”œβ”€β”€ vite.config.ts # Vite configuration
481
- └── .env # Environment variables
385
+ # Generate SMS configuration
386
+ diagramers extend --sms-config \
387
+ --providers twilio,aws-sns \
388
+ --features verification,notifications
482
389
  ```
483
390
 
484
- ### Email System Management
391
+ ### Database Commands
485
392
 
486
- #### Generate Email Module
393
+ #### Database Operations
487
394
  ```bash
488
- diagramers extend --module email --crud
489
- ```
490
-
491
- #### Add Email Configuration Table
492
- ```bash
493
- diagramers extend --table email:configs --fields provider,code,credentials,fromName,fromEmail,default
494
- ```
495
-
496
- #### Add Email Templates Table
497
- ```bash
498
- diagramers extend --table email:templates --fields name,subject,body,isActive,createdAt
499
- ```
500
-
501
- #### Add Email Logs Table
502
- ```bash
503
- diagramers extend --table email:logs --fields to,subject,status,provider,error,createdAt
504
- ```
395
+ # Run database seeding
396
+ diagramers db seed
505
397
 
506
- #### Create Email Relations
507
- ```bash
508
- # One-to-many: User to Email Configs
509
- diagramers extend --relation email:user-config:one-to-many
398
+ # Reset and reseed database
399
+ diagramers db seed --reset
510
400
 
511
- # One-to-many: Email Config to Email Logs
512
- diagramers extend --relation email:config-log:one-to-many
513
- ```
401
+ # Generate seeders for specific modules
402
+ diagramers db seed --modules products,users
514
403
 
515
- #### Add Email Endpoints
516
- ```bash
517
- # Send email endpoint
518
- diagramers extend --endpoint email:send --method POST --description "Send email using configured provider"
404
+ # Create database migration
405
+ diagramers db migrate --create <migration-name>
519
406
 
520
- # Test email endpoint
521
- diagramers extend --endpoint email:test --method POST --description "Test email configuration"
407
+ # Run database migrations
408
+ diagramers db migrate --run
522
409
 
523
- # Get email statistics
524
- diagramers extend --endpoint email:stats --method GET --description "Get email sending statistics"
410
+ # Rollback migrations
411
+ diagramers db migrate --rollback
525
412
  ```
526
413
 
527
- #### Email Provider Setup Commands
414
+ #### Database Configuration
528
415
  ```bash
529
- # Add Gmail SMTP configuration
530
- diagramers extend --endpoint email:setup-gmail --method POST --description "Setup Gmail SMTP configuration"
416
+ # Generate database configuration
417
+ diagramers db config --type mongodb --connection-pool 10
531
418
 
532
- # Add SendGrid configuration
533
- diagramers extend --endpoint email:setup-sendgrid --method POST --description "Setup SendGrid configuration"
419
+ # Generate database schemas
420
+ diagramers db schemas --modules products,users,orders
534
421
 
535
- # Add AWS SES configuration
536
- diagramers extend --endpoint email:setup-ses --method POST --description "Setup AWS SES configuration"
422
+ # Generate database indexes
423
+ diagramers db indexes --modules products --indexes name,price,category_id
537
424
  ```
538
425
 
539
- ### User Management System
426
+ ### Testing Commands
540
427
 
541
- #### Generate User Module
428
+ #### Generate Tests
542
429
  ```bash
543
- diagramers extend --module users --crud
544
- ```
430
+ # Generate unit tests
431
+ diagramers test --unit --modules products,users
545
432
 
546
- #### Add User Profile Table
547
- ```bash
548
- diagramers extend --table users:profiles --fields bio,avatar,socialLinks,location,website,birthDate,preferences
549
- ```
433
+ # Generate integration tests
434
+ diagramers test --integration --modules products
550
435
 
551
- #### Add User Sessions Table
552
- ```bash
553
- diagramers extend --table users:sessions --fields userId,deviceInfo,ipAddress,userAgent,isActive,lastActivity
554
- ```
436
+ # Generate API tests
437
+ diagramers test --api --endpoints products,users
555
438
 
556
- #### Add User Activity Table
557
- ```bash
558
- diagramers extend --table users:activities --fields userId,action,details,ipAddress,userAgent,timestamp
439
+ # Generate test configuration
440
+ diagramers test --config --framework jest --coverage
559
441
  ```
560
442
 
561
- #### Create User Relations
443
+ ### Documentation Commands
444
+
445
+ #### Generate Documentation
562
446
  ```bash
563
- # One-to-one: User to Profile
564
- diagramers extend --relation users:user-profile:one-to-one
447
+ # Generate API documentation
448
+ diagramers docs api --format swagger --output docs/api
565
449
 
566
- # One-to-many: User to Sessions
567
- diagramers extend --relation users:user-session:one-to-many
450
+ # Generate module documentation
451
+ diagramers docs modules --format markdown --output docs/modules
568
452
 
569
- # One-to-many: User to Activities
570
- diagramers extend --relation users:user-activity:one-to-many
571
- ```
453
+ # Generate deployment documentation
454
+ diagramers docs deployment --platforms docker,firebase --output docs/deployment
572
455
 
573
- #### Add User Endpoints
574
- ```bash
575
- # User profile management
576
- diagramers extend --endpoint users:profile --method GET --description "Get user profile"
577
- diagramers extend --endpoint users:update-profile --method PUT --description "Update user profile"
578
- diagramers extend --endpoint users:upload-avatar --method POST --description "Upload user avatar"
579
-
580
- # User administration
581
- diagramers extend --endpoint users:list --method GET --description "List all users (admin)"
582
- diagramers extend --endpoint users:create --method POST --description "Create user (admin)"
583
- diagramers extend --endpoint users:update --method PUT --description "Update user (admin)"
584
- diagramers extend --endpoint users:delete --method DELETE --description "Delete user (admin)"
585
-
586
- # User statistics
587
- diagramers extend --endpoint users:stats --method GET --description "Get user statistics"
588
- diagramers extend --endpoint users:activity --method GET --description "Get user activity"
456
+ # Generate README files
457
+ diagramers docs readme --modules products,users --output docs
589
458
  ```
590
459
 
591
- ## πŸ”§ Workflow Examples
592
-
593
- ### Complete Product Management System
594
-
460
+ ### Documentation Templates
595
461
  ```bash
596
- # 1. Create new API project
597
- diagramers init api ecommerce-api
598
- cd ecommerce-api
599
-
600
- # 2. Generate products module
601
- diagramers extend --module products --crud
602
-
603
- # 3. Add categories table
604
- diagramers extend --table products:categories --fields name,description,slug
605
-
606
- # 4. Add products table
607
- diagramers extend --table products:products --fields name,price,description,category_id
608
-
609
- # 5. Create category-product relation
610
- diagramers extend --relation products:category-product:one-to-many
462
+ # Use custom documentation template
463
+ diagramers docs --template custom-docs --output docs
611
464
 
612
- # 6. Add custom search endpoint
613
- diagramers extend --endpoint products:search --method GET --description "Search products"
614
-
615
- # 7. Install dependencies and start
616
- npm install
617
- npm start
465
+ # Generate documentation for specific features
466
+ diagramers docs --features auth,email,sms --output docs/features
618
467
  ```
619
468
 
620
- ### User Management with Profiles
469
+ ## πŸ” Troubleshooting
621
470
 
622
- ```bash
623
- # 1. Generate users module (if not exists)
624
- diagramers extend --module users --crud
471
+ ### Common Issues
625
472
 
626
- # 2. Add user profiles table
627
- diagramers extend --table users:profiles --fields bio,avatar,social_links,birth_date
473
+ #### Project Generation Issues
474
+ ```bash
475
+ # Clear CLI cache
476
+ diagramers cache clear
628
477
 
629
- # 3. Create user-profile relation
630
- diagramers extend --relation users:user-profile:one-to-one
478
+ # Update CLI to latest version
479
+ npm update -g @diagramers/cli
631
480
 
632
- # 4. Add profile endpoints
633
- diagramers extend --endpoint users:update-profile --method PUT
634
- diagramers extend --endpoint users:get-profile --method GET
481
+ # Check template availability
482
+ diagramers template list --available
635
483
  ```
636
484
 
637
- ### Complete Email System Setup
638
-
485
+ #### Module Generation Issues
639
486
  ```bash
640
- # 1. Generate email module with CRUD operations
641
- diagramers extend --module email --crud
642
-
643
- # 2. Add email configurations table
644
- diagramers extend --table email:configs --fields provider,code,credentials,fromName,fromEmail,default
645
-
646
- # 3. Add email templates table
647
- diagramers extend --table email:templates --fields name,subject,body,isActive,createdAt
648
-
649
- # 4. Add email logs table for tracking
650
- diagramers extend --table email:logs --fields to,subject,status,provider,error,createdAt
651
-
652
- # 5. Create relationships
653
- diagramers extend --relation email:user-config:one-to-many
654
- diagramers extend --relation email:config-log:one-to-many
487
+ # Validate module configuration
488
+ diagramers validate --module products
655
489
 
656
- # 6. Add email-specific endpoints
657
- diagramers extend --endpoint email:send --method POST --description "Send email using configured provider"
658
- diagramers extend --endpoint email:test --method POST --description "Test email configuration"
659
- diagramers extend --endpoint email:stats --method GET --description "Get email sending statistics"
490
+ # Check field types
491
+ diagramers validate --fields name:string,price:number
660
492
 
661
- # 7. Add provider setup endpoints
662
- diagramers extend --endpoint email:setup-gmail --method POST --description "Setup Gmail SMTP configuration"
663
- diagramers extend --endpoint email:setup-sendgrid --method POST --description "Setup SendGrid configuration"
664
-
665
- # 8. Install dependencies and start
666
- npm install
667
- npm start
493
+ # Verify relationships
494
+ diagramers validate --relation products:categories
668
495
  ```
669
496
 
670
- ### Complete User Management System Setup
671
-
497
+ #### Database Issues
672
498
  ```bash
673
- # 1. Generate users module with CRUD operations
674
- diagramers extend --module users --crud
675
-
676
- # 2. Add user profiles table
677
- diagramers extend --table users:profiles --fields bio,avatar,socialLinks,location,website,birthDate,preferences
678
-
679
- # 3. Add user sessions table for tracking
680
- diagramers extend --table users:sessions --fields userId,deviceInfo,ipAddress,userAgent,isActive,lastActivity
499
+ # Check database connection
500
+ diagramers db check --connection
681
501
 
682
- # 4. Add user activity table for audit
683
- diagramers extend --table users:activities --fields userId,action,details,ipAddress,userAgent,timestamp
502
+ # Validate database schema
503
+ diagramers db validate --schema
684
504
 
685
- # 5. Create user relationships
686
- diagramers extend --relation users:user-profile:one-to-one
687
- diagramers extend --relation users:user-session:one-to-many
688
- diagramers extend --relation users:user-activity:one-to-many
689
-
690
- # 6. Add user profile endpoints
691
- diagramers extend --endpoint users:profile --method GET --description "Get user profile"
692
- diagramers extend --endpoint users:update-profile --method PUT --description "Update user profile"
693
- diagramers extend --endpoint users:upload-avatar --method POST --description "Upload user avatar"
694
-
695
- # 7. Add user administration endpoints
696
- diagramers extend --endpoint users:list --method GET --description "List all users (admin)"
697
- diagramers extend --endpoint users:create --method POST --description "Create user (admin)"
698
- diagramers extend --endpoint users:update --method PUT --description "Update user (admin)"
699
- diagramers extend --endpoint users:delete --method DELETE --description "Delete user (admin)"
700
-
701
- # 8. Add user analytics endpoints
702
- diagramers extend --endpoint users:stats --method GET --description "Get user statistics"
703
- diagramers extend --endpoint users:activity --method GET --description "Get user activity"
704
-
705
- # 9. Install dependencies and start
706
- npm install
707
- npm start
505
+ # Test database operations
506
+ diagramers db test --operations
708
507
  ```
709
508
 
710
- ## πŸ› οΈ Advanced Usage
711
-
712
- ### Database Seeding
713
-
714
- All generated tables automatically include:
715
- - **Sample data** - 3 sample records per table
716
- - **Seeder integration** - Automatic database seeding
717
- - **Development data** - Realistic test data
718
-
509
+ ### Debug Mode
719
510
  ```bash
720
- # Run database seeding
721
- npm run seed
511
+ # Enable debug logging
512
+ diagramers --debug init api my-project
722
513
 
723
- # Reset and reseed database
724
- npm run seed --reset
725
- ```
726
-
727
- ### Template Updates
514
+ # Verbose output
515
+ diagramers --verbose extend --module products
728
516
 
729
- ```bash
730
- # Update project with latest template
731
- diagramers update
732
-
733
- # Force update with backup
734
- diagramers update --force --backup
517
+ # Dry run (preview changes)
518
+ diagramers --dry-run extend --module products
735
519
  ```
736
520
 
737
- ### Custom Field Types
738
-
739
- The CLI automatically detects field types based on naming conventions:
521
+ ## 🀝 Contributing
740
522
 
523
+ ### Development Setup
741
524
  ```bash
742
- # These fields will be auto-typed:
743
- diagramers extend --table products:products --fields \
744
- name,description,price,stock_count,created_at,is_active,category_id
745
- ```
525
+ # Clone repository
526
+ git clone https://github.com/diagramers/diagramers-cli.git
527
+ cd diagramers-cli
746
528
 
747
- **Auto-detection:**
748
- - `name`, `title`, `description` β†’ String
749
- - `price`, `count`, `stock_count` β†’ Number
750
- - `created_at`, `updated_at` β†’ Date
751
- - `is_active`, `verified` β†’ Boolean
752
- - `category_id`, `user_id` β†’ ObjectId
529
+ # Install dependencies
530
+ npm install
753
531
 
754
- ## πŸ“š Project Structure
532
+ # Link for development
533
+ npm link
755
534
 
756
- Generated projects follow this structure:
535
+ # Run tests
536
+ npm test
757
537
 
538
+ # Build project
539
+ npm run build
758
540
  ```
759
- my-project/
760
- β”œβ”€β”€ src/
761
- β”‚ β”œβ”€β”€ modules/
762
- β”‚ β”‚ β”œβ”€β”€ products/
763
- β”‚ β”‚ β”‚ β”œβ”€β”€ controllers/
764
- β”‚ β”‚ β”‚ β”œβ”€β”€ entities/
765
- β”‚ β”‚ β”‚ β”œβ”€β”€ schemas/
766
- β”‚ β”‚ β”‚ β”œβ”€β”€ services/
767
- β”‚ β”‚ β”‚ └── routes/
768
- β”‚ β”‚ └── users/
769
- β”‚ β”œβ”€β”€ core/
770
- β”‚ β”‚ β”œβ”€β”€ database/
771
- β”‚ β”‚ β”œβ”€β”€ config/
772
- β”‚ β”‚ └── server/
773
- β”‚ └── shared/
774
- β”œβ”€β”€ scripts/
775
- └── package.json
776
- ```
777
-
778
- ## πŸ” Troubleshooting
779
541
 
780
- ### Common Issues
542
+ ### Contributing Guidelines
543
+ 1. Fork the repository
544
+ 2. Create a feature branch
545
+ 3. Make your changes
546
+ 4. Add tests for new functionality
547
+ 5. Ensure all tests pass
548
+ 6. Submit a pull request
781
549
 
782
- #### Module Not Found
783
- ```bash
784
- ❌ Module 'inventory' does not exist
785
- ```
786
- **Solution:** Create the module first:
550
+ ### Code Style
787
551
  ```bash
788
- diagramers extend --module inventory
789
- ```
552
+ # Run linting
553
+ npm run lint
790
554
 
791
- #### Table Already Exists
792
- ```bash
793
- ❌ Table 'products' already exists in module 'products'
794
- ```
795
- **Solution:** Use a different table name or check existing tables
796
-
797
- #### Invalid Relation
798
- ```bash
799
- ❌ Table 'categories' does not exist in module 'products'
800
- ```
801
- **Solution:** Create both tables before creating relations:
802
- ```bash
803
- diagramers extend --table products:categories --fields name,description
804
- diagramers extend --table products:products --fields name,price
805
- diagramers extend --relation products:category-product
806
- ```
555
+ # Fix linting issues
556
+ npm run lint:fix
807
557
 
808
- ### Getting Help
558
+ # Format code
559
+ npm run format
809
560
 
810
- ```bash
811
- # General help
812
- diagramers --help
813
-
814
- # Command-specific help
815
- diagramers init --help
816
- diagramers extend --help
817
- diagramers update --help
561
+ # Type checking
562
+ npm run type-check
818
563
  ```
819
564
 
820
- ## 🀝 Contributing
821
-
822
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
823
-
824
565
  ## πŸ“„ License
825
566
 
826
- MIT License - see [LICENSE](LICENSE) file for details.
567
+ MIT License - see LICENSE file for details
827
568
 
828
569
  ## πŸ”— Related Packages
829
570
 
830
- - [@diagramers/api](https://npmjs.com/package/@diagramers/api) - API template package
831
- - [@diagramers/admin](https://npmjs.com/package/@diagramers/admin) - Admin template package
571
+ - [@diagramers/api](./diagramers-api) - Node.js API template
572
+ - [@diagramers/admin](./diagramers-admin) - React admin dashboard template
832
573
 
833
574
  ## πŸ“ž Support
834
575
 
835
- - **Issues**: [GitHub Issues](https://github.com/diagramers/diagramers-cli/issues)
836
- - **Documentation**: [Official Docs](https://docs.diagramers.com)
837
- - **Community**: [Discord Server](https://discord.gg/diagramers)
576
+ For support and questions:
577
+ - Create an issue on GitHub
578
+ - Check the documentation
579
+ - Review the examples in the codebase
580
+ - Join our community discussions
581
+
582
+ ## πŸ—ΊοΈ Roadmap
583
+
584
+ ### Upcoming Features
585
+ - [ ] GraphQL support
586
+ - [ ] Microservices architecture
587
+ - [ ] Kubernetes deployment
588
+ - [ ] Advanced caching strategies
589
+ - [ ] Real-time analytics
590
+ - [ ] Advanced security features
591
+ - [ ] Multi-tenant support
592
+ - [ ] API versioning
593
+ - [ ] Advanced rate limiting
594
+ - [ ] Webhook system
595
+
596
+ ### Plugin Ecosystem
597
+ - [ ] Plugin marketplace
598
+ - [ ] Community plugins
599
+ - [ ] Plugin development tools
600
+ - [ ] Plugin testing framework
601
+ - [ ] Plugin documentation generator
602
+
603
+ ### Integration Features
604
+ - [ ] Third-party service integrations
605
+ - [ ] Payment gateway integrations
606
+ - [ ] Analytics integrations
607
+ - [ ] Monitoring integrations
608
+ - [ ] Backup service integrations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagramers/cli",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Diagramers CLI - Command-line tools for managing Diagramers projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {