@useconvoy/cli 0.53.3 → 0.56.2
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 +11 -1
- package/dist/marketplace/convoy/skills/convoy/SKILL.md +23 -3
- package/dist/src/agent/app/script-runner.d.ts +18 -0
- package/dist/src/agent/app/script-runner.js +139 -0
- package/dist/src/agent/app/script-runner.js.map +1 -0
- package/dist/src/agent/app/thread-attachment-cache.js +2 -19
- package/dist/src/agent/app/thread-attachment-cache.js.map +1 -1
- package/dist/src/agent/app/thread-processor.d.ts +8 -5
- package/dist/src/agent/app/thread-processor.js +40 -24
- package/dist/src/agent/app/thread-processor.js.map +1 -1
- package/dist/src/agent/runtimes/contracts.d.ts +16 -0
- package/dist/src/agent/runtimes/contracts.js.map +1 -1
- package/dist/src/agent/sdk/runtime/process-group.js +4 -1
- package/dist/src/agent/sdk/runtime/process-group.js.map +1 -1
- package/dist/src/cli.js +4 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/connect/workflow.js +1 -3
- package/dist/src/commands/connect/workflow.js.map +1 -1
- package/dist/src/commands/tasks/attachments/download.js +2 -1
- package/dist/src/commands/tasks/attachments/download.js.map +1 -1
- package/dist/src/commands/tasks/attachments/transfer.d.ts +3 -1
- package/dist/src/commands/tasks/attachments/transfer.js +15 -3
- package/dist/src/commands/tasks/attachments/transfer.js.map +1 -1
- package/dist/src/commands/threads/spawn-target.js +12 -13
- package/dist/src/commands/threads/spawn-target.js.map +1 -1
- package/dist/src/commands/update/command.d.ts +4 -0
- package/dist/src/commands/update/command.js +27 -0
- package/dist/src/commands/update/command.js.map +1 -0
- package/dist/src/commands/workflows/create.d.ts +2 -0
- package/dist/src/commands/workflows/create.js +66 -0
- package/dist/src/commands/workflows/create.js.map +1 -0
- package/dist/src/commands/workflows/delete.d.ts +2 -0
- package/dist/src/commands/workflows/delete.js +21 -0
- package/dist/src/commands/workflows/delete.js.map +1 -0
- package/dist/src/commands/workflows/formatters.d.ts +11 -0
- package/dist/src/commands/workflows/formatters.js +37 -0
- package/dist/src/commands/workflows/formatters.js.map +1 -0
- package/dist/src/commands/workflows/get.d.ts +2 -0
- package/dist/src/commands/workflows/get.js +34 -0
- package/dist/src/commands/workflows/get.js.map +1 -0
- package/dist/src/commands/workflows/index.d.ts +2 -0
- package/dist/src/commands/workflows/index.js +21 -0
- package/dist/src/commands/workflows/index.js.map +1 -0
- package/dist/src/commands/workflows/list.d.ts +2 -0
- package/dist/src/commands/workflows/list.js +26 -0
- package/dist/src/commands/workflows/list.js.map +1 -0
- package/dist/src/commands/workflows/parsers.d.ts +9 -0
- package/dist/src/commands/workflows/parsers.js +25 -0
- package/dist/src/commands/workflows/parsers.js.map +1 -0
- package/dist/src/commands/workflows/runs/cancel.d.ts +2 -0
- package/dist/src/commands/workflows/runs/cancel.js +32 -0
- package/dist/src/commands/workflows/runs/cancel.js.map +1 -0
- package/dist/src/commands/workflows/runs/formatters.d.ts +6 -0
- package/dist/src/commands/workflows/runs/formatters.js +55 -0
- package/dist/src/commands/workflows/runs/formatters.js.map +1 -0
- package/dist/src/commands/workflows/runs/get.d.ts +2 -0
- package/dist/src/commands/workflows/runs/get.js +23 -0
- package/dist/src/commands/workflows/runs/get.js.map +1 -0
- package/dist/src/commands/workflows/runs/index.d.ts +2 -0
- package/dist/src/commands/workflows/runs/index.js +17 -0
- package/dist/src/commands/workflows/runs/index.js.map +1 -0
- package/dist/src/commands/workflows/runs/list.d.ts +2 -0
- package/dist/src/commands/workflows/runs/list.js +29 -0
- package/dist/src/commands/workflows/runs/list.js.map +1 -0
- package/dist/src/commands/workflows/runs/resume.d.ts +2 -0
- package/dist/src/commands/workflows/runs/resume.js +23 -0
- package/dist/src/commands/workflows/runs/resume.js.map +1 -0
- package/dist/src/commands/workflows/runs/steps.d.ts +4 -0
- package/dist/src/commands/workflows/runs/steps.js +27 -0
- package/dist/src/commands/workflows/runs/steps.js.map +1 -0
- package/dist/src/commands/workflows/start.d.ts +2 -0
- package/dist/src/commands/workflows/start.js +67 -0
- package/dist/src/commands/workflows/start.js.map +1 -0
- package/dist/src/commands/workflows/update.d.ts +2 -0
- package/dist/src/commands/workflows/update.js +63 -0
- package/dist/src/commands/workflows/update.js.map +1 -0
- package/dist/src/commands/workflows/validate.d.ts +2 -0
- package/dist/src/commands/workflows/validate.js +25 -0
- package/dist/src/commands/workflows/validate.js.map +1 -0
- package/dist/src/convex/_generated/api.d.ts +8 -0
- package/dist/src/lib/config/convex-client.js +32 -3
- package/dist/src/lib/config/convex-client.js.map +1 -1
- package/dist/src/lib/file-name.d.ts +5 -0
- package/dist/src/lib/file-name.js +16 -0
- package/dist/src/lib/file-name.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { createWorkflowCommand } from "./create.js";
|
|
3
|
+
import { deleteWorkflowCommand } from "./delete.js";
|
|
4
|
+
import { getWorkflowCommand } from "./get.js";
|
|
5
|
+
import { listWorkflowsCommand } from "./list.js";
|
|
6
|
+
import { workflowRunsCommand } from "./runs/index.js";
|
|
7
|
+
import { startWorkflowCommand } from "./start.js";
|
|
8
|
+
import { updateWorkflowCommand } from "./update.js";
|
|
9
|
+
import { validateWorkflowCommand } from "./validate.js";
|
|
10
|
+
export const workflowsCommand = new Command("workflows")
|
|
11
|
+
.alias("workflow")
|
|
12
|
+
.description("Workflow commands")
|
|
13
|
+
.addCommand(listWorkflowsCommand)
|
|
14
|
+
.addCommand(getWorkflowCommand)
|
|
15
|
+
.addCommand(createWorkflowCommand)
|
|
16
|
+
.addCommand(updateWorkflowCommand)
|
|
17
|
+
.addCommand(deleteWorkflowCommand)
|
|
18
|
+
.addCommand(validateWorkflowCommand)
|
|
19
|
+
.addCommand(startWorkflowCommand)
|
|
20
|
+
.addCommand(workflowRunsCommand);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACrD,KAAK,CAAC,UAAU,CAAC;KACjB,WAAW,CAAC,mBAAmB,CAAC;KAChC,UAAU,CAAC,oBAAoB,CAAC;KAChC,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,qBAAqB,CAAC;KACjC,UAAU,CAAC,qBAAqB,CAAC;KACjC,UAAU,CAAC,qBAAqB,CAAC;KACjC,UAAU,CAAC,uBAAuB,CAAC;KACnC,UAAU,CAAC,oBAAoB,CAAC;KAChC,UAAU,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../cli.js";
|
|
4
|
+
import { api } from "../../convex/_generated/api.js";
|
|
5
|
+
import { runOneShotCommand } from "../../lib/one-shot-command.js";
|
|
6
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../lib/output.js";
|
|
7
|
+
import { resolveProjectFromCommand } from "../../lib/project-resolution.js";
|
|
8
|
+
import { formatWorkflowLine } from "./formatters.js";
|
|
9
|
+
export const listWorkflowsCommand = addGlobalOptions(addOutputOptions(new Command("list").description("List a project's Workflows").option("--org <org>", "Organization ID or slug (used with --project alias)"))).action(async (options, cmd) => {
|
|
10
|
+
await runOneShotCommand(cmd, async ({ client, config }) => {
|
|
11
|
+
const outputMode = resolveOutputMode(options);
|
|
12
|
+
const { projectId } = await resolveProjectFromCommand(client, config, cmd, options.org);
|
|
13
|
+
const workflows = await client.query(api.workflows.core.listByProject, { projectId });
|
|
14
|
+
printOutput(outputMode, workflows, (value) => {
|
|
15
|
+
if (value.length === 0) {
|
|
16
|
+
console.log(chalk.dim("No workflows found."));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log(chalk.bold(`Workflows (${value.length}):`));
|
|
20
|
+
for (const workflow of value) {
|
|
21
|
+
console.log(` ${formatWorkflowLine(workflow)}`);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/workflows/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAMrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAClD,gBA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generated/api.js";
|
|
3
|
+
export type WorkflowDefinitionInput = FunctionArgs<typeof api.workflows.core.create>["definition"];
|
|
4
|
+
/**
|
|
5
|
+
* A definition JSON file: either the bare definition or a `workflows get` dump,
|
|
6
|
+
* whose `draftDefinition` is taken. Only the outline is checked here; the
|
|
7
|
+
* backend validates the tree.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readDefinitionFile(path: string): WorkflowDefinitionInput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readTextFile } from "../../lib/text-input.js";
|
|
2
|
+
/**
|
|
3
|
+
* A definition JSON file: either the bare definition or a `workflows get` dump,
|
|
4
|
+
* whose `draftDefinition` is taken. Only the outline is checked here; the
|
|
5
|
+
* backend validates the tree.
|
|
6
|
+
*/
|
|
7
|
+
export function readDefinitionFile(path) {
|
|
8
|
+
let parsed;
|
|
9
|
+
try {
|
|
10
|
+
parsed = JSON.parse(readTextFile(path, "definition"));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
14
|
+
throw new Error(`Could not parse definition file "${path}": ${message}`);
|
|
15
|
+
}
|
|
16
|
+
const candidate = typeof parsed === "object" && parsed !== null && "draftDefinition" in parsed ? parsed.draftDefinition : parsed;
|
|
17
|
+
if (typeof candidate !== "object" ||
|
|
18
|
+
candidate === null ||
|
|
19
|
+
!Array.isArray(candidate.lanes) ||
|
|
20
|
+
!Array.isArray(candidate.stages)) {
|
|
21
|
+
throw new Error(`Definition file "${path}" needs \`lanes\` and \`stages\` arrays (see \`workflows get --output json\`).`);
|
|
22
|
+
}
|
|
23
|
+
return candidate;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../../src/commands/workflows/parsers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,iBAAiB,IAAI,MAAM,CAAC,CAAC,CAAE,MAAuC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC;IACnJ,IACE,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,CAAC,KAAK,CAAC,OAAO,CAAE,SAAiC,CAAC,KAAK,CAAC;QACxD,CAAC,KAAK,CAAC,OAAO,CAAE,SAAkC,CAAC,MAAM,CAAC,EAC1D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,gFAAgF,CAAC,CAAC;IAC5H,CAAC;IACD,OAAO,SAAoC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { confirm } from "@inquirer/prompts";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { addGlobalOptions } from "../../../cli.js";
|
|
5
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
6
|
+
import { parseId } from "../../../lib/id.js";
|
|
7
|
+
import { runOneShotCommand } from "../../../lib/one-shot-command.js";
|
|
8
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../../lib/output.js";
|
|
9
|
+
// Confirmed by default: cancel is terminal and stops every lane thread.
|
|
10
|
+
export const cancelRunCommand = addGlobalOptions(addOutputOptions(new Command("cancel").description("Cancel a run and stop its lane threads").argument("<runId>", "Run ID").option("-y, --yes", "Skip confirmation"))).action(async (runId, options, cmd) => {
|
|
11
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
12
|
+
const outputMode = resolveOutputMode(options);
|
|
13
|
+
const parsedRunId = parseId(runId, "runId");
|
|
14
|
+
if (!options.yes) {
|
|
15
|
+
const shouldCancel = await confirm({ message: `Cancel run ${parsedRunId}? Its lane threads are stopped.`, default: false });
|
|
16
|
+
if (!shouldCancel) {
|
|
17
|
+
printOutput(outputMode, { runId: parsedRunId, canceled: false }, () => {
|
|
18
|
+
console.log(chalk.dim("\nCancelled."));
|
|
19
|
+
console.log();
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
await client.mutation(api.workflows.runs.core.cancel, { runId: parsedRunId });
|
|
25
|
+
printOutput(outputMode, { runId: parsedRunId, canceled: true }, (value) => {
|
|
26
|
+
console.log(chalk.green("✓") + " Run canceled");
|
|
27
|
+
console.log(` ID: ${value.runId}`);
|
|
28
|
+
console.log();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EA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AAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QAC9E,WAAW,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;YACxE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YACpC,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FunctionReturnType } from "convex/server";
|
|
2
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
3
|
+
export type RunSummary = FunctionReturnType<typeof api.workflows.runs.core.listByWorkflow>[number];
|
|
4
|
+
export type RunDetail = NonNullable<FunctionReturnType<typeof api.workflows.runs.core.get>>;
|
|
5
|
+
export declare function formatRunLine(run: RunSummary): string;
|
|
6
|
+
export declare function formatRunDetail(run: RunDetail): string[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
function colorStatus(status) {
|
|
3
|
+
switch (status) {
|
|
4
|
+
case "completed":
|
|
5
|
+
return chalk.green(status);
|
|
6
|
+
case "failed":
|
|
7
|
+
case "canceled":
|
|
8
|
+
return chalk.red(status);
|
|
9
|
+
case "running":
|
|
10
|
+
case "waiting":
|
|
11
|
+
return chalk.yellow(status);
|
|
12
|
+
default:
|
|
13
|
+
return chalk.dim(status);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function formatRunLine(run) {
|
|
17
|
+
const ended = run.completedAt ?? run.canceledAt;
|
|
18
|
+
const when = new Date(run.startedAt).toISOString() + (ended ? ` → ${new Date(ended).toISOString()}` : "");
|
|
19
|
+
return `${colorStatus(run.status).padEnd(19)} ${chalk.dim(when)} ${run._id}`;
|
|
20
|
+
}
|
|
21
|
+
// Step ids printed here are the run-step row ids that approve/retry/skip take.
|
|
22
|
+
function formatStep(step) {
|
|
23
|
+
const held = step.held ? ` ${chalk.yellow("held")}` : "";
|
|
24
|
+
const lines = [` ${colorStatus(step.status).padEnd(19)} ${step.title}${held} ${chalk.dim(`· ${step.laneName} · ${step.type} · ${step._id}`)}`];
|
|
25
|
+
if (step.threadId) {
|
|
26
|
+
lines.push(chalk.dim(` thread ${step.threadId}`));
|
|
27
|
+
}
|
|
28
|
+
if (step.errorMessage) {
|
|
29
|
+
lines.push(chalk.red(` ${step.errorMessage}`));
|
|
30
|
+
}
|
|
31
|
+
return lines;
|
|
32
|
+
}
|
|
33
|
+
export function formatRunDetail(run) {
|
|
34
|
+
const lines = [
|
|
35
|
+
chalk.bold(`${run.workflowName} v${run.versionNumber}`) + (run.workflowDeleted ? chalk.dim(" (workflow deleted)") : ""),
|
|
36
|
+
` ID: ${run._id}`,
|
|
37
|
+
` Status: ${colorStatus(run.status)}`,
|
|
38
|
+
` Task: ${run.attachedTaskId ?? "None"}`,
|
|
39
|
+
` Started: ${new Date(run.startedAt).toISOString()}`,
|
|
40
|
+
];
|
|
41
|
+
if (run.completedAt)
|
|
42
|
+
lines.push(` Completed: ${new Date(run.completedAt).toISOString()}`);
|
|
43
|
+
if (run.canceledAt)
|
|
44
|
+
lines.push(` Canceled: ${new Date(run.canceledAt).toISOString()}`);
|
|
45
|
+
lines.push("");
|
|
46
|
+
for (const stage of run.stages) {
|
|
47
|
+
lines.push(chalk.bold(stage.name) + chalk.dim(` ${stage.stageId}`));
|
|
48
|
+
for (const step of stage.steps) {
|
|
49
|
+
lines.push(...formatStep(step));
|
|
50
|
+
}
|
|
51
|
+
lines.push("");
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,SAAS,WAAW,CAAC,MAAc;IACjC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACb,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9B;YACE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAe;IAC3C,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,UAAU,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1G,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC;AAChF,CAAC;AAED,+EAA+E;AAC/E,SAAS,UAAU,CAAC,IAAa;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,E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,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC3F,IAAI,GAAG,CAAC,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { addGlobalOptions } from "../../../cli.js";
|
|
3
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
4
|
+
import { parseId } from "../../../lib/id.js";
|
|
5
|
+
import { runOneShotCommand } from "../../../lib/one-shot-command.js";
|
|
6
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../../lib/output.js";
|
|
7
|
+
import { formatRunDetail } from "./formatters.js";
|
|
8
|
+
export const getRunCommand = addGlobalOptions(addOutputOptions(new Command("get").description("Show a run's stages and steps").argument("<runId>", "Run ID"))).action(async (runId, options, cmd) => {
|
|
9
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
10
|
+
const outputMode = resolveOutputMode(options);
|
|
11
|
+
const run = await client.query(api.workflows.runs.core.get, { runId: parseId(runId, "runId") });
|
|
12
|
+
if (!run) {
|
|
13
|
+
throw new Error("Run not found or not accessible.");
|
|
14
|
+
}
|
|
15
|
+
printOutput(outputMode, run, (value) => {
|
|
16
|
+
console.log();
|
|
17
|
+
for (const line of formatRunDetail(value)) {
|
|
18
|
+
console.log(line);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAC3C,gBAAgB,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAChH,CAAC,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,OAAsB,EAAE,GAAY,EAAE,EAAE;IACrE,MAAM,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAChD,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,CAAiB,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAChH,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QAED,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,KAAK,MAAM,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { cancelRunCommand } from "./cancel.js";
|
|
3
|
+
import { getRunCommand } from "./get.js";
|
|
4
|
+
import { listRunsCommand } from "./list.js";
|
|
5
|
+
import { resumeRunLaneCommand } from "./resume.js";
|
|
6
|
+
import { approveStepCommand, retryStepCommand, skipStepCommand } from "./steps.js";
|
|
7
|
+
export const workflowRunsCommand = new Command("runs")
|
|
8
|
+
.alias("run")
|
|
9
|
+
.description("Workflow run commands")
|
|
10
|
+
.addCommand(listRunsCommand)
|
|
11
|
+
.addCommand(getRunCommand)
|
|
12
|
+
.addCommand(cancelRunCommand)
|
|
13
|
+
.addCommand(approveStepCommand)
|
|
14
|
+
.addCommand(retryStepCommand)
|
|
15
|
+
.addCommand(skipStepCommand)
|
|
16
|
+
.addCommand(resumeRunLaneCommand);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACnD,KAAK,CAAC,KAAK,CAAC;KACZ,WAAW,CAAC,uBAAuB,CAAC;KACpC,UAAU,CAAC,eAAe,CAAC;KAC3B,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,gBAAgB,CAAC;KAC5B,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,gBAAgB,CAAC;KAC5B,UAAU,CAAC,eAAe,CAAC;KAC3B,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../../cli.js";
|
|
4
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
5
|
+
import { parseId } from "../../../lib/id.js";
|
|
6
|
+
import { runOneShotCommand } from "../../../lib/one-shot-command.js";
|
|
7
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../../lib/output.js";
|
|
8
|
+
import { formatRunLine } from "./formatters.js";
|
|
9
|
+
// The caller's own runs only, newest first — the backend scopes by starter.
|
|
10
|
+
export const listRunsCommand = addGlobalOptions(addOutputOptions(new Command("list").description("List your runs of a Workflow").argument("<workflowId>", "Workflow ID"))).action(async (workflowId, options, cmd) => {
|
|
11
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
12
|
+
const outputMode = resolveOutputMode(options);
|
|
13
|
+
const runs = await client.query(api.workflows.runs.core.listByWorkflow, {
|
|
14
|
+
workflowId: parseId(workflowId, "workflowId"),
|
|
15
|
+
});
|
|
16
|
+
printOutput(outputMode, runs, (value) => {
|
|
17
|
+
if (value.length === 0) {
|
|
18
|
+
console.log(chalk.dim("No runs found."));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.log(chalk.bold(`\nRuns (${value.length}):`));
|
|
22
|
+
for (const run of value) {
|
|
23
|
+
console.log(` ${formatRunLine(run)}`);
|
|
24
|
+
}
|
|
25
|
+
console.log();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAC7C,gBAAgB,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAC1H,CAAC,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,OAAsB,EAAE,GAAY,EAAE,EAAE;IAC1E,MAAM,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAChD,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtE,UAAU,EAAE,OAAO,CAAc,UAAU,EAAE,YAAY,CAAC;SAC3D,CAAC,CAAC;QAEH,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBACzC,OAAO;YACT,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;YACrD,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,KAAK,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../../cli.js";
|
|
4
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
5
|
+
import { parseId } from "../../../lib/id.js";
|
|
6
|
+
import { runOneShotCommand } from "../../../lib/one-shot-command.js";
|
|
7
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../../lib/output.js";
|
|
8
|
+
export const resumeRunLaneCommand = addGlobalOptions(addOutputOptions(new Command("resume")
|
|
9
|
+
.description("Resume a lane the user's own message put on hold")
|
|
10
|
+
.argument("<runId>", "Run ID")
|
|
11
|
+
.requiredOption("--lane <laneId>", "Lane ID (from `workflows runs get`)"))).action(async (runId, options, cmd) => {
|
|
12
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
13
|
+
const outputMode = resolveOutputMode(options);
|
|
14
|
+
const args = { runId: parseId(runId, "runId"), laneId: options.lane };
|
|
15
|
+
await client.mutation(api.workflows.runs.core.resumeLane, args);
|
|
16
|
+
printOutput(outputMode, args, (value) => {
|
|
17
|
+
console.log(chalk.green("✓") + " Lane resumed");
|
|
18
|
+
console.log(` Lane: ${value.laneId}`);
|
|
19
|
+
console.log();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/resume.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAC;AAM9G,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAClD,gBAAgB,CACd,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,kDAAkD,CAAC;KAC/D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;KAC7B,cAAc,CAAC,iBAAiB,EAAE,qCAAqC,CAAC,CAC5E,CACF,CAAC,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,OAA6B,EAAE,GAAY,EAAE,EAAE;IAC5E,MAAM,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAChD,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,CAAiB,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACtF,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAChE,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YACvC,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../../cli.js";
|
|
4
|
+
import { api } from "../../../convex/_generated/api.js";
|
|
5
|
+
import { parseId } from "../../../lib/id.js";
|
|
6
|
+
import { runOneShotCommand } from "../../../lib/one-shot-command.js";
|
|
7
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../../lib/output.js";
|
|
8
|
+
// approve, retry, skip share one shape: (runId, run-step id) → null. The
|
|
9
|
+
// backend gates each to the starting user and the step's current status.
|
|
10
|
+
function stepCommand(name, description, mutation, done) {
|
|
11
|
+
return addGlobalOptions(addOutputOptions(new Command(name).description(description).argument("<runId>", "Run ID").argument("<stepId>", "Run step ID (from `workflows runs get`)"))).action(async (runId, stepId, options, cmd) => {
|
|
12
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
13
|
+
const outputMode = resolveOutputMode(options);
|
|
14
|
+
const args = { runId: parseId(runId, "runId"), stepId: parseId(stepId, "stepId") };
|
|
15
|
+
await client.mutation(mutation, args);
|
|
16
|
+
printOutput(outputMode, args, (value) => {
|
|
17
|
+
console.log(chalk.green("✓") + ` ${done}`);
|
|
18
|
+
console.log(` Step: ${value.stepId}`);
|
|
19
|
+
console.log();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export const approveStepCommand = stepCommand("approve", "Approve a waiting step (a wait step completes; a held bash step runs)", api.workflows.runs.core.approveStep, "Step approved");
|
|
25
|
+
export const retryStepCommand = stepCommand("retry", "Retry a failed step", api.workflows.runs.core.retryStep, "Step retried");
|
|
26
|
+
export const skipStepCommand = stepCommand("skip", "Skip a failed step so the run moves on", api.workflows.runs.core.skipStep, "Step skipped");
|
|
27
|
+
//# sourceMappingURL=steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../../../src/commands/workflows/runs/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB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I,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AACxL,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAC/H,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,EAAE,wCAAwC,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../cli.js";
|
|
4
|
+
import { api } from "../../convex/_generated/api.js";
|
|
5
|
+
import { parseId } from "../../lib/id.js";
|
|
6
|
+
import { runOneShotCommand } from "../../lib/one-shot-command.js";
|
|
7
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../lib/output.js";
|
|
8
|
+
import { resolveAbsentableStringInput } from "../../lib/text-input.js";
|
|
9
|
+
import { resolveTaskIdForCommand } from "../tasks/resolve.js";
|
|
10
|
+
function requireFlag(value, flag) {
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
throw new Error(`--${flag} is required.`);
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
// Runtime/model/mode come from the pinned definition (docs/specs/workflows.md →
|
|
17
|
+
// Start), so unlike `threads create` there is no --cli-type here.
|
|
18
|
+
export const startWorkflowCommand = addGlobalOptions(addOutputOptions(new Command("start")
|
|
19
|
+
.description("Start a Workflow run")
|
|
20
|
+
.argument("<workflowId>", "Workflow to run")
|
|
21
|
+
.option("--profile-id <profileId>", "CLI profile to run on (see `profiles list`)")
|
|
22
|
+
.option("--path-id <pathId>", "Working path on that profile")
|
|
23
|
+
.option("--worktree-branch <branch>", "Run in a new worktree on this branch, created from the path")
|
|
24
|
+
.option("--worktree-base <ref>", "Base ref for the new worktree branch")
|
|
25
|
+
.option("--task <taskId>", "Attach a task (ID or ref)")
|
|
26
|
+
.option("--first-prompt <text>", "Override the first lane's first prompt for this run only")
|
|
27
|
+
.option("--first-prompt-file <path>", "Read the first-prompt override from a file")
|
|
28
|
+
.option("--org <org>", "Organization ID or slug (used with --project alias)"))).action(async (workflow, options, cmd) => {
|
|
29
|
+
await runOneShotCommand(cmd, async ({ client, config }) => {
|
|
30
|
+
const outputMode = resolveOutputMode(options);
|
|
31
|
+
const pathId = requireFlag(options.pathId, "path-id");
|
|
32
|
+
if (options.worktreeBase !== undefined && options.worktreeBranch === undefined) {
|
|
33
|
+
throw new Error("--worktree-base needs --worktree-branch.");
|
|
34
|
+
}
|
|
35
|
+
const firstPrompt = resolveAbsentableStringInput({
|
|
36
|
+
inlineValue: options.firstPrompt,
|
|
37
|
+
filePath: options.firstPromptFile,
|
|
38
|
+
inlineLabel: "--first-prompt",
|
|
39
|
+
fileLabel: "--first-prompt-file",
|
|
40
|
+
displayName: "first prompt",
|
|
41
|
+
})?.trim();
|
|
42
|
+
const taskId = options.task
|
|
43
|
+
? await resolveTaskIdForCommand({ client, config, cmd, taskIdOrRef: options.task, org: options.org })
|
|
44
|
+
: undefined;
|
|
45
|
+
const result = await client.mutation(api.workflows.runs.core.start, {
|
|
46
|
+
workflowId: parseId(workflow, "workflowId"),
|
|
47
|
+
profileId: parseId(requireFlag(options.profileId, "profile-id"), "profileId"),
|
|
48
|
+
pathId,
|
|
49
|
+
...(options.worktreeBranch !== undefined && {
|
|
50
|
+
worktree: {
|
|
51
|
+
parentPathId: pathId,
|
|
52
|
+
branch: options.worktreeBranch,
|
|
53
|
+
...(options.worktreeBase !== undefined && { baseRef: options.worktreeBase }),
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
...(taskId !== undefined && { taskId }),
|
|
57
|
+
...(firstPrompt && { firstPromptOverride: { displayContent: firstPrompt } }),
|
|
58
|
+
});
|
|
59
|
+
printOutput(outputMode, result, (value) => {
|
|
60
|
+
console.log(chalk.green("✓") + " Workflow run started");
|
|
61
|
+
console.log(` Run: ${value.runId}`);
|
|
62
|
+
console.log(` Thread: ${value.containerThreadId}`);
|
|
63
|
+
console.log();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/commands/workflows/start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAa9D,SAAS,WAAW,CAAI,KAAoB,EAAE,IAAY;IACxD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,gFAAgF;AAChF,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAClD,gBAAgB,CACd,IAAI,OAAO,CAAC,OAAO,CAAC;KACjB,WAAW,CAAC,sBAAsB,CAAC;KACnC,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAC;KAC3C,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
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addGlobalOptions } from "../../cli.js";
|
|
4
|
+
import { api } from "../../convex/_generated/api.js";
|
|
5
|
+
import { parseId } from "../../lib/id.js";
|
|
6
|
+
import { runOneShotCommand } from "../../lib/one-shot-command.js";
|
|
7
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../lib/output.js";
|
|
8
|
+
import { parseOptionalNonEmptyString } from "../../lib/parsers.js";
|
|
9
|
+
import { validateNoConflict } from "../tasks/parsers.js";
|
|
10
|
+
import { assertRunnable, printValidation } from "./formatters.js";
|
|
11
|
+
import { readDefinitionFile } from "./parsers.js";
|
|
12
|
+
export const updateWorkflowCommand = addGlobalOptions(addOutputOptions(new Command("update")
|
|
13
|
+
.description("Edit a Workflow's identity fields or replace its draft definition")
|
|
14
|
+
.argument("<workflowId>", "Workflow ID")
|
|
15
|
+
.option("--name <name>", "New name")
|
|
16
|
+
.option("--description <description>", "New short description")
|
|
17
|
+
.option("--clear-description", "Clear the description")
|
|
18
|
+
.option("--category <category>", "New category label")
|
|
19
|
+
.option("--clear-category", "Clear the category")
|
|
20
|
+
.option("--color <color>", "New agent palette color")
|
|
21
|
+
.option("--clear-color", "Clear the color")
|
|
22
|
+
.option("--definition-file <path>", "Replace the draft definition (bare JSON, or a `workflows get` dump)")
|
|
23
|
+
.option("--validate", "Run the version-cut checks after saving; exits non-zero when the draft is not runnable"))).action(async (workflow, options, cmd) => {
|
|
24
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
25
|
+
const outputMode = resolveOutputMode(options);
|
|
26
|
+
validateNoConflict(options.clearDescription === true, options.description !== undefined, "Cannot use --description and --clear-description together");
|
|
27
|
+
validateNoConflict(options.clearCategory === true, options.category !== undefined, "Cannot use --category and --clear-category together");
|
|
28
|
+
validateNoConflict(options.clearColor === true, options.color !== undefined, "Cannot use --color and --clear-color together");
|
|
29
|
+
const name = parseOptionalNonEmptyString(options.name, "Name");
|
|
30
|
+
const description = parseOptionalNonEmptyString(options.description, "Description");
|
|
31
|
+
const category = parseOptionalNonEmptyString(options.category, "Category");
|
|
32
|
+
const color = parseOptionalNonEmptyString(options.color, "Color");
|
|
33
|
+
const updates = {
|
|
34
|
+
...(name !== undefined && { name }),
|
|
35
|
+
...(description !== undefined && { description }),
|
|
36
|
+
...(options.clearDescription === true && { description: null }),
|
|
37
|
+
...(category !== undefined && { category }),
|
|
38
|
+
...(options.clearCategory === true && { category: null }),
|
|
39
|
+
...(color !== undefined && { color }),
|
|
40
|
+
...(options.clearColor === true && { color: null }),
|
|
41
|
+
...(options.definitionFile !== undefined && { definition: readDefinitionFile(options.definitionFile) }),
|
|
42
|
+
};
|
|
43
|
+
if (Object.keys(updates).length === 0) {
|
|
44
|
+
throw new Error("No updates provided. Pass at least one field to change.");
|
|
45
|
+
}
|
|
46
|
+
const workflowId = parseId(workflow, "workflowId");
|
|
47
|
+
await client.mutation(api.workflows.core.update, { workflowId, ...updates });
|
|
48
|
+
// One payload for both modes: JSON output must stay a single object.
|
|
49
|
+
const validation = options.validate ? await client.query(api.workflows.core.validate, { workflowId }) : undefined;
|
|
50
|
+
printOutput(outputMode, { workflowId, ...(validation && { validation }) }, (value) => {
|
|
51
|
+
console.log(chalk.green("✓") + " Workflow updated");
|
|
52
|
+
console.log(` ID: ${value.workflowId}`);
|
|
53
|
+
console.log();
|
|
54
|
+
if (value.validation) {
|
|
55
|
+
printValidation(value.validation);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (validation) {
|
|
59
|
+
assertRunnable(validation);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/workflows/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WA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;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,UAAU,EAAE,CAAC;YACf,cAAc,CAAC,UAAU,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { addGlobalOptions } from "../../cli.js";
|
|
3
|
+
import { api } from "../../convex/_generated/api.js";
|
|
4
|
+
import { parseId } from "../../lib/id.js";
|
|
5
|
+
import { runOneShotCommand } from "../../lib/one-shot-command.js";
|
|
6
|
+
import { addOutputOptions, printOutput, resolveOutputMode } from "../../lib/output.js";
|
|
7
|
+
import { assertRunnable, printValidation } from "./formatters.js";
|
|
8
|
+
import { readDefinitionFile } from "./parsers.js";
|
|
9
|
+
// Dry run of the checks a run start applies; nothing is saved or started.
|
|
10
|
+
export const validateWorkflowCommand = addGlobalOptions(addOutputOptions(new Command("validate")
|
|
11
|
+
.description("Check that a Workflow's draft (or a definition file) could start a run")
|
|
12
|
+
.argument("<workflowId>", "Workflow whose draft, or whose project, to check against")
|
|
13
|
+
.option("--definition-file <path>", "Check this definition instead of the stored draft"))).action(async (workflow, options, cmd) => {
|
|
14
|
+
await runOneShotCommand(cmd, async ({ client }) => {
|
|
15
|
+
const outputMode = resolveOutputMode(options);
|
|
16
|
+
const definition = options.definitionFile !== undefined ? readDefinitionFile(options.definitionFile) : undefined;
|
|
17
|
+
const result = await client.query(api.workflows.core.validate, {
|
|
18
|
+
workflowId: parseId(workflow, "workflowId"),
|
|
19
|
+
...(definition !== undefined && { definition }),
|
|
20
|
+
});
|
|
21
|
+
printOutput(outputMode, result, printValidation);
|
|
22
|
+
assertRunnable(result);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/commands/workflows/validate.ts"],"names":[],"mappings":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