@output.ai/cli 0.5.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +1 -0
  2. package/dist/api/generated/api.d.ts +25 -0
  3. package/dist/api/generated/api.js +11 -0
  4. package/dist/commands/agents/init.d.ts +0 -1
  5. package/dist/commands/agents/init.js +9 -16
  6. package/dist/commands/agents/init.spec.js +49 -224
  7. package/dist/commands/workflow/generate.js +2 -2
  8. package/dist/commands/workflow/plan.js +3 -3
  9. package/dist/commands/workflow/plan.spec.js +13 -13
  10. package/dist/commands/workflow/terminate.d.ts +13 -0
  11. package/dist/commands/workflow/terminate.js +39 -0
  12. package/dist/services/claude_client.d.ts +4 -4
  13. package/dist/services/claude_client.integration.test.js +2 -2
  14. package/dist/services/claude_client.js +7 -7
  15. package/dist/services/claude_client.spec.js +3 -3
  16. package/dist/services/coding_agents.d.ts +10 -24
  17. package/dist/services/coding_agents.js +112 -368
  18. package/dist/services/coding_agents.spec.js +101 -290
  19. package/dist/services/project_scaffold.js +3 -3
  20. package/dist/services/workflow_builder.d.ts +1 -1
  21. package/dist/services/workflow_builder.js +1 -1
  22. package/dist/services/workflow_planner.js +5 -3
  23. package/dist/services/workflow_planner.spec.js +4 -5
  24. package/dist/templates/agent_instructions/dotclaude/settings.json.template +29 -0
  25. package/dist/templates/agent_instructions/{AGENTS.md.template → dotoutputai/AGENTS.md.template} +12 -10
  26. package/dist/utils/claude.d.ts +5 -0
  27. package/dist/utils/claude.js +19 -0
  28. package/dist/utils/claude.spec.d.ts +1 -0
  29. package/dist/utils/claude.spec.js +119 -0
  30. package/dist/utils/paths.d.ts +0 -4
  31. package/dist/utils/paths.js +0 -6
  32. package/package.json +3 -3
  33. package/dist/templates/agent_instructions/agents/workflow_context_fetcher.md.template +0 -82
  34. package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +0 -98
  35. package/dist/templates/agent_instructions/agents/workflow_planner.md.template +0 -113
  36. package/dist/templates/agent_instructions/agents/workflow_prompt_writer.md.template +0 -595
  37. package/dist/templates/agent_instructions/agents/workflow_quality.md.template +0 -244
  38. package/dist/templates/agent_instructions/commands/build_workflow.md.template +0 -290
  39. package/dist/templates/agent_instructions/commands/debug_workflow.md.template +0 -198
  40. package/dist/templates/agent_instructions/commands/plan_workflow.md.template +0 -261
  41. package/dist/templates/agent_instructions/meta/post_flight.md.template +0 -94
  42. package/dist/templates/agent_instructions/meta/pre_flight.md.template +0 -60
  43. package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +0 -249
  44. package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +0 -298
  45. package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +0 -265
  46. package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +0 -252
  47. package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +0 -226
  48. package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +0 -209
  49. package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +0 -128
  50. package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +0 -117
  51. package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +0 -199
  52. package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +0 -228
  53. package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +0 -141
  54. package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +0 -201
  55. package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +0 -151
  56. package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +0 -164
  57. package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +0 -134
@@ -1,199 +0,0 @@
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
@@ -1,228 +0,0 @@
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
@@ -1,141 +0,0 @@
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