roast-ai 0.4.6 → 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.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +3 -1
  3. data/.gitignore +7 -0
  4. data/.rubocop.yml +14 -0
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +9 -1
  7. data/Rakefile +16 -4
  8. data/examples/README.md +9 -0
  9. data/examples/available_tools_demo/workflow.yml +2 -2
  10. data/examples/basic_prompt_workflow/workflow.md +1 -0
  11. data/examples/basic_prompt_workflow/workflow.yml +14 -0
  12. data/lib/roast/dsl/executor.rb +2 -1
  13. data/lib/roast/helpers/cmd_runner.rb +199 -0
  14. data/lib/roast/initializers.rb +1 -1
  15. data/lib/roast/tools/apply_diff.rb +1 -1
  16. data/lib/roast/tools/bash.rb +4 -4
  17. data/lib/roast/tools/cmd.rb +3 -5
  18. data/lib/roast/tools/coding_agent.rb +1 -1
  19. data/lib/roast/tools/grep.rb +6 -2
  20. data/lib/roast/tools/read_file.rb +2 -1
  21. data/lib/roast/tools/swarm.rb +2 -7
  22. data/lib/roast/tools.rb +10 -1
  23. data/lib/roast/version.rb +1 -1
  24. data/lib/roast/workflow/base_step.rb +2 -3
  25. data/lib/roast/workflow/command_executor.rb +3 -3
  26. data/lib/roast/workflow/resource_resolver.rb +1 -1
  27. data/lib/roast/workflow/shell_script_step.rb +1 -1
  28. data/lib/roast/workflow/step_loader.rb +2 -7
  29. data/lib/roast.rb +7 -1
  30. data/rubocop/cop/roast/use_cmd_runner.rb +93 -0
  31. data/rubocop/cop/roast.rb +4 -0
  32. data/sorbet/rbi/gems/docile@1.4.1.rbi +377 -0
  33. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +233 -2
  34. data/sorbet/rbi/gems/racc@1.8.1.rbi +6 -4
  35. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +396 -2
  36. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3788 -2
  37. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +7747 -2
  38. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +2386 -0
  39. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +62813 -2
  40. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1311 -2
  41. data/sorbet/rbi/gems/simplecov-html@0.13.2.rbi +225 -0
  42. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2259 -0
  43. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +9 -0
  44. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +125 -2
  45. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +244 -2
  46. data/sorbet/tapioca/require.rb +2 -1
  47. metadata +12 -240
  48. data/CHANGELOG.md +0 -364
  49. data/examples/agent_continue/add_documentation/prompt.md +0 -5
  50. data/examples/agent_continue/add_error_handling/prompt.md +0 -5
  51. data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
  52. data/examples/agent_continue/combined_workflow.yml +0 -24
  53. data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
  54. data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
  55. data/examples/agent_continue/document_with_context/prompt.md +0 -5
  56. data/examples/agent_continue/explore_api/prompt.md +0 -6
  57. data/examples/agent_continue/implement_client/prompt.md +0 -6
  58. data/examples/agent_continue/inline_workflow.yml +0 -20
  59. data/examples/agent_continue/refactor_code/prompt.md +0 -2
  60. data/examples/agent_continue/verify_changes/prompt.md +0 -6
  61. data/examples/agent_continue/workflow.yml +0 -27
  62. data/examples/agent_workflow/README.md +0 -75
  63. data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
  64. data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
  65. data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
  66. data/examples/agent_workflow/workflow.png +0 -0
  67. data/examples/agent_workflow/workflow.yml +0 -16
  68. data/examples/api_workflow/README.md +0 -85
  69. data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
  70. data/examples/api_workflow/generate_report/prompt.md +0 -10
  71. data/examples/api_workflow/prompt.md +0 -10
  72. data/examples/api_workflow/transform_data/prompt.md +0 -10
  73. data/examples/api_workflow/workflow.png +0 -0
  74. data/examples/api_workflow/workflow.yml +0 -30
  75. data/examples/apply_diff_demo/README.md +0 -58
  76. data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
  77. data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
  78. data/examples/apply_diff_demo/workflow.yml +0 -24
  79. data/examples/available_tools_demo/workflow.png +0 -0
  80. data/examples/bash_prototyping/README.md +0 -53
  81. data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
  82. data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
  83. data/examples/bash_prototyping/api_testing.png +0 -0
  84. data/examples/bash_prototyping/api_testing.yml +0 -14
  85. data/examples/bash_prototyping/check_processes/prompt.md +0 -11
  86. data/examples/bash_prototyping/generate_report/prompt.md +0 -16
  87. data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
  88. data/examples/bash_prototyping/system_analysis.png +0 -0
  89. data/examples/bash_prototyping/system_analysis.yml +0 -14
  90. data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
  91. data/examples/case_when/README.md +0 -58
  92. data/examples/case_when/detect_language/prompt.md +0 -16
  93. data/examples/case_when/workflow.png +0 -0
  94. data/examples/case_when/workflow.yml +0 -58
  95. data/examples/cmd/README.md +0 -99
  96. data/examples/cmd/analyze_project/prompt.md +0 -57
  97. data/examples/cmd/basic_demo/prompt.md +0 -48
  98. data/examples/cmd/basic_workflow.png +0 -0
  99. data/examples/cmd/basic_workflow.yml +0 -17
  100. data/examples/cmd/check_repository/prompt.md +0 -57
  101. data/examples/cmd/create_and_verify/prompt.md +0 -56
  102. data/examples/cmd/dev_workflow.png +0 -0
  103. data/examples/cmd/dev_workflow.yml +0 -26
  104. data/examples/cmd/explore_project/prompt.md +0 -67
  105. data/examples/cmd/explorer_workflow.png +0 -0
  106. data/examples/cmd/explorer_workflow.yml +0 -21
  107. data/examples/cmd/smart_tool_selection/prompt.md +0 -99
  108. data/examples/coding_agent_with_model.yml +0 -20
  109. data/examples/coding_agent_with_retries.yml +0 -30
  110. data/examples/conditional/README.md +0 -161
  111. data/examples/conditional/check_condition/prompt.md +0 -1
  112. data/examples/conditional/simple_workflow.png +0 -0
  113. data/examples/conditional/simple_workflow.yml +0 -15
  114. data/examples/conditional/workflow.png +0 -0
  115. data/examples/conditional/workflow.yml +0 -23
  116. data/examples/context_management_demo/README.md +0 -43
  117. data/examples/context_management_demo/workflow.yml +0 -42
  118. data/examples/direct_coerce_syntax/README.md +0 -32
  119. data/examples/direct_coerce_syntax/workflow.png +0 -0
  120. data/examples/direct_coerce_syntax/workflow.yml +0 -36
  121. data/examples/dot_notation/README.md +0 -37
  122. data/examples/dot_notation/workflow.png +0 -0
  123. data/examples/dot_notation/workflow.yml +0 -44
  124. data/examples/exit_on_error/README.md +0 -50
  125. data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
  126. data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
  127. data/examples/exit_on_error/workflow.png +0 -0
  128. data/examples/exit_on_error/workflow.yml +0 -19
  129. data/examples/grading/README.md +0 -71
  130. data/examples/grading/analyze_coverage/prompt.md +0 -52
  131. data/examples/grading/calculate_final_grade.rb +0 -67
  132. data/examples/grading/format_result.rb +0 -64
  133. data/examples/grading/generate_grades/prompt.md +0 -105
  134. data/examples/grading/generate_recommendations/output.txt +0 -17
  135. data/examples/grading/generate_recommendations/prompt.md +0 -60
  136. data/examples/grading/js_test_runner +0 -31
  137. data/examples/grading/rb_test_runner +0 -19
  138. data/examples/grading/read_dependencies/prompt.md +0 -16
  139. data/examples/grading/run_coverage.rb +0 -54
  140. data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
  141. data/examples/grading/verify_test_helpers/prompt.md +0 -53
  142. data/examples/grading/workflow.md +0 -8
  143. data/examples/grading/workflow.png +0 -0
  144. data/examples/grading/workflow.rb.md +0 -6
  145. data/examples/grading/workflow.ts+tsx.md +0 -6
  146. data/examples/grading/workflow.yml +0 -41
  147. data/examples/instrumentation.rb +0 -76
  148. data/examples/interpolation/README.md +0 -50
  149. data/examples/interpolation/analyze_file/prompt.md +0 -1
  150. data/examples/interpolation/analyze_patterns/prompt.md +0 -27
  151. data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
  152. data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
  153. data/examples/interpolation/sample.js +0 -48
  154. data/examples/interpolation/sample.rb +0 -42
  155. data/examples/interpolation/workflow.md +0 -1
  156. data/examples/interpolation/workflow.png +0 -0
  157. data/examples/interpolation/workflow.yml +0 -21
  158. data/examples/iteration/IMPLEMENTATION.md +0 -88
  159. data/examples/iteration/README.md +0 -68
  160. data/examples/iteration/analyze_complexity/prompt.md +0 -22
  161. data/examples/iteration/generate_recommendations/prompt.md +0 -21
  162. data/examples/iteration/generate_report/prompt.md +0 -129
  163. data/examples/iteration/implement_fix/prompt.md +0 -25
  164. data/examples/iteration/prioritize_issues/prompt.md +0 -24
  165. data/examples/iteration/prompts/analyze_file.md +0 -28
  166. data/examples/iteration/prompts/generate_summary.md +0 -24
  167. data/examples/iteration/prompts/update_report.md +0 -29
  168. data/examples/iteration/prompts/write_report.md +0 -22
  169. data/examples/iteration/read_file/prompt.md +0 -9
  170. data/examples/iteration/select_next_issue/prompt.md +0 -25
  171. data/examples/iteration/simple_workflow.md +0 -39
  172. data/examples/iteration/simple_workflow.yml +0 -58
  173. data/examples/iteration/update_fix_count/prompt.md +0 -26
  174. data/examples/iteration/verify_fix/prompt.md +0 -29
  175. data/examples/iteration/workflow.png +0 -0
  176. data/examples/iteration/workflow.yml +0 -42
  177. data/examples/json_handling/README.md +0 -32
  178. data/examples/json_handling/workflow.png +0 -0
  179. data/examples/json_handling/workflow.yml +0 -52
  180. data/examples/mcp/README.md +0 -223
  181. data/examples/mcp/analyze_changes/prompt.md +0 -8
  182. data/examples/mcp/analyze_issues/prompt.md +0 -4
  183. data/examples/mcp/analyze_schema/prompt.md +0 -4
  184. data/examples/mcp/check_data_quality/prompt.md +0 -5
  185. data/examples/mcp/check_documentation/prompt.md +0 -4
  186. data/examples/mcp/create_recommendations/prompt.md +0 -5
  187. data/examples/mcp/database_workflow.png +0 -0
  188. data/examples/mcp/database_workflow.yml +0 -29
  189. data/examples/mcp/env_demo/workflow.png +0 -0
  190. data/examples/mcp/env_demo/workflow.yml +0 -34
  191. data/examples/mcp/fetch_pr_context/prompt.md +0 -4
  192. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
  193. data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
  194. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
  195. data/examples/mcp/filesystem_demo/workflow.png +0 -0
  196. data/examples/mcp/filesystem_demo/workflow.yml +0 -38
  197. data/examples/mcp/generate_insights/prompt.md +0 -4
  198. data/examples/mcp/generate_report/prompt.md +0 -6
  199. data/examples/mcp/generate_review/prompt.md +0 -16
  200. data/examples/mcp/github_workflow.png +0 -0
  201. data/examples/mcp/github_workflow.yml +0 -32
  202. data/examples/mcp/multi_mcp_workflow.png +0 -0
  203. data/examples/mcp/multi_mcp_workflow.yml +0 -58
  204. data/examples/mcp/post_review/prompt.md +0 -3
  205. data/examples/mcp/save_report/prompt.md +0 -6
  206. data/examples/mcp/search_issues/prompt.md +0 -2
  207. data/examples/mcp/summarize/prompt.md +0 -1
  208. data/examples/mcp/test_filesystem/prompt.md +0 -6
  209. data/examples/mcp/test_github/prompt.md +0 -8
  210. data/examples/mcp/test_read/prompt.md +0 -1
  211. data/examples/mcp/workflow.png +0 -0
  212. data/examples/mcp/workflow.yml +0 -35
  213. data/examples/no_model_fallback/README.md +0 -17
  214. data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
  215. data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
  216. data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
  217. data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
  218. data/examples/no_model_fallback/sample.rb +0 -42
  219. data/examples/no_model_fallback/workflow.yml +0 -19
  220. data/examples/openrouter_example/README.md +0 -48
  221. data/examples/openrouter_example/analyze_input/prompt.md +0 -16
  222. data/examples/openrouter_example/generate_response/prompt.md +0 -9
  223. data/examples/openrouter_example/workflow.png +0 -0
  224. data/examples/openrouter_example/workflow.yml +0 -12
  225. data/examples/pre_post_processing/README.md +0 -111
  226. data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
  227. data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
  228. data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
  229. data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
  230. data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
  231. data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
  232. data/examples/pre_post_processing/post_processing/output.txt +0 -24
  233. data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
  234. data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
  235. data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
  236. data/examples/pre_post_processing/workflow.png +0 -0
  237. data/examples/pre_post_processing/workflow.yml +0 -21
  238. data/examples/retry/workflow.yml +0 -23
  239. data/examples/rspec_to_minitest/README.md +0 -68
  240. data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
  241. data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
  242. data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
  243. data/examples/rspec_to_minitest/workflow.md +0 -10
  244. data/examples/rspec_to_minitest/workflow.png +0 -0
  245. data/examples/rspec_to_minitest/workflow.yml +0 -40
  246. data/examples/shared_config/README.md +0 -52
  247. data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
  248. data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
  249. data/examples/shared_config/shared.png +0 -0
  250. data/examples/shared_config/shared.yml +0 -7
  251. data/examples/single_target_prepost/README.md +0 -36
  252. data/examples/single_target_prepost/post_processing/output.txt +0 -27
  253. data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
  254. data/examples/single_target_prepost/workflow.png +0 -0
  255. data/examples/single_target_prepost/workflow.yml +0 -20
  256. data/examples/smart_coercion_defaults/README.md +0 -65
  257. data/examples/smart_coercion_defaults/workflow.png +0 -0
  258. data/examples/smart_coercion_defaults/workflow.yml +0 -44
  259. data/examples/step_configuration/README.md +0 -84
  260. data/examples/step_configuration/workflow.png +0 -0
  261. data/examples/step_configuration/workflow.yml +0 -57
  262. data/examples/swarm_example.yml +0 -25
  263. data/examples/tool_config_example/README.md +0 -109
  264. data/examples/tool_config_example/example_step/prompt.md +0 -42
  265. data/examples/tool_config_example/workflow.png +0 -0
  266. data/examples/tool_config_example/workflow.yml +0 -17
  267. data/examples/user_input/README.md +0 -90
  268. data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
  269. data/examples/user_input/funny_name/workflow.png +0 -0
  270. data/examples/user_input/funny_name/workflow.yml +0 -26
  271. data/examples/user_input/generate_summary/prompt.md +0 -11
  272. data/examples/user_input/simple_input_demo/workflow.png +0 -0
  273. data/examples/user_input/simple_input_demo/workflow.yml +0 -35
  274. data/examples/user_input/survey_workflow.png +0 -0
  275. data/examples/user_input/survey_workflow.yml +0 -71
  276. data/examples/user_input/welcome_message/prompt.md +0 -3
  277. data/examples/user_input/workflow.png +0 -0
  278. data/examples/user_input/workflow.yml +0 -73
  279. data/examples/workflow_generator/README.md +0 -27
  280. data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
  281. data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
  282. data/examples/workflow_generator/get_user_input/prompt.md +0 -14
  283. data/examples/workflow_generator/info_from_roast.rb +0 -22
  284. data/examples/workflow_generator/workflow.png +0 -0
  285. data/examples/workflow_generator/workflow.yml +0 -34
  286. data/lib/roast/helpers/timeout_handler.rb +0 -89
