create-claude-workspace 1.1.65 → 1.1.67
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.
|
@@ -34,7 +34,7 @@ You are a Senior Backend TypeScript Architect with deep expertise in server-side
|
|
|
34
34
|
## Architecture Patterns
|
|
35
35
|
|
|
36
36
|
**Onion Architecture per domain:**
|
|
37
|
-
- `domain/` —
|
|
37
|
+
- `domain/` — **TypeBox schemas** (single source of truth for all types), repository interfaces, value objects (no dependencies). Define schemas here, derive TypeScript types via `Static<typeof Schema>`. NEVER create separate interface files when a TypeBox schema exists — use `Static<>` everywhere (API, frontend, DB mapping).
|
|
38
38
|
- `business/` — use cases, business logic (depends on domain only)
|
|
39
39
|
- `api/` — Hono routes, validation, OpenAPI (depends on business + domain)
|
|
40
40
|
- `infrastructure/` — repository implementations, external APIs (depends on domain)
|
|
@@ -63,6 +63,7 @@ Always prefer `@cibule/*` packages over custom implementations:
|
|
|
63
63
|
- Platform-specific code lives ONLY in `infrastructure/` layer behind abstract repository interfaces
|
|
64
64
|
- Use Web Standard APIs: `fetch`, `Request`, `Response`, `URL`, `crypto`, `TextEncoder`/`TextDecoder`
|
|
65
65
|
- Hono is inherently platform-agnostic — inject platform bindings via DI, not `c.env` in routes
|
|
66
|
+
- **OpenAPI-first**: All API routes MUST use `hono-openapi` with `openAPIRouteHandler` — generates OpenAPI spec from TypeBox schemas. Serve API docs via `@scalar/hono-api-reference` at `/reference`. Never define routes without OpenAPI metadata.
|
|
66
67
|
- Entry points handle platform wiring:
|
|
67
68
|
- Worker entry: exports `default { fetch }` with Hono app + D1 bindings
|
|
68
69
|
- Node entry: `serve()` with Hono app + SQLite/better-sqlite3 bindings
|
|
@@ -84,7 +85,7 @@ Always prefer `@cibule/*` packages over custom implementations:
|
|
|
84
85
|
- `moduleResolution: "bundler"` — NEVER add `.js` extensions to imports (write `'./foo'`, not `'./foo.js'`)
|
|
85
86
|
- `readonly` on all fields that don't need reassignment
|
|
86
87
|
- Custom error classes for domain-specific errors
|
|
87
|
-
- Input validation at system boundaries — **TypeBox** preferred (compile-time types + runtime validation from one schema, no duplication). Use
|
|
88
|
+
- Input validation at system boundaries — **TypeBox** preferred (compile-time types + runtime validation from one schema, no duplication). Use `typebox` and `typebox/compiler` for `TypeCompiler`.
|
|
88
89
|
- Async/await patterns (no callback hell)
|
|
89
90
|
- Separation of concerns (routes, services, repositories)
|
|
90
91
|
- File size limit: MAX 200 lines per TypeScript file
|
|
@@ -115,7 +115,8 @@ After generation, the architect's plan specifies what code to write IN the gener
|
|
|
115
115
|
| Use cases, business logic |
|
|
116
116
|
+-----------------------------------------------------+
|
|
117
117
|
| domain/ |
|
|
118
|
-
|
|
|
118
|
+
| TypeBox schemas (single source of truth), types, |
|
|
119
|
+
| repository interfaces, value objects |
|
|
119
120
|
+-----------------------------------------------------+
|
|
120
121
|
| infrastructure/ |
|
|
121
122
|
| Repository implementations (database, API, mock) |
|
|
@@ -131,6 +132,13 @@ Dependency rules:
|
|
|
131
132
|
- ui -> shared/ui, domain (for types)
|
|
132
133
|
- feature -> ui, data-access, shared/ui
|
|
133
134
|
|
|
135
|
+
**TypeBox as single source of truth**: Define TypeBox schemas in `domain/` layer (`libs/[domain]/domain/`). These schemas are the canonical definition — derive everything from them:
|
|
136
|
+
- **TypeScript types**: `Static<typeof MySchema>` — no separate interface definitions
|
|
137
|
+
- **API validation**: `openAPIRouteHandler` uses the same schemas for request/response validation + OpenAPI spec
|
|
138
|
+
- **Frontend types**: Frontend imports types from domain lib via `@[PREFIX]/[domain]-domain` — no copy-paste
|
|
139
|
+
- **DB mapping**: Infrastructure layer maps between DB rows and domain types
|
|
140
|
+
- NEVER duplicate type definitions. If a type exists as a TypeBox schema, use `Static<>` everywhere.
|
|
141
|
+
|
|
134
142
|
### @cibule/* Ecosystem (Preferred Libraries)
|
|
135
143
|
|
|
136
144
|
[Include only if project uses backend or fullstack architecture]
|
|
@@ -281,7 +289,8 @@ Key rules enforced (do NOT weaken):
|
|
|
281
289
|
|
|
282
290
|
[Include only if the project has a backend]
|
|
283
291
|
|
|
284
|
-
- Hono routes with validation (**TypeBox** —
|
|
292
|
+
- Hono routes with validation (**TypeBox** — `typebox` for schema + type inference, `TypeCompiler` for runtime validation)
|
|
293
|
+
- **OpenAPI-first**: Use `hono-openapi` with `openAPIRouteHandler` for all API routes — generates OpenAPI spec from TypeBox schemas automatically. API docs served via `@scalar/hono-api-reference` at `/reference`.
|
|
285
294
|
- `@cibule/di` for dependency injection (see @cibule/* Ecosystem section above)
|
|
286
295
|
- `@cibule/db` + driver for database access, UnitOfWork for atomic writes
|
|
287
296
|
- `@cibule/storage` + driver for file storage, `@cibule/image` + driver for image processing
|