@output.ai/cli 0.4.2 → 0.5.1
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 +6 -8
- package/dist/assets/docker/docker-compose-dev.yml +9 -1
- package/dist/services/coding_agents.js +180 -8
- package/dist/services/coding_agents.spec.js +54 -11
- package/dist/templates/agent_instructions/AGENTS.md.template +20 -14
- package/dist/templates/agent_instructions/agents/{context_fetcher.md.template → workflow_context_fetcher.md.template} +1 -1
- package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +98 -0
- package/dist/templates/agent_instructions/agents/workflow_planner.md.template +3 -3
- package/dist/templates/agent_instructions/agents/{prompt_writer.md.template → workflow_prompt_writer.md.template} +1 -1
- package/dist/templates/agent_instructions/agents/workflow_quality.md.template +2 -2
- package/dist/templates/agent_instructions/commands/build_workflow.md.template +2 -2
- package/dist/templates/agent_instructions/commands/debug_workflow.md.template +198 -0
- package/dist/templates/agent_instructions/commands/plan_workflow.md.template +3 -3
- package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +249 -0
- package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +298 -0
- package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +265 -0
- package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +252 -0
- package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +226 -0
- package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +209 -0
- package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +128 -0
- package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +117 -0
- package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +199 -0
- package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +228 -0
- package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +141 -0
- package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +201 -0
- package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +151 -0
- package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +164 -0
- package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +134 -0
- package/dist/templates/project/README.md.template +2 -2
- package/dist/templates/project/package.json.template +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-runs-list
|
|
3
|
+
description: List Output SDK workflow execution history. Use when finding failed runs, reviewing past executions, identifying workflow IDs for debugging, filtering runs by workflow type, or investigating recent workflow activity.
|
|
4
|
+
allowed-tools: [Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# List Workflow Execution History
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill helps you view the execution history of workflows. Use it to find failed runs, identify workflow IDs for debugging, and review past executions.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Finding recent failed workflow runs
|
|
16
|
+
- Getting a workflow ID for debugging
|
|
17
|
+
- Reviewing execution history for a specific workflow
|
|
18
|
+
- Investigating when a problem started occurring
|
|
19
|
+
- Checking the status of recent executions
|
|
20
|
+
|
|
21
|
+
## Instructions
|
|
22
|
+
|
|
23
|
+
### List All Recent Runs
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx output workflow runs list
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
By default, this shows the 100 most recent workflow executions across all workflow types.
|
|
30
|
+
|
|
31
|
+
### Available Flags
|
|
32
|
+
|
|
33
|
+
| Flag | Description | Default |
|
|
34
|
+
|------|-------------|---------|
|
|
35
|
+
| `--limit <n>` | Number of runs to display | 100 |
|
|
36
|
+
| `--format <type>` | Output format: table, json, text | table |
|
|
37
|
+
|
|
38
|
+
### Filter by Workflow Name
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx output workflow runs list <workflowName>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This shows only runs for the specified workflow type.
|
|
45
|
+
|
|
46
|
+
### Get Detailed JSON Output
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx output workflow runs list --format json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use JSON format for programmatic analysis or when you need full details.
|
|
53
|
+
|
|
54
|
+
## Understanding the Output
|
|
55
|
+
|
|
56
|
+
### Status Values
|
|
57
|
+
|
|
58
|
+
| Status | Meaning | Action |
|
|
59
|
+
|--------|---------|--------|
|
|
60
|
+
| RUNNING | Workflow is currently executing | Wait or monitor |
|
|
61
|
+
| COMPLETED | Workflow finished successfully | No action needed |
|
|
62
|
+
| FAILED | Workflow encountered an error | Debug with trace |
|
|
63
|
+
| TERMINATED | Workflow was manually stopped | Review if expected |
|
|
64
|
+
| TIMED_OUT | Workflow exceeded time limit | Check for long operations |
|
|
65
|
+
|
|
66
|
+
### Key Fields
|
|
67
|
+
|
|
68
|
+
When viewing runs, pay attention to:
|
|
69
|
+
|
|
70
|
+
- **Workflow ID**: Unique identifier needed for debugging commands
|
|
71
|
+
- **Status**: Current execution state
|
|
72
|
+
- **Start Time**: When the execution began
|
|
73
|
+
- **End Time**: When the execution completed (if finished)
|
|
74
|
+
- **Workflow Name**: The type of workflow that ran
|
|
75
|
+
|
|
76
|
+
## Examples
|
|
77
|
+
|
|
78
|
+
**Scenario**: Find failed workflow runs
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# List recent runs and look for FAILED status
|
|
82
|
+
npx output workflow runs list --limit 20
|
|
83
|
+
|
|
84
|
+
# Or use JSON format with jq to filter
|
|
85
|
+
npx output workflow runs list --format json | jq '.[] | select(.status == "FAILED")'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Scenario**: Get workflow ID for debugging
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# List runs for a specific workflow
|
|
92
|
+
npx output workflow runs list my-workflow --limit 5
|
|
93
|
+
|
|
94
|
+
# Note the workflow ID from the output (e.g., "abc123xyz")
|
|
95
|
+
# Then debug it
|
|
96
|
+
npx output workflow debug abc123xyz --format json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Scenario**: Review recent activity for a specific workflow
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# See the last 10 runs of the data-pipeline workflow
|
|
103
|
+
npx output workflow runs list data-pipeline --limit 10
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Scenario**: Export run history for analysis
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Get all recent runs as JSON for external analysis
|
|
110
|
+
npx output workflow runs list --format json > workflow-runs.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Scenario**: Find when failures started
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Look at more history to find patterns
|
|
117
|
+
npx output workflow runs list --limit 50 --format json | jq 'group_by(.status) | map({status: .[0].status, count: length})'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Identifying Problems
|
|
121
|
+
|
|
122
|
+
### Signs of Issues
|
|
123
|
+
|
|
124
|
+
1. **Multiple FAILED runs**: Indicates a persistent bug
|
|
125
|
+
2. **Mix of COMPLETED and FAILED**: Could be input-dependent issues
|
|
126
|
+
3. **All recent runs TERMINATED**: Someone may be stopping workflows
|
|
127
|
+
4. **Long RUNNING times**: Possible hang or performance issue
|
|
128
|
+
|
|
129
|
+
### Next Steps After Finding a Failed Run
|
|
130
|
+
|
|
131
|
+
1. Copy the workflow ID from the run
|
|
132
|
+
2. Get the execution trace: `npx output workflow debug <workflowId> --format json`
|
|
133
|
+
3. Analyze the trace to identify the failure
|
|
134
|
+
4. Apply the appropriate fix based on the error pattern
|
|
135
|
+
|
|
136
|
+
## Related Commands
|
|
137
|
+
|
|
138
|
+
- `npx output workflow debug <id>` - Analyze execution trace
|
|
139
|
+
- `npx output workflow status <id>` - Check current status
|
|
140
|
+
- `npx output workflow result <id>` - Get execution result
|
|
141
|
+
- `npx output workflow list` - List available workflows
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-start
|
|
3
|
+
description: Start an Output SDK workflow asynchronously without waiting for completion. Use when starting long-running workflows, getting a workflow ID for later monitoring, running workflows in the background, or executing multiple workflows in parallel.
|
|
4
|
+
allowed-tools: [Bash, Read, Write]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Start Workflow Asynchronously
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill starts a workflow asynchronously, meaning the command returns immediately with a workflow ID while the workflow executes in the background. Use this for long-running workflows or when you need to run multiple workflows in parallel.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Starting workflows that take minutes or hours
|
|
16
|
+
- Running multiple workflows in parallel
|
|
17
|
+
- When you need to disconnect and check results later
|
|
18
|
+
- Monitoring workflow progress separately
|
|
19
|
+
- When you need the workflow ID immediately for tracking
|
|
20
|
+
|
|
21
|
+
## When to Use Sync Instead
|
|
22
|
+
|
|
23
|
+
Consider using `npx output workflow run` (sync) when:
|
|
24
|
+
- Workflow completes quickly (seconds)
|
|
25
|
+
- You need the result immediately in your terminal
|
|
26
|
+
- Simple testing during development
|
|
27
|
+
- You want a single command with the result
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
### Basic Syntax
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx output workflow start <workflowName> --input '<json-input>'
|
|
35
|
+
npx output workflow start <workflowName> --input <path-to-json-file>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The `--input` flag is required when the workflow expects input data.
|
|
39
|
+
|
|
40
|
+
### Input Methods
|
|
41
|
+
|
|
42
|
+
#### 1. Inline JSON
|
|
43
|
+
|
|
44
|
+
Pass JSON directly on the command line:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx output workflow start data-migration --input '{"batchSize": 1000}'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### 2. File Path (Recommended)
|
|
51
|
+
|
|
52
|
+
Reference a JSON file containing the input:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This is the recommended approach because:
|
|
59
|
+
- Input is version controlled and reproducible
|
|
60
|
+
- Complex inputs are easier to read and edit
|
|
61
|
+
- Scenarios can be shared and reused
|
|
62
|
+
|
|
63
|
+
### Getting the Workflow ID
|
|
64
|
+
|
|
65
|
+
The command outputs the workflow ID which you'll need for:
|
|
66
|
+
- Checking status: `npx output workflow status <id>`
|
|
67
|
+
- Getting results: `npx output workflow result <id>`
|
|
68
|
+
- Debugging: `npx output workflow debug <id>`
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
**Scenario**: Start a long-running workflow with scenario file
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx output workflow start data-migration --input src/data_migration/scenarios/full_migration.json
|
|
76
|
+
|
|
77
|
+
# Output:
|
|
78
|
+
# Started workflow: data-migration
|
|
79
|
+
# Workflow ID: abc123xyz
|
|
80
|
+
# Use 'npx output workflow status abc123xyz' to check progress
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Scenario**: Start multiple workflows in parallel using scenario files
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Start several workflows with different scenario files
|
|
87
|
+
npx output workflow start process-batch --input src/process_batch/scenarios/batch_1.json
|
|
88
|
+
npx output workflow start process-batch --input src/process_batch/scenarios/batch_2.json
|
|
89
|
+
npx output workflow start process-batch --input src/process_batch/scenarios/batch_3.json
|
|
90
|
+
|
|
91
|
+
# Note: Save the workflow IDs to check them later
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Scenario**: Create scenario then start workflow
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Create a scenario file
|
|
98
|
+
mkdir -p src/generate_report/scenarios
|
|
99
|
+
cat > src/generate_report/scenarios/annual_2024.json << 'EOF'
|
|
100
|
+
{
|
|
101
|
+
"year": 2024,
|
|
102
|
+
"includeCharts": true,
|
|
103
|
+
"format": "pdf"
|
|
104
|
+
}
|
|
105
|
+
EOF
|
|
106
|
+
|
|
107
|
+
# Start the workflow
|
|
108
|
+
npx output workflow start generate-report --input src/generate_report/scenarios/annual_2024.json
|
|
109
|
+
# Output: Workflow ID: report-2024-abc
|
|
110
|
+
|
|
111
|
+
# Check status periodically
|
|
112
|
+
npx output workflow status report-2024-abc
|
|
113
|
+
# Output: Status: RUNNING
|
|
114
|
+
|
|
115
|
+
# Later, check again
|
|
116
|
+
npx output workflow status report-2024-abc
|
|
117
|
+
# Output: Status: COMPLETED
|
|
118
|
+
|
|
119
|
+
# Get the result
|
|
120
|
+
npx output workflow result report-2024-abc
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Scenario**: Quick inline test for development
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx output workflow start quick-job --input '{"test": true}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Scenario**: Script for parallel execution
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Start workflows and capture IDs
|
|
133
|
+
ID1=$(npx output workflow start job --input src/job/scenarios/type_a.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
|
|
134
|
+
ID2=$(npx output workflow start job --input src/job/scenarios/type_b.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
|
|
135
|
+
|
|
136
|
+
# Wait and check results
|
|
137
|
+
npx output workflow result $ID1
|
|
138
|
+
npx output workflow result $ID2
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Following Up After Starting
|
|
142
|
+
|
|
143
|
+
### Check Status
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx output workflow status <workflowId>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Status values:
|
|
150
|
+
- **RUNNING**: Still executing
|
|
151
|
+
- **COMPLETED**: Finished successfully
|
|
152
|
+
- **FAILED**: Encountered an error
|
|
153
|
+
- **TERMINATED**: Was manually stopped
|
|
154
|
+
|
|
155
|
+
### Get Result
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npx output workflow result <workflowId>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Only works for COMPLETED workflows. For FAILED workflows, use debug.
|
|
162
|
+
|
|
163
|
+
### Debug If Failed
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npx output workflow debug <workflowId> --format json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Stop If Needed
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npx output workflow stop <workflowId>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Workflow ID Management
|
|
176
|
+
|
|
177
|
+
When starting multiple workflows, keep track of IDs:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Log IDs to a file
|
|
181
|
+
npx output workflow start batch-job --input src/batch_job/scenarios/id_1.json >> workflow-ids.txt
|
|
182
|
+
npx output workflow start batch-job --input src/batch_job/scenarios/id_2.json >> workflow-ids.txt
|
|
183
|
+
|
|
184
|
+
# Or use a naming convention in your workflow that makes IDs predictable
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Best Practices
|
|
188
|
+
|
|
189
|
+
1. **Use scenario files**: Store inputs in `src/<workflow>/scenarios/` for reproducibility
|
|
190
|
+
2. **Save the workflow ID**: Always note the ID for later reference
|
|
191
|
+
3. **Monitor long workflows**: Use `npx output workflow status` to check progress
|
|
192
|
+
4. **Handle failures**: Check status before getting results
|
|
193
|
+
5. **Clean up**: Stop any stuck workflows with `npx output workflow stop`
|
|
194
|
+
|
|
195
|
+
## Related Commands
|
|
196
|
+
|
|
197
|
+
- `npx output workflow run <name> --input` - Execute synchronously
|
|
198
|
+
- `npx output workflow status <id>` - Check execution status
|
|
199
|
+
- `npx output workflow result <id>` - Get execution result
|
|
200
|
+
- `npx output workflow stop <id>` - Stop a running workflow
|
|
201
|
+
- `npx output workflow debug <id>` - Debug a workflow execution
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-status
|
|
3
|
+
description: Check the status of an Output SDK workflow execution. Use when monitoring a running workflow, checking if a workflow completed, or determining workflow state (RUNNING, COMPLETED, FAILED, TERMINATED).
|
|
4
|
+
allowed-tools: [Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Check Workflow Execution Status
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill checks the current execution status of a workflow. Use it to monitor running workflows, verify completion, or determine if a workflow failed before attempting to get its result.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Monitoring a workflow started asynchronously
|
|
16
|
+
- Checking if a workflow has completed
|
|
17
|
+
- Determining why you can't get a workflow result
|
|
18
|
+
- Verifying workflow state before taking action
|
|
19
|
+
- Polling for completion in scripts
|
|
20
|
+
|
|
21
|
+
## When to Use Other Commands
|
|
22
|
+
|
|
23
|
+
- **Getting results**: Use `npx output workflow result` after confirming COMPLETED status
|
|
24
|
+
- **Debugging failures**: Use `npx output workflow debug` for FAILED workflows
|
|
25
|
+
- **Execution history**: Use `npx output workflow runs list` for multiple runs
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
### Check Status
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx output workflow status <workflowId>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Replace `<workflowId>` with the ID from `npx output workflow start` or `npx output workflow runs list`.
|
|
36
|
+
|
|
37
|
+
## Understanding Status Values
|
|
38
|
+
|
|
39
|
+
| Status | Meaning | Next Action |
|
|
40
|
+
|--------|---------|-------------|
|
|
41
|
+
| RUNNING | Workflow is currently executing | Wait and check again |
|
|
42
|
+
| COMPLETED | Workflow finished successfully | Get result with `npx output workflow result` |
|
|
43
|
+
| FAILED | Workflow encountered an error | Debug with `npx output workflow debug` |
|
|
44
|
+
| TERMINATED | Workflow was manually stopped | Review if expected, restart if needed |
|
|
45
|
+
| TIMED_OUT | Workflow exceeded time limit | Check for long operations, adjust timeout |
|
|
46
|
+
|
|
47
|
+
## Examples
|
|
48
|
+
|
|
49
|
+
**Scenario**: Monitor a running workflow
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Start a workflow
|
|
53
|
+
npx output workflow start data-sync '{"source": "external"}'
|
|
54
|
+
# Output: Workflow ID: sync-abc123
|
|
55
|
+
|
|
56
|
+
# Check status
|
|
57
|
+
npx output workflow status sync-abc123
|
|
58
|
+
# Output: Status: RUNNING
|
|
59
|
+
|
|
60
|
+
# Wait and check again
|
|
61
|
+
sleep 30
|
|
62
|
+
npx output workflow status sync-abc123
|
|
63
|
+
# Output: Status: COMPLETED
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Scenario**: Poll for completion in a script
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
WORKFLOW_ID="abc123xyz"
|
|
70
|
+
|
|
71
|
+
while true; do
|
|
72
|
+
STATUS=$(npx output workflow status $WORKFLOW_ID)
|
|
73
|
+
echo "Current status: $STATUS"
|
|
74
|
+
|
|
75
|
+
if [[ "$STATUS" == *"COMPLETED"* ]]; then
|
|
76
|
+
echo "Workflow completed!"
|
|
77
|
+
npx output workflow result $WORKFLOW_ID
|
|
78
|
+
break
|
|
79
|
+
elif [[ "$STATUS" == *"FAILED"* ]]; then
|
|
80
|
+
echo "Workflow failed!"
|
|
81
|
+
npx output workflow debug $WORKFLOW_ID --format json
|
|
82
|
+
break
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
sleep 10
|
|
86
|
+
done
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Scenario**: Check before getting result
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Verify status first
|
|
93
|
+
npx output workflow status my-workflow-123
|
|
94
|
+
|
|
95
|
+
# If COMPLETED, get result
|
|
96
|
+
npx output workflow result my-workflow-123
|
|
97
|
+
|
|
98
|
+
# If FAILED, debug instead
|
|
99
|
+
npx output workflow debug my-workflow-123 --format json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Scenario**: Batch status check
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Check multiple workflows
|
|
106
|
+
for id in abc123 def456 ghi789; do
|
|
107
|
+
echo "Workflow $id: $(npx output workflow status $id)"
|
|
108
|
+
done
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Status Transitions
|
|
112
|
+
|
|
113
|
+
Workflows typically follow these paths:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
RUNNING -> COMPLETED (success)
|
|
117
|
+
RUNNING -> FAILED (error occurred)
|
|
118
|
+
RUNNING -> TERMINATED (manually stopped)
|
|
119
|
+
RUNNING -> TIMED_OUT (exceeded limit)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Interpreting Status Output
|
|
123
|
+
|
|
124
|
+
The status command returns information including:
|
|
125
|
+
- **Status**: Current state (RUNNING, COMPLETED, FAILED, etc.)
|
|
126
|
+
- **Duration**: How long the workflow has been running or ran
|
|
127
|
+
- **Start Time**: When the workflow began
|
|
128
|
+
|
|
129
|
+
## Troubleshooting
|
|
130
|
+
|
|
131
|
+
### "Workflow not found"
|
|
132
|
+
- The workflow ID may be incorrect
|
|
133
|
+
- The workflow may have been deleted from history
|
|
134
|
+
- Check `npx output workflow runs list` to find the correct ID
|
|
135
|
+
|
|
136
|
+
### Status stays RUNNING too long
|
|
137
|
+
1. Check if the workflow is stuck: `npx output workflow debug <id>`
|
|
138
|
+
2. Look for infinite loops or waiting operations
|
|
139
|
+
3. Consider stopping: `npx output workflow stop <id>`
|
|
140
|
+
|
|
141
|
+
### Unexpected TERMINATED status
|
|
142
|
+
- Someone may have manually stopped the workflow
|
|
143
|
+
- Check with `npx output workflow debug` for context
|
|
144
|
+
- Restart if needed: `npx output workflow start`
|
|
145
|
+
|
|
146
|
+
## Related Commands
|
|
147
|
+
|
|
148
|
+
- `npx output workflow result <id>` - Get execution result (after COMPLETED)
|
|
149
|
+
- `npx output workflow debug <id>` - Debug execution (after FAILED)
|
|
150
|
+
- `npx output workflow stop <id>` - Stop a running workflow
|
|
151
|
+
- `npx output workflow runs list` - View execution history
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-stop
|
|
3
|
+
description: Stop a running Output SDK workflow execution. Use when cancelling a workflow, stopping a long-running process, terminating a stuck workflow, or when you need to abort a workflow in progress.
|
|
4
|
+
allowed-tools: [Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stop Running Workflow
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill stops a running workflow execution. The workflow will be marked as TERMINATED and will not complete its remaining steps. Use this carefully as it cannot be undone.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Cancelling a workflow that's no longer needed
|
|
16
|
+
- Stopping a workflow that appears stuck
|
|
17
|
+
- Terminating a long-running workflow to free resources
|
|
18
|
+
- Aborting a workflow with incorrect input
|
|
19
|
+
- Emergency stop during unexpected behavior
|
|
20
|
+
|
|
21
|
+
## When NOT to Use This
|
|
22
|
+
|
|
23
|
+
- If the workflow is about to complete (let it finish)
|
|
24
|
+
- If you're unsure whether stopping is safe
|
|
25
|
+
- For debugging (use `npx output workflow debug` instead)
|
|
26
|
+
- If the workflow has side effects that may leave data in an inconsistent state
|
|
27
|
+
|
|
28
|
+
## Instructions
|
|
29
|
+
|
|
30
|
+
### Stop a Workflow
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx output workflow stop <workflowId>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Safety Considerations
|
|
37
|
+
|
|
38
|
+
Before stopping, consider:
|
|
39
|
+
|
|
40
|
+
1. **Side effects**: Has the workflow made changes that need to be rolled back?
|
|
41
|
+
2. **Partial completion**: Are there steps that completed with side effects?
|
|
42
|
+
3. **Dependencies**: Are other workflows or systems waiting on this result?
|
|
43
|
+
4. **Recovery**: Do you need to restart or clean up after stopping?
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
**Scenario**: Stop a stuck workflow
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Check status - workflow has been running too long
|
|
51
|
+
npx output workflow status abc123xyz
|
|
52
|
+
# Status: RUNNING (for 2 hours)
|
|
53
|
+
|
|
54
|
+
# Decide to stop it
|
|
55
|
+
npx output workflow stop abc123xyz
|
|
56
|
+
# Workflow abc123xyz has been stopped
|
|
57
|
+
|
|
58
|
+
# Verify it's terminated
|
|
59
|
+
npx output workflow status abc123xyz
|
|
60
|
+
# Status: TERMINATED
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Scenario**: Cancel a workflow started with wrong input
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Realized input was wrong immediately after starting
|
|
67
|
+
npx output workflow start expensive-job '{"wrong": "input"}'
|
|
68
|
+
# Workflow ID: job-abc123
|
|
69
|
+
|
|
70
|
+
# Stop before it processes too much
|
|
71
|
+
npx output workflow stop job-abc123
|
|
72
|
+
|
|
73
|
+
# Start again with correct input
|
|
74
|
+
npx output workflow start expensive-job '{"correct": "input"}'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Scenario**: Stop multiple workflows
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Get list of running workflows
|
|
81
|
+
npx output workflow runs list --format json | jq '.[] | select(.status == "RUNNING") | .workflowId'
|
|
82
|
+
|
|
83
|
+
# Stop each one (carefully review first!)
|
|
84
|
+
for id in abc123 def456; do
|
|
85
|
+
echo "Stopping $id"
|
|
86
|
+
npx output workflow stop $id
|
|
87
|
+
done
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## After Stopping a Workflow
|
|
91
|
+
|
|
92
|
+
### Check the State
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx output workflow status <workflowId>
|
|
96
|
+
# Status: TERMINATED
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Review What Happened
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx output workflow debug <workflowId> --format json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This shows:
|
|
106
|
+
- Which steps completed before termination
|
|
107
|
+
- Any partial results or side effects
|
|
108
|
+
- The point at which the workflow was stopped
|
|
109
|
+
|
|
110
|
+
### Clean Up If Needed
|
|
111
|
+
|
|
112
|
+
If the workflow made partial changes:
|
|
113
|
+
1. Review the debug output to see what completed
|
|
114
|
+
2. Manually revert any side effects if necessary
|
|
115
|
+
3. Consider creating a cleanup workflow for this scenario
|
|
116
|
+
|
|
117
|
+
### Restart If Appropriate
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Start a fresh execution
|
|
121
|
+
npx output workflow start <workflowName> '<input>'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## What Happens When You Stop
|
|
125
|
+
|
|
126
|
+
1. The Temporal server receives the termination request
|
|
127
|
+
2. The currently executing step may complete or abort
|
|
128
|
+
3. No further steps are executed
|
|
129
|
+
4. The workflow status changes to TERMINATED
|
|
130
|
+
5. The result will not be available (workflow didn't complete)
|
|
131
|
+
|
|
132
|
+
## Troubleshooting
|
|
133
|
+
|
|
134
|
+
### "Workflow not found"
|
|
135
|
+
- Check the workflow ID is correct
|
|
136
|
+
- Use `npx output workflow runs list` to find valid IDs
|
|
137
|
+
|
|
138
|
+
### "Workflow already completed"
|
|
139
|
+
- The workflow finished before the stop command
|
|
140
|
+
- Check status and get result if needed
|
|
141
|
+
|
|
142
|
+
### "Workflow already terminated"
|
|
143
|
+
- The workflow was already stopped
|
|
144
|
+
- No action needed
|
|
145
|
+
|
|
146
|
+
### Stop command hangs
|
|
147
|
+
- The Temporal server may be unresponsive
|
|
148
|
+
- Check if services are running: `docker ps | grep output`
|
|
149
|
+
- May need to restart services
|
|
150
|
+
|
|
151
|
+
## Best Practices
|
|
152
|
+
|
|
153
|
+
1. **Always check status first**: Confirm the workflow is actually RUNNING
|
|
154
|
+
2. **Review before stopping**: Use `npx output workflow debug` to understand state
|
|
155
|
+
3. **Document why**: Note why you stopped the workflow for future reference
|
|
156
|
+
4. **Plan for cleanup**: Know what side effects may need manual handling
|
|
157
|
+
5. **Consider alternatives**: Sometimes waiting is better than stopping
|
|
158
|
+
|
|
159
|
+
## Related Commands
|
|
160
|
+
|
|
161
|
+
- `npx output workflow status <id>` - Check current status
|
|
162
|
+
- `npx output workflow debug <id>` - Review execution details
|
|
163
|
+
- `npx output workflow start <name>` - Start a new execution
|
|
164
|
+
- `npx output workflow runs list` - View execution history
|