@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,9 +1,9 @@
|
|
|
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 isIamJsonMode, t as handleIamError } from "./iam-command-utils-
|
|
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
7
|
//#region src/commands/admin/orgs.create.handler.ts
|
|
8
8
|
async function handleAdminOrgsCreate(options, ctx) {
|
|
9
9
|
const client = requireClient(ctx);
|
|
@@ -1,9 +1,9 @@
|
|
|
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 isIamJsonMode, t as handleIamError } from "./iam-command-utils-
|
|
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
7
|
//#region src/commands/admin/orgs.get.handler.ts
|
|
8
8
|
async function handleAdminOrgsGet(options, ctx) {
|
|
9
9
|
const client = requireClient(ctx);
|
|
@@ -1,9 +1,9 @@
|
|
|
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 isIamJsonMode, t as handleIamError } from "./iam-command-utils-
|
|
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
7
|
import Table from "cli-table3";
|
|
8
8
|
//#region src/commands/admin/orgs.list.handler.ts
|
|
9
9
|
async function handleAdminOrgsList(_options, ctx) {
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { x as toErrorMessage } from "./keystroke.mjs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
|
+
//#region src/lib/package-manager.ts
|
|
8
|
+
const PackageManagerValues = [
|
|
9
|
+
"npm",
|
|
10
|
+
"pnpm",
|
|
11
|
+
"yarn",
|
|
12
|
+
"bun"
|
|
13
|
+
];
|
|
14
|
+
function parsePackageManagerField(value) {
|
|
15
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
16
|
+
const name = value.split("@")[0]?.trim();
|
|
17
|
+
if (name && PackageManagerValues.includes(name)) return name;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function detectFromLockfiles(directory) {
|
|
21
|
+
if (existsSync(join(directory, "bun.lockb")) || existsSync(join(directory, "bun.lock"))) return "bun";
|
|
22
|
+
if (existsSync(join(directory, "pnpm-lock.yaml"))) return "pnpm";
|
|
23
|
+
if (existsSync(join(directory, "yarn.lock"))) return "yarn";
|
|
24
|
+
if (existsSync(join(directory, "package-lock.json")) || existsSync(join(directory, "npm-shrinkwrap.json"))) return "npm";
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function readPackageManagerField(directory) {
|
|
28
|
+
const packageJsonPath = join(directory, "package.json");
|
|
29
|
+
if (!existsSync(packageJsonPath)) return null;
|
|
30
|
+
try {
|
|
31
|
+
return parsePackageManagerField(JSON.parse(readFileSync(packageJsonPath, "utf8")).packageManager);
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function walkProjectDirectories(startDir) {
|
|
37
|
+
const directories = [];
|
|
38
|
+
let directory = startDir;
|
|
39
|
+
while (true) {
|
|
40
|
+
directories.push(directory);
|
|
41
|
+
const parent = dirname(directory);
|
|
42
|
+
if (parent === directory) break;
|
|
43
|
+
directory = parent;
|
|
44
|
+
}
|
|
45
|
+
return directories;
|
|
46
|
+
}
|
|
47
|
+
function hasPackageManagerSignal(cwd) {
|
|
48
|
+
for (const directory of walkProjectDirectories(cwd)) {
|
|
49
|
+
if (detectFromLockfiles(directory)) return true;
|
|
50
|
+
if (readPackageManagerField(directory)) return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Infers the package manager for the current working directory by walking up
|
|
56
|
+
* from `cwd` and preferring lockfiles (monorepo roots) over nested package.json
|
|
57
|
+
* files without lockfiles.
|
|
58
|
+
*/
|
|
59
|
+
function detectPackageManager(options = {}) {
|
|
60
|
+
let packageManagerFromField = null;
|
|
61
|
+
for (const directory of walkProjectDirectories(options.cwd ?? process.cwd())) {
|
|
62
|
+
const fromLockfiles = detectFromLockfiles(directory);
|
|
63
|
+
if (fromLockfiles) return fromLockfiles;
|
|
64
|
+
const fromField = readPackageManagerField(directory);
|
|
65
|
+
if (fromField && !packageManagerFromField) packageManagerFromField = fromField;
|
|
66
|
+
}
|
|
67
|
+
return packageManagerFromField ?? "npm";
|
|
68
|
+
}
|
|
69
|
+
async function resolvePackageManagerResolution(options = {}) {
|
|
70
|
+
const cwd = options.cwd ?? process.cwd();
|
|
71
|
+
if (hasPackageManagerSignal(cwd)) return {
|
|
72
|
+
packageManager: detectPackageManager({ cwd }),
|
|
73
|
+
source: "project"
|
|
74
|
+
};
|
|
75
|
+
if (await (options.isPackageManagerAvailable ?? isPackageManagerOnPath)("pnpm")) return {
|
|
76
|
+
packageManager: "pnpm",
|
|
77
|
+
source: "preferred"
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
packageManager: "npm",
|
|
81
|
+
source: "fallback"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function formatPackageInstallCommand(packageName, options = {}) {
|
|
85
|
+
const packageManager = options.packageManager ?? detectPackageManager({ cwd: options.cwd });
|
|
86
|
+
if (packageManager === "npm") return `npm install ${packageName}`;
|
|
87
|
+
if (packageManager === "pnpm") return `pnpm add ${packageName}`;
|
|
88
|
+
if (packageManager === "yarn") return `yarn add ${packageName}`;
|
|
89
|
+
return `bun add ${packageName}`;
|
|
90
|
+
}
|
|
91
|
+
function buildProjectInstallCommand(packageManager) {
|
|
92
|
+
if (packageManager === "pnpm") return {
|
|
93
|
+
command: "pnpm",
|
|
94
|
+
args: ["install"]
|
|
95
|
+
};
|
|
96
|
+
if (packageManager === "yarn") return {
|
|
97
|
+
command: "yarn",
|
|
98
|
+
args: ["install"]
|
|
99
|
+
};
|
|
100
|
+
if (packageManager === "bun") return {
|
|
101
|
+
command: "bun",
|
|
102
|
+
args: ["install"]
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
command: "npm",
|
|
106
|
+
args: ["install"]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function isPackageManagerOnPath(packageManager) {
|
|
110
|
+
return new Promise((resolve) => {
|
|
111
|
+
const child = spawn(packageManager, ["--version"], {
|
|
112
|
+
stdio: "ignore",
|
|
113
|
+
shell: process.platform === "win32"
|
|
114
|
+
});
|
|
115
|
+
child.on("error", () => resolve(false));
|
|
116
|
+
child.on("close", (code) => resolve(code === 0));
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function readYarnMajorVersion() {
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
const child = spawn("yarn", ["--version"], {
|
|
122
|
+
stdio: [
|
|
123
|
+
"ignore",
|
|
124
|
+
"pipe",
|
|
125
|
+
"ignore"
|
|
126
|
+
],
|
|
127
|
+
shell: process.platform === "win32"
|
|
128
|
+
});
|
|
129
|
+
let output = "";
|
|
130
|
+
child.stdout?.on("data", (chunk) => {
|
|
131
|
+
output += chunk.toString();
|
|
132
|
+
});
|
|
133
|
+
child.on("error", () => resolve(null));
|
|
134
|
+
child.on("close", (code) => {
|
|
135
|
+
if (code !== 0) {
|
|
136
|
+
resolve(null);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const major = Number.parseInt(output.trim().split(".")[0] ?? "", 10);
|
|
140
|
+
resolve(Number.isFinite(major) ? major : null);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async function runProjectInstall(options) {
|
|
145
|
+
const installCommand = buildProjectInstallCommand(options.packageManager);
|
|
146
|
+
return (options.runCommand ?? runPackageManagerCommand)(installCommand, { cwd: options.cwd });
|
|
147
|
+
}
|
|
148
|
+
function runPackageManagerCommand({ command, args }, options) {
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
const child = spawn(command, args, {
|
|
151
|
+
cwd: options.cwd,
|
|
152
|
+
stdio: "inherit",
|
|
153
|
+
shell: process.platform === "win32"
|
|
154
|
+
});
|
|
155
|
+
child.on("error", (error) => {
|
|
156
|
+
reject(new Error(`Failed to start ${command}: ${toErrorMessage(error)}`, { cause: error }));
|
|
157
|
+
});
|
|
158
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { readYarnMajorVersion as a, formatPackageInstallCommand as i, buildProjectInstallCommand as n, resolvePackageManagerResolution as o, detectPackageManager as r, runProjectInstall as s, PackageManagerValues as t };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { i as requireClient } from "./context-
|
|
3
|
+
import { N as throwReportedCliExit, k as CliExitError, p as ui, 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 assertAuthoredWorkflowId, t as WORKFLOW_ID_COMMANDS } from "./authored-workflow-ref-fkHEEVnd.mjs";
|
|
6
8
|
//#region src/commands/workflows/paused/paused.handler.ts
|
|
7
9
|
async function handleWorkflowsPaused(options, ctx) {
|
|
8
10
|
const client = requireClient(ctx);
|
|
9
11
|
try {
|
|
10
|
-
const
|
|
12
|
+
const result = await listPausedRuns(client, options);
|
|
11
13
|
if (ctx.jsonMode) {
|
|
12
|
-
writeJson(
|
|
14
|
+
writeJson(result);
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
15
|
-
if (
|
|
17
|
+
if (result.runs.length === 0) {
|
|
16
18
|
if (options.workflow) {
|
|
17
19
|
ui.hint(`No paused runs found for workflow "${options.workflow}".`);
|
|
18
20
|
return;
|
|
@@ -20,45 +22,30 @@ async function handleWorkflowsPaused(options, ctx) {
|
|
|
20
22
|
ui.hint("No paused workflow runs found.");
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
if (options.workflow) {
|
|
24
|
-
|
|
25
|
-
else if (match.kind === "name") ui.hint(`Showing paused runs matching workflow name "${options.workflow}".`);
|
|
26
|
-
}
|
|
27
|
-
for (const [index, run] of match.result.runs.entries()) {
|
|
25
|
+
if (options.workflow) ui.hint(`Showing paused runs matching workflow id "${options.workflow}".`);
|
|
26
|
+
for (const [index, run] of result.runs.entries()) {
|
|
28
27
|
ui.text(renderPausedRun(run));
|
|
29
|
-
if (index <
|
|
28
|
+
if (index < result.runs.length - 1) ui.br();
|
|
30
29
|
}
|
|
31
|
-
ui.hint(`Showing ${
|
|
30
|
+
ui.hint(`Showing ${result.runs.length} paused run(s)${options.type ? ` filtered to ${options.type}` : ""}.`);
|
|
32
31
|
} catch (error) {
|
|
32
|
+
if (error instanceof CliExitError && error.reported) throw error;
|
|
33
33
|
ui.error(`Failed to list paused workflow runs: ${toErrorMessage(error)}`);
|
|
34
34
|
throwReportedCliExit(`Failed to list paused workflow runs: ${toErrorMessage(error)}`, { cause: error });
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
async function listPausedRuns(client, options) {
|
|
38
|
-
if (!options.workflow) return {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const byAuthoredId = await client.runs.listPausedRuns({
|
|
38
|
+
if (!options.workflow) return client.runs.listPausedRuns({
|
|
39
|
+
type: options.type,
|
|
40
|
+
limit: options.limit
|
|
41
|
+
});
|
|
42
|
+
const workflowsDir = await resolveWorkflowsDir(void 0);
|
|
43
|
+
if (workflowsDir) await assertAuthoredWorkflowId(options.workflow, workflowsDir, WORKFLOW_ID_COMMANDS.paused);
|
|
44
|
+
return client.runs.listPausedRuns({
|
|
46
45
|
authoredWorkflowId: options.workflow,
|
|
47
46
|
type: options.type,
|
|
48
47
|
limit: options.limit
|
|
49
48
|
});
|
|
50
|
-
if (byAuthoredId.runs.length > 0) return {
|
|
51
|
-
kind: "authoredId",
|
|
52
|
-
result: byAuthoredId
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
kind: "name",
|
|
56
|
-
result: await client.runs.listPausedRuns({
|
|
57
|
-
workflowName: options.workflow,
|
|
58
|
-
type: options.type,
|
|
59
|
-
limit: options.limit
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
49
|
}
|
|
63
50
|
function renderPausedRun(run) {
|
|
64
51
|
const lines = [
|
|
@@ -1,28 +1,30 @@
|
|
|
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/projects/projects.command.ts
|
|
7
|
+
const loadProjectsListHandler = async () => (await import("./list2.handler-BIaIyrQf.mjs")).handleProjectsList;
|
|
8
|
+
const PROJECTS_LIST_OPTIONS = {
|
|
9
|
+
schema: JsonOptionSchema,
|
|
10
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
11
|
+
loadHandler: loadProjectsListHandler
|
|
12
|
+
};
|
|
7
13
|
function createProjectsCommand() {
|
|
8
14
|
return createTypedCommand({
|
|
9
15
|
name: "projects",
|
|
10
16
|
description: "List tracked Keystroke projects",
|
|
11
|
-
|
|
12
|
-
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
13
|
-
loadHandler: async () => (await import("./list.handler-BEMj3FyH.mjs")).handleProjectsList,
|
|
17
|
+
...PROJECTS_LIST_OPTIONS,
|
|
14
18
|
subcommands: [createTypedCommand({
|
|
15
19
|
name: "list",
|
|
16
20
|
description: "List all tracked Keystroke projects",
|
|
17
|
-
|
|
18
|
-
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
19
|
-
loadHandler: async () => (await import("./list.handler-BEMj3FyH.mjs")).handleProjectsList
|
|
21
|
+
...PROJECTS_LIST_OPTIONS
|
|
20
22
|
}), createTypedCommand({
|
|
21
23
|
name: "clear-cache",
|
|
22
24
|
description: "Clear the stored projects cache (projects.json)",
|
|
23
25
|
schema: z.object({}),
|
|
24
26
|
optionsConfig: {},
|
|
25
|
-
loadHandler: async () => (await import("./clear-cache.handler-
|
|
27
|
+
loadHandler: async () => (await import("./clear-cache.handler-gJpwslkK.mjs")).handleProjectsClearCache
|
|
26
28
|
})]
|
|
27
29
|
});
|
|
28
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
3
|
+
import { N as throwReportedCliExit, b as isNetworkError, h as AUTH_HINT, p as ui, x as toErrorMessage } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
5
|
//#region src/commands/integrations/register.handler.ts
|
|
6
6
|
function exitWithError(ctx, message, opts) {
|
|
7
7
|
if (ctx.jsonMode) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as formatPackageInstallCommand } from "./package-manager-BP3-q8hh.mjs";
|
|
5
5
|
//#region src/lib/render-operation.ts
|
|
6
6
|
function isFull(op) {
|
|
7
7
|
return "inputSchemaJson" in op;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as writeJson } from "./output-
|
|
5
|
-
import { a as readManifestsFromOutDir } from "./dist-
|
|
6
|
-
import { t as requireWorkflowsDir } from "./resolve-project-
|
|
7
|
-
import { t as readCredentialEnvMap } from "./credential-env-map-
|
|
8
|
-
import { a as loadProjectDotenvFile, c as getTerminalContentWidth, o as manifestGroupKey, s as normalizeManifestScopeToServer, t as buildCredentialWorkflowConsumersByGroup, u as truncateWithEllipsis } from "./list-enrichment-
|
|
9
|
-
import { t as groupCredentialRequirements } from "./credentials-
|
|
3
|
+
import { c as getProcessEnv, n as style, p as ui, t as ANSI } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-DnIFEmi5.mjs";
|
|
5
|
+
import { a as readManifestsFromOutDir } from "./dist-BmbFJq8U.mjs";
|
|
6
|
+
import { t as requireWorkflowsDir } from "./resolve-project-DLKlAy0z.mjs";
|
|
7
|
+
import { t as readCredentialEnvMap } from "./credential-env-map-5a41jLwM.mjs";
|
|
8
|
+
import { a as loadProjectDotenvFile, c as getTerminalContentWidth, o as manifestGroupKey, s as normalizeManifestScopeToServer, t as buildCredentialWorkflowConsumersByGroup, u as truncateWithEllipsis } from "./list-enrichment-dqbkXJzy.mjs";
|
|
9
|
+
import { t as groupCredentialRequirements } from "./credentials-DtwLbee6.mjs";
|
|
10
10
|
//#region src/commands/credentials/requirements/requirements-display.ts
|
|
11
11
|
function dimLabel(label, width = 10) {
|
|
12
12
|
return style(label.padEnd(width), ANSI.dim);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as credentials } from "./dist-
|
|
3
|
+
import { n as credentials } from "./dist-B5jy238v.mjs";
|
|
4
4
|
//#region src/lib/resolve-cli-credentials.ts
|
|
5
5
|
/**
|
|
6
6
|
* Resolves CLI credential inputs using explicit overrides first, then stored
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as projects } from "./dist-
|
|
5
|
-
import { n as findProjectRoot } from "./project-config-DudGRFPO.mjs";
|
|
3
|
+
import { j as ProjectNotFoundError, p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as projects } from "./dist-B5jy238v.mjs";
|
|
5
|
+
import { n as findProjectRoot, r as getProjectConfigPath } from "./project-config-DudGRFPO.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
|
+
import { access } from "node:fs/promises";
|
|
7
8
|
//#region src/lib/resolve-project.ts
|
|
8
9
|
/**
|
|
9
10
|
* Resolve the project root from an explicit `--path` flag or by
|
|
@@ -19,17 +20,32 @@ async function resolveWorkflowsDir(explicitPath) {
|
|
|
19
20
|
* Like `resolveWorkflowsDir` but throws a `ProjectNotFoundError`
|
|
20
21
|
* when no project is found.
|
|
21
22
|
*/
|
|
22
|
-
async function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
ui.warn("No keystroke.config.ts found in this directory or any parent directory.");
|
|
23
|
+
async function renderProjectNotFoundHints(fromCwd) {
|
|
24
|
+
if (fromCwd) ui.warn("No keystroke.config.ts found in this directory or any parent directory.");
|
|
25
|
+
else ui.warn("No keystroke.config.ts found at the provided project path.");
|
|
26
26
|
const lastProject = await projects.getLast();
|
|
27
27
|
if (lastProject) {
|
|
28
28
|
ui.hint(`Last used project: ${lastProject}`);
|
|
29
29
|
ui.hint(` cd ${lastProject}`);
|
|
30
30
|
}
|
|
31
31
|
ui.hint("Run `keystroke init` to initialize a project, or use --path.");
|
|
32
|
-
|
|
32
|
+
}
|
|
33
|
+
async function assertProjectConfigExists(projectRoot) {
|
|
34
|
+
try {
|
|
35
|
+
await access(getProjectConfigPath(projectRoot));
|
|
36
|
+
} catch {
|
|
37
|
+
await renderProjectNotFoundHints(false);
|
|
38
|
+
throw new ProjectNotFoundError("No keystroke.config.ts found");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function requireWorkflowsDir(explicitPath) {
|
|
42
|
+
const dir = await resolveWorkflowsDir(explicitPath);
|
|
43
|
+
if (!dir) {
|
|
44
|
+
await renderProjectNotFoundHints(true);
|
|
45
|
+
throw new ProjectNotFoundError("No keystroke.config.ts found");
|
|
46
|
+
}
|
|
47
|
+
if (explicitPath) await assertProjectConfigExists(dir);
|
|
48
|
+
return dir;
|
|
33
49
|
}
|
|
34
50
|
//#endregion
|
|
35
51
|
export { resolveWorkflowsDir as n, requireWorkflowsDir as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { a as readManifestsFromOutDir } from "./dist-
|
|
5
|
-
import {
|
|
6
|
-
import { n as sleep, t as TERMINAL_STATUSES } from "./run-polling-
|
|
3
|
+
import { A as InputValidationError, p as ui, x as toErrorMessage } from "./keystroke.mjs";
|
|
4
|
+
import { a as readManifestsFromOutDir } from "./dist-BmbFJq8U.mjs";
|
|
5
|
+
import { c as validateRequiredFields, n as formatMissingInputError, r as formatValidationError } from "./schema-display-sZ6ConJd.mjs";
|
|
6
|
+
import { n as sleep, t as TERMINAL_STATUSES } from "./run-polling-1c0ckC1A.mjs";
|
|
7
7
|
import * as path$1 from "node:path";
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
9
9
|
import { z } from "zod";
|
|
@@ -224,6 +224,17 @@ async function tryReadExistingInputSchema(workflowsDir, workflowName) {
|
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/commands/workflows/_shared/run-polling-render.ts
|
|
227
|
+
/**
|
|
228
|
+
* Live progress rendering for workflow runs (`workflows run --wait`, `--follow`, test polling).
|
|
229
|
+
*
|
|
230
|
+
* `pollForCompletion` fetches a full snapshot each tick (run status + all events + logs). This
|
|
231
|
+
* module turns each snapshot into CLI hints; it does not affect execution or JSON output.
|
|
232
|
+
*/
|
|
233
|
+
const CORRELATION_ID_COLLATOR = new Intl.Collator("en", {
|
|
234
|
+
numeric: true,
|
|
235
|
+
sensitivity: "base"
|
|
236
|
+
});
|
|
237
|
+
const LOG_DISPLAY_ORDER = 35;
|
|
227
238
|
function createRuntimeRenderState() {
|
|
228
239
|
return {
|
|
229
240
|
seenEventIds: /* @__PURE__ */ new Set(),
|
|
@@ -232,21 +243,92 @@ function createRuntimeRenderState() {
|
|
|
232
243
|
lastStatus: void 0
|
|
233
244
|
};
|
|
234
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Print any new logs, events, and run-status lines from one poll snapshot.
|
|
248
|
+
*
|
|
249
|
+
* Render order within a snapshot is intentional:
|
|
250
|
+
* 1. Logs and events are facts observed during the run.
|
|
251
|
+
* 2. Run status is a summary and must come last.
|
|
252
|
+
*
|
|
253
|
+
* On the final poll, `run.status` is often already `completed` while `events` still
|
|
254
|
+
* contains step history we have not printed yet. Printing status first made it look like
|
|
255
|
+
* the workflow finished before steps ran.
|
|
256
|
+
*/
|
|
235
257
|
function renderRunSnapshot(snapshot, state, verbose) {
|
|
258
|
+
const renderItems = buildNewRenderItems(snapshot, state);
|
|
259
|
+
for (const item of sortRenderItemsChronologically(renderItems)) if (item.kind === "log") {
|
|
260
|
+
state.seenLogIds.add(item.log.id);
|
|
261
|
+
renderRunLog(item.log, verbose);
|
|
262
|
+
} else {
|
|
263
|
+
state.seenEventIds.add(item.event.id);
|
|
264
|
+
renderRuntimeEvent(item.event, state.stepStates, verbose);
|
|
265
|
+
}
|
|
236
266
|
if (snapshot.run.status !== state.lastStatus) {
|
|
237
267
|
ui.hint(`Run status: ${snapshot.run.status}`);
|
|
238
268
|
state.lastStatus = snapshot.run.status;
|
|
239
269
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
270
|
+
}
|
|
271
|
+
function buildNewRenderItems(snapshot, state) {
|
|
272
|
+
const logs = snapshot.logs.filter((log) => !state.seenLogIds.has(log.id)).map((log) => ({
|
|
273
|
+
kind: "log",
|
|
274
|
+
log,
|
|
275
|
+
timestamp: log.timestamp,
|
|
276
|
+
correlationId: log.correlationId ?? "",
|
|
277
|
+
displayOrder: LOG_DISPLAY_ORDER,
|
|
278
|
+
id: log.id
|
|
279
|
+
}));
|
|
280
|
+
const events = snapshot.events.filter((event) => !state.seenEventIds.has(event.id)).map((event) => ({
|
|
281
|
+
kind: "event",
|
|
282
|
+
event,
|
|
283
|
+
timestamp: event.createdAt,
|
|
284
|
+
correlationId: event.correlationId,
|
|
285
|
+
displayOrder: eventTypeDisplayOrder(event.eventType),
|
|
286
|
+
id: event.id
|
|
287
|
+
}));
|
|
288
|
+
return [...logs, ...events];
|
|
289
|
+
}
|
|
290
|
+
function sortRenderItemsChronologically(items) {
|
|
291
|
+
return [...items].sort(compareRenderItemsChronologically);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Display order for events that share a `createdAt` (common when the executor
|
|
295
|
+
* persists a batch with one timestamp). Sorting by `id` alone is unsafe because
|
|
296
|
+
* microsandbox event ids embed the type (`…:step_completed:1` < `…:step_started:1`).
|
|
297
|
+
*/
|
|
298
|
+
const EVENT_TYPE_DISPLAY_ORDER = {
|
|
299
|
+
trigger_transform: 5,
|
|
300
|
+
step_created: 10,
|
|
301
|
+
step_started: 20,
|
|
302
|
+
step_retrying: 30,
|
|
303
|
+
step_completed: 40,
|
|
304
|
+
step_failed: 50,
|
|
305
|
+
hook_created: 10,
|
|
306
|
+
hook_resumed: 40,
|
|
307
|
+
hook_cancelled: 50,
|
|
308
|
+
wait_created: 10,
|
|
309
|
+
wait_completed: 40,
|
|
310
|
+
stream_chunk: 35,
|
|
311
|
+
child_workflow_created: 10,
|
|
312
|
+
child_workflow_completed: 40,
|
|
313
|
+
child_workflow_failed: 50,
|
|
314
|
+
agent_created: 10,
|
|
315
|
+
agent_started: 20,
|
|
316
|
+
agent_completed: 40,
|
|
317
|
+
agent_failed: 50,
|
|
318
|
+
agent_cancelled: 50
|
|
319
|
+
};
|
|
320
|
+
function eventTypeDisplayOrder(eventType) {
|
|
321
|
+
return EVENT_TYPE_DISPLAY_ORDER[eventType];
|
|
322
|
+
}
|
|
323
|
+
/** Ascending timestamp, then correlation, lifecycle/log position, then id. */
|
|
324
|
+
function compareRenderItemsChronologically(a, b) {
|
|
325
|
+
const timeDiff = Date.parse(a.timestamp) - Date.parse(b.timestamp);
|
|
326
|
+
if (timeDiff !== 0) return timeDiff;
|
|
327
|
+
const correlationDiff = CORRELATION_ID_COLLATOR.compare(a.correlationId, b.correlationId);
|
|
328
|
+
if (correlationDiff !== 0) return correlationDiff;
|
|
329
|
+
const displayOrderDiff = a.displayOrder - b.displayOrder;
|
|
330
|
+
if (displayOrderDiff !== 0) return displayOrderDiff;
|
|
331
|
+
return a.id.localeCompare(b.id);
|
|
250
332
|
}
|
|
251
333
|
function renderRunLog(log, verbose) {
|
|
252
334
|
const message = `${`log[${log.source}:${log.level}]`} ${log.message}`;
|
|
@@ -339,6 +421,7 @@ function toObject(value) {
|
|
|
339
421
|
//#endregion
|
|
340
422
|
//#region src/commands/workflows/_shared/run-polling.ts
|
|
341
423
|
const POLL_INTERVAL_MS = 1e3;
|
|
424
|
+
/** Poll until the run reaches a terminal status. When `render` is true, see `renderRunSnapshot`. */
|
|
342
425
|
async function pollForCompletion(client, runId, timeoutSeconds, verbose, render = true) {
|
|
343
426
|
const deadline = Date.now() + timeoutSeconds * 1e3;
|
|
344
427
|
const renderState = createRuntimeRenderState();
|