create-velox-app 0.6.65 → 0.6.66

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # create-velox-app
2
2
 
3
+ ## 0.6.66
4
+
5
+ ### Patch Changes
6
+
7
+ - docs(skills): recommend namespace generator for AI agents
8
+
3
9
  ## 0.6.65
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-velox-app",
3
- "version": "0.6.65",
3
+ "version": "0.6.66",
4
4
  "description": "Project scaffolder for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,15 +1,44 @@
1
1
  # VeloxTS Generators Guide
2
2
 
3
+ ## AI Agent Recommended Workflow
4
+
5
+ When creating new entities, the **recommended approach** is:
6
+
7
+ 1. **Design and add the Prisma model** directly to `prisma/schema.prisma`
8
+ 2. **Run `velox make namespace EntityName`** to generate procedures
9
+
10
+ This ensures complete, production-ready code because the AI can design the full schema based on requirements.
11
+
12
+ ```bash
13
+ # Example: Creating a Post entity
14
+
15
+ # Step 1: AI adds model to prisma/schema.prisma
16
+ model Post {
17
+ id String @id @default(uuid())
18
+ title String
19
+ content String
20
+ published Boolean @default(false)
21
+ authorId String
22
+ author User @relation(fields: [authorId], references: [id])
23
+ createdAt DateTime @default(now())
24
+ updatedAt DateTime @updatedAt
25
+ @@map("posts")
26
+ }
27
+
28
+ # Step 2: Generate procedures for the existing model
29
+ velox make namespace Post --example
30
+ ```
31
+
3
32
  ## Decision Tree: Which Generator?
4
33
 
5
34
  ```
6
35
  Do you need a new database entity?
7
- ├── YES → Is this a completely new entity?
8
- ├── YES → velox make resource [RECOMMENDED]
9
- Creates: Prisma model + Schema + Procedures + Tests
10
-
11
- │ └── NO (existing Prisma model) → velox make namespace
12
- Creates: Schema + Procedures (no Prisma injection)
36
+ ├── YES (AI workflow) 1. Design Prisma model in schema.prisma
37
+ 2. velox make namespace EntityName --example
38
+ Creates: Schema + Procedures for existing model
39
+
40
+ ├── YES (Interactive) → velox make resource EntityName -i
41
+ Prompts for fields, creates everything
13
42
 
14
43
  └── NO → What do you need?
15
44
  ├── Single API endpoint → velox make procedure
@@ -29,34 +58,26 @@ Do you need a new database entity?
29
58
 
30
59
  | Generator | Creates | Use When |
31
60
  |-----------|---------|----------|
32
- | `resource` | Prisma + Schema + Procedures + Tests | **New database entity** (recommended default) |
33
- | `namespace` | Schema + Procedures | Existing model or external API |
61
+ | `namespace` | Schema + Procedures + Tests | **AI agents** or existing Prisma model |
62
+ | `resource -i` | Prisma + Schema + Procedures + Tests | **Human interactive** field definition |
63
+ | `resource` | Scaffolds with TODOs | Quick start (fields needed manually) |
34
64
  | `procedure` | Procedures (inline schemas) | Single endpoint, quick prototype |
35
65
  | `schema` | Zod schema file | Standalone validation |
36
66
  | `model` | Prisma model | Database-only change |
37
67
 
38
- ## Resource Generator [RECOMMENDED]
68
+ ## Namespace Generator [AI RECOMMENDED]
39
69
 
40
- The full-stack generator for new entities. Like Laravel's `make:model -a`.
70
+ Best choice for AI agents. Works with models you've already defined.
41
71
 
42
72
  ```bash
43
- # Basic usage
44
- velox make resource Post
73
+ # After adding model to schema.prisma:
74
+ velox make namespace Post --example
45
75
 
46
- # Full CRUD with pagination
47
- velox make resource Post --crud --paginated
76
+ # With tests
77
+ velox make namespace Order --example --with-tests
48
78
 
49
- # Interactive field definition
50
- velox make resource Product -i
51
-
52
- # With soft delete
53
- velox make resource Comment --soft-delete
54
-
55
- # Auto-run migration
56
- velox make resource Order --auto-migrate
57
-
58
- # Preview without writing
59
- velox make resource Post --dry-run
79
+ # Short form
80
+ velox m ns Product -e -t
60
81
  ```
61
82
 
62
83
  ### What It Creates
@@ -67,40 +88,36 @@ src/
67
88
  │ ├── posts.ts # CRUD procedures
68
89
  │ └── __tests__/
69
90
  │ └── posts.test.ts # Unit tests
70
- ├── schemas/
71
- └── post.schema.ts # Zod validation
72
- └── models/
73
- └── post.prisma # Injected into schema.prisma
91
+ └── schemas/
92
+ └── post.ts # Zod validation
74
93
  ```
75
94
 
76
95
  ### Options
77
96
 
78
97
  | Option | Short | Description |
79
98
  |--------|-------|-------------|
