@geekmidas/cli 0.45.0 → 0.47.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 (51) hide show
  1. package/dist/{config-C0b0jdmU.mjs → config-C3LSBNSl.mjs} +2 -2
  2. package/dist/{config-C0b0jdmU.mjs.map → config-C3LSBNSl.mjs.map} +1 -1
  3. package/dist/{config-xVZsRjN7.cjs → config-HYiM3iQJ.cjs} +2 -2
  4. package/dist/{config-xVZsRjN7.cjs.map → config-HYiM3iQJ.cjs.map} +1 -1
  5. package/dist/config.cjs +2 -2
  6. package/dist/config.d.cts +1 -1
  7. package/dist/config.d.mts +1 -1
  8. package/dist/config.mjs +2 -2
  9. package/dist/dokploy-api-4a6h35VY.cjs +3 -0
  10. package/dist/{dokploy-api-BdxOMH_V.cjs → dokploy-api-BnX2OxyF.cjs} +121 -1
  11. package/dist/dokploy-api-BnX2OxyF.cjs.map +1 -0
  12. package/dist/{dokploy-api-DWsqNjwP.mjs → dokploy-api-CMWlWq7-.mjs} +121 -1
  13. package/dist/dokploy-api-CMWlWq7-.mjs.map +1 -0
  14. package/dist/dokploy-api-DQvi9iZa.mjs +3 -0
  15. package/dist/{index-CXa3odEw.d.mts → index-A70abJ1m.d.mts} +598 -46
  16. package/dist/index-A70abJ1m.d.mts.map +1 -0
  17. package/dist/{index-E8Nu2Rxl.d.cts → index-pOA56MWT.d.cts} +598 -46
  18. package/dist/index-pOA56MWT.d.cts.map +1 -0
  19. package/dist/index.cjs +916 -357
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.mjs +916 -357
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/{openapi-D3pA6FfZ.mjs → openapi-C3C-BzIZ.mjs} +2 -2
  24. package/dist/{openapi-D3pA6FfZ.mjs.map → openapi-C3C-BzIZ.mjs.map} +1 -1
  25. package/dist/{openapi-DhcCtKzM.cjs → openapi-D7WwlpPF.cjs} +2 -2
  26. package/dist/{openapi-DhcCtKzM.cjs.map → openapi-D7WwlpPF.cjs.map} +1 -1
  27. package/dist/openapi.cjs +3 -3
  28. package/dist/openapi.mjs +3 -3
  29. package/dist/workspace/index.cjs +1 -1
  30. package/dist/workspace/index.d.cts +1 -1
  31. package/dist/workspace/index.d.mts +1 -1
  32. package/dist/workspace/index.mjs +1 -1
  33. package/dist/{workspace-BDAhr6Kb.cjs → workspace-CaVW6j2q.cjs} +10 -1
  34. package/dist/{workspace-BDAhr6Kb.cjs.map → workspace-CaVW6j2q.cjs.map} +1 -1
  35. package/dist/{workspace-D_6ZCaR_.mjs → workspace-DLFRaDc-.mjs} +10 -1
  36. package/dist/{workspace-D_6ZCaR_.mjs.map → workspace-DLFRaDc-.mjs.map} +1 -1
  37. package/package.json +3 -3
  38. package/src/auth/credentials.ts +66 -0
  39. package/src/deploy/dns/hostinger-api.ts +258 -0
  40. package/src/deploy/dns/index.ts +399 -0
  41. package/src/deploy/dokploy-api.ts +175 -0
  42. package/src/deploy/index.ts +389 -240
  43. package/src/deploy/state.ts +146 -0
  44. package/src/workspace/types.ts +629 -47
  45. package/tsconfig.tsbuildinfo +1 -1
  46. package/dist/dokploy-api-Bdmk5ImW.cjs +0 -3
  47. package/dist/dokploy-api-BdxOMH_V.cjs.map +0 -1
  48. package/dist/dokploy-api-DWsqNjwP.mjs.map +0 -1
  49. package/dist/dokploy-api-tZSZaHd9.mjs +0 -3
  50. package/dist/index-CXa3odEw.d.mts.map +0 -1
  51. package/dist/index-E8Nu2Rxl.d.cts.map +0 -1
@@ -5,20 +5,75 @@ import { z } from "zod/v4";
5
5
 
