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.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/Rakefile +2 -0
  4. data/examples/README.md +9 -0
  5. data/examples/available_tools_demo/workflow.yml +1 -1
  6. data/examples/basic_prompt_workflow/workflow.md +1 -0
  7. data/examples/basic_prompt_workflow/workflow.yml +14 -0
  8. data/lib/roast/version.rb +1 -1
  9. data/lib/roast/workflow/base_step.rb +2 -3
  10. data/lib/roast/workflow/step_loader.rb +2 -7
  11. data/lib/roast.rb +6 -1
  12. metadata +4 -239
  13. data/CHANGELOG.md +0 -369
  14. data/examples/agent_continue/add_documentation/prompt.md +0 -5
  15. data/examples/agent_continue/add_error_handling/prompt.md +0 -5
  16. data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
  17. data/examples/agent_continue/combined_workflow.yml +0 -24
  18. data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
  19. data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
  20. data/examples/agent_continue/document_with_context/prompt.md +0 -5
  21. data/examples/agent_continue/explore_api/prompt.md +0 -6
  22. data/examples/agent_continue/implement_client/prompt.md +0 -6
  23. data/examples/agent_continue/inline_workflow.yml +0 -20
  24. data/examples/agent_continue/refactor_code/prompt.md +0 -2
  25. data/examples/agent_continue/verify_changes/prompt.md +0 -6
  26. data/examples/agent_continue/workflow.yml +0 -27
  27. data/examples/agent_workflow/README.md +0 -75
  28. data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
  29. data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
  30. data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
  31. data/examples/agent_workflow/workflow.png +0 -0
  32. data/examples/agent_workflow/workflow.yml +0 -16
  33. data/examples/api_workflow/README.md +0 -85
  34. data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
  35. data/examples/api_workflow/generate_report/prompt.md +0 -10
  36. data/examples/api_workflow/prompt.md +0 -10
  37. data/examples/api_workflow/transform_data/prompt.md +0 -10
  38. data/examples/api_workflow/workflow.png +0 -0
  39. data/examples/api_workflow/workflow.yml +0 -30
  40. data/examples/apply_diff_demo/README.md +0 -58
  41. data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
  42. data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
  43. data/examples/apply_diff_demo/workflow.yml +0 -24
  44. data/examples/available_tools_demo/workflow.png +0 -0
  45. data/examples/bash_prototyping/README.md +0 -53
  46. data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
  47. data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
  48. data/examples/bash_prototyping/api_testing.png +0 -0
  49. data/examples/bash_prototyping/api_testing.yml +0 -14
  50. data/examples/bash_prototyping/check_processes/prompt.md +0 -11
  51. data/examples/bash_prototyping/generate_report/prompt.md +0 -16
  52. data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
  53. data/examples/bash_prototyping/system_analysis.png +0 -0
  54. data/examples/bash_prototyping/system_analysis.yml +0 -14
  55. data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
  56. data/examples/case_when/README.md +0 -58
  57. data/examples/case_when/detect_language/prompt.md +0 -16
  58. data/examples/case_when/workflow.png +0 -0
  59. data/examples/case_when/workflow.yml +0 -58
  60. data/examples/cmd/README.md +0 -99
  61. data/examples/cmd/analyze_project/prompt.md +0 -57
  62. data/examples/cmd/basic_demo/prompt.md +0 -48
  63. data/examples/cmd/basic_workflow.png +0 -0
  64. data/examples/cmd/basic_workflow.yml +0 -16
  65. data/examples/cmd/check_repository/prompt.md +0 -57
  66. data/examples/cmd/create_and_verify/prompt.md +0 -56
  67. data/examples/cmd/dev_workflow.png +0 -0
  68. data/examples/cmd/dev_workflow.yml +0 -26
  69. data/examples/cmd/explore_project/prompt.md +0 -67
  70. data/examples/cmd/explorer_workflow.png +0 -0
  71. data/examples/cmd/explorer_workflow.yml +0 -21
  72. data/examples/cmd/smart_tool_selection/prompt.md +0 -99
  73. data/examples/coding_agent_with_model.yml +0 -20
  74. data/examples/coding_agent_with_retries.yml +0 -30
  75. data/examples/conditional/README.md +0 -161
  76. data/examples/conditional/check_condition/prompt.md +0 -1
  77. data/examples/conditional/simple_workflow.png +0 -0
  78. data/examples/conditional/simple_workflow.yml +0 -15
  79. data/examples/conditional/workflow.png +0 -0
  80. data/examples/conditional/workflow.yml +0 -23
  81. data/examples/context_management_demo/README.md +0 -43
  82. data/examples/context_management_demo/workflow.yml +0 -42
  83. data/examples/direct_coerce_syntax/README.md +0 -32
  84. data/examples/direct_coerce_syntax/workflow.png +0 -0
  85. data/examples/direct_coerce_syntax/workflow.yml +0 -36
  86. data/examples/dot_notation/README.md +0 -37
  87. data/examples/dot_notation/workflow.png +0 -0
  88. data/examples/dot_notation/workflow.yml +0 -44
  89. data/examples/exit_on_error/README.md +0 -50
  90. data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
  91. data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
  92. data/examples/exit_on_error/workflow.png +0 -0
  93. data/examples/exit_on_error/workflow.yml +0 -19
  94. data/examples/grading/README.md +0 -71
  95. data/examples/grading/analyze_coverage/prompt.md +0 -52
  96. data/examples/grading/calculate_final_grade.rb +0 -67
  97. data/examples/grading/format_result.rb +0 -64
  98. data/examples/grading/generate_grades/prompt.md +0 -105
  99. data/examples/grading/generate_recommendations/output.txt +0 -17
  100. data/examples/grading/generate_recommendations/prompt.md +0 -60
  101. data/examples/grading/js_test_runner +0 -31
  102. data/examples/grading/rb_test_runner +0 -19
  103. data/examples/grading/read_dependencies/prompt.md +0 -16
  104. data/examples/grading/run_coverage.rb +0 -54
  105. data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
  106. data/examples/grading/verify_test_helpers/prompt.md +0 -53
  107. data/examples/grading/workflow.md +0 -8
  108. data/examples/grading/workflow.png +0 -0
  109. data/examples/grading/workflow.rb.md +0 -6
  110. data/examples/grading/workflow.ts+tsx.md +0 -6
  111. data/examples/grading/workflow.yml +0 -41
  112. data/examples/instrumentation.rb +0 -76
  113. data/examples/interpolation/README.md +0 -50
  114. data/examples/interpolation/analyze_file/prompt.md +0 -1
  115. data/examples/interpolation/analyze_patterns/prompt.md +0 -27
  116. data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
  117. data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
  118. data/examples/interpolation/sample.js +0 -48
  119. data/examples/interpolation/sample.rb +0 -42
  120. data/examples/interpolation/workflow.md +0 -1
  121. data/examples/interpolation/workflow.png +0 -0
  122. data/examples/interpolation/workflow.yml +0 -21
  123. data/examples/iteration/IMPLEMENTATION.md +0 -88
  124. data/examples/iteration/README.md +0 -68
  125. data/examples/iteration/analyze_complexity/prompt.md +0 -22
  126. data/examples/iteration/generate_recommendations/prompt.md +0 -21
  127. data/examples/iteration/generate_report/prompt.md +0 -129
  128. data/examples/iteration/implement_fix/prompt.md +0 -25
  129. data/examples/iteration/prioritize_issues/prompt.md +0 -24
  130. data/examples/iteration/prompts/analyze_file.md +0 -28
  131. data/examples/iteration/prompts/generate_summary.md +0 -24
  132. data/examples/iteration/prompts/update_report.md +0 -29
  133. data/examples/iteration/prompts/write_report.md +0 -22
  134. data/examples/iteration/read_file/prompt.md +0 -9
  135. data/examples/iteration/select_next_issue/prompt.md +0 -25
  136. data/examples/iteration/simple_workflow.md +0 -39
  137. data/examples/iteration/simple_workflow.yml +0 -58
  138. data/examples/iteration/update_fix_count/prompt.md +0 -26
  139. data/examples/iteration/verify_fix/prompt.md +0 -29
  140. data/examples/iteration/workflow.png +0 -0
  141. data/examples/iteration/workflow.yml +0 -42
  142. data/examples/json_handling/README.md +0 -32
  143. data/examples/json_handling/workflow.png +0 -0
  144. data/examples/json_handling/workflow.yml +0 -52
  145. data/examples/mcp/README.md +0 -223
  146. data/examples/mcp/analyze_changes/prompt.md +0 -8
  147. data/examples/mcp/analyze_issues/prompt.md +0 -4
  148. data/examples/mcp/analyze_schema/prompt.md +0 -4
  149. data/examples/mcp/check_data_quality/prompt.md +0 -5
  150. data/examples/mcp/check_documentation/prompt.md +0 -4
  151. data/examples/mcp/create_recommendations/prompt.md +0 -5
  152. data/examples/mcp/database_workflow.png +0 -0
  153. data/examples/mcp/database_workflow.yml +0 -29
  154. data/examples/mcp/env_demo/workflow.png +0 -0
  155. data/examples/mcp/env_demo/workflow.yml +0 -34
  156. data/examples/mcp/fetch_pr_context/prompt.md +0 -4
  157. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
  158. data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
  159. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
  160. data/examples/mcp/filesystem_demo/workflow.png +0 -0
  161. data/examples/mcp/filesystem_demo/workflow.yml +0 -38
  162. data/examples/mcp/generate_insights/prompt.md +0 -4
  163. data/examples/mcp/generate_report/prompt.md +0 -6
  164. data/examples/mcp/generate_review/prompt.md +0 -16
  165. data/examples/mcp/github_workflow.png +0 -0
  166. data/examples/mcp/github_workflow.yml +0 -32
  167. data/examples/mcp/multi_mcp_workflow.png +0 -0
  168. data/examples/mcp/multi_mcp_workflow.yml +0 -58
  169. data/examples/mcp/post_review/prompt.md +0 -3
  170. data/examples/mcp/save_report/prompt.md +0 -6
  171. data/examples/mcp/search_issues/prompt.md +0 -2
  172. data/examples/mcp/summarize/prompt.md +0 -1
  173. data/examples/mcp/test_filesystem/prompt.md +0 -6
  174. data/examples/mcp/test_github/prompt.md +0 -8
  175. data/examples/mcp/test_read/prompt.md +0 -1
  176. data/examples/mcp/workflow.png +0 -0
  177. data/examples/mcp/workflow.yml +0 -35
  178. data/examples/no_model_fallback/README.md +0 -17
  179. data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
  180. data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
  181. data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
  182. data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
  183. data/examples/no_model_fallback/sample.rb +0 -42
  184. data/examples/no_model_fallback/workflow.yml +0 -19
  185. data/examples/openrouter_example/README.md +0 -48
  186. data/examples/openrouter_example/analyze_input/prompt.md +0 -16
  187. data/examples/openrouter_example/generate_response/prompt.md +0 -9
  188. data/examples/openrouter_example/workflow.png +0 -0
  189. data/examples/openrouter_example/workflow.yml +0 -12
  190. data/examples/pre_post_processing/README.md +0 -111
  191. data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
  192. data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
  193. data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
  194. data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
  195. data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
  196. data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
  197. data/examples/pre_post_processing/post_processing/output.txt +0 -24
  198. data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
  199. data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
  200. data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
  201. data/examples/pre_post_processing/workflow.png +0 -0
  202. data/examples/pre_post_processing/workflow.yml +0 -21
  203. data/examples/retry/workflow.yml +0 -23
  204. data/examples/rspec_to_minitest/README.md +0 -68
  205. data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
  206. data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
  207. data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
  208. data/examples/rspec_to_minitest/workflow.md +0 -10
  209. data/examples/rspec_to_minitest/workflow.png +0 -0
  210. data/examples/rspec_to_minitest/workflow.yml +0 -40
  211. data/examples/shared_config/README.md +0 -52
  212. data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
  213. data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
  214. data/examples/shared_config/shared.png +0 -0
  215. data/examples/shared_config/shared.yml +0 -7
  216. data/examples/single_target_prepost/README.md +0 -36
  217. data/examples/single_target_prepost/post_processing/output.txt +0 -27
  218. data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
  219. data/examples/single_target_prepost/workflow.png +0 -0
  220. data/examples/single_target_prepost/workflow.yml +0 -20
  221. data/examples/smart_coercion_defaults/README.md +0 -65
  222. data/examples/smart_coercion_defaults/workflow.png +0 -0
  223. data/examples/smart_coercion_defaults/workflow.yml +0 -44
  224. data/examples/step_configuration/README.md +0 -84
  225. data/examples/step_configuration/workflow.png +0 -0
  226. data/examples/step_configuration/workflow.yml +0 -57
  227. data/examples/swarm_example.yml +0 -25
  228. data/examples/tool_config_example/README.md +0 -109
  229. data/examples/tool_config_example/example_step/prompt.md +0 -42
  230. data/examples/tool_config_example/workflow.png +0 -0
  231. data/examples/tool_config_example/workflow.yml +0 -17
  232. data/examples/user_input/README.md +0 -90
  233. data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
  234. data/examples/user_input/funny_name/workflow.png +0 -0
  235. data/examples/user_input/funny_name/workflow.yml +0 -25
  236. data/examples/user_input/generate_summary/prompt.md +0 -11
  237. data/examples/user_input/simple_input_demo/workflow.png +0 -0
  238. data/examples/user_input/simple_input_demo/workflow.yml +0 -35
  239. data/examples/user_input/survey_workflow.png +0 -0
  240. data/examples/user_input/survey_workflow.yml +0 -71
  241. data/examples/user_input/welcome_message/prompt.md +0 -3
  242. data/examples/user_input/workflow.png +0 -0
  243. data/examples/user_input/workflow.yml +0 -73
  244. data/examples/workflow_generator/README.md +0 -27
  245. data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
  246. data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
  247. data/examples/workflow_generator/get_user_input/prompt.md +0 -14
  248. data/examples/workflow_generator/info_from_roast.rb +0 -22
  249. data/examples/workflow_generator/workflow.png +0 -0
  250. data/examples/workflow_generator/workflow.yml +0 -34
