roast-ai 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +32 -0
- data/CLAUDE.md +52 -1
- data/Gemfile +3 -1
- data/Gemfile.lock +63 -16
- data/README.md +115 -5
- data/bin/roast +1 -1
- data/claude-swarm.yml +210 -0
- data/docs/AGENT_STEPS.md +264 -0
- data/examples/agent_workflow/README.md +75 -0
- data/examples/agent_workflow/apply_refactorings/prompt.md +22 -0
- data/examples/agent_workflow/identify_code_smells/prompt.md +15 -0
- data/examples/agent_workflow/summarize_improvements/prompt.md +18 -0
- data/examples/agent_workflow/workflow.yml +16 -0
- data/examples/available_tools_demo/README.md +42 -0
- data/examples/available_tools_demo/analyze_files/prompt.md +6 -0
- data/examples/available_tools_demo/explore_directory/prompt.md +6 -0
- data/examples/available_tools_demo/workflow.yml +32 -0
- data/examples/available_tools_demo/write_summary/prompt.md +6 -0
- data/examples/case_when/detect_language/prompt.md +2 -2
- data/examples/grading/README.md +71 -0
- data/examples/grading/run_coverage.rb +0 -2
- data/examples/iteration/analyze_complexity/prompt.md +2 -2
- data/examples/iteration/generate_recommendations/prompt.md +2 -2
- data/examples/iteration/implement_fix/prompt.md +2 -2
- data/examples/iteration/prioritize_issues/prompt.md +1 -1
- data/examples/iteration/prompts/analyze_file.md +2 -2
- data/examples/iteration/prompts/generate_summary.md +1 -1
- data/examples/iteration/prompts/update_report.md +3 -3
- data/examples/iteration/prompts/write_report.md +3 -3
- data/examples/iteration/read_file/prompt.md +2 -2
- data/examples/iteration/select_next_issue/prompt.md +2 -2
- data/examples/iteration/update_fix_count/prompt.md +4 -4
- data/examples/iteration/verify_fix/prompt.md +3 -3
- data/examples/mcp/README.md +3 -3
- data/examples/mcp/analyze_changes/prompt.md +1 -1
- data/examples/mcp/database_workflow.yml +1 -1
- data/examples/mcp/fetch_pr_context/prompt.md +1 -1
- data/examples/mcp/github_workflow.yml +1 -1
- data/examples/mcp/post_review/prompt.md +1 -1
- data/examples/pre_post_processing/analyze_test_file/prompt.md +1 -1
- data/examples/pre_post_processing/improve_test_coverage/prompt.md +1 -1
- data/examples/pre_post_processing/optimize_test_performance/prompt.md +1 -1
- data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +2 -2
- data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +1 -1
- data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +1 -1
- data/examples/pre_post_processing/validate_changes/prompt.md +2 -2
- data/examples/user_input/README.md +90 -0
- data/examples/user_input/funny_name/create_backstory/prompt.md +10 -0
- data/examples/user_input/funny_name/workflow.yml +26 -0
- data/examples/user_input/generate_summary/prompt.md +11 -0
- data/examples/user_input/simple_input_demo/workflow.yml +35 -0
- data/examples/user_input/survey_workflow.yml +71 -0
- data/examples/user_input/welcome_message/prompt.md +3 -0
- data/examples/user_input/workflow.yml +73 -0
- data/examples/workflow_generator/create_workflow_files/prompt.md +1 -1
- data/lib/roast/errors.rb +6 -4
- data/lib/roast/helpers/function_caching_interceptor.rb +0 -2
- data/lib/roast/helpers/logger.rb +12 -35
- data/lib/roast/helpers/minitest_coverage_runner.rb +0 -1
- data/lib/roast/helpers/prompt_loader.rb +0 -2
- data/lib/roast/resources/api_resource.rb +0 -4
- data/lib/roast/resources/url_resource.rb +0 -3
- data/lib/roast/resources.rb +0 -8
- data/lib/roast/tools/ask_user.rb +0 -2
- data/lib/roast/tools/bash.rb +0 -3
- data/lib/roast/tools/cmd.rb +0 -3
- data/lib/roast/tools/coding_agent.rb +1 -8
- data/lib/roast/tools/grep.rb +0 -3
- data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -4
- data/lib/roast/tools/read_file.rb +0 -2
- data/lib/roast/tools/search_file.rb +0 -2
- data/lib/roast/tools/update_files.rb +0 -4
- data/lib/roast/tools/write_file.rb +0 -3
- data/lib/roast/tools.rb +0 -13
- data/lib/roast/value_objects/step_name.rb +14 -3
- data/lib/roast/value_objects/workflow_path.rb +0 -2
- data/lib/roast/value_objects.rb +4 -4
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/agent_step.rb +26 -0
- data/lib/roast/workflow/api_configuration.rb +0 -4
- data/lib/roast/workflow/base_iteration_step.rb +0 -4
- data/lib/roast/workflow/base_step.rb +54 -28
- data/lib/roast/workflow/base_workflow.rb +2 -21
- data/lib/roast/workflow/case_executor.rb +0 -1
- data/lib/roast/workflow/case_step.rb +0 -4
- data/lib/roast/workflow/command_executor.rb +0 -2
- data/lib/roast/workflow/conditional_executor.rb +0 -1
- data/lib/roast/workflow/conditional_step.rb +0 -4
- data/lib/roast/workflow/configuration.rb +3 -10
- data/lib/roast/workflow/configuration_loader.rb +0 -2
- data/lib/roast/workflow/configuration_parser.rb +1 -7
- data/lib/roast/workflow/dot_access_hash.rb +16 -1
- data/lib/roast/workflow/error_handler.rb +0 -3
- data/lib/roast/workflow/expression_evaluator.rb +0 -3
- data/lib/roast/workflow/file_state_repository.rb +0 -5
- data/lib/roast/workflow/input_executor.rb +41 -0
- data/lib/roast/workflow/input_step.rb +163 -0
- data/lib/roast/workflow/iteration_executor.rb +0 -2
- data/lib/roast/workflow/output_handler.rb +0 -2
- data/lib/roast/workflow/output_manager.rb +0 -2
- data/lib/roast/workflow/prompt_step.rb +1 -1
- data/lib/roast/workflow/replay_handler.rb +0 -3
- data/lib/roast/workflow/resource_resolver.rb +0 -3
- data/lib/roast/workflow/session_manager.rb +0 -3
- data/lib/roast/workflow/state_manager.rb +0 -2
- data/lib/roast/workflow/step_executor_coordinator.rb +34 -11
- data/lib/roast/workflow/step_executor_factory.rb +0 -5
- data/lib/roast/workflow/step_executor_registry.rb +1 -4
- data/lib/roast/workflow/step_executors/hash_step_executor.rb +0 -3
- data/lib/roast/workflow/step_executors/parallel_step_executor.rb +0 -3
- data/lib/roast/workflow/step_executors/string_step_executor.rb +0 -2
- data/lib/roast/workflow/step_factory.rb +56 -0
- data/lib/roast/workflow/step_loader.rb +30 -16
- data/lib/roast/workflow/step_orchestrator.rb +3 -2
- data/lib/roast/workflow/step_type_resolver.rb +28 -1
- data/lib/roast/workflow/validator.rb +0 -4
- data/lib/roast/workflow/workflow_executor.rb +0 -16
- data/lib/roast/workflow/workflow_initializer.rb +1 -8
- data/lib/roast/workflow/workflow_runner.rb +0 -7
- data/lib/roast/workflow.rb +0 -15
- data/lib/roast.rb +55 -10
- data/roast.gemspec +2 -1
- data/schema/workflow.json +46 -0
- metadata +44 -6
- data/lib/roast/helpers.rb +0 -12
@@ -0,0 +1,32 @@
|
|
1
|
+
model: anthropic:claude-opus-4
|
2
|
+
|
3
|
+
tools:
|
4
|
+
- Roast::Tools::Grep
|
5
|
+
- Roast::Tools::ReadFile
|
6
|
+
- Roast::Tools::WriteFile
|
7
|
+
- Roast::Tools::Cmd:
|
8
|
+
allowed_commands:
|
9
|
+
- pwd
|
10
|
+
- ls
|
11
|
+
- echo
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- explore_directory
|
15
|
+
- analyze_files
|
16
|
+
- write_summary
|
17
|
+
|
18
|
+
# Step-level tool configuration
|
19
|
+
explore_directory:
|
20
|
+
available_tools:
|
21
|
+
- pwd
|
22
|
+
- ls
|
23
|
+
|
24
|
+
analyze_files:
|
25
|
+
available_tools:
|
26
|
+
- grep
|
27
|
+
- read_file
|
28
|
+
|
29
|
+
write_summary:
|
30
|
+
available_tools:
|
31
|
+
- write_file
|
32
|
+
- echo
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Based on your exploration and analysis, create a summary:
|
2
|
+
|
3
|
+
1. Write a brief summary of what you found to a file called `summary.txt`
|
4
|
+
2. Echo a completion message
|
5
|
+
|
6
|
+
Note: You only have access to the `write_file` and `echo` tools for this step. You cannot read files or use other commands.
|
@@ -9,8 +9,8 @@ Based on the file extension and content, determine the primary programming langu
|
|
9
9
|
|
10
10
|
Return ONLY the language name in lowercase, nothing else.
|
11
11
|
|
12
|
-
File:
|
12
|
+
File: <%= context.resource_uri %>
|
13
13
|
Content:
|
14
14
|
```
|
15
|
-
|
15
|
+
<%= context.resource %>
|
16
16
|
```
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Test Grading Workflow
|
2
|
+
|
3
|
+
This workflow acts as a senior software engineer and testing expert to evaluate the quality of test files based on best practices and guidelines.
|
4
|
+
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
This example uses `shadowenv` for environment management, which is specific to Shopify's development environment. If you're not using shadowenv, you'll need to adapt the commands to your own setup.
|
8
|
+
|
9
|
+
### If you're using shadowenv:
|
10
|
+
```bash
|
11
|
+
brew install shadowenv
|
12
|
+
```
|
13
|
+
|
14
|
+
### If you're NOT using shadowenv:
|
15
|
+
You'll need to modify the `run_coverage.rb` file to remove the shadowenv commands. Look for lines like:
|
16
|
+
```ruby
|
17
|
+
command = "shadowenv exec -- bundle exec ruby ..."
|
18
|
+
```
|
19
|
+
|
20
|
+
And change them to match your environment:
|
21
|
+
```ruby
|
22
|
+
# For standard Ruby/Bundler setup:
|
23
|
+
command = "bundle exec ruby ..."
|
24
|
+
|
25
|
+
# Or if you're using rbenv/rvm:
|
26
|
+
command = "ruby ..."
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
```bash
|
32
|
+
# Run the grading workflow on a test file
|
33
|
+
roast execute examples/grading/workflow.yml path/to/your_test.rb
|
34
|
+
```
|
35
|
+
|
36
|
+
## How it Works
|
37
|
+
|
38
|
+
1. **read_dependencies**: Analyzes the test file and its dependencies
|
39
|
+
2. **run_coverage**: Executes the test with coverage tracking
|
40
|
+
3. **generate_grades**: Evaluates test quality across multiple dimensions
|
41
|
+
4. **verify_test_helpers**: Checks for proper test helper usage
|
42
|
+
5. **verify_mocks_and_stubs**: Ensures appropriate use of test doubles
|
43
|
+
6. **analyze_coverage**: Reviews code coverage metrics
|
44
|
+
7. **generate_recommendations**: Provides improvement suggestions
|
45
|
+
8. **calculate_final_grade**: Computes an overall grade (A-F scale)
|
46
|
+
9. **format_result**: Formats the final output
|
47
|
+
|
48
|
+
## Customization
|
49
|
+
|
50
|
+
Feel free to adapt this workflow to your testing environment:
|
51
|
+
|
52
|
+
- **Different test frameworks**: Modify `run_coverage.rb` to work with RSpec, Jest, pytest, etc.
|
53
|
+
- **Coverage tools**: Replace the coverage command with your preferred tool (SimpleCov, Istanbul, Coverage.py)
|
54
|
+
- **Grading criteria**: Adjust the prompts in each step to match your team's standards
|
55
|
+
- **Environment setup**: Remove or replace shadowenv with your environment management tool
|
56
|
+
|
57
|
+
## Example Output
|
58
|
+
|
59
|
+
```
|
60
|
+
========== TEST GRADE REPORT ==========
|
61
|
+
Test file: test/example_test.rb
|
62
|
+
|
63
|
+
FINAL GRADE:
|
64
|
+
Score: 85/100
|
65
|
+
Letter Grade: B
|
66
|
+
|
67
|
+
RECOMMENDATIONS:
|
68
|
+
- Add edge case testing for error conditions
|
69
|
+
- Improve test descriptions for clarity
|
70
|
+
- Consider extracting common setup to helper methods
|
71
|
+
```
|
@@ -1,4 +1,4 @@
|
|
1
|
-
I'll analyze the code complexity of the file
|
1
|
+
I'll analyze the code complexity of the file <%= current_file %>, which I've read in the previous step.
|
2
2
|
|
3
3
|
I'll examine the following aspects:
|
4
4
|
1. Cyclomatic complexity (number of decision paths)
|
@@ -9,7 +9,7 @@ I'll examine the following aspects:
|
|
9
9
|
6. Opportunities for refactoring
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
|
12
|
+
<%= output.read_file %>
|
13
13
|
```
|
14
14
|
|
15
15
|
Based on this analysis, I'll provide a structured assessment of the code quality issues found.
|
@@ -1,8 +1,8 @@
|
|
1
|
-
Based on the analysis of complexity for file
|
1
|
+
Based on the analysis of complexity for file <%= current_file %>, I'll generate specific recommendations for improving code quality.
|
2
2
|
|
3
3
|
I'll use the complexity analysis from the previous step:
|
4
4
|
```json
|
5
|
-
|
5
|
+
<%= output.analyze_complexity %>
|
6
6
|
```
|
7
7
|
|
8
8
|
For each identified issue, I'll provide detailed, actionable recommendations including:
|
@@ -2,13 +2,13 @@ I'll implement the fix for the issue selected in the previous step.
|
|
2
2
|
|
3
3
|
Here is the issue to fix:
|
4
4
|
```json
|
5
|
-
|
5
|
+
<%= output.select_next_issue %>
|
6
6
|
```
|
7
7
|
|
8
8
|
First, I'll read the current file content to understand the context:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
|
11
|
+
<%= read_file(output.select_next_issue.file_path) %>
|
12
12
|
```
|
13
13
|
|
14
14
|
Based on the issue description and the recommended changes, I'll implement a fix that:
|
@@ -8,7 +8,7 @@ I'll analyze all the recommendations I've generated across multiple files and pr
|
|
8
8
|
Let me review all the recommendations collected so far:
|
9
9
|
|
10
10
|
```json
|
11
|
-
|
11
|
+
<%= outputs_of.generate_recommendations %>
|
12
12
|
```
|
13
13
|
|
14
14
|
I'll create a comprehensive prioritized list of all issues across files, combining similar issues where appropriate. The prioritized list will include:
|
@@ -3,10 +3,10 @@
|
|
3
3
|
You are a code analyzer focusing on analyzing Ruby files to count the number of methods defined.
|
4
4
|
|
5
5
|
## Input
|
6
|
-
- File path:
|
6
|
+
- File path: <%= file_path %>
|
7
7
|
- File content:
|
8
8
|
```ruby
|
9
|
-
|
9
|
+
<%= read_file(file_path) %>
|
10
10
|
```
|
11
11
|
|
12
12
|
## Task
|
@@ -3,9 +3,9 @@
|
|
3
3
|
You are a data updater responsible for adding analysis results to a report.
|
4
4
|
|
5
5
|
## Input
|
6
|
-
- File path:
|
7
|
-
- Method count:
|
8
|
-
- Current report data:
|
6
|
+
- File path: <%= file_path %>
|
7
|
+
- Method count: <%= method_count %>
|
8
|
+
- Current report data: <%= current_report %>
|
9
9
|
|
10
10
|
## Task
|
11
11
|
1. Parse the current report data as JSON
|
@@ -3,8 +3,8 @@
|
|
3
3
|
You are responsible for creating a formatted report file based on the analysis results.
|
4
4
|
|
5
5
|
## Input
|
6
|
-
- Report data:
|
7
|
-
- Summary:
|
6
|
+
- Report data: <%= report_data %>
|
7
|
+
- Summary: <%= summary %>
|
8
8
|
|
9
9
|
## Task
|
10
10
|
1. Generate a Markdown report that includes:
|
@@ -16,7 +16,7 @@ You are responsible for creating a formatted report file based on the analysis r
|
|
16
16
|
Return a JSON object with the following structure:
|
17
17
|
```json
|
18
18
|
{
|
19
|
-
"report_content": "# Ruby Method Analysis Report\n\n
|
19
|
+
"report_content": "# Ruby Method Analysis Report\n\n<%= summary %>\n\n## Detailed Results\n\n| File | Method Count | Methods |\n|------|--------------|--------|\n| file1.rb | 5 | method1, method2, ... |\n| file2.rb | 3 | methodA, methodB, ... |\n...",
|
20
20
|
"report_file_path": "method_analysis_report.md"
|
21
21
|
}
|
22
22
|
```
|
@@ -1,9 +1,9 @@
|
|
1
|
-
I'll analyze the Ruby file at:
|
1
|
+
I'll analyze the Ruby file at: <%= current_file %>
|
2
2
|
|
3
3
|
First, let me read the content of this file.
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
|
6
|
+
<%= read_file(current_file) %>
|
7
7
|
```
|
8
8
|
|
9
9
|
I'll store this content for further analysis in the next steps.
|
@@ -2,12 +2,12 @@ I'll select the next highest priority issue to fix from our prioritized list.
|
|
2
2
|
|
3
3
|
Here is the current prioritized list of issues:
|
4
4
|
```json
|
5
|
-
|
5
|
+
<%= output.prioritize_issues %>
|
6
6
|
```
|
7
7
|
|
8
8
|
And here is the count of fixes we've already applied:
|
9
9
|
```
|
10
|
-
|
10
|
+
<%= output.update_fix_count || '0' %>
|
11
11
|
```
|
12
12
|
|
13
13
|
I'll select the highest priority issue that hasn't yet been addressed. I'll consider:
|
@@ -2,19 +2,19 @@ I'll update the count of fixes that have been successfully applied.
|
|
2
2
|
|
3
3
|
Current fix count:
|
4
4
|
```
|
5
|
-
|
5
|
+
<%= output.update_fix_count || 0 %>
|
6
6
|
```
|
7
7
|
|
8
8
|
Verification result from the previous step:
|
9
9
|
```json
|
10
|
-
|
10
|
+
<%= output.verify_fix %>
|
11
11
|
```
|
12
12
|
|
13
13
|
I'll increment the fix count if the verification was successful or partial, but not if it failed.
|
14
14
|
|
15
15
|
```javascript
|
16
|
-
let currentCount = parseInt(
|
17
|
-
let verificationStatus = "
|
16
|
+
let currentCount = parseInt(<%= output.update_fix_count || 0 %>);
|
17
|
+
let verificationStatus = "<%= output.verify_fix.status %>";
|
18
18
|
|
19
19
|
if (verificationStatus === "success" || verificationStatus === "partial") {
|
20
20
|
currentCount += 1;
|
@@ -2,17 +2,17 @@ I'll verify that the fix implemented in the previous step correctly addresses th
|
|
2
2
|
|
3
3
|
Here are the details of the issue that was fixed:
|
4
4
|
```json
|
5
|
-
|
5
|
+
<%= output.select_next_issue %>
|
6
6
|
```
|
7
7
|
|
8
8
|
And here is the implementation of the fix:
|
9
9
|
```json
|
10
|
-
|
10
|
+
<%= output.implement_fix %>
|
11
11
|
```
|
12
12
|
|
13
13
|
Now I'll read the updated file to verify the changes:
|
14
14
|
```ruby
|
15
|
-
|
15
|
+
<%= read_file(output.select_next_issue.file_path) %>
|
16
16
|
```
|
17
17
|
|
18
18
|
I'll evaluate the fix based on these criteria:
|
data/examples/mcp/README.md
CHANGED
@@ -44,7 +44,7 @@ tools:
|
|
44
44
|
- --rm
|
45
45
|
- ghcr.io/example/mcp-server
|
46
46
|
env:
|
47
|
-
API_KEY: "{{
|
47
|
+
API_KEY: "{{ENV['API_KEY']}}"
|
48
48
|
except:
|
49
49
|
- dangerous_function
|
50
50
|
```
|
@@ -116,7 +116,7 @@ tools:
|
|
116
116
|
command: npx
|
117
117
|
args: ["-y", "@modelcontextprotocol/server-github"]
|
118
118
|
env:
|
119
|
-
GITHUB_PERSONAL_ACCESS_TOKEN: "{{
|
119
|
+
GITHUB_PERSONAL_ACCESS_TOKEN: "{{ENV['GITHUB_TOKEN']}}"
|
120
120
|
only:
|
121
121
|
- search_repositories
|
122
122
|
- get_issue
|
@@ -131,7 +131,7 @@ tools:
|
|
131
131
|
command: npx
|
132
132
|
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
133
133
|
env:
|
134
|
-
DATABASE_URL: "{{
|
134
|
+
DATABASE_URL: "{{ENV['DATABASE_URL']}}"
|
135
135
|
only:
|
136
136
|
- query
|
137
137
|
- list_tables
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Using the GitHub tool, post the code review as a comment on PR
|
1
|
+
Using the GitHub tool, post the code review as a comment on PR #<%= ENV['PR_NUMBER'] %>.
|
2
2
|
Format the review in a friendly, constructive manner.
|
3
3
|
Include specific line-by-line suggestions where appropriate.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Improve Test Coverage
|
2
2
|
|
3
|
-
Based on the analysis of
|
3
|
+
Based on the analysis of <%= file %>, implement the following improvements:
|
4
4
|
|
5
5
|
1. **Add Missing Test Cases**: Write tests for uncovered code paths, edge cases, and error conditions
|
6
6
|
2. **Improve Test Descriptions**: Make test names more descriptive and follow consistent naming conventions
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Aggregate all the metrics collected during the workflow execution:
|
4
4
|
|
5
5
|
Available data:
|
6
|
-
- Pre-processing baseline metrics:
|
7
|
-
- Results from all processed test files:
|
6
|
+
- Pre-processing baseline metrics: <%= pre_processing.gather_baseline_metrics %>
|
7
|
+
- Results from all processed test files: <%= output.targets %>
|
8
8
|
|
9
9
|
Please calculate and provide:
|
10
10
|
|
@@ -9,7 +9,7 @@ Provide a high-level overview of the optimization results, key achievements, and
|
|
9
9
|
|
10
10
|
### Metrics Summary
|
11
11
|
Include the aggregated metrics from the previous step:
|
12
|
-
|
12
|
+
<%= aggregate_metrics %>
|
13
13
|
|
14
14
|
### Detailed Results by File
|
15
15
|
For each processed test file, include:
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Prepare the test environment for optimization. Please:
|
4
4
|
|
5
5
|
1. Ensure all test dependencies are installed
|
6
|
-
2. Create a backup branch for safety: `test-optimization-backup
|
6
|
+
2. Create a backup branch for safety: `test-optimization-backup-<%= timestamp %>`
|
7
7
|
3. Set up any necessary test databases or fixtures
|
8
8
|
4. Configure test parallelization settings if available
|
9
9
|
5. Clear any test caches that might affect benchmarking
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Validate Changes
|
2
2
|
|
3
|
-
Validate the changes made to
|
3
|
+
Validate the changes made to <%= file %>:
|
4
4
|
|
5
5
|
1. **Run the updated tests** and ensure they all pass
|
6
6
|
2. **Check coverage metrics** to verify improvements
|
@@ -11,7 +11,7 @@ Validate the changes made to {{file}}:
|
|
11
11
|
Store the validation results in the workflow state:
|
12
12
|
```json
|
13
13
|
{
|
14
|
-
"file": "
|
14
|
+
"file": "<%= file %>",
|
15
15
|
"tests_passed": true,
|
16
16
|
"coverage_before": 0.0,
|
17
17
|
"coverage_after": 0.0,
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# User Input Example
|
2
|
+
|
3
|
+
This example demonstrates how to use the `input` step type in Roast workflows to collect information from users during workflow execution.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
The `input` step type allows workflows to:
|
8
|
+
- Collect text input from users
|
9
|
+
- Ask yes/no questions (boolean)
|
10
|
+
- Present multiple choice options
|
11
|
+
- Securely collect passwords (hidden input)
|
12
|
+
- Store collected values in workflow state for later use
|
13
|
+
|
14
|
+
## Running the Example
|
15
|
+
|
16
|
+
```bash
|
17
|
+
# Run the interactive deployment workflow
|
18
|
+
roast execute examples/user_input/workflow.yml
|
19
|
+
|
20
|
+
# Run a simple survey workflow
|
21
|
+
roast execute examples/user_input/survey_workflow.yml
|
22
|
+
```
|
23
|
+
|
24
|
+
## Input Step Configuration
|
25
|
+
|
26
|
+
### Basic Text Input
|
27
|
+
```yaml
|
28
|
+
- input:
|
29
|
+
prompt: "Enter your name:"
|
30
|
+
name: user_name
|
31
|
+
```
|
32
|
+
|
33
|
+
### Boolean (Yes/No) Input
|
34
|
+
```yaml
|
35
|
+
- input:
|
36
|
+
prompt: "Do you want to continue?"
|
37
|
+
type: boolean
|
38
|
+
default: true
|
39
|
+
name: should_continue
|
40
|
+
```
|
41
|
+
|
42
|
+
### Choice Selection
|
43
|
+
```yaml
|
44
|
+
- input:
|
45
|
+
prompt: "Select environment:"
|
46
|
+
type: choice
|
47
|
+
options:
|
48
|
+
- development
|
49
|
+
- staging
|
50
|
+
- production
|
51
|
+
name: environment
|
52
|
+
```
|
53
|
+
|
54
|
+
### Password Input
|
55
|
+
```yaml
|
56
|
+
- input:
|
57
|
+
prompt: "Enter password:"
|
58
|
+
type: password
|
59
|
+
required: true
|
60
|
+
name: user_password
|
61
|
+
```
|
62
|
+
|
63
|
+
## Configuration Options
|
64
|
+
|
65
|
+
- `prompt` (required): The question or message to display to the user
|
66
|
+
- `name` (optional): Variable name to store the input value in workflow state
|
67
|
+
- `type` (optional): Type of input - `text` (default), `boolean`, `choice`, or `password`
|
68
|
+
- `required` (optional): Whether the input is required (default: false)
|
69
|
+
- `default` (optional): Default value if user presses enter without input
|
70
|
+
- `timeout` (optional): Timeout in seconds for user input
|
71
|
+
- `options` (required for choice type): Array of options for choice selection
|
72
|
+
|
73
|
+
## Accessing Input Values
|
74
|
+
|
75
|
+
Input values stored with a `name` can be accessed in subsequent steps using interpolation:
|
76
|
+
|
77
|
+
```yaml
|
78
|
+
- input:
|
79
|
+
prompt: "Enter project name:"
|
80
|
+
name: project_name
|
81
|
+
|
82
|
+
- prompt: "Creating project: #{state.project_name}"
|
83
|
+
```
|
84
|
+
|
85
|
+
## Non-TTY Environments
|
86
|
+
|
87
|
+
When running in non-TTY environments (e.g., CI/CD pipelines), input steps will:
|
88
|
+
- Use default values if provided
|
89
|
+
- Fail if required inputs have no default
|
90
|
+
- Skip optional inputs without defaults
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Create a hilarious and absurd backstory for someone named <%= workflow.output.user_name %> as a <%= workflow.output.genre %>.
|
2
|
+
|
3
|
+
Make it funny, creative, and include:
|
4
|
+
- A ridiculous origin story
|
5
|
+
- An absurd special ability or talent related to their name
|
6
|
+
- A nemesis with an equally silly name
|
7
|
+
- Their greatest achievement (make it hilariously mundane yet epic)
|
8
|
+
- A catchphrase that makes no sense
|
9
|
+
|
10
|
+
Keep it fun and family-friendly! Format it as an entertaining narrative.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: funny_name_backstory
|
2
|
+
description: Create a humorous backstory based on your name
|
3
|
+
model: anthropic:claude-3-5-sonnet
|
4
|
+
|
5
|
+
steps:
|
6
|
+
# Collect user's name
|
7
|
+
- input:
|
8
|
+
prompt: "What's your name?"
|
9
|
+
name: user_name
|
10
|
+
required: true
|
11
|
+
|
12
|
+
# Ask for preferences
|
13
|
+
- input:
|
14
|
+
prompt: "Pick a genre for your backstory:"
|
15
|
+
type: choice
|
16
|
+
options:
|
17
|
+
- "Epic Fantasy Adventure"
|
18
|
+
- "Cyberpunk Hacker"
|
19
|
+
- "Time-Traveling Detective"
|
20
|
+
- "Intergalactic Pizza Delivery"
|
21
|
+
- "Victorian-Era Vampire Hunter"
|
22
|
+
- "Professional Cat Whisperer"
|
23
|
+
name: genre
|
24
|
+
|
25
|
+
# Generate the backstory
|
26
|
+
- create_backstory
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Please generate a nicely formatted survey summary based on the following information:
|
2
|
+
|
3
|
+
Survey Participant: <%= workflow.output.developer_name %>
|
4
|
+
Usage Duration: <%= workflow.output.usage_duration %>
|
5
|
+
Experience Rating: <%= workflow.output.experience_rating %>
|
6
|
+
Primary Feature Used: <%= workflow.output.primary_feature %>
|
7
|
+
Additional Feedback Provided: <%= workflow.output.user_feedback %>
|
8
|
+
Contact Permission: <%= workflow.output.allow_contact %>
|
9
|
+
Email (if provided): <%= workflow.output.user_email %>
|
10
|
+
|
11
|
+
Format this as a professional survey summary report with proper headings and thank the participant for their time.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: simple_input_demo
|
2
|
+
description: Simple demonstration of input step functionality
|
3
|
+
model: gpt-4o
|
4
|
+
|
5
|
+
steps:
|
6
|
+
# Text input
|
7
|
+
- input:
|
8
|
+
prompt: "What's your name?"
|
9
|
+
name: user_name
|
10
|
+
required: true
|
11
|
+
|
12
|
+
- input:
|
13
|
+
prompt: "Are you enjoying Roast?"
|
14
|
+
type: boolean
|
15
|
+
default: true
|
16
|
+
name: enjoying_roast
|
17
|
+
|
18
|
+
- input:
|
19
|
+
prompt: "What's your favorite programming language?"
|
20
|
+
type: choice
|
21
|
+
options:
|
22
|
+
- Ruby
|
23
|
+
- Python
|
24
|
+
- JavaScript
|
25
|
+
- Go
|
26
|
+
- Other
|
27
|
+
name: favorite_language
|
28
|
+
|
29
|
+
- input:
|
30
|
+
prompt: "Create a secret password (won't be displayed):"
|
31
|
+
type: password
|
32
|
+
required: true
|
33
|
+
name: secret_password
|
34
|
+
|
35
|
+
- "Summarize the following inputs: {{workflow.output}}"
|