@geekmidas/cli 10.0.0-alpha.61 → 10.0.0-alpha.62

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 (135) hide show
  1. package/dist/{HostingerProvider-DI_Pr2VE.mjs → HostingerProvider-B92qH4dC.mjs} +2 -2
  2. package/dist/{HostingerProvider-DI_Pr2VE.mjs.map → HostingerProvider-B92qH4dC.mjs.map} +1 -1
  3. package/dist/{HostingerProvider-CgDaD8VR.cjs → HostingerProvider-DyD1Hin8.cjs} +2 -2
  4. package/dist/{HostingerProvider-CgDaD8VR.cjs.map → HostingerProvider-DyD1Hin8.cjs.map} +1 -1
  5. package/dist/{LegacyStateStore-C7vFAxbu.mjs → LegacyStateStore-A8d2GdT7.mjs} +2 -2
  6. package/dist/{LegacyStateStore-C7vFAxbu.mjs.map → LegacyStateStore-A8d2GdT7.mjs.map} +1 -1
  7. package/dist/{LegacyStateStore-JbBVFp_2.cjs → LegacyStateStore-UHJEBLdn.cjs} +2 -2
  8. package/dist/{LegacyStateStore-JbBVFp_2.cjs.map → LegacyStateStore-UHJEBLdn.cjs.map} +1 -1
  9. package/dist/{LocalStateStore-DfUwQsL8.mjs → LocalStateStore-B51rnfgn.mjs} +2 -2
  10. package/dist/{LocalStateStore-DfUwQsL8.mjs.map → LocalStateStore-B51rnfgn.mjs.map} +1 -1
  11. package/dist/{LocalStateStore-DHj_-CQB.cjs → LocalStateStore-COW3Ldwa.cjs} +2 -2
  12. package/dist/{LocalStateStore-DHj_-CQB.cjs.map → LocalStateStore-COW3Ldwa.cjs.map} +1 -1
  13. package/dist/{S3StateStore-Dq6hHtzY.mjs → S3StateStore-CJewPhgz.mjs} +2 -2
  14. package/dist/{S3StateStore-Dq6hHtzY.mjs.map → S3StateStore-CJewPhgz.mjs.map} +1 -1
  15. package/dist/{S3StateStore-xqnpUrzy.cjs → S3StateStore-WUJGdRNL.cjs} +2 -2
  16. package/dist/{S3StateStore-xqnpUrzy.cjs.map → S3StateStore-WUJGdRNL.cjs.map} +1 -1
  17. package/dist/{SSMStateStore-5dBRwVlJ.cjs → SSMStateStore-Zejt42V8.cjs} +2 -2
  18. package/dist/{SSMStateStore-5dBRwVlJ.cjs.map → SSMStateStore-Zejt42V8.cjs.map} +1 -1
  19. package/dist/{SSMStateStore-SUmvAbLi.mjs → SSMStateStore-iK5UKp9d.mjs} +2 -2
  20. package/dist/{SSMStateStore-SUmvAbLi.mjs.map → SSMStateStore-iK5UKp9d.mjs.map} +1 -1
  21. package/dist/{bundler-DXATpO1T.cjs → bundler-CfH9frOS.cjs} +2 -2
  22. package/dist/{bundler-DXATpO1T.cjs.map → bundler-CfH9frOS.cjs.map} +1 -1
  23. package/dist/{bundler-B5VsKW-_.mjs → bundler-DN5r4x5b.mjs} +2 -2
  24. package/dist/{bundler-B5VsKW-_.mjs.map → bundler-DN5r4x5b.mjs.map} +1 -1
  25. package/dist/{cli-DQdrVkj2.cjs → cli-DOAUp80L.cjs} +12 -16
  26. package/dist/cli-DOAUp80L.cjs.map +1 -0
  27. package/dist/{cli-DEA_J3Sa.mjs → cli-DYwxmfsW.mjs} +10 -14
  28. package/dist/cli-DYwxmfsW.mjs.map +1 -0
  29. package/dist/{config-DXnkCEq0.cjs → config-BYh9S0cZ.cjs} +2 -2
  30. package/dist/config-BYh9S0cZ.cjs.map +1 -0
  31. package/dist/{config-C5-EEdmr.mjs → config-Bf4-bROQ.mjs} +2 -2
  32. package/dist/config-Bf4-bROQ.mjs.map +1 -0
  33. package/dist/config.cjs +2 -2
  34. package/dist/config.d.cts +2 -2
  35. package/dist/config.d.mts +2 -2
  36. package/dist/config.mjs +2 -2
  37. package/dist/define-CHBIEc5j.mjs +94 -0
  38. package/dist/define-CHBIEc5j.mjs.map +1 -0
  39. package/dist/define-Cv_QvDrg.cjs +141 -0
  40. package/dist/define-Cv_QvDrg.cjs.map +1 -0
  41. package/dist/deploy/public.cjs +28 -13
  42. package/dist/deploy/public.d.cts +38 -315
  43. package/dist/deploy/public.d.cts.map +1 -1
  44. package/dist/deploy/public.d.mts +38 -315
  45. package/dist/deploy/public.d.mts.map +1 -1
  46. package/dist/deploy/public.mjs +8 -3
  47. package/dist/{deploy-BJcLmVTc.mjs → deploy-B7jvUORo.mjs} +152 -532
  48. package/dist/deploy-B7jvUORo.mjs.map +1 -0
  49. package/dist/deploy-Cg9fae7a.mjs +133 -0
  50. package/dist/deploy-Cg9fae7a.mjs.map +1 -0
  51. package/dist/deploy-D8Qr-Xto.cjs +138 -0
  52. package/dist/deploy-D8Qr-Xto.cjs.map +1 -0
  53. package/dist/{deploy-BbJdgQ2b.cjs → deploy-DSaCYvcO.cjs} +168 -560
  54. package/dist/deploy-DSaCYvcO.cjs.map +1 -0
  55. package/dist/dokploy-CD9PY-3D.mjs +32 -0
  56. package/dist/dokploy-CD9PY-3D.mjs.map +1 -0
  57. package/dist/dokploy-Ey2foJLv.cjs +32 -0
  58. package/dist/dokploy-Ey2foJLv.cjs.map +1 -0
  59. package/dist/{encryption-DaA9gRXr.mjs → encryption-CVwvGbsL.mjs} +4 -4
  60. package/dist/{encryption-DaA9gRXr.mjs.map → encryption-CVwvGbsL.mjs.map} +1 -1
  61. package/dist/{encryption-ojzUo7-z.cjs → encryption-ChBk3hTj.cjs} +4 -4
  62. package/dist/{encryption-ojzUo7-z.cjs.map → encryption-ChBk3hTj.cjs.map} +1 -1
  63. package/dist/{github-DmCj2u95.mjs → github-BCB3_LBX.mjs} +3 -3
  64. package/dist/{github-DmCj2u95.mjs.map → github-BCB3_LBX.mjs.map} +1 -1
  65. package/dist/{github-Cq57poPj.cjs → github-OUgPDlqg.cjs} +3 -3
  66. package/dist/{github-Cq57poPj.cjs.map → github-OUgPDlqg.cjs.map} +1 -1
  67. package/dist/{index-UiWCaGzU.d.cts → index-BtXDZQuF.d.cts} +2 -2
  68. package/dist/{index-Da1-oa9W.d.mts.map → index-BtXDZQuF.d.cts.map} +1 -1
  69. package/dist/{index-Da1-oa9W.d.mts → index-DrKzpHl-.d.mts} +2 -2
  70. package/dist/{index-UiWCaGzU.d.cts.map → index-DrKzpHl-.d.mts.map} +1 -1
  71. package/dist/index.cjs +42 -41
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.mjs +42 -41
  74. package/dist/index.mjs.map +1 -1
  75. package/dist/{migrate-5_J5JySj.mjs → migrate-BoHMqdCu.mjs} +4 -4
  76. package/dist/{migrate-5_J5JySj.mjs.map → migrate-BoHMqdCu.mjs.map} +1 -1
  77. package/dist/{migrate-BScRpCEx.cjs → migrate-dnaFMvOm.cjs} +4 -4
  78. package/dist/{migrate-BScRpCEx.cjs.map → migrate-dnaFMvOm.cjs.map} +1 -1
  79. package/dist/openapi.cjs +1 -1
  80. package/dist/openapi.d.cts +1 -1
  81. package/dist/openapi.d.mts +1 -1
  82. package/dist/openapi.mjs +1 -1
  83. package/dist/reconcile/public.d.cts +1 -1
  84. package/dist/reconcile/public.d.mts +1 -1
  85. package/dist/resolve-CFCIkm7m.mjs +170 -0
  86. package/dist/resolve-CFCIkm7m.mjs.map +1 -0
  87. package/dist/resolve-wbv66HjD.cjs +217 -0
  88. package/dist/resolve-wbv66HjD.cjs.map +1 -0
  89. package/dist/runtime-CMwtq0AL.cjs +163 -0
  90. package/dist/runtime-CMwtq0AL.cjs.map +1 -0
  91. package/dist/runtime-CXPlkZzs.d.mts +90 -0
  92. package/dist/runtime-CXPlkZzs.d.mts.map +1 -0
  93. package/dist/runtime-DbakJS8u.mjs +134 -0
  94. package/dist/runtime-DbakJS8u.mjs.map +1 -0
  95. package/dist/runtime-Dn_n-29S.d.cts +90 -0
  96. package/dist/runtime-Dn_n-29S.d.cts.map +1 -0
  97. package/dist/{sniffer-CQmJnNJM.cjs → sniffer-BsfPa-GA.cjs} +17 -14
  98. package/dist/sniffer-BsfPa-GA.cjs.map +1 -0
  99. package/dist/{sniffer-bdleks5l.mjs → sniffer-DHE2Nafd.mjs} +17 -14
  100. package/dist/sniffer-DHE2Nafd.mjs.map +1 -0
  101. package/dist/target/public.cjs +15 -0
  102. package/dist/target/public.d.cts +28 -0
  103. package/dist/target/public.d.cts.map +1 -0
  104. package/dist/target/public.d.mts +28 -0
  105. package/dist/target/public.d.mts.map +1 -0
  106. package/dist/target/public.mjs +4 -0
  107. package/dist/terminal-6oL0vANs.cjs +576 -0
  108. package/dist/terminal-6oL0vANs.cjs.map +1 -0
  109. package/dist/terminal-ByZNjuig.mjs +517 -0
  110. package/dist/terminal-ByZNjuig.mjs.map +1 -0
  111. package/dist/{types-efNLu9xu.d.cts → types-CfLKGfC_.d.mts} +624 -34
  112. package/dist/types-CfLKGfC_.d.mts.map +1 -0
  113. package/dist/{types-Bp1mVxG0.d.mts → types-DIA7Li-J.d.cts} +626 -34
  114. package/dist/types-DIA7Li-J.d.cts.map +1 -0
  115. package/dist/workspace/index.cjs +1 -1
  116. package/dist/workspace/index.d.cts +3 -3
  117. package/dist/workspace/index.d.mts +3 -3
  118. package/dist/workspace/index.mjs +1 -1
  119. package/dist/{workspace-B64Xk1Mb.cjs → workspace-B6zQO6RY.cjs} +229 -23
  120. package/dist/workspace-B6zQO6RY.cjs.map +1 -0
  121. package/dist/{workspace-Bp1xVaOz.mjs → workspace-BFe57es7.mjs} +229 -23
  122. package/dist/workspace-BFe57es7.mjs.map +1 -0
  123. package/package.json +23 -13
  124. package/dist/cli-DEA_J3Sa.mjs.map +0 -1
  125. package/dist/cli-DQdrVkj2.cjs.map +0 -1
  126. package/dist/config-C5-EEdmr.mjs.map +0 -1
  127. package/dist/config-DXnkCEq0.cjs.map +0 -1
  128. package/dist/deploy-BJcLmVTc.mjs.map +0 -1
  129. package/dist/deploy-BbJdgQ2b.cjs.map +0 -1
  130. package/dist/sniffer-CQmJnNJM.cjs.map +0 -1
  131. package/dist/sniffer-bdleks5l.mjs.map +0 -1
  132. package/dist/types-Bp1mVxG0.d.mts.map +0 -1
  133. package/dist/types-efNLu9xu.d.cts.map +0 -1
  134. package/dist/workspace-B64Xk1Mb.cjs.map +0 -1
  135. package/dist/workspace-Bp1xVaOz.mjs.map +0 -1
