@keystrokehq/cli 0.0.31 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -4
- package/dist/{accept.handler-DNfIXPSP.mjs → accept.handler-DCsud1s5.mjs} +4 -4
- package/dist/{admin-CJp8XksD.mjs → admin-BaOtHeZ2.mjs} +10 -10
- package/dist/{agent-manifest-De5TCxZq.mjs → agent-manifest-DfWD5tvv.mjs} +17 -27
- package/dist/{agents-G37PM35Z.mjs → agents-BVAVfMR_.mjs} +9 -9
- package/dist/{api-keys-4igNHJ_W.mjs → api-keys-BhEEsHUh.mjs} +6 -6
- package/dist/{api-BK3EhPvs.mjs → api-sWkB_Wta.mjs} +1 -1
- package/dist/{auth-CIOmmV4x.mjs → auth-BnsitjzT.mjs} +6 -6
- package/dist/{auth.handler-CznN_vfz.mjs → auth.handler-W_xk14TL.mjs} +3 -3
- package/dist/authored-workflow-ref-fkHEEVnd.mjs +113 -0
- package/dist/{build-agents-DseUtzd4-CSGpNXur.mjs → build-agents-CUzBnlAG-3ePFZiJ6.mjs} +12 -11
- package/dist/{build-progress-DLM1Bt4T.mjs → build-progress-CM-b6Bby.mjs} +2 -2
- package/dist/{build-tasks-C09SdfjC-BmAVLTtQ.mjs → build-tasks-5eOvI19S-tbN6CRx9.mjs} +4 -4
- package/dist/{build-workflows-BZ_m97Pr-BiyptCrn.mjs → build-workflows-C-gQM3l5-_zcBHE3M.mjs} +14 -9
- package/dist/{build.handler-zHimoO7c.mjs → build.handler-CpAsAsBc.mjs} +12 -9
- package/dist/{clear-cache.handler-BP0K1-uN.mjs → clear-cache.handler-gJpwslkK.mjs} +2 -2
- package/dist/{clear.handler-T27GpgSu.mjs → clear.handler-CDyG6-dk.mjs} +1 -1
- package/dist/{clear.handler-PsA5QKHx.mjs → clear.handler-_sR33Hp8.mjs} +2 -2
- package/dist/{commander-BlrSdFcu.mjs → commander-C6SSTQJ2.mjs} +22 -3
- package/dist/{connect-BbLJhlIA.mjs → connect-27EgnljZ.mjs} +3 -3
- package/dist/{connect.handler-BthE-7Wg.mjs → connect.handler-COM1LnNg.mjs} +5 -5
- package/dist/{context-sgKhRc5v.mjs → context-ebZssGCY.mjs} +4 -4
- package/dist/{create.handler-BovbO_g0.mjs → create.handler-CAWJAGzQ.mjs} +3 -3
- package/dist/{credential-env-map-CRs0llf0.mjs → credential-env-map-5a41jLwM.mjs} +1 -1
- package/dist/{credential-requirements-D0mavK8j-CFMf0Xwu.mjs → credential-requirements-B5Alhu1v-DanlSKnT.mjs} +3 -3
- package/dist/{credential-schema-mismatch-ClQgEVtO.mjs → credential-schema-mismatch-c17ktoNU.mjs} +1 -1
- package/dist/{credentials-CsncZ52a.mjs → credentials-C0ssbMlp.mjs} +10 -10
- package/dist/{credentials-DKrSaaLw.mjs → credentials-DtwLbee6.mjs} +1 -1
- package/dist/current-deployment-workflow-C6x65imE.mjs +20 -0
- package/dist/current.handler-DP1L_hm3.mjs +19 -0
- package/dist/{delete.handler-DkAK396w.mjs → delete.handler-C-5XFkgN.mjs} +2 -2
- package/dist/{deploy-DvPfR9fC.mjs → deploy-BcVQJza8.mjs} +2 -2
- package/dist/{deploy-progress-BsUH7fGE.mjs → deploy-progress-Bt86Yc1r.mjs} +2 -2
- package/dist/{deploy.handler-BW3f2N2G.mjs → deploy.handler-GPS9lxGk.mjs} +16 -16
- package/dist/{diff-utils-Bs--xmoV.mjs → diff-utils-YEUYtSRs.mjs} +1 -1
- package/dist/{diff.handler-BwhsoAg0.mjs → diff.handler-DkM5dhaN.mjs} +15 -9
- package/dist/{dist-Dw7gCE7y.mjs → dist-B5jy238v.mjs} +37 -11
- package/dist/{dist-CTEtWDW4.mjs → dist-BmbFJq8U.mjs} +8 -27
- package/dist/{env.handler-Dks6ZQh-.mjs → env.handler-V_isbSi2.mjs} +52 -29
- package/dist/{error-boundary-0veZ_RDS.mjs → error-boundary-BRxUsPi7.mjs} +3 -3
- package/dist/{iam-command-utils-CSZj4XlH.mjs → iam-command-utils-DNDN0wT6.mjs} +3 -13
- package/dist/{import-module-y0glInUe-DV_3dsU0.mjs → import-module-y0glInUe-EuAWaw9g.mjs} +506 -128
- package/dist/{init-DX08T87c.mjs → init-D1OmmclX.mjs} +8 -3
- package/dist/{init.handler-CzlmkNXi.mjs → init.handler-CUbYlUgP.mjs} +57 -14
- package/dist/{inspect.handler-v9snxDLi.mjs → inspect.handler-BE6coOuW.mjs} +24 -13
- package/dist/{integration-catalog-CiZ62hb_.mjs → integration-catalog-pSmWHFLQ.mjs} +3 -3
- package/dist/{integrations-MEExmqcg.mjs → integrations-DZD5t8n2.mjs} +7 -7
- package/dist/{invites-BuatfJmN.mjs → invites-BuR1H-tA.mjs} +5 -5
- package/dist/{invites.list.handler-CK6mL10z.mjs → invites.list.handler-Dj4a6XOg.mjs} +6 -5
- package/dist/{invites.resend.handler-CKZouK1Z.mjs → invites.resend.handler-DEGF4vlB.mjs} +6 -5
- package/dist/{invites.revoke.handler-H0VI-3sp.mjs → invites.revoke.handler-Dg4ZvlFS.mjs} +6 -5
- package/dist/keystroke.mjs +122 -77
- package/dist/{list-enrichment-DP1wEyBZ.mjs → list-enrichment-dqbkXJzy.mjs} +2 -2
- package/dist/{list.handler-LxZInip2.mjs → list.handler-2g1CZAvB.mjs} +4 -4
- package/dist/{list.handler-BKfGLkFu.mjs → list.handler-7MkJfkak.mjs} +5 -5
- package/dist/list.handler-BTYVIn6z.mjs +39 -0
- package/dist/{list.handler-BiY5NFWd.mjs → list.handler-Bchcr3-e.mjs} +3 -3
- package/dist/list.handler-Choc4SZz.mjs +64 -0
- package/dist/{list.handler-Jk_vK66s.mjs → list.handler-D47C1z3m.mjs} +4 -4
- package/dist/{list.handler-DVnFrlis.mjs → list.handler-DYE48apa.mjs} +7 -7
- package/dist/{list.handler-DIMWZx78.mjs → list.handler-KcCaG3PZ.mjs} +4 -4
- package/dist/list2.handler-BIaIyrQf.mjs +99 -0
- package/dist/{listen-C_7Rgwkb.mjs → listen-CVY-_F29.mjs} +3 -3
- package/dist/{listen.handler-dJgorIzr.mjs → listen.handler-D_nEvXRn.mjs} +4 -4
- package/dist/{logs-B9YMhUGt.mjs → logs-CZ2qnsSH.mjs} +3 -3
- package/dist/{logs.handler-BfjCsAyq.mjs → logs.handler-BRUzZC9Z.mjs} +26 -29
- package/dist/{logs.handler-DGGVPMOX.mjs → logs.handler-Wk6mYyAZ.mjs} +1 -1
- package/dist/{members.add.handler-DSRCRxsI.mjs → members.add.handler-BJ0wr6rP.mjs} +6 -5
- package/dist/{members.invite.handler-BNpHn1dY.mjs → members.invite.handler-DyveDMuq.mjs} +6 -5
- package/dist/{members.list.handler-Bn9LJEPG.mjs → members.list.handler-CyQxH_zS.mjs} +6 -5
- package/dist/{members.remove.handler-Dkr2t_tX.mjs → members.remove.handler-Dtv9PooY.mjs} +6 -5
- package/dist/{members.update.handler-DBtUYuAY.mjs → members.update.handler-CeK-tCjT.mjs} +6 -5
- package/dist/{operations-AWMLs6mE.mjs → operations-CxQlt0S0.mjs} +5 -5
- package/dist/{org-DOH7YHk2.mjs → org-B8MPHJJu.mjs} +35 -28
- package/dist/org-context-BI9OSpbb.mjs +112 -0
- package/dist/org-output-DffU7DKn.mjs +64 -0
- package/dist/{orgs.create.handler-BO70zIdp.mjs → orgs.create.handler-BKvSmkU3.mjs} +4 -4
- package/dist/{orgs.get.handler-BuGg5bc9.mjs → orgs.get.handler-BA-CexIY.mjs} +4 -4
- package/dist/{orgs.list.handler--5HutMkl.mjs → orgs.list.handler-eCEg5kC1.mjs} +4 -4
- package/dist/{output-BWcVRt-T.mjs → output-DnIFEmi5.mjs} +1 -1
- package/dist/package-manager-BP3-q8hh.mjs +162 -0
- package/dist/{paused.handler-DHvxz-cC.mjs → paused.handler-4wKMTKZ-.mjs} +20 -33
- package/dist/{projects-C5GZ5Jrf.mjs → projects-Wu_2fB_x.mjs} +11 -9
- package/dist/{register.handler-CePNU3sP.mjs → register.handler-BvAkXCwE.mjs} +2 -2
- package/dist/{render-credential-Bn15FEUC.mjs → render-credential-D-H1ECDt.mjs} +1 -1
- package/dist/{render-operation-Bc7Wu1sP.mjs → render-operation-VdEPhoII.mjs} +2 -2
- package/dist/{requirements.handler-B5rqCjMu.mjs → requirements.handler-Bab4kBtw.mjs} +7 -7
- package/dist/{resolve-cli-credentials-CAOSVMJP.mjs → resolve-cli-credentials-GVOOedoQ.mjs} +1 -1
- package/dist/{resolve-project-E9mrh_el.mjs → resolve-project-DLKlAy0z.mjs} +24 -8
- package/dist/{run-polling-DawiBus-.mjs → run-polling-C5fI7xTp.mjs} +97 -14
- package/dist/{run.handler-BG7xitEK.mjs → run.handler-BKD5Xu0A.mjs} +42 -30
- package/dist/{runs-swYYBT6C.mjs → runs-CT31dczt.mjs} +4 -4
- package/dist/{schema-display-FvI8QjOQ.mjs → schema-display-sZ6ConJd.mjs} +33 -26
- package/dist/schemas-ClAIoIrX.mjs +281 -0
- package/dist/{search-BEfy2fG9.mjs → search-BeQW_pf4.mjs} +3 -3
- package/dist/{search.handler-V7ObLGjN.mjs → search.handler-BJ-ZlDL4.mjs} +6 -6
- package/dist/{show.handler-C_VDYU91.mjs → show.handler-BrIHUH28.mjs} +4 -4
- package/dist/{show.handler-CsidInW8.mjs → show.handler-Cqe_hCqU.mjs} +5 -5
- package/dist/{show.handler-Wmv0tkxx.mjs → show.handler-DB8xl5FU.mjs} +6 -6
- package/dist/{skill-installer-D6j9IA3Z.mjs → skill-installer-DuMhavmM.mjs} +3 -1
- package/dist/{skills-sync.handler-BAATdT6N.mjs → skills-sync.handler-BGs-_YD9.mjs} +13 -7
- package/dist/{skills.command-0-E8mcYE.mjs → skills.command-DUWn6FbL.mjs} +5 -5
- package/dist/skills.handler-DqLXJepA.mjs +9 -0
- package/dist/{spinner-progress-lrKDs4YF.mjs → spinner-progress-BYxlr3lY.mjs} +1 -1
- package/dist/status.handler-DAId4bVU.mjs +72 -0
- package/dist/{switch.handler-BwYndsP-.mjs → switch.handler-Cd4Yg2n8.mjs} +17 -4
- package/dist/{sync-6fZkIUtn.mjs → sync-DgC4lcxh.mjs} +2 -2
- package/dist/{sync.handler-Ctr-cN9X.mjs → sync.handler-Cm_WtGmH.mjs} +8 -8
- package/dist/{task-BWuIKWh4.mjs → task-DTvLzUkA.mjs} +2 -88
- package/dist/{task-target-build-QllcCfoN.mjs → task-target-build-CtvRyVjH.mjs} +5 -5
- package/dist/task-target-deploy-runner.mjs +6 -6
- package/dist/{test-C8VIZe9V.mjs → test-4V7nh67i.mjs} +5 -5
- package/dist/{test.handler-BCW0YBPd.mjs → test.handler-BdCYcwR4.mjs} +2 -2
- package/dist/{test.handler-DLaxrJ9V.mjs → test.handler-Bo4YTs2Z.mjs} +19 -16
- package/dist/{tool.handler-8qNmgdRe.mjs → tool.handler-CPCrSDq2.mjs} +12 -12
- package/dist/{trigger-artifacts-BcRScRSp-BiD2h6do.mjs → trigger-artifacts-BcRScRSp-BRpU-He5.mjs} +2 -2
- package/dist/{trigger-manifest-C07EM-b2.mjs → trigger-manifest-BVqjDhxU.mjs} +1 -1
- package/dist/{upgrade-DgOcc8IT.mjs → upgrade-2qUOcjxb.mjs} +4 -8
- package/dist/upgrade.handler-PqlKSuUE.mjs +99 -0
- package/dist/{upload.handler-B7xle1oX.mjs → upload.handler-CS-vLpzC.mjs} +9 -9
- package/dist/{users.get.handler-C4t1vXwi.mjs → users.get.handler-CH1c6Lnj.mjs} +4 -4
- package/dist/{users.list.handler-Dvl90grq.mjs → users.list.handler-CxbZFgjO.mjs} +4 -4
- package/dist/{users.set-role.handler-Djw1_VGf.mjs → users.set-role.handler-CBRE-Ws6.mjs} +4 -4
- package/dist/{validate.handler-Drf_lssw.mjs → validate.handler-1d-UmtXB.mjs} +171 -26
- package/dist/{workflow-build-Begvjfq8.mjs → workflow-build-Bm8JoVv4.mjs} +234 -32
- package/dist/{workflow-build-manifest-1sC52TIG.mjs → workflow-build-manifest-CV6bBmDO.mjs} +1 -1
- package/dist/{workflow-bundler-BzHk73PM-muPv1yGG.mjs → workflow-bundler-Bs3zQNQv-Dy7lXxy3.mjs} +15 -4
- package/dist/{workflows-DjMlxuBX.mjs → workflows-ny7rOdeH.mjs} +34 -37
- package/dist/{writer-byNNUjRm-B-on1n6c.mjs → writer-BLg0RuZa-Y6ExdYH9.mjs} +6 -4
- package/package.json +11 -11
- package/dist/current-deployment-workflow-B1VQCYC-.mjs +0 -94
- package/dist/current.handler-BaGaCLzB.mjs +0 -21
- package/dist/list.handler-BEMj3FyH.mjs +0 -76
- package/dist/list.handler-Cq_oQY5B.mjs +0 -52
- package/dist/list.handler-htR9TeiS.mjs +0 -24
- package/dist/package-manager-DT1EhOkS.mjs +0 -61
- package/dist/schemas-D2zfmyC-.mjs +0 -671
- package/dist/skills.handler-DYIQK0Vu.mjs +0 -9
- package/dist/status.handler-Ch_DtyBp.mjs +0 -109
- package/dist/upgrade.handler-DSZuw7-9.mjs +0 -80
- /package/dist/{build-metadata-BB_L45ZS-DSJL7dTy.mjs → build-metadata-BB_L45ZS-DRQsV6JK.mjs} +0 -0
- /package/dist/{deploy-DhCbYFc7.mjs → deploy-BiKBH25R.mjs} +0 -0
- /package/dist/{detect-env-access-CwkOYeYM-COq4U-4Y.mjs → detect-env-access-CwkOYeYM-r4aynBU0.mjs} +0 -0
- /package/dist/{read-credential-keys-77a91T8M-DGK5XTQp.mjs → read-credential-keys-77a91T8M-I07NYwfH.mjs} +0 -0
- /package/dist/{run-polling-fBouPjJ2.mjs → run-polling-1c0ckC1A.mjs} +0 -0
- /package/dist/{schemas-4Mq_bxob.mjs → schemas-8nhXlXWh.mjs} +0 -0
- /package/dist/{task-target-deploy-B_3HPSo2.mjs → task-target-deploy-m9LfE488.mjs} +0 -0
- /package/dist/{types-AlA-ifK9.mjs → types-Cb0eWmUU.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-
|
|
4
|
-
import { t as createTypedCommand } from "./commander-
|
|
3
|
+
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-DnIFEmi5.mjs";
|
|
4
|
+
import { t as createTypedCommand } from "./commander-C6SSTQJ2.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/commands/listen/listen.command.ts
|
|
7
7
|
const ListenOptionsSchema = JsonOptionSchema.extend({ timeout: z.coerce.number().int().min(1).default(300) });
|
|
@@ -18,7 +18,7 @@ function createListenCommand() {
|
|
|
18
18
|
description: "Listen for one incoming request and print its body",
|
|
19
19
|
schema: ListenOptionsSchema,
|
|
20
20
|
optionsConfig: LISTEN_OPTIONS_CONFIG,
|
|
21
|
-
loadHandler: async () => (await import("./listen.handler-
|
|
21
|
+
loadHandler: async () => (await import("./listen.handler-D_nEvXRn.mjs")).handleListen
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { a as writeJsonError, i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import { n as sleep } from "./run-polling-
|
|
3
|
+
import { N as throwReportedCliExit, k as CliExitError, n as style, p as ui, t as ANSI, x as toErrorMessage } from "./keystroke.mjs";
|
|
4
|
+
import { a as writeJsonError, i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as sleep } from "./run-polling-1c0ckC1A.mjs";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
//#region src/lib/clipboard.ts
|
|
9
9
|
function getClipboardCommands() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { t as createTypedCommand } from "./commander-
|
|
3
|
+
import { t as createTypedCommand } from "./commander-C6SSTQJ2.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/commands/logs/logs.command.ts
|
|
6
6
|
const LogsOptionsSchema = z.object({
|
|
@@ -44,13 +44,13 @@ function createLogsCommand() {
|
|
|
44
44
|
description: "Display recent CLI log entries",
|
|
45
45
|
schema: LogsOptionsSchema,
|
|
46
46
|
optionsConfig: LOGS_OPTIONS_CONFIG,
|
|
47
|
-
loadHandler: async () => (await import("./logs.handler-
|
|
47
|
+
loadHandler: async () => (await import("./logs.handler-Wk6mYyAZ.mjs")).handleLogs,
|
|
48
48
|
subcommands: [createTypedCommand({
|
|
49
49
|
name: "clear",
|
|
50
50
|
description: "Clear the CLI log file",
|
|
51
51
|
schema: z.object({}),
|
|
52
52
|
optionsConfig: {},
|
|
53
|
-
loadHandler: async () => (await import("./clear.handler-
|
|
53
|
+
loadHandler: async () => (await import("./clear.handler-CDyG6-dk.mjs")).handleLogsClear
|
|
54
54
|
})]
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import { n as
|
|
3
|
+
import { N as throwReportedCliExit, k as CliExitError, n as style, p as ui, t as ANSI, x as toErrorMessage } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as resolveWorkflowsDir } from "./resolve-project-DLKlAy0z.mjs";
|
|
7
|
+
import { n as sleep, t as TERMINAL_STATUSES } from "./run-polling-1c0ckC1A.mjs";
|
|
8
|
+
import { n as assertAuthoredWorkflowId, t as WORKFLOW_ID_COMMANDS } from "./authored-workflow-ref-fkHEEVnd.mjs";
|
|
7
9
|
import Table from "cli-table3";
|
|
8
10
|
//#region src/commands/workflows/_shared/run-query.ts
|
|
9
|
-
async function
|
|
10
|
-
|
|
11
|
-
authoredWorkflowId: options.
|
|
11
|
+
async function listRunsByAuthoredWorkflowId(client, options) {
|
|
12
|
+
return (await client.runs.listRuns({
|
|
13
|
+
authoredWorkflowId: options.authoredWorkflowId,
|
|
12
14
|
status: options.status,
|
|
13
15
|
limit: options.limit
|
|
14
|
-
});
|
|
15
|
-
if (byAuthoredId.runs.length > 0) return {
|
|
16
|
-
kind: "authoredId",
|
|
17
|
-
runs: byAuthoredId.runs
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
kind: "name",
|
|
21
|
-
runs: (await client.runs.listRuns({
|
|
22
|
-
workflowName: options.workflowRef,
|
|
23
|
-
status: options.status,
|
|
24
|
-
limit: options.limit
|
|
25
|
-
})).runs
|
|
26
|
-
};
|
|
16
|
+
})).runs;
|
|
27
17
|
}
|
|
28
18
|
//#endregion
|
|
29
19
|
//#region src/commands/workflows/logs/run-log-display.ts
|
|
@@ -88,12 +78,12 @@ async function handleWorkflowsLogs(options, ctx) {
|
|
|
88
78
|
}
|
|
89
79
|
async function listRecentRuns(client, options, jsonMode) {
|
|
90
80
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
await assertWorkflowIdWhenLocal(options.workflow);
|
|
82
|
+
const runs = await listRunsByAuthoredWorkflowId(client, {
|
|
83
|
+
authoredWorkflowId: options.workflow,
|
|
93
84
|
status: options.status,
|
|
94
85
|
limit: options.limit
|
|
95
86
|
});
|
|
96
|
-
const { runs } = result;
|
|
97
87
|
if (jsonMode) {
|
|
98
88
|
writeJson(runs.map((run) => ({
|
|
99
89
|
id: run.id,
|
|
@@ -130,8 +120,9 @@ async function listRecentRuns(client, options, jsonMode) {
|
|
|
130
120
|
formatDuration(run.createdAt, run.completedAt)
|
|
131
121
|
]);
|
|
132
122
|
ui.text(table.toString());
|
|
133
|
-
ui.hint(
|
|
123
|
+
ui.hint(`${runs.length} run(s) matched workflow id "${options.workflow}". Use --latest to view the newest run's logs, or --run-id <id> to pin a specific run.`);
|
|
134
124
|
} catch (error) {
|
|
125
|
+
if (error instanceof CliExitError && error.reported) throw error;
|
|
135
126
|
const message = toErrorMessage(error);
|
|
136
127
|
ui.error(`Failed to list runs: ${message}`);
|
|
137
128
|
throwReportedCliExit(`Failed to list runs: ${message}`, { cause: error });
|
|
@@ -139,18 +130,19 @@ async function listRecentRuns(client, options, jsonMode) {
|
|
|
139
130
|
}
|
|
140
131
|
async function showLatestRunLogs(client, options, jsonMode) {
|
|
141
132
|
try {
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
await assertWorkflowIdWhenLocal(options.workflow);
|
|
134
|
+
const latestRun = (await listRunsByAuthoredWorkflowId(client, {
|
|
135
|
+
authoredWorkflowId: options.workflow,
|
|
144
136
|
limit: 1
|
|
145
|
-
});
|
|
146
|
-
const latestRun = result.runs[0];
|
|
137
|
+
}))[0];
|
|
147
138
|
if (!latestRun) {
|
|
148
139
|
ui.hint(`No runs found for workflow "${options.workflow}".`);
|
|
149
140
|
return;
|
|
150
141
|
}
|
|
151
|
-
if (!jsonMode) ui.hint(
|
|
142
|
+
if (!jsonMode) ui.hint(`Showing logs for the latest run of workflow id "${options.workflow}". Use --run-id ${latestRun.id} to pin this run.`);
|
|
152
143
|
await showRunLogs(client, latestRun.id, options, jsonMode);
|
|
153
144
|
} catch (error) {
|
|
145
|
+
if (error instanceof CliExitError && error.reported) throw error;
|
|
154
146
|
const message = toErrorMessage(error);
|
|
155
147
|
ui.error(`Failed to resolve latest run: ${message}`);
|
|
156
148
|
throwReportedCliExit(`Failed to resolve latest run: ${message}`, { cause: error });
|
|
@@ -227,5 +219,10 @@ async function showRunLogs(client, runId, options, jsonMode) {
|
|
|
227
219
|
throwReportedCliExit(`Failed to get run logs: ${message}`, { cause: error });
|
|
228
220
|
}
|
|
229
221
|
}
|
|
222
|
+
async function assertWorkflowIdWhenLocal(authoredWorkflowId) {
|
|
223
|
+
const workflowsDir = await resolveWorkflowsDir(void 0);
|
|
224
|
+
if (!workflowsDir) return;
|
|
225
|
+
await assertAuthoredWorkflowId(authoredWorkflowId, workflowsDir, WORKFLOW_ID_COMMANDS.logs);
|
|
226
|
+
}
|
|
230
227
|
//#endregion
|
|
231
228
|
export { handleWorkflowsLogs };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { A as InputValidationError, L as originalConsole, R as readLogEntries, n as style, p as ui, t as ANSI } from "./keystroke.mjs";
|
|
4
4
|
//#region src/commands/logs/logs.handler.ts
|
|
5
5
|
const LEVEL_STYLES = {
|
|
6
6
|
debug: ANSI.dim,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-DNDN0wT6.mjs";
|
|
7
|
+
import { s as requireOrganizationId } from "./org-context-BI9OSpbb.mjs";
|
|
7
8
|
//#region src/commands/org/members.add.handler.ts
|
|
8
9
|
async function handleMembersAdd(options, ctx) {
|
|
9
10
|
const client = requireClient(ctx);
|
|
10
|
-
const organizationId = requireOrganizationId(ctx);
|
|
11
|
+
const organizationId = await requireOrganizationId(ctx);
|
|
11
12
|
if (options.role === "owner") requireConfirmation({
|
|
12
13
|
confirmed: options.confirm,
|
|
13
14
|
message: "Adding an owner grants full organization control.",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-DNDN0wT6.mjs";
|
|
7
|
+
import { s as requireOrganizationId } from "./org-context-BI9OSpbb.mjs";
|
|
7
8
|
//#region src/commands/org/members.invite.handler.ts
|
|
8
9
|
async function handleMembersInvite(options, ctx) {
|
|
9
10
|
const client = requireClient(ctx);
|
|
10
|
-
const organizationId = requireOrganizationId(ctx);
|
|
11
|
+
const organizationId = await requireOrganizationId(ctx);
|
|
11
12
|
if (options.role === "owner") requireConfirmation({
|
|
12
13
|
confirmed: options.confirm,
|
|
13
14
|
message: "Inviting an owner grants full organization control.",
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-DNDN0wT6.mjs";
|
|
7
|
+
import { s as requireOrganizationId } from "./org-context-BI9OSpbb.mjs";
|
|
7
8
|
import Table from "cli-table3";
|
|
8
9
|
//#region src/commands/org/members.list.handler.ts
|
|
9
10
|
async function handleMembersList(_options, ctx) {
|
|
10
11
|
const client = requireClient(ctx);
|
|
11
|
-
const organizationId = requireOrganizationId(ctx);
|
|
12
|
+
const organizationId = await requireOrganizationId(ctx);
|
|
12
13
|
try {
|
|
13
14
|
const result = await client.organizations.members.list(organizationId);
|
|
14
15
|
if (isIamJsonMode(_options, ctx)) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-DNDN0wT6.mjs";
|
|
7
|
+
import { s as requireOrganizationId } from "./org-context-BI9OSpbb.mjs";
|
|
7
8
|
//#region src/commands/org/members.remove.handler.ts
|
|
8
9
|
async function handleMembersRemove(options, ctx) {
|
|
9
10
|
const client = requireClient(ctx);
|
|
10
|
-
const organizationId = requireOrganizationId(ctx);
|
|
11
|
+
const organizationId = await requireOrganizationId(ctx);
|
|
11
12
|
requireConfirmation({
|
|
12
13
|
confirmed: options.confirm,
|
|
13
14
|
message: "Removing a member revokes organization access.",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
6
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
import { n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-DNDN0wT6.mjs";
|
|
7
|
+
import { s as requireOrganizationId } from "./org-context-BI9OSpbb.mjs";
|
|
7
8
|
//#region src/commands/org/members.update.handler.ts
|
|
8
9
|
async function handleMembersUpdate(options, ctx) {
|
|
9
10
|
const client = requireClient(ctx);
|
|
10
|
-
const organizationId = requireOrganizationId(ctx);
|
|
11
|
+
const organizationId = await requireOrganizationId(ctx);
|
|
11
12
|
if (options.role === "owner") requireConfirmation({
|
|
12
13
|
confirmed: options.confirm,
|
|
13
14
|
message: "Promoting a member to owner grants full organization control.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-
|
|
4
|
-
import { t as createTypedCommand } from "./commander-
|
|
3
|
+
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-DnIFEmi5.mjs";
|
|
4
|
+
import { t as createTypedCommand } from "./commander-C6SSTQJ2.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/commands/operations/operations.command.ts
|
|
7
7
|
const OperationsListOptionsSchema = JsonOptionSchema.extend({
|
|
@@ -56,13 +56,13 @@ function createOperationsCommand() {
|
|
|
56
56
|
description: "Browse and inspect operations across all integrations",
|
|
57
57
|
schema: OperationsListOptionsSchema,
|
|
58
58
|
optionsConfig: OPERATIONS_LIST_OPTIONS_CONFIG,
|
|
59
|
-
loadHandler: async () => (await import("./list.handler-
|
|
59
|
+
loadHandler: async () => (await import("./list.handler-7MkJfkak.mjs")).handleOperationsList,
|
|
60
60
|
subcommands: [createTypedCommand({
|
|
61
61
|
name: "list",
|
|
62
62
|
description: "List operations, optionally scoped to one integration",
|
|
63
63
|
schema: OperationsListOptionsSchema,
|
|
64
64
|
optionsConfig: OPERATIONS_LIST_OPTIONS_CONFIG,
|
|
65
|
-
loadHandler: async () => (await import("./list.handler-
|
|
65
|
+
loadHandler: async () => (await import("./list.handler-7MkJfkak.mjs")).handleOperationsList
|
|
66
66
|
}), createTypedCommand({
|
|
67
67
|
name: "show",
|
|
68
68
|
description: "Show full details for one operation, including input/output schemas",
|
|
@@ -73,7 +73,7 @@ function createOperationsCommand() {
|
|
|
73
73
|
description: "Operation id, e.g. aws-s3.put-object",
|
|
74
74
|
key: "id"
|
|
75
75
|
},
|
|
76
|
-
loadHandler: async () => (await import("./show.handler-
|
|
76
|
+
loadHandler: async () => (await import("./show.handler-DB8xl5FU.mjs")).handleOperationShow
|
|
77
77
|
})]
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-
|
|
4
|
-
import { t as createTypedCommand } from "./commander-
|
|
3
|
+
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-DnIFEmi5.mjs";
|
|
4
|
+
import { t as createTypedCommand } from "./commander-C6SSTQJ2.mjs";
|
|
5
5
|
import { t as OrgRoleSchema } from "./schema-Lbp5lGJu.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-
|
|
39
|
+
loadHandler: async () => (await import("./invites.list.handler-Dj4a6XOg.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-
|
|
46
|
+
loadHandler: async () => (await import("./invites.list.handler-Dj4a6XOg.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-
|
|
58
|
+
loadHandler: async () => (await import("./invites.resend.handler-DEGF4vlB.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-
|
|
70
|
+
loadHandler: async () => (await import("./invites.revoke.handler-Dg4ZvlFS.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-
|
|
145
|
+
loadHandler: async () => (await import("./members.list.handler-CyQxH_zS.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-
|
|
152
|
+
loadHandler: async () => (await import("./members.list.handler-CyQxH_zS.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-
|
|
159
|
+
loadHandler: async () => (await import("./members.invite.handler-DyveDMuq.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-
|
|
166
|
+
loadHandler: async () => (await import("./members.add.handler-BJ0wr6rP.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-
|
|
178
|
+
loadHandler: async () => (await import("./members.update.handler-CeK-tCjT.mjs")).handleMembersUpdate
|
|
179
179
|
}),
|
|
180
180
|
createTypedCommand({
|
|
181
181
|
name: "remove",
|
|
@@ -187,43 +187,50 @@ function createOrgMembersCommand() {
|
|
|
187
187
|
description: "User ID to remove",
|
|
188
188
|
key: "userId"
|
|
189
189
|
},
|
|
190
|
-
loadHandler: async () => (await import("./members.remove.handler-
|
|
190
|
+
loadHandler: async () => (await import("./members.remove.handler-Dtv9PooY.mjs")).handleMembersRemove
|
|
191
191
|
})
|
|
192
192
|
]
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
|
196
|
+
//#region src/commands/org/org-options.ts
|
|
197
|
+
/** Shared schema for read-only org commands (`list`, `current`, and default `org`). */
|
|
198
|
+
const OrgReadOptionsSchema = JsonOptionSchema;
|
|
199
|
+
const ORG_READ_OPTIONS_CONFIG = { ...JSON_OPTION_CONFIG };
|
|
200
|
+
const OrgSwitchOptionsSchema = z.object({});
|
|
201
|
+
const ORG_SWITCH_OPTIONS_CONFIG = {};
|
|
202
|
+
/** Long description for the `org` command tree (includes global org override flags). */
|
|
203
|
+
const ORG_COMMAND_DESCRIPTION = "Manage organization context (global --org <id> or KEYSTROKE_ORG_ID override active org)";
|
|
204
|
+
//#endregion
|
|
196
205
|
//#region src/commands/org/org.command.ts
|
|
197
|
-
const OrgOptionsSchema = z.object({});
|
|
198
|
-
const ORG_OPTIONS_CONFIG = {};
|
|
199
206
|
function createOrgCommand() {
|
|
200
207
|
return createTypedCommand({
|
|
201
208
|
name: "org",
|
|
202
|
-
description:
|
|
203
|
-
schema:
|
|
204
|
-
optionsConfig:
|
|
205
|
-
loadHandler: async () => (await import("./list.handler-
|
|
209
|
+
description: ORG_COMMAND_DESCRIPTION,
|
|
210
|
+
schema: OrgReadOptionsSchema,
|
|
211
|
+
optionsConfig: ORG_READ_OPTIONS_CONFIG,
|
|
212
|
+
loadHandler: async () => (await import("./list.handler-BTYVIn6z.mjs")).handleOrgList,
|
|
206
213
|
subcommands: [
|
|
207
214
|
createTypedCommand({
|
|
208
215
|
name: "list",
|
|
209
216
|
description: "List your organizations",
|
|
210
|
-
schema:
|
|
211
|
-
optionsConfig:
|
|
212
|
-
loadHandler: async () => (await import("./list.handler-
|
|
217
|
+
schema: OrgReadOptionsSchema,
|
|
218
|
+
optionsConfig: ORG_READ_OPTIONS_CONFIG,
|
|
219
|
+
loadHandler: async () => (await import("./list.handler-BTYVIn6z.mjs")).handleOrgList
|
|
213
220
|
}),
|
|
214
221
|
createTypedCommand({
|
|
215
222
|
name: "current",
|
|
216
223
|
description: "Show the current organization",
|
|
217
|
-
schema:
|
|
218
|
-
optionsConfig:
|
|
219
|
-
loadHandler: async () => (await import("./current.handler-
|
|
224
|
+
schema: OrgReadOptionsSchema,
|
|
225
|
+
optionsConfig: ORG_READ_OPTIONS_CONFIG,
|
|
226
|
+
loadHandler: async () => (await import("./current.handler-DP1L_hm3.mjs")).handleOrgCurrent
|
|
220
227
|
}),
|
|
221
228
|
createTypedCommand({
|
|
222
229
|
name: "switch",
|
|
223
|
-
description: "Switch to a different organization",
|
|
224
|
-
schema:
|
|
225
|
-
optionsConfig:
|
|
226
|
-
loadHandler: async () => (await import("./switch.handler-
|
|
230
|
+
description: "Switch to a different organization (interactive)",
|
|
231
|
+
schema: OrgSwitchOptionsSchema,
|
|
232
|
+
optionsConfig: ORG_SWITCH_OPTIONS_CONFIG,
|
|
233
|
+
loadHandler: async () => (await import("./switch.handler-Cd4Yg2n8.mjs")).handleOrgSwitch
|
|
227
234
|
}),
|
|
228
235
|
createOrgMembersCommand(),
|
|
229
236
|
createOrgInvitesCommand()
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { N as throwReportedCliExit, b as isNetworkError, p as ui, x as toErrorMessage, y as isAuthError } from "./keystroke.mjs";
|
|
4
|
+
import { a as writeJsonError } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-ebZssGCY.mjs";
|
|
6
|
+
//#region src/commands/org/org-context.ts
|
|
7
|
+
/** Shown when org context is missing or IAM commands need an org. */
|
|
8
|
+
const ORG_CONTEXT_HINT = "Pass --org <organization-id>, set KEYSTROKE_ORG_ID, or run `keystroke org switch`.";
|
|
9
|
+
/** Shown when switch cannot persist because no stored API keys exist. */
|
|
10
|
+
const ORG_STORED_KEYS_HINT = "Run `keystroke auth` for each organization, then `keystroke org switch`.";
|
|
11
|
+
async function getApiKeyValidationStatus(ctx) {
|
|
12
|
+
if (!ctx.client) return { kind: "not_authenticated" };
|
|
13
|
+
try {
|
|
14
|
+
const result = await ctx.client.public.auth.validate();
|
|
15
|
+
return {
|
|
16
|
+
kind: "valid",
|
|
17
|
+
apiKeyId: result.apiKeyId,
|
|
18
|
+
organizationId: result.organizationId
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
const message = toErrorMessage(error);
|
|
22
|
+
if (isAuthError(error)) return {
|
|
23
|
+
kind: "invalid",
|
|
24
|
+
message
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
kind: "unavailable",
|
|
28
|
+
message,
|
|
29
|
+
reason: isNetworkError(error) ? "network" : "other"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function findMembershipOrganization(memberships, organizationId) {
|
|
34
|
+
return memberships.find((org) => org.id === organizationId);
|
|
35
|
+
}
|
|
36
|
+
async function resolveEffectiveOrganization(ctx, memberships) {
|
|
37
|
+
const explicitOrganizationId = ctx.organizationId;
|
|
38
|
+
if (explicitOrganizationId) {
|
|
39
|
+
const membership = findMembershipOrganization(memberships, explicitOrganizationId);
|
|
40
|
+
const storedOrg = ctx.storedOrgs.find((org) => org.organizationId === explicitOrganizationId);
|
|
41
|
+
const name = membership?.name ?? storedOrg?.organizationName;
|
|
42
|
+
return {
|
|
43
|
+
organizationId: explicitOrganizationId,
|
|
44
|
+
...name ? { name } : {},
|
|
45
|
+
source: ctx.orgSource ?? "credentials",
|
|
46
|
+
isMembershipKnown: membership !== void 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (!ctx.client) return;
|
|
50
|
+
const validation = await getApiKeyValidationStatus(ctx);
|
|
51
|
+
if (validation.kind !== "valid") return;
|
|
52
|
+
const membership = findMembershipOrganization(memberships, validation.organizationId);
|
|
53
|
+
const storedOrg = ctx.storedOrgs.find((org) => org.organizationId === validation.organizationId);
|
|
54
|
+
const name = membership?.name ?? storedOrg?.organizationName;
|
|
55
|
+
return {
|
|
56
|
+
organizationId: validation.organizationId,
|
|
57
|
+
...name ? { name } : {},
|
|
58
|
+
source: "api-key",
|
|
59
|
+
isMembershipKnown: membership !== void 0
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Active org id for list output; omits unknown explicit overrides. */
|
|
63
|
+
function resolveListActiveOrganizationId(effective) {
|
|
64
|
+
if (!effective?.isMembershipKnown) return;
|
|
65
|
+
return effective.organizationId;
|
|
66
|
+
}
|
|
67
|
+
function buildOrgListRows(params) {
|
|
68
|
+
return params.memberships.map((org) => ({
|
|
69
|
+
id: org.id,
|
|
70
|
+
name: org.name,
|
|
71
|
+
current: org.id === params.activeOrganizationId,
|
|
72
|
+
keyStored: params.storedOrgIds.has(org.id)
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function warnUnknownOrganizationOverride(params) {
|
|
76
|
+
if (findMembershipOrganization(params.memberships, params.organizationId)) return;
|
|
77
|
+
ui.warn(`Organization ID "${params.organizationId}" is not one of your memberships (from ${params.orgSource}).`);
|
|
78
|
+
ui.hint("Check the ID with `keystroke org list` or clear --org / KEYSTROKE_ORG_ID.");
|
|
79
|
+
}
|
|
80
|
+
function requireEffectiveOrganization(effective, ctx) {
|
|
81
|
+
if (effective) {
|
|
82
|
+
if (!effective.isMembershipKnown && (ctx.orgSource === "flag" || ctx.orgSource === "env")) {
|
|
83
|
+
const message = `Organization ID "${effective.organizationId}" is not one of your memberships.`;
|
|
84
|
+
if (ctx.jsonMode) writeJsonError(message, {
|
|
85
|
+
code: "UNKNOWN_ORGANIZATION",
|
|
86
|
+
hint: "Check the ID with `keystroke org list` or clear --org / KEYSTROKE_ORG_ID."
|
|
87
|
+
});
|
|
88
|
+
ui.error(message);
|
|
89
|
+
ui.hint("Check the ID with `keystroke org list` or clear --org / KEYSTROKE_ORG_ID.");
|
|
90
|
+
throwReportedCliExit(message);
|
|
91
|
+
}
|
|
92
|
+
return effective;
|
|
93
|
+
}
|
|
94
|
+
const message = `No organization set. ${ORG_CONTEXT_HINT}`;
|
|
95
|
+
if (ctx.jsonMode) writeJsonError(message, {
|
|
96
|
+
code: "ORG_REQUIRED",
|
|
97
|
+
hint: ORG_CONTEXT_HINT
|
|
98
|
+
});
|
|
99
|
+
ui.error(message);
|
|
100
|
+
if (ctx.storedOrgs.length === 0) ui.hint(ORG_STORED_KEYS_HINT);
|
|
101
|
+
throwReportedCliExit(message);
|
|
102
|
+
}
|
|
103
|
+
async function requireOrganizationId(ctx) {
|
|
104
|
+
const { user } = await requireClient(ctx).users.getMe();
|
|
105
|
+
return requireEffectiveOrganization(await resolveEffectiveOrganization(ctx, user.organizations ?? []), ctx).organizationId;
|
|
106
|
+
}
|
|
107
|
+
function formatOrgSourceLabel(source) {
|
|
108
|
+
if (source === "api-key") return "api key";
|
|
109
|
+
return source;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { getApiKeyValidationStatus as a, resolveEffectiveOrganization as c, formatOrgSourceLabel as i, resolveListActiveOrganizationId as l, ORG_STORED_KEYS_HINT as n, requireEffectiveOrganization as o, buildOrgListRows as r, requireOrganizationId as s, ORG_CONTEXT_HINT as t, warnUnknownOrganizationOverride as u };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { i as formatOrgSourceLabel } from "./org-context-BI9OSpbb.mjs";
|
|
6
|
+
import Table from "cli-table3";
|
|
7
|
+
//#region src/commands/org/org-output.ts
|
|
8
|
+
function formatOrgStatus(row) {
|
|
9
|
+
const parts = [];
|
|
10
|
+
if (row.current) parts.push("current");
|
|
11
|
+
if (row.keyStored) parts.push("key stored");
|
|
12
|
+
return parts.length > 0 ? parts.join(", ") : "—";
|
|
13
|
+
}
|
|
14
|
+
function renderOrgListHuman(rows) {
|
|
15
|
+
ui.header("Organizations");
|
|
16
|
+
if (rows.length === 0) {
|
|
17
|
+
ui.hint("You do not belong to any organization.");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const table = new Table({
|
|
21
|
+
head: [
|
|
22
|
+
"Name",
|
|
23
|
+
"ID",
|
|
24
|
+
"Status"
|
|
25
|
+
],
|
|
26
|
+
style: { head: [] }
|
|
27
|
+
});
|
|
28
|
+
for (const row of rows) table.push([
|
|
29
|
+
row.name,
|
|
30
|
+
row.id,
|
|
31
|
+
formatOrgStatus(row)
|
|
32
|
+
]);
|
|
33
|
+
ui.text(table.toString());
|
|
34
|
+
ui.hint(`${rows.length} organization(s)`);
|
|
35
|
+
}
|
|
36
|
+
function renderOrgListJson(params) {
|
|
37
|
+
writeJson({
|
|
38
|
+
organizations: params.rows.map((row) => ({
|
|
39
|
+
id: row.id,
|
|
40
|
+
name: row.name,
|
|
41
|
+
current: row.current,
|
|
42
|
+
keyStored: row.keyStored
|
|
43
|
+
})),
|
|
44
|
+
activeOrganizationId: params.activeOrganizationId
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function renderOrgCurrentHuman(effective) {
|
|
48
|
+
ui.header("Current organization");
|
|
49
|
+
const label = effective.name ?? effective.organizationId;
|
|
50
|
+
ui.text(label);
|
|
51
|
+
ui.hint(`ID: ${effective.organizationId}`);
|
|
52
|
+
ui.hint(`Source: ${formatOrgSourceLabel(effective.source)}`);
|
|
53
|
+
}
|
|
54
|
+
function renderOrgCurrentJson(effective) {
|
|
55
|
+
writeJson({
|
|
56
|
+
organization: {
|
|
57
|
+
id: effective.organizationId,
|
|
58
|
+
name: effective.name ?? null
|
|
59
|
+
},
|
|
60
|
+
source: effective.source
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { renderOrgListJson as i, renderOrgCurrentJson as n, renderOrgListHuman as r, renderOrgCurrentHuman as t };
|