6
6
  /**
7
7
  * Deploy target for an app.
8
- * Currently only 'dokploy' is supported.
9
- * Future: 'vercel' | 'cloudflare'
8
+ *
9
+ * Specifies where the app will be deployed.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // Currently supported
14
+ * deploy: 'dokploy'
15
+ *
16
+ * // Future support (not yet implemented)
17
+ * deploy: 'vercel'
18
+ * deploy: 'cloudflare'
19
+ * ```
10
20
  */
11
21
  type DeployTarget = 'dokploy' | 'vercel' | 'cloudflare';
12
22
  /**
13
23
  * Backend framework types for apps that don't use gkm routes.
24
+ *
25
+ * Used with `entry` to specify the framework for proper Docker builds.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * // Better Auth server
30
+ * {
31
+ * entry: './src/index.ts',
32
+ * framework: 'better-auth',
33
+ * port: 3001,
34
+ * }
35
+ *
36
+ * // Hono app without gkm routes
37
+ * {
38
+ * entry: './src/server.ts',
39
+ * framework: 'hono',
40
+ * port: 3000,
41
+ * }
42
+ * ```
14
43
  */
15
44
  type BackendFramework = 'hono' | 'better-auth' | 'express' | 'fastify';
16
45
  /**
17
46
  * Frontend framework types.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Next.js app
51
+ * {
52
+ * type: 'frontend',
53
+ * framework: 'nextjs',
54
+ * port: 3000,
55
+ * }
56
+ *
57
+ * // Vite SPA
58
+ * {
59
+ * type: 'frontend',
60
+ * framework: 'vite',
61
+ * port: 5173,
62
+ * }
63
+ * ```
18
64
  */
19
65
  type FrontendFramework = 'nextjs' | 'remix' | 'vite';
20
66
  /**
21
67
  * Service image configuration for custom Docker images.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * // Use specific version
72
+ * db: { version: '16-alpine' }
73
+ *
74
+ * // Use custom image
75
+ * db: { image: 'timescale/timescaledb:latest-pg16' }
76
+ * ```
22
77
  */
