create-questpie 2.0.3 → 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 (153) hide show
  1. package/dist/index.mjs +544 -87
  2. package/package.json +2 -3
  3. package/templates/elysia/AGENTS.md +56 -0
  4. package/templates/elysia/CLAUDE.md +39 -0
  5. package/templates/elysia/Dockerfile +24 -0
  6. package/templates/elysia/README.md +148 -0
  7. package/templates/elysia/docker/init-extensions.sql +11 -0
  8. package/templates/elysia/docker-compose.yml +21 -0
  9. package/templates/elysia/env.example +16 -0
  10. package/templates/elysia/gitignore +6 -0
  11. package/templates/elysia/package.json +47 -0
  12. package/templates/elysia/questpie.config.ts +12 -0
  13. package/templates/elysia/src/index.ts +21 -0
  14. package/templates/elysia/src/lib/auth-client.ts +32 -0
  15. package/templates/elysia/src/lib/client.ts +13 -0
  16. package/templates/elysia/src/lib/env.ts +24 -0
  17. package/templates/elysia/src/lib/query-client.ts +18 -0
  18. package/templates/elysia/src/lib/query.ts +18 -0
  19. package/templates/elysia/src/questpie/server/.generated/context.gen.ts +200 -0
  20. package/templates/elysia/src/questpie/server/.generated/entities.gen.ts +84 -0
  21. package/templates/elysia/src/questpie/server/.generated/factories.ts +65 -0
  22. package/templates/elysia/src/questpie/server/.generated/index.ts +131 -0
  23. package/templates/elysia/src/questpie/server/.generated/names.gen.ts +25 -0
  24. package/templates/elysia/src/questpie/server/app.ts +10 -0
  25. package/templates/elysia/src/questpie/server/collections/index.ts +1 -0
  26. package/templates/elysia/src/questpie/server/collections/posts.collection.ts +10 -0
  27. package/templates/elysia/src/questpie/server/config/auth.ts +8 -0
  28. package/templates/elysia/src/questpie/server/config/openapi.ts +10 -0
  29. package/templates/elysia/src/questpie/server/globals/index.ts +1 -0
  30. package/templates/elysia/src/questpie/server/globals/site-settings.global.ts +10 -0
  31. package/templates/elysia/src/questpie/server/modules.ts +8 -0
  32. package/templates/elysia/src/questpie/server/questpie.config.ts +21 -0
  33. package/templates/elysia/tsconfig.json +28 -0
  34. package/templates/hono/AGENTS.md +56 -0
  35. package/templates/hono/CLAUDE.md +39 -0
  36. package/templates/hono/Dockerfile +24 -0
  37. package/templates/hono/README.md +148 -0
  38. package/templates/hono/docker/init-extensions.sql +11 -0
  39. package/templates/hono/docker-compose.yml +21 -0
  40. package/templates/hono/env.example +16 -0
  41. package/templates/hono/gitignore +6 -0
  42. package/templates/hono/package.json +47 -0
  43. package/templates/hono/questpie.config.ts +12 -0
  44. package/templates/hono/src/index.ts +30 -0
  45. package/templates/hono/src/lib/auth-client.ts +32 -0
  46. package/templates/hono/src/lib/client.ts +13 -0
  47. package/templates/hono/src/lib/env.ts +24 -0
  48. package/templates/hono/src/lib/query-client.ts +18 -0
  49. package/templates/hono/src/lib/query.ts +18 -0
  50. package/templates/hono/src/questpie/server/.generated/context.gen.ts +200 -0
  51. package/templates/hono/src/questpie/server/.generated/entities.gen.ts +84 -0
  52. package/templates/hono/src/questpie/server/.generated/factories.ts +65 -0
  53. package/templates/hono/src/questpie/server/.generated/index.ts +131 -0
  54. package/templates/hono/src/questpie/server/.generated/names.gen.ts +25 -0
  55. package/templates/hono/src/questpie/server/app.ts +10 -0
  56. package/templates/hono/src/questpie/server/collections/index.ts +1 -0
  57. package/templates/hono/src/questpie/server/collections/posts.collection.ts +10 -0
  58. package/templates/hono/src/questpie/server/config/auth.ts +8 -0
  59. package/templates/hono/src/questpie/server/config/openapi.ts +10 -0
  60. package/templates/hono/src/questpie/server/globals/index.ts +1 -0
  61. package/templates/hono/src/questpie/server/globals/site-settings.global.ts +10 -0
  62. package/templates/hono/src/questpie/server/modules.ts +8 -0
  63. package/templates/hono/src/questpie/server/questpie.config.ts +21 -0
  64. package/templates/hono/tsconfig.json +28 -0
  65. package/templates/next/AGENTS.md +55 -0
  66. package/templates/next/CLAUDE.md +39 -0
  67. package/templates/next/Dockerfile +25 -0
  68. package/templates/next/README.md +148 -0
  69. package/templates/next/components.json +22 -0
  70. package/templates/next/docker/init-extensions.sql +11 -0
  71. package/templates/next/docker-compose.yml +21 -0
  72. package/templates/next/env.example +16 -0
  73. package/templates/next/gitignore +10 -0
  74. package/templates/next/next-env.d.ts +5 -0
  75. package/templates/next/next.config.ts +20 -0
  76. package/templates/next/package.json +54 -0
  77. package/templates/next/postcss.config.mjs +8 -0
  78. package/templates/next/public/.gitkeep +0 -0
  79. package/templates/next/questpie.config.ts +12 -0
  80. package/templates/next/src/app/admin/[[...all]]/page.tsx +34 -0
  81. package/templates/next/src/app/admin/admin.css +4 -0
  82. package/templates/next/src/app/admin/layout.tsx +63 -0
  83. package/templates/next/src/app/api/[...all]/route.ts +24 -0
  84. package/templates/next/src/app/layout.tsx +24 -0
  85. package/templates/next/src/app/not-found.tsx +18 -0
  86. package/templates/next/src/app/page.tsx +74 -0
  87. package/templates/next/src/app/providers.tsx +11 -0
  88. package/templates/next/src/lib/auth-client.ts +12 -0
  89. package/templates/next/src/lib/client.ts +13 -0
  90. package/templates/next/src/lib/env.ts +24 -0
  91. package/templates/next/src/lib/query-client.ts +18 -0
  92. package/templates/next/src/lib/query.ts +18 -0
  93. package/templates/next/src/questpie/admin/.generated/client.ts +13 -0
  94. package/templates/next/src/questpie/admin/admin.ts +9 -0
  95. package/templates/next/src/questpie/admin/modules.ts +3 -0
  96. package/templates/next/src/questpie/server/.generated/context.gen.ts +204 -0
  97. package/templates/next/src/questpie/server/.generated/entities.gen.ts +100 -0
  98. package/templates/next/src/questpie/server/.generated/factories.ts +204 -0
  99. package/templates/next/src/questpie/server/.generated/index.ts +139 -0
  100. package/templates/next/src/questpie/server/.generated/names.gen.ts +31 -0
  101. package/templates/next/src/questpie/server/app.ts +10 -0
  102. package/templates/next/src/questpie/server/collections/index.ts +1 -0
  103. package/templates/next/src/questpie/server/collections/posts.collection.ts +58 -0
  104. package/templates/next/src/questpie/server/config/admin.ts +80 -0
  105. package/templates/next/src/questpie/server/config/auth.ts +8 -0
  106. package/templates/next/src/questpie/server/config/openapi.ts +10 -0
  107. package/templates/next/src/questpie/server/globals/index.ts +1 -0
  108. package/templates/next/src/questpie/server/globals/site-settings.global.ts +19 -0
  109. package/templates/next/src/questpie/server/modules.ts +9 -0
  110. package/templates/next/src/questpie/server/questpie.config.ts +21 -0
  111. package/templates/next/src/styles.css +125 -0
  112. package/templates/next/tsconfig.json +37 -0
  113. package/templates/tanstack-start/AGENTS.md +35 -600
  114. package/templates/tanstack-start/CLAUDE.md +26 -127
  115. package/templates/tanstack-start/README.md +20 -7
  116. package/templates/tanstack-start/docker/init-extensions.sql +11 -0
  117. package/templates/tanstack-start/docker-compose.yml +1 -0
  118. package/templates/tanstack-start/package.json +1 -0
  119. package/templates/tanstack-start/src/lib/auth-client.ts +1 -1
  120. package/templates/tanstack-start/src/lib/client.ts +1 -1
  121. package/templates/tanstack-start/src/lib/query.ts +18 -0
  122. package/templates/tanstack-start/src/questpie/admin/modules.ts +3 -1
  123. package/templates/tanstack-start/src/questpie/server/.generated/factories.ts +10 -9
  124. package/templates/tanstack-start/src/questpie/server/collections/index.ts +1 -1
  125. package/templates/tanstack-start/src/questpie/server/config/auth.ts +1 -1
  126. package/templates/tanstack-start/src/questpie/server/globals/index.ts +1 -1
  127. package/templates/tanstack-start/src/questpie/server/modules.ts +4 -5
  128. package/templates/tanstack-start/src/questpie/server/questpie.config.ts +3 -2
  129. package/templates/tanstack-start/src/routes/__root.tsx +31 -1
  130. package/templates/tanstack-start/src/routes/api/$.ts +2 -3
  131. package/templates/tanstack-start/src/routes/index.tsx +97 -0
  132. package/templates/tanstack-start/vite.config.ts +2 -2
  133. package/skills/questpie/AGENTS.md +0 -2670
  134. package/skills/questpie/SKILL.md +0 -260
  135. package/skills/questpie/references/auth.md +0 -121
  136. package/skills/questpie/references/business-logic.md +0 -550
  137. package/skills/questpie/references/codegen-plugin-api.md +0 -382
  138. package/skills/questpie/references/crud-api.md +0 -378
  139. package/skills/questpie/references/data-modeling.md +0 -493
  140. package/skills/questpie/references/extend.md +0 -557
  141. package/skills/questpie/references/field-types.md +0 -386
  142. package/skills/questpie/references/infrastructure-adapters.md +0 -545
  143. package/skills/questpie/references/multi-tenancy.md +0 -364
  144. package/skills/questpie/references/production.md +0 -475
  145. package/skills/questpie/references/query-operators.md +0 -125
  146. package/skills/questpie/references/quickstart.md +0 -564
  147. package/skills/questpie/references/rules.md +0 -389
  148. package/skills/questpie/references/tanstack-query.md +0 -520
  149. package/skills/questpie-admin/AGENTS.md +0 -1508
  150. package/skills/questpie-admin/SKILL.md +0 -436
  151. package/skills/questpie-admin/references/blocks.md +0 -331
  152. package/skills/questpie-admin/references/custom-ui.md +0 -305
  153. package/skills/questpie-admin/references/views.md +0 -449
