@keystrokehq/cli 0.0.32 → 0.0.38

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 (148) hide show
  1. package/README.md +25 -4
  2. package/dist/{accept.handler-DNfIXPSP.mjs → accept.handler-CykuBpt6.mjs} +4 -4
  3. package/dist/{admin-CJp8XksD.mjs → admin-gRjPC3eD.mjs} +10 -10
  4. package/dist/{agent-manifest-De5TCxZq.mjs → agent-manifest-DfWD5tvv.mjs} +17 -27
  5. package/dist/{agents-G37PM35Z.mjs → agents-BpyuvM9p.mjs} +9 -9
  6. package/dist/{api-keys-4igNHJ_W.mjs → api-keys-BSKhdD_x.mjs} +6 -6
  7. package/dist/{api-BK3EhPvs.mjs → api-sWkB_Wta.mjs} +1 -1
  8. package/dist/{auth-CIOmmV4x.mjs → auth-DCgToFf5.mjs} +6 -6
  9. package/dist/{auth.handler-CznN_vfz.mjs → auth.handler-QRQAEUJC.mjs} +3 -3
  10. package/dist/authored-workflow-ref-BRCQgyWl.mjs +113 -0
  11. package/dist/{build-agents-DseUtzd4-CSGpNXur.mjs → build-agents-CUzBnlAG-3ePFZiJ6.mjs} +12 -11
  12. package/dist/{build-progress-DLM1Bt4T.mjs → build-progress-D_SQqdHA.mjs} +2 -2
  13. package/dist/{build-tasks-C09SdfjC-BmAVLTtQ.mjs → build-tasks-5eOvI19S-tbN6CRx9.mjs} +4 -4
  14. package/dist/{build-workflows-BZ_m97Pr-BiyptCrn.mjs → build-workflows-C-gQM3l5-_zcBHE3M.mjs} +14 -9
  15. package/dist/{build.handler-zHimoO7c.mjs → build.handler-DGQn_clk.mjs} +12 -9
  16. package/dist/{clear-cache.handler-BP0K1-uN.mjs → clear-cache.handler-gJpwslkK.mjs} +2 -2
  17. package/dist/{clear.handler-PsA5QKHx.mjs → clear.handler-CuXYvUj2.mjs} +2 -2
  18. package/dist/{clear.handler-T27GpgSu.mjs → clear.handler-DnjvgyMj.mjs} +1 -1
  19. package/dist/{commander-BlrSdFcu.mjs → commander-B_8QwPpe.mjs} +22 -3
  20. package/dist/{connect-BbLJhlIA.mjs → connect-DV9lhP6C.mjs} +3 -3
  21. package/dist/{connect.handler-BthE-7Wg.mjs → connect.handler-D6JzuFuT.mjs} +5 -5
  22. package/dist/{context-sgKhRc5v.mjs → context-Brc9VGV9.mjs} +4 -4
  23. package/dist/{create.handler-BovbO_g0.mjs → create.handler-D_tmjANR.mjs} +3 -3
  24. package/dist/{credential-env-map-CRs0llf0.mjs → credential-env-map-5a41jLwM.mjs} +1 -1
  25. package/dist/{credential-requirements-D0mavK8j-CFMf0Xwu.mjs → credential-requirements-B5Alhu1v-DanlSKnT.mjs} +3 -3
  26. package/dist/{credential-schema-mismatch-ClQgEVtO.mjs → credential-schema-mismatch-CStYUB2h.mjs} +1 -1
  27. package/dist/{credentials-DKrSaaLw.mjs → credentials-DtwLbee6.mjs} +1 -1
  28. package/dist/{credentials-CsncZ52a.mjs → credentials-UDrvrKj-.mjs} +10 -10
  29. package/dist/current-deployment-workflow-CknsHF5T.mjs +20 -0
  30. package/dist/current.handler-Cy91EeLU.mjs +19 -0
  31. package/dist/{delete.handler-DkAK396w.mjs → delete.handler-rUDDUrDQ.mjs} +2 -2
  32. package/dist/{deploy-DvPfR9fC.mjs → deploy-DgWPlEKO.mjs} +2 -2
  33. package/dist/{deploy-progress-BsUH7fGE.mjs → deploy-progress-BDOCSm_U.mjs} +2 -2
  34. package/dist/{deploy.handler-BW3f2N2G.mjs → deploy.handler-BDCHCk_A.mjs} +16 -16
  35. package/dist/{diff-utils-Bs--xmoV.mjs → diff-utils-YEUYtSRs.mjs} +1 -1
  36. package/dist/{diff.handler-BwhsoAg0.mjs → diff.handler-CGERP-Qn.mjs} +15 -9
  37. package/dist/{dist-Dw7gCE7y.mjs → dist-B5jy238v.mjs} +37 -11
  38. package/dist/{dist-CTEtWDW4.mjs → dist-BmbFJq8U.mjs} +8 -27
  39. package/dist/{env.handler-Dks6ZQh-.mjs → env.handler--8FRrSlJ.mjs} +52 -29
  40. package/dist/{error-boundary-0veZ_RDS.mjs → error-boundary-D2DiCLAp.mjs} +3 -3
  41. package/dist/{iam-command-utils-CSZj4XlH.mjs → iam-command-utils-D01Gw8-M.mjs} +3 -13
  42. package/dist/{import-module-y0glInUe-DV_3dsU0.mjs → import-module-y0glInUe-EuAWaw9g.mjs} +506 -128
  43. package/dist/{init-BOCDwqKR.mjs → init-Mpe_8lA_.mjs} +3 -3
  44. package/dist/{init.handler-B3T4J6u_.mjs → init.handler-BjLAIAmm.mjs} +5 -5
  45. package/dist/{inspect.handler-v9snxDLi.mjs → inspect.handler-CXCi7fhH.mjs} +24 -13
  46. package/dist/{integration-catalog-CiZ62hb_.mjs → integration-catalog-mZs6EAlN.mjs} +3 -3
  47. package/dist/{integrations-m7_tb3GV.mjs → integrations-D_IH5Ud1.mjs} +7 -7
  48. package/dist/{invites-BuatfJmN.mjs → invites-CWWz4wmY.mjs} +5 -5
  49. package/dist/{invites.list.handler-CK6mL10z.mjs → invites.list.handler-CQLWSoWo.mjs} +6 -5
  50. package/dist/{invites.resend.handler-CKZouK1Z.mjs → invites.resend.handler-CeIGE_qM.mjs} +6 -5
  51. package/dist/{invites.revoke.handler-H0VI-3sp.mjs → invites.revoke.handler-9K6jkym_.mjs} +6 -5
  52. package/dist/keystroke.mjs +139 -82
  53. package/dist/{list-enrichment-DP1wEyBZ.mjs → list-enrichment-dqbkXJzy.mjs} +2 -2
  54. package/dist/list.handler-BvuxTFLe.mjs +64 -0
  55. package/dist/list.handler-CDWPmiMy.mjs +39 -0
  56. package/dist/{list.handler-DVnFrlis.mjs → list.handler-Co32_F3n.mjs} +7 -7
  57. package/dist/{list.handler-CMRQKH4b.mjs → list.handler-Cuw1fWO_.mjs} +41 -12
  58. package/dist/{list.handler-DbYUk6ko.mjs → list.handler-D-rSyrX0.mjs} +5 -5
  59. package/dist/{list.handler-DIMWZx78.mjs → list.handler-DMvq96UA.mjs} +4 -4
  60. package/dist/{list.handler-LxZInip2.mjs → list.handler-DUTNS8du.mjs} +4 -4
  61. package/dist/{list.handler-BiY5NFWd.mjs → list.handler-Dz-Yeijp.mjs} +3 -3
  62. package/dist/list2.handler-BpqKZTZk.mjs +99 -0
  63. package/dist/{listen-C_7Rgwkb.mjs → listen-CeNwufij.mjs} +3 -3
  64. package/dist/{listen.handler-dJgorIzr.mjs → listen.handler-CfRoaOwu.mjs} +4 -4
  65. package/dist/{logs-B9YMhUGt.mjs → logs-B7k2_W1R.mjs} +3 -3
  66. package/dist/{logs.handler-DGGVPMOX.mjs → logs.handler-BIqJ0FED.mjs} +1 -1
  67. package/dist/{logs.handler-BfjCsAyq.mjs → logs.handler-CSqOzxCU.mjs} +26 -29
  68. package/dist/{members.add.handler-DSRCRxsI.mjs → members.add.handler-CBjoA6vG.mjs} +6 -5
  69. package/dist/{members.invite.handler-BNpHn1dY.mjs → members.invite.handler-D8KcKJ9Y.mjs} +6 -5
  70. package/dist/{members.list.handler-Bn9LJEPG.mjs → members.list.handler-CB_qSJK0.mjs} +6 -5
  71. package/dist/{members.remove.handler-Dkr2t_tX.mjs → members.remove.handler-DNhO81mo.mjs} +6 -5
  72. package/dist/{members.update.handler-DBtUYuAY.mjs → members.update.handler-Bjdk_uz4.mjs} +6 -5
  73. package/dist/{operations-CF2nUiBs.mjs → operations-HHwoArwE.mjs} +5 -5
  74. package/dist/org-context-CNh2p2DP.mjs +112 -0
  75. package/dist/{org-DOH7YHk2.mjs → org-f-qo68Em.mjs} +35 -28
  76. package/dist/org-output-BcI17Uan.mjs +64 -0
  77. package/dist/{orgs.create.handler-BO70zIdp.mjs → orgs.create.handler-DOE9ZIed.mjs} +4 -4
  78. package/dist/{orgs.get.handler-BuGg5bc9.mjs → orgs.get.handler-sWErVI7r.mjs} +4 -4
  79. package/dist/{orgs.list.handler--5HutMkl.mjs → orgs.list.handler-Cp-mXsA0.mjs} +4 -4
  80. package/dist/{output-BWcVRt-T.mjs → output-BPydP5tG.mjs} +1 -1
  81. package/dist/{package-manager-CvY4IW7X.mjs → package-manager-BwJ6muas.mjs} +27 -2
  82. package/dist/{paused.handler-DHvxz-cC.mjs → paused.handler-DWdoKYY8.mjs} +20 -33
  83. package/dist/{projects-C5GZ5Jrf.mjs → projects-CCC36zbJ.mjs} +11 -9
  84. package/dist/{register.handler-CKMZ2WmD.mjs → register.handler-Dxae5iq8.mjs} +3 -3
  85. package/dist/{render-credential-Bn15FEUC.mjs → render-credential-D-H1ECDt.mjs} +1 -1
  86. package/dist/{render-operation-DWbMwhfc.mjs → render-operation-iF7Wblv2.mjs} +2 -2
  87. package/dist/{requirements.handler-B5rqCjMu.mjs → requirements.handler-Bg3mRnER.mjs} +7 -7
  88. package/dist/{resolve-cli-credentials-CAOSVMJP.mjs → resolve-cli-credentials-GVOOedoQ.mjs} +1 -1
  89. package/dist/{resolve-project-E9mrh_el.mjs → resolve-project-CoCN9xfi.mjs} +24 -8
  90. package/dist/{run-polling-DawiBus-.mjs → run-polling-htHWhG0T.mjs} +97 -14
  91. package/dist/{run.handler-BG7xitEK.mjs → run.handler-C-CM-xZG.mjs} +42 -30
  92. package/dist/{runs-swYYBT6C.mjs → runs-BRJPNq4B.mjs} +4 -4
  93. package/dist/{schema-display-FvI8QjOQ.mjs → schema-display-sZ6ConJd.mjs} +33 -26
  94. package/dist/schemas-ClAIoIrX.mjs +281 -0
  95. package/dist/{search-CA0J5NOY.mjs → search-CQMgdp51.mjs} +3 -3
  96. package/dist/{search.handler-BVDsYZlJ.mjs → search.handler-Dn5jjyF-.mjs} +6 -6
  97. package/dist/show.handler-CdZF0aao.mjs +79 -0
  98. package/dist/{show.handler-CsidInW8.mjs → show.handler-D3nDc1MJ.mjs} +5 -5
  99. package/dist/{show.handler-CwwnCmbp.mjs → show.handler-DUDxnNiZ.mjs} +6 -6
  100. package/dist/{skill-installer-DG8kTaQR.mjs → skill-installer-DYNH_MJT.mjs} +3 -1
  101. package/dist/{skills-sync.handler-yRmi3OgP.mjs → skills-sync.handler-_LVhIMRH.mjs} +13 -7
  102. package/dist/{skills.command-COYd3k4Z.mjs → skills.command-DSHGwXPX.mjs} +5 -5
  103. package/dist/skills.handler-DqLXJepA.mjs +9 -0
  104. package/dist/{spinner-progress-lrKDs4YF.mjs → spinner-progress-fLaD0sjH.mjs} +1 -1
  105. package/dist/status.handler-1hEzX5oB.mjs +72 -0
  106. package/dist/{switch.handler-BwYndsP-.mjs → switch.handler-D135WwfB.mjs} +17 -4
  107. package/dist/{sync-6fZkIUtn.mjs → sync-CFScllh3.mjs} +2 -2
  108. package/dist/{sync.handler-Ctr-cN9X.mjs → sync.handler-x8v53-TT.mjs} +8 -8
  109. package/dist/{task-BWuIKWh4.mjs → task-DTvLzUkA.mjs} +2 -88
  110. package/dist/{task-target-build-QllcCfoN.mjs → task-target-build-CtvRyVjH.mjs} +5 -5
  111. package/dist/task-target-deploy-runner.mjs +6 -6
  112. package/dist/{test-C8VIZe9V.mjs → test-Dx4RXoLZ.mjs} +5 -5
  113. package/dist/{test.handler-DLaxrJ9V.mjs → test.handler-BmvL5vF8.mjs} +19 -16
  114. package/dist/{test.handler-BCW0YBPd.mjs → test.handler-Mz_XOnJl.mjs} +2 -2
  115. package/dist/{tool.handler-8qNmgdRe.mjs → tool.handler-DsbpocYI.mjs} +12 -12
  116. package/dist/{trigger-artifacts-BcRScRSp-BiD2h6do.mjs → trigger-artifacts-BcRScRSp-BRpU-He5.mjs} +2 -2
  117. package/dist/{trigger-manifest-C07EM-b2.mjs → trigger-manifest-BVqjDhxU.mjs} +1 -1
  118. package/dist/{upgrade-DgOcc8IT.mjs → upgrade-C9G6HksL.mjs} +4 -8
  119. package/dist/upgrade.handler-DsFeAFF4.mjs +99 -0
  120. package/dist/{upload.handler-B7xle1oX.mjs → upload.handler-DscKDQ63.mjs} +9 -9
  121. package/dist/{users.get.handler-C4t1vXwi.mjs → users.get.handler-CaUv_maM.mjs} +4 -4
  122. package/dist/{users.list.handler-Dvl90grq.mjs → users.list.handler-DzsOvAtd.mjs} +4 -4
  123. package/dist/{users.set-role.handler-Djw1_VGf.mjs → users.set-role.handler-koRzA0V9.mjs} +4 -4
  124. package/dist/{validate.handler-Drf_lssw.mjs → validate.handler-BkBsS8BL.mjs} +171 -26
  125. package/dist/{workflow-build-Begvjfq8.mjs → workflow-build-Db6at6IA.mjs} +234 -32
  126. package/dist/{workflow-build-manifest-1sC52TIG.mjs → workflow-build-manifest-CV6bBmDO.mjs} +1 -1
  127. package/dist/{workflow-bundler-BzHk73PM-muPv1yGG.mjs → workflow-bundler-Bs3zQNQv-Dy7lXxy3.mjs} +15 -4
  128. package/dist/{workflows-DjMlxuBX.mjs → workflows-B8VG6nKg.mjs} +34 -37
  129. package/dist/{writer-byNNUjRm-B-on1n6c.mjs → writer-BLg0RuZa-Y6ExdYH9.mjs} +6 -4
  130. package/package.json +10 -10
  131. package/dist/current-deployment-workflow-B1VQCYC-.mjs +0 -94
  132. package/dist/current.handler-BaGaCLzB.mjs +0 -21
  133. package/dist/list.handler-BEMj3FyH.mjs +0 -76
  134. package/dist/list.handler-Cq_oQY5B.mjs +0 -52
  135. package/dist/list.handler-htR9TeiS.mjs +0 -24
  136. package/dist/schemas-D2zfmyC-.mjs +0 -671
  137. package/dist/show.handler-nkK6Erbb.mjs +0 -31
  138. package/dist/skills.handler-DYIQK0Vu.mjs +0 -9
  139. package/dist/status.handler-Ch_DtyBp.mjs +0 -109
  140. package/dist/upgrade.handler-DSZuw7-9.mjs +0 -80
  141. /package/dist/{build-metadata-BB_L45ZS-DSJL7dTy.mjs → build-metadata-BB_L45ZS-DRQsV6JK.mjs} +0 -0
  142. /package/dist/{deploy-DhCbYFc7.mjs → deploy-BiKBH25R.mjs} +0 -0
  143. /package/dist/{detect-env-access-CwkOYeYM-COq4U-4Y.mjs → detect-env-access-CwkOYeYM-r4aynBU0.mjs} +0 -0
  144. /package/dist/{read-credential-keys-77a91T8M-DGK5XTQp.mjs → read-credential-keys-77a91T8M-I07NYwfH.mjs} +0 -0
  145. /package/dist/{run-polling-fBouPjJ2.mjs → run-polling-1c0ckC1A.mjs} +0 -0
  146. /package/dist/{schemas-4Mq_bxob.mjs → schemas-8nhXlXWh.mjs} +0 -0
  147. /package/dist/{task-target-deploy-B_3HPSo2.mjs → task-target-deploy-m9LfE488.mjs} +0 -0
  148. /package/dist/{types-AlA-ifK9.mjs → types-Cb0eWmUU.mjs} +0 -0