@@ -1,4 +1,53 @@
1
1
  import { ConstructManifest } from "@geekmidas/manifest";
2
+ //#endregion
3
+ //#region src/deploy/identity.d.ts
4
+ /**
5
+ * Who a deploy is, on a target it shares with other workspaces.
6
+ *
7
+ * A Dokploy server is one flat namespace of projects, images and Docker
8
+ * service names. Deploys used to identify everything they made by the
9
+ * workspace name alone, so two workspaces called `shop` — or `Shop` and
10
+ * `shop` — deploying to one server landed in the same project, pushed over
11
+ * each other's images and redeployed each other's applications. A
12
+ * `DeployIdentity` is what a deploy names and claims its resources by instead.
13
+ */
14
+ interface DeployIdentity {
15
+ /**
16
+ * Whose deploy this is — an organisation, a team, a repository. Two
17
+ * workspaces with the same name are told apart by it. Defaults to the
18
+ * kebab-cased workspace name; set `deploy.namespace` to choose one.
19
+ */
20
+ readonly namespace: string;
21
+ /** The workspace name as the target spells it: lowercase, `[a-z0-9-]`. */
22
+ readonly project: string;
23
+ readonly stage: string;
24
+ /**
25
+ * `<namespace>/<project>`: what a Dokploy project is claimed by.
26
+ *
27
+ * The stage is not part of it because one Dokploy project holds every stage
28
+ * of a workspace, each as an environment — the key has to be the same from
29
+ * every stage that deploys into it.
30
+ */
31
+ readonly key: string;
32
+ /**
33
+ * The prefix every name on the target carries: the project alone in the
34
+ * default namespace, `<namespace>-<project>` in any other.
35
+ *
36
+ * The default adds nothing so that a workspace that never set a namespace
37
+ * keeps the names it was already deployed under — a Postgres is found by
38
+ * its name, and a new name would be a new, empty database.
39
+ */
40
+ readonly scope: string;
41
+ }
42
+ /** What an identity is derived from: a workspace's name and namespace. */
43
+ interface IdentitySource {
44
+ name: string;
45
+ deploy?: {
46
+ namespace?: string;
47
+ };
48
+ }
49
+ declare function deployIdentity(workspace: IdentitySource, stage: string): DeployIdentity;
50
+ //#endregion
2
51
  //#region src/secrets/types.d.ts
