@keystrokehq/cli 0.0.3 → 0.0.4

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 (94) hide show
  1. package/README.md +10 -0
  2. package/dist/{accept.handler-DFtM0IuO.mjs → accept.handler-CudtwdDV.mjs} +1 -1
  3. package/dist/{admin-D_7tenRC.mjs → admin-ByNq50FH.mjs} +9 -9
  4. package/dist/{agents-DMEo-6QB.mjs → agents-DbekD_Vx.mjs} +2 -2
  5. package/dist/{api-keys-BThGvtdn.mjs → api-keys-kvwq9Jb4.mjs} +5 -5
  6. package/dist/{auth-CY0Gg9sN.mjs → auth-DS3C07ib.mjs} +3 -3
  7. package/dist/{build-agents-DfbiMZ_e-CRnzruSu.mjs → build-agents-DfbiMZ_e-in-if4_C.mjs} +2 -2
  8. package/dist/{build-tasks-O1jYtlv1-Y65uGWuz.mjs → build-tasks-O1jYtlv1-B2Dm4hFj.mjs} +2 -2
  9. package/dist/{build-workflows-3fdvdHHf-DJ_lH1NH.mjs → build-workflows-3fdvdHHf-Bg5XV7hM.mjs} +2 -2
  10. package/dist/{build.handler-Tb3IpABI.mjs → build.handler-BzQRnkC3.mjs} +1 -1
  11. package/dist/{clear.handler-YS8gPriq.mjs → clear.handler-U9n_V1IM.mjs} +1 -1
  12. package/dist/{commander-DZ3F3CVq.mjs → commander-pxSPDCZ4.mjs} +1 -1
  13. package/dist/{connect-DpQgYg8z.mjs → connect-B_uc0wqI.mjs} +2 -2
  14. package/dist/{connect.handler-DuRr_yyN.mjs → connect.handler-VJgm2ZQG.mjs} +1 -1
  15. package/dist/{context-Y1f1hGYy.mjs → context-D-YKFNxL.mjs} +1 -1
  16. package/dist/{create.handler-uNG3I4wS.mjs → create.handler-d9nfcKfp.mjs} +1 -1
  17. package/dist/{credentials-UpgEcaub.mjs → credentials-CL_PCuhM.mjs} +4 -4
  18. package/dist/{current-deployment-workflow-M8GEIHxv.mjs → current-deployment-workflow-BRYuEubW.mjs} +1 -1
  19. package/dist/{current.handler-BqPUKCvn.mjs → current.handler-vJG2Dohx.mjs} +1 -1
  20. package/dist/{delete.handler-CJTHVZaz.mjs → delete.handler-RsYTkJLV.mjs} +1 -1
  21. package/dist/{deploy-Gw0KPrkf.mjs → deploy-BE3F62Mz.mjs} +2 -2
  22. package/dist/{deploy.handler-zzFAt7pp.mjs → deploy.handler-Dlyd8Zqs.mjs} +8 -8
  23. package/dist/{diff.handler--zdSkUnK.mjs → diff.handler-CH0xP8pk.mjs} +2 -2
  24. package/dist/{env.handler-d4sJ706C.mjs → env.handler-BkCO2vjR.mjs} +2 -2
  25. package/dist/{init-C0sps8R7.mjs → init-CWFlBuxT.mjs} +2 -2
  26. package/dist/{init.handler-DSW6XFZn.mjs → init.handler-HRdgViGH.mjs} +1 -1
  27. package/dist/{inspect.handler-DbN0ZVTh.mjs → inspect.handler-DRMKUJsh.mjs} +2 -2
  28. package/dist/{integration-catalog-DFlytKJS.mjs → integration-catalog-ClP7YGqM.mjs} +1 -1
  29. package/dist/{integrations-Dcadds2b.mjs → integrations-CoBzLNEe.mjs} +3 -3
  30. package/dist/{invites-DvsxTRAb.mjs → invites-BmNy1RHp.mjs} +4 -4
  31. package/dist/{invites.list.handler-B5quln3m.mjs → invites.list.handler-ICP2V3p4.mjs} +1 -1
  32. package/dist/{invites.resend.handler-CSpj7bQ5.mjs → invites.resend.handler-BGaTTMka.mjs} +1 -1
  33. package/dist/{invites.revoke.handler-_hdEkBdO.mjs → invites.revoke.handler-DBwF5Lxc.mjs} +1 -1
  34. package/dist/keystroke.d.mts +0 -0
  35. package/dist/keystroke.mjs +27 -19
  36. package/dist/{list.handler-08GY-wnx.mjs → list.handler-B2bN8NsQ.mjs} +1 -1
  37. package/dist/{list.handler-BRq-nScx.mjs → list.handler-BXTGPazY.mjs} +1 -1
  38. package/dist/{list.handler-DSPr0OxS.mjs → list.handler-BjihvxHn.mjs} +1 -1
  39. package/dist/{list.handler-CWO6DExh.mjs → list.handler-Vv9KmhB9.mjs} +2 -2
  40. package/dist/{list.handler-DLl8ca6F.mjs → list.handler-b4qYQtwn.mjs} +1 -1
  41. package/dist/{list.handler-20v4uRMk.mjs → list.handler-rnyzLJDy.mjs} +1 -1
  42. package/dist/listen-DVV1fp5c.mjs +25 -0
  43. package/dist/listen.handler-CyFpUSOu.mjs +212 -0
  44. package/dist/{logs-D_48skmi.mjs → logs-BRticZ00.mjs} +3 -3
  45. package/dist/{logs.handler-4ctMVYMj.mjs → logs.handler-CsnG7Bb0.mjs} +2 -2
  46. package/dist/{members.add.handler-Dq_giQ8g.mjs → members.add.handler-CH0RhbgE.mjs} +1 -1
  47. package/dist/{members.invite.handler-v404bUsq.mjs → members.invite.handler-CYB7RQ9A.mjs} +1 -1
  48. package/dist/{members.list.handler-D6TE0yp8.mjs → members.list.handler-DrDtmMei.mjs} +1 -1
  49. package/dist/{members.remove.handler-BhQ3cyeR.mjs → members.remove.handler-uGoZt2Me.mjs} +1 -1
  50. package/dist/{members.update.handler-BVy2cv1K.mjs → members.update.handler-DXCWkzOc.mjs} +1 -1
  51. package/dist/{org-CkRr-f3S.mjs → org-GdHhuSNk.mjs} +15 -15
  52. package/dist/{orgs.create.handler-swGnT2ce.mjs → orgs.create.handler-5AaPgTZV.mjs} +1 -1
  53. package/dist/{orgs.get.handler-ClAqYTH0.mjs → orgs.get.handler-BTfopRVm.mjs} +1 -1
  54. package/dist/{orgs.list.handler-D-ptz8It.mjs → orgs.list.handler-DKJgs6x0.mjs} +1 -1
  55. package/dist/{paused.handler-B3aVqw-m.mjs → paused.handler-BUifVTyQ.mjs} +1 -1
  56. package/dist/{projects-yA9AAaDM.mjs → projects-BjnCG-pc.mjs} +4 -4
  57. package/dist/{runs-B8mW4PqP.mjs → runs-2BdRfql3.mjs} +2 -2
  58. package/dist/{skills.command-DWxcc3Ui.mjs → skills.command-mMs4o12N.mjs} +3 -3
  59. package/dist/{src-J09NGJ6Z.mjs → src-CBL7AJ0H.mjs} +11 -0
  60. package/dist/{switch.handler-C4hgbhcH.mjs → switch.handler-DV0wiJP8.mjs} +1 -1
  61. package/dist/{sync-CL6zXiiA.mjs → sync-D098Vbv2.mjs} +2 -2
  62. package/dist/{sync.handler-D1uF8E8I.mjs → sync.handler-BocldSG_.mjs} +2 -2
  63. package/dist/{task-target-build-DTzz4fpG.mjs → task-target-build-Di8gflnj.mjs} +3 -3
  64. package/dist/task-target-deploy-runner.d.mts +0 -0
  65. package/dist/task-target-deploy-runner.mjs +4 -4
  66. package/dist/{test-BsTLXIPB.mjs → test-BZt0Duhs.mjs} +6 -6
  67. package/dist/{test.handler-D25kziPi.mjs → test.handler-iCUotLes.mjs} +1 -1
  68. package/dist/{trigger-artifacts-B3OCTX9K-DG-FGGJT.mjs → trigger-artifacts-B3OCTX9K-Cgt51KLh.mjs} +2 -2
  69. package/dist/{try-deploy.handler-2aX5TmLk.mjs → try-deploy.handler-YDOirkk1.mjs} +3 -3
  70. package/dist/upgrade-Bdez-X6_.mjs +41 -0
  71. package/dist/upgrade.handler-DhH_Cuza.mjs +80 -0
  72. package/dist/{upload.handler-CqProKVJ.mjs → upload.handler-BmqZAPxZ.mjs} +2 -2
  73. package/dist/{users.get.handler-C_d2GWKX.mjs → users.get.handler-uoEgEwI-.mjs} +1 -1
  74. package/dist/{users.list.handler-DXAsO8Yk.mjs → users.list.handler-DLWPOIHD.mjs} +1 -1
  75. package/dist/{users.set-role.handler-Bn_yV4RI.mjs → users.set-role.handler-BCJhTsyb.mjs} +1 -1
  76. package/dist/{validate.handler-CGD6GttR.mjs → validate.handler-ROzzUI85.mjs} +1 -1
  77. package/dist/{workflow-build-BcaIdRR6.mjs → workflow-build-DD8TLlPu.mjs} +5 -5
  78. package/dist/{workflow-bundler-BzHk73PM-Cde7cKiU.mjs → workflow-bundler-BzHk73PM-Bt-poFqX.mjs} +1 -1
  79. package/dist/{workflows-S-gbfw8f.mjs → workflows-DypSJM0t.mjs} +12 -12
  80. package/package.json +32 -31
  81. package/LICENSE +0 -21
  82. /package/dist/{build-metadata-zidV9Cai-RgG4ndIH.mjs → build-metadata-zidV9Cai-BAS0FMxT.mjs} +0 -0
  83. /package/dist/{clear-cache.handler-BEbPz5Ej.mjs → clear-cache.handler-BDV-a3ku.mjs} +0 -0
  84. /package/dist/{clear.handler-CtOZ4aRn.mjs → clear.handler-Dh6QoVO1.mjs} +0 -0
  85. /package/dist/{deploy-CdnaZY3s.mjs → deploy-B_bkUlIL.mjs} +0 -0
  86. /package/dist/{detect-env-access-CwkOYeYM-h2W05D_Q.mjs → detect-env-access-CwkOYeYM-CsrSOCcj.mjs} +0 -0
  87. /package/dist/{list.handler-DAiJtW20.mjs → list.handler-DO0PnyWP.mjs} +0 -0
  88. /package/dist/{logs.handler-C3QnSCaH.mjs → logs.handler-ddQu_MXN.mjs} +0 -0
  89. /package/dist/{options-Dn9t3K4a.mjs → options-BhB9qA5P.mjs} +0 -0
  90. /package/dist/{read-credential-keys-77a91T8M-CAJLnMRi.mjs → read-credential-keys-77a91T8M-aLuQvlIq.mjs} +0 -0
  91. /package/dist/{run-polling-CTzhTgyN.mjs → run-polling-CF9OeLWl.mjs} +0 -0
  92. /package/dist/{skills-sync.handler-C2faeat-.mjs → skills-sync.handler-IB73kEeA.mjs} +0 -0
  93. /package/dist/{skills.handler-8KCSF7wp.mjs → skills.handler-JauTJV1C.mjs} +0 -0
  94. /package/dist/{task-target-deploy-BPLlP__P.mjs → task-target-deploy-BzGRNDiv.mjs} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/org/invites.revoke.handler.ts