@@ -1,13 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui, j as throwReportedCliExit } from "./keystroke.mjs";
4
- import { n as credentials } from "./dist-Dw7gCE7y.mjs";
5
- import { i as requireClient } from "./context-sgKhRc5v.mjs";
3
+ import { P as throwReportedCliExit, p as ui } from "./keystroke.mjs";
4
+ import { n as credentials } from "./dist-B5jy238v.mjs";
5
+ import { i as requireClient } from "./context-Brc9VGV9.mjs";
6
+ import { c as resolveEffectiveOrganization, n as ORG_STORED_KEYS_HINT, t as ORG_CONTEXT_HINT } from "./org-context-CNh2p2DP.mjs";
6
7
  import { select } from "@clack/prompts";
7
8
  //#region src/commands/org/switch.handler.ts
8
9
  async function handleOrgSwitch(_options, ctx) {
10
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
11
+ const message = "Organization switch requires an interactive terminal.";
12
+ ui.error(message);
13
+ ui.hint(ORG_CONTEXT_HINT);
14
+ throwReportedCliExit(message);
15
+ }
9
16
  const { user } = await requireClient(ctx).users.getMe();
10
17
  const orgs = user.organizations ?? [];
18
+ const currentOrgId = (await resolveEffectiveOrganization(ctx, orgs))?.organizationId;
11
19
  const storedOrgIds = new Set(ctx.storedOrgs.map((o) => o.organizationId));