3
52
  /** Credentials for a specific service */
4
53
  interface ServiceCredentials {
@@ -355,6 +404,545 @@ interface CustomStateConfig {
355
404
  * State configuration types.
356
405
  */
357
406
  type StateConfig = LocalStateConfig | SSMStateConfig | S3StateConfig | CustomStateConfig;
407
+ //#endregion
408
+ //#region src/deploy/credentials.d.ts
409
+ /**
410
+ * How a deploy gets the credentials it acts with.
411
+ *
412
+ * `deploy()` never prompts and never reads a terminal: it asks a
413
+ * `CredentialProvider` and, when the provider has nothing, stops with
414
+ * `MissingCredential` naming what it needed and how to supply it. Whether to
415
+ * ask a person, read a vault or fail is the caller's decision — `gkm deploy`
416
+ * prompts at a terminal and stores what was typed; a CI job sets the
417
+ * environment; a host passes its own provider.
418
+ */
419
+ /**
420
+ * What each kind of credential is asked for with, and what it is.
421
+ *
422
+ * A target that needs a kind the CLI does not know declares it by augmenting
423
+ * this interface, and lists it in its `credentials`:
424
+ *
425
+ * ```ts
426
+ * declare module '@geekmidas/cli/target' {
427
+ * interface CredentialKinds {
428
+ * fly: { request: { org: string }; value: { token: string } };
429
+ * }
430
+ * }
431
+ * ```
432
+ */
433
+ interface CredentialKinds {
434
+ /** The Dokploy API a stage deploys through. */
435
+ dokploy: {
436
+ /** `deploy.dokploy.endpoint`, when the config names one. */
437
+ request: {
438
+ endpoint?: string;
439
+ };
440
+ value: {
441
+ endpoint: string;
442
+ token: string;
443
+ };
444
+ };
445
+ /**
446
+ * A container registry login, for Dokploy to pull with. Asked for only when
447
+ * Dokploy has no registry for `deploy.dokploy.registry` and one has to be
448
+ * created.
449
+ */
450
+ registry: {
451
+ /** `deploy.dokploy.registry`. */
452
+ request: {
453
+ url: string;
454
+ };
455
+ value: {
456
+ username: string;
457
+ password: string;
458
+ };
459
+ };
460
+ }
461
+ type CredentialKind = keyof CredentialKinds;
462
+ /** What a deploy asks a provider for. */
463
+ type CredentialRequest<K extends CredentialKind = CredentialKind> = { [P in K]: {
464
+ kind: P;
465
+ } & CredentialKinds[P]['request']; }[K];
466
+ /** What a provider answers with. */
467
+ type Credential<K extends CredentialKind> = CredentialKinds[K]['value'];
468
+ interface CredentialProvider {
469
+ /**
470
+ * The credential `request` asks for, or `undefined` when this provider has
471
+ * none — the deploy then raises {@link MissingCredential}.
472
+ */
473
+ get<K extends CredentialKind>(request: CredentialRequest<K>, options?: {
474
+ signal?: AbortSignal;
475
+ }): Promise<Credential<K> | undefined>;
476
+ }
477
+ /** A deploy needed a credential, and its provider had none. */
478
+ declare class MissingCredential extends Error {
479
+ readonly kind: CredentialKind;
480
+ /** What it was for: the Dokploy endpoint or the registry URL. */
481
+ readonly target: string | undefined;
482
+ /** How to supply it. */
483
+ readonly howToProvide: string;
484
+ constructor(kind: CredentialKind,
485
+ /** What it was for: the Dokploy endpoint or the registry URL. */
486
+ target: string | undefined,
487
+ /** How to supply it. */
488
+ howToProvide?: string);
489
+ }
490
+ /** Whatever was asked for, from the first provider that has it. */
491
+ declare function chainCredentials(...providers: CredentialProvider[]): CredentialProvider;
492
+ interface StoredCredentialsOptions {
493
+ /** Where to read the variables from. Defaults to `process.env`. */
494
+ env?: NodeJS.ProcessEnv;
495
+ /**
496
+ * The CLI's home, whose `credentials.json` holds stored logins. Defaults
497
+ * to `GKM_HOME`, else `~/.gkm`.
498
+ */
499
+ home?: string;
500
+ }
501
+ /**
502
+ * Credentials from the environment, then from what `gkm login` stored. What
503
+ * `deploy()` uses when it is handed no provider.
504
+ *
505
+ * - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
506
+ * the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
507
+ * Each half is read on its own: a token is a secret and belongs in the
508
+ * environment, an endpoint is configuration and belongs in the config.
509
+ * - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
510
+ */
511
+ declare function storedCredentials(options?: StoredCredentialsOptions): CredentialProvider;
512
+ //#endregion
513
+ //#region src/deploy/types.d.ts
514
+ /** Result for a single app deployment in workspace mode */
515
+ interface AppDeployResult {
516
+ /** App name */
517
+ appName: string;
518
+ /** App type */
519
+ type: 'backend' | 'web' | 'mobile';
520
+ /** Whether deployment succeeded */
521
+ success: boolean;
522
+ /** Dokploy application ID */
523
+ applicationId?: string;
524
+ /** Docker image reference */
525
+ imageRef?: string;
526
+ /** The registry's digest for the image, `sha256:…`, once pushed */
527
+ digest?: string;
528
+ /** Deployment URL */
529
+ url?: string;
530
+ /** Error message if failed */
531
+ error?: string;
532
+ }
533
+ /** Result from workspace deployment */
534
+ interface WorkspaceDeployResult {
535
+ /** Results for each app */
536
+ apps: AppDeployResult[];
537
+ /** Dokploy project ID */
538
+ projectId: string;
539
+ /** Total number of successful deployments */
540
+ successCount: number;
541
+ /** Total number of failed deployments */
542
+ failedCount: number;
543
+ }
544
+ /**
545
+ * What a deploy did — or, for a dry run, would do. Plain JSON, so it can be
546
+ * written out as is (`gkm deploy --json` ends with it).
547
+ */
548
+ interface DeployResult extends WorkspaceDeployResult {
549
+ stage: string;
550
+ /** `<namespace>/<project>`. */
551
+ identity: string;
552
+ /** The image tag every app was built with. */
553
+ tag: string;
554
+ /** Whether this was a dry run: nothing was created, built or pushed. */
555
+ dryRun: boolean;
556
+ /** Dokploy's environment for the stage; empty when a dry run would create it. */
557
+ environmentId: string;
558
+ /** Apps left out, and why — a mobile app, another deploy target. */
559
+ skipped: {
560
+ app: string;
561
+ reason: string;
562
+ }[];
563
+ /** Each deployed app's public URL. */
564
+ urls: Record<string, string>;
565
+ /**
566
+ * Every resource the run touched, in order: what it applied, or for a dry
567
+ * run, what it would.
568
+ */
569
+ changes: ResourceChange[];
570
+ }
571
+ //#endregion
572
+ //#region src/deploy/events.d.ts
573
+ /**
574
+ * The stretch of a deploy an event belongs to.
575
+ *
576
+ * - `validate`: the config, the target, the stage, the apps, the lock, the
577
+ * stage's secrets and what each app reads from its environment
578
+ * - `plan`: a dry run's lookups — what would be created and what reused
579
+ * - `provision`: what the apps run on — for Dokploy the project, environment
580
+ * and registry — and the declared constructs
581
+ * - `build`: each app's artifact, built without changing anything live
582
+ * - `release`: the artifacts put live. Dokploy builds and pushes each image
583
+ * here, beside its application, because a site's build args are resolved
584
+ * per app
585
+ * - `verify`: what was released answers — for Dokploy, DNS records and its
586
+ * domain validation
587
+ * - `rollback`: the previous release restored, after `release` or `verify`
588
+ * failed, on a target that can
589
+ */
590
+ type DeployPhase = 'validate' | 'plan' | 'provision' | 'build' | 'release' | 'verify' | 'rollback';
591
+ /** An error, as an event carries it. */
592
+ interface DeployEventError {
593
+ /** The error's class name — `MissingCredential`, `StateLocked`. */
594
+ name: string;
595
+ message: string;
596
+ }
597
+ /**
598
+ * How a resource came to be used:
599
+ * - `recorded`: the id the stage's state holds still resolves
600
+ * - `resumed`: a run that died after creating it is picked up
601
+ * - `found`: it existed and was looked up
602
+ * - `created`: this run created it
603
+ */
604
+ type ResourceVia = 'recorded' | 'resumed' | 'found' | 'created';
605
+ /** One resource a deploy touches, planned or applied. */
606
+ interface ResourceChange {
607
+ /** `<type>:<name>`, unique within the stage — `application:api`. */
608
+ key: string;
609
+ /** `project`, `environment`, `registry`, `application`, `domain`, `image`, or a construct's kind. */
610
+ resourceType: string;
611
+ /**
612
+ * For a plan: whether the run would create it, reuse what exists, or
613
+ * ensure it (look it up, and create it if missing). For an applied change:
614
+ * what was done.
615
+ */
616
+ action: 'create' | 'reuse' | 'ensure' | 'build';
617
+ /** The target's id, once there is one. */
618
+ id?: string;
619
+ }
620
+ type DeployEvent = {
621
+ type: 'deploy.started';
622
+ stage: string;
623
+ /** The target the run deploys through, by the name it was given. */
624
+ target: string;
625
+ /** `<namespace>/<project>`. */
626
+ identity: string;
627
+ tag: string;
628
+ /** The apps this run deploys, in order. */
629
+ apps: string[];
630
+ dryRun: boolean;
631
+ } | {
632
+ type: 'phase.started';
633
+ phase: DeployPhase;
634
+ } | {
635
+ type: 'phase.finished';
636
+ phase: DeployPhase;
637
+ } |
638
+ /** A phase threw; `deploy.failed` follows (after a rollback, if any). */
639
+ {
640
+ type: 'phase.failed';
641
+ phase: DeployPhase;
642
+ error: DeployEventError;
643
+ } |
644
+ /**
645
+ * A progress line, exactly as `gkm deploy` prints it — leading newline and
646
+ * indentation included, so a terminal renderer prints `message` as is.
647
+ */
648
+ {
649
+ type: 'log';
650
+ level: 'info' | 'warn' | 'error';
651
+ message: string;
652
+ } | {
653
+ type: 'app.skipped';
654
+ app: string;
655
+ reason: string;
656
+ } | ({
657
+ type: 'resource.planned';
658
+ } & ResourceChange) | ({
659
+ type: 'resource.applied';
660
+ via: ResourceVia;
661
+ } & ResourceChange & {
662
+ id: string;
663
+ }) | {
664
+ type: 'artifact.built';
665
+ app: string;
666
+ imageRef: string;
667
+ /** The registry's digest, `sha256:…`, once pushed. */
668
+ digest?: string;
669
+ } | {
670
+ type: 'app.deployed';
671
+ app: string;
672
+ applicationId: string;
673
+ imageRef: string;
674
+ url: string;
675
+ } | {
676
+ type: 'app.failed';
677
+ app: string;
678
+ error: DeployEventError;
679
+ } |
680
+ /** One check of whether a released app answers. */
681
+ {
682
+ type: 'health.checked';
683
+ app: string;
684
+ /** What was asked: a URL, or the target's own status check. */
685
+ url: string;
686
+ healthy: boolean;
687
+ /** The HTTP status, when the check was a request. */
688
+ status?: number;
689
+ /** 1 for the first check of the app in this run. */
690
+ attempt: number;
691
+ } | {
692
+ type: 'deploy.finished';
693
+ result: DeployResult;
694
+ } | {
695
+ type: 'deploy.failed';
696
+ error: DeployEventError;
697
+ };
698
+ /** Every `type` a deploy event can have. */
699
+ type DeployEventType = DeployEvent['type'];
700
+ //#endregion
701
+ //#region src/target/types.d.ts
702
+ /**
703
+ * Which family of defaults a target's deploys belong to.
704
+ *
705
+ * - `server`: the target runs containers the project controls, so a cache can
706
+ * live in the database and events go through pg-boss.
707
+ * - `aws`: the target runs on managed AWS services, so the defaults are
708
+ * Upstash, S3 and SNS/SQS.
709
+ *
710
+ * `gkm dev` and `gkm build` choose backends by it, which is why a target from
711
+ * a package declares it in its `package.json` too: they read it without
712
+ * importing the target.
713
+ */
714
+ type DeployRuntime = 'server' | 'aws';
715
+ /** What a target can do, beyond the phases every target has. */
716
+ interface DeployTargetCapabilities {
717
+ /**
718
+ * Whether `rollback` restores the previous release. When it does, a failed
719
+ * `release` or `verify` is rolled back before the deploy reports failure.
720
+ */
721
+ rollback: boolean;
722
+ /**
723
+ * Who applies database migrations: the target, as part of `release`, or
724
+ * the app itself when it starts.
725
+ */
726
+ migrations: 'target' | 'app';
727
+ /**
728
+ * Whether the target builds container images — and so needs Docker where
729
+ * the deploy runs, and a registry to push to.
730
+ */
731
+ images: boolean;
732
+ }
733
+ /** A failed validation of a target's options, issue by issue. */
734
+ interface TargetOptionsIssue {
735
+ readonly message: string;
736
+ readonly path?: ReadonlyArray<PropertyKey | {
737
+ readonly key: PropertyKey;
738
+ }>;
739
+ }
740
+ type TargetOptionsResult<Output> = {
741
+ readonly value: Output;
742
+ readonly issues?: undefined;
743
+ } | {
744
+ readonly issues: ReadonlyArray<TargetOptionsIssue>;
745
+ };
746
+ /**
747
+ * The schema a target's options are validated with: any Standard Schema —
748
+ * a Zod, Valibot or ArkType schema is one.
749
+ *
750
+ * The interface is the Standard Schema spec's own, copied as the spec asks,
751
+ * so a target's types do not depend on a package the CLI does not ship.
752
+ */
753
+ interface TargetOptionsSchema<Output = unknown> {
754
+ readonly '~standard': {
755
+ readonly version: 1;
756
+ readonly vendor: string;
757
+ readonly validate: (value: unknown) => TargetOptionsResult<Output> | Promise<TargetOptionsResult<Output>>;
758
+ readonly types?: {
759
+ readonly input: unknown;
760
+ readonly output: Output;
761
+ } | undefined;
762
+ };
763
+ }
764
+ /**
765
+ * The stage's secrets, as a target reads and writes them.
766
+ *
767
+ * Every secret value read through here is masked: a progress line that
768
+ * would print one prints `***` instead, in the terminal and in the events.
769
+ */
770
+ interface DeploySecrets {
771
+ /** Which kind of store holds them — `'file'`, `'ssm'`, or a custom one's. */
772
+ readonly store: string;
773
+ /** The stage's secrets, or null when it has none yet. */
774
+ read(): Promise<StageSecrets | null>;
775
+ /** Replace the stage's secrets. */
776
+ write(secrets: StageSecrets): Promise<void>;
777
+ /** Mask `value` in everything this run prints or emits from now on. */
778
+ mask(value: string): void;
779
+ }
780
+ /** Where a target's progress lines go: `log` events of the run. */
781
+ interface DeployTargetLogger {
782
+ info(message: string): void;
783
+ warn(message: string): void;
784
+ error(message: string): void;
785
+ }
786
+ /**
787
+ * The events a target reports. The run's own — `deploy.*` and `phase.*` —
788
+ * are the CLI's, which emits them around each phase it calls.
789
+ */
790
+ type TargetEvent = Exclude<DeployEvent, {
791
+ type: 'deploy.started' | 'deploy.finished' | 'deploy.failed' | 'phase.started' | 'phase.finished' | 'phase.failed';
792
+ }>;
793
+ /** Everything a phase is handed. The same object for every phase of a run. */
794
+ interface DeployPhaseContext<Options = undefined> {
795
+ /** The name the target was resolved by — `deploy.default`, `--target`. */
796
+ readonly target: string;
797
+ /**
798
+ * The workspace root. Never `process.cwd()`: a host deploys projects
799
+ * that are not where it runs.
800
+ */
801
+ readonly cwd: string;
802
+ readonly stage: string;
803
+ /** The image tag, or whatever version label the target releases under. */
804
+ readonly tag: string;
805
+ /**
806
+ * The apps this target deploys, in dependency order: those asked for that
807
+ * deploy here. Apps that deploy elsewhere are already in `skipped`.
808
+ */
809
+ readonly apps: readonly string[];
810
+ /** The apps the run leaves out, and why. */
811
+ readonly skipped: readonly {
812
+ app: string;
813
+ reason: string;
814
+ }[];
815
+ /** Who the deploy is, for naming and claiming what it creates. */
816
+ readonly identity: DeployIdentity;
817
+ /** The workspace, with its apps derived from the manifest. */
818
+ readonly workspace: NormalizedWorkspace;
819
+ /** What the workspace declares. */
820
+ readonly manifest: ConstructManifest;
821
+ /** The target's options, as its `options` schema parsed them. */
822
+ readonly options: Options;
823
+ /**
824
+ * Look everything up and report what would happen — as `resource.planned`
825
+ * events — without changing anything. Only `validate` and `plan` run.
826
+ */
827
+ readonly dryRun: boolean;
828
+ /** Where every credential comes from. Nothing prompts. */
829
+ readonly credentials: CredentialProvider;
830
+ /**
831
+ * The stage's deploy state. A real run holds the stage's lock for every
832
+ * phase; a dry run holds none and must write nothing.
833
+ */
834
+ readonly state: StateStore;
835
+ readonly secrets: DeploySecrets;
836
+ readonly logger: DeployTargetLogger;
837
+ /** Fires when the run is stopped; every phase stops what it is doing. */
838
+ readonly signal: AbortSignal;
839
+ /**
840
+ * Where the output of what a phase spawns goes: the host's terminal, its
841
+ * stderr (so stdout carries only events), or nowhere.
842
+ */
843
+ readonly childOutput: 'inherit' | 'stderr' | 'ignore';
844
+ /** Report progress. */
845
+ emit(event: TargetEvent): void;
846
+ /** Leave an app out of this run, with the reason a person will read. */
847
+ skip(app: string, reason: string): void;
848
+ /**
849
+ * What a resource is called on the target: scoped by the stage and the
850
+ * identity exactly as the constructs are — `name('api')` is
851
+ * `production-shop-api`. Two workspaces, or two stages, never share one.
852
+ */
853
+ name(resource: string): string;
854
+ }
855
+ /** Why `rollback` was called: the phase that failed, and its error. */
856
+ interface DeployFailure {
857
+ readonly phase: 'release' | 'verify';
858
+ readonly error: unknown;
859
+ }
860
+ /**
861
+ * A deploy target.
862
+ *
863
+ * The CLI calls the phases in order — `validate`, then `plan` for a dry run,
864
+ * or `provision → build → release → verify` for a real one — emitting
865
+ * `phase.started`/`phase.finished` around each. Every phase must be safe to
866
+ * run again: a deploy stopped part way is finished by deploying again, so a
867
+ * phase finds what an earlier run made (through `state`) before making it.
868
+ *
869
+ * `Run` is whatever the target carries from one phase to the next within a
870
+ * run — `validate` makes it, every later phase is handed it.
871
+ *
872
+ * ```ts
873
+ * import { defineTarget } from '@geekmidas/cli/target';
874
+ * import { z } from 'zod';
875
+ *
876
+ * export default defineTarget({
877
+ * name: 'fly',
878
+ * runtime: 'server',
879
+ * capabilities: { rollback: true, migrations: 'target', images: true },
880
+ * options: z.object({ org: z.string(), region: z.string().default('ams') }),
881
+ * async validate(ctx) {
882
+ * return { org: ctx.options.org, region: ctx.options.region };
883
+ * },
884
+ * async plan(ctx, run) { … },
885
+ * async release(ctx, run) { … },
886
+ * async rollback(ctx, run, failure) { … },
887
+ * result(ctx, run) { … },
888
+ * });
889
+ * ```
890
+ */
891
+ interface DeployTarget<Options = undefined, Run = unknown> {
892
+ /** The target's own name, for messages. Config refers to it by its key. */
893
+ readonly name: string;
894
+ readonly runtime: DeployRuntime;
895
+ readonly capabilities: DeployTargetCapabilities;
896
+ /**
897
+ * What `deploy.targets` may pass it — `[package, options]` — validated
898
+ * before any phase runs. Without one, the target takes no options.
899
+ */
900
+ readonly options?: TargetOptionsSchema<Options>;
901
+ /**
902
+ * The kinds of credential it asks the run's `CredentialProvider` for, so a
903
+ * host or `gkm login` can collect them up front.
904
+ */
905
+ readonly credentials?: readonly CredentialKind[];
906
+ /**
907
+ * Everything the deploy needs, checked before anything changes: the
908
+ * config, the apps, credentials, the stage's secrets.
909
+ */
910
+ validate(ctx: DeployPhaseContext<Options>): Promise<Run>;
911
+ /** A dry run: emit `resource.planned` for what a real run would do. */
912
+ plan(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
913
+ /** Create or find what the apps run on, and what they declare. */
914
+ provision?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
915
+ /** Build each app's artifact (`artifact.built`), changing nothing live. */
916
+ build?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
917
+ /** Put the built artifacts live (`app.deployed`). */
918
+ release(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
919
+ /** Check what was released answers (`health.checked`). */
920
+ verify?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
921
+ /**
922
+ * Restore the previous release, after `release` or `verify` failed. Called
923
+ * only when `capabilities.rollback` is true.
924
+ */
925
+ rollback?(ctx: DeployPhaseContext<Options>, run: Run, failure: DeployFailure): Promise<void>;
926
+ /** What the run did, once its last phase has finished. */
927
+ result(ctx: DeployPhaseContext<Options>, run: Run): DeployResult | Promise<DeployResult>;
928
+ }
929
+ /**
930
+ * A target of any options and run state — what the CLI holds once a target
931
+ * is resolved, its types left behind in the config that named it. The phases
932
+ * are methods, so their parameters are compared bivariantly and every
933
+ * `DeployTarget<O, R>` is one.
934
+ */
935
+ type AnyDeployTarget = DeployTarget<unknown, unknown>;
936
+ /** A target's options type, from the target. */
937
+ type TargetOptions<T> = T extends DeployTarget<infer O, infer _Run> ? O : never;
938
+ /**
939
+ * One `deploy.targets` entry:
940
+ *
941
+ * - `'@acme/gkm-target'` — a package, its default export the target
942
+ * - a target object, from `defineTarget` or a package's factory
943
+ * - `['@acme/gkm-target', { region: 'ams' }]` — either, with options
944
+ */
945
+ type DeployTargetEntry = string | AnyDeployTarget | readonly [string | AnyDeployTarget, unknown];
358
946
  declare namespace json_schema_d_exports {
359
947
  export { ArraySchema, BaseSchema, BooleanSchema, IntegerSchema, JSONSchema, NullSchema, NumberSchema, ObjectSchema, Schema$1 as Schema, SchemaType, StringSchema, _JSONSchema };
360
948
  }
@@ -4746,17 +5334,18 @@ declare const FrameworkSchema: ZodUnion<readonly [ZodEnum<{
4746
5334
  */
4747
5335
  type Framework = output$1<typeof FrameworkSchema>;
4748
5336
  /**
4749
- * Supported deploy targets (Phase 1).
5337
+ * The built-in targets a config may name: `dokploy`, deployed by
5338
+ * `gkm deploy`, and `sst`, deployed by `sst deploy` from the manifest
5339
+ * `gkm build` writes.
4750
5340
  */
4751
- declare const SUPPORTED_DEPLOY_TARGETS: readonly ['dokploy', 'sst'];
5341
+ declare const SUPPORTED_DEPLOY_TARGETS: string[];
5342
+ /** Built-in names reserved for targets that do not exist yet. */
5343
+ declare const PHASE_2_DEPLOY_TARGETS: string[];
4752
5344
  /**
4753
- * Phase 2 deploy targets (not yet implemented).
5345
+ * Whether a config may name `target`: a usable built-in, or one of its own
5346
+ * `deploy.targets`.
4754
5347
  */
4755
- declare const PHASE_2_DEPLOY_TARGETS: readonly ['vercel', 'cloudflare'];
4756
- /**
4757
- * Check if a deploy target is supported.
4758
- */
4759
- declare function isDeployTargetSupported(target: string): boolean;
5348
+ declare function isDeployTargetSupported(target: string, targets?: Record<string, unknown>): boolean;
4760
5349
  /**
4761
5350
  * Check if a deploy target is planned for Phase 2.
4762
5351
  */
@@ -4938,12 +5527,7 @@ declare const WorkspaceConfigSchema: ZodObject<{
4938
5527
  path: ZodString;
4939
5528
  port: ZodNumber;
4940
5529
  dependencies: ZodOptional<ZodArray<ZodString>>;
4941
- deploy: ZodOptional<ZodEnum<{
4942
- cloudflare: "cloudflare";
4943
- dokploy: "dokploy";
4944
- sst: "sst";
4945
- vercel: "vercel";
4946
- }>>;
5530
+ deploy: ZodOptional<ZodString>;
4947
5531
  constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
4948
5532
  routes: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
4949
5533
  functions: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
@@ -5005,12 +5589,8 @@ declare const WorkspaceConfigSchema: ZodObject<{
5005
5589
  }, $strip>>;
5006
5590
  }, $strip>>;
5007
5591
  deploy: ZodOptional<ZodObject<{
5008
- default: ZodOptional<ZodEnum<{
5009
- cloudflare: "cloudflare";
5010
- dokploy: "dokploy";
5011
- sst: "sst";
5012
- vercel: "vercel";
5013
- }>>;
5592
+ default: ZodOptional<ZodString>;
5593
+ targets: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>, ZodTuple<[ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>]>, ZodUnknown], null>]>>>;
5014
5594
  namespace: ZodOptional<ZodString>;
5015
5595
  domains: ZodOptional<ZodRecord<ZodString, ZodString>>;
5016
5596
  dokploy: ZodOptional<ZodObject<{
@@ -5327,21 +5907,16 @@ declare function formatValidationErrors(error: ZodError): string;
5327
5907
  //#endregion
5328
5908
  //#region src/workspace/types.d.ts
5329
5909
  /**
5330
- * Deploy target for an app.
5331
- *
5332
- * Specifies where the app will be deployed.
5910
+ * Where a stage — or one app — deploys, by target name: a built-in
5911
+ * (`dokploy`; `sst`, deployed by SST itself) or a key of `deploy.targets`.
5333
5912
  *
5334
5913
  * @example
5335
5914
  * ```ts
5336
- * // Currently supported
5337
5915
  * deploy: 'dokploy'
5338
- *
5339
- * // Future support (not yet implemented)
5340
- * deploy: 'vercel'
5341
- * deploy: 'cloudflare'
5916
+ * deploy: 'acme' // deploy: { targets: { acme: '@acme/gkm-target' } }
5342
5917
  * ```
5343
5918
  */
5344
- type DeployTarget = 'dokploy' | 'sst' | 'vercel' | 'cloudflare';
5919
+ type DeployTargetName = 'dokploy' | 'sst' | (string & {});
5345
5920
  /**
5346
5921
  * Each deployed stage's base domain — `deploy.domains`.
5347
5922
  *
@@ -5459,7 +6034,24 @@ interface DokployWorkspaceConfig {
5459
6034
  */
5460
6035
  interface DeployConfig {
5461
6036
  /** Default deploy target for all apps (default: 'dokploy') */
5462
- default?: DeployTarget;
6037
+ default?: DeployTargetName;
6038
+ /**
6039
+ * Targets that do not ship with the CLI, by the name `default` (or an
6040
+ * app's `deploy`) uses: a package whose default export is the target, a
6041
+ * target object, or either with its options.
6042
+ *
6043
+ * ```ts
6044
+ * targets: {
6045
+ * acme: '@acme/gkm-target',
6046
+ * fly: ['@acme/gkm-fly', { org: 'acme' }],
6047
+ * local: defineTarget({ … }),
6048
+ * }
6049
+ * ```
6050
+ *
6051
+ * A package is never guessed from a name: it is installed and listed here.
6052
+ * A built-in's name cannot be taken.
6053
+ */
6054
+ targets?: Record<string, DeployTargetEntry>;
5463
6055
  /**
5464
6056
  * Whose deploy this is, on a target shared with other workspaces — an
5465
6057
  * organisation or a team, lowercase `[a-z0-9-]`. Two workspaces with the
@@ -5652,7 +6244,7 @@ interface AppConfigBase {
5652
6244
  * Overrides `deploy.default` for this specific app.
5653
6245
  * @example 'dokploy', 'vercel'
5654
6246
  */
5655
- deploy?: DeployTarget;
6247
+ deploy?: DeployTargetName;
5656
6248
  /**
5657
6249
  * Constructs glob pattern — one glob, every kind.
5658
6250
  *
@@ -6103,7 +6695,7 @@ interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
6103
6695
  /** Resolved dependencies array (empty array if none) */
6104
6696
  dependencies: string[];
6105
6697
  /** Resolved deploy target (app.deploy > deploy.default > 'dokploy') */
6106
- resolvedDeployTarget: DeployTarget;
6698
+ resolvedDeployTarget: DeployTargetName;
6107
6699
  /** Entry file path for non-gkm apps */
6108
6700
  entry?: string;
6109
6701
  /** Framework for the app */
@@ -6406,5 +6998,5 @@ interface GkmConfig {
6406
6998
  deploy?: DeployConfig;
6407
6999
  }
6408
7000
  //#endregion
6409
- export { PHASE_2_DEPLOY_TARGETS as A, StateVersionConflict as B, WorkspaceConfig as C, Framework as D, BackendFramework as E, isDeployTargetSupported as F, isPhase2DeployTarget as I, safeValidateWorkspaceConfig as L, WorkspaceConfigSchema as M, formatValidationErrors as N, FrontendFramework as O, getDeployTargetError as P, validateWorkspaceConfig as R, SharedConfig as S, isWorkspaceConfig as T, LoadedConfig as _, Routes as a, NormalizedWorkspace as b, AppInput as c, DeployConfig as d, DeployTarget as f, InferredWorkspaceConfig as g, InferAppNames as h, OpenApiConfig as i, SUPPORTED_DEPLOY_TARGETS as j, MobileFramework as k, AppsRecord as l, DokployWorkspaceConfig as m, EmailBackend as n, AppConfig as o, DevConfig as p, GkmConfig as r, AppConfigInput as s, CacheBackend as t, ConstrainedApps as u, ModelsConfig as v, WorkspaceInput as w, SecretsConfig as x, NormalizedAppConfig as y, StateLocked as z };
6410
- //# sourceMappingURL=types-Bp1mVxG0.d.mts.map
7001
+ export { DeployEventError as $, PHASE_2_DEPLOY_TARGETS as A, DeployFailure as B, WorkspaceConfig as C, Framework as D, BackendFramework as E, isDeployTargetSupported as F, DeployTargetCapabilities as G, DeployRuntime as H, isPhase2DeployTarget as I, TargetEvent as J, DeployTargetEntry as K, safeValidateWorkspaceConfig as L, WorkspaceConfigSchema as M, formatValidationErrors as N, FrontendFramework as O, getDeployTargetError as P, DeployEvent as Q, validateWorkspaceConfig as R, SharedConfig as S, isWorkspaceConfig as T, DeploySecrets as U, DeployPhaseContext as V, DeployTarget as W, TargetOptionsIssue as X, TargetOptions as Y, TargetOptionsSchema as Z, LoadedConfig as _, StateVersionConflict as _t, Routes as a, DeployResult as at, NormalizedWorkspace as b, deployIdentity as bt, AppInput as c, CredentialKinds as ct, DeployConfig as d, MissingCredential as dt, DeployEventType as et, DeployTargetName as f, StoredCredentialsOptions as ft, InferredWorkspaceConfig as g, StateStore as gt, InferAppNames as h, StateLocked as ht, OpenApiConfig as i, AppDeployResult as it, SUPPORTED_DEPLOY_TARGETS as j, MobileFramework as k, AppsRecord as l, CredentialProvider as lt, DokployWorkspaceConfig as m, storedCredentials as mt, EmailBackend as n, ResourceChange as nt, AppConfig as o, Credential as ot, DevConfig as p, chainCredentials as pt, DeployTargetLogger as q, GkmConfig as r, ResourceVia as rt, AppConfigInput as s, CredentialKind as st, CacheBackend as t, DeployPhase as tt, ConstrainedApps as u, CredentialRequest as ut, ModelsConfig as v, StageSecrets as vt, WorkspaceInput as w, SecretsConfig as x, NormalizedAppConfig as y, DeployIdentity as yt, AnyDeployTarget as z };
7002
+ //# sourceMappingURL=types-DIA7Li-J.d.cts.map