23
78
  interface ServiceImageConfig {
24
79
  /** Docker image version/tag (e.g., '18-alpine') */
@@ -28,6 +83,23 @@ interface ServiceImageConfig {
28
83
  }
29
84
  /**
30
85
  * Mail service configuration.
86
+ *
87
+ * In development, uses Mailpit for email testing.
88
+ * In production, uses SMTP configuration.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * services: {
93
+ * mail: {
94
+ * smtp: {
95
+ * host: 'smtp.sendgrid.net',
96
+ * port: 587,
97
+ * user: 'apikey',
98
+ * pass: process.env.SENDGRID_API_KEY,
99
+ * }
100
+ * }
101
+ * }
102
+ * ```
31
103
  */
32
104
  interface MailServiceConfig extends ServiceImageConfig {
33
105
  /** SMTP configuration for production */
@@ -40,6 +112,36 @@ interface MailServiceConfig extends ServiceImageConfig {
40
112
  }
41
113
  /**
42
114
  * Development services configuration.
115
+ *
116
+ * Configures shared infrastructure services like databases and caches.
117
+ * These are automatically provisioned in Dokploy during deployment.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * // Enable with defaults
122
+ * services: {
123
+ * db: true, // postgres:18-alpine
124
+ * cache: true, // redis:8-alpine
125
+ * }
126
+ *
127
+ * // Custom versions
128
+ * services: {
129
+ * db: { version: '16-alpine' },
130
+ * cache: { version: '7-alpine' },
131
+ * }
132
+ *
133
+ * // Custom images
134
+ * services: {
135
+ * db: { image: 'timescale/timescaledb:latest-pg16' },
136
+ * }
137
+ *
138
+ * // With mail service
139
+ * services: {
140
+ * db: true,
141
+ * cache: true,
142
+ * mail: true, // Mailpit in dev
143
+ * }
144
+ * ```
43
145
  */
44
146
  interface ServicesConfig {
45
147
  /** PostgreSQL database (default: postgres:18-alpine) */
@@ -51,53 +153,192 @@ interface ServicesConfig {
51
153
  }
52
154
  /**
53
155
  * Stage-based domain configuration.
54
- * Maps deployment stages to base domains.
55
- * @example { development: 'dev.myapp.com', production: 'myapp.com' }
156
+ *
157
+ * Maps deployment stages to base domains. The main frontend app
158
+ * gets the base domain, other apps get `{appName}.{baseDomain}`.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * domains: {
163
+ * development: 'dev.myapp.com',
164
+ * staging: 'staging.myapp.com',
165
+ * production: 'myapp.com',
166
+ * }
167
+ *
168
+ * // Result for production stage:
169
+ * // - web (main frontend): myapp.com
170
+ * // - api: api.myapp.com
171
+ * // - auth: auth.myapp.com
172
+ * ```
56
173
  */
57
174
  type DokployDomainsConfig = Record<string, string>;
58
175
  /**
59
176
  * Per-app domain override configuration.
60
- * Can be a single domain string or stage-specific domains.
61
- * @example 'api.custom.com' or { production: 'api.custom.com', staging: 'api.staging.com' }
177
+ *
178
+ * Can be a single domain string (used for all stages) or
179
+ * stage-specific domains.
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * // Single domain for all stages
184
+ * domain: 'api.custom.com'
185
+ *
186
+ * // Stage-specific domains
187
+ * domain: {
188
+ * development: 'api.dev.custom.com',
189
+ * staging: 'api.staging.custom.com',
190
+ * production: 'api.custom.com',
191
+ * }
192
+ * ```
62
193
  */
63
194
  type AppDomainConfig = string | Record<string, string>;
64
195
  /**
65
196
  * Dokploy workspace deployment configuration.
197
+ *
198
+ * Configures how the workspace is deployed to a Dokploy server.
199
+ * One workspace maps to one Dokploy project with stage-based environments.
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * deploy: {
204
+ * default: 'dokploy',
205
+ * dokploy: {
206
+ * endpoint: 'https://dokploy.myserver.com',
207
+ * projectId: 'proj_abc123',
208
+ * registry: 'ghcr.io/myorg',
209
+ * domains: {
210
+ * development: 'dev.myapp.com',
211
+ * production: 'myapp.com',
212
+ * },
213
+ * },
214
+ * }
215
+ * ```
66
216
  */
67
217
  interface DokployWorkspaceConfig {
68
- /** Dokploy API endpoint */
218
+ /** Dokploy API endpoint (e.g., 'https://dokploy.myserver.com') */
69
219
  endpoint: string;
70
- /** Project ID (1 workspace = 1 project) */
220
+ /** Project ID in Dokploy (auto-created on first deploy) */
71
221
  projectId: string;
72
- /** Container registry for images */
222
+ /** Container registry for Docker images (e.g., 'ghcr.io/myorg') */
73
223
  registry?: string;
74
- /** Registry ID in Dokploy */
224
+ /** Registry ID in Dokploy (auto-configured) */
75
225
  registryId?: string;
76
226
  /**
77
227
  * Stage-based domain configuration.
78
228
  * The main frontend app gets the base domain.
79
229
  * Other apps get {appName}.{baseDomain} by default.
80
- * @example { development: 'dev.myapp.com', production: 'myapp.com' }
81
230
  */
82
231
  domains?: DokployDomainsConfig;
83
232
  }
233
+ /**
234
+ * DNS provider types for automatic DNS record creation.
235
+ */
236
+ type DnsProvider = 'hostinger' | 'cloudflare' | 'manual';
237
+ /**
238
+ * DNS configuration for automatic record creation during deployment.
239
+ *
240
+ * When configured, the deploy command will automatically create DNS
241
+ * A records pointing to your Dokploy server for each app's domain.
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * // Auto-create DNS records at Hostinger
246
+ * dns: {
247
+ * provider: 'hostinger',
248
+ * domain: 'traflabs.io',
249
+ * autoCreate: true,
250
+ * }
251
+ *
252
+ * // Manual mode - just print required records
253
+ * dns: {
254
+ * provider: 'manual',
255
+ * domain: 'traflabs.io',
256
+ * }
257
+ * ```
258
+ */
259
+ interface DnsConfig {
260
+ /**
261
+ * DNS provider for automatic record creation.
262
+ * - 'hostinger': Use Hostinger DNS API
263
+ * - 'cloudflare': Use Cloudflare DNS API (future)
264
+ * - 'manual': Don't create records, just print required records
265
+ */
266
+ provider: DnsProvider;
267
+ /**
268
+ * Root domain where records will be created.
269
+ * @example 'traflabs.io', 'example.com'
270
+ */
271
+ domain: string;
272
+ /**
273
+ * Automatically create DNS records during deploy.
274
+ * If false, only prints required records for manual setup.
275
+ * @default true
276
+ */
277
+ autoCreate?: boolean;
278
+ /**
279
+ * TTL for created DNS records in seconds.
280
+ * @default 300 (5 minutes)
281
+ */
282
+ ttl?: number;
283
+ }
84
284
  /**
85
285
  * Deployment configuration for the workspace.
286
+ *
287
+ * @example
288
+ * ```ts
289
+ * // Minimal - just set default target
290
+ * deploy: {
291
+ * default: 'dokploy',
292
+ * }
293
+ *
294
+ * // Full configuration with DNS
295
+ * deploy: {
296
+ * default: 'dokploy',
297
+ * dokploy: {
298
+ * endpoint: 'https://dokploy.myserver.com',
299
+ * projectId: 'proj_abc123',
300
+ * registry: 'ghcr.io/myorg',
301
+ * domains: {
302
+ * production: 'myapp.com',
303
+ * },
304
+ * },
305
+ * dns: {
306
+ * provider: 'hostinger',
307
+ * domain: 'myapp.com',
308
+ * autoCreate: true,
309
+ * },
310
+ * }
311
+ * ```
86
312
  */
87
313
  interface DeployConfig {
88
- /** Default deploy target for all apps */
314
+ /** Default deploy target for all apps (default: 'dokploy') */
89
315
  default?: DeployTarget;
90
316
  /** Dokploy-specific configuration */
91
317
  dokploy?: DokployWorkspaceConfig;
318
+ /** DNS configuration for automatic record creation */
319
+ dns?: DnsConfig;
92
320
  }
93
321
  /**
94
322
  * Models package configuration for shared schemas.
323
+ *
324
+ * Configures a shared models package containing Zod schemas
325
+ * that can be used across backend and frontend apps.
326
+ *
327
+ * @example
328
+ * ```ts
329
+ * shared: {
330
+ * models: {
331
+ * path: 'packages/models',
332
+ * schema: 'zod',
333
+ * },
334
+ * }
335
+ * ```
95
336
  */
96
337
  interface ModelsConfig {
97
- /** Path to models package (default: packages/models) */
338
+ /** Path to models package relative to workspace root (default: 'packages/models') */
98
339
  path?: string;
99
340
  /**
100
- * Schema library to use.
341
+ * Schema library to use (default: 'zod').
101
342
  * Currently only 'zod' is supported.
102
343
  * Future: any StandardSchema-compatible library
103
344
  */
@@ -105,6 +346,20 @@ interface ModelsConfig {
105
346
  }
106
347
  /**
107
348
  * Shared packages configuration.
349
+ *
350
+ * Configures shared packages in the monorepo that are
351
+ * used by multiple apps.
352
+ *
353
+ * @example
354
+ * ```ts
355
+ * shared: {
356
+ * packages: ['packages/*', 'libs/*'],
357
+ * models: {
358
+ * path: 'packages/models',
359
+ * schema: 'zod',
360
+ * },
361
+ * }
362
+ * ```
108
363
  */
109
364
  interface SharedConfig {
110
365
  /** Glob patterns for shared packages (default: ['packages/*']) */
@@ -114,17 +369,45 @@ interface SharedConfig {
114
369
  }
115
370
  /**
116
371
  * Secrets encryption configuration.
372
+ *
373
+ * Configures how secrets are encrypted for deployment.
374
+ * Secrets are stored encrypted in `.gkm/secrets/{stage}.json`
375
+ * with keys stored separately in `~/.gkm/{project}/{stage}.key`.
376
+ *
377
+ * @example
378
+ * ```ts
379
+ * secrets: {
380
+ * enabled: true,
381
+ * algorithm: 'aes-256-gcm',
382
+ * kdf: 'scrypt',
383
+ * }
384
+ * ```
117
385
  */
118
386
  interface SecretsConfig {
119
- /** Enable encrypted secrets */
387
+ /** Enable encrypted secrets (default: true) */
120
388
  enabled?: boolean;
121
- /** Encryption algorithm (default: aes-256-gcm) */
389
+ /** Encryption algorithm (default: 'aes-256-gcm') */
122
390
  algorithm?: string;
123
- /** Key derivation function (default: scrypt) */
391
+ /** Key derivation function (default: 'scrypt') */
124
392
  kdf?: 'scrypt' | 'pbkdf2';
125
393
  }
126
394
  /**
127
395
  * Client generation configuration for frontend apps.
396
+ *
397
+ * Configures automatic API client generation from OpenAPI specs.
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * // In a frontend app config
402
+ * {
403
+ * type: 'frontend',
404
+ * framework: 'nextjs',
405
+ * dependencies: ['api'],
406
+ * client: {
407
+ * output: './src/lib/api',
408
+ * },
409
+ * }
410
+ * ```
128
411
  */
129
412
  interface ClientConfig {
130
413
  /** Output directory for generated client (relative to app path) */
@@ -132,68 +415,204 @@ interface ClientConfig {
132
415
  }
133
416
  /**
134
417
  * Base app configuration properties (shared between input and normalized).
418
+ *
419
+ * @example
420
+ * ```ts
421
+ * // Backend app with gkm routes
422
+ * api: {
423
+ * type: 'backend',
424
+ * path: 'apps/api',
425
+ * port: 3000,
426
+ * routes: './src/endpoints/**\/*.ts',
427
+ * envParser: './src/config/env',
428
+ * logger: './src/config/logger',
429
+ * }
430
+ *
431
+ * // Backend app with entry point (e.g., Better Auth)
432
+ * auth: {
433
+ * type: 'backend',
434
+ * path: 'apps/auth',
435
+ * port: 3001,
436
+ * entry: './src/index.ts',
437
+ * framework: 'better-auth',
438
+ * requiredEnv: ['DATABASE_URL', 'BETTER_AUTH_SECRET'],
439
+ * }
440
+ *
441
+ * // Frontend app
442
+ * web: {
443
+ * type: 'frontend',
444
+ * path: 'apps/web',
445
+ * port: 3002,
446
+ * framework: 'nextjs',
447
+ * dependencies: ['api', 'auth'],
448
+ * }
449
+ * ```
135
450
  */
136
451
  interface AppConfigBase {
137
- /** App type (default: 'backend') */
452
+ /**
453
+ * App type.
454
+ * - 'backend': Server-side app (API, auth service, etc.)
455
+ * - 'frontend': Client-side app (Next.js, Vite, etc.)
456
+ * @default 'backend'
457
+ */
138
458
  type?: 'backend' | 'frontend';
139
- /** Path relative to workspace root */
459
+ /**
460
+ * Path to the app relative to workspace root.
461
+ * @example 'apps/api', 'apps/web', 'services/auth'
462
+ */
140
463
  path: string;
141
- /** Dev server port */
464
+ /**
465
+ * Development server port.
466
+ * Must be unique across all apps in the workspace.
467
+ * @example 3000, 3001, 3002
468
+ */
142
469
  port: number;
143
- /** Per-app deploy target override */
470
+ /**
471
+ * Per-app deploy target override.
472
+ * Overrides `deploy.default` for this specific app.
473
+ * @example 'dokploy', 'vercel'
474
+ */
144
475
  deploy?: DeployTarget;
145
- /** Routes glob pattern */
476
+ /**
477
+ * Routes glob pattern for gkm endpoints.
478
+ * @example './src/endpoints/**\/*.ts'
479
+ */
146
480
  routes?: Routes;
147
- /** Functions glob pattern */
481
+ /**
482
+ * Functions glob pattern for Lambda functions.
483
+ * @example './src/functions/**\/*.ts'
484
+ */
148
485
  functions?: Routes;
149
- /** Crons glob pattern */
486
+ /**
487
+ * Crons glob pattern for scheduled tasks.
488
+ * @example './src/crons/**\/*.ts'
489
+ */
150
490
  crons?: Routes;
151
- /** Subscribers glob pattern */
491
+ /**
492
+ * Subscribers glob pattern for event handlers.
493
+ * @example './src/subscribers/**\/*.ts'
494
+ */
152
495
  subscribers?: Routes;
153
- /** Path to environment parser module */
496
+ /**
497
+ * Path to environment parser module.
498
+ * @example './src/config/env'
499
+ */
154
500
  envParser?: string;
155
- /** Path to logger module */
501
+ /**
502
+ * Path to logger module.
503
+ * @example './src/config/logger'
504
+ */
156
505
  logger?: string;
157
- /** Provider configuration */
506
+ /** Provider configuration (AWS, Docker, etc.) */
158
507
  providers?: ProvidersConfig;
159
- /** Server lifecycle hooks */
508
+ /**
509
+ * Server lifecycle hooks.
510
+ * @example { beforeSetup: './src/hooks/setup.ts' }
511
+ */
160
512
  hooks?: HooksConfig;
161
- /** Telescope configuration */
513
+ /**
514
+ * Telescope debugging dashboard configuration.
515
+ * @example true, './src/config/telescope', { enabled: true, path: '/__telescope' }
516
+ */
162
517
  telescope?: string | boolean | TelescopeConfig;
163
- /** Studio configuration */
518
+ /**
519
+ * Studio admin panel configuration.
520
+ * @example true, './src/config/studio'
521
+ */
164
522
  studio?: string | boolean | StudioConfig;
165
- /** OpenAPI configuration */
523
+ /**
524
+ * OpenAPI documentation configuration.
525
+ * @example true, { output: './src/openapi.ts' }
526
+ */
166
527
  openapi?: boolean | OpenApiConfig;
167
- /** Runtime (node or bun) */
528
+ /**
529
+ * Runtime environment.
530
+ * @default 'node'
531
+ */
168
532
  runtime?: Runtime;
169
- /** Environment file(s) to load */
533
+ /**
534
+ * Environment file(s) to load during development.
535
+ * @example '.env', ['.env', '.env.local']
536
+ */
170
537
  env?: string | string[];
171
538
  /**
172
539
  * Entry file path for apps that don't use gkm routes.
173
- * Used by both `gkm dev` (runs with tsx) and Docker builds (bundles with tsdown).
174
- * @example './src/index.ts'
540
+ *
541
+ * When specified, the app is run directly with tsx in development
542
+ * and bundled with esbuild for production Docker builds.
543
+ *
544
+ * Use this for:
545
+ * - Better Auth servers
546
+ * - Custom Hono/Express apps
547
+ * - Any backend that doesn't use gkm's endpoint builder
548
+ *
549
+ * @example './src/index.ts', './src/server.ts'
175
550
  */
176
551
  entry?: string;
177
- /** Framework for the app (frontend or backend without gkm routes) */
552
+ /**
553
+ * Framework for the app.
554
+ *
555
+ * Backend frameworks: 'hono', 'better-auth', 'express', 'fastify'
556
+ * Frontend frameworks: 'nextjs', 'remix', 'vite'
557
+ *
558
+ * @example 'nextjs', 'better-auth', 'hono'
559
+ */
178
560
  framework?: BackendFramework | FrontendFramework;
179
- /** Client generation configuration */
561
+ /**
562
+ * Client generation configuration.
563
+ * Generates typed API client from backend dependencies.
564
+ */
180
565
  client?: ClientConfig;
181
566
  /**
182
- * Override domain for this app (per-stage or single value).
183
- * @example 'api.custom.com' or { production: 'api.custom.com', staging: 'api.staging.com' }
567
+ * Override domain for this app.
568
+ *
569
+ * By default, apps get `{appName}.{baseDomain}` (or just `{baseDomain}`
570
+ * for the main frontend). Use this to specify a custom domain.
571
+ *
572
+ * @example
573
+ * ```ts
574
+ * // Single domain for all stages
575
+ * domain: 'api.custom.com'
576
+ *
577
+ * // Stage-specific domains
578
+ * domain: {
579
+ * production: 'api.custom.com',
580
+ * staging: 'api.staging.custom.com',
581
+ * }
582
+ * ```
184
583
  */
185
584
  domain?: AppDomainConfig;
186
585
  /**
187
586
  * Required environment variables for entry-based apps.
587
+ *
188
588
  * Use this instead of envParser for apps that don't use gkm routes.
189
- * The deploy command uses this to filter which secrets to embed.
190
- * @example ['DATABASE_URL', 'BETTER_AUTH_SECRET']
589
+ * The deploy command uses this list to filter which secrets to embed
590
+ * in the Docker image.
591
+ *
592
+ * @example ['DATABASE_URL', 'BETTER_AUTH_SECRET', 'REDIS_URL']
191
593
  */
192
594
  requiredEnv?: string[];
193
595
  }
194
596
  /**
195
597
  * App configuration input with type-safe dependencies.
196
- * @template TAppNames - Union of valid app names in the workspace
598
+ *
599
+ * @template TAppNames - Union of valid app names in the workspace (auto-inferred)
600
+ *
601
+ * @example
602
+ * ```ts
603
+ * // Dependencies are type-checked against app names
604
+ * apps: {
605
+ * api: { path: 'apps/api', port: 3000 },
606
+ * auth: { path: 'apps/auth', port: 3001 },
607
+ * web: {
608
+ * path: 'apps/web',
609
+ * port: 3002,
610
+ * type: 'frontend',
611
+ * dependencies: ['api', 'auth'], // ✓ Valid
612
+ * // dependencies: ['invalid'], // ✗ Type error
613
+ * },
614
+ * }
615
+ * ```
197
616
  */
198
617
  interface AppConfigInput<TAppNames extends string = string> extends AppConfigBase {
199
618
  /** Dependencies on other apps in the workspace (type-safe) */
@@ -226,13 +645,49 @@ type ConstrainedApps<TApps extends AppsRecord> = { [K in keyof TApps]: Omit<TApp
226
645
  } };
227
646
  /**
228
647
  * Full workspace input type with constrained dependencies.
648
+ *
649
+ * @example
650
+ * ```ts
651
+ * import { defineWorkspace } from '@geekmidas/cli';
652
+ *
653
+ * export default defineWorkspace({
654
+ * name: 'my-app',
655
+ * apps: {
656
+ * api: {
657
+ * path: 'apps/api',
658
+ * port: 3000,
659
+ * routes: './src/endpoints/**\/*.ts',
660
+ * },
661
+ * web: {
662
+ * type: 'frontend',
663
+ * path: 'apps/web',
664
+ * port: 3001,
665
+ * framework: 'nextjs',
666
+ * dependencies: ['api'],
667
+ * },
668
+ * },
669
+ * services: {
670
+ * db: true,
671
+ * cache: true,
672
+ * },
673
+ * deploy: {
674
+ * default: 'dokploy',
675
+ * },
676
+ * });
677
+ * ```
229
678
  */
230
679
  type WorkspaceInput<TApps extends AppsRecord> = {
680
+ /** Workspace name (defaults to root package.json name) */
231
681
  name?: string;
682
+ /** App definitions */
232
683
  apps: ConstrainedApps<TApps>;
684
+ /** Shared packages configuration */
233
685
  shared?: SharedConfig;
686
+ /** Deployment configuration */
234
687
  deploy?: DeployConfig;
688
+ /** Development services (db, cache, mail) */
235
689
  services?: ServicesConfig;
690
+ /** Encrypted secrets configuration */
236
691
  secrets?: SecretsConfig;
237
692
  };
238
693
  /**
@@ -255,8 +710,79 @@ type InferredWorkspaceConfig<TApps extends AppsRecord> = {
255
710
  /** @deprecated Use WorkspaceInput */
256
711
 
257
712
  /**
258
- * Workspace configuration for multi-app monorepos (legacy).
259
- * @deprecated Use WorkspaceConfigInput with defineWorkspace for type inference
713
+ * Workspace configuration for multi-app monorepos.
714
+ *
715
+ * Use `defineWorkspace()` helper for type-safe configuration with
716
+ * auto-completion and dependency validation.
717
+ *
718
+ * @example
719
+ * ```ts
720
+ * // gkm.config.ts
721
+ * import { defineWorkspace } from '@geekmidas/cli';
722
+ *
723
+ * export default defineWorkspace({
724
+ * name: 'my-saas',
725
+ *
726
+ * // App definitions
727
+ * apps: {
728
+ * // Backend API with gkm routes
729
+ * api: {
730
+ * path: 'apps/api',
731
+ * port: 3000,
732
+ * routes: './src/endpoints/**\/*.ts',
733
+ * envParser: './src/config/env',
734
+ * logger: './src/config/logger',
735
+ * telescope: true,
736
+ * },
737
+ *
738
+ * // Better Auth service
739
+ * auth: {
740
+ * path: 'apps/auth',
741
+ * port: 3001,
742
+ * entry: './src/index.ts',
743
+ * framework: 'better-auth',
744
+ * requiredEnv: ['DATABASE_URL', 'BETTER_AUTH_SECRET'],
745
+ * },
746
+ *
747
+ * // Next.js frontend
748
+ * web: {
749
+ * type: 'frontend',
750
+ * path: 'apps/web',
751
+ * port: 3002,
752
+ * framework: 'nextjs',
753
+ * dependencies: ['api', 'auth'],
754
+ * },
755
+ * },
756
+ *
757
+ * // Infrastructure services
758
+ * services: {
759
+ * db: true, // PostgreSQL
760
+ * cache: true, // Redis
761
+ * },
762
+ *
763
+ * // Deployment configuration
764
+ * deploy: {
765
+ * default: 'dokploy',
766
+ * dokploy: {
767
+ * endpoint: 'https://dokploy.myserver.com',
768
+ * projectId: 'proj_abc123',
769
+ * registry: 'ghcr.io/myorg',
770
+ * domains: {
771
+ * production: 'myapp.com',
772
+ * staging: 'staging.myapp.com',
773
+ * },
774
+ * },
775
+ * },
776
+ *
777
+ * // Shared packages
778
+ * shared: {
779
+ * packages: ['packages/*'],
780
+ * models: { path: 'packages/models' },
781
+ * },
782
+ * });
783
+ * ```
784
+ *
785
+ * @deprecated Use WorkspaceInput with defineWorkspace for type inference
260
786
  */
261
787
  interface WorkspaceConfig {
262
788
  /** Workspace name (defaults to root package.json name) */
@@ -274,11 +800,18 @@ interface WorkspaceConfig {
274
800
  }
275
801
  /**
276
802
  * Normalized app configuration with resolved defaults.
803
+ *
804
+ * This is the internal representation after processing user input.
805
+ * All optional fields have been resolved to their defaults.
277
806
  */
278
807
  interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
808
+ /** App type (always defined after normalization) */
279
809
  type: 'backend' | 'frontend';
810
+ /** Path to the app */
280
811
  path: string;
812
+ /** Development server port */
281
813
  port: number;
814
+ /** Resolved dependencies array (empty array if none) */
282
815
  dependencies: string[];
283
816
  /** Resolved deploy target (app.deploy > deploy.default > 'dokploy') */
284
817
  resolvedDeployTarget: DeployTarget;
@@ -293,14 +826,24 @@ interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
293
826
  }
294
827
  /**
295
828
  * Normalized workspace configuration with resolved defaults.
829
+ *
830
+ * This is the internal representation after processing user input.
831
+ * All optional fields have been resolved to their defaults.
296
832
  */
297
833
  interface NormalizedWorkspace {
834
+ /** Workspace name (resolved from package.json if not specified) */
298
835
  name: string;
836
+ /** Absolute path to workspace root */
299
837
  root: string;
838
+ /** Normalized app configurations */
300
839
  apps: Record<string, NormalizedAppConfig>;
840
+ /** Services configuration (empty object if not specified) */
301
841
  services: ServicesConfig;
842
+ /** Deploy configuration (empty object if not specified) */
302
843
  deploy: DeployConfig;
844
+ /** Shared packages configuration (empty object if not specified) */
303
845
  shared: SharedConfig;
846
+ /** Secrets configuration (empty object if not specified) */
304
847
  secrets: SecretsConfig;
305
848
  }
306
849
  /**
@@ -316,6 +859,15 @@ interface LoadedConfig {
316
859
  }
317
860
  /**
318
861
  * Type guard to check if a config is a WorkspaceConfig.
862
+ *
863
+ * @example
864
+ * ```ts
865
+ * const config = await loadConfig();
866
+ * if (isWorkspaceConfig(config)) {
867
+ * // config.apps is available
868
+ * console.log(Object.keys(config.apps));
869
+ * }
870
+ * ```
319
871
  */
320
872
  declare function isWorkspaceConfig(config: GkmConfig | WorkspaceConfig): config is WorkspaceConfig;
321
873
  //#endregion
@@ -557,4 +1109,4 @@ declare function getDependencyEnvVars(workspace: NormalizedWorkspace, appName: s
557
1109
 
558
1110
  //#endregion
559
1111
  export { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ClientConfig, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig, wrapSingleAppAsWorkspace };
560
- //# sourceMappingURL=index-E8Nu2Rxl.d.cts.map
1112
+ //# sourceMappingURL=index-pOA56MWT.d.cts.map