@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,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-services-check
|
|
3
|
+
description: Verify Output SDK development services are running. Use when debugging workflows, starting development, encountering connection errors, services may be down, or when you see "ECONNREFUSED" or timeout errors.
|
|
4
|
+
allowed-tools: [Bash, Read]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Output Services Health Check
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill verifies that all required Output SDK development services are running and healthy. The Output SDK requires three services for local development: Docker containers, the API server, and the Temporal server with its UI.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Starting a debugging session
|
|
16
|
+
- Encountering connection refused errors (ECONNREFUSED)
|
|
17
|
+
- Workflows failing to start or connect
|
|
18
|
+
- Timeout errors when running workflows
|
|
19
|
+
- Before running any workflow commands
|
|
20
|
+
- When the development environment seems unresponsive
|
|
21
|
+
|
|
22
|
+
## Instructions
|
|
23
|
+
|
|
24
|
+
### Step 1: Check Docker Containers
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
docker ps | grep output
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Expected**: You should see containers related to `output` running. If no containers appear, Docker may not be running or the services haven't been started.
|
|
31
|
+
|
|
32
|
+
### Step 2: Check API Server Health
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
curl -s http://localhost:3001/health
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Expected**: Returns a health status response. If this fails with "Connection refused", the API server is not running.
|
|
39
|
+
|
|
40
|
+
### Step 3: Check Temporal UI Accessibility
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
curl -s http://localhost:8080 > /dev/null && echo "Temporal UI accessible" || echo "Temporal UI not accessible"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Expected**: "Temporal UI accessible". If not accessible, Temporal server may not be running.
|
|
47
|
+
|
|
48
|
+
## Remediation Steps
|
|
49
|
+
|
|
50
|
+
### If Docker is not running:
|
|
51
|
+
1. Start Docker Desktop (macOS/Windows) or the Docker daemon (Linux)
|
|
52
|
+
2. Wait for Docker to fully initialize
|
|
53
|
+
3. Re-run the checks
|
|
54
|
+
|
|
55
|
+
### If services are not running:
|
|
56
|
+
```bash
|
|
57
|
+
# Start all development services
|
|
58
|
+
npx output dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Wait 30-60 seconds for all services to initialize, then re-run the checks.
|
|
62
|
+
|
|
63
|
+
### If only some services are down:
|
|
64
|
+
```bash
|
|
65
|
+
# Restart all services using Docker Compose
|
|
66
|
+
docker compose down
|
|
67
|
+
docker compose up -d
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### If services fail to start:
|
|
71
|
+
1. Check for port conflicts: `lsof -i :3001` and `lsof -i :8080`
|
|
72
|
+
2. Check Docker logs: `docker compose logs`
|
|
73
|
+
3. Ensure you have sufficient system resources (memory, disk space)
|
|
74
|
+
|
|
75
|
+
## Decision Tree
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
IF docker_not_running:
|
|
79
|
+
ACTION: Start Docker Desktop/daemon
|
|
80
|
+
WAIT: for Docker to initialize
|
|
81
|
+
|
|
82
|
+
IF no_output_containers:
|
|
83
|
+
RUN: npx output dev
|
|
84
|
+
WAIT: 30-60 seconds for services
|
|
85
|
+
|
|
86
|
+
IF api_not_responding:
|
|
87
|
+
CHECK: port 3001 for conflicts
|
|
88
|
+
RUN: output dev (if not already running)
|
|
89
|
+
|
|
90
|
+
IF temporal_not_accessible:
|
|
91
|
+
CHECK: port 8080 for conflicts
|
|
92
|
+
CHECK: docker compose logs for Temporal errors
|
|
93
|
+
|
|
94
|
+
IF all_services_healthy:
|
|
95
|
+
PROCEED: with workflow debugging
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
**Scenario**: User reports "connection refused" when running a workflow
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# First, check if services are running
|
|
104
|
+
docker ps | grep output
|
|
105
|
+
# Output: (empty - no containers)
|
|
106
|
+
|
|
107
|
+
# Start services
|
|
108
|
+
npx output dev
|
|
109
|
+
|
|
110
|
+
# Wait and verify
|
|
111
|
+
sleep 60
|
|
112
|
+
curl -s http://localhost:3001/health
|
|
113
|
+
# Output: {"status":"healthy"}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Scenario**: Partial service failure
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# API responds but Temporal doesn't
|
|
120
|
+
curl -s http://localhost:3001/health # Works
|
|
121
|
+
curl -s http://localhost:8080 # Fails
|
|
122
|
+
|
|
123
|
+
# Check Temporal logs
|
|
124
|
+
docker compose logs temporal
|
|
125
|
+
|
|
126
|
+
# Restart just Temporal
|
|
127
|
+
docker compose restart temporal
|
|
128
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-list
|
|
3
|
+
description: List all available Output SDK workflows in the project. Use when discovering what workflows exist, checking workflow names, exploring the project's workflow structure, or when unsure which workflows are available to run.
|
|
4
|
+
allowed-tools: [Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# List Available Workflows
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill helps you discover all available workflows in an Output SDK project. Workflows are the main execution units that orchestrate steps to accomplish tasks.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Discovering what workflows exist in a project
|
|
16
|
+
- Verifying a workflow name before running it
|
|
17
|
+
- Exploring a new or unfamiliar codebase
|
|
18
|
+
- Checking if a specific workflow has been created
|
|
19
|
+
- Getting an overview of project capabilities
|
|
20
|
+
|
|
21
|
+
## Instructions
|
|
22
|
+
|
|
23
|
+
### List All Workflows
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx output workflow list
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This command scans the project and displays all available workflows.
|
|
30
|
+
|
|
31
|
+
### Understanding the Output
|
|
32
|
+
|
|
33
|
+
The command outputs a table with workflow information:
|
|
34
|
+
|
|
35
|
+
| Column | Description |
|
|
36
|
+
|--------|-------------|
|
|
37
|
+
| Name | The workflow identifier used in commands |
|
|
38
|
+
| Description | Brief description of what the workflow does |
|
|
39
|
+
| Location | File path where the workflow is defined |
|
|
40
|
+
|
|
41
|
+
### Finding Workflow Files
|
|
42
|
+
|
|
43
|
+
Workflows are typically located in:
|
|
44
|
+
```
|
|
45
|
+
src/workflows/*/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Each workflow directory usually contains:
|
|
49
|
+
- `workflow.ts` or `index.ts` - The main workflow definition
|
|
50
|
+
- Step files - Individual steps used by the workflow
|
|
51
|
+
- Schema files - Input/output type definitions
|
|
52
|
+
|
|
53
|
+
### Inspecting a Workflow
|
|
54
|
+
|
|
55
|
+
After finding a workflow, you can examine its code:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Read the workflow file
|
|
59
|
+
cat src/workflows/<workflowName>/workflow.ts
|
|
60
|
+
|
|
61
|
+
# Or examine the entire workflow directory
|
|
62
|
+
ls -la src/workflows/<workflowName>/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Examples
|
|
66
|
+
|
|
67
|
+
**Scenario**: Discover available workflows in a project
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx output workflow list
|
|
71
|
+
|
|
72
|
+
# Example output:
|
|
73
|
+
# Name Description Location
|
|
74
|
+
# ----------- --------------------------- --------------------------------
|
|
75
|
+
# simple Simple workflow example src/workflows/simple/workflow.ts
|
|
76
|
+
# data-pipeline Process and transform data src/workflows/data-pipeline/workflow.ts
|
|
77
|
+
# user-signup Handle user registration src/workflows/user-signup/workflow.ts
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Scenario**: Verify a workflow exists before running
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Check if "email-sender" workflow exists
|
|
84
|
+
npx output workflow list | grep email-sender
|
|
85
|
+
|
|
86
|
+
# If no output, the workflow doesn't exist
|
|
87
|
+
# If found, proceed with running it
|
|
88
|
+
npx output workflow run email-sender '{"to": "user@example.com"}'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Scenario**: Explore workflow implementation
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# List workflows
|
|
95
|
+
npx output workflow list
|
|
96
|
+
|
|
97
|
+
# Find the location and examine it
|
|
98
|
+
cat src/workflows/simple/workflow.ts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Troubleshooting
|
|
102
|
+
|
|
103
|
+
### No workflows found
|
|
104
|
+
- Ensure you're in the project root directory
|
|
105
|
+
- Check that workflows are in `src/workflows/*/`
|
|
106
|
+
- Verify workflow files export a default workflow
|
|
107
|
+
|
|
108
|
+
### Workflow not showing
|
|
109
|
+
- Check the file exports a valid workflow definition
|
|
110
|
+
- Ensure the workflow file compiles without errors
|
|
111
|
+
- Run `npm run build` to check for TypeScript errors
|
|
112
|
+
|
|
113
|
+
## Related Commands
|
|
114
|
+
|
|
115
|
+
- `npx output workflow run <name>` - Execute a workflow synchronously
|
|
116
|
+
- `npx output workflow start <name>` - Start a workflow asynchronously
|
|
117
|
+
- `npx output workflow runs list` - View execution history
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-result
|
|
3
|
+
description: Get the result of an Output SDK workflow execution. Use when retrieving the output of a completed workflow, getting the return value, or checking what a workflow produced after async execution.
|
|
4
|
+
allowed-tools: [Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Get Workflow Execution Result
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill retrieves the result (return value) of a completed workflow execution. Use it after a workflow started with `npx output workflow start` has completed, or to retrieve results from historical runs.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Getting output from an asynchronously started workflow
|
|
16
|
+
- Retrieving results from a completed workflow
|
|
17
|
+
- Checking what a workflow produced
|
|
18
|
+
- Processing workflow output in scripts
|
|
19
|
+
- Comparing results between runs
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- The workflow must have completed (status: COMPLETED)
|
|
24
|
+
- You need the workflow ID
|
|
25
|
+
- For FAILED workflows, use `npx output workflow debug` instead
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
### Get Result
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx output workflow result <workflowId>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The result is the return value of the workflow function, typically JSON.
|
|
36
|
+
|
|
37
|
+
### Check Status First
|
|
38
|
+
|
|
39
|
+
Before getting results, verify the workflow completed:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx output workflow status <workflowId>
|
|
43
|
+
# Should show: COMPLETED
|
|
44
|
+
|
|
45
|
+
npx output workflow result <workflowId>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Understanding Results
|
|
49
|
+
|
|
50
|
+
### Success Results
|
|
51
|
+
|
|
52
|
+
A successful workflow returns the value from its `fn` function:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Workflow code
|
|
56
|
+
export default workflow({
|
|
57
|
+
fn: async (input) => {
|
|
58
|
+
return { processed: true, count: 42 };
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Result output
|
|
65
|
+
npx output workflow result abc123
|
|
66
|
+
# { "processed": true, "count": 42 }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Error Results
|
|
70
|
+
|
|
71
|
+
If you try to get the result of a failed workflow:
|
|
72
|
+
- You'll get an error message
|
|
73
|
+
- Use `npx output workflow debug` instead to see what went wrong
|
|
74
|
+
|
|
75
|
+
### No Result (void workflows)
|
|
76
|
+
|
|
77
|
+
Some workflows don't return a value:
|
|
78
|
+
```bash
|
|
79
|
+
npx output workflow result abc123
|
|
80
|
+
# null
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Examples
|
|
84
|
+
|
|
85
|
+
**Scenario**: Get result after async start
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Start workflow
|
|
89
|
+
npx output workflow start calculate '{"values": [1, 2, 3]}'
|
|
90
|
+
# Output: Workflow ID: calc-abc123
|
|
91
|
+
|
|
92
|
+
# Wait for completion
|
|
93
|
+
npx output workflow status calc-abc123
|
|
94
|
+
# Status: COMPLETED
|
|
95
|
+
|
|
96
|
+
# Get the result
|
|
97
|
+
npx output workflow result calc-abc123
|
|
98
|
+
# { "sum": 6, "average": 2 }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Scenario**: Process result with jq
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Extract specific field
|
|
105
|
+
npx output workflow result abc123 | jq '.total'
|
|
106
|
+
|
|
107
|
+
# Format for display
|
|
108
|
+
npx output workflow result abc123 | jq '.'
|
|
109
|
+
|
|
110
|
+
# Save to file
|
|
111
|
+
npx output workflow result abc123 > result.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Scenario**: Compare results between runs
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Get results from two runs
|
|
118
|
+
npx output workflow result run-1-abc > result1.json
|
|
119
|
+
npx output workflow result run-2-xyz > result2.json
|
|
120
|
+
|
|
121
|
+
# Compare
|
|
122
|
+
diff result1.json result2.json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Scenario**: Use in a script
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
WORKFLOW_ID="abc123"
|
|
129
|
+
|
|
130
|
+
# Wait for completion
|
|
131
|
+
while [[ $(npx output workflow status $WORKFLOW_ID) == *"RUNNING"* ]]; do
|
|
132
|
+
sleep 5
|
|
133
|
+
done
|
|
134
|
+
|
|
135
|
+
# Check if completed successfully
|
|
136
|
+
if [[ $(npx output workflow status $WORKFLOW_ID) == *"COMPLETED"* ]]; then
|
|
137
|
+
RESULT=$(npx output workflow result $WORKFLOW_ID)
|
|
138
|
+
echo "Workflow result: $RESULT"
|
|
139
|
+
else
|
|
140
|
+
echo "Workflow did not complete successfully"
|
|
141
|
+
npx output workflow debug $WORKFLOW_ID
|
|
142
|
+
fi
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Handling Different Result Types
|
|
146
|
+
|
|
147
|
+
### JSON Objects
|
|
148
|
+
```bash
|
|
149
|
+
npx output workflow result abc123
|
|
150
|
+
# { "key": "value", "nested": { "data": true } }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Arrays
|
|
154
|
+
```bash
|
|
155
|
+
npx output workflow result abc123
|
|
156
|
+
# [1, 2, 3, 4, 5]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Primitive Values
|
|
160
|
+
```bash
|
|
161
|
+
npx output workflow result abc123
|
|
162
|
+
# 42
|
|
163
|
+
|
|
164
|
+
npx output workflow result abc123
|
|
165
|
+
# "success"
|
|
166
|
+
|
|
167
|
+
npx output workflow result abc123
|
|
168
|
+
# true
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Large Results
|
|
172
|
+
|
|
173
|
+
For large results, redirect to a file:
|
|
174
|
+
```bash
|
|
175
|
+
npx output workflow result abc123 > large-result.json
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Error Handling
|
|
179
|
+
|
|
180
|
+
### "Workflow not found"
|
|
181
|
+
- Check the workflow ID is correct
|
|
182
|
+
- Use `npx output workflow runs list` to find valid IDs
|
|
183
|
+
|
|
184
|
+
### "Workflow not completed"
|
|
185
|
+
- Check status: `npx output workflow status <id>`
|
|
186
|
+
- Wait for COMPLETED status before getting result
|
|
187
|
+
- If RUNNING, wait and try again
|
|
188
|
+
- If FAILED, use `npx output workflow debug`
|
|
189
|
+
|
|
190
|
+
### "No result available"
|
|
191
|
+
- The workflow may return void/undefined
|
|
192
|
+
- Check the workflow code to see what it returns
|
|
193
|
+
|
|
194
|
+
## Related Commands
|
|
195
|
+
|
|
196
|
+
- `npx output workflow status <id>` - Check if workflow completed
|
|
197
|
+
- `npx output workflow debug <id>` - Debug failed workflows
|
|
198
|
+
- `npx output workflow run <name>` - Run and get result in one step
|
|
199
|
+
- `npx output workflow runs list` - Find workflow IDs
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: output-workflow-run
|
|
3
|
+
description: Execute an Output SDK workflow synchronously and wait for the result. Use when running a workflow and needing immediate results, testing workflow execution, or getting the output directly in the terminal.
|
|
4
|
+
allowed-tools: [Bash, Read, Write]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Run Workflow Synchronously
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill executes a workflow synchronously, meaning the command waits for the workflow to complete and returns the result directly. This is ideal for testing, quick executions, and when you need immediate feedback.
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Testing a workflow during development
|
|
16
|
+
- Running a workflow and needing the result immediately
|
|
17
|
+
- Quick one-off workflow executions
|
|
18
|
+
- Debugging by re-running a workflow with different inputs
|
|
19
|
+
- When you don't need to monitor the workflow separately
|
|
20
|
+
|
|
21
|
+
## When to Use Async Instead
|
|
22
|
+
|
|
23
|
+
Consider using `npx output workflow start` (async) when:
|
|
24
|
+
- The workflow takes a long time (minutes to hours)
|
|
25
|
+
- You need to run multiple workflows in parallel
|
|
26
|
+
- You want to disconnect and check results later
|
|
27
|
+
- You need to monitor progress separately
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
### Basic Syntax
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx output workflow run <workflowName> --input '<json-input>'
|
|
35
|
+
npx output workflow run <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 run example --input '{"question": "who really is ada lovelace?"}'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### 2. File Path (Recommended)
|
|
51
|
+
|
|
52
|
+
Reference a JSON file containing the input:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx output workflow run simple --input src/simple/scenarios/question_ada_lovelace.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
|
+
### Scenario Folder Pattern (Best Practice)
|
|
64
|
+
|
|
65
|
+
Workflows typically have a `scenarios/` folder containing test inputs:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
src/
|
|
69
|
+
my_workflow/
|
|
70
|
+
workflow.ts
|
|
71
|
+
steps.ts
|
|
72
|
+
scenarios/
|
|
73
|
+
basic_test.json
|
|
74
|
+
edge_case_empty.json
|
|
75
|
+
large_payload.json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Best practice workflow:**
|
|
79
|
+
|
|
80
|
+
1. Create a scenario file with your input:
|
|
81
|
+
```bash
|
|
82
|
+
# Create scenarios folder if it doesn't exist
|
|
83
|
+
mkdir -p src/my_workflow/scenarios
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
2. Write your input to a scenario file:
|
|
87
|
+
```json
|
|
88
|
+
// src/my_workflow/scenarios/test_user.json
|
|
89
|
+
{
|
|
90
|
+
"userId": "123",
|
|
91
|
+
"options": {
|
|
92
|
+
"verbose": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. Run the workflow referencing the scenario:
|
|
98
|
+
```bash
|
|
99
|
+
npx output workflow run my_workflow --input src/my_workflow/scenarios/test_user.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Input Examples
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Inline JSON - simple object
|
|
106
|
+
npx output workflow run my-workflow --input '{"userId": "123"}'
|
|
107
|
+
|
|
108
|
+
# Inline JSON - complex nested input
|
|
109
|
+
npx output workflow run data-pipeline --input '{"source": "api", "options": {"limit": 100}}'
|
|
110
|
+
|
|
111
|
+
# File path - reference a scenario file
|
|
112
|
+
npx output workflow run simple --input src/simple/scenarios/basic.json
|
|
113
|
+
|
|
114
|
+
# File path - relative to current directory
|
|
115
|
+
npx output workflow run batch-processor --input ./test_inputs/batch1.json
|
|
116
|
+
|
|
117
|
+
# No input (only if workflow doesn't require it)
|
|
118
|
+
npx output workflow run health-check
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Understanding the Output
|
|
122
|
+
|
|
123
|
+
The command returns the workflow result directly to stdout.
|
|
124
|
+
|
|
125
|
+
### Success Output
|
|
126
|
+
The workflow's return value is displayed, typically as JSON.
|
|
127
|
+
|
|
128
|
+
### Error Output
|
|
129
|
+
If the workflow fails, you'll see:
|
|
130
|
+
- Error message
|
|
131
|
+
- The workflow ID (for further debugging)
|
|
132
|
+
- Suggestion to use `npx output workflow debug` for details
|
|
133
|
+
|
|
134
|
+
## Examples
|
|
135
|
+
|
|
136
|
+
**Scenario**: Test a workflow with a scenario file
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# First, look for existing scenarios
|
|
140
|
+
ls src/simple/scenarios/
|
|
141
|
+
|
|
142
|
+
# Run using a scenario file
|
|
143
|
+
npx output workflow run simple --input src/simple/scenarios/basic_sum.json
|
|
144
|
+
|
|
145
|
+
# Output:
|
|
146
|
+
# { "sum": 6, "count": 3 }
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Scenario**: Create and run a new test scenario
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Create a scenario file
|
|
153
|
+
cat > src/my_workflow/scenarios/test_case_1.json << 'EOF'
|
|
154
|
+
{
|
|
155
|
+
"question": "What is the capital of France?",
|
|
156
|
+
"context": "geography"
|
|
157
|
+
}
|
|
158
|
+
EOF
|
|
159
|
+
|
|
160
|
+
# Run the workflow
|
|
161
|
+
npx output workflow run my_workflow --input src/my_workflow/scenarios/test_case_1.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Scenario**: Quick inline test during development
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
npx output workflow run example --input '{"question": "explain quantum computing"}'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Scenario**: Re-run a workflow with different input for debugging
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# First attempt with scenario file
|
|
174
|
+
npx output workflow run process-data --input src/process_data/scenarios/user_abc.json
|
|
175
|
+
# Error occurs
|
|
176
|
+
|
|
177
|
+
# Create a new scenario to isolate the issue
|
|
178
|
+
cat > src/process_data/scenarios/debug_minimal.json << 'EOF'
|
|
179
|
+
{"id": "test", "debug": true}
|
|
180
|
+
EOF
|
|
181
|
+
|
|
182
|
+
npx output workflow run process-data --input src/process_data/scenarios/debug_minimal.json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Scenario**: Capture output for further processing
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Save result to a file
|
|
189
|
+
npx output workflow run generate-report --input src/generate_report/scenarios/jan_2024.json > report.json
|
|
190
|
+
|
|
191
|
+
# Pipe to jq for processing
|
|
192
|
+
npx output workflow run get-users --input src/get_users/scenarios/active.json | jq '.users[].name'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Error Handling
|
|
196
|
+
|
|
197
|
+
### Common Errors
|
|
198
|
+
|
|
199
|
+
| Error | Cause | Solution |
|
|
200
|
+
|-------|-------|----------|
|
|
201
|
+
| "Workflow not found" | Workflow name is incorrect | Check with `npx output workflow list` |
|
|
202
|
+
| "Invalid input" | JSON doesn't match schema | Verify input matches workflow's inputSchema |
|
|
203
|
+
| "Parse error" | Malformed JSON or file not found | Check JSON syntax or file path |
|
|
204
|
+
| "Timeout" | Workflow took too long | Use async execution for long workflows |
|
|
205
|
+
|
|
206
|
+
### Getting More Details on Failures
|
|
207
|
+
|
|
208
|
+
When a workflow fails, the output includes the workflow ID. Use it to get the full trace:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npx output workflow run my-workflow --input src/my_workflow/scenarios/test.json
|
|
212
|
+
# Output: Workflow failed. ID: abc123xyz
|
|
213
|
+
|
|
214
|
+
npx output workflow debug abc123xyz --format json
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Input Schema Tips
|
|
218
|
+
|
|
219
|
+
1. **Check the schema first**: Look at the workflow's `inputSchema` in the code
|
|
220
|
+
2. **Use scenario files**: Create reusable test inputs in the workflow's `scenarios/` folder
|
|
221
|
+
3. **Use proper types**: Strings in quotes, numbers without quotes, booleans as true/false
|
|
222
|
+
4. **Include required fields**: All non-optional schema fields must be provided
|
|
223
|
+
|
|
224
|
+
## Related Commands
|
|
225
|
+
|
|
226
|
+
- `npx output workflow start <name> --input` - Start asynchronously
|
|
227
|
+
- `npx output workflow list` - See available workflows
|
|
228
|
+
- `npx output workflow debug <id>` - Debug a failed run
|