@kuckit/cli 1.0.4 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -18,4 +18,479 @@ interface DiscoverOptions {
18
18
  }
19
19
  declare function discoverModules(options: DiscoverOptions): Promise<void>;
20
20
  //#endregion
21
- export { addModule, discoverModules, generateModule };
21
+ //#region src/commands/infra/provider.d.ts
22
+ /**
23
+ * KuckitInfraProvider Interface
24
+ *
25
+ * This interface defines the contract that all cloud infrastructure providers must implement.
26
+ * It enables multi-cloud support by abstracting provider-specific logic behind a common interface.
27
+ *
28
+ * Provider packages (e.g., @kuckit/infra-gcp, @kuckit/infra-aws) implement this interface
29
+ * and are discovered/loaded by the CLI at runtime.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // In @kuckit/infra-gcp/src/provider.ts
34
+ * import { defineInfraProvider } from '@kuckit/cli'
35
+ *
36
+ * export const provider = defineInfraProvider({
37
+ * id: 'gcp',
38
+ * label: 'Google Cloud Platform',
39
+ * // ... implementation
40
+ * })
41
+ * ```
42
+ */
43
+ /**
44
+ * Base configuration stored by CLI (provider-agnostic fields)
45
+ */
46
+ interface BaseInfraConfig {
47
+ /** Provider ID (e.g., 'gcp', 'aws', 'azure') */
48
+ provider: string;
49
+ /** Environment (dev/staging/prod) */
50
+ env: string;
51
+ /** Deployment region */
52
+ region: string;
53
+ /** Project/app name for resource naming */
54
+ projectName: string;
55
+ /** Pulumi stack name */
56
+ stackName: string;
57
+ /** ISO timestamp of config creation */
58
+ createdAt: string;
59
+ /** ISO timestamp of last update */
60
+ updatedAt: string;
61
+ }
62
+ /**
63
+ * Result from an infrastructure operation (init/deploy/destroy)
64
+ */
65
+ interface InfraOperationResult<TOutputs = Record<string, unknown>> {
66
+ /** Whether the operation succeeded */
67
+ success: boolean;
68
+ /** Human-readable message */
69
+ message: string;
70
+ /** Deployment outputs (only on success) */
71
+ outputs?: TOutputs;
72
+ /** Error details (only on failure) */
73
+ error?: {
74
+ code: string;
75
+ message: string;
76
+ details?: string;
77
+ };
78
+ }
79
+ /**
80
+ * Options passed to provider init
81
+ */
82
+ interface ProviderInitOptions {
83
+ /** Environment to initialize */
84
+ env: string;
85
+ /** Target region */
86
+ region: string;
87
+ /** Project root directory */
88
+ projectRoot: string;
89
+ /** Skip confirmation prompts */
90
+ yes?: boolean;
91
+ /** Provider-specific options */
92
+ providerOptions?: Record<string, unknown>;
93
+ }
94
+ /**
95
+ * Options passed to provider deploy
96
+ */
97
+ interface ProviderDeployOptions {
98
+ /** Environment to deploy */
99
+ env: string;
100
+ /** Project root directory */
101
+ projectRoot: string;
102
+ /** Preview changes without applying */
103
+ preview?: boolean;
104
+ /** Skip Docker build (use existing image) */
105
+ skipBuild?: boolean;
106
+ /** Use specific image URL */
107
+ image?: string;
108
+ /** Skip confirmation prompts */
109
+ yes?: boolean;
110
+ }
111
+ /**
112
+ * Options passed to provider destroy
113
+ */
114
+ interface ProviderDestroyOptions {
115
+ /** Environment to destroy */
116
+ env: string;
117
+ /** Project root directory */
118
+ projectRoot: string;
119
+ /** Only destroy application layer, keep persistent resources */
120
+ appOnly?: boolean;
121
+ /** Skip confirmation prompts */
122
+ force?: boolean;
123
+ }
124
+ /**
125
+ * Options passed to provider status check
126
+ */
127
+ interface ProviderStatusOptions {
128
+ /** Environment to check */
129
+ env: string;
130
+ /** Project root directory */
131
+ projectRoot: string;
132
+ }
133
+ /**
134
+ * Status information returned by provider
135
+ */
136
+ interface ProviderStatus {
137
+ /** Whether infrastructure is deployed */
138
+ deployed: boolean;
139
+ /** Current state (initializing/ready/deploying/error) */
140
+ state: 'initializing' | 'ready' | 'deploying' | 'error' | 'not_initialized';
141
+ /** Service URL if deployed */
142
+ serviceUrl?: string;
143
+ /** Last deployment timestamp */
144
+ lastDeployment?: string;
145
+ /** Provider-specific status details */
146
+ details?: Record<string, unknown>;
147
+ }
148
+ /**
149
+ * Options for ejecting provider to local packages
150
+ */
151
+ interface ProviderEjectOptions {
152
+ /** Target directory for ejected code */
153
+ targetDir: string;
154
+ /** Project root directory */
155
+ projectRoot: string;
156
+ /** Skip confirmation prompts */
157
+ force?: boolean;
158
+ }
159
+ /**
160
+ * The main infrastructure provider interface.
161
+ *
162
+ * All provider packages must export a `provider` object implementing this interface.
163
+ * The CLI discovers and loads providers dynamically based on installed packages.
164
+ *
165
+ * @typeParam TConfig - Provider-specific configuration extending BaseInfraConfig
166
+ * @typeParam TOutputs - Provider-specific deployment outputs
167
+ */
168
+ interface KuckitInfraProvider<TConfig extends BaseInfraConfig = BaseInfraConfig, TOutputs extends Record<string, unknown> = Record<string, unknown>> {
169
+ /**
170
+ * Unique provider identifier (e.g., 'gcp', 'aws', 'azure')
171
+ * Used for config storage and provider resolution
172
+ */
173
+ readonly id: string;
174
+ /**
175
+ * Human-readable provider name for display
176
+ * (e.g., 'Google Cloud Platform', 'Amazon Web Services')
177
+ */
178
+ readonly label: string;
179
+ /**
180
+ * Provider version (semver)
181
+ */
182
+ readonly version: string;
183
+ /**
184
+ * Get the infrastructure directory path for this provider.
185
+ * This is where Pulumi/Terraform/CDK code lives.
186
+ *
187
+ * @param projectRoot - The project root directory
188
+ * @returns Absolute path to infrastructure directory
189
+ */
190
+ getInfraDir(projectRoot: string): string;
191
+ /**
192
+ * Check if provider prerequisites are met (CLI tools, auth, etc.)
193
+ *
194
+ * @returns Object with status and any missing prerequisites
195
+ */
196
+ checkPrerequisites(): Promise<{
197
+ ok: boolean;
198
+ missing: Array<{
199
+ name: string;
200
+ installUrl: string;
201
+ }>;
202
+ }>;
203
+ /**
204
+ * Initialize base infrastructure for the project.
205
+ * Creates foundational resources (VPC, registry, database) without deploying the app.
206
+ *
207
+ * @param options - Initialization options
208
+ * @returns Operation result with deployment outputs
209
+ */
210
+ init(options: ProviderInitOptions): Promise<InfraOperationResult<TOutputs>>;
211
+ /**
212
+ * Deploy the application to the infrastructure.
213
+ * Builds container image (if needed) and deploys to compute platform.
214
+ *
215
+ * @param options - Deployment options
216
+ * @param config - Current stored configuration
217
+ * @returns Operation result with deployment outputs
218
+ */
219
+ deploy(options: ProviderDeployOptions, config: TConfig): Promise<InfraOperationResult<TOutputs>>;
220
+ /**
221
+ * Destroy infrastructure resources.
222
+ *
223
+ * @param options - Destroy options
224
+ * @param config - Current stored configuration
225
+ * @returns Operation result
226
+ */
227
+ destroy(options: ProviderDestroyOptions, config: TConfig): Promise<InfraOperationResult>;
228
+ /**
229
+ * Get current infrastructure status.
230
+ *
231
+ * @param options - Status options
232
+ * @param config - Current stored configuration
233
+ * @returns Current provider status
234
+ */
235
+ status(options: ProviderStatusOptions, config: TConfig): Promise<ProviderStatus>;
236
+ /**
237
+ * Get provider-specific configuration prompts for init.
238
+ * Returns questions to ask user during interactive init.
239
+ *
240
+ * @param defaults - Any existing config values to use as defaults
241
+ * @returns Array of prompts for inquirer
242
+ */
243
+ getInitPrompts(defaults?: Partial<TConfig>): Promise<Array<{
244
+ name: string;
245
+ message: string;
246
+ type: 'input' | 'select' | 'confirm';
247
+ default?: string | boolean;
248
+ choices?: Array<{
249
+ value: string;
250
+ label: string;
251
+ }>;
252
+ validate?: (value: string) => boolean | string;
253
+ }>>;
254
+ /**
255
+ * Build provider-specific config from user responses.
256
+ *
257
+ * @param responses - User responses from init prompts
258
+ * @param baseConfig - Base config fields
259
+ * @returns Complete provider config
260
+ */
261
+ buildConfig(responses: Record<string, unknown>, baseConfig: Pick<BaseInfraConfig, 'env' | 'region' | 'projectName' | 'stackName'>): TConfig;
262
+ /**
263
+ * Optional: Eject provider infrastructure code to local project.
264
+ * Allows customization of infrastructure beyond provider defaults.
265
+ *
266
+ * @param options - Eject options
267
+ * @returns Operation result
268
+ */
269
+ eject?(options: ProviderEjectOptions): Promise<InfraOperationResult>;
270
+ /**
271
+ * Optional: Generate Dockerfile for the project.
272
+ * Providers can include optimized Dockerfile templates.
273
+ *
274
+ * @param projectRoot - Project root directory
275
+ * @returns Dockerfile content or null if using existing
276
+ */
277
+ generateDockerfile?(projectRoot: string): Promise<string | null>;
278
+ /**
279
+ * Optional: Validate that project structure is compatible with provider.
280
+ *
281
+ * @param projectRoot - Project root directory
282
+ * @returns Validation result with any issues
283
+ */
284
+ validateProject?(projectRoot: string): Promise<{
285
+ valid: boolean;
286
+ issues: Array<{
287
+ severity: 'error' | 'warning';
288
+ message: string;
289
+ }>;
290
+ }>;
291
+ }
292
+ /**
293
+ * Helper to define a provider with type inference.
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * export const provider = defineInfraProvider({
298
+ * id: 'gcp',
299
+ * label: 'Google Cloud Platform',
300
+ * version: '1.0.0',
301
+ * getInfraDir: (root) => join(root, 'node_modules/@kuckit/infra-gcp/infra'),
302
+ * // ... rest of implementation
303
+ * })
304
+ * ```
305
+ */
306
+ declare function defineInfraProvider<TConfig extends BaseInfraConfig = BaseInfraConfig, TOutputs extends Record<string, unknown> = Record<string, unknown>>(provider: KuckitInfraProvider<TConfig, TOutputs>): KuckitInfraProvider<TConfig, TOutputs>;
307
+ /**
308
+ * Type for the provider module export.
309
+ * Provider packages should default export this shape.
310
+ */
311
+ interface KuckitInfraProviderModule<TConfig extends BaseInfraConfig = BaseInfraConfig, TOutputs extends Record<string, unknown> = Record<string, unknown>> {
312
+ provider: KuckitInfraProvider<TConfig, TOutputs>;
313
+ }
314
+ //#endregion
315
+ //#region src/commands/infra/types.d.ts
316
+ /**
317
+ * GCP-specific configuration fields
318
+ */
319
+ interface GcpProviderConfig {
320
+ /** GCP Project ID */
321
+ gcpProject: string;
322
+ }
323
+ /**
324
+ * AWS-specific configuration fields (future)
325
+ */
326
+ interface AwsProviderConfig {
327
+ /** AWS Account ID */
328
+ awsAccountId: string;
329
+ /** AWS Profile name */
330
+ awsProfile?: string;
331
+ }
332
+ /**
333
+ * Azure-specific configuration fields (future)
334
+ */
335
+ interface AzureProviderConfig {
336
+ /** Azure Subscription ID */
337
+ subscriptionId: string;
338
+ /** Azure Resource Group */
339
+ resourceGroup: string;
340
+ }
341
+ /**
342
+ * Union of all provider configs
343
+ */
344
+ type ProviderConfig = GcpProviderConfig | AwsProviderConfig | AzureProviderConfig;
345
+ /**
346
+ * Base deployment outputs common to all providers
347
+ */
348
+ interface BaseDeploymentOutputs {
349
+ /** Container registry URL */
350
+ registryUrl: string;
351
+ /** Service URL after deployment */
352
+ serviceUrl?: string;
353
+ }
354
+ /**
355
+ * GCP-specific deployment outputs
356
+ */
357
+ interface GcpDeploymentOutputs extends BaseDeploymentOutputs {
358
+ /** Cloud SQL connection name for Cloud SQL Auth Proxy */
359
+ databaseConnectionName: string;
360
+ /** Database name inside Cloud SQL instance */
361
+ databaseName?: string;
362
+ /** Database user for Cloud SQL */
363
+ databaseUser?: string;
364
+ /** Memorystore Redis private IP address */
365
+ redisHost: string;
366
+ /** Secret Manager secret IDs */
367
+ secretIds: {
368
+ /** Database password secret ID */
369
+ dbPassword: string;
370
+ /** Redis AUTH string secret ID */
371
+ redisAuth: string;
372
+ };
373
+ /** Cloud Run Job name for database migrations */
374
+ migrationJobName?: string;
375
+ }
376
+ /**
377
+ * AWS-specific deployment outputs (future)
378
+ */
379
+ interface AwsDeploymentOutputs extends BaseDeploymentOutputs {
380
+ /** RDS instance endpoint */
381
+ databaseEndpoint?: string;
382
+ /** ElastiCache endpoint */
383
+ redisEndpoint?: string;
384
+ /** ECS service ARN */
385
+ ecsServiceArn?: string;
386
+ }
387
+ /**
388
+ * Azure-specific deployment outputs (future)
389
+ */
390
+ interface AzureDeploymentOutputs extends BaseDeploymentOutputs {
391
+ /** Azure SQL server name */
392
+ sqlServerName?: string;
393
+ /** Azure Cache for Redis hostname */
394
+ redisHostname?: string;
395
+ /** Container Apps URL */
396
+ containerAppUrl?: string;
397
+ }
398
+ /**
399
+ * Union of all deployment output types
400
+ */
401
+ type DeploymentOutputs = GcpDeploymentOutputs | AwsDeploymentOutputs | AzureDeploymentOutputs;
402
+ /**
403
+ * Supported cloud provider IDs
404
+ */
405
+ type SupportedProvider = 'gcp' | 'aws' | 'azure';
406
+ /**
407
+ * CLI config stored in .kuckit/infra.json
408
+ *
409
+ * This is an extended version of BaseInfraConfig with additional fields
410
+ * specific to CLI storage and provider management.
411
+ */
412
+ interface StoredInfraConfig extends BaseInfraConfig {
413
+ /**
414
+ * Provider ID (e.g., 'gcp', 'aws', 'azure')
415
+ * @override Narrows the base string type to supported providers
416
+ */
417
+ provider: SupportedProvider;
418
+ /**
419
+ * npm package name of the provider (e.g., '@kuckit/infra-gcp')
420
+ * Used to load the provider dynamically at runtime.
421
+ */
422
+ providerPackage: string;
423
+ /**
424
+ * Environment (dev/staging/prod)
425
+ * @override Narrows to common environments
426
+ */
427
+ env: 'dev' | 'staging' | 'prod';
428
+ /**
429
+ * Provider-specific configuration.
430
+ * Contains fields that vary by cloud provider.
431
+ */
432
+ providerConfig: ProviderConfig;
433
+ /**
434
+ * Optional local infrastructure directory.
435
+ * Set when provider has been ejected for customization.
436
+ * If not set, uses provider's bundled infra.
437
+ */
438
+ localInfraDir?: string;
439
+ /**
440
+ * Deployment outputs from the last successful deployment.
441
+ * Structure varies by provider.
442
+ */
443
+ outputs?: DeploymentOutputs;
444
+ }
445
+ /**
446
+ * Legacy config format (pre-provider-module)
447
+ * Used for migration and backward compatibility
448
+ *
449
+ * @deprecated Use StoredInfraConfig instead
450
+ */
451
+ interface LegacyInfraConfig {
452
+ provider: 'gcp';
453
+ gcpProject: string;
454
+ region: string;
455
+ projectName: string;
456
+ stackName: string;
457
+ env: 'dev' | 'prod';
458
+ outputs?: GcpDeploymentOutputs;
459
+ createdAt: string;
460
+ updatedAt: string;
461
+ }
462
+ /**
463
+ * Check if config is legacy format
464
+ */
465
+ declare function isLegacyConfig(config: StoredInfraConfig | LegacyInfraConfig): config is LegacyInfraConfig;
466
+ /**
467
+ * Migrate legacy config to new format
468
+ */
469
+ declare function migrateLegacyConfig(legacy: LegacyInfraConfig): StoredInfraConfig;
470
+ /**
471
+ * Check if config is for GCP
472
+ */
473
+ declare function isGcpConfig(config: StoredInfraConfig): config is StoredInfraConfig & {
474
+ provider: 'gcp';
475
+ providerConfig: GcpProviderConfig;
476
+ outputs?: GcpDeploymentOutputs;
477
+ };
478
+ /**
479
+ * Check if config is for AWS
480
+ */
481
+ declare function isAwsConfig(config: StoredInfraConfig): config is StoredInfraConfig & {
482
+ provider: 'aws';
483
+ providerConfig: AwsProviderConfig;
484
+ outputs?: AwsDeploymentOutputs;
485
+ };
486
+ /**
487
+ * Check if config is for Azure
488
+ */
489
+ declare function isAzureConfig(config: StoredInfraConfig): config is StoredInfraConfig & {
490
+ provider: 'azure';
491
+ providerConfig: AzureProviderConfig;
492
+ outputs?: AzureDeploymentOutputs;
493
+ };
494
+ //#endregion
495
+ export { type AwsDeploymentOutputs, type AwsProviderConfig, type AzureDeploymentOutputs, type AzureProviderConfig, type BaseDeploymentOutputs, type BaseInfraConfig, type DeploymentOutputs, type GcpDeploymentOutputs, type GcpProviderConfig, type InfraOperationResult, type KuckitInfraProvider, type KuckitInfraProviderModule, type LegacyInfraConfig, type ProviderConfig, type ProviderDeployOptions, type ProviderDestroyOptions, type ProviderEjectOptions, type ProviderInitOptions, type ProviderStatus, type ProviderStatusOptions, type StoredInfraConfig, type SupportedProvider, addModule, defineInfraProvider, discoverModules, generateModule, isAwsConfig, isAzureConfig, isGcpConfig, isLegacyConfig, migrateLegacyConfig };
496
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/commands/generate-module.ts","../src/commands/add-module.ts","../src/commands/discover-module.ts","../src/commands/infra/provider.ts","../src/commands/infra/types.ts"],"sourcesContent":[],"mappings":";UAGU,qBAAA;EAAA,GAAA,EAAA,MAAA;EAwBY,GAAA,EAAA,MAAA;;iBAAA,cAAA,wBAAsC,wBAAwB;;;UCtB1E,gBAAA;EDFA,WAAA,EAAA,OAAA;AAwBV;iBCwMsB,SAAA,+BAAwC,mBAAmB;;;UC9NhE,eAAA;EFFP,IAAA,EAAA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AYA;AAYA;;;;AAAoG,UAiBnF,iBAAA,SAA0B,eAjByD,CAAA;EASxF;AAQZ;;;EAoCW,QAAA,EA/BA,iBA+BA;EApCgC;;AAiD3C;AAeA;EACS,eAAA,EAAA,MAAA;EAAoB;;;AAQ7B;EAwBgB,GAAA,EAAA,KAAA,GAAA,SAAW,GAAA,MAAA;EAAS;;;;EAGL,cAAA,EA7Ed,cA6Ec;EAQf;;;;;EAGe,aAAA,CAAA,EAAA,MAAA;EAQf;;;;EAGL,OAAA,CAAA,EAtFA,iBAsFA;;;;;;;;UAzEM,iBAAA;;;;;;;YAON;;;;;;;iBAQK,cAAA,SACP,oBAAoB,8BAChB;;;;iBAOG,mBAAA,SAA4B,oBAAoB;;;;iBAwBhD,WAAA,SAAoB,8BAA8B;;kBAEjD;YACN;;;;;iBAQK,WAAA,SAAoB,8BAA8B;;kBAEjD;YACN;;;;;iBAQK,aAAA,SAAsB,8BAA8B;;kBAEnD;YACN"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { i as generateModule, r as addModule, t as discoverModules } from "./discover-module-B4oRIuSK.js";
1
+ import { a as isLegacyConfig, i as isGcpConfig, l as addModule, n as isAwsConfig, o as migrateLegacyConfig, r as isAzureConfig, s as discoverModules, t as defineInfraProvider, u as generateModule } from "./provider-DbqTBb6C.js";
2
2
 
