@korajs/cli 0.1.15 → 0.2.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/README.md +49 -0
- package/dist/bin.cjs +2517 -332
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +12 -10
- package/dist/bin.js.map +1 -1
- package/dist/chunk-E4JG7THU.js +1550 -0
- package/dist/chunk-E4JG7THU.js.map +1 -0
- package/dist/chunk-KTSRAPSE.js +752 -0
- package/dist/chunk-KTSRAPSE.js.map +1 -0
- package/dist/chunk-ZGYRDYXS.js +609 -0
- package/dist/chunk-ZGYRDYXS.js.map +1 -0
- package/dist/create.cjs +974 -159
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +2103 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +617 -1
- package/dist/index.d.ts +617 -1
- package/dist/index.js +91 -5
- package/package.json +8 -2
- package/dist/chunk-N36PFOSA.js +0 -103
- package/dist/chunk-N36PFOSA.js.map +0 -1
- package/dist/chunk-SYOFLJLB.js +0 -437
- package/dist/chunk-SYOFLJLB.js.map +0 -1
- package/dist/chunk-VGOOQ56H.js +0 -103
- package/dist/chunk-VGOOQ56H.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KoraError, SchemaDefinition } from '@korajs/core';
|
|
2
|
+
import * as citty from 'citty';
|
|
2
3
|
|
|
3
4
|
/** Supported package managers */
|
|
4
5
|
declare const PACKAGE_MANAGERS: readonly ["pnpm", "npm", "yarn", "bun"];
|
|
@@ -19,6 +20,7 @@ interface TemplateContext {
|
|
|
19
20
|
projectName: string;
|
|
20
21
|
packageManager: PackageManager;
|
|
21
22
|
koraVersion: string;
|
|
23
|
+
dbProvider?: string;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -69,4 +71,618 @@ declare class DevServerError extends KoraError {
|
|
|
69
71
|
*/
|
|
70
72
|
declare function generateTypes(schema: SchemaDefinition): string;
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
/**
|
|
75
|
+
* The `deploy` command for Phase 13.
|
|
76
|
+
*
|
|
77
|
+
* This command orchestrates:
|
|
78
|
+
* - deploy state resolution and persistence
|
|
79
|
+
* - artifact generation
|
|
80
|
+
* - adapter-driven provision/build/deploy flows
|
|
81
|
+
*/
|
|
82
|
+
declare const deployCommand: citty.CommandDef<{
|
|
83
|
+
platform: {
|
|
84
|
+
type: "string";
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
app: {
|
|
88
|
+
type: "string";
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
region: {
|
|
92
|
+
type: "string";
|
|
93
|
+
description: string;
|
|
94
|
+
};
|
|
95
|
+
prod: {
|
|
96
|
+
type: "boolean";
|
|
97
|
+
description: string;
|
|
98
|
+
default: false;
|
|
99
|
+
};
|
|
100
|
+
confirm: {
|
|
101
|
+
type: "boolean";
|
|
102
|
+
description: string;
|
|
103
|
+
default: false;
|
|
104
|
+
};
|
|
105
|
+
reset: {
|
|
106
|
+
type: "boolean";
|
|
107
|
+
description: string;
|
|
108
|
+
default: false;
|
|
109
|
+
};
|
|
110
|
+
}>;
|
|
111
|
+
|
|
112
|
+
declare const DEPLOY_PLATFORMS: readonly ["fly", "railway", "render", "docker", "kora-cloud"];
|
|
113
|
+
type DeployPlatform = (typeof DEPLOY_PLATFORMS)[number];
|
|
114
|
+
interface ProjectConfig {
|
|
115
|
+
projectRoot: string;
|
|
116
|
+
appName: string;
|
|
117
|
+
region: string | null;
|
|
118
|
+
environment: 'preview' | 'production';
|
|
119
|
+
confirm: boolean;
|
|
120
|
+
}
|
|
121
|
+
interface ProvisionResult {
|
|
122
|
+
applicationId: string;
|
|
123
|
+
databaseId: string | null;
|
|
124
|
+
secretsSet: string[];
|
|
125
|
+
}
|
|
126
|
+
interface BuildArtifacts {
|
|
127
|
+
clientDirectory: string | null;
|
|
128
|
+
serverBundlePath: string | null;
|
|
129
|
+
deployDirectory: string;
|
|
130
|
+
}
|
|
131
|
+
interface DeployResult {
|
|
132
|
+
deploymentId: string;
|
|
133
|
+
liveUrl: string;
|
|
134
|
+
syncUrl: string | null;
|
|
135
|
+
}
|
|
136
|
+
interface LogOptions {
|
|
137
|
+
since?: string;
|
|
138
|
+
tail?: number;
|
|
139
|
+
}
|
|
140
|
+
interface LogLine {
|
|
141
|
+
timestamp: string;
|
|
142
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
143
|
+
message: string;
|
|
144
|
+
}
|
|
145
|
+
interface DeploymentStatus {
|
|
146
|
+
state: 'pending' | 'healthy' | 'failed' | 'unknown';
|
|
147
|
+
message: string;
|
|
148
|
+
liveUrl?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Contract implemented by each deployment platform integration.
|
|
152
|
+
*/
|
|
153
|
+
interface DeployAdapter {
|
|
154
|
+
name: DeployPlatform;
|
|
155
|
+
detect(): Promise<boolean>;
|
|
156
|
+
install(): Promise<void>;
|
|
157
|
+
authenticate(): Promise<void>;
|
|
158
|
+
provision(config: ProjectConfig): Promise<ProvisionResult>;
|
|
159
|
+
build(config: ProjectConfig): Promise<BuildArtifacts>;
|
|
160
|
+
deploy(artifacts: BuildArtifacts): Promise<DeployResult>;
|
|
161
|
+
rollback(deploymentId: string): Promise<void>;
|
|
162
|
+
logs(options: LogOptions): AsyncIterable<LogLine>;
|
|
163
|
+
status(): Promise<DeploymentStatus>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Optional adapter extension for commands that require runtime context
|
|
167
|
+
* (project root, app name, region) outside an initial provisioning run.
|
|
168
|
+
*/
|
|
169
|
+
interface ContextAwareDeployAdapter extends DeployAdapter {
|
|
170
|
+
setContext(context: {
|
|
171
|
+
projectRoot: string;
|
|
172
|
+
appName: string;
|
|
173
|
+
region: string | null;
|
|
174
|
+
}): void;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Checks whether the provided value is a known deploy platform.
|
|
178
|
+
*/
|
|
179
|
+
declare function isDeployPlatform(value: string): value is DeployPlatform;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Execution abstraction for Fly CLI shell interactions.
|
|
183
|
+
* This keeps FlyAdapter deterministic and fully mockable in tests.
|
|
184
|
+
*/
|
|
185
|
+
interface FlyCommandRunner {
|
|
186
|
+
run(command: string, args: string[], cwd: string): Promise<FlyCommandResult>;
|
|
187
|
+
}
|
|
188
|
+
interface FlyCommandResult {
|
|
189
|
+
exitCode: number;
|
|
190
|
+
stdout: string;
|
|
191
|
+
stderr: string;
|
|
192
|
+
}
|
|
193
|
+
interface FlyAdapterOptions {
|
|
194
|
+
runner?: FlyCommandRunner;
|
|
195
|
+
context?: FlyAdapterContext;
|
|
196
|
+
commandCandidates?: readonly string[];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Fly.io deploy adapter implementation for Phase 13.
|
|
200
|
+
*/
|
|
201
|
+
declare class FlyAdapter implements ContextAwareDeployAdapter {
|
|
202
|
+
readonly name: "fly";
|
|
203
|
+
private readonly logger;
|
|
204
|
+
private readonly runner;
|
|
205
|
+
private readonly commandCandidates;
|
|
206
|
+
private flyCommand;
|
|
207
|
+
private currentContext;
|
|
208
|
+
private lastDeploymentId;
|
|
209
|
+
constructor(options?: FlyAdapterOptions);
|
|
210
|
+
/**
|
|
211
|
+
* Seeds runtime context for non-provisioning commands.
|
|
212
|
+
*/
|
|
213
|
+
setContext(context: FlyAdapterContext): void;
|
|
214
|
+
/**
|
|
215
|
+
* Checks whether a Fly CLI executable can be resolved.
|
|
216
|
+
*/
|
|
217
|
+
detect(): Promise<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* Ensures Fly CLI is available before deployment.
|
|
220
|
+
*/
|
|
221
|
+
install(): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Performs Fly authentication check/login.
|
|
224
|
+
*/
|
|
225
|
+
authenticate(): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Provisions app and optionally region-bound resources in Fly.
|
|
228
|
+
*/
|
|
229
|
+
provision(config: ProjectConfig): Promise<ProvisionResult>;
|
|
230
|
+
/**
|
|
231
|
+
* Builds local artifacts consumed by Fly deploy.
|
|
232
|
+
*/
|
|
233
|
+
build(config: ProjectConfig): Promise<BuildArtifacts>;
|
|
234
|
+
/**
|
|
235
|
+
* Deploys generated artifacts to Fly and returns live endpoints.
|
|
236
|
+
*/
|
|
237
|
+
deploy(artifacts: BuildArtifacts): Promise<DeployResult>;
|
|
238
|
+
/**
|
|
239
|
+
* Rolls back to a deployment version.
|
|
240
|
+
*/
|
|
241
|
+
rollback(deploymentId: string): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Returns deployment logs as an async iterable.
|
|
244
|
+
*/
|
|
245
|
+
logs(options: LogOptions): AsyncIterable<LogLine>;
|
|
246
|
+
/**
|
|
247
|
+
* Reads current deployment status from Fly.
|
|
248
|
+
*/
|
|
249
|
+
status(): Promise<DeploymentStatus>;
|
|
250
|
+
private runFlyCommand;
|
|
251
|
+
private requireContext;
|
|
252
|
+
private resolveFlyCommand;
|
|
253
|
+
private tryResolveFlyCommand;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Default subprocess-backed runner for Fly commands.
|
|
257
|
+
*/
|
|
258
|
+
declare class NodeFlyCommandRunner implements FlyCommandRunner {
|
|
259
|
+
run(command: string, args: string[], cwd: string): Promise<FlyCommandResult>;
|
|
260
|
+
}
|
|
261
|
+
interface FlyAdapterContext {
|
|
262
|
+
projectRoot: string;
|
|
263
|
+
appName: string;
|
|
264
|
+
region: string | null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Creates a deploy adapter instance for the selected platform.
|
|
269
|
+
*/
|
|
270
|
+
declare function createDeployAdapter(platform: DeployPlatform): DeployAdapter;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Execution abstraction for Railway CLI shell interactions.
|
|
274
|
+
*/
|
|
275
|
+
interface RailwayCommandRunner {
|
|
276
|
+
run(command: string, args: string[], cwd: string): Promise<RailwayCommandResult>;
|
|
277
|
+
}
|
|
278
|
+
interface RailwayCommandResult {
|
|
279
|
+
exitCode: number;
|
|
280
|
+
stdout: string;
|
|
281
|
+
stderr: string;
|
|
282
|
+
}
|
|
283
|
+
interface RailwayAdapterOptions {
|
|
284
|
+
runner?: RailwayCommandRunner;
|
|
285
|
+
context?: RailwayAdapterContext;
|
|
286
|
+
commandCandidates?: readonly string[];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Railway deploy adapter implementation for Phase 13.
|
|
290
|
+
*/
|
|
291
|
+
declare class RailwayAdapter implements ContextAwareDeployAdapter {
|
|
292
|
+
readonly name: "railway";
|
|
293
|
+
private readonly logger;
|
|
294
|
+
private readonly runner;
|
|
295
|
+
private readonly commandCandidates;
|
|
296
|
+
private railwayCommand;
|
|
297
|
+
private currentContext;
|
|
298
|
+
private lastDeploymentId;
|
|
299
|
+
constructor(options?: RailwayAdapterOptions);
|
|
300
|
+
setContext(context: RailwayAdapterContext): void;
|
|
301
|
+
detect(): Promise<boolean>;
|
|
302
|
+
install(): Promise<void>;
|
|
303
|
+
authenticate(): Promise<void>;
|
|
304
|
+
provision(config: ProjectConfig): Promise<ProvisionResult>;
|
|
305
|
+
build(config: ProjectConfig): Promise<BuildArtifacts>;
|
|
306
|
+
deploy(artifacts: BuildArtifacts): Promise<DeployResult>;
|
|
307
|
+
rollback(deploymentId: string): Promise<void>;
|
|
308
|
+
logs(options: LogOptions): AsyncIterable<LogLine>;
|
|
309
|
+
status(): Promise<DeploymentStatus>;
|
|
310
|
+
private runRailwayCommand;
|
|
311
|
+
private requireContext;
|
|
312
|
+
private resolveRailwayCommand;
|
|
313
|
+
private tryResolveRailwayCommand;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Default subprocess-backed runner for Railway commands.
|
|
317
|
+
*/
|
|
318
|
+
declare class NodeRailwayCommandRunner implements RailwayCommandRunner {
|
|
319
|
+
run(command: string, args: string[], cwd: string): Promise<RailwayCommandResult>;
|
|
320
|
+
}
|
|
321
|
+
interface RailwayAdapterContext {
|
|
322
|
+
projectRoot: string;
|
|
323
|
+
appName: string;
|
|
324
|
+
region: string | null;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Lightweight scaffold adapter used for platforms not yet implemented.
|
|
329
|
+
* It provides explicit, deterministic errors while preserving the shared
|
|
330
|
+
* adapter contract and command wiring across all platforms.
|
|
331
|
+
*/
|
|
332
|
+
declare class StubDeployAdapter implements ContextAwareDeployAdapter {
|
|
333
|
+
readonly name: DeployPlatform;
|
|
334
|
+
private readonly contextLabel;
|
|
335
|
+
constructor(platform: DeployPlatform);
|
|
336
|
+
setContext(_context: {
|
|
337
|
+
projectRoot: string;
|
|
338
|
+
appName: string;
|
|
339
|
+
region: string | null;
|
|
340
|
+
}): void;
|
|
341
|
+
detect(): Promise<boolean>;
|
|
342
|
+
install(): Promise<void>;
|
|
343
|
+
authenticate(): Promise<void>;
|
|
344
|
+
provision(_config: ProjectConfig): Promise<ProvisionResult>;
|
|
345
|
+
build(_config: ProjectConfig): Promise<BuildArtifacts>;
|
|
346
|
+
deploy(_artifacts: BuildArtifacts): Promise<DeployResult>;
|
|
347
|
+
rollback(_deploymentId: string): Promise<void>;
|
|
348
|
+
logs(_options: LogOptions): AsyncIterable<LogLine>;
|
|
349
|
+
status(): Promise<DeploymentStatus>;
|
|
350
|
+
private notImplementedError;
|
|
351
|
+
private notImplementedMessage;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Durable deployment settings stored for subsequent `kora deploy` runs.
|
|
356
|
+
*/
|
|
357
|
+
interface DeployState {
|
|
358
|
+
platform: DeployPlatform;
|
|
359
|
+
appName: string;
|
|
360
|
+
region: string | null;
|
|
361
|
+
projectRoot: string;
|
|
362
|
+
liveUrl: string | null;
|
|
363
|
+
syncUrl: string | null;
|
|
364
|
+
databaseId: string | null;
|
|
365
|
+
lastDeploymentId: string | null;
|
|
366
|
+
createdAt: string;
|
|
367
|
+
updatedAt: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Input required to create a new deployment state record.
|
|
371
|
+
*/
|
|
372
|
+
interface DeployStateCreateInput {
|
|
373
|
+
platform: DeployPlatform;
|
|
374
|
+
appName: string;
|
|
375
|
+
region: string | null;
|
|
376
|
+
projectRoot: string;
|
|
377
|
+
liveUrl?: string | null;
|
|
378
|
+
syncUrl?: string | null;
|
|
379
|
+
databaseId?: string | null;
|
|
380
|
+
lastDeploymentId?: string | null;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Partial update fields for an existing deployment state record.
|
|
384
|
+
*/
|
|
385
|
+
interface DeployStatePatch {
|
|
386
|
+
platform?: DeployPlatform;
|
|
387
|
+
appName?: string;
|
|
388
|
+
region?: string | null;
|
|
389
|
+
projectRoot?: string;
|
|
390
|
+
liveUrl?: string | null;
|
|
391
|
+
syncUrl?: string | null;
|
|
392
|
+
databaseId?: string | null;
|
|
393
|
+
lastDeploymentId?: string | null;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Returns the absolute path to `.kora/deploy`.
|
|
397
|
+
*/
|
|
398
|
+
declare function resolveDeployDirectory(projectRoot: string): string;
|
|
399
|
+
/**
|
|
400
|
+
* Returns the absolute path to `.kora/deploy/deploy.json`.
|
|
401
|
+
*/
|
|
402
|
+
declare function resolveDeployStatePath(projectRoot: string): string;
|
|
403
|
+
/**
|
|
404
|
+
* Loads deployment state from `.kora/deploy/deploy.json`.
|
|
405
|
+
* Returns null when the file does not exist.
|
|
406
|
+
*/
|
|
407
|
+
declare function readDeployState(projectRoot: string): Promise<DeployState | null>;
|
|
408
|
+
/**
|
|
409
|
+
* Writes a brand-new deployment state record, replacing any existing file.
|
|
410
|
+
*/
|
|
411
|
+
declare function writeDeployState(projectRoot: string, input: DeployStateCreateInput, now?: Date): Promise<DeployState>;
|
|
412
|
+
/**
|
|
413
|
+
* Applies a partial update to deployment state.
|
|
414
|
+
* Throws when state does not exist.
|
|
415
|
+
*/
|
|
416
|
+
declare function updateDeployState(projectRoot: string, patch: DeployStatePatch, now?: Date): Promise<DeployState>;
|
|
417
|
+
/**
|
|
418
|
+
* Removes the entire `.kora/deploy` directory tree.
|
|
419
|
+
*/
|
|
420
|
+
declare function resetDeployState(projectRoot: string): Promise<void>;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Configuration for generating a production Dockerfile.
|
|
424
|
+
*/
|
|
425
|
+
interface DockerfileOptions {
|
|
426
|
+
nodeVersion?: string;
|
|
427
|
+
port?: number;
|
|
428
|
+
clientDirectory?: string;
|
|
429
|
+
serverBundleFile?: string;
|
|
430
|
+
/** Native modules that must be installed at runtime (externalized from bundle). */
|
|
431
|
+
nativeDependencies?: Record<string, string>;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Generates a multi-stage Dockerfile for Kora deployments.
|
|
435
|
+
*
|
|
436
|
+
* The generated image expects artifacts produced under `.kora/deploy`:
|
|
437
|
+
* - `dist/` for client assets
|
|
438
|
+
* - `server-bundled.js` for server runtime entry
|
|
439
|
+
* - `package.json` (if native dependencies are needed)
|
|
440
|
+
*/
|
|
441
|
+
declare function generateDockerfile(options?: DockerfileOptions): string;
|
|
442
|
+
/**
|
|
443
|
+
* Generates a minimal package.json for native dependencies in the deploy container.
|
|
444
|
+
*/
|
|
445
|
+
declare function generateDeployPackageJson(nativeDependencies: Record<string, string>): string;
|
|
446
|
+
/**
|
|
447
|
+
* Generates a `.dockerignore` tuned for Kora deploy output.
|
|
448
|
+
*/
|
|
449
|
+
declare function generateDockerIgnore(): string;
|
|
450
|
+
/**
|
|
451
|
+
* Writes the generated Dockerfile (and package.json if needed) to `.kora/deploy/`.
|
|
452
|
+
*/
|
|
453
|
+
declare function writeDockerfileArtifact(deployDirectory: string, options?: DockerfileOptions): Promise<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Writes the generated `.dockerignore` to `.kora/deploy/.dockerignore`.
|
|
456
|
+
*/
|
|
457
|
+
declare function writeDockerIgnoreArtifact(deployDirectory: string): Promise<string>;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Configuration options used to render `fly.toml`.
|
|
461
|
+
*/
|
|
462
|
+
interface FlyTomlOptions {
|
|
463
|
+
appName: string;
|
|
464
|
+
region: string;
|
|
465
|
+
internalPort?: number;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Generates a minimal Fly.io configuration file for Kora sync apps.
|
|
469
|
+
*/
|
|
470
|
+
declare function generateFlyToml(options: FlyTomlOptions): string;
|
|
471
|
+
/**
|
|
472
|
+
* Writes `fly.toml` into `.kora/deploy`.
|
|
473
|
+
*/
|
|
474
|
+
declare function writeFlyTomlArtifact(deployDirectory: string, options: FlyTomlOptions): Promise<string>;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Configuration used to render `railway.json`.
|
|
478
|
+
*/
|
|
479
|
+
interface RailwayJsonOptions {
|
|
480
|
+
appName: string;
|
|
481
|
+
region?: string;
|
|
482
|
+
environment?: string;
|
|
483
|
+
startCommand?: string;
|
|
484
|
+
healthcheckPath?: string;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Generates Railway deployment configuration in JSON format.
|
|
488
|
+
*/
|
|
489
|
+
declare function generateRailwayJson(options: RailwayJsonOptions): string;
|
|
490
|
+
/**
|
|
491
|
+
* Writes `railway.json` into `.kora/deploy`.
|
|
492
|
+
*/
|
|
493
|
+
declare function writeRailwayJsonArtifact(deployDirectory: string, options: RailwayJsonOptions): Promise<string>;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Inputs used to execute a client build through Vite.
|
|
497
|
+
*/
|
|
498
|
+
interface ClientBuildOptions {
|
|
499
|
+
projectRoot: string;
|
|
500
|
+
outDir: string;
|
|
501
|
+
mode?: 'development' | 'production';
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Result returned after a successful Vite build.
|
|
505
|
+
*/
|
|
506
|
+
interface ClientBuildResult {
|
|
507
|
+
outDir: string;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Builds the client bundle with the project's local Vite installation.
|
|
511
|
+
*
|
|
512
|
+
* After Vite completes, patches the output to ensure SQLite WASM assets
|
|
513
|
+
* are present. The template's sqliteWasmHotfix Vite plugin writes to the
|
|
514
|
+
* default `dist/` directory, but `kora deploy` redirects output to
|
|
515
|
+
* `.kora/deploy/dist/`. This post-build step fills in any missing assets.
|
|
516
|
+
*/
|
|
517
|
+
declare function buildClient(options: ClientBuildOptions): Promise<ClientBuildResult>;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Options used to produce a deployable server bundle artifact.
|
|
521
|
+
*/
|
|
522
|
+
interface ServerBundleOptions {
|
|
523
|
+
projectRoot: string;
|
|
524
|
+
deployDirectory: string;
|
|
525
|
+
entryFileCandidates?: readonly string[];
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Result details for the generated server bundle artifact.
|
|
529
|
+
*/
|
|
530
|
+
interface ServerBundleResult {
|
|
531
|
+
entryFilePath: string;
|
|
532
|
+
outputFilePath: string;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Bundles the server entry into a single deployable JavaScript file.
|
|
536
|
+
*/
|
|
537
|
+
declare function bundleServer(options: ServerBundleOptions): Promise<ServerBundleResult>;
|
|
538
|
+
|
|
539
|
+
interface ProjectNameValidationResult {
|
|
540
|
+
valid: boolean;
|
|
541
|
+
issues: readonly string[];
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Validates a project name for scaffolded package creation.
|
|
545
|
+
*
|
|
546
|
+
* The create command uses this validation before writing files so users get a
|
|
547
|
+
* clear, early error if the name cannot be used as an npm package name.
|
|
548
|
+
*/
|
|
549
|
+
declare function validateProjectName(name: string): ProjectNameValidationResult;
|
|
550
|
+
|
|
551
|
+
type FrameworkOption = 'react' | 'vue' | 'svelte' | 'solid';
|
|
552
|
+
type AuthOption = 'none' | 'email-password' | 'oauth';
|
|
553
|
+
type DatabaseOption = 'none' | 'sqlite' | 'postgres';
|
|
554
|
+
type DatabaseProviderOption = 'none' | 'local' | 'supabase' | 'neon' | 'railway' | 'vercel-postgres' | 'custom';
|
|
555
|
+
interface TemplateSelectionInput {
|
|
556
|
+
tailwind: boolean;
|
|
557
|
+
sync: boolean;
|
|
558
|
+
db: DatabaseOption;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Converts high-level scaffold selections into the currently supported
|
|
562
|
+
* concrete template names.
|
|
563
|
+
*/
|
|
564
|
+
declare function determineTemplateFromSelections(input: TemplateSelectionInput): TemplateName;
|
|
565
|
+
declare function isFrameworkValue(value: string): value is FrameworkOption;
|
|
566
|
+
declare function isAuthValue(value: string): value is AuthOption;
|
|
567
|
+
declare function isDatabaseValue(value: string): value is DatabaseOption;
|
|
568
|
+
declare function isDatabaseProviderValue(value: string): value is DatabaseProviderOption;
|
|
569
|
+
|
|
570
|
+
interface SelectOption<T extends string> {
|
|
571
|
+
label: string;
|
|
572
|
+
value: T;
|
|
573
|
+
hint?: string;
|
|
574
|
+
disabled?: boolean;
|
|
575
|
+
}
|
|
576
|
+
interface PromptClient {
|
|
577
|
+
text(message: string, defaultValue?: string): Promise<string>;
|
|
578
|
+
select<T extends string>(message: string, options: readonly SelectOption<T>[]): Promise<T>;
|
|
579
|
+
confirm(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
580
|
+
intro(message: string): void;
|
|
581
|
+
outro(message: string): void;
|
|
582
|
+
}
|
|
583
|
+
declare class PromptCancelledError extends Error {
|
|
584
|
+
constructor(message?: string);
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Prompt client backed by the current readline helpers.
|
|
588
|
+
*
|
|
589
|
+
* Phase 12 will introduce a richer prompt backend. This adapter keeps command
|
|
590
|
+
* logic decoupled from the prompt implementation so we can migrate without
|
|
591
|
+
* reshaping command behavior.
|
|
592
|
+
*/
|
|
593
|
+
declare class ReadlinePromptClient implements PromptClient {
|
|
594
|
+
text(message: string, defaultValue?: string): Promise<string>;
|
|
595
|
+
select<T extends string>(message: string, options: readonly SelectOption<T>[]): Promise<T>;
|
|
596
|
+
confirm(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
597
|
+
intro(message: string): void;
|
|
598
|
+
outro(message: string): void;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Returns the default prompt client for interactive CLI flows.
|
|
602
|
+
*/
|
|
603
|
+
declare function createPromptClient(): PromptClient;
|
|
604
|
+
/**
|
|
605
|
+
* Prompt client backed by @clack/prompts for richer interactive UX.
|
|
606
|
+
* Falls back to readline in non-interactive contexts.
|
|
607
|
+
*/
|
|
608
|
+
declare class ClackPromptClient implements PromptClient {
|
|
609
|
+
text(message: string, defaultValue?: string): Promise<string>;
|
|
610
|
+
select<T extends string>(message: string, options: readonly SelectOption<T>[]): Promise<T>;
|
|
611
|
+
confirm(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
612
|
+
intro(message: string): void;
|
|
613
|
+
outro(message: string): void;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
interface CreatePreferences {
|
|
617
|
+
framework: FrameworkOption;
|
|
618
|
+
tailwind: boolean;
|
|
619
|
+
sync: boolean;
|
|
620
|
+
db: DatabaseOption;
|
|
621
|
+
dbProvider: DatabaseProviderOption;
|
|
622
|
+
auth: AuthOption;
|
|
623
|
+
packageManager: PackageManager;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Preference store for scaffold-time defaults in `create-kora-app`.
|
|
627
|
+
*/
|
|
628
|
+
declare class PreferenceStore {
|
|
629
|
+
private readonly store;
|
|
630
|
+
constructor();
|
|
631
|
+
getCreatePreferences(): CreatePreferences | null;
|
|
632
|
+
saveCreatePreferences(preferences: CreatePreferences): void;
|
|
633
|
+
clearCreatePreferences(): void;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Gets preferences from storage or returns defaults when not available.
|
|
637
|
+
*/
|
|
638
|
+
declare function getCreatePreferencesOrDefault(store: PreferenceStore): CreatePreferences;
|
|
639
|
+
declare function getDefaultCreatePreferences(): CreatePreferences;
|
|
640
|
+
|
|
641
|
+
interface CreateFlags {
|
|
642
|
+
framework?: string;
|
|
643
|
+
auth?: string;
|
|
644
|
+
db?: string;
|
|
645
|
+
dbProvider?: string;
|
|
646
|
+
tailwind?: boolean;
|
|
647
|
+
sync?: boolean;
|
|
648
|
+
useDefaults: boolean;
|
|
649
|
+
}
|
|
650
|
+
interface PreferenceResolutionResult {
|
|
651
|
+
framework: FrameworkOption;
|
|
652
|
+
auth: AuthOption;
|
|
653
|
+
db: DatabaseOption;
|
|
654
|
+
dbProvider: DatabaseProviderOption;
|
|
655
|
+
tailwind: boolean;
|
|
656
|
+
sync: boolean;
|
|
657
|
+
template: ReturnType<typeof determineTemplateFromSelections>;
|
|
658
|
+
usedStoredPreferences: boolean;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Resolves scaffold options with precedence:
|
|
662
|
+
* CLI flags > --yes defaults > stored preferences > interactive prompts.
|
|
663
|
+
*/
|
|
664
|
+
declare function resolveCreatePreferencesFlow(params: {
|
|
665
|
+
flags: CreateFlags;
|
|
666
|
+
prompts: PromptClient;
|
|
667
|
+
store: PreferenceStore;
|
|
668
|
+
}): Promise<PreferenceResolutionResult>;
|
|
669
|
+
declare function shouldSavePreferences(flags: CreateFlags): boolean;
|
|
670
|
+
declare function saveResolvedPreferences(store: PreferenceStore, resolution: Omit<PreferenceResolutionResult, 'template' | 'usedStoredPreferences'> & {
|
|
671
|
+
packageManager: CreatePreferences['packageManager'];
|
|
672
|
+
}): void;
|
|
673
|
+
|
|
674
|
+
interface SyncProviderPresetOptions {
|
|
675
|
+
targetDir: string;
|
|
676
|
+
template: TemplateName;
|
|
677
|
+
db: DatabaseOption;
|
|
678
|
+
dbProvider: DatabaseProviderOption;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Applies provider-specific sync scaffolding adjustments after template copy.
|
|
682
|
+
*
|
|
683
|
+
* This is a lightweight bridge until template-layer composition lands.
|
|
684
|
+
* Today we only specialize the sync server template when Postgres is selected.
|
|
685
|
+
*/
|
|
686
|
+
declare function applySyncProviderPreset(options: SyncProviderPresetOptions): Promise<void>;
|
|
687
|
+
|
|
688
|
+
export { type AuthOption, type BuildArtifacts, ClackPromptClient, CliError, type ClientBuildOptions, type ClientBuildResult, type ContextAwareDeployAdapter, type CreateFlags, type CreatePreferences, DEPLOY_PLATFORMS, type DatabaseOption, type DatabaseProviderOption, type DeployAdapter, type DeployPlatform, type DeployResult, type DeployState, type DeployStateCreateInput, type DeployStatePatch, type DeploymentStatus, DevServerError, type DockerfileOptions, FlyAdapter, type FlyAdapterContext, type FlyAdapterOptions, type FlyCommandResult, type FlyCommandRunner, type FlyTomlOptions, type FrameworkOption, InvalidProjectError, type LogLine, type LogOptions, NodeFlyCommandRunner, NodeRailwayCommandRunner, PACKAGE_MANAGERS, type PackageManager, type PreferenceResolutionResult, PreferenceStore, type ProjectConfig, ProjectExistsError, type ProjectNameValidationResult, PromptCancelledError, type PromptClient, type ProvisionResult, RailwayAdapter, type RailwayAdapterContext, type RailwayAdapterOptions, type RailwayCommandResult, type RailwayCommandRunner, type RailwayJsonOptions, ReadlinePromptClient, SchemaNotFoundError, type SelectOption, type ServerBundleOptions, type ServerBundleResult, StubDeployAdapter, TEMPLATES, TEMPLATE_INFO, type TemplateContext, type TemplateInfo, type TemplateName, type TemplateSelectionInput, applySyncProviderPreset, buildClient, bundleServer, createDeployAdapter, createPromptClient, deployCommand, determineTemplateFromSelections, generateDeployPackageJson, generateDockerIgnore, generateDockerfile, generateFlyToml, generateRailwayJson, generateTypes, getCreatePreferencesOrDefault, getDefaultCreatePreferences, isAuthValue, isDatabaseProviderValue, isDatabaseValue, isDeployPlatform, isFrameworkValue, readDeployState, resetDeployState, resolveCreatePreferencesFlow, resolveDeployDirectory, resolveDeployStatePath, saveResolvedPreferences, shouldSavePreferences, updateDeployState, validateProjectName, writeDeployState, writeDockerIgnoreArtifact, writeDockerfileArtifact, writeFlyTomlArtifact, writeRailwayJsonArtifact };
|