@output.ai/cli 0.0.4 → 0.0.6
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/dist/api/http_client.js +1 -1
- package/dist/commands/agents/init.d.ts +2 -9
- package/dist/commands/agents/init.js +8 -145
- package/dist/commands/agents/init.spec.js +31 -26
- package/dist/commands/workflow/generate.d.ts +5 -5
- package/dist/commands/workflow/generate.js +2 -2
- package/dist/commands/workflow/generate.spec.js +2 -2
- package/dist/commands/workflow/list.d.ts +4 -4
- package/dist/commands/workflow/list.js +3 -3
- package/dist/commands/workflow/output.d.ts +2 -2
- package/dist/commands/workflow/output.js +4 -4
- package/dist/commands/workflow/plan.d.ts +12 -0
- package/dist/commands/workflow/plan.js +65 -0
- package/dist/commands/workflow/plan.spec.d.ts +1 -0
- package/dist/commands/workflow/plan.spec.js +339 -0
- package/dist/commands/workflow/run.d.ts +4 -4
- package/dist/commands/workflow/run.js +5 -5
- package/dist/commands/workflow/start.d.ts +3 -3
- package/dist/commands/workflow/start.js +3 -3
- package/dist/commands/workflow/status.d.ts +2 -2
- package/dist/commands/workflow/status.js +4 -4
- package/dist/commands/workflow/stop.d.ts +1 -1
- package/dist/commands/workflow/stop.js +2 -2
- package/dist/config.d.ts +4 -0
- package/dist/config.js +4 -0
- package/dist/services/claude_client.d.ts +13 -0
- package/dist/services/claude_client.integration.test.d.ts +1 -0
- package/dist/services/claude_client.integration.test.js +43 -0
- package/dist/services/claude_client.js +155 -0
- package/dist/services/claude_client.spec.d.ts +1 -0
- package/dist/services/claude_client.spec.js +141 -0
- package/dist/services/coding_agents.d.ts +43 -0
- package/dist/services/coding_agents.js +230 -0
- package/dist/services/coding_agents.spec.d.ts +1 -0
- package/dist/services/coding_agents.spec.js +254 -0
- package/dist/services/generate_plan_name@v1.prompt +24 -0
- package/dist/services/template_processor.d.ts +1 -1
- package/dist/services/template_processor.js +1 -1
- package/dist/services/workflow_generator.d.ts +1 -1
- package/dist/services/workflow_generator.js +4 -4
- package/dist/services/workflow_planner.d.ts +20 -0
- package/dist/services/workflow_planner.js +83 -0
- package/dist/services/workflow_planner.spec.d.ts +1 -0
- package/dist/services/workflow_planner.spec.js +208 -0
- package/dist/templates/agent_instructions/commands/plan_workflow.md.template +180 -386
- package/dist/test_helpers/mocks.d.ts +37 -0
- package/dist/test_helpers/mocks.js +67 -0
- package/dist/utils/error_handler.js +1 -1
- package/dist/utils/validation.js +1 -1
- package/package.json +13 -3
|
@@ -1,466 +1,260 @@
|
|
|
1
1
|
---
|
|
2
|
+
argument-hint: [workflow-description-and-additional-instructions]
|
|
2
3
|
description: Workflow Planning Command for Output SDK
|
|
3
|
-
version:
|
|
4
|
-
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
model: claude-opus-4-1
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Your task is to generate a comprehensive Output.ai workflow implementation plan in markdown format.
|
|
9
|
+
|
|
10
|
+
The plan will be displayed to the user who can then decide what to do with it.
|
|
11
|
+
|
|
12
|
+
Please respond with only the final version of the plan.
|
|
13
|
+
|
|
14
|
+
Use the todo tool to track your progress through the plan creation process.
|
|
15
|
+
|
|
16
|
+
# Plan Creation Rules
|
|
8
17
|
|
|
9
18
|
## Overview
|
|
10
19
|
|
|
11
|
-
Generate
|
|
20
|
+
Generate detailed specifications for implementation of a new workflow.
|
|
12
21
|
|
|
13
22
|
<pre_flight_check>
|
|
14
|
-
EXECUTE:
|
|
23
|
+
EXECUTE: @.outputai/instructions/meta/pre_flight.md
|
|
15
24
|
</pre_flight_check>
|
|
16
25
|
|
|
17
26
|
<process_flow>
|
|
18
27
|
|
|
19
|
-
<step number="1"
|
|
20
|
-
|
|
21
|
-
### Step 1:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<defaults>
|
|
28
|
-
- retry_policy: 3 attempts with exponential backoff
|
|
29
|
-
- timeout: 30s for activities, 5m for workflows
|
|
30
|
-
- openai_model: gpt-4o unless specified
|
|
31
|
-
- error_handling: ApplicationFailure patterns
|
|
32
|
-
- performance: clarity over speed optimization
|
|
33
|
-
</defaults>
|
|
34
|
-
</smart_inference>
|
|
35
|
-
|
|
36
|
-
<critical_questions>
|
|
37
|
-
ASK ONLY if cannot be inferred:
|
|
38
|
-
- Ambiguous input/output structures
|
|
39
|
-
- Non-standard API integrations
|
|
40
|
-
- Complex orchestration patterns
|
|
41
|
-
- Unusual error handling requirements
|
|
42
|
-
</critical_questions>
|
|
43
|
-
|
|
44
|
-
<requirements_template>
|
|
45
|
-
## Requirements Analysis
|
|
46
|
-
|
|
47
|
-
**Goal**: {{workflowGoal}}
|
|
48
|
-
**Input**: {{inputDescription}}
|
|
49
|
-
**Output**: {{outputDescription}}
|
|
50
|
-
**External Services**: {{servicesList}}
|
|
51
|
-
**Constraints**: {{constraintsList}}
|
|
52
|
-
</requirements_template>
|
|
28
|
+
<step number="1" name="context_gathering">
|
|
29
|
+
|
|
30
|
+
### Step 1: Context Gathering
|
|
31
|
+
|
|
32
|
+
Take the time to gather all the context you need to create a comprehensive plan.
|
|
33
|
+
1. Read any given files or links
|
|
34
|
+
2. Find any related workflows in the project
|
|
35
|
+
3. Read the projects documentation files
|
|
53
36
|
|
|
54
37
|
</step>
|
|
55
38
|
|
|
56
|
-
<step number="2" name="
|
|
39
|
+
<step number="2" name="requirements_clarification">
|
|
57
40
|
|
|
58
|
-
### Step 2:
|
|
41
|
+
### Step 2: Requirements Clarification
|
|
59
42
|
|
|
60
|
-
|
|
61
|
-
- Check the repository for similar implementations
|
|
62
|
-
- Identify reusable activities
|
|
63
|
-
- Find applicable prompt templates in workflow directories
|
|
64
|
-
- Locate relevant schemas and types
|
|
65
|
-
</analysis_targets>
|
|
43
|
+
Clarify scope boundaries and technical considerations by asking numbered questions as needed to ensure clear requirements before proceeding.
|
|
66
44
|
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
45
|
+
<clarification_areas>
|
|
46
|
+
<scope>
|
|
47
|
+
- in_scope: what is included
|
|
48
|
+
- out_of_scope: what is excluded (optional)
|
|
49
|
+
</scope>
|
|
50
|
+
<technical>
|
|
51
|
+
- functionality specifics
|
|
52
|
+
- UI/UX requirements
|
|
53
|
+
- integration points
|
|
54
|
+
</technical>
|
|
55
|
+
</clarification_areas>
|
|
73
56
|
|
|
57
|
+
<decision_tree>
|
|
58
|
+
IF clarification_needed:
|
|
59
|
+
ASK numbered_questions
|
|
60
|
+
WAIT for_user_response
|
|
61
|
+
ELSE:
|
|
62
|
+
PROCEED schema_definition
|
|
63
|
+
</decision_tree>
|
|
74
64
|
</step>
|
|
75
65
|
|
|
76
|
-
<step number="3"
|
|
66
|
+
<step number="3" name="workflow_design">
|
|
77
67
|
|
|
78
|
-
### Step 3:
|
|
68
|
+
### Step 3: Workflow Design
|
|
79
69
|
|
|
80
|
-
|
|
70
|
+
Design the workflow with clear single purpose steps and sound orchestration logic.
|
|
81
71
|
|
|
82
|
-
<
|
|
83
|
-
- Use simple TypeScript interfaces for basic types
|
|
84
|
-
- Use Zod schemas when validation is needed
|
|
85
|
-
- Keep field types simple: string, number, boolean, object
|
|
86
|
-
- Mark optional fields with ? in interfaces or .optional() in Zod
|
|
87
|
-
- Export types for reuse across workflow files
|
|
88
|
-
</schema_requirements>
|
|
72
|
+
<thought_process>
|
|
89
73
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
74
|
+
1. Define the workflow name and description
|
|
75
|
+
2. What is a valid output schema for the workflow?
|
|
76
|
+
3. What is a valid input schema for the workflow?
|
|
77
|
+
4. What needs to happen to transform the input into the output?
|
|
78
|
+
5. What are the atomic steps that need to happen to transform the input into the output?
|
|
79
|
+
6. How do these steps relate to each other?
|
|
80
|
+
7. Are any of these steps conditional?
|
|
81
|
+
8. Are any of these steps already defined in the project?
|
|
82
|
+
9. How could these steps fail, and how should we handle them? (retry, backoff, etc.)
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
import { z } from 'zod';
|
|
84
|
+
</thought_process>
|
|
100
85
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
<workflow_template>
|
|
87
|
+
```typescript
|
|
88
|
+
import { workflow, z } from 'output.ai/core';
|
|
89
|
+
import { sumValues } from './steps.js';
|
|
105
90
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
const inputSchema = z.object( {
|
|
92
|
+
values: z.array( z.number() )
|
|
93
|
+
} );
|
|
109
94
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
const outputSchema = z.object( {
|
|
96
|
+
result: z.number()
|
|
97
|
+
} );
|
|
98
|
+
|
|
99
|
+
export default workflow( {
|
|
100
|
+
name: 'simple',
|
|
101
|
+
description: 'A simple workflow',
|
|
102
|
+
inputSchema,
|
|
103
|
+
outputSchema,
|
|
104
|
+
fn: async input => {
|
|
105
|
+
const result = await sumValues( input.values );
|
|
106
|
+
return { result };
|
|
116
107
|
}
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
} );
|
|
109
|
+
```
|
|
110
|
+
</workflow_template>
|
|
119
111
|
|
|
120
|
-
|
|
112
|
+
<step number="4" name="step_design">
|
|
113
|
+
### Step 4: Step Design
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### Step 4: Activity Design
|
|
125
|
-
|
|
126
|
-
Use the workflow_planner subagent to design workflow activities with clear boundaries.
|
|
127
|
-
|
|
128
|
-
<activity_template>
|
|
129
|
-
### Step: `{{stepName}}`
|
|
130
|
-
|
|
131
|
-
**Purpose**: {{stepPurpose}}
|
|
132
|
-
|
|
133
|
-
**Implementation (steps.ts)**:
|
|
134
|
-
```typescript
|
|
135
|
-
import { step } from '@output.ai/core';
|
|
136
|
-
import { generateText, generateObject } from '@output.ai/llm';
|
|
137
|
-
import { loadPrompt } from '@output.ai/prompt';
|
|
138
|
-
import type { Prompt } from '@output.ai/llm';
|
|
139
|
-
|
|
140
|
-
export const {{stepName}} = step({
|
|
141
|
-
name: '{{stepName}}',
|
|
142
|
-
description: '{{stepDescription}}',
|
|
143
|
-
inputSchema: {
|
|
144
|
-
type: 'object',
|
|
145
|
-
required: [{{requiredFields}}],
|
|
146
|
-
properties: {
|
|
147
|
-
{{fieldName}}: { type: '{{fieldType}}' }
|
|
148
|
-
// Add more fields as needed
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
outputSchema: {
|
|
152
|
-
type: '{{outputType}}'
|
|
153
|
-
},
|
|
154
|
-
fn: async (input) => {
|
|
155
|
-
// Implementation logic
|
|
156
|
-
{{implementationLogic}}
|
|
157
|
-
|
|
158
|
-
// For LLM operations:
|
|
159
|
-
// const prompt = loadPrompt('{{promptName}}', input);
|
|
160
|
-
// const response = await generateText(prompt as Prompt);
|
|
161
|
-
|
|
162
|
-
return {{returnValue}};
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Error Handling**:
|
|
168
|
-
- Use `FatalError` from '@output.ai/core' for non-retryable errors
|
|
169
|
-
- Standard errors will be retried based on workflow configuration
|
|
170
|
-
</activity_template>
|
|
115
|
+
Design the steps with clear boundaries.
|
|
171
116
|
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
117
|
+
<step_template>
|
|
118
|
+
```typescript
|
|
119
|
+
import { step, z } from 'output.ai/core';
|
|
120
|
+
|
|
121
|
+
export const sumValues = step( {
|
|
122
|
+
name: 'sumValues',
|
|
123
|
+
description: 'Sum all values',
|
|
124
|
+
inputSchema: z.array( z.number() ),
|
|
125
|
+
outputSchema: z.number(),
|
|
126
|
+
fn: async numbers => numbers.reduce( ( v, n ) => v + n, 0 )
|
|
127
|
+
} );
|
|
128
|
+
```
|
|
129
|
+
</step_template>
|
|
184
130
|
|
|
185
131
|
</step>
|
|
186
132
|
|
|
187
|
-
<step number="5"
|
|
133
|
+
<step number="5" name="prompt_engineering">
|
|
188
134
|
|
|
189
|
-
### Step 5: Prompt Engineering
|
|
135
|
+
### Step 5: Prompt Engineering
|
|
190
136
|
|
|
191
|
-
|
|
137
|
+
If any of the steps use an LLM, design the prompts for the steps.
|
|
192
138
|
|
|
193
139
|
<decision_tree>
|
|
194
|
-
IF
|
|
195
|
-
|
|
140
|
+
IF step_uses_llm:
|
|
141
|
+
USE prompt_step_template
|
|
196
142
|
ELSE:
|
|
197
143
|
SKIP to step 6
|
|
198
144
|
</decision_tree>
|
|
199
145
|
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
</prompt_template>
|
|
221
|
-
|
|
222
|
-
<template_variables>
|
|
223
|
-
**Template Variables**:
|
|
224
|
-
- `{{ "{{ " }}{{variableName1}}{{ " }}" }}` - {{description1}}
|
|
225
|
-
- `{{ "{{ " }}{{variableName2}}{{ " }}" }}` - {{description2}}
|
|
226
|
-
|
|
227
|
-
**Loading in Step**:
|
|
228
|
-
```typescript
|
|
229
|
-
const prompt = loadPrompt('{{promptName}}@v1', {
|
|
230
|
-
{{variableName1}}: input.{{field1}},
|
|
231
|
-
{{variableName2}}: input.{{field2}}
|
|
232
|
-
});
|
|
233
|
-
```
|
|
234
|
-
</template_variables>
|
|
235
|
-
|
|
236
|
-
</step>
|
|
237
|
-
|
|
238
|
-
<step number="6" subagent="workflow_planner" name="orchestration_planning">
|
|
239
|
-
|
|
240
|
-
### Step 6: Workflow Orchestration
|
|
241
|
-
|
|
242
|
-
Use the workflow_planner subagent to define the workflow execution logic.
|
|
243
|
-
|
|
244
|
-
<orchestration_template>
|
|
245
|
-
## Workflow Logic
|
|
246
|
-
|
|
247
|
-
1. **Input Validation**: `validateWorkflowInput(rawInput, {{WorkflowName}}InputSchema)`
|
|
248
|
-
2. **{{Step2Name}}**: {{step2Description}}
|
|
249
|
-
3. **{{Step3Name}}**: Call `{{activityName}}({{parameters}})`
|
|
250
|
-
4. **{{Step4Name}}**: {{step4Description}}
|
|
251
|
-
5. **Result Assembly**: Structure final output with metadata
|
|
252
|
-
6. **Return**: Complete {{WorkflowName}}Output object
|
|
253
|
-
|
|
254
|
-
**Conditional Logic**:
|
|
255
|
-
{{conditionalRules}}
|
|
256
|
-
</orchestration_template>
|
|
257
|
-
|
|
258
|
-
<workflow_code_template>
|
|
259
|
-
**Workflow File (workflow.ts)**:
|
|
260
|
-
```typescript
|
|
261
|
-
import { workflow } from '@output.ai/core';
|
|
262
|
-
import { {{stepImports}} } from './steps.js';
|
|
263
|
-
import type { {{WorkflowName}}Input, {{WorkflowName}}Output } from './types.js';
|
|
264
|
-
|
|
265
|
-
export default workflow({
|
|
266
|
-
name: '{{workflowName}}',
|
|
267
|
-
description: '{{workflowDescription}}',
|
|
268
|
-
inputSchema: {
|
|
269
|
-
type: 'object',
|
|
270
|
-
required: [{{requiredFields}}],
|
|
271
|
-
properties: {
|
|
272
|
-
{{fieldName}}: { type: '{{fieldType}}' }
|
|
273
|
-
// Define all input fields
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
outputSchema: {
|
|
277
|
-
type: 'object',
|
|
278
|
-
required: [{{outputRequiredFields}}],
|
|
279
|
-
properties: {
|
|
280
|
-
result: { type: 'string' }
|
|
281
|
-
// Define output structure
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
fn: async (input: {{WorkflowName}}Input): Promise<{{WorkflowName}}Output> => {
|
|
285
|
-
// Workflow orchestration logic
|
|
286
|
-
{{orchestrationSteps}}
|
|
287
|
-
|
|
288
|
-
// Example step invocation:
|
|
289
|
-
// const result = await {{stepName}}({ {{stepParams}} });
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
result: {{resultValue}}
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
```
|
|
297
|
-
</workflow_code_template>
|
|
298
|
-
|
|
299
|
-
</step>
|
|
300
|
-
|
|
301
|
-
<step number="7" name="plan_document_creation">
|
|
302
|
-
|
|
303
|
-
### Step 7: Create Plan Document
|
|
304
|
-
|
|
305
|
-
<plan_structure>
|
|
306
|
-
# Workflow Plan: {{WorkflowName}}
|
|
146
|
+
<prompt_step_template>
|
|
147
|
+
```typescript
|
|
148
|
+
import { step, z } from 'output.ai/core';
|
|
149
|
+
import { loadPrompt } from 'output.ai/prompt';
|
|
150
|
+
import { generateText } from 'output.ai/llm';
|
|
151
|
+
|
|
152
|
+
export const aiSdkPrompt = step( {
|
|
153
|
+
name: 'aiSdkPrompt',
|
|
154
|
+
description: 'Generates a prompt',
|
|
155
|
+
inputSchema: z.object( {
|
|
156
|
+
topic: z.string()
|
|
157
|
+
} ),
|
|
158
|
+
outputSchema: z.string(),
|
|
159
|
+
fn: async ( { topic } ) => {
|
|
160
|
+
const prompt = loadPrompt( 'prompt@v1', { topic } );
|
|
161
|
+
const response = await generateText( { prompt } );
|
|
162
|
+
return response;
|
|
163
|
+
}
|
|
164
|
+
} );
|
|
307
165
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
166
|
+
export const finalStep = step( {
|
|
167
|
+
name: 'finalStep',
|
|
168
|
+
outputSchema: z.boolean(),
|
|
169
|
+
fn: async () => true
|
|
170
|
+
} );
|
|
312
171
|
|
|
313
|
-
|
|
314
|
-
|
|
172
|
+
```
|
|
173
|
+
</prompt_step_template>
|
|
315
174
|
|
|
316
|
-
|
|
317
|
-
|
|
175
|
+
<prompt_template>
|
|
176
|
+
```
|
|
177
|
+
---
|
|
178
|
+
provider: anthropic
|
|
179
|
+
model: claude-sonnet-4-20250514
|
|
180
|
+
temperature: 0.7
|
|
181
|
+
---
|
|
318
182
|
|
|
319
|
-
|
|
320
|
-
|
|
183
|
+
<assistant>
|
|
184
|
+
You are a concise assistant.
|
|
185
|
+
</assistant>
|
|
321
186
|
|
|
322
|
-
|
|
323
|
-
|
|
187
|
+
<user>
|
|
188
|
+
Explain about "{{ topic }}"
|
|
189
|
+
</user>
|
|
324
190
|
|
|
325
|
-
|
|
326
|
-
- [ ] Create workflow directory structure
|
|
327
|
-
- [ ] Implement input/output schemas
|
|
328
|
-
- [ ] Create activity functions
|
|
329
|
-
- [ ] Design prompt templates (if needed)
|
|
330
|
-
- [ ] Implement workflow logic
|
|
331
|
-
- [ ] Add to entrypoint.ts
|
|
332
|
-
- [ ] Write unit tests
|
|
333
|
-
- [ ] Test with flow-cli
|
|
334
|
-
- [ ] Run integration tests
|
|
335
|
-
- [ ] Update documentation
|
|
336
|
-
</plan_structure>
|
|
191
|
+
```
|
|
337
192
|
|
|
338
|
-
|
|
339
|
-
workflow_plans/{{workflowName}}-plan.md
|
|
340
|
-
</file_location>
|
|
193
|
+
</prompt_template>
|
|
341
194
|
|
|
342
195
|
</step>
|
|
343
196
|
|
|
344
|
-
<step number="
|
|
345
|
-
|
|
346
|
-
### Step 8: Define Testing Strategy
|
|
347
|
-
|
|
348
|
-
Use the workflow_planner subagent to create comprehensive testing requirements.
|
|
349
|
-
|
|
350
|
-
<test_scenarios>
|
|
351
|
-
## Testing Plan
|
|
197
|
+
<step number="6" name="testing_strategy">
|
|
352
198
|
|
|
353
|
-
|
|
354
|
-
1. **Complete Input**: All fields provided, successful execution
|
|
355
|
-
2. **Minimal Input**: Required fields only
|
|
356
|
-
3. **Variations**: Different input combinations
|
|
199
|
+
### Step 6: Testing Strategy
|
|
357
200
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
201
|
+
Design the testing strategy for the workflow.
|
|
202
|
+
<thought_process>
|
|
203
|
+
1. What unit tests do we need to write?
|
|
204
|
+
2. How can I run the workflow?
|
|
205
|
+
3. What cases do we need to validate?
|
|
206
|
+
</thought_process>
|
|
362
207
|
|
|
363
|
-
|
|
364
|
-
1. **Invalid Input**: Malformed data, wrong types
|
|
365
|
-
2. **Service Failures**: API errors, timeouts
|
|
366
|
-
3. **Schema Violations**: Invalid responses
|
|
367
|
-
|
|
368
|
-
### Performance Tests
|
|
369
|
-
1. **Response Time**: Must complete within {{timeout}}
|
|
370
|
-
2. **Concurrent Execution**: Multiple workflow instances
|
|
371
|
-
3. **Resource Usage**: Monitor memory and CPU
|
|
372
|
-
</test_scenarios>
|
|
208
|
+
</step>
|
|
373
209
|
|
|
374
|
-
<
|
|
375
|
-
|
|
376
|
-
# Build the workflow
|
|
377
|
-
npm run build
|
|
210
|
+
<step number="7" name="generate_plan">
|
|
211
|
+
### Step 7: Generate Plan
|
|
378
212
|
|
|
379
|
-
|
|
380
|
-
npm run start # or flow-worker
|
|
213
|
+
Generate the complete plan in markdown format.
|
|
381
214
|
|
|
382
|
-
|
|
383
|
-
# Via API endpoint if configured
|
|
384
|
-
curl -X POST http://localhost:3000/workflows/{{workflowName}} \
|
|
385
|
-
-H "Content-Type: application/json" \
|
|
386
|
-
-d '{{testPayload}}'
|
|
215
|
+
Note that every implementation should start with running the cli command `output workflow generate --skeleton` to create the workflow directory structure.
|
|
387
216
|
|
|
388
|
-
|
|
389
|
-
|
|
217
|
+
<file_template>
|
|
218
|
+
<header>
|
|
219
|
+
# Workflow Requirements Document
|
|
390
220
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
221
|
+
> Workflow: [WORKFLOW_NAME]
|
|
222
|
+
> Created: [CURRENT_DATE]
|
|
223
|
+
</header>
|
|
224
|
+
<required_sections>
|
|
225
|
+
- Overview
|
|
226
|
+
- Spec Scope
|
|
227
|
+
- Out of Scope
|
|
228
|
+
- Workflow Design
|
|
229
|
+
- Step Design
|
|
230
|
+
- Testing Strategy
|
|
231
|
+
- Implementation Phases
|
|
232
|
+
</required_sections>
|
|
233
|
+
</file_template>
|
|
395
234
|
|
|
396
235
|
</step>
|
|
397
236
|
|
|
398
|
-
<
|
|
399
|
-
|
|
400
|
-
### Step 9: Review and Approval
|
|
401
|
-
|
|
402
|
-
Request user review of the workflow plan before proceeding to implementation.
|
|
237
|
+
<step_number="8" name="post_flight_check">
|
|
403
238
|
|
|
404
|
-
<review_template>
|
|
405
|
-
I've completed the workflow plan for {{workflowName}}:
|
|
406
239
|
|
|
407
|
-
|
|
240
|
+
### Step 8: Post-Flight Check
|
|
408
241
|
|
|
409
|
-
|
|
410
|
-
- Complete input/output schemas with Zod validation
|
|
411
|
-
- {{activityCount}} activity specifications with error handling
|
|
412
|
-
- Workflow orchestration logic
|
|
413
|
-
- Comprehensive testing strategy
|
|
414
|
-
- Implementation checklist
|
|
242
|
+
Verify the plan is complete and ready for implementation.
|
|
415
243
|
|
|
416
|
-
|
|
417
|
-
|
|
244
|
+
<post_flight_check>
|
|
245
|
+
EXECUTE: @.outputai/instructions/meta/post_flight.md
|
|
246
|
+
</post_flight_check>
|
|
418
247
|
|
|
419
248
|
</step>
|
|
420
249
|
|
|
421
250
|
</process_flow>
|
|
422
251
|
|
|
423
252
|
<post_flight_check>
|
|
424
|
-
EXECUTE:
|
|
253
|
+
EXECUTE: @.outputai/instructions/meta/post_flight.md
|
|
425
254
|
</post_flight_check>
|
|
426
255
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
### Basic Planning
|
|
430
|
-
```
|
|
431
|
-
/plan-workflow "Process customer support tickets using AI categorization"
|
|
432
|
-
```
|
|
256
|
+
---- START ----
|
|
433
257
|
|
|
434
|
-
|
|
435
|
-
```
|
|
436
|
-
/plan-workflow "Multi-step data pipeline with validation" --complexity=complex --integrations=apis,llm
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### Integration-Heavy Workflow
|
|
440
|
-
```
|
|
441
|
-
/plan-workflow "E-commerce order fulfillment" --integrations=payment,inventory,shipping
|
|
442
|
-
```
|
|
258
|
+
Workflow Description and Additional Instructions:
|
|
443
259
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
### Plan Completeness
|
|
447
|
-
- All schemas defined with exact types
|
|
448
|
-
- Every activity specified with I/O and processing logic
|
|
449
|
-
- External services identified with SDK references
|
|
450
|
-
- Error handling complete for all scenarios
|
|
451
|
-
- Testing scenarios documented with commands
|
|
452
|
-
|
|
453
|
-
### Output SDK Compliance
|
|
454
|
-
- ES module imports with .js extensions
|
|
455
|
-
- Use @output.ai/core for workflow and step functions
|
|
456
|
-
- Use @output.ai/llm for AI operations
|
|
457
|
-
- Use @output.ai/prompt for prompt loading
|
|
458
|
-
- Use FatalError from @output.ai/core for non-retryable errors
|
|
459
|
-
- Follow established workflow file structure (workflow.ts, steps.ts, types.ts, *.prompt)
|
|
460
|
-
|
|
461
|
-
### Implementation Readiness
|
|
462
|
-
- Developer can implement without clarification
|
|
463
|
-
- All code examples compile without modification
|
|
464
|
-
- Testing approach is comprehensive
|
|
465
|
-
- Performance requirements are measurable
|
|
466
|
-
- Documentation is clear and actionable
|
|
260
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock for @anthropic-ai/claude-agent-sdk
|
|
3
|
+
*/
|
|
4
|
+
export declare const mockClaudeAgentSDK: {
|
|
5
|
+
Agent: import("vitest").Mock<(...args: any[]) => any>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Mock for @output.ai/llm
|
|
9
|
+
*/
|
|
10
|
+
export declare const mockLLM: {
|
|
11
|
+
generateText: import("vitest").Mock<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Mock for child_process spawn (for agents init)
|
|
15
|
+
*/
|
|
16
|
+
export declare const mockSpawn: import("vitest").Mock<(...args: any[]) => any>;
|
|
17
|
+
/**
|
|
18
|
+
* Mock for fs/promises
|
|
19
|
+
*/
|
|
20
|
+
export declare const mockFS: {
|
|
21
|
+
access: import("vitest").Mock<(...args: any[]) => any>;
|
|
22
|
+
mkdir: import("vitest").Mock<(...args: any[]) => any>;
|
|
23
|
+
writeFile: import("vitest").Mock<(...args: any[]) => any>;
|
|
24
|
+
readFile: import("vitest").Mock<(...args: any[]) => any>;
|
|
25
|
+
stat: import("vitest").Mock<(...args: any[]) => any>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Mock for @inquirer/prompts
|
|
29
|
+
*/
|
|
30
|
+
export declare const mockInquirer: {
|
|
31
|
+
input: import("vitest").Mock<(...args: any[]) => any>;
|
|
32
|
+
confirm: import("vitest").Mock<(...args: any[]) => any>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Reset all mocks
|
|
36
|
+
*/
|
|
37
|
+
export declare function resetAllMocks(): void;
|