create-kuckit-app 0.1.0 → 0.2.0

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 (92) hide show
  1. package/dist/bin.js +11 -5
  2. package/dist/{create-project-DTm05G7D.js → create-project-CP-h4Ygi.js} +7 -5
  3. package/dist/index.js +1 -1
  4. package/package.json +3 -2
  5. package/templates/base/.claude/CLAUDE.md +44 -0
  6. package/templates/base/.claude/agents/daidalos.md +76 -0
  7. package/templates/base/.claude/agents/episteme.md +79 -0
  8. package/templates/base/.claude/agents/librarian.md +132 -0
  9. package/templates/base/.claude/agents/oracle.md +210 -0
  10. package/templates/base/.claude/commands/create-plan.md +159 -0
  11. package/templates/base/.claude/commands/file-beads.md +98 -0
  12. package/templates/base/.claude/commands/review-beads.md +161 -0
  13. package/templates/base/.claude/settings.json +11 -0
  14. package/templates/base/.claude/skills/kuckit/SKILL.md +436 -0
  15. package/templates/base/.claude/skills/kuckit/references/ARCHITECTURE.md +388 -0
  16. package/templates/base/.claude/skills/kuckit/references/CLI-COMMANDS.md +365 -0
  17. package/templates/base/.claude/skills/kuckit/references/MODULE-DEVELOPMENT.md +581 -0
  18. package/templates/base/.claude/skills/kuckit/references/PACKAGES.md +112 -0
  19. package/templates/base/.claude/skills/kuckit/references/PUBLISHING.md +231 -0
  20. package/templates/base/.env.example +13 -0
  21. package/templates/base/.github/workflows/ci.yml +28 -0
  22. package/templates/base/.husky/pre-commit +1 -0
  23. package/templates/base/.prettierignore +5 -0
  24. package/templates/base/.prettierrc +8 -0
  25. package/templates/base/AGENTS.md +148 -0
  26. package/templates/base/apps/server/.env.example +18 -0
  27. package/templates/base/apps/server/AGENTS.md +37 -0
  28. package/templates/base/apps/server/package.json +13 -4
  29. package/templates/base/apps/server/src/app.ts +20 -0
  30. package/templates/base/apps/server/src/auth.ts +10 -0
  31. package/templates/base/apps/server/src/config/modules.ts +14 -6
  32. package/templates/base/apps/server/src/container.ts +81 -0
  33. package/templates/base/apps/server/src/health.ts +27 -0
  34. package/templates/base/apps/server/src/middleware/container.ts +41 -0
  35. package/templates/base/apps/server/src/rpc-router-registry.ts +26 -0
  36. package/templates/base/apps/server/src/rpc.ts +31 -0
  37. package/templates/base/apps/server/src/server.ts +39 -29
  38. package/templates/base/apps/web/.env.example +4 -0
  39. package/templates/base/apps/web/AGENTS.md +53 -0
  40. package/templates/base/apps/web/index.html +1 -1
  41. package/templates/base/apps/web/package.json +15 -3
  42. package/templates/base/apps/web/src/lib/kuckit-router.ts +42 -0
  43. package/templates/base/apps/web/src/main.tsx +26 -14
  44. package/templates/base/apps/web/src/providers/KuckitProvider.tsx +147 -0
  45. package/templates/base/apps/web/src/providers/ServicesProvider.tsx +47 -0
  46. package/templates/base/apps/web/src/routeTree.gen.ts +91 -0
  47. package/templates/base/apps/web/src/routes/__root.tsx +31 -0
  48. package/templates/base/apps/web/src/routes/index.tsx +46 -0
  49. package/templates/base/apps/web/src/routes/login.tsx +108 -0
  50. package/templates/base/apps/web/src/services/auth-client.ts +12 -0
  51. package/templates/base/apps/web/src/services/index.ts +3 -0
  52. package/templates/base/apps/web/src/services/rpc.ts +29 -0
  53. package/templates/base/apps/web/src/services/types.ts +14 -0
  54. package/templates/base/apps/web/vite.config.ts +2 -1
  55. package/templates/base/docker-compose.yml +23 -0
  56. package/templates/base/eslint.config.js +18 -0
  57. package/templates/base/package.json +32 -2
  58. package/templates/base/packages/api/AGENTS.md +27 -0
  59. package/templates/base/packages/api/package.json +35 -0
  60. package/templates/base/packages/api/src/context.ts +48 -0
  61. package/templates/base/packages/api/src/index.ts +22 -0
  62. package/templates/base/packages/api/tsconfig.json +8 -0
  63. package/templates/base/packages/auth/AGENTS.md +45 -0
  64. package/templates/base/packages/auth/package.json +27 -0
  65. package/templates/base/packages/auth/src/index.ts +22 -0
  66. package/templates/base/packages/auth/tsconfig.json +8 -0
  67. package/templates/base/packages/db/AGENTS.md +59 -0
  68. package/templates/base/packages/db/drizzle.config.ts +19 -0
  69. package/templates/base/packages/db/package.json +36 -0
  70. package/templates/base/packages/db/src/connection.ts +40 -0
  71. package/templates/base/packages/db/src/index.ts +4 -0
  72. package/templates/base/packages/db/src/migrations/0000_init.sql +54 -0
  73. package/templates/base/packages/db/src/migrations/meta/_journal.json +13 -0
  74. package/templates/base/packages/db/src/schema/auth.ts +51 -0
  75. package/templates/base/packages/db/tsconfig.json +8 -0
  76. package/templates/base/packages/items-module/AGENTS.md +112 -0
  77. package/templates/base/packages/items-module/package.json +32 -0
  78. package/templates/base/packages/items-module/src/adapters/item.drizzle.ts +66 -0
  79. package/templates/base/packages/items-module/src/api/items.router.ts +47 -0
  80. package/templates/base/packages/items-module/src/client-module.ts +39 -0
  81. package/templates/base/packages/items-module/src/domain/item.entity.ts +36 -0
  82. package/templates/base/packages/items-module/src/index.ts +15 -0
  83. package/templates/base/packages/items-module/src/module.ts +53 -0
  84. package/templates/base/packages/items-module/src/ports/item.repository.ts +13 -0
  85. package/templates/base/packages/items-module/src/ui/ItemsPage.tsx +162 -0
  86. package/templates/base/packages/items-module/src/usecases/create-item.ts +25 -0
  87. package/templates/base/packages/items-module/src/usecases/delete-item.ts +18 -0
  88. package/templates/base/packages/items-module/src/usecases/get-item.ts +19 -0
  89. package/templates/base/packages/items-module/src/usecases/list-items.ts +21 -0
  90. package/templates/base/packages/items-module/tsconfig.json +9 -0
  91. package/templates/base/turbo.json +13 -1
  92. package/templates/base/apps/web/src/App.tsx +0 -16
