create-kuckit-app 2.0.2 → 2.1.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 (52) hide show
  1. package/README.md +24 -14
  2. package/package.json +1 -1
  3. package/templates/base/.claude/skills/beads/CLAUDE.md +87 -0
  4. package/templates/base/.claude/skills/beads/README.md +123 -0
  5. package/templates/base/.claude/skills/beads/SKILL.md +77 -715
  6. package/templates/base/.claude/skills/beads/adr/0001-bd-prime-as-source-of-truth.md +61 -0
  7. package/templates/base/.claude/skills/beads/resources/AGENTS.md +62 -0
  8. package/templates/base/.claude/skills/beads/resources/ASYNC_GATES.md +175 -0
  9. package/templates/base/.claude/skills/beads/resources/BOUNDARIES.md +520 -0
  10. package/templates/base/.claude/skills/beads/resources/CHEMISTRY_PATTERNS.md +197 -0
  11. package/templates/base/.claude/skills/beads/resources/CLI_REFERENCE.md +561 -0
  12. package/templates/base/.claude/skills/beads/resources/DEPENDENCIES.md +754 -0
  13. package/templates/base/.claude/skills/beads/resources/INTEGRATION_PATTERNS.md +438 -0
  14. package/templates/base/.claude/skills/beads/resources/ISSUE_CREATION.md +150 -0
  15. package/templates/base/.claude/skills/beads/resources/MOLECULES.md +370 -0
  16. package/templates/base/.claude/skills/beads/resources/PATTERNS.md +363 -0
  17. package/templates/base/.claude/skills/beads/resources/RESUMABILITY.md +239 -0
  18. package/templates/base/.claude/skills/beads/resources/STATIC_DATA.md +61 -0
  19. package/templates/base/.claude/skills/beads/resources/TROUBLESHOOTING.md +537 -0
  20. package/templates/base/.claude/skills/beads/resources/WORKFLOWS.md +638 -0
  21. package/templates/base/.claude/skills/beads/resources/WORKTREES.md +95 -0
  22. package/templates/base/.claude/skills/browser-skill/SKILL.md +72 -0
  23. package/templates/base/.claude/skills/knowledge/SKILL.md +155 -205
  24. package/templates/base/.claude/skills/knowledge/reference/doc-mapping.md +49 -0
  25. package/templates/base/.claude/skills/knowledge/reference/extraction-prompts.md +102 -0
  26. package/templates/base/.claude/skills/kuckit/SKILL.md +15 -9
  27. package/templates/base/.claude/skills/kuckit/references/MODULE-DEVELOPMENT.md +142 -0
  28. package/templates/base/.claude/skills/kuckit/references/PACKAGES.md +22 -17
  29. package/templates/base/.claude/skills/kuckit/references/PUBLISHING.md +92 -0
  30. package/templates/base/.claude/skills/module-testing/SKILL.md +1 -1
  31. package/templates/base/.claude/skills/planning/SKILL.md +26 -1
  32. package/templates/base/.env.example +1 -1
  33. package/templates/base/AGENTS.md +155 -418
  34. package/templates/base/apps/server/src/modules.ts +14 -1
  35. package/templates/base/apps/web/.env.example +1 -1
  36. package/templates/base/apps/web/src/routes/$.tsx +0 -1
  37. package/templates/base/apps/web/src/routes/dashboard.tsx +3 -1
  38. package/templates/base/docs/ARCHITECTURE.md +689 -0
  39. package/templates/base/docs/DEPENDENCY-INJECTION.md +871 -0
  40. package/templates/base/docs/DEPLOYMENT.md +573 -0
  41. package/templates/base/docs/INDEX.md +135 -0
  42. package/templates/base/docs/MIGRATION.md +989 -0
  43. package/templates/base/docs/MODULE_CSS.md +343 -0
  44. package/templates/base/docs/MODULE_TESTING.md +368 -0
  45. package/templates/base/docs/MULTI_AGENT_WORKFLOW.md +909 -0
  46. package/templates/base/docs/TESTING.md +579 -0
  47. package/templates/base/docs/TROUBLESHOOTING.md +360 -0
  48. package/templates/base/package.json +2 -0
  49. package/templates/base/packages/items-module/AGENTS.md +3 -1
  50. package/templates/base/packages/items-module/src/server/adapters/{item.drizzle.ts → item.repository.ts} +1 -13
  51. package/templates/base/packages/items-module/src/server/module.ts +2 -1
  52. package/templates/base/packages/items-module/src/server/schema/item.ts +13 -0