80
- | `--crud` | `-c` | Generate full CRUD operations |
81
- | `--paginated` | `-P` | Include pagination for list |
82
- | `--soft-delete` | `-s` | Add soft delete support |
83
- | `--timestamps` | `-t` | Include timestamps (default: true) |
84
- | `--with-tests` | `-W` | Generate tests (default: true) |
85
- | `--interactive` | `-i` | Define fields interactively |
86
- | `--skip-registration` | | Don't auto-register in router |
87
- | `--auto-migrate` | | Run migration automatically |
88
- | `--dry-run` | `-d` | Preview changes only |
89
- | `--force` | `-f` | Overwrite existing files |
99
+ | `--example` | `-e` | Include example CRUD procedures |
100
+ | `--with-tests` | `-t` | Generate test file (default: true) |
101
+ | `--skip-registration` | `-S` | Don't auto-register in router |
90
102
 
91
- ## Namespace Generator
103
+ ## Resource Generator [HUMAN INTERACTIVE]
92
104
 
93
- For existing Prisma models or external data sources.
105
+ Best for humans defining fields interactively via `-i` flag.
106
+
107
+ **Important:** Without `-i`, creates scaffolds with TODO placeholders that require manual completion.
94
108
 
95
109
  ```bash
96
- # Empty namespace (add procedures manually)
97
- velox make namespace products
110
+ # RECOMMENDED: Interactive mode (prompts for fields)
111
+ velox make resource Product -i
98
112
 
99
- # With example CRUD
100
- velox make namespace orders --example
113
+ # Without -i: Creates TODOs (not recommended)
114
+ velox make resource Post
101
115
 
102
- # Short form
103
- velox m ns inventory -e
116
+ # With all features
117
+ velox make resource Order -i --soft-delete --auto-migrate
118
+
119
+ # Preview without writing
120
+ velox make resource Post --dry-run
104
121
  ```
105
122
 
106
123
  ### What It Creates
@@ -108,24 +125,29 @@ velox m ns inventory -e
108
125
  ```
109
126
  src/
110
127
  ├── procedures/
111
- └── products.ts # Procedure namespace
112
- └── schemas/
113
- └── product.ts # Zod schema
128
+ ├── posts.ts # CRUD procedures
129
+ └── __tests__/
130
+ └── posts.test.ts # Unit tests
131
+ ├── schemas/
132
+ │ └── post.schema.ts # Zod validation
133
+ └── models/
134
+ └── post.prisma # Injected into schema.prisma
114
135
  ```
115
136
 
116
- ### When to Use
117
-
118
- - You already have a Prisma model defined
119
- - You're calling an external API (no database)
120
- - You want separate schema files (not inline)
121
- - You don't need Prisma model injection
122
-
123
137
  ### Options
124
138
 
125
139
  | Option | Short | Description |
126
140
  |--------|-------|-------------|
127
- | `--example` | `-e` | Include example CRUD procedures |
128
- | `--skip-registration` | `-S` | Don't auto-register in router |
141
+ | `--interactive` | `-i` | **Define fields interactively (recommended)** |
142
+ | `--crud` | `-c` | Generate full CRUD operations |
143
+ | `--paginated` | `-P` | Include pagination for list |
144
+ | `--soft-delete` | `-s` | Add soft delete support |
145
+ | `--timestamps` | `-t` | Include timestamps (default: true) |
146
+ | `--with-tests` | `-W` | Generate tests (default: true) |
147
+ | `--skip-registration` | | Don't auto-register in router |
148
+ | `--auto-migrate` | | Run migration automatically |
149
+ | `--dry-run` | `-d` | Preview changes only |
150
+ | `--force` | `-f` | Overwrite existing files |
129
151
 
130
152
  ## Procedure Generator
131
153
 
@@ -238,25 +260,45 @@ velox make task SendDailyDigest --cron="0 9 * * *"
238
260
 
239
261
  ## Common Workflows
240
262
 
241
- ### New Feature: Blog Posts
263
+ ### New Feature: Blog Posts (AI Agent)
242
264
 
243
265
  ```bash
244
- # 1. Generate complete resource
245
- velox make resource Post --crud --paginated -i
246
-
247
- # 2. (Optional) Add related resources
248
- velox make resource Comment --crud
249
- velox make resource Tag --crud
250
-
251
- # 3. Run migration
266
+ # 1. Design Prisma model directly in schema.prisma
267
+ model Post {
268
+ id String @id @default(uuid())
269
+ title String
270
+ slug String @unique
271
+ content String
272
+ excerpt String?
273
+ published Boolean @default(false)
274
+ authorId String
275
+ author User @relation(fields: [authorId], references: [id])
276
+ createdAt DateTime @default(now())
277
+ updatedAt DateTime @updatedAt
278
+ @@map("posts")
279
+ }
280
+
281
+ # 2. Generate procedures for the model
282
+ velox make namespace Post --example
283
+
284
+ # 3. Push database changes
252
285
  pnpm db:push
253
286
 
254
- # 4. Seed sample data
287
+ # 4. (Optional) Seed sample data
255
288
  velox make seeder PostSeeder
256
- pnpm velox db seed
257
289
  ```
258
290
 
259
- ### Adding to Existing Model
291
+ ### New Feature: Blog Posts (Human Interactive)
292
+
293
+ ```bash
294
+ # 1. Interactive field definition
295
+ velox make resource Post -i --auto-migrate
296
+
297
+ # 2. Follow prompts to define fields
298
+ # 3. Migration runs automatically
299
+ ```
300
+
301
+ ### Adding Procedures for Existing Model
260
302
 
261
303
  ```bash
262
304
  # Model already exists in Prisma