@workflow-code/cli 0.2.4-20260911001 → 0.2.4-20260911002

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/dist/index.js CHANGED
@@ -23,7 +23,7 @@ async function main(argv = process.argv.slice(2)) {
23
23
  const prepared = prepareCliInvocation(argv);
24
24
  argv = prepared.argv;
25
25
  if (argv[0] === "workspace") {
26
- const workspaceCli = await import("./workspace-N66ZCO3W.js");
26
+ const workspaceCli = await import("./workspace-YOZ4XWIF.js");
27
27
  await workspaceCli.main(argv.slice(1), { localeInitialized: true });
28
28
  return typeof process.exitCode === "number" ? process.exitCode : 0;
29
29
  }
@@ -1309,13 +1309,23 @@ async function commandProjectGroupUpload(parsed, workflowArg, forcePublish = fal
1309
1309
  assertApiOk(planned);
1310
1310
  return;
1311
1311
  }
1312
- const prepared = await uploadProjectGroupPackage({
1312
+ const queued = await uploadProjectGroupPackage({
1313
1313
  deploymentId: planned.data.id,
1314
1314
  archivePath: packed.archivePath,
1315
1315
  server: parsed.options.server,
1316
1316
  token: parsed.options.token,
1317
1317
  executionTargets: resolveRequestedExecutionTargets(parsed.options, rootContext.projectType)
1318
1318
  });
1319
+ if (queued.errCode !== 0 || queued.data === void 0) {
1320
+ printApiResponse(queued);
1321
+ assertApiOk(queued);
1322
+ return;
1323
+ }
1324
+ const prepared = await waitForProjectGroupPreparation({
1325
+ deploymentId: planned.data.id,
1326
+ server: parsed.options.server,
1327
+ token: parsed.options.token
1328
+ });
1319
1329
  if (prepared.errCode !== 0 || prepared.data === void 0) {
1320
1330
  printApiResponse(prepared);
1321
1331
  assertApiOk(prepared);
@@ -1903,7 +1913,8 @@ async function packProjectGroup(options) {
1903
1913
  const projects = [{
1904
1914
  projectId: contexts.root.workflowId,
1905
1915
  role: "root",
1906
- archivePath: rootArchivePath
1916
+ archivePath: rootArchivePath,
1917
+ version: readWorkflowPackageVersion(contexts.root.packageJson)
1907
1918
  }];
1908
1919
  try {
1909
1920
  await packWorkflow(
@@ -1918,7 +1929,8 @@ async function packProjectGroup(options) {
1918
1929
  projectId: dependency.packageContext.workflowId,
1919
1930
  role: "dependency",
1920
1931
  archivePath: dependencyArchivePath,
1921
- alias: dependency.alias
1932
+ alias: dependency.alias,
1933
+ version: readWorkflowPackageVersion(dependency.packageContext.packageJson)
1922
1934
  });
1923
1935
  await packWorkflow(
1924
1936
  dependency.packageContext.workflowArg,
@@ -1976,6 +1988,39 @@ async function uploadProjectGroupPackage(options) {
1976
1988
  );
1977
1989
  return response.json();
1978
1990
  }
1991
+ async function waitForProjectGroupPreparation(options) {
1992
+ let previousProgress = "";
1993
+ while (true) {
1994
+ const response = await fetchApi({
1995
+ server: options.server,
1996
+ token: options.token,
1997
+ path: `/api/deployments/${encodeURIComponent(options.deploymentId)}`
1998
+ });
1999
+ if (response.errCode !== 0 || response.data === void 0) return response;
2000
+ const activeItem = response.data.items?.find((item) => item.status === "preparing");
2001
+ const progress = `${response.data.status}:${activeItem?.stage ?? response.data.status}`;
2002
+ if (response.data.status === "preparing" && progress !== previousProgress) {
2003
+ previousProgress = progress;
2004
+ process.stderr.write(`${i18n.t("preparationProgress", {
2005
+ ns: "cli",
2006
+ status: response.data.status,
2007
+ stage: activeItem?.stage ?? response.data.status
2008
+ })}
2009
+ `);
2010
+ }
2011
+ if (response.data.status === "prepared" || response.data.status === "published") {
2012
+ return response;
2013
+ }
2014
+ if (response.data.status === "failed") {
2015
+ return {
2016
+ errCode: 500,
2017
+ errMessage: response.data.error ?? response.data.items?.find((item) => item.error)?.error ?? "Project-group preparation failed.",
2018
+ data: response.data
2019
+ };
2020
+ }
2021
+ await delay(options.pollIntervalMs ?? 1e3);
2022
+ }
2023
+ }
1979
2024
  async function resolveRemoteWorkflowId(parsed) {
1980
2025
  const workflowArg = requirePositional(parsed, 0, "workflow");
1981
2026
  if (isWorkflowUuid(workflowArg)) {
@@ -2060,6 +2105,13 @@ function readRequiredPackageString(packageJson, key) {
2060
2105
  }
2061
2106
  return value.trim();
2062
2107
  }
2108
+ function readWorkflowPackageVersion(packageJson) {
2109
+ const version = readRequiredPackageString(packageJson, "version");
2110
+ if (!/^\d+\.\d+\.\d+$/.test(version)) {
2111
+ throw new Error(i18n.t("packageVersionInvalid", { ns: "cli", version }));
2112
+ }
2113
+ return version;
2114
+ }
2063
2115
  async function uploadPackage(options) {
2064
2116
  const archiveBuffer = await readFile2(options.archivePath);
2065
2117
  const archiveName = path3.basename(options.archivePath);
@@ -2585,5 +2637,6 @@ export {
2585
2637
  shouldUseProjectGroupUpload,
2586
2638
  stageWorkflowWithLocalDependencies,
2587
2639
  waitForDeviceToken,
2588
- waitForPreparation
2640
+ waitForPreparation,
2641
+ waitForProjectGroupPreparation
2589
2642
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow-code/cli",
3
- "version": "0.2.4-20260911001",
3
+ "version": "0.2.4-20260911002",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "workflow-code": "./dist/index.js"
@@ -32,14 +32,14 @@
32
32
  "workflow-code": "0.2.4-20260911001",
33
33
  "@workflow-code/auth-config": "0.1.0",
34
34
  "@workflow-code/i18n": "0.1.0",
35
- "@workflow-code/execution-targets": "0.1.0",
36
35
  "@workflow-code/openai-responses": "0.1.0",
37
36
  "@workflow-code/project-dependencies": "0.1.0",
37
+ "@workflow-code/project-info": "0.1.0",
38
+ "@workflow-code/execution-targets": "0.1.0",
38
39
  "@workflow-code/project-upload": "0.1.0",
39
40
  "@workflow-code/runtime-compatibility": "0.1.0",
40
41
  "@workflow-code/workflow-ids": "0.1.0",
41
- "@workflow-code/workflow-mcp": "0.1.0",
42
- "@workflow-code/project-info": "0.1.0"
42
+ "@workflow-code/workflow-mcp": "0.1.0"
43
43
  },
44
44
  "scripts": {
45
45
  "bootstrap": "node scripts/bootstrap.mjs",