@@ -1,161 +0,0 @@
1
- # Conditional Execution in Roast Workflows
2
-
3
- This example demonstrates how to use conditional execution (`if` and `unless`) in Roast workflows.
4
-
5
- ## Overview
6
-
7
- Conditional execution allows workflows to execute different steps based on runtime conditions. This feature supports:
8
-
9
- - `if` conditions - execute steps when a condition is true
10
- - `unless` conditions - execute steps when a condition is false
11
- - `then` branches - steps to execute when the condition matches
12
- - `else` branches - steps to execute when the condition doesn't match (optional, only for `if`)
13
-
14
- ## Syntax
15
-
16
- ### If Statement
17
-
18
- ```yaml
19
- - if: "{{expression}}"
20
- then:
21
- - step1
22
- - step2
23
- else:
24
- - step3
25
- - step4
26
- ```
27
-
28
- ### Unless Statement
29
-
30
- ```yaml
31
- - unless: "{{expression}}"
32
- then:
33
- - step1
34
- - step2
35
- ```
36
-
37
- ## Condition Types
38
-
39
- Conditions can be:
40
-
41
- 1. **Ruby Expressions** - Wrapped in `{{...}}`
42
- ```yaml
43
- - if: "{{output.previous_step.success == true}}"
44
- ```
45
-
46
- 2. **Bash Commands** - Wrapped in `$(...)`
47
- ```yaml
48
- - if: "$(test -f /path/to/file && echo true || echo false)"
49
- ```
50
-
51
- 3. **Step References** - Reference to previous step output
52
- ```yaml
53
- - if: "check_condition" # References a previous step
54
- ```
55
-
56
- 4. **File Checks**
57
- ```yaml
58
- - if: "{{File.exist?('/tmp/myfile.txt')}}"
59
- ```
60
-
61
- ## Examples
62
-
63
- ### Basic Example
64
-
65
- ```yaml
66
- name: Conditional Example
67
- tools:
68
- - Roast::Tools::Cmd
69
-
70
- steps:
71
- - check_status: "echo 'success'"
72
-
73
- - if: "{{output.check_status.strip == 'success'}}"
74
- then:
75
- - success_action: "echo 'Operation succeeded!'"
76
- else:
77
- - failure_action: "echo 'Operation failed!'"
78
- ```
79
-
80
- ### Unless Example
81
-
82
- ```yaml
83
- name: Unless Example
84
- tools: []
85
-
86
- steps:
87
- - check_file: "test -f /tmp/important.txt && echo exists || echo missing"
88
-
89
- - unless: "{{output.check_file.strip == 'exists'}}"
90
- then:
91
- - create_file: "touch /tmp/important.txt"
92
- - notify: "echo 'Created missing file'"
93
- ```
94
-
95
- ### Nested Conditionals
96
-
97
- ```yaml
98
- name: Nested Conditionals
99
- tools: []
100
-
101
- steps:
102
- - outer_check: "echo 'true'"
103
- - inner_check: "echo 'false'"
104
-
105
- - if: "{{output.outer_check.strip == 'true'}}"
106
- then:
107
- - if: "{{output.inner_check.strip == 'true'}}"
108
- then:
109
- - both_true: "echo 'Both conditions are true'"
110
- else:
111
- - only_outer: "echo 'Only outer condition is true'"
112
- else:
113
- - outer_false: "echo 'Outer condition is false'"
114
- ```
115
-
116
- ### Platform-Specific Actions
117
-
118
- ```yaml
119
- name: Platform Detection
120
- tools:
121
- - Roast::Tools::Cmd
122
-
123
- steps:
124
- - detect_os: "uname -s"
125
-
126
- - if: "{{output.detect_os.strip == 'Darwin'}}"
127
- then:
128
- - mac_setup: "brew --version || echo 'Homebrew not installed'"
129
- else:
130
- - if: "{{output.detect_os.strip == 'Linux'}}"
131
- then:
132
- - linux_setup: "apt-get --version || yum --version"
133
- else:
134
- - unknown_os: "echo 'Unknown operating system'"
135
- ```
136
-
137
- ## Best Practices
138
-
139
- 1. **Use Clear Conditions**: Make your conditions explicit and easy to understand
140
- 2. **Handle Edge Cases**: Always consider what happens when conditions fail
141
- 3. **Test Both Branches**: Ensure both `then` and `else` branches work correctly
142
- 4. **Avoid Deep Nesting**: Keep conditional logic simple and readable
143
- 5. **Use Unless Sparingly**: `unless` can be less intuitive than `if` with negation
144
-
145
- ## Debugging
146
-
147
- To debug conditional execution:
148
-
149
- 1. Check the workflow output to see which branch was executed
150
- 2. Look for keys like `if_condition_name` or `unless_condition_name` in the output
151
- 3. These keys contain information about the condition evaluation and branch taken
152
-
153
- ## Running the Example
154
-
155
- ```bash
156
- # Run the simple conditional example
157
- roast execute examples/conditional/simple_workflow.yml
158
-
159
- # Run the full conditional example (requires API configuration)
160
- roast execute examples/conditional/workflow.yml
161
- ```
@@ -1 +0,0 @@
1
- Check if the OS is macOS or Linux and return true if it's macOS, false otherwise.
@@ -1,15 +0,0 @@
1
- name: Simple Conditional Test
2
- tools: []
3
-
4
- steps:
5
- - set_value: "$(echo 'true')"
6
-
7
- - if: "{{output.set_value.strip == 'true'}}"
8
- then:
9
- - success: "$(echo 'If condition worked!')"
10
- else:
11
- - failure: "$(echo 'If condition failed!')"
12
-
13
- - unless: "{{output.set_value.strip == 'false'}}"
14
- then:
15
- - unless_success: "$(echo 'Unless condition worked!')"
Binary file
@@ -1,23 +0,0 @@
1
- name: Conditional Execution Example
2
- tools:
3
- - Roast::Tools::Cmd
4
-
5
- steps:
6
- - check_os: "$(uname -s)"
7
-
8
- - if: "{{output.check_os.strip == 'Darwin'}}"
9
- then:
10
- - mac_message: "$(echo 'Running on macOS!')"
11
- - mac_info: "$(sw_vers)"
12
- else:
13
- - linux_message: "$(echo 'Running on Linux!')"
14
- - linux_info: "$(lsb_release -a)"
15
-
16
- - check_file: "$(test -f /tmp/roast_test.txt && echo exists || echo missing)"
17
-
18
- - unless: "{{output.check_file.strip == 'exists'}}"
19
- then:
20
- - create_file: "$(touch /tmp/roast_test.txt && echo 'File created')"
21
-
22
- - verify_file: "$(ls -la /tmp/roast_test.txt)"
23
- - cleanup: "$(rm -f /tmp/roast_test.txt)"
@@ -1,43 +0,0 @@
1
- # Context Management Demo
2
-
3
- This example demonstrates Roast's automatic context management feature, which helps prevent workflow failures when conversation history exceeds the LLM's context window.
4
-
5
- ## Features Demonstrated
6
-
7
- 1. **Automatic Token Tracking**: Monitors token usage throughout workflow execution
8
- 2. **Configurable Thresholds**: Set when to trigger warnings or compaction
9
- 3. **Context Preservation**: Specify critical steps to retain during compaction
10
-
11
- ## Configuration
12
-
13
- ```yaml
14
- context_management:
15
- enabled: true # Enable context management
16
- strategy: auto # Compaction strategy (auto, summarize, prune, none)
17
- threshold: 0.8 # Trigger at 80% of context window
18
- max_tokens: 10000 # Override default limit (for demo purposes)
19
- retain_steps: # Steps to always keep in full
20
- - analyze_requirements
21
- - generate_summary
22
- ```
23
-
24
- ## Running the Demo
25
-
26
- ```bash
27
- roast execute context_management_demo
28
- ```
29
-
30
- The workflow intentionally generates verbose responses to demonstrate how context management handles large amounts of text without failing.
31
-
32
- ## What to Observe
33
-
34
- 1. **Token Usage Warnings**: Watch for warnings as the context approaches limits
35
- 2. **Automatic Handling**: The workflow continues even with large outputs
36
- 3. **Preserved Context**: Critical steps remain accessible throughout execution
37
-
38
- ## Customization
39
-
40
- Try modifying the configuration:
41
- - Lower `max_tokens` to trigger compaction sooner
42
- - Change `strategy` to test different compaction approaches
43
- - Add more steps to `retain_steps` to preserve additional context
@@ -1,42 +0,0 @@
1
- name: Context Management Demo
2
- tools:
3
- - Roast::Tools::ReadFile
4
- - Roast::Tools::WriteFile
5
-
6
- # Context management configuration
7
- context_management:
8
- enabled: true
9
- strategy: auto
10
- threshold: 0.8 # Trigger compaction at 80% of context window
11
- max_tokens: 10000 # Demo with smaller limit for testing
12
- retain_steps:
13
- - analyze_requirements
14
- - generate_summary
15
-
16
- steps:
17
- - analyze_requirements: |
18
- Analyze this text and list the key requirements:
19
-
20
- We need a system that can:
21
- 1. Process customer orders
22
- 2. Track inventory levels
23
- 3. Generate reports
24
- 4. Handle refunds
25
- 5. Integrate with payment systems
26
-
27
- - expand_details: |
28
- For each requirement from the previous step, provide detailed implementation notes,
29
- technical considerations, and potential challenges. Be very thorough and verbose
30
- to help test the context management system.
31
-
32
- - generate_more_context: |
33
- Now describe the database schema needed for this system. Include all tables,
34
- relationships, indexes, and data types. Be extremely detailed.
35
-
36
- - add_api_design: |
37
- Design a complete REST API for this system. Include all endpoints, request/response
38
- formats, authentication, and error handling. Provide examples for each endpoint.
39
-
40
- - generate_summary: |
41
- Create a concise executive summary of the system design. Focus on the key decisions
42
- and trade-offs made during the design process.
@@ -1,32 +0,0 @@
1
- # Direct Coerce Syntax
2
-
3
- This example demonstrates the simplified syntax for specifying `coerce_to` and other configuration options directly on iteration steps.
4
-
5
- ## Direct Syntax
6
-
7
- Configuration options are specified directly on the step:
8
-
9
- ```yaml
10
- - repeat:
11
- until: "condition"
12
- coerce_to: boolean
13
- print_response: true
14
- model: "claude-3-haiku"
15
- steps: [...]
16
- ```
17
-
18
- ## Benefits
19
-
20
- 1. **Cleaner YAML** - No unnecessary nesting
21
- 2. **More intuitive** - Configuration options are at the same level as other step properties
22
- 3. **Consistent** - Matches how other step properties are specified
23
-
24
- ## Supported Options
25
-
26
- All step configuration options can be specified directly:
27
- - `coerce_to` - Type coercion (boolean, llm_boolean, iterable)
28
- - `print_response` - Whether to print LLM responses
29
- - `loop` - Auto-loop behavior
30
- - `json` - JSON response mode
31
- - `params` - Additional parameters
32
- - `model` - Model override
@@ -1,36 +0,0 @@
1
- name: Direct Coerce Syntax Demo
2
- description: Demonstrates the simplified coerce_to syntax without config blocks
3
-
4
- steps:
5
- # Example 1: Direct coerce_to on repeat
6
- - repeat:
7
- until: "check_api_ready"
8
- coerce_to: boolean # Direct syntax - no config block needed
9
- max_iterations: 5
10
- steps:
11
- - check_api_ready:
12
- prompt: "Check if the API endpoint returns a 200 status"
13
- - wait: 2
14
-
15
- # Example 2: Direct coerce_to on each
16
- - get_data_sources:
17
- prompt: "List available data sources, one per line"
18
-
19
- - each: "get_data_sources"
20
- as: "source"
21
- coerce_to: iterable # Direct syntax
22
- steps:
23
- - validate_source: "Validating {{source}}..."
24
- - process_source:
25
- prompt: "Process data from {{source}}"
26
-
27
- # Example 3: Multiple configuration options
28
- - repeat:
29
- until: "all_tests_pass"
30
- coerce_to: llm_boolean # Override default
31
- print_response: true # Other options work too
32
- max_iterations: 10
33
- steps:
34
- - run_tests: "$(rake test)"
35
- - all_tests_pass:
36
- prompt: "Did all tests pass successfully?"
@@ -1,37 +0,0 @@
1
- # Dot Notation Access Example
2
-
3
- This example demonstrates the new dot notation access feature for workflow outputs.
4
-
5
- ## Usage
6
-
7
- With the new dot notation feature, you can access output values using Ruby's method syntax instead of hash syntax:
8
-
9
- ### Before (hash syntax):
10
- ```yaml
11
- until: "output[:update_fix_count][:fixes_applied] >= 5 || output[:select_next_issue][:no_issues_left] == true"
12
- ```
13
-
14
- ### After (dot notation):
15
- ```yaml
16
- until: "output.update_fix_count.fixes_applied >= 5 || output.select_next_issue.no_issues_left?"
17
- ```
18
-
19
- ### Even cleaner (omitting output prefix):
20
- ```yaml
21
- until: "update_fix_count.fixes_applied >= 5 || select_next_issue.no_issues_left?"
22
- ```
23
-
24
- ## Features
25
-
26
- 1. **Nested access**: `output.step_name.nested.value`
27
- 2. **Boolean predicates**: `output.step_name.is_complete?` returns false for nil/false values
28
- 3. **Direct access**: Omit the `output.` prefix for cleaner syntax
29
- 4. **Backward compatible**: Hash syntax still works (`output[:step_name][:value]`)
30
-
31
- ## Example Workflow
32
-
33
- See `workflow.yml` for a complete example that demonstrates:
34
- - Setting values in output
35
- - Using dot notation in conditions
36
- - Boolean predicate methods
37
- - Nested value access
Binary file
@@ -1,44 +0,0 @@
1
- name: dot_notation_example
2
- description: Example demonstrating dot notation access for workflow outputs
3
-
4
- steps:
5
- initialize:
6
- prompt: |
7
- Initialize the workflow with some sample data.
8
-
9
- Set output.counter to 0
10
- Set output.config.max_iterations to 5
11
- Set output.config.enabled to true
12
-
13
- process_items:
14
- repeat:
15
- # Using dot notation in conditions
16
- until: "counter >= config.max_iterations || !config.enabled?"
17
- steps:
18
- - increment_counter
19
- - check_status
20
-
21
- increment_counter:
22
- prompt: |
23
- Increment the counter by 1.
24
- Current counter value: {{counter}}
25
-
26
- Set output.counter to {{counter}} + 1
27
-
28
- check_status:
29
- prompt: |
30
- Check if we should continue processing.
31
-
32
- Current counter: {{counter}}
33
- Max iterations: {{config.max_iterations}}
34
-
35
- If counter is 3, set output.config.enabled to false
36
- Set output.status.last_checked to current counter value
37
-
38
- summarize:
39
- prompt: |
40
- Summarize the results:
41
- - Total iterations: {{counter}}
42
- - Last checked at: {{status.last_checked}}
43
- - Was enabled: {{config.enabled}}
44
- - Hit max iterations: {{counter >= config.max_iterations ? "Yes" : "No"}}
@@ -1,50 +0,0 @@
1
- # Exit on Error Example
2
-
3
- This example demonstrates how to use the `exit_on_error` configuration option to continue workflow execution even when a command fails.
4
-
5
- ## Use Case
6
-
7
- When running a linter like RuboCop on a file with syntax errors or style violations, the command will exit with a non-zero status. By default, this would halt the workflow. However, we often want to:
8
-
9
- 1. Capture the linter output (including errors)
10
- 2. Analyze what went wrong
11
- 3. Apply fixes based on the analysis
12
-
13
- ## Configuration
14
-
15
- The key configuration is in the step configuration section:
16
-
17
- ```yaml
18
- lint_check:
19
- exit_on_error: false
20
- ```
21
-
22
- This tells Roast to:
23
- - Continue workflow execution even if the command fails
24
- - Capture the full output (stdout and stderr)
25
- - Append the exit status to the output
26
-
27
- ## Output Format
28
-
29
- When a command fails with `exit_on_error: false`, the output will look like:
30
-
31
- ```
32
- lib/example.rb:5:3: C: Style/StringLiterals: Prefer double-quoted strings
33
- 'hello'
34
- ^^^^^^^
35
- [Exit status: 1]
36
- ```
37
-
38
- This allows subsequent steps to process both the error output and the exit status.
39
-
40
- ## Running the Example
41
-
42
- ```bash
43
- roast execute workflow.yml path/to/file.rb
44
- ```
45
-
46
- The workflow will:
47
- 1. Run RuboCop on the file
48
- 2. Continue even if RuboCop finds issues
49
- 3. Analyze the linter output
50
- 4. Apply fixes based on the analysis
@@ -1,9 +0,0 @@
1
- The linter output from the previous step shows issues with the code.
2
- Please analyze the output and identify the specific problems that need to be fixed.
3
-
4
- Focus on:
5
- - Syntax errors
6
- - Style violations
7
- - Best practice violations
8
-
9
- Provide a structured list of issues found.
@@ -1,2 +0,0 @@
1
- Based on the analysis, please generate the fixes for the identified issues.
2
- Use the CodingAgent tool to apply the necessary changes to the file.
Binary file
@@ -1,19 +0,0 @@
1
- name: Linting with Error Recovery
2
- tools:
3
- - Roast::Tools::ReadFile
4
- - Roast::Tools::WriteFile
5
- - Roast::Tools::CodingAgent
6
-
7
- steps:
8
- # Run linter on the file - may fail if there are syntax errors
9
- - lint_check: $(rubocop {{file}})
10
-
11
- # Analyze linter output and fix issues even if linter failed
12
- - analyze_lint_output
13
-
14
- # Apply fixes based on the analysis
15
- - apply_fixes
16
-
17
- # Step configuration
18
- lint_check:
19
- exit_on_error: false # Continue even if rubocop exits with non-zero status
@@ -1,71 +0,0 @@
1
- # Test Grading Workflow
2
-
3
- This workflow acts as a senior software engineer and testing expert to evaluate the quality of test files based on best practices and guidelines.
4
-
5
- ## Prerequisites
6
-
7
- This example uses `shadowenv` for environment management, which is specific to Shopify's development environment. If you're not using shadowenv, you'll need to adapt the commands to your own setup.
8
-
9
- ### If you're using shadowenv:
10
- ```bash
11
- brew install shadowenv
12
- ```
13
-
14
- ### If you're NOT using shadowenv:
15
- You'll need to modify the `run_coverage.rb` file to remove the shadowenv commands. Look for lines like:
16
- ```ruby
17
- command = "shadowenv exec -- bundle exec ruby ..."
18
- ```
19
-
20
- And change them to match your environment:
21
- ```ruby
22
- # For standard Ruby/Bundler setup:
23
- command = "bundle exec ruby ..."
24
-
25
- # Or if you're using rbenv/rvm:
26
- command = "ruby ..."
27
- ```
28
-
29
- ## Usage
30
-
31
- ```bash
32
- # Run the grading workflow on a test file
33
- roast execute examples/grading/workflow.yml path/to/your_test.rb
34
- ```
35
-
36
- ## How it Works
37
-
38
- 1. **read_dependencies**: Analyzes the test file and its dependencies
39
- 2. **run_coverage**: Executes the test with coverage tracking
40
- 3. **generate_grades**: Evaluates test quality across multiple dimensions
41
- 4. **verify_test_helpers**: Checks for proper test helper usage
42
- 5. **verify_mocks_and_stubs**: Ensures appropriate use of test doubles
43
- 6. **analyze_coverage**: Reviews code coverage metrics
44
- 7. **generate_recommendations**: Provides improvement suggestions
45
- 8. **calculate_final_grade**: Computes an overall grade (A-F scale)
46
- 9. **format_result**: Formats the final output
47
-
48
- ## Customization
49
-
50
- Feel free to adapt this workflow to your testing environment:
51
-
52
- - **Different test frameworks**: Modify `run_coverage.rb` to work with RSpec, Jest, pytest, etc.
53
- - **Coverage tools**: Replace the coverage command with your preferred tool (SimpleCov, Istanbul, Coverage.py)
54
- - **Grading criteria**: Adjust the prompts in each step to match your team's standards
55
- - **Environment setup**: Remove or replace shadowenv with your environment management tool
56
-
57
- ## Example Output
58
-
59
- ```
60
- ========== TEST GRADE REPORT ==========
61
- Test file: test/example_test.rb
62
-
63
- FINAL GRADE:
64
- Score: 85/100
65
- Letter Grade: B
66
-
67
- RECOMMENDATIONS:
68
- - Add edge case testing for error conditions
69
- - Improve test descriptions for clarity
70
- - Consider extracting common setup to helper methods
71
- ```
@@ -1,52 +0,0 @@
1
- <coverage_results>
2
- <%= workflow.output["run_coverage"] %>
3
- </coverage_results>
4
-
5
- Analyze the results and score them on a scale of 1-10 using the following rubrics:
6
-
7
- <line_coverage>
8
- 0-1: Critical failure (0-20% coverage) - Core functionality remains completely untested
9
- 2-3: Poor coverage (21-40%) - Major gaps; many key functions lack any testing
10
- 4-5: Inadequate coverage (41-60%) - Several important code paths are not executed
11
- 6-7: Moderate coverage (61-80%) - Notable gaps remain; some important functionality lacks coverage
12
- 8-9: Good coverage (81-95%) - Only minor or edge case code paths remain untested
13
- 10: Excellent coverage (96-100%)
14
- </line_coverage>
15
-
16
- <branch_coverage>
17
- 0-1: Critical failure (0-20% branch coverage) - Almost no conditional branches are tested
18
- 2-3: Poor coverage (21-40%) - Most conditional logic remains untested
19
- 4-5: Inadequate coverage (41-60%) - Many conditions are only tested for one outcome
20
- 6-7: Moderate coverage (61-80%) - Some conditions lack testing for all outcomes
21
- 8-9: Good coverage (81-95%) - Most conditions are tested for most outcomes
22
- 10: Excellent coverage (96-100%)
23
- </branch_coverage>
24
-
25
- <method_coverage>
26
- 0-1: Critical failure (0-20% method coverage) - Most or core functionality methods are untested
27
- 2-3: Poor coverage (21-40%) - Several public API methods remain untested
28
- 4-5: Inadequate coverage (41-60%) - Some important public methods lack tests
29
- 6-7: Moderate coverage (61-80%) - Notable gaps remain; some public methods may lack comprehensive testing
30
- 8-9: Good coverage (81-95%) - Nearly all public methods are tested; private methods are mostly covered via public method tests
31
- 10: Excellent coverage (96-100%)
32
- </method_coverage>
33
-
34
- RESPONSE FORMAT
35
- You must respond in JSON format within <json> XML tags. Example:
36
-
37
- <json>
38
- {
39
- "method_coverage": {
40
- "score": "10",
41
- "justification": "The source file has 100% method coverage, indicating all methods are being tested."
42
- },
43
- "line_coverage": {
44
- "score": 10,
45
- "justification": "The source file has 100% line coverage, indicating all executable lines are tested."
46
- },
47
- "branch_coverage": {
48
- "score": 8,
49
- "justification": "The source file has 80% branch coverage, indicating some branches need testing."
50
- }
51
- }
52
- </json>