3
- export { addModule, discoverModules, generateModule };
3
+ export { addModule, defineInfraProvider, discoverModules, generateModule, isAwsConfig, isAzureConfig, isGcpConfig, isLegacyConfig, migrateLegacyConfig };
@@ -1016,4 +1016,69 @@ async function discoverModules(options) {
1016
1016
  }
1017
1017
 
1018
1018
  //#endregion
1019
- export { generateModule as i, loadTryLoadKuckitConfig as n, addModule as r, discoverModules as t };
1019
+ //#region src/commands/infra/types.ts
1020
+ /**
1021
+ * Check if config is legacy format
1022
+ */
1023
+ function isLegacyConfig(config) {
1024
+ return "gcpProject" in config && !("providerPackage" in config);
1025
+ }
1026
+ /**
1027
+ * Migrate legacy config to new format
1028
+ */
1029
+ function migrateLegacyConfig(legacy) {
1030
+ return {
1031
+ provider: "gcp",
1032
+ providerPackage: "@kuckit/infra-gcp",
1033
+ region: legacy.region,
1034
+ projectName: legacy.projectName,
1035
+ stackName: legacy.stackName,
1036
+ env: legacy.env,
1037
+ providerConfig: { gcpProject: legacy.gcpProject },
1038
+ outputs: legacy.outputs,
1039
+ createdAt: legacy.createdAt,
1040
+ updatedAt: legacy.updatedAt
1041
+ };
1042
+ }
1043
+ /**
1044
+ * Check if config is for GCP
1045
+ */
1046
+ function isGcpConfig(config) {
1047
+ return config.provider === "gcp";
1048
+ }
1049
+ /**
1050
+ * Check if config is for AWS
1051
+ */
1052
+ function isAwsConfig(config) {
1053
+ return config.provider === "aws";
1054
+ }
1055
+ /**
1056
+ * Check if config is for Azure
1057
+ */
1058
+ function isAzureConfig(config) {
1059
+ return config.provider === "azure";
1060
+ }
1061
+
1062
+ //#endregion
1063
+ //#region src/commands/infra/provider.ts
1064
+ /**
1065
+ * Helper to define a provider with type inference.
1066
+ *
1067
+ * @example
1068
+ * ```typescript
1069
+ * export const provider = defineInfraProvider({
1070
+ * id: 'gcp',
1071
+ * label: 'Google Cloud Platform',
1072
+ * version: '1.0.0',
1073
+ * getInfraDir: (root) => join(root, 'node_modules/@kuckit/infra-gcp/infra'),
1074
+ * // ... rest of implementation
1075
+ * })
1076
+ * ```
1077
+ */
1078
+ function defineInfraProvider(provider) {
1079
+ return provider;
1080
+ }
1081
+
1082
+ //#endregion
1083
+ export { isLegacyConfig as a, loadTryLoadKuckitConfig as c, isGcpConfig as i, addModule as l, isAwsConfig as n, migrateLegacyConfig as o, isAzureConfig as r, discoverModules as s, defineInfraProvider as t, generateModule as u };
1084
+ //# sourceMappingURL=provider-DbqTBb6C.js.map