@moxt-ai/cli 0.4.0 → 0.6.0

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 CHANGED
@@ -226,10 +226,8 @@ moxt workflow comment create -w <workspace-id> <workflow-file-id> <task-id> --co
226
226
  moxt workflow comment list -w <workspace-id> <workflow-file-id> <task-id>
227
227
  moxt workflow comment delete -w <workspace-id> <workflow-file-id> <task-id> <comment-id>
228
228
 
229
- # Inspect or abort workflow agent runs
230
- moxt workflow run status -w <workspace-id> <workflow-file-id> <trigger-id> [trigger-id...]
231
- moxt workflow run output -w <workspace-id> <workflow-file-id> <trigger-id>
232
- moxt workflow run abort -w <workspace-id> <workflow-file-id> <trigger-id>
229
+ # Abort workflow agent runs
230
+ moxt workflow run abort -w <workspace-id> <workflow-file-id> <pipeline-id>
233
231
  ```
234
232
 
235
233
  Workflow, status, and task descriptions are read from local UTF-8 text files with `--desc-file`.
package/dist/index.js CHANGED
@@ -153,7 +153,7 @@ function getApiKeyOrUndefined() {
153
153
 
154
154
  // src/utils/http.ts
155
155
  function getUserAgent() {
156
- return `moxt-cli/${"0.4.0"} (${platform()}/${arch()}) node/${process.versions.node}`;
156
+ return `moxt-cli/${"0.6.0"} (${platform()}/${arch()}) node/${process.versions.node}`;
157
157
  }
158
158
  async function fetchApi(method, path2, body) {
159
159
  const apiKey = getApiKey();
@@ -1513,7 +1513,7 @@ function printWorkflowDetail(item) {
1513
1513
  }
1514
1514
  }
1515
1515
  function printTaskSummary(item) {
1516
- const runIds = item.agentRuns.map((run) => run.pipelineTriggerId).join(",") || "-";
1516
+ const runIds = item.runningAgentRuns.map((run) => run.pipelineId).join(",") || "-";
1517
1517
  print(
1518
1518
  `${colors.bold}#${item.scopedId}${colors.reset} ${item.title} status=${item.statusScopedId} priority=${priorityLabel(item.priority)} assignee=${formatAssignee(item.assignee)} runs=${runIds}`
1519
1519
  );
@@ -1535,12 +1535,12 @@ function printTaskDetail(item) {
1535
1535
  for (const fileId of item.linkedFileIds) print(` - ${fileId}`);
1536
1536
  }
1537
1537
  printDetailField2("subscribed", item.subscribed);
1538
- if (item.agentRuns.length === 0) {
1539
- print("agentRuns: []");
1538
+ if (item.runningAgentRuns.length === 0) {
1539
+ print("runningAgentRuns: []");
1540
1540
  } else {
1541
- print("agentRuns:");
1542
- for (const run of item.agentRuns) {
1543
- print(` - pipelineTriggerId: ${run.pipelineTriggerId}`);
1541
+ print("runningAgentRuns:");
1542
+ for (const run of item.runningAgentRuns) {
1543
+ print(` - pipelineId: ${run.pipelineId}`);
1544
1544
  printAssigneeDetail("executor", run.executor, 4);
1545
1545
  }
1546
1546
  }
@@ -1820,7 +1820,7 @@ function registerTaskCommands(workflow) {
1820
1820
  workflowFileId: options.workflowFileId
1821
1821
  }));
1822
1822
  startSpinner("Fetching workflow tasks...");