@@ -0,0 +1,343 @@
1
+ # Module CSS Aggregator Pattern
2
+
3
+ This guide covers how Kuckit handles CSS from modules, including how module authors should structure their styles and how app developers can manage module CSS imports.
4
+
5
+ ## Overview
6
+
7
+ Kuckit uses a **CSS aggregator pattern** to manage styles from multiple modules. Instead of manually adding CSS imports for each module, the CLI automatically injects imports into a centralized aggregator file when you run `kuckit add`.
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────────────────────┐
11
+ │ apps/web/src/index.css │
12
+ │ ───────────────────────────────────────────────────────────────── │
13
+ │ @import "./kuckit-modules.css"; ◄── Single import │
14
+ │ @import "tailwindcss"; │
15
+ └─────────────────────────────────────────────────────────────────────┘
16
+
17
+
18
+ ┌─────────────────────────────────────────────────────────────────────┐
19
+ │ apps/web/src/kuckit-modules.css │
20
+ │ ───────────────────────────────────────────────────────────────── │
21
+ │ /* KUCKIT_MODULE_STYLES_START */ │
22
+ │ @import "@kuckit/docs-module/styles.css"; ◄── Auto-injected │
23
+ │ @import "@acme/billing-module/styles.css"; ◄── by CLI │
24
+ │ /* KUCKIT_MODULE_STYLES_END */ │
25
+ └─────────────────────────────────────────────────────────────────────┘
26
+ ```
27
+
28
+ ### How It Works
29
+
30
+ 1. **Module declares styles** via `kuckit.styles` in `package.json`
31
+ 2. **CLI injects import** into the aggregator when you run `kuckit add <module>`
32
+ 3. **App imports aggregator** once in `index.css`
33
+ 4. **Tailwind scans modules** via `@source` directives in each module's CSS
34
+
35
+ ---
36
+
37
+ ## Module Author Guide
38
+
39
+ If you're building a Kuckit module with UI components, follow this guide to ensure your styles work correctly.
40
+
41
+ ### 1. Create a Styles File
42
+
43
+ Create `src/styles.css` in your module with Tailwind source directives:
44
+
45
+ ```css
46
+ /* src/styles.css */
47
+
48
+ /* Tell Tailwind to scan this module's components for class names */
49
+ @source "./client/**/*.tsx";
50
+ @source "./ui/**/*.tsx";
51
+
52
+ /* Optional: Add module-specific styles */
53
+ .my-module-card {
54
+ @apply rounded-lg border bg-card p-4;
55
+ }
56
+ ```
57
+
58
+ > **Note**: The `@source` directive tells Tailwind where to look for class names when generating CSS. Without it, Tailwind won't include your component's utility classes.
59
+
60
+ ### 2. Export the Styles in package.json
61
+
62
+ Add the styles file to your package exports and declare it in the `kuckit` metadata:
63
+
64
+ ```json
65
+ {
66
+ "name": "@acme/billing-module",
67
+ "exports": {
68
+ ".": {
69
+ "types": "./src/index.ts",
70
+ "default": "./src/index.ts"
71
+ },
72
+ "./client": {
73
+ "types": "./src/client/index.ts",
74
+ "default": "./src/client/index.ts"
75
+ },
76
+ "./styles.css": "./src/styles.css"
77
+ },
78
+ "publishConfig": {
79
+ "exports": {
80
+ ".": {
81
+ "types": "./dist/index.d.ts",
82
+ "default": "./dist/index.js"
83
+ },
84
+ "./client": {
85
+ "types": "./dist/client/index.d.ts",
86
+ "default": "./dist/client/index.js"
87
+ },
88
+ "./styles.css": "./dist/styles.css"
89
+ }
90
+ },
91
+ "kuckit": {
92
+ "id": "acme.billing",
93
+ "server": ".",
94
+ "client": "./client",
95
+ "styles": "./styles.css"
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### 3. Align Published Paths
101
+
102
+ The `@source` paths must be valid **after publishing**. When your module is published:
103
+
104
+ - Source files move from `src/` to `dist/`
105
+ - The `@source` path is relative to where `styles.css` ends up
106
+
107
+ **Development** (`src/styles.css`):
108
+
109
+ ```css
110
+ @source "./client/**/*.tsx";
111
+ ```
112
+
113
+ **Published** (`dist/styles.css`):
114
+
115
+ ```css
116
+ @source "./client/**/*.tsx"; /* Still works if client/ is in dist/ */
117
+ ```
118
+
119
+ > **Tip**: Use flat structure like `dist/client/` rather than deeply nested paths to avoid path mismatches.
120
+
121
+ ### 4. Include CSS in Build
122
+
123
+ Ensure your build tool copies the CSS file to `dist/`. With `tsdown`:
124
+
125
+ ```json
126
+ {
127
+ "scripts": {
128
+ "build": "tsdown && cp src/styles.css dist/"
129
+ }
130
+ }
131
+ ```
132
+
133
+ Or configure `tsdown` to handle CSS:
134
+
135
+ ```ts
136
+ // tsdown.config.ts
137
+ export default {
138
+ entry: ['src/index.ts', 'src/client/index.ts'],
139
+ format: ['esm'],
140
+ dts: true,
141
+ // CSS is copied via package.json "files" field
142
+ }
143
+ ```
144
+
145
+ ---
146
+
147
+ ## App Developer Guide
148
+
149
+ ### New Projects
150
+
151
+ New projects created with `create-kuckit` include the aggregator file pre-configured. No additional setup is needed—just run `kuckit add <module>` and the CLI handles everything.
152
+
153
+ ### How `kuckit add` Works
154
+
155
+ When you run:
156
+
157
+ ```bash
158
+ bunx kuckit add @acme/billing-module
159
+ ```
160
+
161
+ The CLI:
162
+
163
+ 1. Installs the package
164
+ 2. Reads `kuckit.styles` from the module's `package.json`
165
+ 3. Injects `@import "@acme/billing-module/styles.css";` into `kuckit-modules.css`
166
+ 4. Wires server and client modules
167
+
168
+ ### Manual Installation
169
+
170
+ If you're not using `kuckit add`, manually add the import to your aggregator:
171
+
172
+ ```css
173
+ /* apps/web/src/kuckit-modules.css */
174
+
175
+ /* KUCKIT_MODULE_STYLES_START */
176
+ @import '@kuckit/docs-module/styles.css';
177
+ @import '@acme/billing-module/styles.css'; /* Add this line */
178
+ /* KUCKIT_MODULE_STYLES_END */
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Troubleshooting
184
+
185
+ ### Missing Styles
186
+
187
+ **Symptom**: Module components render without styling (unstyled buttons, missing colors).
188
+
189
+ **Causes and fixes**:
190
+
191
+ 1. **Module not in aggregator**
192
+
193
+ ```bash
194
+ # Check if import exists
195
+ grep "billing-module" apps/web/src/kuckit-modules.css
196
+ ```
197
+
198
+ If missing, add it manually or re-run `kuckit add`.
199
+
200
+ 2. **Missing `@source` directive in module**
201
+
202
+ The module's `styles.css` must include `@source` directives pointing to its components:
203
+
204
+ ```css
205
+ @source "./client/**/*.tsx";
206
+ ```
207
+
208
+ 3. **Path mismatch after publishing**
209
+
210
+ If using a published module, ensure `@source` paths align with the `dist/` structure.
211
+
212
+ 4. **Tailwind not scanning node_modules**
213
+
214
+ In Tailwind v4, add this to your app's CSS:
215
+
216
+ ```css
217
+ @source "../../node_modules/@acme/billing-module/dist/**/*.{js,ts,tsx}";
218
+ ```
219
+
220
+ ### Duplicate Imports
221
+
222
+ **Symptom**: CSS import appears twice in the aggregator.
223
+
224
+ The CLI is idempotent—it checks for existing imports before adding. If you see duplicates:
225
+
226
+ 1. One may be inside markers, one outside
227
+ 2. Remove the duplicate outside the markers
228
+
229
+ ```css
230
+ /* KUCKIT_MODULE_STYLES_START */
231
+ @import '@acme/billing-module/styles.css';
232
+ /* KUCKIT_MODULE_STYLES_END */
233
+
234
+ /* Remove this duplicate if present: */
235
+ /* @import "@acme/billing-module/styles.css"; */
236
+ ```
237
+
238
+ ### Aggregator File Missing
239
+
240
+ **Symptom**: CLI warns "CSS aggregator not found".
241
+
242
+ Create the aggregator file manually:
243
+
244
+ ```bash
245
+ mkdir -p apps/web/src
246
+ cat > apps/web/src/kuckit-modules.css << 'EOF'
247
+ /**
248
+ * Kuckit Module CSS Aggregator
249
+ *
250
+ * Module CSS imports are automatically added here by `kuckit add`.
251
+ * Do not remove the marker comments.
252
+ */
253
+
254
+ /* KUCKIT_MODULE_STYLES_START */
255
+ /* KUCKIT_MODULE_STYLES_END */
256
+ EOF
257
+ ```
258
+
259
+ Then import it in your main CSS:
260
+
261
+ ```css
262
+ /* apps/web/src/index.css */
263
+ @import './kuckit-modules.css';
264
+ @import 'tailwindcss';
265
+ ```
266
+
267
+ ### Migration from Manual Imports
268
+
269
+ If your existing project has scattered module imports:
270
+
271
+ 1. **Create the aggregator** (see above)
272
+ 2. **Move module imports** from `index.css` to between the markers
273
+ 3. **Remove duplicate `@source`** directives (modules should include their own)
274
+ 4. **Test** by running `bun run dev` and verifying styles load
275
+
276
+ Before:
277
+
278
+ ```css
279
+ /* index.css - OLD */
280
+ @import '@kuckit/docs-module/styles.css';
281
+ @source "../../node_modules/@kuckit/docs-module/src/**/*.tsx";
282
+ @import 'tailwindcss';
283
+ ```
284
+
285
+ After:
286
+
287
+ ```css
288
+ /* index.css - NEW */
289
+ @import './kuckit-modules.css';
290
+ @import 'tailwindcss';
291
+ ```
292
+
293
+ ```css
294
+ /* kuckit-modules.css - NEW */
295
+ /* KUCKIT_MODULE_STYLES_START */
296
+ @import '@kuckit/docs-module/styles.css';
297
+ /* KUCKIT_MODULE_STYLES_END */
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Reference
303
+
304
+ ### Marker Comments
305
+
306
+ The CLI uses these markers to identify where to inject imports:
307
+
308
+ ```css
309
+ /* KUCKIT_MODULE_STYLES_START */
310
+ /* ...imports go here... */
311
+ /* KUCKIT_MODULE_STYLES_END */
312
+ ```
313
+
314
+ Do not modify or remove these markers.
315
+
316
+ ### Module Metadata Schema
317
+
318
+ ```typescript
319
+ interface KuckitMetadata {
320
+ id: string // e.g., "acme.billing"
321
+ server?: string // Server module path
322
+ client?: string // Client module path
323
+ styles?: string // CSS file path (e.g., "./styles.css")
324
+ }
325
+ ```
326
+
327
+ ### CLI Behavior
328
+
329
+ | Scenario | CLI Action |
330
+ | -------------------------- | ------------------------------------- |
331
+ | Module has `kuckit.styles` | Injects import into aggregator |
332
+ | Import already exists | Skips (idempotent) |
333
+ | Aggregator file missing | Warns with manual instructions |
334
+ | CSS file doesn't exist | Warns and skips injection |
335
+ | No `kuckit.styles` | No CSS handling (backward compatible) |
336
+
337
+ ---
338
+
339
+ ## Related Documentation
340
+
341
+ - [Module Development Guide](../packages/sdk/docs/MODULE_DEVELOPMENT.md)
342
+ - [CLI Reference](../packages/kuckit-cli/AGENTS.md)
343
+ - [@kuckit/docs-module](../packages/docs-module/SETUP.md) - Example module with CSS
@@ -0,0 +1,368 @@
1
+ # Module Testing Guide
2
+
3
+ > Testing Kuckit modules as standalone npm packages in scaffolded projects
4
+
5
+ **See also**: [General Testing Guide](./TESTING.md) - Unit and integration testing for Kuckit apps
6
+
7
+ ## Overview
8
+
9
+ This guide documents the workflow for testing Kuckit modules before publishing to npm. Testing in a scaffolded project provides high confidence that modules work correctly when consumed as external packages.
10
+
11
+ **Key insight**: Testing with `file:` dependencies in a fresh scaffolded app simulates the real npm install experience, catching issues that unit tests miss.
12
+
13
+ ## Quick Reference
14
+
15
+ ```bash
16
+ # 1. Build CLI tools (from monorepo root)
17
+ cd packages/create-kuckit-app && bun run build && cd ../..
18
+ cd packages/kuckit-cli && bun run build && cd ../..
19
+
20
+ # 2. Scaffold test app using dist
21
+ node packages/create-kuckit-app/dist/bin.js /tmp/kuckit-test-app --skip-install
22
+
23
+ # 3. Prepare module (in temp directory)
24
+ cp -r packages/my-module /tmp/my-module-test
25
+ cd /tmp/my-module-test
26
+ # Replace workspace:* with versions, build, etc.
27
+
28
+ # 4. Install in test app
29
+ cd /tmp/kuckit-test-app
30
+ cp -r /tmp/my-module-test node_modules/@kuckit/my-module
31
+ bun install
32
+
33
+ # 5. Wire and test
34
+ node /path/to/kuckit/packages/kuckit-cli/dist/bin.js add @kuckit/my-module --skip-install
35
+ bun run db:push
36
+ bun run dev
37
+ ```
38
+
39
+ ## Detailed Workflow
40
+
41
+ ### Step 1: Build CLI Tools and Scaffold Test App
42
+
43
+ Build the CLI tools first (unpublished packages won't work with `bunx`):
44
+
45
+ ```bash
46
+ # From monorepo root
47
+ cd packages/create-kuckit-app && bun run build && cd ../..
48
+ cd packages/kuckit-cli && bun run build && cd ../..
49
+ ```
50
+
51
+ Then scaffold a test app using the built dist:
52
+
53
+ ```bash
54
+ node packages/create-kuckit-app/dist/bin.js /tmp/kuckit-test-app --skip-install
55
+ cd /tmp/kuckit-test-app
56
+ ```
57
+
58
+ ### Step 2: Prepare Module for Testing
59
+
60
+ Copy the module to a temporary location and resolve workspace protocols:
61
+
62
+ ```bash
63
+ # Copy module
64
+ cp -r packages/my-module /tmp/my-module-test
65
+ cd /tmp/my-module-test
66
+ ```
67
+
68
+ #### 2.1 Replace Workspace Protocols
69
+
70
+ Edit `package.json` to replace `workspace:*` and `catalog:` with actual versions:
71
+
72
+ ```json
73
+ {
74
+ "peerDependencies": {
75
+ "@kuckit/sdk": "^2.0.0",
76
+ "@kuckit/api": "^2.0.0",
77
+ "drizzle-orm": "^0.44.0"
78
+ },
79
+ "dependencies": {
80
+ "zod": "^3.23.0"
81
+ }
82
+ }
83
+ ```
84
+
85
+ #### 2.2 Create Standalone tsconfig.json
86
+
87
+ Remove `extends` that references parent monorepo config:
88
+
89
+ ```json
90
+ {
91
+ "compilerOptions": {
92
+ "target": "ES2022",
93
+ "module": "ESNext",
94
+ "moduleResolution": "bundler",
95
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
96
+ "jsx": "react-jsx",
97
+ "strict": true,
98
+ "esModuleInterop": true,
99
+ "skipLibCheck": true,
100
+ "declaration": true,
101
+ "declarationMap": true,
102
+ "outDir": "dist",
103
+ "rootDir": "src"
104
+ },
105
+ "include": ["src/**/*"],
106
+ "exclude": ["node_modules", "dist"]
107
+ }
108
+ ```
109
+
110
+ #### 2.3 Build the Module
111
+
112
+ ```bash
113
+ bun add tsdown typescript -d
114
+ bun run tsdown
115
+ ```
116
+
117
+ #### 2.4 Update Package.json Exports
118
+
119
+ Match exports to build output (tsdown uses `.mjs`/`.d.mts` extensions):
120
+
121
+ ```json
122
+ {
123
+ "exports": {
124
+ ".": {
125
+ "types": "./dist/server/module.d.mts",
126
+ "default": "./dist/server/module.mjs"
127
+ },
128
+ "./client": {
129
+ "types": "./dist/client/index.d.mts",
130
+ "default": "./dist/client/index.mjs"
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ### Step 3: Install Module in Test App
137
+
138
+ **Important**: Copy directly into `node_modules` rather than using `file:` protocol. File dependencies resolve from physical path, causing peer dependency resolution failures.
139
+
140
+ ```bash
141
+ cd /tmp/kuckit-test-app
142
+
143
+ # Install dependencies first
144
+ bun install
145
+
146
+ # Copy built module into node_modules
147
+ cp -r /tmp/my-module-test node_modules/@kuckit/my-module
148
+ ```
149
+
150
+ ### Step 4: Wire Up the Module
151
+
152
+ Use the CLI to register the module:
153
+
154
+ ```bash
155
+ node /path/to/kuckit/packages/kuckit-cli/dist/bin.js add @kuckit/my-module --skip-install
156
+ ```
157
+
158
+ Or manually add to `kuckit.config.ts`:
159
+
160
+ ```typescript
161
+ export default defineConfig({
162
+ modules: [
163
+ {
164
+ package: '@kuckit/my-module',
165
+ config: {
166
+ // Module-specific configuration
167
+ apiKey: process.env.MY_MODULE_API_KEY ?? 'test_key',
168
+ environment: 'sandbox',
169
+ },
170
+ },
171
+ ],
172
+ })
173
+ ```
174
+
175
+ ### Step 5: Verification Commands
176
+
177
+ Run these in sequence to verify the module works:
178
+
179
+ ```bash
180
+ # 1. Database schema
181
+ bun run db:push
182
+ # Verifies: Drizzle can load module schema exports
183
+
184
+ # 2. Type checking
185
+ bun run check-types
186
+ # Verifies: TypeScript compilation succeeds
187
+
188
+ # 3. Server runtime
189
+ bun run dev
190
+ # Verifies: Module loads, DI registers, API routes work
191
+
192
+ # 4. API endpoints (in another terminal)
193
+ curl http://localhost:3000/api/health
194
+ curl http://localhost:3000/rpc/my-module/list
195
+
196
+ # 5. Client routes
197
+ # Open browser to http://localhost:5173/my-route
198
+ ```
199
+
200
+ ## Common Issues and Solutions
201
+
202
+ ### Issue: Cannot find module 'drizzle-orm/pg-core'
203
+
204
+ **Symptom**: `drizzle-kit` fails when loading module schema files.
205
+
206
+ **Cause**: `drizzle-kit` tries to load TypeScript source files instead of compiled JavaScript.
207
+
208
+ **Solution**: Build the module first so `drizzle-kit` reads compiled `.js` files:
209
+
210
+ ```bash
211
+ cd /tmp/my-module-test
212
+ bun add tsdown typescript -d
213
+ bun run tsdown
214
+ ```
215
+
216
+ ### Issue: Cannot find package 'express'
217
+
218
+ **Symptom**: `ResolveMessage: Cannot find package 'express' from '/tmp/my-module-test/...'`
219
+
220
+ **Cause**: Modules using Express Router need it as a peer dependency. File dependencies resolve from physical location, not `node_modules`.
221
+
222
+ **Solution**:
223
+
224
+ 1. Add `express` to `peerDependencies` in module's `package.json`:
225
+
226
+ ```json
227
+ {
228
+ "peerDependencies": {
229
+ "express": "^4.0.0 || ^5.0.0"
230
+ }
231
+ }
232
+ ```
233
+
234
+ 2. Copy module into `node_modules` instead of using `file:` protocol:
235
+ ```bash
236
+ cp -r /tmp/my-module-test node_modules/@kuckit/my-module
237
+ ```
238
+
239
+ ### Issue: Module config undefined
240
+
241
+ **Symptom**: `undefined is not an object (evaluating 'Object.keys(config.something)')`
242
+
243
+ **Cause**: Module configuration not passed in `kuckit.config.ts`.
244
+
245
+ **Solution**: Add config block with required fields:
246
+
247
+ ```typescript
248
+ {
249
+ package: '@kuckit/my-module',
250
+ config: {
251
+ apiKey: process.env.API_KEY ?? 'test_key',
252
+ webhookSecret: process.env.WEBHOOK_SECRET ?? 'test_secret',
253
+ // All required config fields...
254
+ },
255
+ }
256
+ ```
257
+
258
+ ### Issue: Cannot read file: components/ui/...
259
+
260
+ **Symptom**: Client build fails with missing UI component errors.
261
+
262
+ **Cause**: Module uses `@/components/ui/*` imports but host app doesn't have shadcn components.
263
+
264
+ **Solution**: Install required shadcn/ui components in the host app:
265
+
266
+ ```bash
267
+ cd apps/web
268
+ bunx --bun shadcn@latest init --yes
269
+ bunx --bun shadcn@latest add card badge alert button skeleton --yes
270
+ ```
271
+
272
+ **Best practice**: Document required shadcn components in module's `AGENTS.md`.
273
+
274
+ ### Issue: Build output extension mismatch
275
+
276
+ **Symptom**: `Module not found` errors for `.js` files when output is `.mjs`.
277
+
278
+ **Cause**: `package.json` exports reference `.js` but `tsdown` outputs `.mjs`.
279
+
280
+ **Solution**: Align exports with actual output:
281
+
282
+ ```json
283
+ {
284
+ "exports": {
285
+ ".": {
286
+ "types": "./dist/server/module.d.mts",
287
+ "default": "./dist/server/module.mjs"
288
+ }
289
+ }
290
+ }
291
+ ```
292
+
293
+ ## Test Checklist
294
+
295
+ Use this checklist when testing a new module:
296
+
297
+ ```
298
+ Pre-test Setup:
299
+ - [ ] Scaffolded fresh test app
300
+ - [ ] Replaced workspace:* protocols with versions
301
+ - [ ] Created standalone tsconfig.json
302
+ - [ ] Built module successfully
303
+ - [ ] Updated package.json exports to match build output
304
+ - [ ] Copied module to node_modules (not file: protocol)
305
+
306
+ Verification:
307
+ - [ ] bun run db:push - Schema exports work
308
+ - [ ] bun run check-types - TypeScript compiles
309
+ - [ ] bun run dev - Server loads module
310
+ - [ ] API endpoints respond correctly
311
+ - [ ] Client routes render
312
+ - [ ] Authentication works (if applicable)
313
+
314
+ Documentation:
315
+ - [ ] Required environment variables documented
316
+ - [ ] Required shadcn components listed
317
+ - [ ] Configuration example in AGENTS.md
318
+ ```
319
+
320
+ ## Test Locations
321
+
322
+ Standard test locations used in the workflow:
323
+
324
+ | Purpose | Path |
325
+ | ------------------- | --------------------------------- |
326
+ | Scaffolded test app | `/tmp/kuckit-test-app` |
327
+ | Module copy | `/tmp/{module-name}-test` |
328
+ | CLI binary | `packages/kuckit-cli/dist/bin.js` |
329
+
330
+ ## Environment Variables Template
331
+
332
+ For modules requiring configuration, create `.env` in the test app:
333
+
334
+ ```bash
335
+ # Database (required by all Kuckit apps)
336
+ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/kuckit_test
337
+
338
+ # Auth (required)
339
+ BETTER_AUTH_SECRET=test-secret-change-in-production
340
+ BETTER_AUTH_URL=http://localhost:3000
341
+
342
+ # Module-specific (example for polar-payments)
343
+ POLAR_ACCESS_TOKEN=polar_at_test
344
+ POLAR_WEBHOOK_SECRET=whsec_test
345
+ POLAR_PLAN_MAPPING={"test_product":"pro"}
346
+ POLAR_ORGANIZATION_ID=org_test
347
+ POLAR_ENVIRONMENT=sandbox
348
+ ```
349
+
350
+ ## Cleanup
351
+
352
+ After testing, stop containers and remove test artifacts:
353
+
354
+ ```bash
355
+ # Stop database container
356
+ cd /tmp/kuckit-test-app
357
+ docker compose down
358
+
359
+ # Remove test artifacts
360
+ rm -rf /tmp/kuckit-test-app
361
+ rm -rf /tmp/{module-name}-test
362
+ ```
363
+
364
+ ## Related Documentation
365
+
366
+ - [Module Development Guide](../packages/sdk/docs/MODULE_DEVELOPMENT.md)
367
+ - [CLI add command](../packages/kuckit-cli/AGENTS.md#add)
368
+ - [SDK Module System](../packages/sdk/AGENTS.md)