@@ -1,3 +0,0 @@
1
- Generate a nicely formatted report based on the following metadata:
2
-
3
- <%= workflow.output[:analyze_patterns] %>
@@ -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,19 +0,0 @@
1
- name: no_model_fallback_example
2
-
3
- tools:
4
- - Roast::Tools::ReadFile
5
-
6
- steps:
7
- - analyze_file
8
- - analyze_patterns
9
- - generate_report_for_{{File.extname(workflow.file).sub('.', '')}}
10
- - '$(echo "Processing completed for file: {{File.basename(workflow.file)}}")'
11
-
12
- analyze_patterns:
13
- json: true
14
-
15
- generate_report_for_rb:
16
- print_response: true
17
-
18
- generate_report_for_md:
19
- print_response: true
@@ -1,48 +0,0 @@
1
- # OpenRouter Example
2
-
3
- This example demonstrates how to use OpenRouter with Roast to access models from different providers through a single API.
4
-
5
- ## Setup
6
-
7
- 1. Sign up for an account at [OpenRouter](https://openrouter.ai/)
8
- 2. Get your API key from the OpenRouter dashboard
9
- 3. Set the API key as an environment variable:
10
- ```bash
11
- export OPENROUTER_API_KEY=your_api_key_here
12
- ```
13
-
14
- ## Running the Example
15
-
16
- ```bash
17
- # Run without a specific target (general analysis)
18
- roast execute workflow.yml
19
-
20
- # Run with a specific file to analyze
21
- roast execute workflow.yml path/to/your/file.txt
22
- ```
23
-
24
- ## How it Works
25
-
26
- This example configures Roast to use OpenRouter as the API provider:
27
-
28
- ```yaml
29
- api_provider: openrouter
30
- api_token: $(echo $OPENROUTER_API_KEY)
31
- model: anthropic/claude-3-haiku-20240307
32
- ```
33
-
34
- The workflow consists of two steps:
35
- 1. `analyze_input`: Analyzes the provided content (or generates general insights if no target is provided)
36
- 2. `generate_response`: Creates a structured response based on the analysis
37
-
38
- ## Available Models
39
-
40
- When using OpenRouter, you can access models from multiple providers by specifying the fully qualified model name, including the provider prefix. Some examples:
41
-
42
- - `anthropic/claude-3-opus-20240229`
43
- - `anthropic/claude-3-sonnet-20240229`
44
- - `meta/llama-3-70b-instruct`
45
- - `google/gemini-1.5-pro-latest`
46
- - `mistral/mistral-large-latest`
47
-
48
- Check the [OpenRouter documentation](https://openrouter.ai/docs) for the complete list of supported models.
@@ -1,16 +0,0 @@
1
- I'd like you to analyze the following input and provide your insights.
2
-
3
- <% if workflow.file && workflow.resource.content %>
4
- Here is the content to analyze:
5
-
6
- ```
7
- <%= workflow.resource.content %>
8
- ```
9
- <% else %>
10
- The workflow is running without a specific file target. Please provide general insights based on the context.
11
- <% end %>
12
-
13
- Please provide:
14
- 1. A summary of the key points
15
- 2. Any notable patterns or issues
16
- 3. Recommendations based on your analysis
@@ -1,9 +0,0 @@
1
- Based on the analysis from the previous step, please generate a response that addresses the findings.
2
-
3
- Your response should be well-structured and include:
4
- 1. An introduction summarizing the analysis
5
- 2. Detailed discussion of key points
6
- 3. Clear recommendations for improvements
7
- 4. A conclusion
8
-
9
- Format the response in markdown for better readability.
@@ -1,12 +0,0 @@
1
- name: OpenRouter Example
2
- api_provider: openrouter
3
- api_token: $(echo $OPENROUTER_API_KEY)
4
- model: google/gemini-2.0-flash-001
5
-
6
- tools:
7
- - Roast::Tools::ReadFile
8
- - Roast::Tools::WriteFile
9
-
10
- steps:
11
- - analyze_input
12
- - generate_response
@@ -1,111 +0,0 @@
1
- # Pre/Post Processing Example: Test Suite Optimization
2
-
3
- This example demonstrates how to use Roast's pre/post processing framework to optimize an entire test suite across multiple files.
4
-
5
- ## Overview
6
-
7
- The workflow processes multiple test files, but performs setup and aggregation tasks only once:
8
-
9
- - **Pre-processing**: Runs once before any test files are processed
10
- - Gathers baseline metrics for comparison
11
- - Sets up the test environment
12
-
13
- - **Main workflow**: Runs for each test file matching the target pattern
14
- - Analyzes test quality and coverage
15
- - Improves test coverage
16
- - Optimizes test performance
17
- - Validates changes
18
-
19
- - **Post-processing**: Runs once after all test files have been processed
20
- - Aggregates metrics from all files
21
- - Generates a comprehensive report
22
- - Cleans up the environment
23
-
24
- ## Workflow Structure
25
-
26
- ```yaml
27
- name: test_optimization
28
- model: gpt-4o
29
- target: "test/**/*_test.rb"
30
-
31
- pre_processing:
32
- - gather_baseline_metrics
33
- - setup_test_environment
34
-
35
- steps:
36
- - analyze_test_file
37
- - improve_test_coverage
38
- - optimize_test_performance
39
- - validate_changes
40
-
41
- post_processing:
42
- - aggregate_metrics
43
- - generate_summary_report
44
- - cleanup_environment
45
- ```
46
-
47
- ## Directory Structure
48
-
49
- ```
50
- pre_post_processing/
51
- ├── workflow.yml
52
- ├── pre_processing/
53
- │ ├── gather_baseline_metrics/
54
- │ │ └── prompt.md
55
- │ └── setup_test_environment/
56
- │ └── prompt.md
57
- ├── analyze_test_file/
58
- │ └── prompt.md
59
- ├── improve_test_coverage/
60
- │ └── prompt.md
61
- ├── optimize_test_performance/
62
- │ └── prompt.md
63
- ├── validate_changes/
64
- │ └── prompt.md
65
- └── post_processing/
66
- ├── aggregate_metrics/
67
- │ └── prompt.md
68
- ├── generate_summary_report/
69
- │ └── prompt.md
70
- └── cleanup_environment/
71
- └── prompt.md
72
- ```
73
-
74
- ## Key Features Demonstrated
75
-
76
- 1. **Shared State**: Pre-processing results are available to all subsequent steps
77
- 2. **Result Aggregation**: Post-processing has access to results from all workflow executions
78
- 3. **One-time Operations**: Setup and cleanup happen only once, regardless of target count
79
- 4. **Metrics Collection**: Each file's results are stored and aggregated for reporting
80
-
81
- ## Running the Example
82
-
83
- ```bash
84
- cd examples/pre_post_processing
85
- roast workflow.yml
86
- ```
87
-
88
- This will:
89
- 1. Run pre-processing steps once
90
- 2. Process each test file matching `test/**/*_test.rb`
91
- 3. Run post-processing steps once with access to all results
92
- 4. Generate a comprehensive optimization report
93
-
94
- ## Use Cases
95
-
96
- This pattern is ideal for:
97
- - **Code migrations**: Setup migration tools, process files, generate migration report
98
- - **Performance audits**: Baseline metrics, analyze files, aggregate improvements
99
- - **Documentation generation**: Analyze codebase, generate docs per file, create index
100
- - **Dependency updates**: Check current versions, update files, verify compatibility
101
- - **Security scanning**: Setup scanners, check each file, generate security report
102
-
103
- ## Customization
104
-
105
- To adapt this example for your use case:
106
-
107
- 1. Update the `target` pattern to match your files
108
- 2. Modify pre-processing steps for your setup needs
109
- 3. Adjust main workflow steps for your processing logic
110
- 4. Customize post-processing for your reporting requirements
111
- 5. Use appropriate AI models for each step type
@@ -1,23 +0,0 @@
1
- # Analyze Test File
2
-
3
- Current test file: <%= file %>
4
-
5
- Please analyze this test file and identify:
6
-
7
- 1. **Test Structure**: Number of test cases, test suites, and overall organization
8
- 2. **Coverage Gaps**: Areas of the code that aren't adequately tested
9
- 3. **Test Quality Issues**:
10
- - Tests that are too brittle or implementation-dependent
11
- - Missing edge cases
12
- - Unclear test descriptions
13
- - Excessive mocking that reduces test value
14
- 4. **Performance Issues**:
15
- - Slow setup/teardown methods
16
- - Inefficient test data generation
17
- - Unnecessary database operations
18
- 5. **Opportunities for Improvement**:
19
- - Tests that could be parameterized
20
- - Common patterns that could be extracted to helpers
21
- - Better use of test fixtures or factories
22
-
23
- Provide specific, actionable recommendations for each issue found.
@@ -1,17 +0,0 @@
1
- # Improve Test Coverage
2
-
3
- Based on the analysis of <%= file %>, implement the following improvements:
4
-
5
- 1. **Add Missing Test Cases**: Write tests for uncovered code paths, edge cases, and error conditions
6
- 2. **Improve Test Descriptions**: Make test names more descriptive and follow consistent naming conventions
7
- 3. **Enhance Assertions**: Add more specific assertions to catch regressions
8
- 4. **Test Data**: Use more realistic test data that better represents production scenarios
9
- 5. **Remove Redundancy**: Eliminate duplicate tests or merge similar ones
10
-
11
- Generate the improved test code and explain the rationale for each change.
12
-
13
- Remember to:
14
- - Maintain backward compatibility with existing test interfaces
15
- - Follow the project's testing conventions and style guide
16
- - Ensure new tests are fast and deterministic
17
- - Add appropriate comments for complex test scenarios
@@ -1,25 +0,0 @@
1
- # Optimize Test Performance
2
-
3
- Optimize the performance of <%= file %> by:
4
-
5
- 1. **Reduce Setup Overhead**:
6
- - Move expensive operations out of individual test setup
7
- - Use shared fixtures where appropriate
8
- - Lazy-load test data only when needed
9
-
10
- 2. **Optimize Database Operations**:
11
- - Use transactions for test isolation instead of truncation
12
- - Minimize database queries in tests
13
- - Use in-memory databases where possible
14
-
15
- 3. **Improve Test Isolation**:
16
- - Remove unnecessary dependencies between tests
17
- - Clean up resources properly to avoid test pollution
18
- - Use proper test doubles instead of hitting external services
19
-
20
- 4. **Parallelize When Possible**:
21
- - Identify tests that can run in parallel
22
- - Remove shared state that prevents parallelization
23
- - Group related tests for better cache utilization
24
-
25
- Generate the optimized test code and provide before/after performance metrics estimates.
@@ -1,31 +0,0 @@
1
- # Aggregate Metrics
2
-
3
- Aggregate all the metrics collected during the workflow execution:
4
-
5
- Available data:
6
- - Pre-processing baseline metrics: <%= pre_processing.gather_baseline_metrics %>
7
- - Results from all processed test files: <%= output.targets %>
8
-
9
- Please calculate and provide:
10
-
11
- 1. **Overall Coverage Improvement**:
12
- - Total coverage before and after
13
- - Percentage improvement
14
- - Files with biggest improvements
15
-
16
- 2. **Performance Gains**:
17
- - Total execution time saved
18
- - Average performance improvement per file
19
- - Files with best optimization results
20
-
21
- 3. **Test Quality Metrics**:
22
- - Number of new tests added
23
- - Number of tests optimized
24
- - Reduction in flaky/brittle tests
25
-
26
- 4. **Summary Statistics**:
27
- - Total files processed
28
- - Success rate
29
- - Any files that had issues
30
-
31
- Output a comprehensive metrics summary that can be used in the final report.
@@ -1,28 +0,0 @@
1
- # Cleanup Environment
2
-
3
- Perform post-optimization cleanup tasks:
4
-
5
- 1. **Commit Changes**: Create a commit with all the test improvements
6
- - Use a descriptive commit message summarizing the optimization results
7
- - Include key metrics in the commit description
8
-
9
- 2. **Update Documentation**:
10
- - Update test documentation if structure changed significantly
11
- - Add notes about any new test helpers or patterns introduced
12
-
13
- 3. **Clean Temporary Files**:
14
- - Remove any temporary files created during optimization
15
- - Clear test caches that were used for benchmarking
16
-
17
- 4. **Final Verification**:
18
- - Run the full test suite one more time to ensure everything works
19
- - Verify CI/CD pipelines will work with the changes
20
-
21
- 5. **Create PR Description**:
22
- - Generate a pull request description template with:
23
- - Summary of changes
24
- - Key metrics improvements
25
- - Any breaking changes or considerations
26
- - Review checklist
27
-
28
- Output a summary of cleanup actions performed and any final notes for the team.
@@ -1,32 +0,0 @@
1
- # Generate Summary Report
2
-
3
- Generate a comprehensive test optimization report based on all the collected data:
4
-
5
- ## Test Suite Optimization Report
6
-
7
- ### Executive Summary
8
- Provide a high-level overview of the optimization results, key achievements, and any issues encountered.
9
-
10
- ### Metrics Summary
11
- Include the aggregated metrics from the previous step:
12
- <%= aggregate_metrics %>
13
-
14
- ### Detailed Results by File
15
- For each processed test file, include:
16
- - File name and path
17
- - Coverage improvement
18
- - Performance improvement
19
- - Number of tests added/modified
20
- - Key changes made
21
-
22
- ### Recommendations
23
- Based on the optimization results, provide:
24
- 1. Further optimization opportunities
25
- 2. Best practices observed that should be adopted project-wide
26
- 3. Common patterns that could be extracted into shared utilities
27
- 4. Testing strategy improvements
28
-
29
- ### Next Steps
30
- Suggest follow-up actions to maintain and build upon these improvements.
31
-
32
- Format the report in Markdown for easy sharing and include visual indicators (✅ ❌ ⚠️) for quick scanning.
@@ -1,24 +0,0 @@
1
- === Test Optimization Summary Report ===
2
- Generated at: <%= Time.now.strftime("%Y-%m-%d %H:%M:%S") %>
3
-
4
- ## Baseline Metrics
5
- <%= pre_processing.gather_baseline_metrics %>
6
-
7
- ## Files Processed
8
- Total files: <%= targets.size %>
9
-
10
- <% targets.each do |file, target| %>
11
- ### <%= file %>
12
- Analysis: <%= target.output.analyze_test_file %>
13
- Coverage improvements: <%= target.output.improve_test_coverage %>
14
- Performance optimizations: <%= target.output.optimize_test_performance %>
15
- <% end %>
16
-
17
- ## Post-Processing Results
18
- ### Aggregated Metrics
19
- <%= output.aggregate_metrics %>
20
-
21
- ### Summary Report
22
- <%= output.generate_summary_report %>
23
-
24
- === End of Report ===
@@ -1,26 +0,0 @@
1
- # Gather Baseline Metrics
2
-
3
- Analyze the current test suite and gather baseline metrics for comparison. Please provide:
4
-
5
- 1. Total number of test files to be processed
6
- 2. Current overall test coverage percentage
7
- 3. Average test execution time across all files
8
- 4. Number of tests by type (unit, integration, system)
9
- 5. Any test files that are particularly slow (> 5 seconds)
10
-
11
- Store these metrics in the workflow state for later comparison in post-processing.
12
-
13
- Output format:
14
- ```json
15
- {
16
- "total_test_files": 0,
17
- "overall_coverage": 0.0,
18
- "average_execution_time": 0.0,
19
- "test_counts": {
20
- "unit": 0,
21
- "integration": 0,
22
- "system": 0
23
- },
24
- "slow_tests": []
25
- }
26
- ```
@@ -1,11 +0,0 @@
1
- # Setup Test Environment
2
-
3
- Prepare the test environment for optimization. Please:
4
-
5
- 1. Ensure all test dependencies are installed
6
- 2. Create a backup branch for safety: `test-optimization-backup-<%= timestamp %>`
7
- 3. Set up any necessary test databases or fixtures
8
- 4. Configure test parallelization settings if available
9
- 5. Clear any test caches that might affect benchmarking
10
-
11
- Return a summary of the setup steps completed and any warnings or issues encountered.
@@ -1,24 +0,0 @@
1
- # Validate Changes
2
-
3
- Validate the changes made to <%= file %>:
4
-
5
- 1. **Run the updated tests** and ensure they all pass
6
- 2. **Check coverage metrics** to verify improvements
7
- 3. **Measure execution time** to confirm performance gains
8
- 4. **Verify no regressions** were introduced
9
- 5. **Ensure code style** follows project conventions
10
-
11
- Store the validation results in the workflow state:
12
- ```json
13
- {
14
- "file": "<%= file %>",
15
- "tests_passed": true,
16
- "coverage_before": 0.0,
17
- "coverage_after": 0.0,
18
- "execution_time_before": 0.0,
19
- "execution_time_after": 0.0,
20
- "issues_found": []
21
- }
22
- ```
23
-
24
- If any issues are found, provide recommendations for fixing them.
@@ -1,21 +0,0 @@
1
- name: test_optimization
2
- model: gpt-4o
3
- target: "test/**/*_test.rb"
4
-
5
- # Pre-processing steps run once before any test files are processed
6
- pre_processing:
7
- - gather_baseline_metrics
8
- - setup_test_environment
9
-
10
- # Main workflow steps run for each test file
11
- steps:
12
- - analyze_test_file
13
- - improve_test_coverage
14
- - optimize_test_performance
15
- - validate_changes
16
-
17
- # Post-processing steps run once after all test files have been processed
18
- post_processing:
19
- - aggregate_metrics
20
- - generate_summary_report
21
- - cleanup_environment
@@ -1,23 +0,0 @@
1
- description: Demonstrate retry functionality for steps
2
-
3
- # This example shows how to configure steps to automatically retry on failure
4
- # The 'retries' parameter specifies how many times to retry a failing step
5
-
6
- steps:
7
- - check_network: "$(curl -f -s -o /dev/null -w '%{http_code}' https://httpstat.us/500)"
8
- - process_data: "Process important data that might fail transiently"
9
- - flaky_command: "$(./flaky_script.sh)"
10
-
11
- # Configuration for each step
12
- check_network:
13
- retries: 3 # Will retry up to 3 times if it fails
14
- exit_on_error: true # Will exit workflow if all retries fail
15
-
16
- process_data:
17
- model: gpt-4o-mini
18
- retries: 2 # Will retry up to 2 times
19
-
20
- # Command with retries but won't exit on error after all retries fail
21
- flaky_command:
22
- retries: 5
23
- exit_on_error: false # Continue workflow even after all retries fail
@@ -1,68 +0,0 @@
1
- # RSpec to Minitest Migration Workflow
2
-
3
- This workflow demonstrates how to automate the migration of RSpec tests to their Minitest equivalents, following a structured approach to ensure proper test coverage and functionality.
4
-
5
- ## Workflow Overview
6
-
7
- The workflow consists of three main steps:
8
-
9
- 1. **Analyze Spec**: Understand the purpose and structure of the RSpec test, including its dependencies and testing patterns.
10
- 2. **Create Minitest**: Generate a new Minitest file with equivalent test coverage and assertions.
11
- 3. **Run and Improve**: Execute the Minitest file and iteratively improve it until all tests pass.
12
-
13
- ## Prerequisites
14
-
15
- - Ruby environment with both RSpec and Minitest gems installed
16
- - Access to the original codebase being tested
17
- - Ability to run tests in the target environment
18
-
19
- ## Usage
20
-
21
- To use this workflow:
22
-
23
- 1. Configure the target pattern in `workflow.yml` to match the RSpec files you want to convert (or pass in via CLI --target option):
24
- ```yaml
25
- target: "path/to/specs/**/*_spec.rb"
26
- ```
27
-
28
- 2. Run the workflow with:
29
- ```
30
- roast execute examples/rspec_to_minitest/workflow.yml
31
- ```
32
-
33
- 3. Review the generated Minitest files and ensure they're correctly placed in your test directory.
34
-
35
- ## Implementation Details
36
-
37
- The workflow leverages the following tools:
38
-
39
- - Standard file operations (read/write)
40
- - Code search capabilities to find related files
41
- - Command execution to run tests
42
- - CodingAgent for iterative improvements using AI-powered coding assistance
43
-
44
- ## Required Tool: CodingAgent
45
-
46
- This workflow introduces a new tool called `CodingAgent` which leverages Claude Code to perform code-related tasks:
47
-
48
- 1. Running tests
49
- 2. Analyzing errors and failures
50
- 3. Making iterative improvements to code
51
-
52
- The CodingAgent tool is implemented in `lib/roast/tools/coding_agent.rb`.
53
-
54
- ## Conversion Mappings
55
-
56
- The workflow handles these common RSpec to Minitest conversions:
57
-
58
- | RSpec Feature | Minitest Equivalent |
59
- |---------------|---------------------|
60
- | `describe/context` | Test class |
61
- | `it` blocks | `test_*` methods |
62
- | `before/after` | `setup/teardown` methods |
63
- | `let/let!` | Instance variables or helper methods |
64
- | `expect(x).to eq(y)` | `assert_equal y, x` |
65
- | `expect(x).to be_truthy` | `assert x` |
66
- | `expect(x).to be_falsey` | `refute x` |
67
- | `expect { ... }.to raise_error` | `assert_raises { ... }` |
68
- | Mocks/doubles | Minitest mocking or Mocha |
@@ -1,30 +0,0 @@
1
- In this first step, try to understand the purpose and dependencies of the spec we will be migrating.
2
-
3
- 1. Read the provided RSpec file carefully to understand:
4
- - The purpose of the test suite
5
- - The subject under test (SUT)
6
- - Test structure and organization
7
- - Dependencies and fixtures used
8
- - Mocks, stubs, and doubles
9
-
10
- 2. Use your tools to search for the SUT implementation and any other important dependent files so that they will be in the context for future steps in this process.
11
- - Dependencies include fixtures
12
- - Note that test/fixtures already has quite a bit of fixture files present
13
- - If any fixtures are missing, copy them over when you write the new test file later
14
-
15
- 3. Identify RSpec-specific features being used, such as:
16
- - describe/context blocks
17
- - before/after hooks
18
- - let and let! declarations
19
- - expect(...).to syntax and matchers
20
- - shared examples/contexts
21
- - metadata and tags
22
-
23
- 4. Provide a summary of your analysis, including:
24
- - Purpose of the test suite
25
- - Main subject under test
26
- - Key dependencies
27
- - Testing patterns used
28
- - Any potentially challenging aspects for Minitest conversion
29
-
30
- This analysis will guide the next steps of creating an equivalent Minitest implementation.