roast-ai 0.4.7 → 0.4.8
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/Gemfile.lock +1 -1
- data/Rakefile +2 -0
- data/examples/README.md +9 -0
- data/examples/available_tools_demo/workflow.yml +1 -1
- data/examples/basic_prompt_workflow/workflow.md +1 -0
- data/examples/basic_prompt_workflow/workflow.yml +14 -0
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_step.rb +2 -3
- data/lib/roast/workflow/step_loader.rb +2 -7
- data/lib/roast.rb +6 -1
- metadata +4 -239
- data/CHANGELOG.md +0 -369
- data/examples/agent_continue/add_documentation/prompt.md +0 -5
- data/examples/agent_continue/add_error_handling/prompt.md +0 -5
- data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
- data/examples/agent_continue/combined_workflow.yml +0 -24
- data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
- data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
- data/examples/agent_continue/document_with_context/prompt.md +0 -5
- data/examples/agent_continue/explore_api/prompt.md +0 -6
- data/examples/agent_continue/implement_client/prompt.md +0 -6
- data/examples/agent_continue/inline_workflow.yml +0 -20
- data/examples/agent_continue/refactor_code/prompt.md +0 -2
- data/examples/agent_continue/verify_changes/prompt.md +0 -6
- data/examples/agent_continue/workflow.yml +0 -27
- data/examples/agent_workflow/README.md +0 -75
- data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
- data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
- data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
- data/examples/agent_workflow/workflow.png +0 -0
- data/examples/agent_workflow/workflow.yml +0 -16
- data/examples/api_workflow/README.md +0 -85
- data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
- data/examples/api_workflow/generate_report/prompt.md +0 -10
- data/examples/api_workflow/prompt.md +0 -10
- data/examples/api_workflow/transform_data/prompt.md +0 -10
- data/examples/api_workflow/workflow.png +0 -0
- data/examples/api_workflow/workflow.yml +0 -30
- data/examples/apply_diff_demo/README.md +0 -58
- data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
- data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
- data/examples/apply_diff_demo/workflow.yml +0 -24
- data/examples/available_tools_demo/workflow.png +0 -0
- data/examples/bash_prototyping/README.md +0 -53
- data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
- data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
- data/examples/bash_prototyping/api_testing.png +0 -0
- data/examples/bash_prototyping/api_testing.yml +0 -14
- data/examples/bash_prototyping/check_processes/prompt.md +0 -11
- data/examples/bash_prototyping/generate_report/prompt.md +0 -16
- data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
- data/examples/bash_prototyping/system_analysis.png +0 -0
- data/examples/bash_prototyping/system_analysis.yml +0 -14
- data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
- data/examples/case_when/README.md +0 -58
- data/examples/case_when/detect_language/prompt.md +0 -16
- data/examples/case_when/workflow.png +0 -0
- data/examples/case_when/workflow.yml +0 -58
- data/examples/cmd/README.md +0 -99
- data/examples/cmd/analyze_project/prompt.md +0 -57
- data/examples/cmd/basic_demo/prompt.md +0 -48
- data/examples/cmd/basic_workflow.png +0 -0
- data/examples/cmd/basic_workflow.yml +0 -16
- data/examples/cmd/check_repository/prompt.md +0 -57
- data/examples/cmd/create_and_verify/prompt.md +0 -56
- data/examples/cmd/dev_workflow.png +0 -0
- data/examples/cmd/dev_workflow.yml +0 -26
- data/examples/cmd/explore_project/prompt.md +0 -67
- data/examples/cmd/explorer_workflow.png +0 -0
- data/examples/cmd/explorer_workflow.yml +0 -21
- data/examples/cmd/smart_tool_selection/prompt.md +0 -99
- data/examples/coding_agent_with_model.yml +0 -20
- data/examples/coding_agent_with_retries.yml +0 -30
- data/examples/conditional/README.md +0 -161
- data/examples/conditional/check_condition/prompt.md +0 -1
- data/examples/conditional/simple_workflow.png +0 -0
- data/examples/conditional/simple_workflow.yml +0 -15
- data/examples/conditional/workflow.png +0 -0
- data/examples/conditional/workflow.yml +0 -23
- data/examples/context_management_demo/README.md +0 -43
- data/examples/context_management_demo/workflow.yml +0 -42
- data/examples/direct_coerce_syntax/README.md +0 -32
- data/examples/direct_coerce_syntax/workflow.png +0 -0
- data/examples/direct_coerce_syntax/workflow.yml +0 -36
- data/examples/dot_notation/README.md +0 -37
- data/examples/dot_notation/workflow.png +0 -0
- data/examples/dot_notation/workflow.yml +0 -44
- data/examples/exit_on_error/README.md +0 -50
- data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
- data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
- data/examples/exit_on_error/workflow.png +0 -0
- data/examples/exit_on_error/workflow.yml +0 -19
- data/examples/grading/README.md +0 -71
- data/examples/grading/analyze_coverage/prompt.md +0 -52
- data/examples/grading/calculate_final_grade.rb +0 -67
- data/examples/grading/format_result.rb +0 -64
- data/examples/grading/generate_grades/prompt.md +0 -105
- data/examples/grading/generate_recommendations/output.txt +0 -17
- data/examples/grading/generate_recommendations/prompt.md +0 -60
- data/examples/grading/js_test_runner +0 -31
- data/examples/grading/rb_test_runner +0 -19
- data/examples/grading/read_dependencies/prompt.md +0 -16
- data/examples/grading/run_coverage.rb +0 -54
- data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
- data/examples/grading/verify_test_helpers/prompt.md +0 -53
- data/examples/grading/workflow.md +0 -8
- data/examples/grading/workflow.png +0 -0
- data/examples/grading/workflow.rb.md +0 -6
- data/examples/grading/workflow.ts+tsx.md +0 -6
- data/examples/grading/workflow.yml +0 -41
- data/examples/instrumentation.rb +0 -76
- data/examples/interpolation/README.md +0 -50
- data/examples/interpolation/analyze_file/prompt.md +0 -1
- data/examples/interpolation/analyze_patterns/prompt.md +0 -27
- data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
- data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
- data/examples/interpolation/sample.js +0 -48
- data/examples/interpolation/sample.rb +0 -42
- data/examples/interpolation/workflow.md +0 -1
- data/examples/interpolation/workflow.png +0 -0
- data/examples/interpolation/workflow.yml +0 -21
- data/examples/iteration/IMPLEMENTATION.md +0 -88
- data/examples/iteration/README.md +0 -68
- data/examples/iteration/analyze_complexity/prompt.md +0 -22
- data/examples/iteration/generate_recommendations/prompt.md +0 -21
- data/examples/iteration/generate_report/prompt.md +0 -129
- data/examples/iteration/implement_fix/prompt.md +0 -25
- data/examples/iteration/prioritize_issues/prompt.md +0 -24
- data/examples/iteration/prompts/analyze_file.md +0 -28
- data/examples/iteration/prompts/generate_summary.md +0 -24
- data/examples/iteration/prompts/update_report.md +0 -29
- data/examples/iteration/prompts/write_report.md +0 -22
- data/examples/iteration/read_file/prompt.md +0 -9
- data/examples/iteration/select_next_issue/prompt.md +0 -25
- data/examples/iteration/simple_workflow.md +0 -39
- data/examples/iteration/simple_workflow.yml +0 -58
- data/examples/iteration/update_fix_count/prompt.md +0 -26
- data/examples/iteration/verify_fix/prompt.md +0 -29
- data/examples/iteration/workflow.png +0 -0
- data/examples/iteration/workflow.yml +0 -42
- data/examples/json_handling/README.md +0 -32
- data/examples/json_handling/workflow.png +0 -0
- data/examples/json_handling/workflow.yml +0 -52
- data/examples/mcp/README.md +0 -223
- data/examples/mcp/analyze_changes/prompt.md +0 -8
- data/examples/mcp/analyze_issues/prompt.md +0 -4
- data/examples/mcp/analyze_schema/prompt.md +0 -4
- data/examples/mcp/check_data_quality/prompt.md +0 -5
- data/examples/mcp/check_documentation/prompt.md +0 -4
- data/examples/mcp/create_recommendations/prompt.md +0 -5
- data/examples/mcp/database_workflow.png +0 -0
- data/examples/mcp/database_workflow.yml +0 -29
- data/examples/mcp/env_demo/workflow.png +0 -0
- data/examples/mcp/env_demo/workflow.yml +0 -34
- data/examples/mcp/fetch_pr_context/prompt.md +0 -4
- data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
- data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
- data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
- data/examples/mcp/filesystem_demo/workflow.png +0 -0
- data/examples/mcp/filesystem_demo/workflow.yml +0 -38
- data/examples/mcp/generate_insights/prompt.md +0 -4
- data/examples/mcp/generate_report/prompt.md +0 -6
- data/examples/mcp/generate_review/prompt.md +0 -16
- data/examples/mcp/github_workflow.png +0 -0
- data/examples/mcp/github_workflow.yml +0 -32
- data/examples/mcp/multi_mcp_workflow.png +0 -0
- data/examples/mcp/multi_mcp_workflow.yml +0 -58
- data/examples/mcp/post_review/prompt.md +0 -3
- data/examples/mcp/save_report/prompt.md +0 -6
- data/examples/mcp/search_issues/prompt.md +0 -2
- data/examples/mcp/summarize/prompt.md +0 -1
- data/examples/mcp/test_filesystem/prompt.md +0 -6
- data/examples/mcp/test_github/prompt.md +0 -8
- data/examples/mcp/test_read/prompt.md +0 -1
- data/examples/mcp/workflow.png +0 -0
- data/examples/mcp/workflow.yml +0 -35
- data/examples/no_model_fallback/README.md +0 -17
- data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
- data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
- data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
- data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
- data/examples/no_model_fallback/sample.rb +0 -42
- data/examples/no_model_fallback/workflow.yml +0 -19
- data/examples/openrouter_example/README.md +0 -48
- data/examples/openrouter_example/analyze_input/prompt.md +0 -16
- data/examples/openrouter_example/generate_response/prompt.md +0 -9
- data/examples/openrouter_example/workflow.png +0 -0
- data/examples/openrouter_example/workflow.yml +0 -12
- data/examples/pre_post_processing/README.md +0 -111
- data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
- data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
- data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
- data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
- data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
- data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
- data/examples/pre_post_processing/post_processing/output.txt +0 -24
- data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
- data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
- data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
- data/examples/pre_post_processing/workflow.png +0 -0
- data/examples/pre_post_processing/workflow.yml +0 -21
- data/examples/retry/workflow.yml +0 -23
- data/examples/rspec_to_minitest/README.md +0 -68
- data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
- data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
- data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
- data/examples/rspec_to_minitest/workflow.md +0 -10
- data/examples/rspec_to_minitest/workflow.png +0 -0
- data/examples/rspec_to_minitest/workflow.yml +0 -40
- data/examples/shared_config/README.md +0 -52
- data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
- data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
- data/examples/shared_config/shared.png +0 -0
- data/examples/shared_config/shared.yml +0 -7
- data/examples/single_target_prepost/README.md +0 -36
- data/examples/single_target_prepost/post_processing/output.txt +0 -27
- data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
- data/examples/single_target_prepost/workflow.png +0 -0
- data/examples/single_target_prepost/workflow.yml +0 -20
- data/examples/smart_coercion_defaults/README.md +0 -65
- data/examples/smart_coercion_defaults/workflow.png +0 -0
- data/examples/smart_coercion_defaults/workflow.yml +0 -44
- data/examples/step_configuration/README.md +0 -84
- data/examples/step_configuration/workflow.png +0 -0
- data/examples/step_configuration/workflow.yml +0 -57
- data/examples/swarm_example.yml +0 -25
- data/examples/tool_config_example/README.md +0 -109
- data/examples/tool_config_example/example_step/prompt.md +0 -42
- data/examples/tool_config_example/workflow.png +0 -0
- data/examples/tool_config_example/workflow.yml +0 -17
- data/examples/user_input/README.md +0 -90
- data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
- data/examples/user_input/funny_name/workflow.png +0 -0
- data/examples/user_input/funny_name/workflow.yml +0 -25
- data/examples/user_input/generate_summary/prompt.md +0 -11
- data/examples/user_input/simple_input_demo/workflow.png +0 -0
- data/examples/user_input/simple_input_demo/workflow.yml +0 -35
- data/examples/user_input/survey_workflow.png +0 -0
- data/examples/user_input/survey_workflow.yml +0 -71
- data/examples/user_input/welcome_message/prompt.md +0 -3
- data/examples/user_input/workflow.png +0 -0
- data/examples/user_input/workflow.yml +0 -73
- data/examples/workflow_generator/README.md +0 -27
- data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
- data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
- data/examples/workflow_generator/get_user_input/prompt.md +0 -14
- data/examples/workflow_generator/info_from_roast.rb +0 -22
- data/examples/workflow_generator/workflow.png +0 -0
- data/examples/workflow_generator/workflow.yml +0 -34
@@ -1,22 +0,0 @@
|
|
1
|
-
# Write Method Analysis Report
|
2
|
-
|
3
|
-
You are responsible for creating a formatted report file based on the analysis results.
|
4
|
-
|
5
|
-
## Input
|
6
|
-
- Report data: <%= report_data %>
|
7
|
-
- Summary: <%= summary %>
|
8
|
-
|
9
|
-
## Task
|
10
|
-
1. Generate a Markdown report that includes:
|
11
|
-
- The summary information
|
12
|
-
- A detailed table of all files analyzed, with their method counts and method names
|
13
|
-
2. Format the report in a clean, readable manner
|
14
|
-
|
15
|
-
## Response Format
|
16
|
-
Return a JSON object with the following structure:
|
17
|
-
```json
|
18
|
-
{
|
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
|
-
"report_file_path": "method_analysis_report.md"
|
21
|
-
}
|
22
|
-
```
|
@@ -1,25 +0,0 @@
|
|
1
|
-
I'll select the next highest priority issue to fix from our prioritized list.
|
2
|
-
|
3
|
-
Here is the current prioritized list of issues:
|
4
|
-
```json
|
5
|
-
<%= output.prioritize_issues %>
|
6
|
-
```
|
7
|
-
|
8
|
-
And here is the count of fixes we've already applied:
|
9
|
-
```
|
10
|
-
<%= output.update_fix_count || '0' %>
|
11
|
-
```
|
12
|
-
|
13
|
-
I'll select the highest priority issue that hasn't yet been addressed. I'll consider:
|
14
|
-
|
15
|
-
1. The priority score from our previous analysis
|
16
|
-
2. Dependencies between issues (ensuring prerequisites are addressed first)
|
17
|
-
3. Logical grouping (addressing related issues in the same file together)
|
18
|
-
|
19
|
-
If there are no issues left to fix, I'll indicate this with `{"no_issues_left": true}`.
|
20
|
-
|
21
|
-
For the selected issue, I'll return:
|
22
|
-
1. The issue details
|
23
|
-
2. The file path to modify
|
24
|
-
3. A clear description of the changes needed
|
25
|
-
4. Any context needed for implementation
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# Simple Iteration Workflow Example
|
2
|
-
|
3
|
-
This example demonstrates how to use both the `each` and `repeat` iteration constructs in Roast workflows.
|
4
|
-
|
5
|
-
## Workflow Description
|
6
|
-
|
7
|
-
The workflow analyzes Ruby files in the `lib/roast/workflow` directory and counts the number of methods defined in each file. The process follows these steps:
|
8
|
-
|
9
|
-
1. Find all Ruby files in the specified directory
|
10
|
-
2. Initialize a report object to store our results
|
11
|
-
3. Process each file found:
|
12
|
-
- Read the file content
|
13
|
-
- Count the methods defined
|
14
|
-
- Update the report with the analysis result
|
15
|
-
4. Generate a summary report
|
16
|
-
5. Write the report to a file
|
17
|
-
|
18
|
-
## Key Components
|
19
|
-
|
20
|
-
- `each` construct: Processes every Ruby file found in the directory
|
21
|
-
- `repeat` construct: Used to generate the final summary (demonstrates a simple case of the repeat construct)
|
22
|
-
- Both block-level and prompt-based steps
|
23
|
-
|
24
|
-
## Running the Workflow
|
25
|
-
|
26
|
-
To run this workflow, use the following command:
|
27
|
-
|
28
|
-
```bash
|
29
|
-
shadowenv exec -- bundle exec roast examples/iteration/simple_workflow.yml
|
30
|
-
```
|
31
|
-
|
32
|
-
The final report will be saved to a markdown file as specified in the output of the `write_report` step.
|
33
|
-
|
34
|
-
## Learning Objectives
|
35
|
-
|
36
|
-
- Understand how to use the `each` construct to iterate over a collection
|
37
|
-
- Understand how to use the `repeat` construct for conditional repetition
|
38
|
-
- Learn how to build and update data structures across workflow steps
|
39
|
-
- See how to pass data between steps in an iteration workflow
|
@@ -1,58 +0,0 @@
|
|
1
|
-
name: Ruby Method Counter
|
2
|
-
tools:
|
3
|
-
- Roast::Tools::ReadFile
|
4
|
-
- Roast::Tools::Grep
|
5
|
-
- Roast::Tools::WriteFile
|
6
|
-
- Roast::Tools::CodingAgent
|
7
|
-
|
8
|
-
steps:
|
9
|
-
# Find all Ruby files in the specified directory
|
10
|
-
- find_ruby_files:
|
11
|
-
$(find lib/roast/workflow -type f -name "*.rb")
|
12
|
-
|
13
|
-
# Initialize a report object to store our results
|
14
|
-
- initialize_report:
|
15
|
-
$(echo '{"files_analyzed": 0, "total_methods": 0, "results": []}')
|
16
|
-
|
17
|
-
# Process each file found
|
18
|
-
- each: "{{output['find_ruby_files'].split('\n')}}"
|
19
|
-
as: "current_file"
|
20
|
-
steps:
|
21
|
-
# Read the file content
|
22
|
-
- read_file:
|
23
|
-
prompt: examples/iteration/prompts/analyze_file
|
24
|
-
model: claude-3-haiku-20240307
|
25
|
-
vars:
|
26
|
-
file_path: "{{ current_file }}"
|
27
|
-
|
28
|
-
# Update the report with the analysis result
|
29
|
-
- update_report:
|
30
|
-
prompt: examples/iteration/prompts/update_report
|
31
|
-
model: claude-3-haiku-20240307
|
32
|
-
vars:
|
33
|
-
file_path: "{{ current_file }}"
|
34
|
-
method_count: "{{ output['read_file']['method_count'] }}"
|
35
|
-
current_report: "{{ output['initialize_report'] }}"
|
36
|
-
|
37
|
-
# Generate the summary report after processing all files
|
38
|
-
- report_count:
|
39
|
-
$(echo "{{ output.initialize_report.files_analyzed }}")
|
40
|
-
|
41
|
-
# Repeat to generate the final summary - demonstrates the repeat construct
|
42
|
-
- repeat:
|
43
|
-
steps:
|
44
|
-
- generate_summary:
|
45
|
-
prompt: examples/iteration/prompts/generate_summary
|
46
|
-
model: claude-3-haiku-20240307
|
47
|
-
vars:
|
48
|
-
report_data: "{{ output['initialize_report'] }}"
|
49
|
-
until: "{{true}}"
|
50
|
-
max_iterations: 1
|
51
|
-
|
52
|
-
# Write the report to a file
|
53
|
-
- write_report:
|
54
|
-
prompt: examples/iteration/prompts/write_report
|
55
|
-
model: claude-3-haiku-20240307
|
56
|
-
vars:
|
57
|
-
report_data: "{{ output['initialize_report'] }}"
|
58
|
-
summary: "{{ output['generate_summary']['summary'] }}"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
I'll update the count of fixes that have been successfully applied.
|
2
|
-
|
3
|
-
Current fix count:
|
4
|
-
```
|
5
|
-
<%= output.update_fix_count || 0 %>
|
6
|
-
```
|
7
|
-
|
8
|
-
Verification result from the previous step:
|
9
|
-
```json
|
10
|
-
<%= output.verify_fix %>
|
11
|
-
```
|
12
|
-
|
13
|
-
I'll increment the fix count if the verification was successful or partial, but not if it failed.
|
14
|
-
|
15
|
-
```javascript
|
16
|
-
let currentCount = parseInt(<%= output.update_fix_count || 0 %>);
|
17
|
-
let verificationStatus = "<%= output.verify_fix.status %>";
|
18
|
-
|
19
|
-
if (verificationStatus === "success" || verificationStatus === "partial") {
|
20
|
-
currentCount += 1;
|
21
|
-
}
|
22
|
-
|
23
|
-
return { fixes_applied: currentCount };
|
24
|
-
```
|
25
|
-
|
26
|
-
This updated count will be used to determine whether we've met our target for the number of fixes to implement.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
I'll verify that the fix implemented in the previous step correctly addresses the identified issue.
|
2
|
-
|
3
|
-
Here are the details of the issue that was fixed:
|
4
|
-
```json
|
5
|
-
<%= output.select_next_issue %>
|
6
|
-
```
|
7
|
-
|
8
|
-
And here is the implementation of the fix:
|
9
|
-
```json
|
10
|
-
<%= output.implement_fix %>
|
11
|
-
```
|
12
|
-
|
13
|
-
Now I'll read the updated file to verify the changes:
|
14
|
-
```ruby
|
15
|
-
<%= read_file(output.select_next_issue.file_path) %>
|
16
|
-
```
|
17
|
-
|
18
|
-
I'll evaluate the fix based on these criteria:
|
19
|
-
1. Does it fully address the identified issue?
|
20
|
-
2. Did it introduce any new issues or regressions?
|
21
|
-
3. Does it maintain the original functionality?
|
22
|
-
4. Does it follow Ruby best practices and style conventions?
|
23
|
-
5. Is it minimal and focused (changing only what was necessary)?
|
24
|
-
|
25
|
-
Based on this evaluation, I'll provide:
|
26
|
-
1. A verification status (success, partial, failure)
|
27
|
-
2. Detailed reasoning for the status
|
28
|
-
3. Any recommendations for further improvements or adjustments
|
29
|
-
4. An overall assessment of the code quality improvement
|
Binary file
|
@@ -1,42 +0,0 @@
|
|
1
|
-
name: Code Quality Analyzer
|
2
|
-
tools:
|
3
|
-
- Roast::Tools::ReadFile
|
4
|
-
- Roast::Tools::Grep
|
5
|
-
- Roast::Tools::WriteFile
|
6
|
-
- Roast::Tools::UpdateFiles
|
7
|
-
- Roast::Tools::CodingAgent
|
8
|
-
- Roast::Tools::Cmd
|
9
|
-
|
10
|
-
steps:
|
11
|
-
# Get all Ruby files from the target directory
|
12
|
-
- get_files_to_analyze:
|
13
|
-
$(find {{resource.target}} -name "*.rb" -not -path "*/vendor/*" | grep -v "test")
|
14
|
-
|
15
|
-
# Analyze each file and generate improvement recommendations
|
16
|
-
- each: "{{output['get_files_to_analyze'].split('\n')}}"
|
17
|
-
as: "current_file"
|
18
|
-
steps:
|
19
|
-
- read_file:
|
20
|
-
$(cat {{current_file}})
|
21
|
-
- analyze_complexity
|
22
|
-
- generate_recommendations
|
23
|
-
|
24
|
-
# After analyzing all files, sort issues by priority
|
25
|
-
- prioritize_issues
|
26
|
-
|
27
|
-
# Process the highest priority issues first, until we've addressed a sufficient number
|
28
|
-
# or reached our iteration limit
|
29
|
-
- initialize_fixes:
|
30
|
-
$(echo "0")
|
31
|
-
|
32
|
-
- repeat:
|
33
|
-
steps:
|
34
|
-
- select_next_issue
|
35
|
-
- implement_fix
|
36
|
-
- verify_fix
|
37
|
-
- update_fix_count
|
38
|
-
until: "{{output['update_fix_count']['fixes_applied'] >= 5 || output['select_next_issue']['no_issues_left'] == true}}"
|
39
|
-
max_iterations: 10
|
40
|
-
|
41
|
-
# Generate a summary report of all changes made
|
42
|
-
- generate_report
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# JSON Handling Example
|
2
|
-
|
3
|
-
This example demonstrates how Roast handles JSON responses from LLM steps.
|
4
|
-
|
5
|
-
## Key Features
|
6
|
-
|
7
|
-
1. **JSON Arrays**: When a step has `json: true` and returns an array, the result is `flatten.first` - the first element after flattening the array. This is useful when the LLM returns an array with a single object.
|
8
|
-
|
9
|
-
2. **JSON Objects**: Hash/object responses are maintained as proper Ruby hashes in the workflow output.
|
10
|
-
|
11
|
-
3. **Replay Support**: JSON data structures are properly serialized and deserialized when saving/loading workflow state for replay functionality.
|
12
|
-
|
13
|
-
## Running the Example
|
14
|
-
|
15
|
-
```bash
|
16
|
-
bin/roast examples/json_handling/workflow.yml
|
17
|
-
```
|
18
|
-
|
19
|
-
## How It Works
|
20
|
-
|
21
|
-
1. The `fetch_users` step generates a JSON array of user objects
|
22
|
-
2. The `fetch_metadata` step generates a JSON object with metadata
|
23
|
-
3. The `process_data` step can access the structured data using `{{output.fetch_users}}` and `{{output.fetch_metadata}}`
|
24
|
-
4. The structured data is preserved through the workflow, including during replay scenarios
|
25
|
-
|
26
|
-
## Implementation Details
|
27
|
-
|
28
|
-
When `json: true` is set on a step:
|
29
|
-
- Array responses return `flatten.first` - the first element after flattening
|
30
|
-
- Object responses are preserved as hashes
|
31
|
-
- Non-JSON array responses (when `json: false`) are joined with newlines
|
32
|
-
- The data maintains its structure when saved to and loaded from workflow state files
|
Binary file
|
@@ -1,52 +0,0 @@
|
|
1
|
-
name: JSON Data Handling Example
|
2
|
-
api_provider: openai
|
3
|
-
model: gpt-4
|
4
|
-
|
5
|
-
tools:
|
6
|
-
- type: write_file
|
7
|
-
allowed_paths:
|
8
|
-
- examples/json_handling/
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- name: fetch_users
|
12
|
-
prompt: |
|
13
|
-
Generate a JSON array of 3 user objects. Each user should have:
|
14
|
-
- id (number)
|
15
|
-
- name (string)
|
16
|
-
- email (string)
|
17
|
-
- active (boolean)
|
18
|
-
json: true
|
19
|
-
|
20
|
-
- name: fetch_metadata
|
21
|
-
prompt: |
|
22
|
-
Generate a JSON object with metadata about a dataset:
|
23
|
-
- total_records (number)
|
24
|
-
- last_updated (ISO date string)
|
25
|
-
- categories (array of strings)
|
26
|
-
- filters (object with status and sort fields)
|
27
|
-
json: true
|
28
|
-
|
29
|
-
- name: process_data
|
30
|
-
prompt: |
|
31
|
-
Based on the users data: {{output.fetch_users}}
|
32
|
-
And metadata: {{output.fetch_metadata}}
|
33
|
-
|
34
|
-
Create a summary report describing:
|
35
|
-
1. How many active users there are
|
36
|
-
2. The categories available
|
37
|
-
3. When the data was last updated
|
38
|
-
|
39
|
-
- name: save_report
|
40
|
-
tool: write_file
|
41
|
-
path: examples/json_handling/report.txt
|
42
|
-
content: |
|
43
|
-
# JSON Data Processing Report
|
44
|
-
|
45
|
-
## Users Data
|
46
|
-
{{output.fetch_users}}
|
47
|
-
|
48
|
-
## Metadata
|
49
|
-
{{output.fetch_metadata}}
|
50
|
-
|
51
|
-
## Summary
|
52
|
-
{{output.process_data}}
|
data/examples/mcp/README.md
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
# MCP (Model Context Protocol) Tools
|
2
|
-
|
3
|
-
This example demonstrates how to use MCP tools in Roast workflows. MCP is an open standard that enables seamless integration between AI applications and external data sources and tools.
|
4
|
-
|
5
|
-
## What are MCP Tools?
|
6
|
-
|
7
|
-
MCP tools allow your Roast workflows to connect to external services and tools through a standardized protocol. This enables:
|
8
|
-
|
9
|
-
- Access to external APIs and services
|
10
|
-
- Integration with databases and file systems
|
11
|
-
- Connection to specialized tools and platforms
|
12
|
-
- Real-time data access during workflow execution
|
13
|
-
|
14
|
-
## Configuration
|
15
|
-
|
16
|
-
MCP tools are configured in the `tools` section of your workflow YAML file. Roast supports two types of MCP connections:
|
17
|
-
|
18
|
-
### 1. SSE (Server-Sent Events) MCP Tools
|
19
|
-
|
20
|
-
Connect to HTTP endpoints that implement the MCP protocol:
|
21
|
-
|
22
|
-
```yaml
|
23
|
-
tools:
|
24
|
-
- Tool Name:
|
25
|
-
url: https://example.com/mcp-endpoint
|
26
|
-
env:
|
27
|
-
- "Authorization: Bearer {{resource.api_token}}"
|
28
|
-
only:
|
29
|
-
- allowed_function_1
|
30
|
-
- allowed_function_2
|
31
|
-
```
|
32
|
-
|
33
|
-
### 2. Stdio MCP Tools
|
34
|
-
|
35
|
-
Connect to local processes that implement the MCP protocol:
|
36
|
-
|
37
|
-
```yaml
|
38
|
-
tools:
|
39
|
-
- Tool Name:
|
40
|
-
command: docker
|
41
|
-
args:
|
42
|
-
- run
|
43
|
-
- -i
|
44
|
-
- --rm
|
45
|
-
- ghcr.io/example/mcp-server
|
46
|
-
env:
|
47
|
-
API_KEY: "{{ENV['API_KEY']}}"
|
48
|
-
except:
|
49
|
-
- dangerous_function
|
50
|
-
```
|
51
|
-
|
52
|
-
## Parameters
|
53
|
-
|
54
|
-
- **`url`** (SSE only): The HTTP(S) endpoint URL for the MCP server
|
55
|
-
- **`command`** (stdio only): The command to execute
|
56
|
-
- **`args`** (stdio only): Array of command-line arguments
|
57
|
-
- **`env`**: Headers (SSE) or environment variables (stdio)
|
58
|
-
- **`only`**: Whitelist of functions to include
|
59
|
-
- **`except`**: Blacklist of functions to exclude
|
60
|
-
|
61
|
-
## Example Workflow
|
62
|
-
|
63
|
-
The `workflow.yml` in this directory shows a simple example using GitMCP to read documentation:
|
64
|
-
|
65
|
-
```yaml
|
66
|
-
name: MCP Tools Example
|
67
|
-
model: gpt-4o-mini
|
68
|
-
tools:
|
69
|
-
- Roast Docs:
|
70
|
-
url: https://gitmcp.io/Shopify/roast/docs
|
71
|
-
|
72
|
-
steps:
|
73
|
-
- get_doc: Read the Roast docs, and tell me how to use MCP tools.
|
74
|
-
- summarize
|
75
|
-
|
76
|
-
summarize:
|
77
|
-
print_response: true
|
78
|
-
```
|
79
|
-
|
80
|
-
## Running the Examples
|
81
|
-
|
82
|
-
### Simple Example (no authentication required)
|
83
|
-
|
84
|
-
```bash
|
85
|
-
# Run the basic MCP example
|
86
|
-
roast execute examples/mcp/workflow.yml
|
87
|
-
|
88
|
-
# Run the multi-tool example
|
89
|
-
roast execute examples/mcp/multi_mcp_workflow.yml
|
90
|
-
```
|
91
|
-
|
92
|
-
### GitHub Example (requires GitHub token)
|
93
|
-
|
94
|
-
```bash
|
95
|
-
# Set your GitHub token first
|
96
|
-
export GITHUB_TOKEN="your-github-personal-access-token"
|
97
|
-
|
98
|
-
# Run the GitHub workflow
|
99
|
-
roast execute examples/mcp/github_workflow.yml
|
100
|
-
```
|
101
|
-
|
102
|
-
### Filesystem Example
|
103
|
-
|
104
|
-
```bash
|
105
|
-
# This uses the filesystem MCP server to safely browse /tmp
|
106
|
-
roast execute examples/mcp/filesystem_demo/workflow.yml
|
107
|
-
```
|
108
|
-
|
109
|
-
## More Examples
|
110
|
-
|
111
|
-
### GitHub Integration
|
112
|
-
|
113
|
-
```yaml
|
114
|
-
tools:
|
115
|
-
- GitHub:
|
116
|
-
command: npx
|
117
|
-
args: ["-y", "@modelcontextprotocol/server-github"]
|
118
|
-
env:
|
119
|
-
GITHUB_PERSONAL_ACCESS_TOKEN: "{{ENV['GITHUB_TOKEN']}}"
|
120
|
-
only:
|
121
|
-
- search_repositories
|
122
|
-
- get_issue
|
123
|
-
- create_issue
|
124
|
-
```
|
125
|
-
|
126
|
-
### Database Access
|
127
|
-
|
128
|
-
```yaml
|
129
|
-
tools:
|
130
|
-
- Database:
|
131
|
-
command: npx
|
132
|
-
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
133
|
-
env:
|
134
|
-
DATABASE_URL: "{{ENV['DATABASE_URL']}}"
|
135
|
-
only:
|
136
|
-
- query
|
137
|
-
- list_tables
|
138
|
-
```
|
139
|
-
|
140
|
-
### Using Multiple MCP Tools
|
141
|
-
|
142
|
-
You can combine MCP tools with traditional Roast tools:
|
143
|
-
|
144
|
-
```yaml
|
145
|
-
tools:
|
146
|
-
# Traditional Roast tools
|
147
|
-
- Roast::Tools::ReadFile
|
148
|
-
- Roast::Tools::WriteFile
|
149
|
-
|
150
|
-
# MCP tools
|
151
|
-
- External API:
|
152
|
-
url: https://api.example.com/mcp
|
153
|
-
- Local Tool:
|
154
|
-
command: ./my-mcp-server
|
155
|
-
```
|
156
|
-
|
157
|
-
## Installing and Using MCP Servers
|
158
|
-
|
159
|
-
MCP servers can be run in different ways:
|
160
|
-
|
161
|
-
### Using npx (recommended for testing)
|
162
|
-
|
163
|
-
Most official MCP servers can be run directly with npx without installation:
|
164
|
-
|
165
|
-
```bash
|
166
|
-
# These are automatically downloaded and run when used in workflows
|
167
|
-
npx -y @modelcontextprotocol/server-github
|
168
|
-
npx -y @modelcontextprotocol/server-filesystem /path/to/allow
|
169
|
-
npx -y @modelcontextprotocol/server-sqlite /path/to/database.db
|
170
|
-
```
|
171
|
-
|
172
|
-
### Installing globally
|
173
|
-
|
174
|
-
For production use, you might want to install servers globally:
|
175
|
-
|
176
|
-
```bash
|
177
|
-
npm install -g @modelcontextprotocol/server-github
|
178
|
-
npm install -g @modelcontextprotocol/server-filesystem
|
179
|
-
```
|
180
|
-
|
181
|
-
### Available MCP Servers
|
182
|
-
|
183
|
-
Popular MCP servers you can use:
|
184
|
-
|
185
|
-
- **@modelcontextprotocol/server-filesystem**: Safe filesystem access
|
186
|
-
- **@modelcontextprotocol/server-github**: GitHub API integration (requires token)
|
187
|
-
- **@modelcontextprotocol/server-gitlab**: GitLab API integration
|
188
|
-
- **@modelcontextprotocol/server-google-drive**: Google Drive access
|
189
|
-
- **@modelcontextprotocol/server-slack**: Slack integration
|
190
|
-
- **@modelcontextprotocol/server-postgres**: PostgreSQL database access
|
191
|
-
- **@modelcontextprotocol/server-sqlite**: SQLite database access
|
192
|
-
|
193
|
-
For more MCP servers, visit: https://github.com/modelcontextprotocol/servers
|
194
|
-
|
195
|
-
## Troubleshooting
|
196
|
-
|
197
|
-
### Common Issues
|
198
|
-
|
199
|
-
1. **"No such file or directory" error**
|
200
|
-
- Make sure `npx` is installed: `which npx`
|
201
|
-
- For local commands, ensure they're in your PATH
|
202
|
-
|
203
|
-
2. **"Bad credentials" or authentication errors**
|
204
|
-
- Check that your environment variables are set correctly
|
205
|
-
- Use `{{ENV['VAR_NAME']}}` syntax for interpolation
|
206
|
-
- Test with: `echo $GITHUB_TOKEN` to verify it's set
|
207
|
-
|
208
|
-
3. **MCP server doesn't start**
|
209
|
-
- Try running the command manually first: `npx -y @modelcontextprotocol/server-filesystem /tmp`
|
210
|
-
- Check for any npm/node errors
|
211
|
-
|
212
|
-
4. **"Step not found" errors**
|
213
|
-
- Inline prompts in the workflow use the syntax: `step_name: prompt text`
|
214
|
-
- For multi-line prompts use: `step_name: |` followed by indented text
|
215
|
-
- For separate prompt files: create `step_name/prompt.md` in the workflow directory
|
216
|
-
|
217
|
-
## Security Notes
|
218
|
-
|
219
|
-
- Never hardcode credentials - use environment variables
|
220
|
-
- Use `only` to limit function access when possible
|
221
|
-
- Be cautious with stdio tools as they execute local processes
|
222
|
-
- Review MCP server documentation for security best practices
|
223
|
-
- The filesystem server only allows access to specified directories
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# MCP Database Integration Example
|
2
|
-
# This workflow demonstrates using a PostgreSQL MCP server for database operations
|
3
|
-
|
4
|
-
name: Database Analysis Workflow
|
5
|
-
model: gpt-4o-mini
|
6
|
-
|
7
|
-
tools:
|
8
|
-
# PostgreSQL MCP tool
|
9
|
-
- Database:
|
10
|
-
command: npx
|
11
|
-
args:
|
12
|
-
- "-y"
|
13
|
-
- "@modelcontextprotocol/server-postgres"
|
14
|
-
env:
|
15
|
-
DATABASE_URL: "{{ENV['DATABASE_URL']}}"
|
16
|
-
only:
|
17
|
-
- query
|
18
|
-
- list_tables
|
19
|
-
- describe_table
|
20
|
-
- get_schema
|
21
|
-
|
22
|
-
steps:
|
23
|
-
- analyze_schema
|
24
|
-
- check_data_quality
|
25
|
-
- generate_insights
|
26
|
-
- create_recommendations
|
27
|
-
|
28
|
-
create_recommendations:
|
29
|
-
print_response: true
|
Binary file
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Environment Variable Interpolation Demo
|
2
|
-
# This shows how ENV variables are interpolated in MCP tool configurations
|
3
|
-
|
4
|
-
name: ENV Interpolation Demo
|
5
|
-
model: o4-mini
|
6
|
-
|
7
|
-
tools:
|
8
|
-
- Roast::Tools::ReadFile
|
9
|
-
|
10
|
-
# Filesystem MCP with interpolated path
|
11
|
-
# The user's home directory will be resolved from ENV['HOME']
|
12
|
-
- UserFiles:
|
13
|
-
command: npx
|
14
|
-
args: ["-y", "@modelcontextprotocol/server-filesystem", "{{ENV['HOME'] || '/tmp'}}"]
|
15
|
-
only:
|
16
|
-
- list_directory
|
17
|
-
- get_file_info
|
18
|
-
|
19
|
-
steps:
|
20
|
-
- show_env: |
|
21
|
-
First, tell me what user is running this workflow. The current user is: {{ENV['USER'] || 'unknown'}}
|
22
|
-
And their home directory is: {{ENV['HOME'] || 'not set'}}
|
23
|
-
|
24
|
-
- list_home: |
|
25
|
-
Now use the UserFiles MCP tool's list_directory function to list the user's home directory.
|
26
|
-
Just show the first 5-10 items you find.
|
27
|
-
|
28
|
-
|
29
|
-
show_env:
|
30
|
-
print_response: true
|
31
|
-
|
32
|
-
list_home:
|
33
|
-
model: gpt-4o-mini
|
34
|
-
print_response: true
|