create-velox-app 0.6.64 → 0.6.65

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.65
4
+
5
+ ### Patch Changes
6
+
7
+ - improve ai integration and simplify api router definition
8
+
3
9
  ## 0.6.64
4
10
 
5
11
  ### 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.65",
4
4
  "description": "Project scaffolder for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,313 @@
1
+ # VeloxTS Generators Guide
2
+
3
+ ## Decision Tree: Which Generator?
4
+
5
+ ```
6
+ 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)
13
+
14
+ └── NO → What do you need?
15
+ ├── Single API endpoint → velox make procedure
16
+ ├── Validation schema only → velox make schema
17
+ ├── Database model only → velox make model
18
+ ├── Background job → velox make job
19
+ ├── Email template → velox make mail
20
+ ├── Auth guard → velox make guard
21
+ ├── Auth policy → velox make policy
22
+ ├── Middleware → velox make middleware
23
+ ├── Service class → velox make service
24
+ ├── Custom exception → velox make exception
25
+ └── Scheduled task → velox make task
26
+ ```
27
+
28
+ ## Generator Comparison
29
+
30
+ | Generator | Creates | Use When |
31
+ |-----------|---------|----------|
32
+ | `resource` | Prisma + Schema + Procedures + Tests | **New database entity** (recommended default) |
33
+ | `namespace` | Schema + Procedures | Existing model or external API |
34
+ | `procedure` | Procedures (inline schemas) | Single endpoint, quick prototype |
35
+ | `schema` | Zod schema file | Standalone validation |
36
+ | `model` | Prisma model | Database-only change |
37
+
38
+ ## Resource Generator [RECOMMENDED]
39
+
40
+ The full-stack generator for new entities. Like Laravel's `make:model -a`.
41
+
42
+ ```bash
43
+ # Basic usage
44
+ velox make resource Post
45
+
46
+ # Full CRUD with pagination
47
+ velox make resource Post --crud --paginated
48
+
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
60
+ ```
61
+
62
+ ### What It Creates
63
+
64
+ ```
65
+ src/
66
+ ├── procedures/
67
+ │ ├── posts.ts # CRUD procedures
68
+ │ └── __tests__/
69
+ │ └── posts.test.ts # Unit tests
70
+ ├── schemas/
71
+ │ └── post.schema.ts # Zod validation
72
+ └── models/
73
+ └── post.prisma # Injected into schema.prisma
74
+ ```
75
+
76
+ ### Options
77
+
78
+ | Option | Short | Description |
79
+ |--------|-------|-------------|
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 |
90
+
91
+ ## Namespace Generator
92
+
93
+ For existing Prisma models or external data sources.
94
+
95
+ ```bash
96
+ # Empty namespace (add procedures manually)
97
+ velox make namespace products
98
+
99
+ # With example CRUD
100
+ velox make namespace orders --example
101
+
102
+ # Short form
103
+ velox m ns inventory -e
104
+ ```
105
+
106
+ ### What It Creates
107
+
108
+ ```
109
+ src/
110
+ ├── procedures/
111
+ │ └── products.ts # Procedure namespace
112
+ └── schemas/
113
+ └── product.ts # Zod schema
114
+ ```
115
+
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
+ ### Options
124
+
125
+ | Option | Short | Description |
126
+ |--------|-------|-------------|
127
+ | `--example` | `-e` | Include example CRUD procedures |
128
+ | `--skip-registration` | `-S` | Don't auto-register in router |
129
+
130
+ ## Procedure Generator
131
+
132
+ For single procedures or quick prototypes.
133
+
134
+ ```bash
135
+ # Simple single procedure
136
+ velox make procedure health
137
+
138
+ # CRUD with inline schemas
139
+ velox make procedure users --crud
140
+
141
+ # With pagination
142
+ velox make procedure posts --crud --paginated
143
+ ```
144
+
145
+ ### What It Creates
146
+
147
+ ```
148
+ src/
149
+ └── procedures/
150
+ └── users.ts # Procedures with inline schemas
151
+ ```
152
+
153
+ ### When to Use
154
+
155
+ - Adding a single endpoint (health check, webhook)
156
+ - Quick prototyping
157
+ - Self-contained procedure with inline schemas
158
+
159
+ ### Options
160
+
161
+ | Option | Short | Description |
162
+ |--------|-------|-------------|
163
+ | `--crud` | `-c` | Generate full CRUD operations |
164
+ | `--paginated` | `-P` | Include pagination |
165
+ | `--skip-registration` | `-S` | Don't auto-register |
166
+
167
+ ## Other Generators
168
+
169
+ ### Schema Generator
170
+
171
+ ```bash
172
+ velox make schema User
173
+ velox make schema Post --crud # With input schemas
174
+ ```
175
+
176
+ ### Model Generator
177
+
178
+ ```bash
179
+ velox make model User
180
+ velox make model Post --timestamps
181
+ ```
182
+
183
+ ### Job Generator (Background Tasks)
184
+
185
+ ```bash
186
+ velox make job SendWelcomeEmail
187
+ velox make job ProcessOrder --queue
188
+ ```
189
+
190
+ ### Mail Generator
191
+
192
+ ```bash
193
+ velox make mail WelcomeEmail
194
+ velox make mail OrderConfirmation --react # React Email template
195
+ ```
196
+
197
+ ### Guard Generator (Authentication)
198
+
199
+ ```bash
200
+ velox make guard admin # Role-based
201
+ velox make guard verified # Custom logic
202
+ ```
203
+
204
+ ### Policy Generator (Authorization)
205
+
206
+ ```bash
207
+ velox make policy PostPolicy
208
+ velox make policy CommentPolicy --crud
209
+ ```
210
+
211
+ ### Middleware Generator
212
+
213
+ ```bash
214
+ velox make middleware logging
215
+ velox make middleware rate-limit
216
+ ```
217
+
218
+ ### Service Generator
219
+
220
+ ```bash
221
+ velox make service PaymentService
222
+ velox make service EmailService --injectable
223
+ ```
224
+
225
+ ### Exception Generator
226
+
227
+ ```bash
228
+ velox make exception PaymentFailed
229
+ velox make exception ValidationFailed --http
230
+ ```
231
+
232
+ ### Task Generator (Scheduled)
233
+
234
+ ```bash
235
+ velox make task CleanupExpiredSessions
236
+ velox make task SendDailyDigest --cron="0 9 * * *"
237
+ ```
238
+
239
+ ## Common Workflows
240
+
241
+ ### New Feature: Blog Posts
242
+
243
+ ```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
252
+ pnpm db:push
253
+
254
+ # 4. Seed sample data
255
+ velox make seeder PostSeeder
256
+ pnpm velox db seed
257
+ ```
258
+
259
+ ### Adding to Existing Model
260
+
261
+ ```bash
262
+ # Model already exists in Prisma
263
+ velox make namespace Order --example
264
+
265
+ # Or just add schema
266
+ velox make schema Order --crud
267
+ ```
268
+
269
+ ### Quick Utility Endpoint
270
+
271
+ ```bash
272
+ # Health check
273
+ velox make procedure health
274
+
275
+ # Then customize the generated file
276
+ ```
277
+
278
+ ### Background Processing
279
+
280
+ ```bash
281
+ # Create job
282
+ velox make job SendWelcomeEmail
283
+
284
+ # Create mail template
285
+ velox make mail WelcomeEmail --react
286
+
287
+ # Use in procedure
288
+ createUser: procedure()
289
+ .input(CreateUserSchema)
290
+ .mutation(async ({ ctx, input }) => {
291
+ const user = await ctx.db.user.create({ data: input });
292
+ await dispatch(SendWelcomeEmail, { userId: user.id });
293
+ return user;
294
+ }),
295
+ ```
296
+
297
+ ## Generator Aliases
298
+
299
+ | Full Command | Alias |
300
+ |--------------|-------|
301
+ | `velox make resource` | `velox m r` |
302
+ | `velox make namespace` | `velox m ns` |
303
+ | `velox make procedure` | `velox m p` |
304
+ | `velox make schema` | `velox m s` |
305
+ | `velox make model` | `velox m mod` |
306
+ | `velox make job` | `velox m j` |
307
+ | `velox make mail` | `velox m em` |
308
+ | `velox make guard` | `velox m g` |
309
+ | `velox make policy` | `velox m pol` |
310
+ | `velox make middleware` | `velox m mw` |
311
+ | `velox make service` | `velox m svc` |
312
+ | `velox make exception` | `velox m ex` |
313
+ | `velox make task` | `velox m task` |