@@ -33,6 +33,7 @@ tailor-sdk workflow [command]
3333| [ ` workflow list ` ] ( #workflow-list ) | List all workflows in the workspace. |
3434| [ ` workflow get ` ] ( #workflow-get ) | Get workflow details. |
3535| [ ` workflow start ` ] ( #workflow-start ) | Start a workflow execution. |
36+ | [ ` workflow wait ` ] ( #workflow-wait ) | Wait for a workflow execution. |
3637| [ ` workflow executions ` ] ( #workflow-executions ) | List or get workflow executions. |
3738| [ ` workflow resume ` ] ( #workflow-resume ) | Resume a failed or pending workflow execution. |
3839
@@ -175,8 +176,10 @@ tailor-sdk workflow start [options] <name>
175176| ` --machine-user <MACHINE_USER> ` | ` -m ` | Machine user name. Falls back to the active profile's default machine user. | No | - | ` TAILOR_PLATFORM_MACHINE_USER_NAME ` |
176177| ` --arg <ARG> ` | ` -a ` | Workflow argument (JSON string) | No | - | - |
177178| ` --wait ` | ` -W ` | Wait for execution to complete | No | ` false ` | - |
178- | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
179- | ` --logs ` | ` -l ` | Display job execution logs after completion (requires --wait) | No | ` false ` | - |
179+ | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when waiting (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
180+ | ` --timeout <TIMEOUT> ` | ` -t ` | Maximum time to wait (e.g., '30s', '10m') | No | ` "10m" ` | - |
181+ | ` --until <UNTIL> ` | ` -u ` | Wait target (success, suspended, terminal) | No | ` "terminal" ` | - |
182+ | ` --logs ` | ` -l ` | Display job execution logs after completion | No | ` false ` | - |
180183
181184<!-- politty:command:workflow start:options:end -->
182185
@@ -185,6 +188,136 @@ tailor-sdk workflow start [options] <name>
185188See [ Global Options] ( ../cli-reference.md#global-options ) for options available to all commands.
186189
187190<!-- politty:command:workflow start:global-options-link:end -->
191+ <!-- politty:command:workflow wait:heading:start -->
192+
193+ ### workflow wait
194+
195+ <!-- politty:command:workflow wait:heading:end -->
196+
197+ <!-- politty:command:workflow wait:description:start -->
198+
199+ Wait for a workflow execution.
200+
201+ <!-- politty:command:workflow wait:description:end -->
202+
203+ <!-- politty:command:workflow wait:usage:start -->
204+
205+ ** Usage**
206+
207+ ```
208+ tailor-sdk workflow wait [options] <execution-id>
209+ ```
210+
211+ <!-- politty:command:workflow wait:usage:end -->
212+
213+ <!-- politty:command:workflow wait:arguments:start -->
214+
215+ ** Arguments**
216+
217+ | Argument | Description | Required |
218+ | -------------- | ------------ | -------- |
219+ | ` execution-id ` | Execution ID | Yes |
220+
221+ <!-- politty:command:workflow wait:arguments:end -->
222+
223+ <!-- politty:command:workflow wait:options:start -->
224+
225+ ** Options**
226+
227+ | Option | Alias | Description | Required | Default | Env |
228+ | ------------------------------- | ----- | --------------------------------------------------------- | -------- | ------------ | ------------------------------ |
229+ | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - | ` TAILOR_PLATFORM_WORKSPACE_ID ` |
230+ | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - | ` TAILOR_PLATFORM_PROFILE ` |
231+ | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when waiting (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
232+ | ` --timeout <TIMEOUT> ` | ` -t ` | Maximum time to wait (e.g., '30s', '10m') | No | ` "10m" ` | - |
233+ | ` --until <UNTIL> ` | ` -u ` | Wait target (success, suspended, terminal) | No | ` "terminal" ` | - |
234+ | ` --logs ` | ` -l ` | Display job execution logs after completion | No | ` false ` | - |
235+
236+ <!-- politty:command:workflow wait:options:end -->
237+
238+ <!-- politty:command:workflow wait:global-options-link:start -->
239+
240+ See [ Global Options] ( ../cli-reference.md#global-options ) for options available to all commands.
241+
242+ <!-- politty:command:workflow wait:global-options-link:end -->
243+
244+ <!-- politty:command:workflow wait:examples:start -->
245+
246+ ** Examples**
247+
248+ ** Wait for workflow success**
249+
250+ ``` bash
251+ $ tailor-sdk workflow wait execution-id --until success --timeout 10m --json
252+ ```
253+
254+ ** Wait for a workflow wait point**
255+
256+ ``` bash
257+ $ tailor-sdk workflow wait execution-id --until suspended --timeout 6m --logs --json
258+ ```
259+
260+ ** Wait for success, failure, or suspension**
261+
262+ ``` bash
263+ $ tailor-sdk workflow wait execution-id --until terminal
264+ ```
265+
266+ <!-- politty:command:workflow wait:examples:end -->
267+
268+ ** Shell automation**
269+
270+ Capture the execution ID from ` workflow start ` and wait for the same run from a
271+ separate command:
272+
273+ ``` bash
274+ execution_id=" $(
275+ tailor-sdk workflow start order-workflow --json | jq -r ' .executionId'
276+ ) "
277+
278+ tailor-sdk workflow wait " $execution_id " \
279+ --until success \
280+ --timeout 10m \
281+ --interval 5s \
282+ --json
283+ ```
284+
285+ Wait until a workflow reaches a wait point, such as an approval step:
286+
287+ ``` bash
288+ tailor-sdk workflow wait " $execution_id " \
289+ --until suspended \
290+ --timeout 6m \
291+ --logs \
292+ --json
293+ ```
294+
295+ ** Programmatic API**
296+
297+ Use ` waitWorkflowExecution ` when a script already has an execution ID and needs
298+ the same waiter behavior as the CLI:
299+
300+ ``` ts
301+ import { waitWorkflowExecution } from " @tailor-platform/sdk/cli" ;
302+
303+ const executionId = process .env .EXECUTION_ID ;
304+
305+ if (! executionId ) {
306+ throw new Error (" EXECUTION_ID is required" );
307+ }
308+
309+ const result = await waitWorkflowExecution ({
310+ executionId ,
311+ until: " success" ,
312+ timeout: 10 * 60 * 1000 ,
313+ interval: 5000 ,
314+ });
315+
316+ if (result .timedOut ) {
317+ throw new Error (` Workflow ${result .id } timed out at ${result .status } ` );
318+ }
319+ ```
320+
188321<!-- politty:command:workflow executions:heading:start -->
189322
190323### workflow executions
@@ -221,17 +354,19 @@ tailor-sdk workflow executions [options] [execution-id]
221354
222355** Options**
223356
224- | Option | Alias | Description | Required | Default | Env |
225- | --------------------------------- | ----- | -------------------------------------------------------------- | -------- | -------- | ------------------------------ |
226- | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - | ` TAILOR_PLATFORM_WORKSPACE_ID ` |
227- | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - | ` TAILOR_PLATFORM_PROFILE ` |
228- | ` --order <ORDER> ` | - | Sort order (asc or desc) | No | ` "desc" ` | - |
229- | ` --limit <LIMIT> ` | ` -l ` | Maximum number of items to return (0: unlimited) | No | ` 50 ` | - |
230- | ` --workflow-name <WORKFLOW_NAME> ` | ` -n ` | Filter by workflow name (list mode only) | No | - | - |
231- | ` --status <STATUS> ` | ` -s ` | Filter by status (list mode only) | No | - | - |
232- | ` --wait ` | ` -W ` | Wait for execution to complete | No | ` false ` | - |
233- | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
234- | ` --logs ` | - | Display job execution logs (detail mode only) | No | ` false ` | - |
357+ | Option | Alias | Description | Required | Default | Env |
358+ | --------------------------------- | ----- | --------------------------------------------------------- | -------- | ------------ | ------------------------------ |
359+ | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - | ` TAILOR_PLATFORM_WORKSPACE_ID ` |
360+ | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - | ` TAILOR_PLATFORM_PROFILE ` |
361+ | ` --order <ORDER> ` | - | Sort order (asc or desc) | No | ` "desc" ` | - |
362+ | ` --limit <LIMIT> ` | ` -l ` | Maximum number of items to return (0: unlimited) | No | ` 50 ` | - |
363+ | ` --workflow-name <WORKFLOW_NAME> ` | ` -n ` | Filter by workflow name (list mode only) | No | - | - |
364+ | ` --status <STATUS> ` | ` -s ` | Filter by status (list mode only) | No | - | - |
365+ | ` --wait ` | ` -W ` | Wait for execution to complete | No | ` false ` | - |
366+ | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when waiting (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
367+ | ` --timeout <TIMEOUT> ` | ` -t ` | Maximum time to wait (e.g., '30s', '10m') | No | ` "10m" ` | - |
368+ | ` --until <UNTIL> ` | ` -u ` | Wait target (success, suspended, terminal) | No | ` "terminal" ` | - |
369+ | ` --logs ` | - | Display job execution logs (detail mode only) | No | ` false ` | - |
235370
236371<!-- politty:command:workflow executions:options:end -->
237372
@@ -276,13 +411,15 @@ tailor-sdk workflow resume [options] <execution-id>
276411
277412** Options**
278413
279- | Option | Alias | Description | Required | Default | Env |
280- | ------------------------------- | ----- | -------------------------------------------------------------- | -------- | ------- | ------------------------------ |
281- | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - | ` TAILOR_PLATFORM_WORKSPACE_ID ` |
282- | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - | ` TAILOR_PLATFORM_PROFILE ` |
283- | ` --wait ` | ` -W ` | Wait for execution to complete | No | ` false ` | - |
284- | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
285- | ` --logs ` | ` -l ` | Display job execution logs after completion (requires --wait) | No | ` false ` | - |
414+ | Option | Alias | Description | Required | Default | Env |
415+ | ------------------------------- | ----- | --------------------------------------------------------- | -------- | ------------ | ------------------------------ |
416+ | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - | ` TAILOR_PLATFORM_WORKSPACE_ID ` |
417+ | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - | ` TAILOR_PLATFORM_PROFILE ` |
418+ | ` --wait ` | ` -W ` | Wait for execution to complete | No | ` false ` | - |
419+ | ` --interval <INTERVAL> ` | ` -i ` | Polling interval when waiting (e.g., '3s', '500ms', '1m') | No | ` "3s" ` | - |
420+ | ` --timeout <TIMEOUT> ` | ` -t ` | Maximum time to wait (e.g., '30s', '10m') | No | ` "10m" ` | - |
421+ | ` --until <UNTIL> ` | ` -u ` | Wait target (success, suspended, terminal) | No | ` "terminal" ` | - |
422+ | ` --logs ` | ` -l ` | Display job execution logs after completion | No | ` false ` | - |
286423
287424<!-- politty:command:workflow resume:options:end -->
288425
0 commit comments