create-velox-app 0.6.64 → 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,17 @@
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
+
9
+ ## 0.6.65
10
+
11
+ ### Patch Changes
12
+
13
+ - improve ai integration and simplify api router definition
14
+
3
15
  ## 0.6.64
4
16
 
5
17
  ### Patch Changes
@@ -50,9 +50,6 @@ function generateIndexTs() {
50
50
  function generateRouterTs() {
51
51
  return compileTemplate('api/router.auth.ts', AUTH_CONFIG);
52
52
  }
53
- function generateRouterTypesTs() {
54
- return compileTemplate('api/router.types.auth.ts', AUTH_CONFIG);
55
- }
56
53
  function generateConfigDatabase(config) {
57
54
  return compileTemplate('api/config/database.ts', config);
58
55
  }
@@ -68,9 +65,6 @@ function generateAuthSchema() {
68
65
  function generateHealthSchema() {
69
66
  return compileTemplate('api/schemas/health.ts', AUTH_CONFIG);
70
67
  }
71
- function generateRoutes() {
72
- return compileTemplate('api/routes.auth.ts', AUTH_CONFIG);
73
- }
74
68
  function generateApiTypesDts() {
75
69
  return compileTemplate('api/types.d.ts', AUTH_CONFIG);
76
70
  }
@@ -96,7 +90,6 @@ export function generateAuthTemplate(config) {
96
90
  { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema(config) },
97
91
  // API Source files
98
92
  { path: 'apps/api/src/router.ts', content: generateRouterTs() },
99
- { path: 'apps/api/src/router.types.ts', content: generateRouterTypesTs() },
100
93
  { path: 'apps/api/src/index.ts', content: generateIndexTs() },
101
94
  { path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
102
95
  { path: 'apps/api/src/config/auth.ts', content: generateAuthConfig() },
@@ -107,7 +100,6 @@ export function generateAuthTemplate(config) {
107
100
  { path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
108
101
  { path: 'apps/api/src/schemas/auth.ts', content: generateAuthSchema() },
109
102
  { path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
110
- { path: 'apps/api/src/routes.ts', content: generateRoutes() },
111
103
  { path: 'apps/api/src/types.d.ts', content: generateApiTypesDts() },
112
104
  { path: 'apps/api/src/utils/auth.ts', content: generateAuthUtils() },
113
105
  ];
@@ -12,4 +12,11 @@ export declare function generateRootReadme(config: TemplateConfig): string;
12
12
  export type TemplateVariant = 'default' | 'auth' | 'trpc';
13
13
  export declare function generateRootClaudeMd(config: TemplateConfig, variant: TemplateVariant | boolean): string;
14
14
  export declare function generateRootCursorrules(config: TemplateConfig): string;
15
+ /**
16
+ * Generate VeloxTS skill files for Claude Code
17
+ *
18
+ * These skills provide project-aware guidance to Claude when working on
19
+ * VeloxTS projects. Skills are Markdown files with YAML frontmatter.
20
+ */
21
+ export declare function generateClaudeSkillFiles(config: TemplateConfig): TemplateFile[];
15
22
  export declare function generateRootFiles(config: TemplateConfig, variant?: TemplateVariant | boolean): TemplateFile[];
@@ -57,6 +57,36 @@ export function generateRootCursorrules(config) {
57
57
  return compileTemplate('root/.cursorrules', config);
58
58
  }
59
59
  // ============================================================================
60
+ // Claude Code Skills
61
+ // ============================================================================
62
+ /**
63
+ * Generate VeloxTS skill files for Claude Code
64
+ *
65
+ * These skills provide project-aware guidance to Claude when working on
66
+ * VeloxTS projects. Skills are Markdown files with YAML frontmatter.
67
+ */
68
+ export function generateClaudeSkillFiles(config) {
69
+ const skillPath = '.claude/skills/veloxts';
70
+ return [
71
+ {
72
+ path: `${skillPath}/SKILL.md`,
73
+ content: compileTemplate('root/.claude/skills/veloxts/SKILL.md', config),
74
+ },
75
+ {
76
+ path: `${skillPath}/GENERATORS.md`,
77
+ content: compileTemplate('root/.claude/skills/veloxts/GENERATORS.md', config),
78
+ },
79
+ {
80
+ path: `${skillPath}/PROCEDURES.md`,
81
+ content: compileTemplate('root/.claude/skills/veloxts/PROCEDURES.md', config),
82
+ },
83
+ {
84
+ path: `${skillPath}/TROUBLESHOOTING.md`,
85
+ content: compileTemplate('root/.claude/skills/veloxts/TROUBLESHOOTING.md', config),
86
+ },
87
+ ];
88
+ }
89
+ // ============================================================================
60
90
  // Generate All Root Files
61
91
  // ============================================================================
62
92
  export function generateRootFiles(config, variant = 'default') {
@@ -68,5 +98,7 @@ export function generateRootFiles(config, variant = 'default') {
68
98
  { path: 'README.md', content: generateRootReadme(config) },
69
99
  { path: 'CLAUDE.md', content: generateRootClaudeMd(config, variant) },
70
100
  { path: '.cursorrules', content: generateRootCursorrules(config) },
101
+ // Claude Code skills for project-specific guidance
102
+ ...generateClaudeSkillFiles(config),
71
103
  ];
72
104
  }
@@ -35,9 +35,6 @@ function generatePrismaConfig() {
35
35
  function generateRouterTs() {
36
36
  return compileTemplate('api/router.default.ts', DEFAULT_CONFIG);
37
37
  }
38
- function generateRouterTypesTs() {
39
- return compileTemplate('api/router.types.default.ts', DEFAULT_CONFIG);
40
- }
41
38
  function generateIndexTs() {
42
39
  return compileTemplate('api/index.default.ts', DEFAULT_CONFIG);
43
40
  }
@@ -59,9 +56,6 @@ function generateUserSchema() {
59
56
  function generateHealthSchema() {
60
57
  return compileTemplate('api/schemas/health.ts', DEFAULT_CONFIG);
61
58
  }
62
- function generateRoutes() {
63
- return compileTemplate('api/routes.default.ts', DEFAULT_CONFIG);
64
- }
65
59
  function generateApiTypesDts() {
66
60
  return compileTemplate('api/types.d.ts', DEFAULT_CONFIG);
67
61
  }
@@ -84,7 +78,6 @@ export function generateSpaTemplate(config) {
84
78
  { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema(config) },
85
79
  // API Source files
86
80
  { path: 'apps/api/src/router.ts', content: generateRouterTs() },
87
- { path: 'apps/api/src/router.types.ts', content: generateRouterTypesTs() },
88
81
  { path: 'apps/api/src/index.ts', content: generateIndexTs() },
89
82
  { path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
90
83
  { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase(config) },
@@ -92,7 +85,6 @@ export function generateSpaTemplate(config) {
92
85
  { path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
93
86
  { path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
94
87
  { path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
95
- { path: 'apps/api/src/routes.ts', content: generateRoutes() },
96
88
  { path: 'apps/api/src/types.d.ts', content: generateApiTypesDts() },
97
89
  ];
98
90
  // Add docker-compose for PostgreSQL
@@ -41,9 +41,6 @@ function generatePrismaConfig() {
41
41
  function generateRouterTs() {
42
42
  return compileTemplate('api/router.trpc.ts', TRPC_CONFIG);
43
43
  }
44
- function generateRouterTypesTs() {
45
- return compileTemplate('api/router.types.trpc.ts', TRPC_CONFIG);
46
- }
47
44
  function generateIndexTs() {
48
45
  // Use tRPC-specific entry point
49
46
  return compileTemplate('api/index.trpc.ts', TRPC_CONFIG);
@@ -67,9 +64,6 @@ function generateUserSchema() {
67
64
  function generateHealthSchema() {
68
65
  return compileTemplate('api/schemas/health.ts', DEFAULT_CONFIG);
69
66
  }
70
- function generateRoutes() {
71
- return compileTemplate('api/routes.default.ts', DEFAULT_CONFIG);
72
- }
73
67
  function generateApiTypesDts() {
74
68
  return compileTemplate('api/types.d.ts', DEFAULT_CONFIG);
75
69
  }
@@ -92,7 +86,6 @@ export function generateTrpcTemplate(config) {
92
86
  { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema(config) },
93
87
  // API Source files
94
88
  { path: 'apps/api/src/router.ts', content: generateRouterTs() },
95
- { path: 'apps/api/src/router.types.ts', content: generateRouterTypesTs() },
96
89
  { path: 'apps/api/src/index.ts', content: generateIndexTs() },
97
90
  { path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
98
91
  { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase(config) },
@@ -100,7 +93,6 @@ export function generateTrpcTemplate(config) {
100
93
  { path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
101
94
  { path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
102
95
  { path: 'apps/api/src/schemas/health.ts', content: generateHealthSchema() },
103
- { path: 'apps/api/src/routes.ts', content: generateRoutes() },
104
96
  { path: 'apps/api/src/types.d.ts', content: generateApiTypesDts() },
105
97
  ];
106
98
  // Add docker-compose for PostgreSQL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-velox-app",
3
- "version": "0.6.64",
3
+ "version": "0.6.66",
4
4
  "description": "Project scaffolder for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,355 @@
1
+ # VeloxTS Generators Guide
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
+
32
+ ## Decision Tree: Which Generator?
33
+
34
+ ```
35
+ Do you need a new database entity?
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
42
+
43
+ └── NO → What do you need?
44
+ ├── Single API endpoint → velox make procedure
45
+ ├── Validation schema only → velox make schema
46
+ ├── Database model only → velox make model
47
+ ├── Background job → velox make job
48
+ ├── Email template → velox make mail
49
+ ├── Auth guard → velox make guard
50
+ ├── Auth policy → velox make policy
51
+ ├── Middleware → velox make middleware
52
+ ├── Service class → velox make service
53
+ ├── Custom exception → velox make exception
54
+ └── Scheduled task → velox make task
55
+ ```
56
+
57
+ ## Generator Comparison
58
+
59
+ | Generator | Creates | Use When |
60
+ |-----------|---------|----------|
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) |
64
+ | `procedure` | Procedures (inline schemas) | Single endpoint, quick prototype |
65
+ | `schema` | Zod schema file | Standalone validation |
66
+ | `model` | Prisma model | Database-only change |
67
+
68
+ ## Namespace Generator [AI RECOMMENDED]
69
+
70
+ Best choice for AI agents. Works with models you've already defined.
71
+
72
+ ```bash
73
+ # After adding model to schema.prisma:
74
+ velox make namespace Post --example
75
+
76
+ # With tests
77
+ velox make namespace Order --example --with-tests
78
+
79
+ # Short form
80
+ velox m ns Product -e -t
81
+ ```
82
+
83
+ ### What It Creates
84
+
85
+ ```
86
+ src/
87
+ ├── procedures/
88
+ │ ├── posts.ts # CRUD procedures
89
+ │ └── __tests__/
90
+ │ └── posts.test.ts # Unit tests
91
+ └── schemas/
92
+ └── post.ts # Zod validation
93
+ ```
94
+
95
+ ### Options
96
+
97
+ | Option | Short | Description |
98
+ |--------|-------|-------------|
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 |
102
+
103
+ ## Resource Generator [HUMAN INTERACTIVE]
104
+
105
+ Best for humans defining fields interactively via `-i` flag.
106
+
107
+ **Important:** Without `-i`, creates scaffolds with TODO placeholders that require manual completion.
108
+
109
+ ```bash
110
+ # RECOMMENDED: Interactive mode (prompts for fields)
111
+ velox make resource Product -i
112
+
113
+ # Without -i: Creates TODOs (not recommended)
114
+ velox make resource Post
115
+
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
121
+ ```
122
+
123
+ ### What It Creates
124
+
125
+ ```
126
+ src/
127
+ ├── procedures/
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
135
+ ```
136
+
137
+ ### Options
138
+
139
+ | Option | Short | Description |
140
+ |--------|-------|-------------|
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 |
151
+
152
+ ## Procedure Generator
153
+
154
+ For single procedures or quick prototypes.
155
+
156
+ ```bash
157
+ # Simple single procedure
158
+ velox make procedure health
159
+
160
+ # CRUD with inline schemas
161
+ velox make procedure users --crud
162
+
163
+ # With pagination
164
+ velox make procedure posts --crud --paginated
165
+ ```
166
+
167
+ ### What It Creates
168
+
169
+ ```
170
+ src/
171
+ └── procedures/
172
+ └── users.ts # Procedures with inline schemas
173
+ ```
174
+
175
+ ### When to Use
176
+
177
+ - Adding a single endpoint (health check, webhook)
178
+ - Quick prototyping
179
+ - Self-contained procedure with inline schemas
180
+
181
+ ### Options
182
+
183
+ | Option | Short | Description |
184
+ |--------|-------|-------------|
185
+ | `--crud` | `-c` | Generate full CRUD operations |
186
+ | `--paginated` | `-P` | Include pagination |
187
+ | `--skip-registration` | `-S` | Don't auto-register |
188
+
189
+ ## Other Generators
190
+
191
+ ### Schema Generator
192
+
193
+ ```bash
194
+ velox make schema User
195
+ velox make schema Post --crud # With input schemas
196
+ ```
197
+
198
+ ### Model Generator
199
+
200
+ ```bash
201
+ velox make model User
202
+ velox make model Post --timestamps
203
+ ```
204
+
205
+ ### Job Generator (Background Tasks)
206
+
207
+ ```bash
208
+ velox make job SendWelcomeEmail
209
+ velox make job ProcessOrder --queue
210
+ ```
211
+
212
+ ### Mail Generator
213
+
214
+ ```bash
215
+ velox make mail WelcomeEmail
216
+ velox make mail OrderConfirmation --react # React Email template
217
+ ```
218
+
219
+ ### Guard Generator (Authentication)
220
+
221
+ ```bash
222
+ velox make guard admin # Role-based
223
+ velox make guard verified # Custom logic
224
+ ```
225
+
226
+ ### Policy Generator (Authorization)
227
+
228
+ ```bash
229
+ velox make policy PostPolicy
230
+ velox make policy CommentPolicy --crud
231
+ ```
232
+
233
+ ### Middleware Generator
234
+
235
+ ```bash
236
+ velox make middleware logging
237
+ velox make middleware rate-limit
238
+ ```
239
+
240
+ ### Service Generator
241
+
242
+ ```bash
243
+ velox make service PaymentService
244
+ velox make service EmailService --injectable
245
+ ```
246
+
247
+ ### Exception Generator
248
+
249
+ ```bash
250
+ velox make exception PaymentFailed
251
+ velox make exception ValidationFailed --http
252
+ ```
253
+
254
+ ### Task Generator (Scheduled)
255
+
256
+ ```bash
257
+ velox make task CleanupExpiredSessions
258
+ velox make task SendDailyDigest --cron="0 9 * * *"
259
+ ```
260
+
261
+ ## Common Workflows
262
+
263
+ ### New Feature: Blog Posts (AI Agent)
264
+
265
+ ```bash
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
285
+ pnpm db:push
286
+
287
+ # 4. (Optional) Seed sample data
288
+ velox make seeder PostSeeder
289
+ ```
290
+
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
302
+
303
+ ```bash
304
+ # Model already exists in Prisma
305
+ velox make namespace Order --example
306
+
307
+ # Or just add schema
308
+ velox make schema Order --crud
309
+ ```
310
+
311
+ ### Quick Utility Endpoint
312
+
313
+ ```bash
314
+ # Health check
315
+ velox make procedure health
316
+
317
+ # Then customize the generated file
318
+ ```
319
+
320
+ ### Background Processing
321
+
322
+ ```bash
323
+ # Create job
324
+ velox make job SendWelcomeEmail
325
+
326
+ # Create mail template
327
+ velox make mail WelcomeEmail --react
328
+
329
+ # Use in procedure
330
+ createUser: procedure()
331
+ .input(CreateUserSchema)
332
+ .mutation(async ({ ctx, input }) => {
333
+ const user = await ctx.db.user.create({ data: input });
334
+ await dispatch(SendWelcomeEmail, { userId: user.id });
335
+ return user;
336
+ }),
337
+ ```
338
+
339
+ ## Generator Aliases
340
+
341
+ | Full Command | Alias |
342
+ |--------------|-------|
343
+ | `velox make resource` | `velox m r` |
344
+ | `velox make namespace` | `velox m ns` |
345
+ | `velox make procedure` | `velox m p` |
346
+ | `velox make schema` | `velox m s` |
347
+ | `velox make model` | `velox m mod` |
348
+ | `velox make job` | `velox m j` |
349
+ | `velox make mail` | `velox m em` |
350
+ | `velox make guard` | `velox m g` |
351
+ | `velox make policy` | `velox m pol` |
352
+ | `velox make middleware` | `velox m mw` |
353
+ | `velox make service` | `velox m svc` |
354
+ | `velox make exception` | `velox m ex` |
355
+ | `velox make task` | `velox m task` |