@keystrokehq/cli 0.0.32 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -4
- package/dist/{accept.handler-DNfIXPSP.mjs → accept.handler-CykuBpt6.mjs} +4 -4
- package/dist/{admin-CJp8XksD.mjs → admin-gRjPC3eD.mjs} +10 -10
- package/dist/{agent-manifest-De5TCxZq.mjs → agent-manifest-DfWD5tvv.mjs} +17 -27
- package/dist/{agents-G37PM35Z.mjs → agents-BpyuvM9p.mjs} +9 -9
- package/dist/{api-keys-4igNHJ_W.mjs → api-keys-BSKhdD_x.mjs} +6 -6
- package/dist/{api-BK3EhPvs.mjs → api-sWkB_Wta.mjs} +1 -1
- package/dist/{auth-CIOmmV4x.mjs → auth-DCgToFf5.mjs} +6 -6
- package/dist/{auth.handler-CznN_vfz.mjs → auth.handler-QRQAEUJC.mjs} +3 -3
- package/dist/authored-workflow-ref-BRCQgyWl.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-D_SQqdHA.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-DGQn_clk.mjs} +12 -9
- package/dist/{clear-cache.handler-BP0K1-uN.mjs → clear-cache.handler-gJpwslkK.mjs} +2 -2
- package/dist/{clear.handler-PsA5QKHx.mjs → clear.handler-CuXYvUj2.mjs} +2 -2
- package/dist/{clear.handler-T27GpgSu.mjs → clear.handler-DnjvgyMj.mjs} +1 -1
- package/dist/{commander-BlrSdFcu.mjs → commander-B_8QwPpe.mjs} +22 -3
- package/dist/{connect-BbLJhlIA.mjs → connect-DV9lhP6C.mjs} +3 -3
- package/dist/{connect.handler-BthE-7Wg.mjs → connect.handler-D6JzuFuT.mjs} +5 -5
- package/dist/{context-sgKhRc5v.mjs → context-Brc9VGV9.mjs} +4 -4
- package/dist/{create.handler-BovbO_g0.mjs → create.handler-D_tmjANR.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-CStYUB2h.mjs} +1 -1
- package/dist/{credentials-DKrSaaLw.mjs → credentials-DtwLbee6.mjs} +1 -1
- package/dist/{credentials-CsncZ52a.mjs → credentials-UDrvrKj-.mjs} +10 -10
- package/dist/current-deployment-workflow-CknsHF5T.mjs +20 -0
- package/dist/current.handler-Cy91EeLU.mjs +19 -0
- package/dist/{delete.handler-DkAK396w.mjs → delete.handler-rUDDUrDQ.mjs} +2 -2
- package/dist/{deploy-DvPfR9fC.mjs → deploy-DgWPlEKO.mjs} +2 -2
- package/dist/{deploy-progress-BsUH7fGE.mjs → deploy-progress-BDOCSm_U.mjs} +2 -2
- package/dist/{deploy.handler-BW3f2N2G.mjs → deploy.handler-BDCHCk_A.mjs} +16 -16
- package/dist/{diff-utils-Bs--xmoV.mjs → diff-utils-YEUYtSRs.mjs} +1 -1
- package/dist/{diff.handler-BwhsoAg0.mjs → diff.handler-CGERP-Qn.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--8FRrSlJ.mjs} +52 -29
- package/dist/{error-boundary-0veZ_RDS.mjs → error-boundary-D2DiCLAp.mjs} +3 -3
- package/dist/{iam-command-utils-CSZj4XlH.mjs → iam-command-utils-D01Gw8-M.mjs} +3 -13
- package/dist/{import-module-y0glInUe-DV_3dsU0.mjs → import-module-y0glInUe-EuAWaw9g.mjs} +506 -128
- package/dist/{init-BOCDwqKR.mjs → init-Mpe_8lA_.mjs} +3 -3
- package/dist/{init.handler-B3T4J6u_.mjs → init.handler-BjLAIAmm.mjs} +5 -5
- package/dist/{inspect.handler-v9snxDLi.mjs → inspect.handler-CXCi7fhH.mjs} +24 -13
- package/dist/{integration-catalog-CiZ62hb_.mjs → integration-catalog-mZs6EAlN.mjs} +3 -3
- package/dist/{integrations-m7_tb3GV.mjs → integrations-D_IH5Ud1.mjs} +7 -7
- package/dist/{invites-BuatfJmN.mjs → invites-CWWz4wmY.mjs} +5 -5
- package/dist/{invites.list.handler-CK6mL10z.mjs → invites.list.handler-CQLWSoWo.mjs} +6 -5
- package/dist/{invites.resend.handler-CKZouK1Z.mjs → invites.resend.handler-CeIGE_qM.mjs} +6 -5
- package/dist/{invites.revoke.handler-H0VI-3sp.mjs → invites.revoke.handler-9K6jkym_.mjs} +6 -5
- package/dist/keystroke.mjs +139 -82
- package/dist/{list-enrichment-DP1wEyBZ.mjs → list-enrichment-dqbkXJzy.mjs} +2 -2
- package/dist/list.handler-BvuxTFLe.mjs +64 -0
- package/dist/list.handler-CDWPmiMy.mjs +39 -0
- package/dist/{list.handler-DVnFrlis.mjs → list.handler-Co32_F3n.mjs} +7 -7
- package/dist/{list.handler-CMRQKH4b.mjs → list.handler-Cuw1fWO_.mjs} +41 -12
- package/dist/{list.handler-DbYUk6ko.mjs → list.handler-D-rSyrX0.mjs} +5 -5
- package/dist/{list.handler-DIMWZx78.mjs → list.handler-DMvq96UA.mjs} +4 -4
- package/dist/{list.handler-LxZInip2.mjs → list.handler-DUTNS8du.mjs} +4 -4
- package/dist/{list.handler-BiY5NFWd.mjs → list.handler-Dz-Yeijp.mjs} +3 -3
- package/dist/list2.handler-BpqKZTZk.mjs +99 -0
- package/dist/{listen-C_7Rgwkb.mjs → listen-CeNwufij.mjs} +3 -3
- package/dist/{listen.handler-dJgorIzr.mjs → listen.handler-CfRoaOwu.mjs} +4 -4
- package/dist/{logs-B9YMhUGt.mjs → logs-B7k2_W1R.mjs} +3 -3
- package/dist/{logs.handler-DGGVPMOX.mjs → logs.handler-BIqJ0FED.mjs} +1 -1
- package/dist/{logs.handler-BfjCsAyq.mjs → logs.handler-CSqOzxCU.mjs} +26 -29
- package/dist/{members.add.handler-DSRCRxsI.mjs → members.add.handler-CBjoA6vG.mjs} +6 -5
- package/dist/{members.invite.handler-BNpHn1dY.mjs → members.invite.handler-D8KcKJ9Y.mjs} +6 -5
- package/dist/{members.list.handler-Bn9LJEPG.mjs → members.list.handler-CB_qSJK0.mjs} +6 -5
- package/dist/{members.remove.handler-Dkr2t_tX.mjs → members.remove.handler-DNhO81mo.mjs} +6 -5
- package/dist/{members.update.handler-DBtUYuAY.mjs → members.update.handler-Bjdk_uz4.mjs} +6 -5
- package/dist/{operations-CF2nUiBs.mjs → operations-HHwoArwE.mjs} +5 -5
- package/dist/org-context-CNh2p2DP.mjs +112 -0
- package/dist/{org-DOH7YHk2.mjs → org-f-qo68Em.mjs} +35 -28
- package/dist/org-output-BcI17Uan.mjs +64 -0
- package/dist/{orgs.create.handler-BO70zIdp.mjs → orgs.create.handler-DOE9ZIed.mjs} +4 -4
- package/dist/{orgs.get.handler-BuGg5bc9.mjs → orgs.get.handler-sWErVI7r.mjs} +4 -4
- package/dist/{orgs.list.handler--5HutMkl.mjs → orgs.list.handler-Cp-mXsA0.mjs} +4 -4
- package/dist/{output-BWcVRt-T.mjs → output-BPydP5tG.mjs} +1 -1
- package/dist/{package-manager-CvY4IW7X.mjs → package-manager-BwJ6muas.mjs} +27 -2
- package/dist/{paused.handler-DHvxz-cC.mjs → paused.handler-DWdoKYY8.mjs} +20 -33
- package/dist/{projects-C5GZ5Jrf.mjs → projects-CCC36zbJ.mjs} +11 -9
- package/dist/{register.handler-CKMZ2WmD.mjs → register.handler-Dxae5iq8.mjs} +3 -3
- package/dist/{render-credential-Bn15FEUC.mjs → render-credential-D-H1ECDt.mjs} +1 -1
- package/dist/{render-operation-DWbMwhfc.mjs → render-operation-iF7Wblv2.mjs} +2 -2
- package/dist/{requirements.handler-B5rqCjMu.mjs → requirements.handler-Bg3mRnER.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-CoCN9xfi.mjs} +24 -8
- package/dist/{run-polling-DawiBus-.mjs → run-polling-htHWhG0T.mjs} +97 -14
- package/dist/{run.handler-BG7xitEK.mjs → run.handler-C-CM-xZG.mjs} +42 -30
- package/dist/{runs-swYYBT6C.mjs → runs-BRJPNq4B.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-CA0J5NOY.mjs → search-CQMgdp51.mjs} +3 -3
- package/dist/{search.handler-BVDsYZlJ.mjs → search.handler-Dn5jjyF-.mjs} +6 -6
- package/dist/show.handler-CdZF0aao.mjs +79 -0
- package/dist/{show.handler-CsidInW8.mjs → show.handler-D3nDc1MJ.mjs} +5 -5
- package/dist/{show.handler-CwwnCmbp.mjs → show.handler-DUDxnNiZ.mjs} +6 -6
- package/dist/{skill-installer-DG8kTaQR.mjs → skill-installer-DYNH_MJT.mjs} +3 -1
- package/dist/{skills-sync.handler-yRmi3OgP.mjs → skills-sync.handler-_LVhIMRH.mjs} +13 -7
- package/dist/{skills.command-COYd3k4Z.mjs → skills.command-DSHGwXPX.mjs} +5 -5
- package/dist/skills.handler-DqLXJepA.mjs +9 -0
- package/dist/{spinner-progress-lrKDs4YF.mjs → spinner-progress-fLaD0sjH.mjs} +1 -1
- package/dist/status.handler-1hEzX5oB.mjs +72 -0
- package/dist/{switch.handler-BwYndsP-.mjs → switch.handler-D135WwfB.mjs} +17 -4
- package/dist/{sync-6fZkIUtn.mjs → sync-CFScllh3.mjs} +2 -2
- package/dist/{sync.handler-Ctr-cN9X.mjs → sync.handler-x8v53-TT.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-Dx4RXoLZ.mjs} +5 -5
- package/dist/{test.handler-DLaxrJ9V.mjs → test.handler-BmvL5vF8.mjs} +19 -16
- package/dist/{test.handler-BCW0YBPd.mjs → test.handler-Mz_XOnJl.mjs} +2 -2
- package/dist/{tool.handler-8qNmgdRe.mjs → tool.handler-DsbpocYI.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-C9G6HksL.mjs} +4 -8
- package/dist/upgrade.handler-DsFeAFF4.mjs +99 -0
- package/dist/{upload.handler-B7xle1oX.mjs → upload.handler-DscKDQ63.mjs} +9 -9
- package/dist/{users.get.handler-C4t1vXwi.mjs → users.get.handler-CaUv_maM.mjs} +4 -4
- package/dist/{users.list.handler-Dvl90grq.mjs → users.list.handler-DzsOvAtd.mjs} +4 -4
- package/dist/{users.set-role.handler-Djw1_VGf.mjs → users.set-role.handler-koRzA0V9.mjs} +4 -4
- package/dist/{validate.handler-Drf_lssw.mjs → validate.handler-BkBsS8BL.mjs} +171 -26
- package/dist/{workflow-build-Begvjfq8.mjs → workflow-build-Db6at6IA.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-B8VG6nKg.mjs} +34 -37
- package/dist/{writer-byNNUjRm-B-on1n6c.mjs → writer-BLg0RuZa-Y6ExdYH9.mjs} +6 -4
- package/package.json +10 -10
- 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/schemas-D2zfmyC-.mjs +0 -671
- package/dist/show.handler-nkK6Erbb.mjs +0 -31
- 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, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-
|
|
3
|
+
import { p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-BPydP5tG.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-Brc9VGV9.mjs";
|
|
6
|
+
import { n as isIamJsonMode, r as requireConfirmation, t as handleIamError } from "./iam-command-utils-D01Gw8-M.mjs";
|
|
7
7
|
//#region src/commands/admin/users.set-role.handler.ts
|
|
8
8
|
async function handleAdminUsersSetRole(options, ctx) {
|
|
9
9
|
const client = requireClient(ctx);
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { i as projects } from "./dist-
|
|
5
|
-
import { i as writeJson } from "./output-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
3
|
+
import { P as throwReportedCliExit, S as toErrorMessage, p as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as projects } from "./dist-B5jy238v.mjs";
|
|
5
|
+
import { i as writeJson } from "./output-BPydP5tG.mjs";
|
|
6
|
+
import { a as readManifestsFromOutDir } from "./dist-BmbFJq8U.mjs";
|
|
7
|
+
import { t as requireWorkflowsDir } from "./resolve-project-CoCN9xfi.mjs";
|
|
8
|
+
import { c as build, s as typecheckWorkflows, t as WorkflowNotFoundError } from "./workflow-build-Db6at6IA.mjs";
|
|
9
|
+
import { t as createBuildProgress } from "./build-progress-D_SQqdHA.mjs";
|
|
10
|
+
import { n as assertAuthoredWorkflowId, t as WORKFLOW_ID_COMMANDS } from "./authored-workflow-ref-BRCQgyWl.mjs";
|
|
9
11
|
import * as path$1 from "node:path";
|
|
10
12
|
import * as os from "node:os";
|
|
11
|
-
import { mkdtemp, rm } from "node:fs/promises";
|
|
13
|
+
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
|
12
14
|
//#region src/commands/workflows/validate/workflow-validate.ts
|
|
13
|
-
/**
|
|
14
|
-
* workflow-validate.ts
|
|
15
|
-
*
|
|
16
|
-
* Validation-only build: runs analysis phases without
|
|
17
|
-
* writing any permanent output artifacts. Uses a temp dir cleaned up afterwards.
|
|
18
|
-
*/
|
|
19
15
|
var WorkflowValidationFailedError = class extends Error {
|
|
20
16
|
result;
|
|
21
17
|
constructor(result) {
|
|
@@ -42,12 +38,13 @@ async function runWorkflowValidate(options) {
|
|
|
42
38
|
});
|
|
43
39
|
}
|
|
44
40
|
const totalMs = Date.now() - startTime;
|
|
45
|
-
let result = mapBuildResultToValidateResult(buildResult, totalMs);
|
|
41
|
+
let result = await mapBuildResultToValidateResult(buildResult, totalMs);
|
|
42
|
+
if (options.typecheck !== false) result = await appendTypecheckToValidateResult(result, options.workflowsDir);
|
|
46
43
|
result = filterValidationResult(result, options.workflow);
|
|
47
44
|
if (!result.success) throw new WorkflowValidationFailedError(result);
|
|
48
45
|
return result;
|
|
49
46
|
}
|
|
50
|
-
function mapBuildResultToValidateResult(buildResult, totalMs) {
|
|
47
|
+
async function mapBuildResultToValidateResult(buildResult, totalMs) {
|
|
51
48
|
const workflowMap = /* @__PURE__ */ new Map();
|
|
52
49
|
for (const artifact of buildResult.artifacts) workflowMap.set(artifact.manifest.id, {
|
|
53
50
|
id: artifact.manifest.id,
|
|
@@ -56,6 +53,7 @@ function mapBuildResultToValidateResult(buildResult, totalMs) {
|
|
|
56
53
|
issues: []
|
|
57
54
|
});
|
|
58
55
|
for (const failure of buildResult.failures) appendFailureIssue(workflowMap, failure);
|
|
56
|
+
await enrichAuthoredWorkflowIds(workflowMap);
|
|
59
57
|
if (buildResult.warnings.length > 0) workflowMap.set("__project__", {
|
|
60
58
|
name: "project",
|
|
61
59
|
filePath: "",
|
|
@@ -79,11 +77,13 @@ function mapBuildResultToValidateResult(buildResult, totalMs) {
|
|
|
79
77
|
function appendFailureIssue(workflowMap, failure) {
|
|
80
78
|
if (failure.kind === "workflow" || failure.kind === "loader-protocol") {
|
|
81
79
|
const key = failure.workflow.resolvedFilePath;
|
|
82
|
-
const
|
|
83
|
-
|
|
80
|
+
const authoredId = failure.workflow.workflowId ?? resolveAuthoredIdFromWorkflowMap(workflowMap, failure.workflow.resolvedFilePath);
|
|
81
|
+
const existing = workflowMap.get(key) ?? workflowMap.get(authoredId ?? "") ?? createWorkflowValidateStats({
|
|
82
|
+
id: authoredId,
|
|
84
83
|
name: path$1.basename(failure.workflow.resolvedFilePath, path$1.extname(failure.workflow.resolvedFilePath)),
|
|
85
84
|
filePath: failure.workflow.resolvedFilePath
|
|
86
85
|
});
|
|
86
|
+
if (!existing.id && authoredId) existing.id = authoredId;
|
|
87
87
|
existing.issues.push({
|
|
88
88
|
severity: "error",
|
|
89
89
|
file: failure.workflow.resolvedFilePath,
|
|
@@ -142,6 +142,7 @@ function appendFailureIssue(workflowMap, failure) {
|
|
|
142
142
|
if (failure.kind === "trigger") {
|
|
143
143
|
const key = `trigger:${failure.workflowId}:${failure.triggerExportName}`;
|
|
144
144
|
const existing = workflowMap.get(key) ?? createWorkflowValidateStats({
|
|
145
|
+
id: failure.workflowId,
|
|
145
146
|
name: failure.triggerId,
|
|
146
147
|
filePath: ""
|
|
147
148
|
});
|
|
@@ -198,6 +199,136 @@ function appendFailureIssue(workflowMap, failure) {
|
|
|
198
199
|
});
|
|
199
200
|
workflowMap.set(key, existing);
|
|
200
201
|
}
|
|
202
|
+
function resolveAuthoredIdFromWorkflowMap(workflowMap, filePath) {
|
|
203
|
+
for (const stats of workflowMap.values()) if (stats.id && stats.filePath === filePath) return stats.id;
|
|
204
|
+
}
|
|
205
|
+
const AUTHORED_WORKFLOW_ID_PATTERN = /\bid:\s*['"]([^'"]+)['"]/;
|
|
206
|
+
async function readAuthoredWorkflowIdFromSource(filePath) {
|
|
207
|
+
const source = await readFile(filePath, "utf-8").catch(() => null);
|
|
208
|
+
if (!source) return;
|
|
209
|
+
return AUTHORED_WORKFLOW_ID_PATTERN.exec(source)?.[1];
|
|
210
|
+
}
|
|
211
|
+
async function collectWorkflowTypeScriptFiles(projectRoot) {
|
|
212
|
+
const workflowsRoot = path$1.join(projectRoot, "workflows");
|
|
213
|
+
const files = [];
|
|
214
|
+
async function walk(dir) {
|
|
215
|
+
let entries = [];
|
|
216
|
+
try {
|
|
217
|
+
entries = await readdir(dir, {
|
|
218
|
+
withFileTypes: true,
|
|
219
|
+
encoding: "utf8"
|
|
220
|
+
});
|
|
221
|
+
} catch {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
for (const entry of entries) {
|
|
225
|
+
if (entry.name === "node_modules" || entry.name === "dist") continue;
|
|
226
|
+
const fullPath = path$1.join(dir, entry.name);
|
|
227
|
+
if (entry.isDirectory()) await walk(fullPath);
|
|
228
|
+
else if (entry.isFile() && /\.tsx?$/.test(entry.name)) files.push(fullPath);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
await walk(workflowsRoot);
|
|
232
|
+
return files;
|
|
233
|
+
}
|
|
234
|
+
function findWorkflowStatsForDiagnosticFile(workflowMap, diagnosticFile) {
|
|
235
|
+
const resolvedFile = path$1.resolve(diagnosticFile);
|
|
236
|
+
for (const stats of workflowMap.values()) {
|
|
237
|
+
if (!stats.filePath) continue;
|
|
238
|
+
const workflowFile = path$1.resolve(stats.filePath);
|
|
239
|
+
const workflowDir = path$1.dirname(workflowFile);
|
|
240
|
+
if (resolvedFile === workflowFile || resolvedFile.startsWith(`${workflowDir}${path$1.sep}`)) return stats;
|
|
241
|
+
}
|
|
242
|
+
const fallback = createWorkflowValidateStats({
|
|
243
|
+
name: path$1.basename(resolvedFile, path$1.extname(resolvedFile)),
|
|
244
|
+
filePath: resolvedFile
|
|
245
|
+
});
|
|
246
|
+
workflowMap.set(resolvedFile, fallback);
|
|
247
|
+
return fallback;
|
|
248
|
+
}
|
|
249
|
+
function appendTypecheckDiagnostic(workflowMap, diagnostic) {
|
|
250
|
+
if (!diagnostic.file) {
|
|
251
|
+
const projectStats = workflowMap.get("__project__") ?? createWorkflowValidateStats({
|
|
252
|
+
name: "project",
|
|
253
|
+
filePath: ""
|
|
254
|
+
});
|
|
255
|
+
projectStats.issues.push({
|
|
256
|
+
severity: diagnostic.severity,
|
|
257
|
+
message: diagnostic.message,
|
|
258
|
+
type: "analysis"
|
|
259
|
+
});
|
|
260
|
+
workflowMap.set("__project__", projectStats);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
findWorkflowStatsForDiagnosticFile(workflowMap, diagnostic.file).issues.push({
|
|
264
|
+
severity: diagnostic.severity,
|
|
265
|
+
file: path$1.resolve(diagnostic.file),
|
|
266
|
+
line: diagnostic.line,
|
|
267
|
+
message: diagnostic.message,
|
|
268
|
+
type: "analysis"
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
async function appendTypecheckToValidateResult(result, projectRoot) {
|
|
272
|
+
const workflowMap = /* @__PURE__ */ new Map();
|
|
273
|
+
for (const workflow of result.workflows) {
|
|
274
|
+
const key = workflow.id ?? (workflow.filePath ? `file:${workflow.filePath}` : `name:${workflow.name}`);
|
|
275
|
+
workflowMap.set(key, workflow);
|
|
276
|
+
}
|
|
277
|
+
const files = await collectWorkflowTypeScriptFiles(projectRoot);
|
|
278
|
+
if (files.length === 0) return result;
|
|
279
|
+
try {
|
|
280
|
+
const typecheckResult = await typecheckWorkflows({
|
|
281
|
+
projectRoot,
|
|
282
|
+
files
|
|
283
|
+
});
|
|
284
|
+
if (typecheckResult.toolFailure) {
|
|
285
|
+
const projectStats = workflowMap.get("__project__") ?? createWorkflowValidateStats({
|
|
286
|
+
name: "project",
|
|
287
|
+
filePath: ""
|
|
288
|
+
});
|
|
289
|
+
projectStats.issues.push({
|
|
290
|
+
severity: "error",
|
|
291
|
+
message: typecheckResult.toolFailure.message,
|
|
292
|
+
type: "other"
|
|
293
|
+
});
|
|
294
|
+
workflowMap.set("__project__", projectStats);
|
|
295
|
+
}
|
|
296
|
+
for (const diagnostic of typecheckResult.diagnostics) appendTypecheckDiagnostic(workflowMap, diagnostic);
|
|
297
|
+
} catch (error) {
|
|
298
|
+
const projectStats = workflowMap.get("__project__") ?? createWorkflowValidateStats({
|
|
299
|
+
name: "project",
|
|
300
|
+
filePath: ""
|
|
301
|
+
});
|
|
302
|
+
projectStats.issues.push({
|
|
303
|
+
severity: "error",
|
|
304
|
+
message: toErrorMessage(error),
|
|
305
|
+
type: "other"
|
|
306
|
+
});
|
|
307
|
+
workflowMap.set("__project__", projectStats);
|
|
308
|
+
}
|
|
309
|
+
await enrichAuthoredWorkflowIds(workflowMap);
|
|
310
|
+
const workflows = [...workflowMap.values()];
|
|
311
|
+
const errorCount = workflows.reduce((count, workflow) => count + workflow.issues.filter((issue) => issue.severity === "error").length, 0);
|
|
312
|
+
const warningCount = workflows.reduce((count, workflow) => count + workflow.issues.filter((issue) => issue.severity === "warning").length, 0);
|
|
313
|
+
return {
|
|
314
|
+
...result,
|
|
315
|
+
success: errorCount === 0,
|
|
316
|
+
workflows,
|
|
317
|
+
errorCount,
|
|
318
|
+
warningCount
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
async function enrichAuthoredWorkflowIds(workflowMap) {
|
|
322
|
+
for (const stats of workflowMap.values()) {
|
|
323
|
+
if (stats.id || !stats.filePath) continue;
|
|
324
|
+
const fromArtifacts = resolveAuthoredIdFromWorkflowMap(workflowMap, stats.filePath);
|
|
325
|
+
if (fromArtifacts) {
|
|
326
|
+
stats.id = fromArtifacts;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
stats.id = await readAuthoredWorkflowIdFromSource(stats.filePath);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
201
332
|
function createWorkflowValidateStats(stats) {
|
|
202
333
|
return {
|
|
203
334
|
id: stats.id,
|
|
@@ -206,14 +337,19 @@ function createWorkflowValidateStats(stats) {
|
|
|
206
337
|
issues: []
|
|
207
338
|
};
|
|
208
339
|
}
|
|
340
|
+
/** Matches an authored workflow id or failures scoped to that workflow's source tree. */
|
|
341
|
+
function workflowMatchesValidateRef(workflow, workflowRef) {
|
|
342
|
+
if (workflow.id === workflowRef) return true;
|
|
343
|
+
if (!workflow.filePath) return false;
|
|
344
|
+
const normalizedRef = workflowRef.replaceAll("\\", "/");
|
|
345
|
+
const normalizedPath = workflow.filePath.replaceAll("\\", "/");
|
|
346
|
+
if (normalizedPath.includes(`/${normalizedRef}/`) || normalizedPath.endsWith(`/${normalizedRef}.workflow.ts`)) return true;
|
|
347
|
+
return path$1.basename(normalizedPath, path$1.extname(normalizedPath)) === normalizedRef;
|
|
348
|
+
}
|
|
209
349
|
function filterValidationResult(result, workflowRef) {
|
|
210
350
|
if (!workflowRef) return result;
|
|
211
|
-
const matching = result.workflows.filter((workflow) =>
|
|
212
|
-
if (matching.length === 0)
|
|
213
|
-
const availableNames = result.workflows.map((workflow) => workflow.name).filter((name) => name !== "project");
|
|
214
|
-
const availableIds = result.workflows.map((workflow) => workflow.id).filter((id) => id !== void 0);
|
|
215
|
-
throw new WorkflowNotFoundError(workflowRef, availableNames.length > 0 ? availableNames : availableIds);
|
|
216
|
-
}
|
|
351
|
+
const matching = result.workflows.filter((workflow) => workflowMatchesValidateRef(workflow, workflowRef));
|
|
352
|
+
if (matching.length === 0) throw new WorkflowNotFoundError(workflowRef, [...new Set(result.workflows.map((workflow) => workflow.id).filter((id) => id !== void 0))]);
|
|
217
353
|
return {
|
|
218
354
|
...result,
|
|
219
355
|
success: matching.every((workflow) => workflow.issues.every((issue) => issue.severity !== "error")),
|
|
@@ -232,6 +368,10 @@ function renderValidateSummary(result) {
|
|
|
232
368
|
ui.success(`Validation passed — ${workflowLabel}, ${result.errorCount} errors, ${result.warningCount} warnings`);
|
|
233
369
|
}
|
|
234
370
|
}
|
|
371
|
+
function formatValidateWorkflowLabel(workflow) {
|
|
372
|
+
if (workflow.id) return `workflow id: ${workflow.id}`;
|
|
373
|
+
return `workflow: ${workflow.name}`;
|
|
374
|
+
}
|
|
235
375
|
function renderValidateFailure(error, asJson) {
|
|
236
376
|
if (error instanceof WorkflowValidationFailedError) {
|
|
237
377
|
if (!asJson) {
|
|
@@ -239,15 +379,15 @@ function renderValidateFailure(error, asJson) {
|
|
|
239
379
|
for (const workflow of error.result.workflows) for (const issue of workflow.issues.filter((i) => i.severity === "error")) {
|
|
240
380
|
const loc = issue.file ? issue.line !== void 0 ? `${issue.file}:${issue.line}` : issue.file : "";
|
|
241
381
|
ui.hint(` ${loc ? `${loc} — ` : ""}${issue.message}`);
|
|
242
|
-
ui.hint(`
|
|
382
|
+
ui.hint(` ${formatValidateWorkflowLabel(workflow)}`);
|
|
243
383
|
ui.hint(` type: ${issue.type}`);
|
|
244
384
|
}
|
|
245
385
|
} else writeJson(error.result);
|
|
246
386
|
return;
|
|
247
387
|
}
|
|
248
388
|
if (error instanceof WorkflowNotFoundError) {
|
|
249
|
-
ui.error(`Workflow "${error.
|
|
250
|
-
if (error.
|
|
389
|
+
ui.error(`Workflow "${error.workflowRef}" not found.`);
|
|
390
|
+
if (error.availableIds.length > 0) ui.hint(`Available workflow ids: ${error.availableIds.join(", ")}`);
|
|
251
391
|
return;
|
|
252
392
|
}
|
|
253
393
|
ui.error(`Validation error: ${toErrorMessage(error)}`);
|
|
@@ -257,6 +397,10 @@ function renderValidateFailure(error, asJson) {
|
|
|
257
397
|
async function handleWorkflowsValidate(options, ctx) {
|
|
258
398
|
const workflowsDir = await requireWorkflowsDir(options.path);
|
|
259
399
|
projects.track(workflowsDir);
|
|
400
|
+
if (options.workflow) {
|
|
401
|
+
const manifests = await readManifestsFromOutDir(workflowsDir);
|
|
402
|
+
await assertAuthoredWorkflowId(options.workflow, workflowsDir, WORKFLOW_ID_COMMANDS.validate, { refreshManifests: manifests.length === 0 });
|
|
403
|
+
}
|
|
260
404
|
const { jsonMode } = ctx;
|
|
261
405
|
renderValidateHeader(options.workflow);
|
|
262
406
|
const progress = createBuildProgress(options.workflow ?? "all workflows");
|
|
@@ -264,6 +408,7 @@ async function handleWorkflowsValidate(options, ctx) {
|
|
|
264
408
|
const result = await runWorkflowValidate({
|
|
265
409
|
workflowsDir,
|
|
266
410
|
verbose: options.verbose,
|
|
411
|
+
typecheck: options.typecheck,
|
|
267
412
|
workflow: options.workflow,
|
|
268
413
|
onProgressEvent: progress.handleEvent
|
|
269
414
|
});
|