1823
- const response = await httpGet(`/workspaces/${options.workspace}/workflow-tasks${query}`);
1823
+ const response = await httpGet(`/workspaces/${options.workspace}/workflow-tasks-v2${query}`);
1824
1824
  if (!response.ok) {
1825
1825
  stopSpinner(false, "Failed");
1826
1826
  failResponse(response);
@@ -1839,9 +1839,7 @@ function registerTaskCommands(workflow) {
1839
1839
  ).action(async (workflowFileId, taskScopedId, options) => {
1840
1840
  const id = runOrExit4(() => parsePositiveInteger(taskScopedId, "taskScopedId"));
1841
1841
  startSpinner("Fetching task...");
1842
- const response = await httpGet(
1843
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks/${id}`
1844
- );
1842
+ const response = await getWorkflowTask(options.workspace, workflowFileId, id);
1845
1843
  if (!response.ok) {
1846
1844
  stopSpinner(false, "Failed");
1847
1845
  failResponse(response);
@@ -1869,10 +1867,19 @@ function registerTaskCommands(workflow) {
1869
1867
  return next;
1870
1868
  });
1871
1869
  startSpinner("Creating task...");
1872
- const response = await httpPost(
1873
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks`,
1870
+ const createResponse = await httpPost(
1871
+ `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks-v2`,
1874
1872
  body
1875
1873
  );
1874
+ if (!createResponse.ok) {
1875
+ stopSpinner(false, "Failed");
1876
+ failResponse(createResponse);
1877
+ }
1878
+ const response = await getWorkflowTask(
1879
+ options.workspace,
1880
+ workflowFileId,
1881
+ createResponse.data.taskScopedId
1882
+ );
1876
1883
  if (!response.ok) {
1877
1884
  stopSpinner(false, "Failed");
1878
1885
  failResponse(response);
@@ -1903,10 +1910,15 @@ function registerTaskCommands(workflow) {
1903
1910
  });
1904
1911
  const id = runOrExit4(() => parsePositiveInteger(taskScopedId, "taskScopedId"));
1905
1912
  startSpinner("Updating task...");
1906
- const response = await httpPatch(
1907
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks/${id}/metadata`,
1913
+ const updateResponse = await httpPatch(
1914
+ `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks-v2/${id}/metadata`,
1908
1915
  body
1909
1916
  );
1917
+ if (!updateResponse.ok) {
1918
+ stopSpinner(false, "Failed");
1919
+ failResponse(updateResponse);
1920
+ }
1921
+ const response = await getWorkflowTask(options.workspace, workflowFileId, id);
1910
1922
  if (!response.ok) {
1911
1923
  stopSpinner(false, "Failed");
1912
1924
  failResponse(response);
@@ -1925,8 +1937,13 @@ function registerTaskCommands(workflow) {
1925
1937
  fileIds: parseFileIds(options.fileIds, "--file-ids")
1926
1938
  }));
1927
1939
  startSpinner(action === "add-linked-files" ? "Adding linked files..." : "Removing linked files...");
1928
- const path2 = `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks/${id}/linked-files`;
1929
- const response = action === "add-linked-files" ? await httpPost(path2, { fileIds }) : await httpDelete(path2, { fileIds });
1940
+ const path2 = `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks-v2/${id}/linked-files`;
1941
+ const updateResponse = action === "add-linked-files" ? await httpPost(path2, { fileIds }) : await httpDelete(path2, { fileIds });
1942
+ if (!updateResponse.ok) {
1943
+ stopSpinner(false, "Failed");
1944
+ failResponse(updateResponse);
1945
+ }
1946
+ const response = await getWorkflowTask(options.workspace, workflowFileId, id);
1930
1947
  if (!response.ok) {
1931
1948
  stopSpinner(false, "Failed");
1932
1949
  failResponse(response);
@@ -1945,10 +1962,15 @@ function registerTaskCommands(workflow) {
1945
1962
  statusScopedId: parsePositiveInteger(options.status, "--status")
1946
1963
  }));
1947
1964
  startSpinner("Moving task...");
1948
- const response = await httpPatch(
1949
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks/${id}/status`,
1965
+ const updateResponse = await httpPatch(
1966
+ `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks-v2/${id}/status`,
1950
1967
  { statusScopedId }
1951
1968
  );
1969
+ if (!updateResponse.ok) {
1970
+ stopSpinner(false, "Failed");
1971
+ failResponse(updateResponse);
1972
+ }
1973
+ const response = await getWorkflowTask(options.workspace, workflowFileId, id);
1952
1974
  if (!response.ok) {
1953
1975
  stopSpinner(false, "Failed");
1954
1976
  failResponse(response);
@@ -1970,10 +1992,15 @@ function registerTaskCommands(workflow) {
1970
1992
  });
1971
1993
  const id = runOrExit4(() => parsePositiveInteger(taskScopedId, "taskScopedId"));
1972
1994
  startSpinner("Updating task assignee...");
1973
- const response = await httpPatch(
1974
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks/${id}/assignee`,
1995
+ const updateResponse = await httpPatch(
1996
+ `/workspaces/${options.workspace}/workflows/${workflowFileId}/tasks-v2/${id}/assignee`,
1975
1997
  body
1976
1998
  );
1999
+ if (!updateResponse.ok) {
2000
+ stopSpinner(false, "Failed");
2001
+ failResponse(updateResponse);
2002
+ }
2003
+ const response = await getWorkflowTask(options.workspace, workflowFileId, id);
1977
2004
  if (!response.ok) {
1978
2005
  stopSpinner(false, "Failed");
1979
2006
  failResponse(response);
@@ -1997,6 +2024,11 @@ function registerTaskCommands(workflow) {
1997
2024
  stopSpinner(true, `Deleted: ${response.data.scopedId}`);
1998
2025
  });
1999
2026
  }
2027
+ function getWorkflowTask(workspaceId, workflowFileId, taskScopedId) {
2028
+ return httpGet(
2029
+ `/workspaces/${workspaceId}/workflows/${workflowFileId}/tasks-v2/${taskScopedId}`
2030
+ );
2031
+ }
2000
2032
  function registerCommentCommands(workflow) {
2001
2033
  const comment = workflow.command("comment").description("Workflow task comment operations");
2002
2034
  addWorkspaceOption(
@@ -2065,54 +2097,18 @@ function registerCommentCommands(workflow) {
2065
2097
  function registerRunCommands(workflow) {
2066
2098
  const run = workflow.command("run").description("Workflow agent run operations");
2067
2099
  addWorkspaceOption(
2068
- run.command("status").description("Get workflow agent run statuses").argument("<workflowFileId>").argument("<triggerIds...>")
2069
- ).action(async (workflowFileId, triggerIds, options) => {
2070
- const workflowPipelineTriggerIds = runOrExit4(
2071
- () => triggerIds.map((triggerId) => parsePositiveInteger(triggerId, "workflowPipelineTriggerId"))
2072
- );
2073
- startSpinner("Fetching run statuses...");
2074
- const response = await httpPost(
2075
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/pipeline/triggers/statuses`,
2076
- { workflowPipelineTriggerIds }
2077
- );
2078
- if (!response.ok) {
2079
- stopSpinner(false, "Failed");
2080
- failResponse(response);
2081
- }
2082
- stopSpinner(true, `Found ${response.data.length} run status item(s)`);
2083
- for (const item of response.data) {
2084
- print(`${colors.bold}${item.workflowPipelineTriggerId}${colors.reset} ${item.pipelineStatus}`);
2085
- }
2086
- });
2087
- addWorkspaceOption(
2088
- run.command("output").description("Get workflow agent run output events").argument("<workflowFileId>").argument("<triggerId>")
2089
- ).action(async (workflowFileId, triggerId, options) => {
2090
- const id = runOrExit4(() => parsePositiveInteger(triggerId, "workflowPipelineTriggerId"));
2091
- startSpinner("Fetching run output...");
2092
- const response = await httpGet(
2093
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/pipeline/trigger/${id}/output`
2094
- );
2095
- if (!response.ok) {
2096
- stopSpinner(false, "Failed");
2097
- failResponse(response);
2098
- }
2099
- stopSpinner(true, `Run ${response.data.workflowPipelineTriggerId}`);
2100
- for (const event of response.data.pipelineEvents) print(event);
2101
- });
2102
- addWorkspaceOption(
2103
- run.command("abort").description("Abort a workflow agent run").argument("<workflowFileId>").argument("<triggerId>")
2104
- ).action(async (workflowFileId, triggerId, options) => {
2105
- const id = runOrExit4(() => parsePositiveInteger(triggerId, "workflowPipelineTriggerId"));
2100
+ run.command("abort").description("Abort a workflow agent run").argument("<workflowFileId>").argument("<pipelineId>")
2101
+ ).action(async (workflowFileId, pipelineId, options) => {
2106
2102
  startSpinner("Aborting run...");
2107
2103
  const response = await httpPost(
2108
- `/workspaces/${options.workspace}/workflows/${workflowFileId}/pipeline/trigger/${id}/abort`,
2104
+ `/workspaces/${options.workspace}/workflows/${workflowFileId}/pipeline/${pipelineId}/abort`,
2109
2105
  {}
2110
2106
  );
2111
2107
  if (!response.ok) {
2112
2108
  stopSpinner(false, "Failed");
2113
2109
  failResponse(response);
2114
2110
  }
2115
- stopSpinner(true, `Abort accepted: ${id}`);
2111
+ stopSpinner(true, `Abort accepted: ${pipelineId}`);
2116
2112
  });
2117
2113
  }
2118
2114
 
@@ -2139,7 +2135,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
2139
2135
  var MAX_BATCH_SIZE = 100;
2140
2136
  function commonLabels() {
2141
2137
  return {
2142
- cli_version: "0.4.0",
2138
+ cli_version: "0.6.0",
2143
2139
  node_version: process.versions.node,
2144
2140
  os: platform2(),
2145
2141
  arch: arch2(),
@@ -2185,7 +2181,7 @@ async function flush() {
2185
2181
  }
2186
2182
  const batch = buffer.splice(0, MAX_BATCH_SIZE);
2187
2183
  const payload = {
2188
- release_id: "0.4.0",
2184
+ release_id: "0.6.0",
2189
2185
  client_type: "cli",
2190
2186
  metric_data_list: batch.map((m) => ({
2191
2187
  profile: "cli",
@@ -2326,9 +2322,9 @@ function installExitHandler() {
2326
2322
 
2327
2323
  // src/index.ts
2328
2324
  updateNotifier({
2329
- pkg: { name: "@moxt-ai/cli", version: "0.4.0" }
2325
+ pkg: { name: "@moxt-ai/cli", version: "0.6.0" }
2330
2326
  }).notify();
2331
- var program = createProgram("0.4.0");
2327
+ var program = createProgram("0.6.0");
2332
2328
  instrumentProgram(program);
2333
2329
  installExitHandler();
2334
2330
  program.parseAsync(process.argv).then(async () => {