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,14 +0,0 @@
1
- name: API Testing with Bash
2
- model: gpt-4o-mini
3
- tools:
4
- - Roast::Tools::Bash
5
- - Roast::Tools::WriteFile
6
-
7
- # Demonstrates using Bash for API testing with curl and jq
8
- # These commands would be restricted by the Cmd tool
9
-
10
- steps:
11
- - test_public_api
12
- - process_json_response
13
- - test_multiple_endpoints
14
- - generate_api_report
@@ -1,11 +0,0 @@
1
- # Check Running Processes
2
-
3
- Use the bash tool to analyze running processes:
4
-
5
- 1. List all processes (ps aux or ps -ef)
6
- 2. Find the top 5 CPU-consuming processes
7
- 3. Find the top 5 memory-consuming processes
8
- 4. Check if any specific development services are running (like databases, web servers)
9
- 5. Count total number of processes
10
-
11
- Note: The exact commands may vary between macOS and Linux. Use appropriate commands for the detected OS.
@@ -1,16 +0,0 @@
1
- # Generate System Analysis Report
2
-
3
- Based on all the information gathered in previous steps:
4
-
5
- 1. Create a comprehensive markdown report summarizing:
6
- - System specifications and OS details
7
- - Resource usage (CPU, memory, disk)
8
- - Active processes and services
9
- - Network configuration
10
- - Any potential issues or interesting findings
11
-
12
- 2. Save the report to `system_analysis_report.md` using the write_file tool
13
-
14
- 3. Include timestamps and organize the information in a clear, readable format
15
-
16
- The report should be suitable for sharing with other developers or for documentation purposes.
@@ -1,24 +0,0 @@
1
- # Process JSON Responses
2
-
3
- Use bash with jq (if available) to process JSON responses:
4
-
5
- 1. First check if jq is installed:
6
- ```bash
7
- which jq
8
- ```
9
-
10
- 2. If jq is available, use it to parse JSON:
11
- ```bash
12
- curl -s https://api.github.com/users/github | jq '.name, .public_repos'
13
- ```
14
-
15
- 3. If jq is not available, use alternative methods like:
16
- - grep with regular expressions
17
- - sed/awk for parsing
18
- - Python one-liners if Python is available
19
-
20
- 4. Extract specific fields from the API responses
21
- 5. Count items in arrays
22
- 6. Filter data based on conditions
23
-
24
- Show different approaches for JSON processing depending on available tools.
@@ -1,14 +0,0 @@
1
- name: System Analysis with Bash
2
- model: gpt-4o-mini
3
- tools:
4
- - Roast::Tools::Bash
5
- - Roast::Tools::WriteFile
6
-
7
- # This workflow demonstrates using Bash for system analysis tasks
8
- # that would be restricted by the Cmd tool
9
-
10
- steps:
11
- - analyze_system
12
- - check_processes
13
- - analyze_network
14
- - generate_report
@@ -1,22 +0,0 @@
1
- # Test Public API Endpoints
2
-
3
- Use the bash tool to test various public APIs:
4
-
5
- 1. Test GitHub API:
6
- ```bash
7
- curl -s https://api.github.com/users/github
8
- ```
9
-
10
- 2. Test a public JSON placeholder API:
11
- ```bash
12
- curl -s https://jsonplaceholder.typicode.com/posts/1
13
- ```
14
-
15
- 3. Check response headers:
16
- ```bash
17
- curl -I https://api.github.com
18
- ```
19
-
20
- 4. Test with different HTTP methods if appropriate
21
-
22
- Analyze the responses and note the structure of the returned data.
@@ -1,58 +0,0 @@
1
- # Case/When/Else Example
2
-
3
- This example demonstrates the use of `case/when/else` control flow in Roast workflows.
4
-
5
- ## Overview
6
-
7
- The `case/when/else` construct allows you to execute different steps based on the value of an expression, similar to Ruby's case statement or switch statements in other languages.
8
-
9
- ## Syntax
10
-
11
- ```yaml
12
- - case: <expression>
13
- when:
14
- <value1>:
15
- - <steps>
16
- <value2>:
17
- - <steps>
18
- else:
19
- - <steps>
20
- ```
21
-
22
- ## Features Demonstrated
23
-
24
- 1. **Basic case/when/else**: Detect file language and execute language-specific analysis
25
- 2. **Bash command evaluation**: Use environment variables to determine deployment strategy
26
- 3. **Complex expressions**: Use Ruby expressions to categorize numeric values
27
-
28
- ## Expression Types
29
-
30
- The `case` expression can be:
31
- - A simple string value
32
- - An interpolated workflow output: `{{ workflow.output.variable }}`
33
- - A Ruby expression: `{{ workflow.output.count > 10 ? 'high' : 'low' }}`
34
- - A bash command: `$(echo $ENVIRONMENT)`
35
- - A reference to a previous step's output
36
-
37
- ## How It Works
38
-
39
- 1. The `case` expression is evaluated to produce a value
40
- 2. The value is compared against each key in the `when` clause
41
- 3. If a match is found, the steps under that key are executed
42
- 4. If no match is found and an `else` clause exists, those steps are executed
43
- 5. If no match is found and no `else` clause exists, execution continues
44
-
45
- ## Running the Example
46
-
47
- ```bash
48
- roast execute examples/case_when/workflow.yml
49
- ```
50
-
51
- This will process all Ruby, JavaScript, Python, and Go files in the current directory, detecting their language and running appropriate analysis steps.
52
-
53
- ## Use Cases
54
-
55
- - **Multi-language projects**: Different linting/testing for different file types
56
- - **Environment-specific workflows**: Different deployment steps for prod/staging/dev
57
- - **Conditional processing**: Different handling based on file size, complexity, or other metrics
58
- - **Error handling**: Different recovery strategies based on error types
@@ -1,16 +0,0 @@
1
- # Detect Programming Language
2
-
3
- Based on the file extension and content, determine the primary programming language of this file:
4
- - If it's a `.rb` file, return "ruby"
5
- - If it's a `.js` file, return "javascript"
6
- - If it's a `.py` file, return "python"
7
- - If it's a `.go` file, return "go"
8
- - Otherwise, return "unknown"
9
-
10
- Return ONLY the language name in lowercase, nothing else.
11
-
12
- File: <%= context.resource_uri %>
13
- Content:
14
- ```
15
- <%= context.resource %>
16
- ```
Binary file
@@ -1,58 +0,0 @@
1
- name: "Case/When/Else Example"
2
-
3
- tools:
4
- - Roast::Tools::Cmd
5
- - Roast::Tools::ReadFile
6
- - Roast::Tools::WriteFile
7
-
8
- target: "**/*.{rb,js,py,go}"
9
-
10
- steps:
11
- - detect_language
12
-
13
- - case: "{{ workflow.output.detect_language }}"
14
- when:
15
- ruby:
16
- - analyze_ruby
17
- - generate_ruby_report
18
- javascript:
19
- - analyze_javascript
20
- - generate_js_report
21
- python:
22
- - analyze_python
23
- - generate_python_report
24
- go:
25
- - analyze_go
26
- - generate_go_report
27
- else:
28
- - analyze_generic
29
- - generate_generic_report
30
-
31
- # Another example using bash command for case expression
32
- - get_environment: $(echo $ENVIRONMENT || echo "development")
33
-
34
- - case: "{{ workflow.output.get_environment }}"
35
- when:
36
- production:
37
- - production_checks
38
- - deploy_production
39
- staging:
40
- - staging_checks
41
- - deploy_staging
42
- development:
43
- - run_tests
44
- - local_deploy
45
- else:
46
- - unknown_environment
47
-
48
- # Example with numeric case values
49
- - count_issues
50
-
51
- - case: "{{ workflow.output.count_issues.to_i > 10 ? 'high' : workflow.output.count_issues.to_i > 5 ? 'medium' : 'low' }}"
52
- when:
53
- high:
54
- - high_priority_alert
55
- medium:
56
- - medium_priority_notice
57
- low:
58
- - low_priority_info
@@ -1,99 +0,0 @@
1
- # Command Tool Examples
2
-
3
- Learn how to execute system commands in your Roast workflows using the Cmd tool. This example demonstrates how to define allowed commands and use them as functions within your workflows.
4
-
5
- ## Overview
6
-
7
- The `Cmd` tool allows you to define a list of approved system commands that can be executed by the AI. Each allowed command is treated as a distinct function, providing several benefits:
8
-
9
- - **Security**: Only explicitly allowed commands can be run, preventing unauthorized system access.
10
- - **Clarity**: Each command has a clear, defined purpose within the workflow.
11
- - **Intelligent Usage**: Custom descriptions can be provided to help the AI choose the correct command for a given task.
12
-
13
- ## Configuration
14
-
15
- You can configure the `Cmd` tool in your workflow YAML file.
16
-
17
- ### Basic Configuration
18
-
19
- List the commands that the AI is allowed to execute:
20
-
21
- ```yaml
22
- tools:
23
- - Roast::Tools::Cmd:
24
- allowed_commands:
25
- - pwd
26
- - ls
27
- - echo
28
- ```
29
-
30
- Each command listed here (`pwd`, `ls`, `echo`) becomes a function the AI can call. For example, the AI can call `pwd()` to get the current directory, or `ls(args: "-la")` to list files.
31
-
32
- ### Enhanced Configuration with Descriptions
33
-
34
- For more complex commands or to provide better guidance to the AI, you can include a description:
35
-
36
- ```yaml
37
- tools:
38
- - Roast::Tools::Cmd:
39
- allowed_commands:
40
- - pwd
41
- - ls
42
- - name: git
43
- description: "git CLI - version control system (e.g., git status, git log)"
44
- - name: npm
45
- description: "npm CLI - Node.js package manager (e.g., npm install, npm run)"
46
- - name: docker
47
- description: "Docker CLI - container platform (e.g., docker ps, docker run)"
48
- ```
49
- These descriptions help the AI understand the purpose of each command and its common subcommands or arguments.
50
-
51
- ## How It Works
52
-
53
- When the `Cmd` tool is configured, each entry in `allowed_commands` is registered as a function available to the AI.
54
-
55
- - `pwd` becomes `pwd()`
56
- - `ls` becomes `ls(args: <string>)`
57
- - `git` (with a description) becomes `git(args: <string>)`
58
-
59
- The AI can then choose to call these functions with appropriate arguments (passed via the `args` parameter) to accomplish its tasks.
60
-
61
- ## Example Workflows
62
-
63
- This directory contains several example workflows demonstrating different uses of the `Cmd` tool:
64
-
65
- - **`basic_workflow.yml`**: Introduces simple command execution.
66
- - **`explorer_workflow.yml`**: Uses commands to navigate and understand a project structure.
67
- - **`dev_workflow.yml`**: Showcases how descriptions guide the AI in selecting tools for development-related tasks.
68
-
69
- ## Running the Examples
70
-
71
- To run an example workflow:
72
- ```bash
73
- bin/roast execute examples/cmd/NAME_OF_WORKFLOW.yml
74
- ```
75
- For instance:
76
- ```bash
77
- bin/roast execute examples/cmd/basic_workflow.yml
78
- ```
79
-
80
- ## Security
81
-
82
- Explicitly defining `allowed_commands` is crucial for security:
83
- - You maintain full control over which system commands the AI can execute.
84
- - It creates self-documenting configurations, making workflows safer and more predictable.
85
-
86
- ## Best Practices
87
-
88
- - **Start Simple**: Begin with basic commands like `pwd` and `ls`.
89
- - **Use Descriptions for Clarity**: Provide descriptions for commands that are not universally understood or have complex arguments/subcommands. This helps both the AI and human readers.
90
- - **Scope Appropriately**: Only allow commands that are necessary for the workflow's intended purpose.
91
-
92
- ## Why Use Custom Descriptions?
93
-
94
- Custom descriptions are particularly useful when:
95
- - Dealing with domain-specific or less common commands.
96
- - Disambiguating between commands with similar names or overlapping functionality.
97
- - Guiding the AI to make more informed decisions about tool selection.
98
-
99
- Good descriptions enhance the AI's ability to use commands effectively and make your workflows more robust.
@@ -1,57 +0,0 @@
1
- # Project Analysis
2
-
3
- You need to analyze the current project to identify its type, available tools, and development setup. Gather comprehensive information to understand the project's nature and configuration.
4
-
5
- Investigate the project to determine:
6
-
7
- 1. Your current working location
8
- 2. The project structure and contents
9
- 3. Whether this is a Node.js project (look for package.json)
10
- 4. Whether Docker is configured (look for Dockerfile or docker-compose.yml)
11
- 5. Whether there's a Makefile for build automation
12
- 6. The version control state
13
-
14
- Based on your findings, determine:
15
- - Project type (Node.js application, containerized service, make-based project, etc.)
16
- - Available development tools and configurations
17
- - How dependencies are managed
18
- - Version control status
19
- - Recommended next steps for development
20
-
21
- RESPONSE FORMAT
22
- Provide your analysis in JSON format:
23
-
24
- <json>
25
- {
26
- "project_analysis": {
27
- "working_directory": "/path/to/project",
28
- "project_type": "Identified based on available files",
29
- "detected_tools": {
30
- "node_project": {
31
- "has_package_json": false,
32
- "has_lock_file": false,
33
- "package_manager": "none"
34
- },
35
- "containerization": {
36
- "has_dockerfile": false,
37
- "has_compose": false,
38
- "docker_ready": false
39
- },
40
- "build_system": {
41
- "has_makefile": false,
42
- "make_targets": []
43
- },
44
- "version_control": {
45
- "has_git": true,
46
- "working_tree_clean": false,
47
- "uncommitted_changes": 3
48
- }
49
- },
50
- "recommendations": [
51
- "Relevant recommendations based on what was found"
52
- ],
53
- "confidence": "high"
54
- },
55
- "analysis_complete": true
56
- }
57
- </json>
@@ -1,48 +0,0 @@
1
- # Basic Command Demonstration
2
-
3
- You are demonstrating basic command functions. Execute several simple commands to show how the command tool system works.
4
-
5
- **SPECIFIC TASKS:**
6
- 1. Show the current working directory: use `pwd`
7
- 2. List all files with details: use `ls -la`
8
- 3. Display celebratory message: use `echo "🎉 Command functions are working!"`
9
- 4. List examples directory: use `ls examples/`
10
-
11
- **EFFICIENCY RULES:**
12
- - Execute each command ONLY ONCE
13
- - DO NOT repeat any command
14
- - Follow the exact order above
15
-
16
- Each command execution demonstrates how commands are called as functions in the workflow, with security enforced through the workflow's configuration.
17
-
18
- RESPONSE FORMAT
19
- Provide a summary of your command executions in JSON format:
20
-
21
- <json>
22
- {
23
- "demonstration_complete": true,
24
- "commands_executed": [
25
- {
26
- "command": "pwd",
27
- "purpose": "Show current working directory",
28
- "output_summary": "Current directory path"
29
- },
30
- {
31
- "command": "ls -la",
32
- "purpose": "List all files with details",
33
- "output_summary": "Directory listing with permissions and sizes"
34
- },
35
- {
36
- "command": "echo \"🎉 Command functions are working!\"",
37
- "purpose": "Display test message",
38
- "output_summary": "Success message displayed"
39
- },
40
- {
41
- "command": "ls examples/",
42
- "purpose": "List examples directory",
43
- "output_summary": "Contents of examples directory"
44
- }
45
- ],
46
- "conclusion": "Successfully demonstrated basic command functions with security constraints"
47
- }
48
- </json>
Binary file
@@ -1,17 +0,0 @@
1
- name: Basic Command Functions
2
- model: default
3
-
4
- # Learn the basics of using command functions in Roast
5
-
6
- tools:
7
- - Roast::Tools::Cmd:
8
- allowed_commands:
9
- - pwd
10
- - ls
11
- - echo
12
- - mkdir
13
- - cat
14
-
15
- steps:
16
- - basic_demo
17
- - create_and_verify
@@ -1,57 +0,0 @@
1
- # Repository Status Check
2
-
3
- You need to analyze the Git repository status and provide a comprehensive overview of the repository state, history, and configuration.
4
-
5
- **SPECIFIC COMMANDS TO USE:**
6
- 1. Check repository status: `git status`
7
- 2. Show current branch: `git branch --show-current`
8
- 3. List recent commits: `git log --oneline -10`
9
- 4. Show remote repositories: `git remote -v`
10
-
11
- **EFFICIENCY RULES:**
12
- - Run each command ONLY ONCE - do not repeat any git command
13
- - DO NOT try different variations of the same command (e.g., different log formats)
14
- - Gather all needed information with these 4 commands only
15
-
16
- From these commands, analyze:
17
- - Current branch and its state
18
- - Working directory status (clean/dirty)
19
- - Recent commit activity
20
- - Remote repository configuration
21
- - Overall repository health
22
-
23
- RESPONSE FORMAT
24
- Provide your analysis in JSON format:
25
-
26
- <json>
27
- {
28
- "repository_status": {
29
- "current_branch": "main",
30
- "working_directory": {
31
- "is_clean": false,
32
- "modified_files": 3,
33
- "untracked_files": 2,
34
- "staged_changes": 1
35
- },
36
- "recent_activity": {
37
- "total_recent_commits": 10,
38
- "latest_commit": {
39
- "hash": "abc1234",
40
- "message": "Latest commit message"
41
- },
42
- "activity_summary": "Regular commits indicate active development"
43
- },
44
- "remotes": {
45
- "origin": {
46
- "fetch_url": "https://github.com/user/repo.git",
47
- "push_url": "https://github.com/user/repo.git"
48
- }
49
- },
50
- "repository_health": {
51
- "status": "healthy",
52
- "notes": "Repository has uncommitted changes but is otherwise in good state"
53
- }
54
- },
55
- "analysis_complete": true
56
- }
57
- </json>
@@ -1,56 +0,0 @@
1
- # Creating and Verifying Files
2
-
3
- You need to demonstrate file creation and verification capabilities. Create a test directory and file, then verify the operations were successful.
4
-
5
- **EXECUTE THESE COMMANDS IN ORDER:**
6
- 1. Create directory: `mkdir -p test_cmd_demo`
7
- 2. Create file: `echo "This file was created by command functions!" > test_cmd_demo/demo.txt`
8
- 3. Verify directory: `ls -la test_cmd_demo/`
9
- 4. Verify content: `cat test_cmd_demo/demo.txt`
10
- 5. Show completion: `echo "Demo complete! You can remove test_cmd_demo when ready."`
11
-
12
- **EFFICIENCY RULE:** Execute each command exactly once in the order shown above.
13
-
14
- This exercise demonstrates how command functions can be combined for practical file operations while maintaining security through the workflow's command restrictions.
15
-
16
- RESPONSE FORMAT
17
- Report the results in JSON format:
18
-
19
- <json>
20
- {
21
- "task_completed": true,
22
- "operations": [
23
- {
24
- "step": "create_directory",
25
- "command": "mkdir -p test_cmd_demo",
26
- "success": true,
27
- "result": "Directory created successfully"
28
- },
29
- {
30
- "step": "create_file",
31
- "command": "echo \"This file was created by command functions!\" > test_cmd_demo/demo.txt",
32
- "success": true,
33
- "result": "File created with content"
34
- },
35
- {
36
- "step": "verify_creation",
37
- "command": "ls -la test_cmd_demo/",
38
- "success": true,
39
- "result": "Directory listing shows demo.txt file"
40
- },
41
- {
42
- "step": "verify_content",
43
- "command": "cat test_cmd_demo/demo.txt",
44
- "success": true,
45
- "result": "File contents match expected text"
46
- },
47
- {
48
- "step": "completion_message",
49
- "command": "echo \"Demo complete! You can remove test_cmd_demo when ready.\"",
50
- "success": true,
51
- "result": "Completion message displayed"
52
- }
53
- ],
54
- "summary": "Successfully demonstrated file creation and verification using command functions"
55
- }
56
- </json>
Binary file
@@ -1,26 +0,0 @@
1
- name: Development Tools Workflow
2
- model: default
3
-
4
- # Demonstrates how custom descriptions guide intelligent tool selection
5
-
6
- tools:
7
- - Roast::Tools::Cmd:
8
- allowed_commands:
9
- - pwd
10
- - ls
11
- - name: git
12
- description: "git CLI - version control system with subcommands like status, commit, branch"
13
- - name: npm
14
- description: "npm CLI - Node.js package manager with subcommands like install, run, test"
15
- - name: docker
16
- description: "Docker CLI - container platform with subcommands like ps, run, build"
17
- - name: curl
18
- description: "curl command - make HTTP requests with options like -X, -H, -d"
19
- - name: jq
20
- description: "jq command - process JSON data with filters like '.key', '.[].name'"
21
- - name: make
22
- description: "make command - run build targets defined in Makefile"
23
-
24
- steps:
25
- - analyze_project
26
- - smart_tool_selection