8
8
  async function handleOrgInvitesRevoke(options, ctx) {
File without changes
@@ -9,7 +9,7 @@ import * as path$1 from "node:path";
9
9
  import { z } from "zod";
10
10
  import { log } from "@clack/prompts";
11
11
  //#region package.json
12
- var version = "0.0.3";
12
+ var version = "0.0.4";
13
13
  //#endregion
14
14
  //#region src/command-registry.ts
15
15
  const ROOT_OPTIONS_WITH_VALUES = new Set([
@@ -21,76 +21,84 @@ const ROOT_VERSION_FLAGS = new Set(["-V", "--version"]);
21
21
  const lazyCommandDefinitions = [
22
22
  {
23
23
  name: "agents",
24
- loadCommand: async () => (await import("./agents-DMEo-6QB.mjs")).createAgentsCommand()
24
+ loadCommand: async () => (await import("./agents-DbekD_Vx.mjs")).createAgentsCommand()
25
25
  },
26
26
  {
27
27
  name: "admin",
28
- loadCommand: async () => (await import("./admin-D_7tenRC.mjs")).createAdminCommand()
28
+ loadCommand: async () => (await import("./admin-ByNq50FH.mjs")).createAdminCommand()
29
29
  },
30
30
  {
31
31
  name: "api-keys",
32
- loadCommand: async () => (await import("./api-keys-BThGvtdn.mjs")).createApiKeysCommand()
32
+ loadCommand: async () => (await import("./api-keys-kvwq9Jb4.mjs")).createApiKeysCommand()
33
33
  },
34
34
  {
35
35
  name: "auth",
36
- loadCommand: async () => (await import("./auth-CY0Gg9sN.mjs")).createAuthCommand()
36
+ loadCommand: async () => (await import("./auth-DS3C07ib.mjs")).createAuthCommand()
37
37
  },
38
38
  {
39
39
  name: "connect",
40
- loadCommand: async () => (await import("./connect-DpQgYg8z.mjs")).createConnectCommand()
40
+ loadCommand: async () => (await import("./connect-B_uc0wqI.mjs")).createConnectCommand()
41
41
  },
42
42
  {
43
43
  name: "credentials",
44
- loadCommand: async () => (await import("./credentials-UpgEcaub.mjs")).createCredentialsCommand(),
44
+ loadCommand: async () => (await import("./credentials-CL_PCuhM.mjs")).createCredentialsCommand(),
45
45
  copyInheritedSettings: true
46
46
  },
47
47
  {
48
48
  name: "org",
49
- loadCommand: async () => (await import("./org-CkRr-f3S.mjs")).createOrgCommand()
49
+ loadCommand: async () => (await import("./org-GdHhuSNk.mjs")).createOrgCommand()
50
50
  },
51
51
  {
52
52
  name: "deploy",
53
- loadCommand: async () => (await import("./deploy-Gw0KPrkf.mjs")).createDeployCommand()
53
+ loadCommand: async () => (await import("./deploy-BE3F62Mz.mjs")).createDeployCommand()
54
54
  },
55
55
  {
56
56
  name: "init",
57
- loadCommand: async () => (await import("./init-C0sps8R7.mjs")).createInitCommand()
57
+ loadCommand: async () => (await import("./init-CWFlBuxT.mjs")).createInitCommand()
58
58
  },
59
59
  {
60
60
  name: "integrations",
61
- loadCommand: async () => (await import("./integrations-Dcadds2b.mjs")).createIntegrationsCommand()
61
+ loadCommand: async () => (await import("./integrations-CoBzLNEe.mjs")).createIntegrationsCommand()
62
62
  },
63
63
  {
64
64
  name: "invites",
65
- loadCommand: async () => (await import("./invites-DvsxTRAb.mjs")).createInvitesCommand()
65
+ loadCommand: async () => (await import("./invites-BmNy1RHp.mjs")).createInvitesCommand()
66
66
  },
67
67
  {
68
68
  name: "logs",
69
- loadCommand: async () => (await import("./logs-D_48skmi.mjs")).createLogsCommand()
69
+ loadCommand: async () => (await import("./logs-BRticZ00.mjs")).createLogsCommand()
70
+ },
71
+ {
72
+ name: "listen",
73
+ loadCommand: async () => (await import("./listen-DVV1fp5c.mjs")).createListenCommand()
70
74
  },
71
75
  {
72
76
  name: "projects",
73
- loadCommand: async () => (await import("./projects-yA9AAaDM.mjs")).createProjectsCommand()
77
+ loadCommand: async () => (await import("./projects-BjnCG-pc.mjs")).createProjectsCommand()
74
78
  },
75
79
  {
76
80
  name: "runs",
77
- loadCommand: async () => (await import("./runs-B8mW4PqP.mjs")).createRunsCommand()
81
+ loadCommand: async () => (await import("./runs-2BdRfql3.mjs")).createRunsCommand()
78
82
  },
79
83
  {
80
84
  name: "skills",
81
- loadCommand: async () => (await import("./skills.command-DWxcc3Ui.mjs")).createSkillsCommand()
85
+ loadCommand: async () => (await import("./skills.command-mMs4o12N.mjs")).createSkillsCommand()
82
86
  },
83
87
  {
84
88
  name: "sync",
85
- loadCommand: async () => (await import("./sync-CL6zXiiA.mjs")).createSyncCommand()
89
+ loadCommand: async () => (await import("./sync-D098Vbv2.mjs")).createSyncCommand()
86
90
  },
87
91
  {
88
92
  name: "test",
89
- loadCommand: async () => (await import("./test-BsTLXIPB.mjs")).createTestCommand()
93
+ loadCommand: async () => (await import("./test-BZt0Duhs.mjs")).createTestCommand()
94
+ },
95
+ {
96
+ name: "upgrade",
97
+ loadCommand: async () => (await import("./upgrade-Bdez-X6_.mjs")).createUpgradeCommand()
90
98
  },
91
99
  {
92
100
  name: "workflows",
93
- loadCommand: async () => (await import("./workflows-S-gbfw8f.mjs")).createWorkflowsCommand()
101
+ loadCommand: async () => (await import("./workflows-DypSJM0t.mjs")).createWorkflowsCommand()
94
102
  }
95
103
  ];
96
104
  function selectCommandRegistration(argv, commandNames = new Set(lazyCommandDefinitions.map((definition) => definition.name))) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
4
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
5
5
  //#region src/commands/org/list.handler.ts
6
6
  async function handleOrgList(_options, ctx) {
7
7
  const { user } = await requireClient(ctx).users.getMe();
@@ -5,7 +5,7 @@ import { d as trackProject } from "./dist-BF6r1hfv.mjs";
5
5
  import { i as writeJson } from "./output-q4KljAhu.mjs";
6
6
  import { t as requireWorkflowsDir } from "./resolve-project-DgfftdPm.mjs";
7
7
  import { t as createSpinnerProgress } from "./spinner-progress-bvKd1jXc.mjs";
8
- import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-BcaIdRR6.mjs";
8
+ import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-DD8TLlPu.mjs";
9
9
  //#region src/commands/workflows/list.handler.ts
10
10
  function formatWorkflow(artifact) {
11
11
  const name = style(artifact.manifest.name, `${ANSI.bold}${ANSI.cyan}`);
@@ -3,7 +3,7 @@
3
3
  import { D as throwReportedCliExit, t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
5
  import { n as getProcessEnv } from "./env-YTZGKGIu.mjs";
6
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
6
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
7
7
  import { a as readManifestsFromOutDir } from "./dist-C2Dq_nx3.mjs";
8
8
  import { n as resolveWorkflowsDir } from "./resolve-project-DgfftdPm.mjs";
9
9
  import { t as readCredentialEnvMap } from "./credential-env-map-C8P7uTD-.mjs";
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { h as toErrorMessage, m as isNetworkError, o as ANSI, s as style, t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
6
- import { t as getIntegrationCatalog } from "./integration-catalog-DFlytKJS.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
+ import { t as getIntegrationCatalog } from "./integration-catalog-ClP7YGqM.mjs";
7
7
  import Table from "cli-table3";
8
8
  //#region src/commands/integrations/list.handler.ts
9
9
  function summarizeConnections(entry, connections) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  import Table from "cli-table3";
8
8
  //#region src/commands/invites/list.handler.ts
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { D as throwReportedCliExit, h as toErrorMessage, o as ANSI, s as style, t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import Table from "cli-table3";
7
7
  //#region src/commands/api-keys/list.handler.ts
8
8
  async function handleApiKeysList(_options, ctx) {
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-q4KljAhu.mjs";
4
+ import { t as createTypedCommand } from "./commander-pxSPDCZ4.mjs";
5
+ import { z } from "zod";
6
+ //#region src/commands/listen/listen.command.ts
7
+ const ListenOptionsSchema = JsonOptionSchema.extend({ timeout: z.coerce.number().int().min(1).default(300) });
8
+ const LISTEN_OPTIONS_CONFIG = {
9
+ ...JSON_OPTION_CONFIG,
10
+ timeout: {
11
+ flag: "--timeout <seconds>",
12
+ description: "Maximum time to wait before cancelling the listen session (default: 300)"
13
+ }
14
+ };
15
+ function createListenCommand() {
16
+ return createTypedCommand({
17
+ name: "listen",
18
+ description: "Listen for one incoming request and print its body",
19
+ schema: ListenOptionsSchema,
20
+ optionsConfig: LISTEN_OPTIONS_CONFIG,
21
+ loadHandler: async () => (await import("./listen.handler-CyFpUSOu.mjs")).handleListen
22
+ });
23
+ }
24
+ //#endregion
25
+ export { createListenCommand };
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { C as CliExitError, D as throwReportedCliExit, h as toErrorMessage, o as ANSI, s as style, t as ui } from "./keystroke.mjs";
4
+ import { a as writeJsonError, i as writeJson } from "./output-q4KljAhu.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
+ import { n as sleep } from "./run-polling-CF9OeLWl.mjs";
7
+ import { spawn } from "node:child_process";
8
+ //#region src/lib/clipboard.ts
9
+ function getClipboardCommands() {
10
+ if (process.platform === "darwin") return [{
11
+ command: "pbcopy",
12
+ args: []
13
+ }];
14
+ if (process.platform === "win32") return [{
15
+ command: "clip",
16
+ args: [],
17
+ windowsHide: true
18
+ }];
19
+ return [
20
+ {
21
+ command: "wl-copy",
22
+ args: []
23
+ },
24
+ {
25
+ command: "xclip",
26
+ args: ["-selection", "clipboard"]
27
+ },
28
+ {
29
+ command: "xsel",
30
+ args: ["--clipboard", "--input"]
31
+ }
32
+ ];
33
+ }
34
+ async function runClipboardCommand(text, command) {
35
+ const child = spawn(command.command, command.args, {
36
+ stdio: [
37
+ "pipe",
38
+ "ignore",
39
+ "ignore"
40
+ ],
41
+ windowsHide: command.windowsHide
42
+ });
43
+ await new Promise((resolve, reject) => {
44
+ let settled = false;
45
+ const rejectOnce = (error) => {
46
+ if (settled) return;
47
+ settled = true;
48
+ reject(error);
49
+ };
50
+ child.once("error", rejectOnce);
51
+ child.once("close", (code) => {
52
+ if (settled) return;
53
+ settled = true;
54
+ if (code === 0) {
55
+ resolve();
56
+ return;
57
+ }
58
+ reject(/* @__PURE__ */ new Error(`Clipboard command "${command.command}" exited with code ${code ?? "unknown"}.`));
59
+ });
60
+ child.stdin.once("error", rejectOnce);
61
+ child.stdin.end(text);
62
+ });
63
+ }
64
+ async function copyToClipboard(text) {
65
+ let lastError;
66
+ for (const command of getClipboardCommands()) try {
67
+ await runClipboardCommand(text, command);
68
+ return;
69
+ } catch (error) {
70
+ lastError = error;
71
+ }
72
+ throw lastError ?? /* @__PURE__ */ new Error("Clipboard copy is unavailable in this environment.");
73
+ }
74
+ //#endregion
75
+ //#region src/commands/listen/listen.handler.ts
76
+ const LISTEN_POLL_INTERVAL_MS = 1e3;
77
+ function formatReceivedPayload(session) {
78
+ if (session.body !== null) return JSON.stringify(session.body, null, 2);
79
+ return session.rawBody ?? "";
80
+ }
81
+ function exitListenError(ctx, message, opts) {
82
+ if (ctx.jsonMode) writeJsonError(message, {
83
+ code: opts?.code,
84
+ hint: opts?.hint,
85
+ cause: opts?.cause
86
+ });
87
+ ui.error(message);
88
+ if (opts?.hint) ui.hint(opts.hint);
89
+ if (opts?.exitCode !== void 0) throw new CliExitError(message, {
90
+ cause: opts.cause,
91
+ exitCode: opts.exitCode,
92
+ reported: true
93
+ });
94
+ throwReportedCliExit(message, { cause: opts?.cause });
95
+ }
96
+ function createInterruptTrap() {
97
+ let interrupted = false;
98
+ let resolveInterrupt;
99
+ const interruptPromise = new Promise((resolve) => {
100
+ resolveInterrupt = resolve;
101
+ });
102
+ const handleInterrupt = () => {
103
+ interrupted = true;
104
+ resolveInterrupt?.();
105
+ };
106
+ process.once("SIGINT", handleInterrupt);
107
+ process.once("SIGTERM", handleInterrupt);
108
+ return {
109
+ get interrupted() {
110
+ return interrupted;
111
+ },
112
+ wait() {
113
+ return interruptPromise;
114
+ },
115
+ dispose() {
116
+ process.off("SIGINT", handleInterrupt);
117
+ process.off("SIGTERM", handleInterrupt);
118
+ }
119
+ };
120
+ }
121
+ async function copyListenUrlBestEffort(url) {
122
+ try {
123
+ await copyToClipboard(url);
124
+ return true;
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+ async function cancelListenSessionBestEffort(client, sessionId) {
130
+ try {
131
+ await client.listen.cancel(sessionId);
132
+ } catch {}
133
+ }
134
+ async function pollForListenSession(params) {
135
+ const deadline = Date.now() + params.timeoutSeconds * 1e3;
136
+ while (Date.now() < deadline) {
137
+ if (params.interrupt.interrupted) exitListenError(params.ctx, "Listen cancelled.", {
138
+ code: "INTERRUPTED",
139
+ exitCode: 130
140
+ });
141
+ const session = await params.client.listen.get(params.sessionId);
142
+ if (session.status === "received") return session;
143
+ if (session.status === "expired") exitListenError(params.ctx, "Listen session expired before a request arrived.", {
144
+ code: "LISTEN_EXPIRED",
145
+ hint: "Run `keystroke listen` again to create a fresh URL."
146
+ });
147
+ if (session.status === "cancelled") exitListenError(params.ctx, "Listen session was cancelled before a request arrived.", { code: "LISTEN_CANCELLED" });
148
+ const remainingMs = deadline - Date.now();
149
+ if (remainingMs <= 0) break;
150
+ await Promise.race([sleep(Math.min(LISTEN_POLL_INTERVAL_MS, remainingMs)), params.interrupt.wait()]);
151
+ }
152
+ if (params.interrupt.interrupted) exitListenError(params.ctx, "Listen cancelled.", {
153
+ code: "INTERRUPTED",
154
+ exitCode: 130
155
+ });
156
+ exitListenError(params.ctx, `Timed out waiting ${params.timeoutSeconds}s for a request.`, {
157
+ code: "LISTEN_TIMEOUT",
158
+ hint: "Re-run `keystroke listen` and trigger the external request before timeout."
159
+ });
160
+ }
161
+ async function handleListen(options, ctx) {
162
+ const client = requireClient(ctx);
163
+ const interrupt = createInterruptTrap();
164
+ let sessionId = null;
165
+ let shouldCancel = false;
166
+ try {
167
+ const session = await client.listen.create();
168
+ sessionId = session.id;
169
+ shouldCancel = true;
170
+ if (!ctx.jsonMode) {
171
+ const copied = await copyListenUrlBestEffort(session.url);
172
+ ui.text(style("Webhook URL", `${ANSI.bold}${ANSI.cyan}`));
173
+ ui.text(session.url);
174
+ ui.br();
175
+ if (copied) ui.text(style("Copied to clipboard.", ANSI.dim));
176
+ else ui.text(style("Highlight the URL to copy it manually.", ANSI.dim));
177
+ ui.text(style("Waiting for first request...", ANSI.dim));
178
+ }
179
+ const received = await pollForListenSession({
180
+ client,
181
+ ctx,
182
+ sessionId: session.id,
183
+ timeoutSeconds: options.timeout,
184
+ interrupt
185
+ });
186
+ shouldCancel = false;
187
+ if (ctx.jsonMode) {
188
+ writeJson(received);
189
+ return;
190
+ }
191
+ ui.br();
192
+ ui.text(style("Request received.", `${ANSI.bold}${ANSI.green}`));
193
+ const payload = formatReceivedPayload(received);
194
+ if (payload.length > 0) {
195
+ ui.br();
196
+ ui.text(payload);
197
+ return;
198
+ }
199
+ ui.hint("Received an empty body.");
200
+ } catch (error) {
201
+ if (shouldCancel && sessionId) await cancelListenSessionBestEffort(client, sessionId);
202
+ if (error instanceof CliExitError) throw error;
203
+ exitListenError(ctx, `Listen failed: ${toErrorMessage(error)}`, {
204
+ code: "LISTEN_FAILED",
205
+ cause: error
206
+ });
207
+ } finally {
208
+ interrupt.dispose();
209
+ }
210
+ }
211
+ //#endregion
212
+ export { handleListen };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
3
+ import { t as createTypedCommand } from "./commander-pxSPDCZ4.mjs";
4
4
  import { z } from "zod";
5
5
  //#region src/commands/logs/logs.command.ts
6
6
  const LogsOptionsSchema = z.object({ count: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of log entries to display") });
@@ -14,13 +14,13 @@ function createLogsCommand() {
14
14
  description: "Display recent CLI log entries",
15
15
  schema: LogsOptionsSchema,
16
16
  optionsConfig: LOGS_OPTIONS_CONFIG,
17
- loadHandler: async () => (await import("./logs.handler-C3QnSCaH.mjs")).handleLogs,
17
+ loadHandler: async () => (await import("./logs.handler-ddQu_MXN.mjs")).handleLogs,
18
18
  subcommands: [createTypedCommand({
19
19
  name: "clear",
20
20
  description: "Delete the CLI log file",
21
21
  schema: z.object({}),
22
22
  optionsConfig: {},
23
- loadHandler: async () => (await import("./clear.handler-CtOZ4aRn.mjs")).handleLogsClear
23
+ loadHandler: async () => (await import("./clear.handler-Dh6QoVO1.mjs")).handleLogsClear
24
24
  })]
25
25
  });
26
26
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { D as throwReportedCliExit, h as toErrorMessage, o as ANSI, s as style, t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
6
- import { n as sleep, t as TERMINAL_STATUSES } from "./run-polling-CTzhTgyN.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
+ import { n as sleep, t as TERMINAL_STATUSES } from "./run-polling-CF9OeLWl.mjs";
7
7
  import Table from "cli-table3";
8
8
  //#region src/commands/workflows/_shared/run-query.ts
9
9
  async function listRunsByWorkflowRef(client, options) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/org/members.add.handler.ts
8
8
  async function handleMembersAdd(options, ctx) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/org/members.invite.handler.ts
8
8
  async function handleMembersInvite(options, ctx) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  import Table from "cli-table3";
8
8
  //#region src/commands/org/members.list.handler.ts
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/org/members.remove.handler.ts
8
8
  async function handleMembersRemove(options, ctx) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { i as requireOrganizationId, n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/org/members.update.handler.ts
8
8
  async function handleMembersUpdate(options, ctx) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-q4KljAhu.mjs";
4
- import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
4
+ import { t as createTypedCommand } from "./commander-pxSPDCZ4.mjs";
5
5
  import { t as OrgRoleSchema } from "./schema-_FQrHcIS.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/commands/org/invites.command.ts
@@ -36,14 +36,14 @@ function createOrgInvitesCommand() {
36
36
  description: "Manage organization invitations",
37
37
  schema: OrgInvitesListOptionsSchema,
38
38
  optionsConfig: { ...JSON_OPTION_CONFIG },
39
- loadHandler: async () => (await import("./invites.list.handler-B5quln3m.mjs")).handleOrgInvitesList,
39
+ loadHandler: async () => (await import("./invites.list.handler-ICP2V3p4.mjs")).handleOrgInvitesList,
40
40
  subcommands: [
41
41
  createTypedCommand({
42
42
  name: "list",
43
43
  description: "List organization invites",
44
44
  schema: OrgInvitesListOptionsSchema,
45
45
  optionsConfig: { ...JSON_OPTION_CONFIG },
46
- loadHandler: async () => (await import("./invites.list.handler-B5quln3m.mjs")).handleOrgInvitesList
46
+ loadHandler: async () => (await import("./invites.list.handler-ICP2V3p4.mjs")).handleOrgInvitesList
47
47
  }),
48
48
  createTypedCommand({
49
49
  name: "resend",
@@ -55,7 +55,7 @@ function createOrgInvitesCommand() {
55
55
  description: "Invite ID to resend",
56
56
  key: "inviteId"
57
57
  },
58
- loadHandler: async () => (await import("./invites.resend.handler-CSpj7bQ5.mjs")).handleOrgInvitesResend
58
+ loadHandler: async () => (await import("./invites.resend.handler-BGaTTMka.mjs")).handleOrgInvitesResend
59
59
  }),
60
60
  createTypedCommand({
61
61
  name: "revoke",
@@ -67,7 +67,7 @@ function createOrgInvitesCommand() {
67
67
  description: "Invite ID to revoke",
68
68
  key: "inviteId"
69
69
  },
70
- loadHandler: async () => (await import("./invites.revoke.handler-_hdEkBdO.mjs")).handleOrgInvitesRevoke
70
+ loadHandler: async () => (await import("./invites.revoke.handler-DBwF5Lxc.mjs")).handleOrgInvitesRevoke
71
71
  })
72
72
  ]
73
73
  });
@@ -142,28 +142,28 @@ function createOrgMembersCommand() {
142
142
  description: "Manage organization members",
143
143
  schema: MembersListOptionsSchema,
144
144
  optionsConfig: { ...JSON_OPTION_CONFIG },
145
- loadHandler: async () => (await import("./members.list.handler-D6TE0yp8.mjs")).handleMembersList,
145
+ loadHandler: async () => (await import("./members.list.handler-DrDtmMei.mjs")).handleMembersList,
146
146
  subcommands: [
147
147
  createTypedCommand({
148
148
  name: "list",
149
149
  description: "List organization members",
150
150
  schema: MembersListOptionsSchema,
151
151
  optionsConfig: { ...JSON_OPTION_CONFIG },
152
- loadHandler: async () => (await import("./members.list.handler-D6TE0yp8.mjs")).handleMembersList
152
+ loadHandler: async () => (await import("./members.list.handler-DrDtmMei.mjs")).handleMembersList
153
153
  }),
154
154
  createTypedCommand({
155
155
  name: "invite",
156
156
  description: "Invite a user to the current organization",
157
157
  schema: MembersInviteOptionsSchema,
158
158
  optionsConfig: INVITE_OPTIONS_CONFIG,
159
- loadHandler: async () => (await import("./members.invite.handler-v404bUsq.mjs")).handleMembersInvite
159
+ loadHandler: async () => (await import("./members.invite.handler-CYB7RQ9A.mjs")).handleMembersInvite
160
160
  }),
161
161
  createTypedCommand({
162
162
  name: "add",
163
163
  description: "Add an existing user to the current organization",
164
164
  schema: MembersAddOptionsSchema,
165
165
  optionsConfig: ADD_OPTIONS_CONFIG,
166
- loadHandler: async () => (await import("./members.add.handler-Dq_giQ8g.mjs")).handleMembersAdd
166
+ loadHandler: async () => (await import("./members.add.handler-CH0RhbgE.mjs")).handleMembersAdd
167
167
  }),
168
168
  createTypedCommand({
169
169
  name: "update",
@@ -175,7 +175,7 @@ function createOrgMembersCommand() {
175
175
  description: "User ID to update",
176
176
  key: "userId"
177
177
  },
178
- loadHandler: async () => (await import("./members.update.handler-BVy2cv1K.mjs")).handleMembersUpdate
178
+ loadHandler: async () => (await import("./members.update.handler-DXCWkzOc.mjs")).handleMembersUpdate
179
179
  }),
180
180
  createTypedCommand({
181
181
  name: "remove",
@@ -187,7 +187,7 @@ function createOrgMembersCommand() {
187
187
  description: "User ID to remove",
188
188
  key: "userId"
189
189
  },
190
- loadHandler: async () => (await import("./members.remove.handler-BhQ3cyeR.mjs")).handleMembersRemove
190
+ loadHandler: async () => (await import("./members.remove.handler-uGoZt2Me.mjs")).handleMembersRemove
191
191
  })
192
192
  ]
193
193
  });
@@ -202,28 +202,28 @@ function createOrgCommand() {
202
202
  description: "Manage organization context",
203
203
  schema: OrgOptionsSchema,
204
204
  optionsConfig: ORG_OPTIONS_CONFIG,
205
- loadHandler: async () => (await import("./list.handler-08GY-wnx.mjs")).handleOrgList,
205
+ loadHandler: async () => (await import("./list.handler-B2bN8NsQ.mjs")).handleOrgList,
206
206
  subcommands: [
207
207
  createTypedCommand({
208
208
  name: "list",
209
209
  description: "List your organizations",
210
210
  schema: OrgOptionsSchema,
211
211
  optionsConfig: ORG_OPTIONS_CONFIG,
212
- loadHandler: async () => (await import("./list.handler-08GY-wnx.mjs")).handleOrgList
212
+ loadHandler: async () => (await import("./list.handler-B2bN8NsQ.mjs")).handleOrgList
213
213
  }),
214
214
  createTypedCommand({
215
215
  name: "current",
216
216
  description: "Show the current organization",
217
217
  schema: OrgOptionsSchema,
218
218
  optionsConfig: ORG_OPTIONS_CONFIG,
219
- loadHandler: async () => (await import("./current.handler-BqPUKCvn.mjs")).handleOrgCurrent
219
+ loadHandler: async () => (await import("./current.handler-vJG2Dohx.mjs")).handleOrgCurrent
220
220
  }),
221
221
  createTypedCommand({
222
222
  name: "switch",
223
223
  description: "Switch to a different organization",
224
224
  schema: OrgOptionsSchema,
225
225
  optionsConfig: ORG_OPTIONS_CONFIG,
226
- loadHandler: async () => (await import("./switch.handler-C4hgbhcH.mjs")).handleOrgSwitch
226
+ loadHandler: async () => (await import("./switch.handler-DV0wiJP8.mjs")).handleOrgSwitch
227
227
  }),
228
228
  createOrgMembersCommand(),
229
229
  createOrgInvitesCommand()
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/admin/orgs.create.handler.ts
8
8
  async function handleAdminOrgsCreate(options, ctx) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-q4KljAhu.mjs";
5
- import { i as requireClient } from "./context-Y1f1hGYy.mjs";
5
+ import { i as requireClient } from "./context-D-YKFNxL.mjs";
6
6
  import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
7
7
  //#region src/commands/admin/orgs.get.handler.ts
8
8
  async function handleAdminOrgsGet(options, ctx) {