servcraft 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -277,6 +277,10 @@ servcraft init my-app --dry-run -y # Preview without creating
277
277
  ### Generate resources
278
278
 
279
279
  ```bash
280
+ # Scaffold complete CRUD resource (recommended)
281
+ servcraft scaffold product --fields "name:string price:number category:string?"
282
+ servcraft scaffold user --fields "name:string email:email age:number?" --validator zod
283
+
280
284
  # Generate complete module
281
285
  servcraft generate module product
282
286
  servcraft g m product --prisma # Include Prisma model
@@ -331,6 +335,28 @@ servcraft remove auth --keep-env # Keep environment variables
331
335
  servcraft doctor # Check configuration and dependencies
332
336
  ```
333
337
 
338
+ ### Custom Templates
339
+
340
+ Customize code generation templates for your project:
341
+
342
+ ```bash
343
+ # Initialize custom templates directory
344
+ servcraft templates init # Creates .servcraft/templates/
345
+
346
+ # List available templates
347
+ servcraft templates list # Shows project, user, and built-in templates
348
+ ```
349
+
350
+ **Template locations (priority order):**
351
+ 1. Project: `.servcraft/templates/` - Project-specific templates
352
+ 2. User: `~/.servcraft/templates/` - User-wide templates
353
+ 3. Built-in: Default ServCraft templates
354
+
355
+ **Available template types:**
356
+ - controller.ts, service.ts, repository.ts
357
+ - types.ts, schemas.ts, routes.ts, module-index.ts
358
+ - controller-test.ts, service-test.ts, integration-test.ts
359
+
334
360
  ### Shell Auto-completion
335
361
 
336
362
  Enable tab completion for servcraft commands in your shell:
package/ROADMAP.md CHANGED
@@ -4,7 +4,11 @@ This document outlines the planned features and improvements for Servcraft.
4
4
 
5
5
  ## Version History
6
6
 
7
- - **v0.3.0** (Current) - Shell auto-completion, update command, comprehensive CLI tests (30 tests) - Phase 2 in progress 🚧
7
+ - **v0.4.2** (Current) - Custom template loading in generate/scaffold - Phase 3 in progress 🚧
8
+ - **v0.4.1** - Custom templates management (init/list)
9
+ - **v0.4.0** - Scaffold command for complete CRUD generation
10
+ - **v0.3.1** - Test templates with --with-tests flag - Phase 2 complete ✅
11
+ - **v0.3.0** - Shell auto-completion, update command, comprehensive CLI tests (30 tests), CI/CD on Node.js 18/20/22
8
12
  - **v0.2.0** - Better errors, remove, doctor, update (stub) - Phase 1 complete ✅
9
13
  - **v0.1.9** - Added `--dry-run` option for all commands (init, add, generate)
10
14
  - **v0.1.8** - Added `servcraft list` command
@@ -190,28 +194,38 @@ Features:
190
194
 
191
195
  ## Phase 3: Advanced Features (v0.4.x)
192
196
 
193
- ### v0.4.0 - Scaffolding
197
+ ### v0.4.0 - Scaffolding ✅ Completed
194
198
 
195
199
  #### `servcraft scaffold <resource>`
196
200
  Generate complete CRUD with single command.
197
201
  ```bash
198
- servcraft scaffold product --fields "name:string price:number category:relation"
202
+ servcraft scaffold product --fields "name:string price:number category:string?"
203
+ servcraft scaffold user --fields "name:string email:email age:number?" --validator zod
199
204
  ```
200
205
 
201
206
  Generates:
202
- - Prisma model
203
- - Controller with CRUD endpoints
204
- - Service with business logic
205
- - Repository with data access
206
- - Routes with validation
207
- - Types/DTOs
208
- - Tests
207
+ - Prisma model (with proper types and indexes)
208
+ - Controller with CRUD endpoints
209
+ - Service with business logic
210
+ - Repository with data access
211
+ - Routes with validation
212
+ - Types/DTOs (interface, Create, Update, Filters)
213
+ - ✅ Schemas (Zod/Joi/Yup validators)
214
+ - ✅ Test files (controller, service, integration)
215
+
216
+ Features:
217
+ - Parses field definitions with types and modifiers
218
+ - Supports optional fields (?)
219
+ - Generates complete Prisma model ready to copy
220
+ - Includes all CRUD operations
221
+ - Automatically generates tests with --with-tests behavior
222
+ - Supports all validators (zod, joi, yup)
209
223
 
210
224
  **Estimated complexity:** High
211
225
 
212
226
  ---
213
227
 
214
- ### v0.4.1 - Custom Templates
228
+ ### v0.4.1 - Custom Templates ✅ Completed
215
229
 
216
230
  #### Template System
217
231
  Allow users to customize generated code.
@@ -219,10 +233,18 @@ Allow users to customize generated code.
219
233
  ```bash
220
234
  servcraft templates init # Create .servcraft/templates/
221
235
  servcraft templates list # List available templates
222
- servcraft generate module --template custom-module
223
236
  ```
224
237
 
225
- Template locations:
238
+ Features:
239
+ - ✅ `servcraft templates init` - Initialize custom template directory
240
+ - ✅ `servcraft templates list` - List project/user/built-in templates
241
+ - ✅ Project templates in `.servcraft/templates/`
242
+ - ✅ User templates in `~/.servcraft/templates/`
243
+ - ✅ Built-in template fallback
244
+ - ✅ Example template file created on init
245
+ - ✅ Support for all 10 template types
246
+
247
+ Template locations (priority order):
226
248
  1. Project `.servcraft/templates/`
227
249
  2. User `~/.servcraft/templates/`
228
250
  3. Built-in defaults
@@ -231,7 +253,24 @@ Template locations:
231
253
 
232
254
  ---
233
255
 
234
- ### v0.4.2 - Plugin System
256
+ ### v0.4.2 - Template Loading ✅ Completed
257
+
258
+ #### Custom Template Loading
259
+ Automatically use custom templates in generate/scaffold commands.
260
+
261
+ Features:
262
+ - ✅ Template loader utility with priority-based loading
263
+ - ✅ `generate` command uses custom templates automatically
264
+ - ✅ `scaffold` command uses custom templates automatically
265
+ - ✅ Falls back to built-in templates when custom not found
266
+ - ✅ Supports all 10 template types seamlessly
267
+ - ✅ No additional flags needed - works out of the box
268
+
269
+ **Estimated complexity:** Medium
270
+
271
+ ---
272
+
273
+ ### v0.4.3 - Plugin System
235
274
 
236
275
  #### Third-party Plugins
237
276
  ```bash