12
20
  if (orgs.length === 0) {
13
21
  ui.warn("You do not belong to any organization.");
@@ -18,10 +26,15 @@ async function handleOrgSwitch(_options, ctx) {
18
26
  ui.hint(`You only belong to one organization: ${name}`);
19
27
  return;
20
28
  }
29
+ if (storedOrgIds.size === 0) {
30
+ ui.warn("No stored API keys for any organization.");
31
+ ui.hint(ORG_STORED_KEYS_HINT);
32
+ return;
33
+ }
21
34
  const selected = await select({
22
35
  message: "Switch to organization:",
23
36
  options: orgs.map((org) => {
24
- const isCurrent = org.id === ctx.organizationId;
37
+ const isCurrent = org.id === currentOrgId;
25
38
  const hasKey = storedOrgIds.has(org.id);
26
39
  const hint = isCurrent ? "(current)" : hasKey ? void 0 : "No stored key, run `keystroke auth`";
27
40
  return {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { t as createTypedCommand } from "./commander-BlrSdFcu.mjs";
3
+ import { t as createTypedCommand } from "./commander-B_8QwPpe.mjs";
4
4
  import { z } from "zod";
5
5
  //#region src/commands/sync/sync.command.ts
6
6
  /**
@@ -32,7 +32,7 @@ function createSyncCommand() {
32
32
  description: "Sync local workflows with Keystroke",
33
33
  schema: SyncOptionsSchema,
34
34
  optionsConfig: SYNC_OPTIONS_CONFIG,
35
- loadHandler: async () => (await import("./sync.handler-Ctr-cN9X.mjs")).handleSync
35
+ loadHandler: async () => (await import("./sync.handler-x8v53-TT.mjs")).handleSync
36
36
  });
37
37
  }
38
38
  //#endregion
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { P as logger, a as ui, j as throwReportedCliExit, l as isLocalMode, y as toErrorMessage } from "./keystroke.mjs";
4
- import { i as projects } from "./dist-Dw7gCE7y.mjs";
5
- import { a as validateApiKey, i as requireClient } from "./context-sgKhRc5v.mjs";
6
- import { n as deployFromDir } from "./dist-CTEtWDW4.mjs";
7
- import { t as requireWorkflowsDir } from "./resolve-project-E9mrh_el.mjs";
8
- import { a as runWorkflowBuild, n as renderBuildFailure, r as renderBuildHeader } from "./workflow-build-Begvjfq8.mjs";
9
- import { t as createBuildProgress } from "./build-progress-DLM1Bt4T.mjs";
10
- import { t as createDeployProgress } from "./deploy-progress-BsUH7fGE.mjs";
3
+ import { L as logger, P as throwReportedCliExit, S as toErrorMessage, l as isLocalMode, p as ui } from "./keystroke.mjs";
4
+ import { i as projects } from "./dist-B5jy238v.mjs";
5
+ import { a as validateApiKey, i as requireClient } from "./context-Brc9VGV9.mjs";
6
+ import { n as deployFromDir } from "./dist-BmbFJq8U.mjs";
7
+ import { t as requireWorkflowsDir } from "./resolve-project-CoCN9xfi.mjs";
8
+ import { a as runWorkflowBuild, n as renderBuildFailure, r as renderBuildHeader } from "./workflow-build-Db6at6IA.mjs";
9
+ import { t as createBuildProgress } from "./build-progress-D_SQqdHA.mjs";
10
+ import { t as createDeployProgress } from "./deploy-progress-BDOCSm_U.mjs";
11
11
  //#region src/commands/sync/sync.handler.ts
12
12
  async function handleSync(options, ctx) {
13
13
  try {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { n as __exportAll } from "./chunk-CH6r78ws.mjs";
4
- import { a as descriptionString, c as optionalDescriptionString, d as trimmedNonEmptyStringUnbounded, f as parseCronExpression, i as createStructuralSchema, n as credentialSetProxyConfigSchema, o as idNoSpacesString, s as jsonSchemaObject, t as CredentialSetManifestSchema, u as trimmedNonEmptyString } from "./schemas-D2zfmyC-.mjs";
4
+ import { a as descriptionString, c as optionalDescriptionString, d as trimmedNonEmptyStringUnbounded, i as createStructuralSchema, n as credentialSetProxyConfigSchema, o as idNoSpacesString, s as jsonSchemaObject, t as CredentialSetManifestSchema, u as trimmedNonEmptyString } from "./schemas-ClAIoIrX.mjs";
5
5
  import { z } from "zod";
6
6
  import "node:crypto";
7
7
  const SHA256HashSchema = z.string().length(64, "Must be 64 characters").regex(/^[a-f0-9]{64}$/i, "Must be hexadecimal").transform((value) => value);
@@ -20,94 +20,8 @@ z.object({
20
20
  return data.constant !== void 0 !== (data.exponential !== void 0);
21
21
  }, { error: "Retry config must specify exactly one of constant or exponential strategy" });
22
22
  //#endregion
23
- //#region ../../packages/core/src/shared/schedule.ts
24
- /**
25
- * shared/schedule.ts
26
- *
27
- * Unified schedule type that supports both simple intervals and cron expressions.
28
- * Can be used in both cron and polling triggers for maximum flexibility.
29
- *
30
- * Template literal types provide compile-time type safety.
31
- * Zod schemas with refinements provide runtime validation.
32
- */
23
+ //#region ../../packages/core/src/shared/duration.ts
33
24
  const DurationSchema = z.union([z.number().int().positive().finite(), z.string().regex(/^[1-9]\d*[smhdwy]$/)]);
34
- const DurationStringSchema = z.string().refine((val) => /^\d+[smhdwy]$/.test(val), { message: "Invalid duration format. Must be a positive integer followed by s, m, h, d, w, or y (e.g., \"5m\", \"1h\")" }).refine((val) => {
35
- const match = val.match(/^(\d+)[smhdwy]$/);
36
- if (!match?.[1]) return false;
37
- const num = Number.parseInt(match[1], 10);
38
- return num > 0 && Number.isFinite(num);
39
- }, { message: "Duration value must be a positive integer greater than 0" });
40
- const CronExpressionSchema = z.string().superRefine((val, ctx) => {
41
- try {
42
- parseCronExpression(val);
43
- } catch (error) {
44
- const errorMessage = error instanceof Error ? error.message : "Invalid cron expression format";
45
- ctx.addIssue({
46
- code: "custom",
47
- message: `Invalid cron expression: ${errorMessage}. Must be a valid 5-field cron: minute hour day month weekday (e.g., "0 9 * * *", "*/15 * * * *")`
48
- });
49
- }
50
- });
51
- z.union([
52
- z.number().refine((val) => val > 0, { message: "Duration in milliseconds must be positive" }).refine(Number.isFinite, { message: "Duration in milliseconds must be finite" }).refine(Number.isInteger, { message: "Duration in milliseconds must be an integer" }),
53
- DurationStringSchema,
54
- CronExpressionSchema
55
- ]);
56
- z.enum([
57
- "UTC",
58
- "GMT",
59
- "Etc/UTC",
60
- "Etc/GMT",
61
- "America/New_York",
62
- "America/Chicago",
63
- "America/Denver",
64
- "America/Los_Angeles",
65
- "America/Phoenix",
66
- "America/Anchorage",
67
- "America/Toronto",
68
- "America/Vancouver",
69
- "America/Mexico_City",
70
- "America/Sao_Paulo",
71
- "America/Buenos_Aires",
72
- "Europe/London",
73
- "Europe/Paris",
74
- "Europe/Berlin",
75
- "Europe/Rome",
76
- "Europe/Madrid",
77
- "Europe/Amsterdam",
78
- "Europe/Stockholm",
79
- "Europe/Vienna",
80
- "Europe/Zurich",
81
- "Europe/Moscow",
82
- "Europe/Athens",
83
- "Europe/Dublin",
84
- "Asia/Tokyo",
85
- "Asia/Shanghai",
86
- "Asia/Hong_Kong",
87
- "Asia/Singapore",
88
- "Asia/Seoul",
89
- "Asia/Dubai",
90
- "Asia/Kolkata",
91
- "Asia/Bangkok",
92
- "Asia/Jakarta",
93
- "Asia/Manila",
94
- "Asia/Taipei",
95
- "Australia/Sydney",
96
- "Australia/Melbourne",
97
- "Australia/Brisbane",
98
- "Australia/Perth",
99
- "Australia/Adelaide",
100
- "Pacific/Auckland",
101
- "Pacific/Honolulu",
102
- "Africa/Cairo",
103
- "Africa/Johannesburg",
104
- "Africa/Lagos",
105
- "Africa/Nairobi",
106
- "Asia/Riyadh",
107
- "Asia/Tehran",
108
- "Asia/Jerusalem",
109
- "Asia/Doha"
110
- ]);
111
25
  //#endregion
112
26
  //#region ../../packages/core/src/artifacts/source-analysis.ts
113
27
  const SourceLocationSchema = z.object({
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { r as getKeystrokeProjectPath } from "./paths-DpHfoaXN-CdPimpky.mjs";
4
- import "./dist-Dw7gCE7y.mjs";
5
- import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-DGK5XTQp.mjs";
4
+ import "./dist-B5jy238v.mjs";
5
+ import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-I07NYwfH.mjs";
6
6
  import path from "node:path";
7
7
  import { mkdir, writeFile } from "node:fs/promises";
8
8
  import { pathToFileURL } from "node:url";
@@ -111,7 +111,7 @@ async function buildTaskTargetFile(options) {
111
111
  return builtTasks;
112
112
  }
113
113
  async function bundleTaskTargetModule(options) {
114
- const [{ rolldown }, { createEnvAccessPlugin, formatEnvAccessError }] = await Promise.all([import("rolldown"), import("./detect-env-access-CwkOYeYM-COq4U-4Y.mjs").then((n) => n.n).then((n) => n.n)]);
114
+ const [{ rolldown }, { createEnvAccessPlugin, formatEnvAccessError }] = await Promise.all([import("rolldown"), import("./detect-env-access-CwkOYeYM-r4aynBU0.mjs").then((n) => n.n).then((n) => n.n)]);
115
115
  const entryId = "\0virtual:task-target-entry";
116
116
  const trackedDependencies = /* @__PURE__ */ new Set();
117
117
  const envViolations = [];
@@ -218,7 +218,7 @@ async function attachTaskTargetTriggers(options) {
218
218
  options.artifact.triggers.push(...buildTaskTriggerArtifactsWithoutBundles(options.entry.taskMetadata.triggers, options.artifact.task.taskId, options.artifact.task.taskName));
219
219
  return [];
220
220
  }
221
- const { buildTriggerArtifacts } = await import("./trigger-artifacts-BcRScRSp-BiD2h6do.mjs").then((n) => n.n);
221
+ const { buildTriggerArtifacts } = await import("./trigger-artifacts-BcRScRSp-BRpU-He5.mjs").then((n) => n.n);
222
222
  const triggerResult = await buildTriggerArtifacts(options.entry.taskMetadata.triggers, options.artifact.task.taskId, options.artifact.task.taskName, options.projectRoot, {
223
223
  workflowExportName: options.entry.source.localExportName,
224
224
  workflowFilePath: options.entry.runtimeBundlePath
@@ -319,7 +319,7 @@ function createPreparedTaskTarget(artifact, triggers) {
319
319
  };
320
320
  }
321
321
  async function tryParseTaskBuildManifest(manifest) {
322
- const { TaskBuildManifestSchema } = await import("./task-BWuIKWh4.mjs").then((n) => n.t);
322
+ const { TaskBuildManifestSchema } = await import("./task-DTvLzUkA.mjs").then((n) => n.t);
323
323
  const result = TaskBuildManifestSchema.safeParse(manifest);
324
324
  return result.success ? result.data : null;
325
325
  }
@@ -2,9 +2,9 @@
2
2
 
3
3
  import { r as getKeystrokeProjectPath } from "./paths-DpHfoaXN-CdPimpky.mjs";
4
4
  import "./default-urls-BoSm4s9C.mjs";
5
- import "./dist-Dw7gCE7y.mjs";
5
+ import "./dist-B5jy238v.mjs";
6
6
  import { n as findProjectRoot, t as assertWorkflowProjectRoot } from "./project-config-DudGRFPO.mjs";
7
- import { t as resolveCliCredentials } from "./resolve-cli-credentials-CAOSVMJP.mjs";
7
+ import { t as resolveCliCredentials } from "./resolve-cli-credentials-GVOOedoQ.mjs";
8
8
  import path from "node:path";
9
9
  import { mkdir, readFile, writeFile } from "node:fs/promises";
10
10
  import { spawnSync } from "node:child_process";
@@ -119,7 +119,7 @@ function restartStage(options, projectRoot, stage) {
119
119
  }
120
120
  async function runBuildPhase(options, projectRoot) {
121
121
  const projectConfig = await assertWorkflowProjectRoot(projectRoot);
122
- const { buildTaskTargetEntries } = await import("./task-target-build-QllcCfoN.mjs");
122
+ const { buildTaskTargetEntries } = await import("./task-target-build-CtvRyVjH.mjs");
123
123
  await writeBuildDescriptor(projectRoot, {
124
124
  projectRoot,
125
125
  projectConfig,
@@ -132,7 +132,7 @@ async function runBuildPhase(options, projectRoot) {
132
132
  }
133
133
  async function runPreparePhase(projectRoot) {
134
134
  const buildDescriptor = await readBuildDescriptor(projectRoot);
135
- const { prepareTaskTargetBuiltTasks } = await import("./task-target-build-QllcCfoN.mjs");
135
+ const { prepareTaskTargetBuiltTasks } = await import("./task-target-build-CtvRyVjH.mjs");
136
136
  const prepareResult = await prepareTaskTargetBuiltTasks({
137
137
  builtTasks: buildDescriptor.builtTasks,
138
138
  projectRoot
@@ -163,11 +163,11 @@ async function resolveDeployAuthOptions(options) {
163
163
  }
164
164
  async function runDeployPhase(options, projectRoot) {
165
165
  const descriptor = await readDescriptor(projectRoot);
166
- const { createDeployClient } = await import("./deploy-DhCbYFc7.mjs");
166
+ const { createDeployClient } = await import("./deploy-BiKBH25R.mjs");
167
167
  const client = createDeployClient(await resolveDeployAuthOptions(options));
168
168
  const auth = await client.public.auth.validate();
169
169
  if (auth.organizationId !== descriptor.projectConfig.organizationId) throw new Error(`Project organization mismatch: config=${descriptor.projectConfig.organizationId} auth=${auth.organizationId}`);
170
- const { deployTaskTargets } = await import("./task-target-deploy-B_3HPSo2.mjs");
170
+ const { deployTaskTargets } = await import("./task-target-deploy-m9LfE488.mjs");
171
171
  const result = await deployTaskTargets({
172
172
  preparedTasks: descriptor.preparedTasks,
173
173
  client,
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui } from "./keystroke.mjs";
4
- import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BWcVRt-T.mjs";
5
- import { t as createTypedCommand } from "./commander-BlrSdFcu.mjs";
3
+ import { p as ui } from "./keystroke.mjs";
4
+ import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BPydP5tG.mjs";
5
+ import { t as createTypedCommand } from "./commander-B_8QwPpe.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/commands/test/test.command.ts
8
8
  const TestOptionsSchema = JsonOptionSchema;
@@ -44,7 +44,7 @@ const TEST_TOOL_OPTIONS_CONFIG = {
44
44
  }
45
45
  };
46
46
  function handleTestHelp() {
47
- ui.hint("Use `keystroke test tool <toolName> --input='{...}'`. To test workflows, use `keystroke workflows test <workflow>`.");
47
+ ui.hint("Use `keystroke test tool <toolName> --input='{...}'`. To test workflows, use `keystroke workflows test <authored-workflow-id>`.");
48
48
  }
49
49
  function createTestCommand() {
50
50
  const cmd = createTypedCommand({
@@ -63,7 +63,7 @@ function createTestCommand() {
63
63
  description: "Agent tool name from the built manifest",
64
64
  key: "toolName"
65
65
  },
66
- loadHandler: async () => (await import("./tool.handler-8qNmgdRe.mjs")).handleTestTool
66
+ loadHandler: async () => (await import("./tool.handler-DsbpocYI.mjs")).handleTestTool
67
67
  })]
68
68
  });
69
69
  cmd.enablePositionalOptions();
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { D as CliExitError, a as ui, l as isLocalMode, y as toErrorMessage } from "./keystroke.mjs";
4
- import { i as projects } from "./dist-Dw7gCE7y.mjs";
3
+ import { A as CliExitError, S as toErrorMessage, l as isLocalMode, p as ui } from "./keystroke.mjs";
4
+ import { i as projects } from "./dist-B5jy238v.mjs";
5
5
  import { t as assertWorkflowProjectRoot } from "./project-config-DudGRFPO.mjs";
6
- import { i as requireClient, t as assertProjectConfigMatchesAuthenticatedOrg } from "./context-sgKhRc5v.mjs";
7
- import { o as readWorkflowsFromDisk, s as uploadTestBundle } from "./dist-CTEtWDW4.mjs";
8
- import { t as requireWorkflowsDir } from "./resolve-project-E9mrh_el.mjs";
9
- import { a as runWorkflowBuild, t as WorkflowNotFoundError } from "./workflow-build-Begvjfq8.mjs";
10
- import { r as isUnknownSchema } from "./schema-display-FvI8QjOQ.mjs";
11
- import { t as createBuildProgress } from "./build-progress-DLM1Bt4T.mjs";
12
- import { t as withErrorBoundary } from "./error-boundary-0veZ_RDS.mjs";
13
- import { a as tryReadExistingInputSchema, n as resolveInput, o as validateInputOrExit, t as pollForCompletion } from "./run-polling-DawiBus-.mjs";
6
+ import { i as requireClient, t as assertProjectConfigMatchesAuthenticatedOrg } from "./context-Brc9VGV9.mjs";
7
+ import { o as readWorkflowsFromDisk, s as uploadTestBundle } from "./dist-BmbFJq8U.mjs";
8
+ import { t as requireWorkflowsDir } from "./resolve-project-CoCN9xfi.mjs";
9
+ import { a as runWorkflowBuild, t as WorkflowNotFoundError } from "./workflow-build-Db6at6IA.mjs";
10
+ import { a as isUnknownSchema } from "./schema-display-sZ6ConJd.mjs";
11
+ import { t as createBuildProgress } from "./build-progress-D_SQqdHA.mjs";
12
+ import { t as withErrorBoundary } from "./error-boundary-D2DiCLAp.mjs";
13
+ import { a as tryReadExistingInputSchema, n as resolveInput, o as validateInputOrExit, t as pollForCompletion } from "./run-polling-htHWhG0T.mjs";
14
+ import { n as assertAuthoredWorkflowId, t as WORKFLOW_ID_COMMANDS } from "./authored-workflow-ref-BRCQgyWl.mjs";
14
15
  //#region src/lib/format.ts
15
16
  function formatBytes(bytes) {
16
17
  if (bytes < 1024) return `${bytes} B`;
@@ -27,6 +28,7 @@ async function resolveAndValidateInputForRun(options) {
27
28
  const input = await resolveInput(options);
28
29
  const workflowsDir = await requireWorkflowsDir(options.path);
29
30
  projects.track(workflowsDir);
31
+ await assertAuthoredWorkflowId(options.workflow, workflowsDir, WORKFLOW_ID_COMMANDS.test);
30
32
  const existingSchema = await tryReadExistingInputSchema(workflowsDir, options.workflow);
31
33
  if (existingSchema && !isUnknownSchema(existingSchema)) validateInputOrExit(options.workflow, input, existingSchema);
32
34
  return {
@@ -36,7 +38,7 @@ async function resolveAndValidateInputForRun(options) {
36
38
  }
37
39
  /**
38
40
  * Build workflow(s) for run using the standard build pipeline, then read
39
- * prepared artifacts from disk filtered by workflow ref.
41
+ * prepared artifacts from disk filtered by authored workflow id.
40
42
  */
41
43
  async function buildWorkflowsForRun(options) {
42
44
  const progress = createBuildProgress(options.workflow);
@@ -47,10 +49,10 @@ async function buildWorkflowsForRun(options) {
47
49
  verbose: options.verbose,
48
50
  onProgressEvent: progress.handleEvent
49
51
  });
50
- const filtered = (await readWorkflowsFromDisk(outDir)).filter((wf) => wf.manifestData.id === options.workflow || wf.name === options.workflow);
52
+ const filtered = (await readWorkflowsFromDisk(outDir)).filter((wf) => wf.manifestData.id === options.workflow);
51
53
  if (filtered.length === 0) {
52
- const availableNames = result.artifacts.map((a) => a.manifest.name);
53
- throw new WorkflowNotFoundError(options.workflow, availableNames);
54
+ const availableIds = result.artifacts.map((artifact) => artifact.manifest.id).filter((id) => typeof id === "string" && id.length > 0);
55
+ throw new WorkflowNotFoundError(options.workflow, availableIds);
54
56
  }
55
57
  return filtered;
56
58
  } finally {
@@ -70,8 +72,9 @@ function validateInputWithFirstBuild(options, input, builds) {
70
72
  function renderBuildSuccessMessage(builds) {
71
73
  const first = builds[0];
72
74
  if (!first) return;
73
- if (builds.length > 1) ui.success(`Built ${builds.length} workflow(s) with name "${first.name}"`);
74
- else ui.success(`Built ${first.name} (${formatBytes(first.bundleSize)})`);
75
+ const label = first.manifestData.id ?? first.name;
76
+ if (builds.length > 1) ui.success(`Built ${builds.length} workflow(s) with id "${label}"`);
77
+ else ui.success(`Built ${label} (${formatBytes(first.bundleSize)})`);
75
78
  }
76
79
  /**
77
80
  * Render completion success message (single or multi).
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui } from "./keystroke.mjs";
4
- import { a as validateApiKey, i as requireClient } from "./context-sgKhRc5v.mjs";
3
+ import { p as ui } from "./keystroke.mjs";
4
+ import { a as validateApiKey, i as requireClient } from "./context-Brc9VGV9.mjs";
5
5
  //#region src/commands/auth/test.handler.ts
6
6
  async function handleAuthTest(_options, ctx) {
7
7
  const result = await validateApiKey(requireClient(ctx));
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { D as CliExitError, a as ui, c as getProcessEnv, j as throwReportedCliExit, y as toErrorMessage } from "./keystroke.mjs";
4
- import { t as Credentials } from "./dist-Dw7gCE7y.mjs";
3
+ import { A as CliExitError, P as throwReportedCliExit, S as toErrorMessage, c as getProcessEnv, p as ui } from "./keystroke.mjs";
4
+ import { t as Credentials } from "./dist-B5jy238v.mjs";
5
5
  import { t as assertWorkflowProjectRoot } from "./project-config-DudGRFPO.mjs";
6
- import { i as writeJson } from "./output-BWcVRt-T.mjs";
7
- import { i as requireClient, t as assertProjectConfigMatchesAuthenticatedOrg } from "./context-sgKhRc5v.mjs";
8
- import { a as readManifestsFromOutDir } from "./dist-CTEtWDW4.mjs";
9
- import { t as requireWorkflowsDir } from "./resolve-project-E9mrh_el.mjs";
10
- import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-Begvjfq8.mjs";
11
- import { t as lookupCurrentDeploymentWorkflow } from "./current-deployment-workflow-B1VQCYC-.mjs";
12
- import { n as resolveInput, o as validateInputOrExit, t as pollForCompletion } from "./run-polling-DawiBus-.mjs";
6
+ import { i as writeJson } from "./output-BPydP5tG.mjs";
7
+ import { i as requireClient, t as assertProjectConfigMatchesAuthenticatedOrg } from "./context-Brc9VGV9.mjs";
8
+ import { a as readManifestsFromOutDir } from "./dist-BmbFJq8U.mjs";
9
+ import { t as requireWorkflowsDir } from "./resolve-project-CoCN9xfi.mjs";
10
+ import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-Db6at6IA.mjs";
11
+ import { t as lookupCurrentDeploymentWorkflow } from "./current-deployment-workflow-CknsHF5T.mjs";
12
+ import { n as resolveInput, o as validateInputOrExit, t as pollForCompletion } from "./run-polling-htHWhG0T.mjs";
13
13
  import * as path$1 from "node:path";
14
14
  import path from "node:path";
15
15
  import * as os from "node:os";
@@ -41,7 +41,7 @@ function createTestWorkflowContext(options = {}) {
41
41
  };
42
42
  }
43
43
  //#endregion
44
- //#region ../../packages/core/dist/chunks/execution-scope-BCDb3CU7.mjs
44
+ //#region ../../packages/core/dist/chunks/execution-scope-C0XN_QSm.mjs
45
45
  const SCOPE_STACK_KEY = "__ks_execution_scope_stack__";
46
46
  function getScopeStack() {
47
47
  const g = globalThis;
@@ -75,7 +75,7 @@ function setExecutionScopeStepCredentialResolver(resolver) {
75
75
  scope.stepCredentialResolver = resolver;
76
76
  }
77
77
  //#endregion
78
- //#region ../../packages/core/dist/chunks/credential-resolver-registry-BRH30wCz.mjs
78
+ //#region ../../packages/core/dist/chunks/credential-resolver-registry-DDCfrXbA.mjs
79
79
  function registerOperationContext(registry) {
80
80
  pushExecutionScopeStepContext(registry.getOperationContext);
81
81
  }
@@ -89,7 +89,7 @@ function clearOperationCredentialResolver() {
89
89
  setExecutionScopeStepCredentialResolver(void 0);
90
90
  }
91
91
  //#endregion
92
- //#region ../../packages/core/dist/chunks/context-registry-DqNWcTgK.mjs
92
+ //#region ../../packages/core/dist/chunks/context-registry-XkpuCrWY.mjs
93
93
  function registerRuntime(registry) {
94
94
  setExecutionScopeWorkflowRuntime(registry.getRuntime);
95
95
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { n as readOptionalJsonSchemaKeys } from "./declared-credential-requirements-B6h4WRv4.mjs";
4
4
  import { t as __exportAll } from "./rolldown-runtime-twds-ZHy-RuJszab7.mjs";
5
- import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-DGK5XTQp.mjs";
6
- import { r as formatEnvAccessError, t as createEnvAccessPlugin } from "./detect-env-access-CwkOYeYM-COq4U-4Y.mjs";
5
+ import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-I07NYwfH.mjs";
6
+ import { r as formatEnvAccessError, t as createEnvAccessPlugin } from "./detect-env-access-CwkOYeYM-r4aynBU0.mjs";
7
7
  import { createHash } from "node:crypto";
8
8
  import { rolldown } from "rolldown";
9
9
  //#region ../../packages/workflow-builder/dist/trigger-artifacts-BcRScRSp.mjs
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { t as JsonSchemaSchema } from "./common-AK0q0Oz0.mjs";
4
- import { c as TriggerSourceSchema, i as IdempotencyKeyConfigSchema, l as TriggerTypeSchema, s as TriggerCredentialRequirementsSchema } from "./credential-requirements-D0mavK8j-CFMf0Xwu.mjs";
4
+ import { c as TriggerSourceSchema, i as IdempotencyKeyConfigSchema, l as TriggerTypeSchema, s as TriggerCredentialRequirementsSchema } from "./credential-requirements-B5Alhu1v-DanlSKnT.mjs";
5
5
  import { z } from "zod";
6
6
  //#region ../../packages/shared-types/src/workflows/build-output/trigger-manifest.ts
7
7
  const TriggerBuildFunctionSchema = z.object({
@@ -1,14 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { t as createTypedCommand } from "./commander-BlrSdFcu.mjs";
3
+ import { t as createTypedCommand } from "./commander-B_8QwPpe.mjs";
4
+ import { t as PackageManagerValues } from "./package-manager-BwJ6muas.mjs";
4
5
  import { z } from "zod";
5
6
  //#region src/commands/upgrade/upgrade.command.ts
6
- const PackageManagerSchema = z.enum([
7
- "npm",
8
- "pnpm",
9
- "yarn",
10
- "bun"
11
- ]);
7
+ const PackageManagerSchema = z.enum(PackageManagerValues);
12
8
  const UpgradeOptionsSchema = z.object({
13
9
  packageManager: PackageManagerSchema.default("npm").describe("Package manager to use"),
14
10
  to: z.string().min(1).default("latest").describe("Package version or dist tag to install"),
@@ -34,7 +30,7 @@ function createUpgradeCommand() {
34
30
  description: "Upgrade the Keystroke CLI to the latest published version",
35
31
  schema: UpgradeOptionsSchema,
36
32
  optionsConfig: UPGRADE_OPTIONS_CONFIG,
37
- loadHandler: async () => (await import("./upgrade.handler-DSZuw7-9.mjs")).handleUpgrade
33
+ loadHandler: async () => (await import("./upgrade.handler-DsFeAFF4.mjs")).handleUpgrade
38
34
  });
39
35
  }
40
36
  //#endregion
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { A as CliExitError, P as throwReportedCliExit, S as toErrorMessage, a as CLI_PACKAGE_NAME, p as ui } from "./keystroke.mjs";
4
+ import { a as readYarnMajorVersion } from "./package-manager-BwJ6muas.mjs";
5
+ import { spawn } from "node:child_process";
6
+ //#region src/commands/upgrade/upgrade.handler.ts
7
+ function buildUpgradeCommand(options) {
8
+ const { packageManager, to } = options;
9
+ const packageSpec = `${CLI_PACKAGE_NAME}@${to}`;
10
+ if (packageManager === "npm") return {
11
+ command: "npm",
12
+ args: [
13
+ "install",
14
+ "--global",
15
+ packageSpec
16
+ ]
17
+ };
18
+ else if (packageManager === "pnpm") return {
19
+ command: "pnpm",
20
+ args: [
21
+ "add",
22
+ "--global",
23
+ packageSpec
24
+ ]
25
+ };
26
+ else if (packageManager === "yarn") return {
27
+ command: "yarn",
28
+ args: [
29
+ "global",
30
+ "add",
31
+ packageSpec
32
+ ]
33
+ };
34
+ else if (packageManager === "bun") return {
35
+ command: "bun",
36
+ args: [
37
+ "add",
38
+ "--global",
39
+ packageSpec
40
+ ]
41
+ };
42
+ else return assertNever(packageManager);
43
+ }
44
+ function renderUpgradeCommand(upgradeCommand) {
45
+ return [upgradeCommand.command, ...upgradeCommand.args].map(shellToken).join(" ");
46
+ }
47
+ async function handleUpgrade(options, _ctx) {
48
+ const { packageManager, dryRun, to } = options;
49
+ await assertYarnClassicSupported(packageManager);
50
+ const upgradeCommand = buildUpgradeCommand({
51
+ packageManager,
52
+ to,
53
+ dryRun
54
+ });
55
+ const renderedCommand = renderUpgradeCommand(upgradeCommand);
56
+ if (dryRun) {
57
+ ui.text(renderedCommand);
58
+ return;
59
+ }
60
+ ui.header(`Upgrading Keystroke CLI with ${packageManager}...`);
61
+ ui.hint(renderedCommand);
62
+ const exitCode = await runCommand(upgradeCommand);
63
+ if (exitCode !== 0) throwReportedCliExit(`CLI upgrade failed with exit code ${exitCode}.`);
64
+ ui.success("Keystroke CLI upgrade complete.");
65
+ }
66
+ async function assertYarnClassicSupported(packageManager) {
67
+ if (packageManager === "npm") return;
68
+ if (packageManager === "pnpm") return;
69
+ if (packageManager === "bun") return;
70
+ if (packageManager === "yarn") {
71
+ const yarnMajor = await readYarnMajorVersion();
72
+ if (yarnMajor !== null && yarnMajor !== 1) throwReportedCliExit("Yarn 2+ does not support `yarn global add`. Use `--package-manager npm` or `--package-manager pnpm` instead.");
73
+ return;
74
+ }
75
+ return assertNever(packageManager);
76
+ }
77
+ function runCommand({ command, args }) {
78
+ return new Promise((resolve, reject) => {
79
+ const child = spawn(command, args, {
80
+ stdio: "inherit",
81
+ shell: process.platform === "win32"
82
+ });
83
+ child.on("error", (error) => {
84
+ reject(new CliExitError(`Failed to start upgrade command: ${toErrorMessage(error)}`, {
85
+ cause: error,
86
+ reported: true
87
+ }));
88
+ });
89
+ child.on("close", (code) => resolve(code ?? 1));
90
+ });
91
+ }
92
+ function shellToken(value) {
93
+ return /^[A-Za-z0-9_./:@=-]+$/.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
94
+ }
95
+ function assertNever(value) {
96
+ throw new Error(`Unsupported package manager: ${String(value)}`);
97
+ }
98
+ //#endregion
99
+ export { handleUpgrade };
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui, c as getProcessEnv, j as throwReportedCliExit, y as toErrorMessage } from "./keystroke.mjs";
3
+ import { P as throwReportedCliExit, S as toErrorMessage, c as getProcessEnv, p as ui } from "./keystroke.mjs";
4
4
  import { t as assertWorkflowProjectRoot } from "./project-config-DudGRFPO.mjs";
5
- import { a as writeJsonError, i as writeJson } from "./output-BWcVRt-T.mjs";
6
- import { i as requireClient } from "./context-sgKhRc5v.mjs";
7
- import { a as readManifestsFromOutDir, t as collectCredentialFingerprintMapFromProjectDist } from "./dist-CTEtWDW4.mjs";
8
- import { t as requireWorkflowsDir } from "./resolve-project-E9mrh_el.mjs";
9
- import { t as getIntegrationCatalog } from "./integration-catalog-CiZ62hb_.mjs";
10
- import { t as readCredentialEnvMap } from "./credential-env-map-CRs0llf0.mjs";
11
- import { a as verifyCredentialResolvable, i as validateManualCredentialWithHook, n as resolveCredentialValuesFromEnv, r as uploadCredential, t as groupCredentialRequirements } from "./credentials-DKrSaaLw.mjs";
12
- import { n as renderCredentialSchemaMismatchText, r as writeCredentialSchemaMismatchJson, t as isCredentialSchemaMismatchErrorLike } from "./credential-schema-mismatch-ClQgEVtO.mjs";
5
+ import { a as writeJsonError, i as writeJson } from "./output-BPydP5tG.mjs";
6
+ import { i as requireClient } from "./context-Brc9VGV9.mjs";
7
+ import { a as readManifestsFromOutDir, t as collectCredentialFingerprintMapFromProjectDist } from "./dist-BmbFJq8U.mjs";
8
+ import { t as requireWorkflowsDir } from "./resolve-project-CoCN9xfi.mjs";
9
+ import { t as getIntegrationCatalog } from "./integration-catalog-mZs6EAlN.mjs";
10
+ import { t as readCredentialEnvMap } from "./credential-env-map-5a41jLwM.mjs";
11
+ import { a as verifyCredentialResolvable, i as validateManualCredentialWithHook, n as resolveCredentialValuesFromEnv, r as uploadCredential, t as groupCredentialRequirements } from "./credentials-DtwLbee6.mjs";
12
+ import { n as renderCredentialSchemaMismatchText, r as writeCredentialSchemaMismatchJson, t as isCredentialSchemaMismatchErrorLike } from "./credential-schema-mismatch-CStYUB2h.mjs";
13
13
  import * as path$1 from "node:path";
14
14
  import { confirm, isCancel } from "@clack/prompts";
15
15
  //#region src/commands/credentials/upload/upload.handler.ts
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui } from "./keystroke.mjs";
4
- import { i as writeJson } from "./output-BWcVRt-T.mjs";
5
- import { i as requireClient } from "./context-sgKhRc5v.mjs";
6
- import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CSZj4XlH.mjs";
3
+ import { p as ui } from "./keystroke.mjs";
4
+ import { i as writeJson } from "./output-BPydP5tG.mjs";
5
+ import { i as requireClient } from "./context-Brc9VGV9.mjs";
6
+ import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-D01Gw8-M.mjs";
7
7
  //#region src/commands/admin/users.get.handler.ts
8
8
  async function handleAdminUsersGet(options, ctx) {
9
9
  const client = requireClient(ctx);
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { a as ui } from "./keystroke.mjs";
4
- import { i as writeJson } from "./output-BWcVRt-T.mjs";
5
- import { i as requireClient } from "./context-sgKhRc5v.mjs";
6
- import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CSZj4XlH.mjs";
3
+ import { p as ui } from "./keystroke.mjs";
4
+ import { i as writeJson } from "./output-BPydP5tG.mjs";
5
+ import { i as requireClient } from "./context-Brc9VGV9.mjs";
6
+ import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-D01Gw8-M.mjs";
7
7
  import Table from "cli-table3";
8
8
  //#region src/commands/admin/users.list.handler.ts
9
9
  async function handleAdminUsersList(options, ctx) {