@@ -0,0 +1,436 @@
1
+ ---
2
+ name: kuckit
3
+ description: Comprehensive Kuckit framework development assistant for building modular full-stack TypeScript applications. Use for any Kuckit-related questions including SDK usage, module development, CLI commands, Clean Architecture patterns, DI container setup, infrastructure deployment, and troubleshooting. Works with @kuckit/sdk, @kuckit/cli, and the entire kuckit ecosystem.
4
+ ---
5
+
6
+ # Kuckit Framework Skill
7
+
8
+ This skill provides comprehensive assistance for developing applications with the Kuckit framework - a full-stack TypeScript monorepo implementing Clean Architecture with a modular plugin system.
9
+
10
+ ## When to Use This Skill
11
+
12
+ Use this skill when you need help with:
13
+
14
+ - Creating or modifying Kuckit modules (server and client)
15
+ - Understanding the Kuckit SDK and DI container
16
+ - Using Kuckit CLI commands
17
+ - Implementing Clean Architecture patterns
18
+ - Working with the module system lifecycle
19
+ - Database operations with Drizzle ORM
20
+ - Infrastructure deployment to GCP
21
+ - Troubleshooting Kuckit applications
22
+
23
+ ## Project Location
24
+
25
+ The Kuckit codebase is located at the project root (where this skill is installed).
26
+
27
+ ## Quick Reference
28
+
29
+ ### Core Documentation Files
30
+
31
+ | Document | Path | Description |
32
+ | --------------- | ------------------------------- | -------------------------------- |
33
+ | Architecture | `docs/ARCHITECTURE.md` | System architecture and diagrams |
34
+ | Index | `docs/INDEX.md` | Documentation navigation |
35
+ | Troubleshooting | `docs/TROUBLESHOOTING.md` | Common issues and solutions |
36
+ | CLI Docs | `packages/kuckit-cli/AGENTS.md` | CLI command reference |
37
+ | SDK README | `packages/sdk/README.md` | SDK quick start |
38
+
39
+ ### Package Structure
40
+
41
+ ```
42
+ packages/
43
+ ├── sdk/ # Backend DI container & module system
44
+ ├── sdk-react/ # Frontend module system
45
+ ├── kuckit-cli/ # CLI tooling
46
+ ├── create-kuckit-app/ # Project scaffolding
47
+ ├── domain/ # Business entities (no dependencies)
48
+ ├── application/ # Use cases and business logic
49
+ ├── contracts/ # DTOs and Zod schemas
50
+ ├── infrastructure/ # Repository implementations
51
+ ├── api/ # oRPC procedures
52
+ ├── db/ # Drizzle ORM schemas
53
+ ├── auth/ # Better-Auth configuration
54
+ ├── infra/ # Pulumi infrastructure
55
+ ├── users-module/ # Reference module implementation
56
+ ├── landing-module/ # Landing page module
57
+ └── cli-auth-module/ # CLI authentication module
58
+ ```
59
+
60
+ ---
61
+
62
+ ## CLI Commands
63
+
64
+ ### Module Management
65
+
66
+ ```bash
67
+ # Generate a new module
68
+ bunx kuckit generate module <name>
69
+ bunx kuckit generate module billing --org acme --dir packages
70
+
71
+ # Install and wire a module
72
+ bunx kuckit add <package>
73
+ bunx kuckit add @acme/billing-module --skip-install
74
+
75
+ # Search npm for modules
76
+ bunx kuckit search <keyword>
77
+ bunx kuckit search billing --limit 20 --json
78
+
79
+ # Find unregistered modules
80
+ bunx kuckit discover
81
+ bunx kuckit discover --json --interactive
82
+
83
+ # Validate project setup
84
+ bunx kuckit doctor
85
+ ```
86
+
87
+ ### Database Commands
88
+
89
+ ```bash
90
+ bunx kuckit db push # Push schemas to database
91
+ bunx kuckit db generate # Generate migrations
92
+ bunx kuckit db studio # Open Drizzle Studio
93
+ ```
94
+
95
+ ### Authentication Commands
96
+
97
+ ```bash
98
+ bunx kuckit auth login # OAuth device flow login
99
+ bunx kuckit auth logout # Clear credentials
100
+ bunx kuckit auth whoami # Show current user
101
+ ```
102
+
103
+ ### Infrastructure Commands
104
+
105
+ ```bash
106
+ # Initialize infrastructure
107
+ bunx kuckit infra init --provider gcp --project <id> --region us-central1 --env dev
108
+
109
+ # Deploy to Cloud Run
110
+ bunx kuckit infra deploy --env dev
111
+ bunx kuckit infra deploy --env dev --preview # Preview only
112
+
113
+ # Database operations
114
+ bunx kuckit infra db:push --env dev
115
+ bunx kuckit infra db:migrate --env dev
116
+
117
+ # Management
118
+ bunx kuckit infra status # Show state
119
+ bunx kuckit infra logs -f # Stream logs
120
+ bunx kuckit infra rollback # Rollback revision
121
+ bunx kuckit infra destroy # Destroy resources
122
+ bunx kuckit infra repair # Fix state issues
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Module Development
128
+
129
+ ### Server Module Definition
130
+
131
+ ```typescript
132
+ // src/module.ts
133
+ import { defineKuckitModule, asClass, asFunction } from '@kuckit/sdk'
134
+
135
+ interface BillingModuleConfig {
136
+ currency: string
137
+ taxRate: number
138
+ }
139
+
140
+ export const kuckitModule = defineKuckitModule<BillingModuleConfig>({
141
+ id: 'acme.billing',
142
+ displayName: 'Billing',
143
+ description: 'Invoice and payment processing',
144
+ version: '1.0.0',
145
+
146
+ // Register DI dependencies
147
+ register(ctx) {
148
+ ctx.container.register({
149
+ invoiceRepository: asClass(DrizzleInvoiceRepository).scoped(),
150
+ paymentService: asFunction(makePaymentService).singleton(),
151
+ })
152
+ },
153
+
154
+ // Register API routes
155
+ registerApi(ctx) {
156
+ ctx.addApiRegistration({
157
+ type: 'rpc-router',
158
+ name: 'billing',
159
+ router: createBillingRouter(ctx.container),
160
+ })
161
+ },
162
+
163
+ // Startup logic
164
+ onBootstrap(ctx) {
165
+ const logger = ctx.container.resolve('logger')
166
+ logger.info(`Billing module initialized with currency: ${ctx.config.currency}`)
167
+ },
168
+
169
+ // Shutdown logic
170
+ onShutdown(ctx) {
171
+ ctx.logger.info('Billing module stopped')
172
+ },
173
+ })
174
+ ```
175
+
176
+ ### Client Module Definition
177
+
178
+ ```typescript
179
+ // src/client/module.ts
180
+ import { defineKuckitClientModule } from '@kuckit/sdk-react'
181
+
182
+ export const kuckitClientModule = defineKuckitClientModule({
183
+ id: 'acme.billing',
184
+
185
+ routes: [
186
+ { path: '/billing', component: BillingPage },
187
+ { path: '/billing/invoices', component: InvoicesPage },
188
+ ],
189
+
190
+ navItems: [{ label: 'Billing', href: '/billing', icon: CreditCard }],
191
+ })
192
+ ```
193
+
194
+ ### Module package.json Metadata
195
+
196
+ ```json
197
+ {
198
+ "name": "@acme/billing-module",
199
+ "kuckit": {
200
+ "id": "acme.billing",
201
+ "server": "./dist/module.js",
202
+ "client": "./dist/client/module.js",
203
+ "schema": "./src/server/schema/index.ts"
204
+ }
205
+ }
206
+ ```
207
+
208
+ ---
209
+
210
+ ## SDK Core Services
211
+
212
+ After `createKuckitContainer()`, these services are available:
213
+
214
+ | Token | Type | Description |
215
+ | ------------------ | ------------------ | ------------------------------ |
216
+ | `config` | `CoreConfig` | Application configuration |
217
+ | `db` | Drizzle instance | Database query builder |
218
+ | `dbPool` | `Pool` | Raw PostgreSQL connection pool |
219
+ | `logger` | `Logger` | Structured logging |
220
+ | `eventBus` | `EventBus` | Pub/sub event system |
221
+ | `clock` | `Clock` | Time abstraction (testable) |
222
+ | `cacheStore` | `CacheStore` | Key-value cache |
223
+ | `rateLimiterStore` | `RateLimiterStore` | Rate limiting |
224
+ | `auth` | Auth utilities | Authentication helpers |
225
+
226
+ ### Container Usage
227
+
228
+ ```typescript
229
+ import { createKuckitContainer, loadKuckitModules, disposeContainer } from '@kuckit/sdk'
230
+
231
+ // Create container with core services
232
+ const container = await createKuckitContainer({
233
+ config: {
234
+ databaseUrl: process.env.DATABASE_URL!,
235
+ enableFileLogging: false,
236
+ logDir: './logs',
237
+ logLevel: 'INFO',
238
+ env: 'development',
239
+ },
240
+ })
241
+
242
+ // Load modules
243
+ await loadKuckitModules({
244
+ container,
245
+ env: 'development',
246
+ modules: [
247
+ { module: usersModule, config: { enableCaching: true } },
248
+ { package: '@acme/billing-module' },
249
+ ],
250
+ onApiRegistrations: (registrations) => {
251
+ // Wire API routes to your framework
252
+ },
253
+ })
254
+
255
+ // Resolve services
256
+ const logger = container.resolve('logger')
257
+ const userRepo = container.resolve('userRepository')
258
+
259
+ // Cleanup on shutdown
260
+ await disposeContainer(container)
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Clean Architecture Layers
266
+
267
+ ### Dependency Rules
268
+
269
+ ```
270
+ domain <- (no deps, pure business logic)
271
+ ^
272
+ |
273
+ application <- (imports domain only)
274
+ ^
275
+ |
276
+ infrastructure <- (imports domain, external libs)
277
+ ^
278
+ |
279
+ api <- (imports domain, application, contracts)
280
+ ^
281
+ |
282
+ sdk <- (imports all core packages)
283
+ ^
284
+ |
285
+ server/web <- (imports sdk and above)
286
+ ```
287
+
288
+ ### Package Responsibilities
289
+
290
+ | Layer | Package | Responsibility |
291
+ | -------------- | ------------------------- | ---------------------------------- |
292
+ | Domain | `packages/domain` | Business entities, port interfaces |
293
+ | Domain | `packages/contracts` | DTOs, Zod validation schemas |
294
+ | Application | `packages/application` | Use cases, business workflows |
295
+ | Infrastructure | `packages/infrastructure` | Repository implementations |
296
+ | Infrastructure | `packages/db` | Drizzle ORM schemas |
297
+ | Infrastructure | `packages/auth` | Better-Auth configuration |
298
+ | API | `packages/api` | oRPC procedures |
299
+ | SDK | `packages/sdk` | Backend module system |
300
+ | SDK | `packages/sdk-react` | Frontend module system |
301
+
302
+ ---
303
+
304
+ ## Configuration
305
+
306
+ ### kuckit.config.ts
307
+
308
+ ```typescript
309
+ import { defineConfig } from '@kuckit/sdk'
310
+
311
+ export default defineConfig({
312
+ modules: ['@kuckit/users-module', '@acme/billing-module'],
313
+ })
314
+ ```
315
+
316
+ ### Configuration Files (search order)
317
+
318
+ 1. `kuckit.config.ts`
319
+ 2. `kuckit.config.js`
320
+ 3. `.kuckitrc.ts`
321
+ 4. `.kuckitrc.js`
322
+ 5. `.kuckitrc` (JSON)
323
+
324
+ ### User Credentials
325
+
326
+ Stored at: `~/.kuckit/config.json`
327
+
328
+ ### Infrastructure State
329
+
330
+ Stored at: `.kuckit/infra.json`
331
+
332
+ ---
333
+
334
+ ## Common Patterns
335
+
336
+ ### Adding a New Feature
337
+
338
+ 1. Create domain entity in `packages/domain`
339
+ 2. Add DTOs/schemas in `packages/contracts`
340
+ 3. Implement use case in `packages/application`
341
+ 4. Create repository in `packages/infrastructure`
342
+ 5. Add oRPC procedure in `packages/api`
343
+ 6. Register in module's `register()` hook
344
+ 7. Add route in client module
345
+
346
+ ### Resolving Services with Types
347
+
348
+ ```typescript
349
+ import type { Container } from '@kuckit/sdk'
350
+
351
+ function createService(container: Container) {
352
+ const logger = container.resolve('logger')
353
+ const db = container.resolve('db')
354
+ // ...
355
+ }
356
+ ```
357
+
358
+ ### Testing with Mock Services
359
+
360
+ ```typescript
361
+ import { createTestContainer } from '@kuckit/sdk/testing'
362
+
363
+ const container = await createTestContainer({
364
+ overrides: {
365
+ clock: asValue(new FakeClock()),
366
+ cacheStore: asValue(new InMemoryCacheStore()),
367
+ },
368
+ })
369
+ ```
370
+
371
+ ---
372
+
373
+ ## Troubleshooting
374
+
375
+ ### Common Issues
376
+
377
+ | Issue | Solution |
378
+ | -------------------------- | --------------------------------------------------------- |
379
+ | Module not found | Run `bunx kuckit discover` to find unregistered modules |
380
+ | Container resolution error | Check module's `register()` hook for missing dependencies |
381
+ | Database connection failed | Verify `DATABASE_URL` environment variable |
382
+ | CLI auth expired | Run `bunx kuckit auth login` to refresh token |
383
+ | Pulumi state issues | Run `bunx kuckit infra repair --refresh` |
384
+
385
+ ### Debugging
386
+
387
+ ```bash
388
+ # Check project setup
389
+ bunx kuckit doctor
390
+
391
+ # View infrastructure state
392
+ bunx kuckit infra status
393
+
394
+ # Stream logs
395
+ bunx kuckit infra logs -f --severity ERROR
396
+ ```
397
+
398
+ ---
399
+
400
+ ## Key Source Files
401
+
402
+ ### CLI Entry Points
403
+
404
+ | File | Purpose |
405
+ | ----------------------------------- | ----------------------- |
406
+ | `packages/kuckit-cli/src/bin.ts` | CLI entry point |
407
+ | `packages/kuckit-cli/src/commands/` | Command implementations |
408
+
409
+ ### SDK Core
410
+
411
+ | File | Purpose |
412
+ | ------------------------------------------- | ------------------------ |
413
+ | `packages/sdk/src/core/container.ts` | DI container setup |
414
+ | `packages/sdk/src/modules/define-module.ts` | Module definition helper |
415
+ | `packages/sdk/src/modules/loader.ts` | Module loading logic |
416
+
417
+ ### Example Modules
418
+
419
+ | Module | Path |
420
+ | --------------- | --------------------------- |
421
+ | Users Module | `packages/users-module/` |
422
+ | Landing Module | `packages/landing-module/` |
423
+ | CLI Auth Module | `packages/cli-auth-module/` |
424
+
425
+ ---
426
+
427
+ ## Getting Help
428
+
429
+ When working with Kuckit:
430
+
431
+ 1. **Read the AGENTS.md** in each package for development rules
432
+ 2. **Check ARCHITECTURE.md** for understanding the layer system
433
+ 3. **Use `kuckit doctor`** to validate your setup
434
+ 4. **Explore reference modules** (users-module) for implementation patterns
435
+
436
+ For infrastructure issues, check `docs/TROUBLESHOOTING.md`