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,50 +0,0 @@
|
|
1
|
-
# Interpolation Example
|
2
|
-
|
3
|
-
This example demonstrates how to use Roast's interpolation feature to create dynamic workflows.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
The workflow in this example:
|
8
|
-
1. Analyzes a file and extracts its metadata
|
9
|
-
2. Extracts patterns based on the file type
|
10
|
-
3. Dynamically selects a report generation step based on the file extension
|
11
|
-
4. Outputs a completion message using the file's basename
|
12
|
-
|
13
|
-
## Interpolation Examples
|
14
|
-
|
15
|
-
The workflow demonstrates several types of interpolation:
|
16
|
-
|
17
|
-
- `{{ }}` syntax for embedding dynamic values
|
18
|
-
- Access to file metadata via expressions like `{{file_basename}}` and `{{file_ext}}`
|
19
|
-
- Dynamic step selection with `generate_report_for_{{file_ext}}`
|
20
|
-
- Shell command interpolation with `$(echo "Processing completed for file: {{file_basename}}")`
|
21
|
-
|
22
|
-
## Running the Example
|
23
|
-
|
24
|
-
To run this example with a Ruby file:
|
25
|
-
|
26
|
-
```bash
|
27
|
-
roast execute workflow.yml /path/to/some_file.rb
|
28
|
-
```
|
29
|
-
|
30
|
-
Or with a JavaScript file:
|
31
|
-
|
32
|
-
```bash
|
33
|
-
roast execute workflow.yml /path/to/some_file.js
|
34
|
-
```
|
35
|
-
|
36
|
-
The workflow will:
|
37
|
-
1. Extract the file's basename and extension
|
38
|
-
2. Store these in the workflow context
|
39
|
-
3. Dynamically choose a report generator based on file extension
|
40
|
-
4. Create a markdown report file
|
41
|
-
5. Output a completion message with the filename
|
42
|
-
|
43
|
-
## How Interpolation Works
|
44
|
-
|
45
|
-
1. When Roast processes a step name or shell command, it looks for `{{ }}` patterns
|
46
|
-
2. Expressions inside `{{ }}` are evaluated in the workflow's context using Ruby's `instance_eval`
|
47
|
-
3. This allows access to the workflow's variables, methods, and output hash
|
48
|
-
4. The evaluated expressions replace the `{{ }}` patterns in the step name or command
|
49
|
-
|
50
|
-
This makes workflows dynamic and able to respond to different inputs without code changes.
|
@@ -1 +0,0 @@
|
|
1
|
-
Analyze the file at: <%= workflow.file %>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
Extract some patterns about this file and return in json format like this:
|
2
|
-
|
3
|
-
<json>
|
4
|
-
{
|
5
|
-
"code_patterns": {
|
6
|
-
"class_structure": {
|
7
|
-
"name": "Calculator",
|
8
|
-
"instance_variables": ["@memory"],
|
9
|
-
"method_count": 7,
|
10
|
-
"method_types": {
|
11
|
-
"constructor": ["initialize"],
|
12
|
-
"operations": ["add", "subtract", "multiply", "divide"],
|
13
|
-
"accessors": ["memory"],
|
14
|
-
"utility": ["clear"]
|
15
|
-
}
|
16
|
-
},
|
17
|
-
"error_handling": {
|
18
|
-
"techniques": ["conditional raise", "zero check"],
|
19
|
-
"examples": ["raise \"Division by zero!\" if number.zero?"]
|
20
|
-
},
|
21
|
-
"design_patterns": {
|
22
|
-
"state": "Uses instance variable to maintain calculator state",
|
23
|
-
"command": "Each operation method modifies the internal state"
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
</json>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
// Sample JavaScript file for testing interpolation in workflows
|
2
|
-
|
3
|
-
class Calculator {
|
4
|
-
constructor() {
|
5
|
-
this.memory = 0;
|
6
|
-
}
|
7
|
-
|
8
|
-
add(number) {
|
9
|
-
this.memory += number;
|
10
|
-
return this.memory;
|
11
|
-
}
|
12
|
-
|
13
|
-
subtract(number) {
|
14
|
-
this.memory -= number;
|
15
|
-
return this.memory;
|
16
|
-
}
|
17
|
-
|
18
|
-
multiply(number) {
|
19
|
-
this.memory *= number;
|
20
|
-
return this.memory;
|
21
|
-
}
|
22
|
-
|
23
|
-
divide(number) {
|
24
|
-
if (number === 0) {
|
25
|
-
throw new Error("Division by zero!");
|
26
|
-
}
|
27
|
-
this.memory /= number;
|
28
|
-
return this.memory;
|
29
|
-
}
|
30
|
-
|
31
|
-
getMemory() {
|
32
|
-
return this.memory;
|
33
|
-
}
|
34
|
-
|
35
|
-
clear() {
|
36
|
-
this.memory = 0;
|
37
|
-
return this.memory;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
// Example usage
|
42
|
-
if (require.main === module) {
|
43
|
-
const calc = new Calculator();
|
44
|
-
calc.add(10);
|
45
|
-
calc.multiply(2);
|
46
|
-
calc.subtract(5);
|
47
|
-
console.log(`Result: ${calc.getMemory()}`);
|
48
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Sample Ruby file for testing interpolation in workflows
|
4
|
-
|
5
|
-
class Calculator
|
6
|
-
def initialize
|
7
|
-
@memory = 0
|
8
|
-
end
|
9
|
-
|
10
|
-
def add(number)
|
11
|
-
@memory += number
|
12
|
-
end
|
13
|
-
|
14
|
-
def subtract(number)
|
15
|
-
@memory -= number
|
16
|
-
end
|
17
|
-
|
18
|
-
def multiply(number)
|
19
|
-
@memory *= number
|
20
|
-
end
|
21
|
-
|
22
|
-
def divide(number)
|
23
|
-
raise "Division by zero!" if number.zero?
|
24
|
-
|
25
|
-
@memory /= number
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :memory
|
29
|
-
|
30
|
-
def clear
|
31
|
-
@memory = 0
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Example usage
|
36
|
-
if __FILE__ == $PROGRAM_NAME
|
37
|
-
calc = Calculator.new
|
38
|
-
calc.add(10)
|
39
|
-
calc.multiply(2)
|
40
|
-
calc.subtract(5)
|
41
|
-
puts "Result: #{calc.memory}"
|
42
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
You are a good robot.
|
Binary file
|
@@ -1,21 +0,0 @@
|
|
1
|
-
name: interpolation_example
|
2
|
-
model: gpt-4o-mini
|
3
|
-
|
4
|
-
tools:
|
5
|
-
- Roast::Tools::ReadFile
|
6
|
-
|
7
|
-
steps:
|
8
|
-
- analyze_file
|
9
|
-
- analyze_patterns
|
10
|
-
- generate_report_for_{{File.extname(workflow.file).sub('.', '')}}
|
11
|
-
- '$(echo "Processing completed for file: {{File.basename(workflow.file)}}")'
|
12
|
-
|
13
|
-
analyze_patterns:
|
14
|
-
json: true
|
15
|
-
|
16
|
-
generate_report_for_rb:
|
17
|
-
print_response: true
|
18
|
-
|
19
|
-
generate_report_for_md:
|
20
|
-
print_response: true
|
21
|
-
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# Iteration Mechanisms Implementation
|
2
|
-
|
3
|
-
This document provides an overview of how the iteration mechanisms are implemented in Roast.
|
4
|
-
|
5
|
-
## Core Components
|
6
|
-
|
7
|
-
### 1. Schema Extensions
|
8
|
-
|
9
|
-
The workflow schema has been extended to support two new iteration constructs:
|
10
|
-
|
11
|
-
- **Repeat** - For conditional repetition until a condition is met
|
12
|
-
- **Each** - For iterating over collections with a variable binding
|
13
|
-
|
14
|
-
These schema extensions define the structure and validation rules for the iteration YAML syntax.
|
15
|
-
|
16
|
-
### 2. Step Classes
|
17
|
-
|
18
|
-
Two new step classes handle the actual iteration logic:
|
19
|
-
|
20
|
-
- **RepeatStep** - Executes steps repeatedly until a condition is met or a maximum iteration count is reached
|
21
|
-
- **EachStep** - Iterates over a collection, binding each item to a variable, and executes steps for each item
|
22
|
-
|
23
|
-
Both inherit from a common `BaseIterationStep` class that provides shared functionality.
|
24
|
-
|
25
|
-
### 3. Pattern Matching
|
26
|
-
|
27
|
-
The `WorkflowExecutor` has been enhanced with pattern matching to recognize the `repeat` and `each` keywords and dispatch to the appropriate step classes:
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
case name
|
31
|
-
when "repeat"
|
32
|
-
execute_repeat_step(command)
|
33
|
-
when "each"
|
34
|
-
# Handle 'each' step with its special format
|
35
|
-
execute_each_step(step)
|
36
|
-
else
|
37
|
-
# Handle regular steps
|
38
|
-
end
|
39
|
-
```
|
40
|
-
|
41
|
-
### 4. State Management
|
42
|
-
|
43
|
-
Both iteration types include state management to:
|
44
|
-
|
45
|
-
- Track current iteration number
|
46
|
-
- Save state after each iteration
|
47
|
-
- Support resumption after failures
|
48
|
-
- Provide safety limits against infinite loops
|
49
|
-
|
50
|
-
## Iteration Flow
|
51
|
-
|
52
|
-
### RepeatStep Flow
|
53
|
-
|
54
|
-
1. Start with iteration count = 0
|
55
|
-
2. Execute the nested steps in sequence
|
56
|
-
3. Evaluate the until condition
|
57
|
-
4. If condition is true or max_iterations is reached, stop
|
58
|
-
5. Otherwise, increment iteration count and go back to step 2
|
59
|
-
6. Return the results of all iterations
|
60
|
-
|
61
|
-
### EachStep Flow
|
62
|
-
|
63
|
-
1. Resolve the collection expression
|
64
|
-
2. For each item in the collection:
|
65
|
-
a. Set the named variable (accessible in steps through a getter method)
|
66
|
-
b. Execute the nested steps
|
67
|
-
c. Save state
|
68
|
-
3. Return the results from all iterations
|
69
|
-
|
70
|
-
## Safety Mechanisms
|
71
|
-
|
72
|
-
- **max_iterations** parameter prevents infinite loops
|
73
|
-
- State is saved after each iteration for resumption capability
|
74
|
-
- Robust error handling during condition evaluation and step execution
|
75
|
-
- Collection type checking ensures iterable objects
|
76
|
-
|
77
|
-
## Usage Examples
|
78
|
-
|
79
|
-
The workflow.yml and step files in this directory demonstrate practical applications of these iteration mechanisms for code quality analysis.
|
80
|
-
|
81
|
-
## Integration with Existing Workflow Engine
|
82
|
-
|
83
|
-
The iteration mechanism integrates seamlessly with the existing workflow engine:
|
84
|
-
|
85
|
-
- Uses the same state persistence mechanisms
|
86
|
-
- Follows the same execution models
|
87
|
-
- Maintains compatibility with all existing steps
|
88
|
-
- Supports interpolation within iteration constructs
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# Code Quality Analysis Workflow
|
2
|
-
|
3
|
-
This example demonstrates the use of Roast's iteration features to analyze and improve code quality across a codebase.
|
4
|
-
|
5
|
-
## What it does
|
6
|
-
|
7
|
-
1. Collects Ruby files from the codebase for analysis
|
8
|
-
2. Analyzes each file for complexity, code smells, and potential improvements
|
9
|
-
3. Generates recommendations for each file
|
10
|
-
4. Prioritizes the identified issues by impact and difficulty
|
11
|
-
5. Automatically implements fixes for the highest-priority issues
|
12
|
-
6. Verifies each fix before moving to the next one
|
13
|
-
7. Continues until either 5 fixes have been applied or all issues are addressed
|
14
|
-
8. Generates a summary report of changes made
|
15
|
-
|
16
|
-
## Iteration Features Demonstrated
|
17
|
-
|
18
|
-
### Collection Iteration with `each`
|
19
|
-
|
20
|
-
The workflow uses the `each` construct to iterate through Ruby files:
|
21
|
-
|
22
|
-
```yaml
|
23
|
-
- each: "output['get_files_to_analyze'].split('\n')"
|
24
|
-
as: "current_file"
|
25
|
-
steps:
|
26
|
-
- read_file
|
27
|
-
- analyze_complexity
|
28
|
-
- generate_recommendations
|
29
|
-
```
|
30
|
-
|
31
|
-
This makes the current file available as `current_file` in each step, allowing the analysis steps to process each file individually.
|
32
|
-
|
33
|
-
### Conditional Repetition with `repeat`
|
34
|
-
|
35
|
-
The workflow uses the `repeat` construct to iteratively fix issues until a condition is met:
|
36
|
-
|
37
|
-
```yaml
|
38
|
-
- repeat:
|
39
|
-
steps:
|
40
|
-
- select_next_issue
|
41
|
-
- implement_fix
|
42
|
-
- verify_fix
|
43
|
-
- update_fix_count
|
44
|
-
until: "output['update_fix_count']['fixes_applied'] >= 5 || output['select_next_issue']['no_issues_left'] == true"
|
45
|
-
max_iterations: 10
|
46
|
-
```
|
47
|
-
|
48
|
-
This continues applying fixes until either:
|
49
|
-
- 5 fixes have been successfully applied
|
50
|
-
- No more issues remain to be fixed
|
51
|
-
- The maximum of 10 iterations is reached (safety limit)
|
52
|
-
|
53
|
-
## Running the Example
|
54
|
-
|
55
|
-
To run this workflow:
|
56
|
-
|
57
|
-
```bash
|
58
|
-
roast run examples/iteration/workflow.yml --target=/path/to/your/project
|
59
|
-
```
|
60
|
-
|
61
|
-
The workflow will analyze the Ruby files in your project, suggest improvements, and apply the highest-priority fixes.
|
62
|
-
|
63
|
-
## Customizing
|
64
|
-
|
65
|
-
- Adjust the file selection criteria in `get_files_to_analyze`
|
66
|
-
- Modify the analysis criteria in `analyze_complexity`
|
67
|
-
- Change the fix limit in the `until` condition
|
68
|
-
- Set a different `max_iterations` value to control the maximum number of fixes
|
@@ -1,22 +0,0 @@
|
|
1
|
-
I'll analyze the code complexity of the file <%= current_file %>, which I've read in the previous step.
|
2
|
-
|
3
|
-
I'll examine the following aspects:
|
4
|
-
1. Cyclomatic complexity (number of decision paths)
|
5
|
-
2. Method length and complexity
|
6
|
-
3. Class size and responsibilities
|
7
|
-
4. Code smells (long parameter lists, deeply nested blocks, etc.)
|
8
|
-
5. Potential performance bottlenecks
|
9
|
-
6. Opportunities for refactoring
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
<%= output.read_file %>
|
13
|
-
```
|
14
|
-
|
15
|
-
Based on this analysis, I'll provide a structured assessment of the code quality issues found.
|
16
|
-
|
17
|
-
For each issue identified, I'll assign:
|
18
|
-
- Severity (high, medium, low)
|
19
|
-
- Type (complexity, maintainability, performance, style)
|
20
|
-
- Location (line numbers, method/class names)
|
21
|
-
- Brief description of the issue
|
22
|
-
- Suggested improvement
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Based on the analysis of complexity for file <%= current_file %>, I'll generate specific recommendations for improving code quality.
|
2
|
-
|
3
|
-
I'll use the complexity analysis from the previous step:
|
4
|
-
```json
|
5
|
-
<%= output.analyze_complexity %>
|
6
|
-
```
|
7
|
-
|
8
|
-
For each identified issue, I'll provide detailed, actionable recommendations including:
|
9
|
-
|
10
|
-
1. What specific changes should be made
|
11
|
-
2. How the change improves the code
|
12
|
-
3. Sample code snippets demonstrating the improvement
|
13
|
-
4. An estimate of effort required (low, medium, high)
|
14
|
-
5. Priority level for implementation
|
15
|
-
|
16
|
-
I'll organize these recommendations to address:
|
17
|
-
- Most critical issues first
|
18
|
-
- Quick wins that provide significant value for minimal effort
|
19
|
-
- Long-term architectural improvements
|
20
|
-
|
21
|
-
My recommendations will follow Ruby best practices, adhere to common style guides, and consider maintainability, readability, and performance.
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# Code Quality Improvement Report
|
2
|
-
|
3
|
-
## Summary of Analysis and Improvements
|
4
|
-
|
5
|
-
I've analyzed {{output.get_files_to_analyze.split('\n').length}} Ruby files for code quality issues and made targeted improvements.
|
6
|
-
|
7
|
-
### Files Analyzed
|
8
|
-
|
9
|
-
```
|
10
|
-
{{output.get_files_to_analyze}}
|
11
|
-
```
|
12
|
-
|
13
|
-
### Issues Identified
|
14
|
-
|
15
|
-
Total issues identified: {{output.prioritize_issues.total_issues}}
|
16
|
-
|
17
|
-
Issues by severity:
|
18
|
-
- High: {{output.prioritize_issues.high_severity || 0}}
|
19
|
-
- Medium: {{output.prioritize_issues.medium_severity || 0}}
|
20
|
-
- Low: {{output.prioritize_issues.low_severity || 0}}
|
21
|
-
|
22
|
-
Issues by type:
|
23
|
-
- Complexity: {{output.prioritize_issues.complexity_issues || 0}}
|
24
|
-
- Maintainability: {{output.prioritize_issues.maintainability_issues || 0}}
|
25
|
-
- Performance: {{output.prioritize_issues.performance_issues || 0}}
|
26
|
-
- Style: {{output.prioritize_issues.style_issues || 0}}
|
27
|
-
|
28
|
-
### Improvements Made
|
29
|
-
|
30
|
-
Number of fixes applied: {{output.update_fix_count.fixes_applied || 0}}
|
31
|
-
|
32
|
-
{{#if output.update_fix_count.fixes_applied > 0}}
|
33
|
-
Fixes by type:
|
34
|
-
{{#each output.fix_summary}}
|
35
|
-
- {{this.type}}: {{this.count}} ({{this.percentage}}% of total)
|
36
|
-
{{/each}}
|
37
|
-
|
38
|
-
Top files improved:
|
39
|
-
{{#each output.file_improvements}}
|
40
|
-
- {{this.file}}: {{this.issues_fixed}} issues fixed
|
41
|
-
{{/each}}
|
42
|
-
{{else}}
|
43
|
-
No fixes were applied during this run.
|
44
|
-
{{/if}}
|
45
|
-
|
46
|
-
## Detailed Fix List
|
47
|
-
|
48
|
-
{{#if output.update_fix_count.fixes_applied > 0}}
|
49
|
-
{{#each output.fixes_applied}}
|
50
|
-
### Fix #{{@index + 1}}: {{this.issue.type}} in {{this.issue.file_path}}
|
51
|
-
|
52
|
-
**Issue**: {{this.issue.description}}
|
53
|
-
**Location**: {{this.issue.location}}
|
54
|
-
**Severity**: {{this.issue.severity}}
|
55
|
-
|
56
|
-
**Solution Applied**: {{this.fix_description}}
|
57
|
-
|
58
|
-
```diff
|
59
|
-
{{this.diff}}
|
60
|
-
```
|
61
|
-
|
62
|
-
**Verification**: {{#if this.verification.success}}✅ Successful{{else}}❌ Failed: {{this.verification.reason}}{{/if}}
|
63
|
-
|
64
|
-
{{/each}}
|
65
|
-
{{else}}
|
66
|
-
No fixes were applied during this run.
|
67
|
-
{{/if}}
|
68
|
-
|
69
|
-
## Recommendations for Future Improvements
|
70
|
-
|
71
|
-
Based on the remaining issues, here are the top recommendations for improving code quality:
|
72
|
-
|
73
|
-
{{#each output.top_recommendations}}
|
74
|
-
{{@index + 1}}. **{{this.title}}**
|
75
|
-
{{this.description}}
|
76
|
-
Affected files: {{this.affected_files}}
|
77
|
-
{{/each}}
|
78
|
-
|
79
|
-
## Conclusion
|
80
|
-
|
81
|
-
This automated code quality improvement run has {{#if output.update_fix_count.fixes_applied > 0}}successfully addressed {{output.update_fix_count.fixes_applied}} issues{{else}}identified issues but did not apply any fixes{{/if}}. The remaining issues should be reviewed and addressed as part of ongoing code maintenance.
|
82
|
-
|
83
|
-
I'll generate a comprehensive summary report of all the code quality improvements made during this workflow.
|
84
|
-
|
85
|
-
Total number of fixes applied:
|
86
|
-
```
|
87
|
-
{{output.update_fix_count.fixes_applied || 0}}
|
88
|
-
```
|
89
|
-
|
90
|
-
I'll analyze the following data to create the report:
|
91
|
-
1. Original list of issues identified:
|
92
|
-
```json
|
93
|
-
{{output.prioritize_issues}}
|
94
|
-
```
|
95
|
-
|
96
|
-
2. Issues that were addressed:
|
97
|
-
```json
|
98
|
-
{{outputs_of.select_next_issue}}
|
99
|
-
```
|
100
|
-
|
101
|
-
3. Implementation and verification details:
|
102
|
-
```json
|
103
|
-
{{outputs_of.implement_fix}}
|
104
|
-
{{outputs_of.verify_fix}}
|
105
|
-
```
|
106
|
-
|
107
|
-
The report will include:
|
108
|
-
|
109
|
-
1. **Executive Summary**
|
110
|
-
- Total files analyzed
|
111
|
-
- Total issues identified
|
112
|
-
- Issues fixed vs. remaining
|
113
|
-
- Most common issue types
|
114
|
-
|
115
|
-
2. **Detailed Analysis by File**
|
116
|
-
- Issues fixed per file
|
117
|
-
- Before/after code quality assessment
|
118
|
-
|
119
|
-
3. **Implementation Details**
|
120
|
-
- Description of each fix
|
121
|
-
- Impact on code quality
|
122
|
-
- Verification results
|
123
|
-
|
124
|
-
4. **Recommendations**
|
125
|
-
- Remaining high-priority issues
|
126
|
-
- Suggested next steps
|
127
|
-
- Long-term code quality improvement suggestions
|
128
|
-
|
129
|
-
This report provides a comprehensive overview of the code quality improvements made and serves as documentation for the changes implemented.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
I'll implement the fix for the issue selected in the previous step.
|
2
|
-
|
3
|
-
Here is the issue to fix:
|
4
|
-
```json
|
5
|
-
<%= output.select_next_issue %>
|
6
|
-
```
|
7
|
-
|
8
|
-
First, I'll read the current file content to understand the context:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
<%= read_file(output.select_next_issue.file_path) %>
|
12
|
-
```
|
13
|
-
|
14
|
-
Based on the issue description and the recommended changes, I'll implement a fix that:
|
15
|
-
1. Addresses the specific issue identified
|
16
|
-
2. Follows Ruby best practices and style conventions
|
17
|
-
3. Is minimal and focused (changes only what's necessary)
|
18
|
-
4. Maintains or improves the existing functionality
|
19
|
-
|
20
|
-
I'll use the update_files tool to apply the changes. For each change, I'll provide:
|
21
|
-
1. The file path
|
22
|
-
2. The changes to make
|
23
|
-
3. A detailed explanation of what was changed and why
|
24
|
-
|
25
|
-
After implementing the fix, I'll return a summary of the changes made.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
I'll analyze all the recommendations I've generated across multiple files and prioritize them according to:
|
2
|
-
|
3
|
-
1. Severity of the issues
|
4
|
-
2. Complexity of implementation
|
5
|
-
3. Impact on code quality and maintainability
|
6
|
-
4. Dependencies between issues
|
7
|
-
|
8
|
-
Let me review all the recommendations collected so far:
|
9
|
-
|
10
|
-
```json
|
11
|
-
<%= outputs_of.generate_recommendations %>
|
12
|
-
```
|
13
|
-
|
14
|
-
I'll create a comprehensive prioritized list of all issues across files, combining similar issues where appropriate. The prioritized list will include:
|
15
|
-
|
16
|
-
1. Issue ID
|
17
|
-
2. File path
|
18
|
-
3. Issue description
|
19
|
-
4. Severity (High, Medium, Low)
|
20
|
-
5. Implementation difficulty (Easy, Medium, Hard)
|
21
|
-
6. Priority score (calculated from severity and difficulty)
|
22
|
-
7. Dependencies (if any)
|
23
|
-
|
24
|
-
This prioritized list will guide our approach to addressing the most important issues first, while being mindful of dependencies between issues.
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# Ruby File Method Analysis
|
2
|
-
|
3
|
-
You are a code analyzer focusing on analyzing Ruby files to count the number of methods defined.
|
4
|
-
|
5
|
-
## Input
|
6
|
-
- File path: <%= file_path %>
|
7
|
-
- File content:
|
8
|
-
```ruby
|
9
|
-
<%= read_file(file_path) %>
|
10
|
-
```
|
11
|
-
|
12
|
-
## Task
|
13
|
-
1. Analyze the Ruby file content
|
14
|
-
2. Count the number of methods defined in the file (including class methods, instance methods, and module methods)
|
15
|
-
3. Return a JSON object with:
|
16
|
-
- file_name: The basename of the file
|
17
|
-
- method_count: The number of methods found
|
18
|
-
- method_names: An array of method names found in the file
|
19
|
-
|
20
|
-
## Response Format
|
21
|
-
Return a JSON object with the following structure:
|
22
|
-
```json
|
23
|
-
{
|
24
|
-
"file_name": "base_step.rb",
|
25
|
-
"method_count": 5,
|
26
|
-
"method_names": ["initialize", "call", "validate", "execute", "helper_method"]
|
27
|
-
}
|
28
|
-
```
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Generate Method Analysis Summary
|
2
|
-
|
3
|
-
You are a report generator responsible for summarizing the method analysis results.
|
4
|
-
|
5
|
-
## Input
|
6
|
-
- Report data: <%= report_data %>
|
7
|
-
|
8
|
-
## Task
|
9
|
-
1. Parse the report data as JSON
|
10
|
-
2. Create a summary of the analysis results including:
|
11
|
-
- Total number of files analyzed
|
12
|
-
- Total number of methods found
|
13
|
-
- Average number of methods per file
|
14
|
-
- File with the most methods
|
15
|
-
- File with the fewest methods
|
16
|
-
3. Generate a formatted summary text
|
17
|
-
|
18
|
-
## Response Format
|
19
|
-
Return a JSON object with the following structure:
|
20
|
-
```json
|
21
|
-
{
|
22
|
-
"summary": "## Ruby Method Analysis Summary\n\nAnalyzed 10 Ruby files in the workflow directory.\n- Total methods found: 45\n- Average methods per file: 4.5\n- Most methods: base_workflow.rb (12 methods)\n- Fewest methods: state_repository.rb (1 method)\n\n### Top 3 Files by Method Count\n1. base_workflow.rb: 12 methods\n2. configuration.rb: 8 methods\n3. workflow_executor.rb: 7 methods\n"
|
23
|
-
}
|
24
|
-
```
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# Update Method Count Report
|
2
|
-
|
3
|
-
You are a data updater responsible for adding analysis results to a report.
|
4
|
-
|
5
|
-
## Input
|
6
|
-
- File path: <%= file_path %>
|
7
|
-
- Method count: <%= method_count %>
|
8
|
-
- Current report data: <%= current_report %>
|
9
|
-
|
10
|
-
## Task
|
11
|
-
1. Parse the current report data as JSON
|
12
|
-
2. Add the new file analysis results to the report's "results" array
|
13
|
-
3. Increment the "files_analyzed" counter by 1
|
14
|
-
4. Add the method count to the "total_methods" counter
|
15
|
-
5. Return the updated JSON report
|
16
|
-
|
17
|
-
## Response Format
|
18
|
-
Return a JSON object with the updated report structure:
|
19
|
-
```json
|
20
|
-
{
|
21
|
-
"files_analyzed": 10,
|
22
|
-
"total_methods": 45,
|
23
|
-
"results": [
|
24
|
-
{"file_path": "file1.rb", "method_count": 5, "method_names": ["method1", "method2", ...]},
|
25
|
-
{"file_path": "file2.rb", "method_count": 3, "method_names": ["methodA", "methodB", ...]},
|
26
|
-
...
|
27
|
-
]
|
28
|
-
}
|
29
|
-
```
|