@@ -1,382 +0,0 @@
1
- # Codegen Plugin API Reference
2
-
3
- Source: `packages/questpie/src/cli/codegen/types.ts`
4
-
5
- ## CodegenPlugin
6
-
7
- Top-level plugin interface. Registered in `questpie.config.ts` via the `plugins` array.
8
-
9
- ```ts
10
- interface CodegenPlugin {
11
- /** Unique plugin name. */
12
- name: string;
13
-
14
- /**
15
- * Target contributions keyed by target ID.
16
- * Well-known target IDs: "server", "admin-client".
17
- */
18
- targets: Record<string, CodegenTargetContribution>;
19
-
20
- /**
21
- * Cross-target validators run after all targets have been generated.
22
- * Returns projection errors for keys missing between targets.
23
- */
24
- validators?: CrossTargetValidator[];
25
- }
26
- ```
27
-
28
- ## CodegenTargetContribution
29
-
30
- A single plugin's contribution to a codegen target.
31
-
32
- ```ts
33
- interface CodegenTargetContribution {
34
- /** Root directory for discovery, relative to resolved server root. */
35
- root: string;
36
-
37
- /** Output directory within root for generated files. @default ".generated" */
38
- outDir?: string;
39
-
40
- /** Primary output filename (e.g. "index.ts", "client.ts"). */
41
- outputFile: string;
42
-
43
- /** Subdirectory within module directories for discovery. */
44
- moduleRoot?: string;
45
-
46
- /** Directory-pattern categories for file discovery. */
47
- categories?: Record<string, CategoryDeclaration>;
48
-
49
- /** File patterns to discover (string shorthand or full DiscoverPattern). */
50
- discover?: Record<string, DiscoverPattern>;
51
-
52
- /** Post-discovery transform — modify context before code generation. */
53
- transform?: (ctx: CodegenContext) => void;
54
-
55
- /** Registry declarations for generated typed factories. */
56
- registries?: {
57
- collectionExtensions?: Record<string, RegistryExtension>;
58
- globalExtensions?: Record<string, RegistryExtension>;
59
- singletonFactories?: Record<string, SingletonFactory>;
60
- };
61
-
62
- /** Callback parameter definitions for extension methods. */
63
- callbackParams?: Record<string, CallbackParamDefinition>;
64
-
65
- /** Custom generator (replaces default template generation). */
66
- generate?: (
67
- ctx: CodegenTargetGenerateContext,
68
- ) => Promise<CodegenTargetOutput> | CodegenTargetOutput;
69
-
70
- /** Scaffold templates for `questpie add`. */
71
- scaffolds?: Record<string, ScaffoldConfig>;
72
- }
73
- ```
74
-
75
- ## CategoryDeclaration
76
-
77
- Declares a directory-pattern category for file discovery and code generation.
78
-
79
- ```ts
80
- interface CategoryDeclaration {
81
- /** Directories to scan relative to QUESTPIE root. */
82
- dirs: string[];
83
-
84
- /** Whether to scan directories recursively. */
85
- recursive?: boolean;
86
-
87
- /** Variable name prefix for generated imports (e.g., "coll", "fn"). */
88
- prefix: string;
89
-
90
- /**
91
- * How to emit in createApp() call.
92
- * - "record" (default): { key: varName, ... }
93
- * - "nested": nested object from dot-separated keys
94
- * - "array": flat array [var1, var2, ...]
95
- */
96
- emit?: "record" | "nested" | "array";
97
-
98
- /** Key separator for recursive categories: "." or "/". */
99
- keySeparator?: "." | "/";
100
-
101
- /** Override the key used in createApp() call. */
102
- createAppKey?: string;
103
-
104
- /** Extra type import statements when this category has files. */
105
- extraTypeImports?: string[];
106
-
107
- /**
108
- * How to generate the App* type.
109
- * - "standard" (default): AppX = _ModuleX & { key: typeof varName; ... }
110
- * - "services": values are ServiceInstanceOf<typeof varName>
111
- * - "emails": standalone record, no module merge
112
- * - "messages": union type of keys
113
- * - "functions": nested type object from dot-separated keys
114
- * - "none": no type emitted
115
- */
116
- typeEmit?:
117
- | "standard"
118
- | "services"
119
- | "emails"
120
- | "messages"
121
- | "functions"
122
- | "none";
123
-
124
- /** Whether to extract types from modules. @default true */
125
- extractFromModules?: boolean;
126
-
127
- /** Include in Registry augmentation. String = custom key, true = category name. */
128
- registryKey?: string | boolean;
129
-
130
- /** Include in App state type. @default true */
131
- includeInAppState?: boolean;
132
-
133
- /** Custom AppContext property emission. */
134
- appContextEmit?: "services";
135
-
136
- /**
137
- * Use a runtime property as the object key instead of file key.
138
- * e.g., views: { keyFromProperty: "name" } -> [_view_kanban.name]: _view_kanban
139
- */
140
- keyFromProperty?: string;
141
-
142
- /** Placeholder token for string union of keys in configType strings. */
143
- placeholder?: string;
144
-
145
- /** Placeholder token for full record type in configType strings. */
146
- recordPlaceholder?: string;
147
-
148
- /** Type registry interface to augment with strict name keys. */
149
- typeRegistry?: {
150
- module: string;
151
- interface: string;
152
- };
153
- }
154
- ```
155
-
156
- ## DiscoverPattern
157
-
158
- Pattern definition for plugin file discovery. Can be a string shorthand or full object.
159
-
160
- ```ts
161
- type DiscoverPattern =
162
- | string // "blocks/*.ts" or "config/admin.ts"
163
- | {
164
- /** Glob pattern relative to QUESTPIE root. */
165
- pattern: string;
166
-
167
- /**
168
- * How to resolve exports.
169
- * - "auto" (default): detect from file content
170
- * - "default": always use default import
171
- * - "named": always use named imports
172
- * - "all": collect all exports
173
- */
174
- resolve?: "default" | "named" | "all" | "auto";
175
-
176
- /** How to derive the key: "filename" or "exportName". */
177
- keyFrom?: "filename" | "exportName";
178
-
179
- /** "map" (directory patterns) or "single" (single-file). */
180
- cardinality?: "single" | "map";
181
-
182
- /**
183
- * How to merge for cardinality: "single".
184
- * "spread": collect ALL matching files and spread as array.
185
- */
186
- mergeStrategy?: "spread";
187
-
188
- /** Augment interface Registry with typeof this under given key. */
189
- registryKey?: string;
190
-
191
- /**
192
- * Destructure a composite config file into multiple createApp keys.
193
- * Keys = property names on the exported object.
194
- * Values = createApp argument keys (state keys).
195
- *
196
- * @example
197
- * appConfig: {
198
- * pattern: "config/app.ts",
199
- * destructure: { locale: "locale", access: "defaultAccess" },
200
- * }
201
- */
202
- destructure?: Record<string, string>;
203
- };
204
- ```
205
-
206
- ## RegistryExtension
207
-
208
- Extension method declaration for codegen-generated factories.
209
-
210
- ```ts
211
- interface RegistryExtension {
212
- /** State key stored on the builder via .set(). */
213
- stateKey: string;
214
-
215
- /** Import declarations needed for this extension's types. */
216
- imports?: Array<{ name: string; from: string }>;
217
-
218
- /** TypeScript type signature for the config parameter. */
219
- configType?: string;
220
-
221
- /** Whether the config is a callback receiving context. */
222
- isCallback?: boolean;
223
-
224
- /** Context parameter names for callback-style extensions. */
225
- callbackContextParams?: string[];
226
-
227
- /** Placeholder -> category mapping for type extraction. */
228
- configTypePlaceholders?: Record<string, string>;
229
-
230
- /** Default values merged into resolved extension config. */
231
- defaults?: Record<string, unknown>;
232
- }
233
- ```
234
-
235
- ## CallbackParamDefinition
236
-
237
- Defines how to emit a callback context parameter at codegen time.
238
-
239
- ```ts
240
- interface CallbackParamDefinition {
241
- /**
242
- * Name of the factory function to call (must be a named export from `from`).
243
- *
244
- * Example: { factory: "createFieldNameProxy", from: "questpie" }
245
- */
246
- factory: string;
247
-
248
- /** Module specifier to import the factory from. */
249
- from: string;
250
- }
251
- ```
252
-
253
- ## SingletonFactory
254
-
255
- Declaration for a singleton factory function generated in factories.ts.
256
-
257
- ```ts
258
- interface SingletonFactory {
259
- /** TypeScript type for the config parameter. */
260
- configType: string;
261
-
262
- /** Import declarations needed for the config type. */
263
- imports: Array<{ name: string; from: string }>;
264
-
265
- /** Whether the config can also be a callback function. */
266
- isCallback?: boolean;
267
- }
268
- ```
269
-
270
- ## CodegenContext
271
-
272
- Context passed to `transform()` callbacks.
273
-
274
- ```ts
275
- interface CodegenContext {
276
- /** All discovered categories. Key = category name, value = map of files. */
277
- categories: Map<string, Map<string, DiscoveredFile>>;
278
-
279
- /** Discovered single-file items keyed by stateKey. */
280
- singles: Map<string, DiscoveredFile>;
281
-
282
- /** Discovered spread items keyed by stateKey. */
283
- spreads: Map<string, DiscoveredFile[]>;
284
-
285
- /** Add an import statement to generated file. */
286
- addImport(name: string, path: string): void;
287
-
288
- /** Add a type declaration to generated file. */
289
- addTypeDeclaration(code: string): void;
290
-
291
- /** Add runtime code to generated file. */
292
- addRuntimeCode(code: string): void;
293
-
294
- /** Set a key on entities passed to createApp(). */
295
- set(key: string, value: string): void;
296
- }
297
- ```
298
-
299
- ## DiscoveredFile
300
-
301
- A file discovered during codegen scanning.
302
-
303
- ```ts
304
- interface DiscoveredFile {
305
- absolutePath: string;
306
- key: string;
307
- importPath: string;
308
- varName: string;
309
- source: string;
310
- exportType: "default" | "named" | "unknown";
311
- namedExportName?: string;
312
- allNamedExports?: string[];
313
- isBundle?: boolean;
314
- }
315
- ```
316
-
317
- ## ScaffoldConfig
318
-
319
- Configuration for `questpie add` scaffold templates.
320
-
321
- ```ts
322
- interface ScaffoldConfig {
323
- /** Directory relative to target root where file is created. */
324
- dir: string;
325
-
326
- /** File extension including dot. @default ".ts" */
327
- extension?: string;
328
-
329
- /** Human-readable description for CLI help. */
330
- description?: string;
331
-
332
- /** Template function generating file content. */
333
- template: (ctx: ScaffoldContext) => string;
334
- }
335
-
336
- interface ScaffoldContext {
337
- kebab: string; // "my-block"
338
- camel: string; // "myBlock"
339
- pascal: string; // "MyBlock"
340
- title: string; // "My Block"
341
- targetId: string;
342
- }
343
- ```
344
-
345
- ## CrossTargetValidator
346
-
347
- Validates consistency between targets after generation.
348
-
349
- ```ts
350
- type CrossTargetValidator = (
351
- targets: Map<string, CodegenResult>,
352
- ) => ProjectionError[];
353
-
354
- interface ProjectionError {
355
- severity: "error" | "warning";
356
- category: string;
357
- key: string;
358
- sourceTarget: string;
359
- consumerTarget: string;
360
- message: string;
361
- }
362
- ```
363
-
364
- ## CodegenOptions
365
-
366
- Options for running codegen.
367
-
368
- ```ts
369
- interface CodegenOptions {
370
- rootDir: string;
371
- configPath: string;
372
- outDir: string;
373
- plugins?: CodegenPlugin[];
374
- dryRun?: boolean;
375
- targetId?: string;
376
- module?: {
377
- name: string;
378
- outputFile?: string;
379
- importRewriteMap?: Record<string, string>;
380
- };
381
- }
382
- ```