roast-ai 0.2.3 → 0.3.1

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/CLAUDE.md +3 -1
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +15 -10
  6. data/README.md +214 -20
  7. data/bin/roast +1 -1
  8. data/examples/bash_prototyping/README.md +53 -0
  9. data/examples/bash_prototyping/analyze_network/prompt.md +13 -0
  10. data/examples/bash_prototyping/analyze_system/prompt.md +11 -0
  11. data/examples/bash_prototyping/api_testing.yml +14 -0
  12. data/examples/bash_prototyping/check_processes/prompt.md +11 -0
  13. data/examples/bash_prototyping/generate_report/prompt.md +16 -0
  14. data/examples/bash_prototyping/process_json_response/prompt.md +24 -0
  15. data/examples/bash_prototyping/system_analysis.yml +14 -0
  16. data/examples/bash_prototyping/test_public_api/prompt.md +22 -0
  17. data/examples/cmd/README.md +99 -0
  18. data/examples/cmd/analyze_project/prompt.md +57 -0
  19. data/examples/cmd/basic_demo/prompt.md +48 -0
  20. data/examples/cmd/basic_workflow.yml +17 -0
  21. data/examples/cmd/check_repository/prompt.md +57 -0
  22. data/examples/cmd/create_and_verify/prompt.md +56 -0
  23. data/examples/cmd/dev_workflow.yml +26 -0
  24. data/examples/cmd/explore_project/prompt.md +67 -0
  25. data/examples/cmd/explorer_workflow.yml +21 -0
  26. data/examples/cmd/smart_tool_selection/prompt.md +99 -0
  27. data/examples/grading/README.md +71 -0
  28. data/examples/grading/read_dependencies/prompt.md +4 -2
  29. data/examples/grading/run_coverage.rb +9 -0
  30. data/examples/grading/workflow.yml +0 -2
  31. data/examples/mcp/README.md +223 -0
  32. data/examples/mcp/analyze_changes/prompt.md +8 -0
  33. data/examples/mcp/analyze_issues/prompt.md +4 -0
  34. data/examples/mcp/analyze_schema/prompt.md +4 -0
  35. data/examples/mcp/check_data_quality/prompt.md +5 -0
  36. data/examples/mcp/check_documentation/prompt.md +4 -0
  37. data/examples/mcp/create_recommendations/prompt.md +5 -0
  38. data/examples/mcp/database_workflow.yml +29 -0
  39. data/examples/mcp/env_demo/workflow.yml +34 -0
  40. data/examples/mcp/fetch_pr_context/prompt.md +4 -0
  41. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +2 -0
  42. data/examples/mcp/filesystem_demo/list_files/prompt.md +6 -0
  43. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +7 -0
  44. data/examples/mcp/filesystem_demo/workflow.yml +38 -0
  45. data/examples/mcp/generate_insights/prompt.md +4 -0
  46. data/examples/mcp/generate_report/prompt.md +6 -0
  47. data/examples/mcp/generate_review/prompt.md +16 -0
  48. data/examples/mcp/github_workflow.yml +32 -0
  49. data/examples/mcp/multi_mcp_workflow.yml +58 -0
  50. data/examples/mcp/post_review/prompt.md +3 -0
  51. data/examples/mcp/save_report/prompt.md +6 -0
  52. data/examples/mcp/search_issues/prompt.md +2 -0
  53. data/examples/mcp/summarize/prompt.md +1 -0
  54. data/examples/mcp/test_filesystem/prompt.md +6 -0
  55. data/examples/mcp/test_github/prompt.md +8 -0
  56. data/examples/mcp/test_read/prompt.md +1 -0
  57. data/examples/mcp/workflow.yml +35 -0
  58. data/examples/shared_config/README.md +52 -0
  59. data/examples/shared_config/example_with_shared_config/workflow.yml +6 -0
  60. data/examples/shared_config/shared.yml +7 -0
  61. data/examples/step_configuration/README.md +0 -3
  62. data/examples/step_configuration/workflow.yml +0 -3
  63. data/examples/tool_config_example/README.md +109 -0
  64. data/examples/tool_config_example/example_step/prompt.md +42 -0
  65. data/examples/tool_config_example/workflow.yml +17 -0
  66. data/examples/workflow_generator/workflow.yml +0 -1
  67. data/lib/roast/helpers/function_caching_interceptor.rb +0 -4
  68. data/lib/roast/helpers/prompt_loader.rb +0 -1
  69. data/lib/roast/tools/bash.rb +62 -0
  70. data/lib/roast/tools/cmd.rb +121 -34
  71. data/lib/roast/tools/coding_agent.rb +86 -7
  72. data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +87 -0
  73. data/lib/roast/tools/search_file.rb +13 -1
  74. data/lib/roast/tools.rb +5 -5
  75. data/lib/roast/version.rb +1 -1
  76. data/lib/roast/workflow/base_step.rb +29 -21
  77. data/lib/roast/workflow/base_workflow.rb +8 -10
  78. data/lib/roast/workflow/configuration.rb +68 -3
  79. data/lib/roast/workflow/configuration_loader.rb +63 -4
  80. data/lib/roast/workflow/configuration_parser.rb +0 -3
  81. data/lib/roast/workflow/error_handler.rb +0 -1
  82. data/lib/roast/workflow/file_state_repository.rb +0 -1
  83. data/lib/roast/workflow/iteration_executor.rb +0 -1
  84. data/lib/roast/workflow/output_manager.rb +0 -1
  85. data/lib/roast/workflow/prompt_step.rb +1 -1
  86. data/lib/roast/workflow/step_executor_coordinator.rb +5 -3
  87. data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -1
  88. data/lib/roast/workflow/step_loader.rb +35 -8
  89. data/lib/roast/workflow/step_orchestrator.rb +4 -2
  90. data/lib/roast/workflow/workflow_execution_context.rb +0 -2
  91. data/lib/roast/workflow/workflow_executor.rb +1 -3
  92. data/lib/roast/workflow/workflow_initializer.rb +66 -2
  93. data/lib/roast/workflow/workflow_runner.rb +1 -2
  94. data/lib/roast.rb +8 -0
  95. data/package-lock.json +6 -0
  96. data/roast.gemspec +2 -1
  97. metadata +73 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 728c4818301b1d1ede4ddebb32de6517c84d8f34bc6a4c5541129ae115ec172f
4
- data.tar.gz: d786b94dcf8112d5686ff298a7f474d9441c1b80cb8956c6fe5e85e270a4ee49
3
+ metadata.gz: 4f94565fdc94547f9ab2fa57b401930d189c2e63f5f31897165a07cf6828b10d
4
+ data.tar.gz: '068450417abc06ed7fb98af7c36ec972d6671b23e0e85cfdadde8a934c327fdc'
5
5
  SHA512:
6
- metadata.gz: b93152561bcafd30a22f6c5059040b29a9c26f9a1f73a369cee4d7329594331d793f0e545c47641fc3024876bebf0814eaa51e7c7f28db27a675ff4735e209ee
7
- data.tar.gz: 3899e1afeed2608ba61bea219e5b7ce852c7408253b7e8d3865f6aeefd58a4d769df3af29ec69c46036a8f5912f1556d63c9dc26ab480fa00801011883b036b5
6
+ metadata.gz: 07e5a581c469a37d3f0371627c92ef0b465cfeb5e977a90221a3cdb7783193de7a1c6600df3b1235705ef65e0e76f566bf88730621172314d3bc0ba70adc5dc4
7
+ data.tar.gz: 12e7ae70eee847f11eac8c4e593e11b5a94c0574634254a559d41d006e8fac01dc7b7c26fa2ba1a80fc13de0172ac810ff390e8bda2555e96489c0385f815537
data/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.1] - 2025-06-05
9
+
10
+ ### Added
11
+ - Default `print_response: true` for the last step in a workflow (#100)
12
+ - The last step now automatically prints its response unless explicitly configured otherwise
13
+ - Helps newcomers who would otherwise see no output from their workflows
14
+ - Works with all step types: string steps, hash steps with variable assignment, and conditional steps
15
+ - Parallel steps and iteration steps are intelligently handled (no automatic output since there's no single "last" step)
16
+
17
+ ### Fixed
18
+ - PromptStep now properly passes `print_response`, `json`, and `params` parameters to chat_completion
19
+
20
+ ## [0.3.0] - 2025-06-04
21
+
22
+ ### Changed
23
+ - **BREAKING**: Upgraded to Raix 1.0.0 (#141)
24
+ - Removed the deprecated `loop` parameter from chat_completion calls
25
+ - Raix 1.0 automatically continues after tool calls until providing a text response
26
+ - All chat completions now return strings (no longer arrays or complex structures)
27
+ - JSON responses are automatically parsed when `json: true` is specified
28
+ - **BREAKING**: Removed configurable `loop` and `auto_loop` options from workflow configuration (#140)
29
+ - The `loop:` and `auto_loop:` YAML configuration options have been removed entirely
30
+ - Looping behavior is now automatic: always enabled when tools are present, disabled when no tools exist
31
+ - This simplifies the codebase and makes behavior more predictable
32
+ - To migrate: remove any `loop: true/false` or `auto_loop: true/false` settings from your workflow YAML files
33
+
34
+ ### Fixed
35
+ - Enhanced boolean coercion to treat empty strings as false
36
+ - Improved iterable coercion to handle JSON array strings
37
+ - Fixed all tests to work with Raix 1.0's string-only responses
38
+
8
39
  ## [0.2.3] - 2025-05-29
9
40
 
10
41
  ### Fixed
data/CLAUDE.md CHANGED
@@ -55,6 +55,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
55
  ## Guidance and Expectations
56
56
 
57
57
  - Do not decide unilaterally to leave code for the sake of "backwards compatibility"... always run those decisions by me first.
58
+ - Don't ever commit and push changes unless directly told to do so
58
59
 
59
60
  ## Git Workflow Practices
60
61
 
@@ -165,4 +166,5 @@ gh pr diff {pr_number}
165
166
  18. Prioritize code readability while encouraging performance optimizations:
166
167
  - Avoid premature optimization outside of hot paths
167
168
  - Consider the tradeoff between readability and performance
168
- - Suggest optimizations that improve both clarity and performance
169
+ - Suggest optimizations that improve both clarity and performance
170
+ ```
data/Gemfile CHANGED
@@ -17,3 +17,4 @@ gem "rake", require: false
17
17
  gem "rubocop-shopify", require: false
18
18
  gem "vcr", require: false
19
19
  gem "webmock", require: false
20
+ gem "minitest-rg"
data/Gemfile.lock CHANGED
@@ -1,19 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roast-ai (0.2.3)
4
+ roast-ai (0.3.1)
5
5
  activesupport (>= 7.0)
6
6
  cli-ui
7
7
  diff-lcs (~> 1.5)
8
8
  faraday-retry
9
9
  json-schema
10
- raix (~> 0.8.6)
10
+ open_router (~> 0.3)
11
+ raix (~> 1.0)
11
12
  thor (~> 1.3)
12
13
 
13
14
  GEM
14
15
  remote: https://rubygems.org/
15
16
  specs:
16
- activesupport (7.2.2.1)
17
+ activesupport (8.0.2)
17
18
  base64
18
19
  benchmark (>= 0.3)
19
20
  bigdecimal
@@ -25,12 +26,13 @@ GEM
25
26
  minitest (>= 5.1)
26
27
  securerandom (>= 0.3)
27
28
  tzinfo (~> 2.0, >= 2.0.5)
29
+ uri (>= 0.13.1)
28
30
  addressable (2.8.7)
29
31
  public_suffix (>= 2.0.2, < 7.0)
30
32
  ast (2.4.3)
31
- base64 (0.2.0)
32
- benchmark (0.4.0)
33
- bigdecimal (3.1.9)
33
+ base64 (0.3.0)
34
+ benchmark (0.4.1)
35
+ bigdecimal (3.2.2)
34
36
  cgi (0.4.2)
35
37
  cli-ui (2.3.1)
36
38
  coderay (1.1.3)
@@ -41,7 +43,7 @@ GEM
41
43
  rexml
42
44
  diff-lcs (1.6.1)
43
45
  dotenv (3.1.8)
44
- drb (2.2.1)
46
+ drb (2.2.3)
45
47
  event_stream_parser (1.0.0)
46
48
  faraday (2.13.1)
47
49
  faraday-net_http (>= 2.0, < 3.5)
@@ -53,7 +55,6 @@ GEM
53
55
  net-http (>= 0.5.0)
54
56
  faraday-retry (2.3.1)
55
57
  faraday (~> 2.0)
56
- ffi (1.17.2)
57
58
  ffi (1.17.2-arm64-darwin)
58
59
  ffi (1.17.2-x86_64-linux-gnu)
59
60
  formatador (1.1.0)
@@ -75,7 +76,7 @@ GEM
75
76
  hashdiff (1.1.2)
76
77
  i18n (1.14.7)
77
78
  concurrent-ruby (~> 1.0)
78
- json (2.12.0)
79
+ json (2.12.2)
79
80
  json-schema (5.1.1)
80
81
  addressable (~> 2.8)
81
82
  bigdecimal (~> 3.1)
@@ -88,6 +89,8 @@ GEM
88
89
  lumberjack (1.2.10)
89
90
  method_source (1.1.0)
90
91
  minitest (5.25.5)
92
+ minitest-rg (5.3.0)
93
+ minitest (~> 5.0)
91
94
  mocha (2.7.1)
92
95
  ruby2_keywords (>= 0.0.5)
93
96
  multipart-post (2.4.1)
@@ -114,10 +117,11 @@ GEM
114
117
  public_suffix (6.0.1)
115
118
  racc (1.8.1)
116
119
  rainbow (3.1.1)
117
- raix (0.8.6)
120
+ raix (1.0.0)
118
121
  activesupport (>= 6.0)
119
122
  faraday-retry (~> 2.0)
120
123
  open_router (~> 0.2)
124
+ ostruct
121
125
  ruby-openai (~> 7)
122
126
  rake (13.2.1)
123
127
  rb-fsevent (0.11.2)
@@ -173,6 +177,7 @@ DEPENDENCIES
173
177
  dotenv
174
178
  guard
175
179
  guard-minitest
180
+ minitest-rg
176
181
  mocha
177
182
  rake
178
183
  roast-ai!
data/README.md CHANGED
@@ -51,6 +51,10 @@ steps:
51
51
  analyze_coverage:
52
52
  model: gpt-4-turbo
53
53
  json: true
54
+
55
+ # Step-specific config that specifies a custom path, not in the current directory
56
+ generate_report:
57
+ path: ../reporting/generate_report
54
58
  ```
55
59
 
56
60
  Each step can have its own prompt file (e.g., `analyze_coverage/prompt.md`) and configuration. Steps can be run in parallel by nesting them in arrays:
@@ -78,7 +82,7 @@ steps:
78
82
 
79
83
  ## Try it
80
84
 
81
- If you dont have one already, get an OpenAI key from [here](https://platform.openai.com/settings/organization/api-keys). You will need an account with a credit card, make sure that a basic completion works.
85
+ If you don't have one already, get an OpenAI key from [here](https://platform.openai.com/settings/organization/api-keys). You will need an account with a credit card, make sure that a basic completion works.
82
86
 
83
87
  ```bash
84
88
  export OPENAI_API_KEY=sk-proj-....
@@ -169,7 +173,7 @@ Roast supports several types of steps:
169
173
  steps:
170
174
  - lint_check: $(rubocop {{file}})
171
175
  - fix_issues
172
-
176
+
173
177
  # Step configuration
174
178
  lint_check:
175
179
  exit_on_error: false # Continue workflow even if command fails
@@ -186,13 +190,13 @@ Roast supports several types of steps:
186
190
  - notify_team
187
191
  else:
188
192
  - run_development_setup
189
-
193
+
190
194
  - verify_dependencies:
191
195
  unless: "$(bundle check)"
192
196
  then:
193
197
  - bundle_install: "$(bundle install)"
194
198
  ```
195
-
199
+
196
200
  Conditions can be:
197
201
  - Ruby expressions: `if: "{{output['count'] > 5}}"`
198
202
  - Bash commands: `if: "$(test -f config.yml && echo true)"` (exit code 0 = true)
@@ -209,7 +213,7 @@ Roast supports several types of steps:
209
213
  steps:
210
214
  - analyze_file
211
215
  - Generate a report for {{current_file}}
212
-
216
+
213
217
  # Repeat until a condition is met
214
218
  - improve_code:
215
219
  repeat:
@@ -219,12 +223,12 @@ Roast supports several types of steps:
219
223
  - run_tests
220
224
  - fix_issues
221
225
  ```
222
-
226
+
223
227
  Each loops support:
224
228
  - Collections from Ruby expressions: `each: "{{[1, 2, 3]}}"`
225
229
  - Command output: `each: "$(ls *.rb)"`
226
230
  - Step references: `each: "file_list"`
227
-
231
+
228
232
  Repeat loops support:
229
233
  - Until conditions: `until: "{{condition}}"`
230
234
  - Maximum iterations: `max_iterations: 10`
@@ -233,7 +237,7 @@ Roast supports several types of steps:
233
237
  ```yaml
234
238
  steps:
235
239
  - detect_language
236
-
240
+
237
241
  - case: "{{ workflow.output.detect_language }}"
238
242
  when:
239
243
  ruby:
@@ -249,13 +253,13 @@ Roast supports several types of steps:
249
253
  - analyze_generic
250
254
  - generate_basic_report
251
255
  ```
252
-
256
+
253
257
  Case expressions can be:
254
258
  - Workflow outputs: `case: "{{ workflow.output.variable }}"`
255
259
  - Ruby expressions: `case: "{{ count > 10 ? 'high' : 'low' }}"`
256
260
  - Bash commands: `case: "$(echo $ENVIRONMENT)"`
257
261
  - Direct values: `case: "production"`
258
-
262
+
259
263
  The value is compared against each key in the `when` clause, and matching steps are executed.
260
264
  If no match is found, the `else` steps are executed (if provided).
261
265
 
@@ -266,6 +270,68 @@ Roast supports several types of steps:
266
270
  ```
267
271
  This creates a simple prompt-response interaction without tool calls or looping. It's detected by the presence of spaces in the step name and is useful for summarization or simple questions at the end of a workflow.
268
272
 
273
+ #### Step Configuration
274
+
275
+ Steps can be configured with various options to control their behavior:
276
+
277
+ ```yaml
278
+ steps:
279
+ - analyze_code # Simple step reference
280
+ - generate_report: # Step with configuration
281
+ model: gpt-4o # Override the global model for this step
282
+ print_response: true # Explicitly control output printing
283
+ json: true # Request JSON-formatted response
284
+ params: # Additional parameters for the API call
285
+ temperature: 0.8
286
+ ```
287
+
288
+ **Configuration options:**
289
+ - `model`: Override the workflow's default model for this specific step
290
+ - `print_response`: Control whether the step's response is included in the final output (default: `false`, except for the last step which defaults to `true` as of v0.3.1)
291
+ - `json`: Request a JSON-formatted response from the model
292
+ - `params`: Additional parameters passed to the model API (temperature, max_tokens, etc.)
293
+ - `path`: Custom directory path for the step's prompt files
294
+ - `coerce_to`: Type coercion for the step result (`:boolean`, `:llm_boolean`, `:iterable`)
295
+
296
+ **Automatic Last Step Output**: As of version 0.3.1, the last step in a workflow automatically has `print_response: true` unless explicitly configured otherwise. This ensures that newcomers to Roast see output from their workflows by default.
297
+
298
+ #### Shared Configuration
299
+
300
+ Roast supports sharing common configuration and steps across multiple workflows using a `shared.yml` file.
301
+
302
+ 1. Place a `shared.yml` file one level above your workflow directory
303
+ 2. Define YAML anchors for common configurations like tools, models or steps
304
+ 3. Reference these anchors in your workflow files using YAML alias syntax
305
+
306
+ **Example structure:**
307
+ ```
308
+ my_project/
309
+ ├── shared.yml # Common configuration anchors
310
+ └── workflows/
311
+ ├── analyze_code.yml
312
+ ├── generate_docs.yml
313
+ └── test_suite.yml
314
+ ```
315
+
316
+ **Example `shared.yml`:**
317
+ ```yaml
318
+ # Define common tools
319
+ standard_tools: &standard_tools
320
+ - Roast::Tools::Grep
321
+ - Roast::Tools::ReadFile
322
+ - Roast::Tools::WriteFile
323
+ - Roast::Tools::SearchFile
324
+ ```
325
+
326
+ **Using in workflows:**
327
+ ```yaml
328
+ name: Code Analysis Workflow
329
+ tools: *standard_tools # Reference shared tools
330
+
331
+ steps:
332
+ ...
333
+ ```
334
+
269
335
  #### Data Flow Between Steps
270
336
 
271
337
  Roast handles data flow between steps in three primary ways:
@@ -542,6 +608,56 @@ Roast provides extensive instrumentation capabilities using ActiveSupport::Notif
542
608
 
543
609
  Roast provides several built-in tools that you can use in your workflows:
544
610
 
611
+ #### Tool Configuration
612
+
613
+ Tools can be configured using a hash format in your workflow YAML:
614
+
615
+ ```yaml
616
+ tools:
617
+ - Roast::Tools::ReadFile # No configuration needed
618
+ - Roast::Tools::Cmd: # With configuration
619
+ allowed_commands:
620
+ - git
621
+ - npm
622
+ - yarn
623
+ - Roast::Tools::CodingAgent: # Optional configuration
624
+ coding_agent_command: claude --model opus -p --allowedTools "Bash, Glob, Grep, LS, Read"
625
+ ```
626
+
627
+ Currently supported configurations:
628
+ - `Roast::Tools::Cmd` via `allowed_commands`: restricts which commands can be executed (defaults to: `pwd`, `find`, `ls`, `rake`, `ruby`, `dev`, `mkdir`)
629
+ - `Roast::Tools::CodingAgent` via `coding_agent_command`: customizes the Claude Code CLI command used by the agent
630
+
631
+ ##### Cmd Tool Configuration
632
+
633
+ The `Cmd` tool's `allowed_commands` can be configured in two ways:
634
+
635
+ **1. Simple String Format** (uses default descriptions):
636
+ ```yaml
637
+ tools:
638
+ - Roast::Tools::Cmd:
639
+ allowed_commands:
640
+ - pwd
641
+ - ls
642
+ - git
643
+ ```
644
+
645
+ **2. Hash Format with Custom Descriptions**:
646
+ ```yaml
647
+ tools:
648
+ - Roast::Tools::Cmd:
649
+ allowed_commands:
650
+ - pwd
651
+ - name: git
652
+ description: "git CLI - version control system with subcommands like status, commit, push"
653
+ - name: npm
654
+ description: "npm CLI - Node.js package manager with subcommands like install, run"
655
+ - name: docker
656
+ description: "Docker CLI - container platform with subcommands like build, run, ps"
657
+ ```
658
+
659
+ Custom descriptions help the LLM understand when and how to use each command, making your workflows more effective.
660
+
545
661
  #### ReadFile
546
662
 
547
663
  Reads the contents of a file from the filesystem.
@@ -649,23 +765,43 @@ search_file(query: "class User", file_path: "app/models")
649
765
 
650
766
  #### Cmd
651
767
 
652
- Executes shell commands and returns their output.
768
+ Executes shell commands with configurable restrictions. By default, only allows specific safe commands.
653
769
 
654
770
  ```ruby
655
- # Execute a simple command
771
+ # Execute allowed commands (pwd, find, ls, rake, ruby, dev, mkdir by default)
772
+ pwd(args: "-L")
773
+ ls(args: "-la")
774
+ ruby(args: "-e 'puts RUBY_VERSION'")
775
+
776
+ # Or use the legacy cmd function with full command
656
777
  cmd(command: "ls -la")
778
+ ```
779
+
780
+ - Commands are registered as individual functions based on allowed_commands configuration
781
+ - Default allowed commands: pwd, find, ls, rake, ruby, dev, mkdir
782
+ - Each command has built-in descriptions to help the LLM understand usage
783
+ - Configurable via workflow YAML (see Tool Configuration section)
657
784
 
658
- # With working directory specified
659
- cmd(command: "npm list", cwd: "/path/to/project")
785
+ #### Bash
660
786
 
661
- # With environment variables
662
- cmd(command: "deploy", env: { "NODE_ENV" => "production" })
787
+ Executes shell commands without restrictions. **⚠️ WARNING: Use only in trusted environments!**
788
+
789
+ ```ruby
790
+ # Execute any command - no restrictions
791
+ bash(command: "curl https://api.example.com | jq '.data'")
792
+
793
+ # Complex operations with pipes and redirects
794
+ bash(command: "find . -name '*.log' -mtime +30 -delete")
795
+
796
+ # System administration tasks
797
+ bash(command: "ps aux | grep ruby | awk '{print $2}'")
663
798
  ```
664
799
 
665
- - Provides access to shell commands for more complex operations
666
- - Can specify working directory and environment variables
667
- - Captures and returns command output
668
- - Useful for integrating with existing tools and scripts
800
+ - **No command restrictions** - full shell access
801
+ - Designed for prototyping and development environments
802
+ - Logs warnings by default (disable with `ROAST_BASH_WARNINGS=false`)
803
+ - Should NOT be used in production or untrusted contexts
804
+ - See `examples/bash_prototyping/` for usage examples
669
805
 
670
806
  #### CodingAgent
671
807
 
@@ -683,6 +819,64 @@ coding_agent(
683
819
  - Useful for tasks that require deep code understanding or multi-step changes
684
820
  - Can work across multiple files and languages
685
821
 
822
+ ### MCP (Model Context Protocol) Tools
823
+
824
+ Roast supports MCP tools, allowing you to integrate external services and tools through the Model Context Protocol standard. MCP enables seamless connections to databases, APIs, and specialized tools.
825
+
826
+ #### Configuring MCP Tools
827
+
828
+ MCP tools are configured in the `tools` section of your workflow YAML alongside traditional Roast tools:
829
+
830
+ ```yaml
831
+ tools:
832
+ # Traditional Roast tools
833
+ - Roast::Tools::ReadFile
834
+
835
+ # MCP tools with SSE (Server-Sent Events)
836
+ - Documentation:
837
+ url: https://gitmcp.io/myorg/myrepo/docs
838
+ env:
839
+ - "Authorization: Bearer {{env.API_TOKEN}}"
840
+
841
+ # MCP tools with stdio
842
+ - GitHub:
843
+ command: npx
844
+ args: ["-y", "@modelcontextprotocol/server-github"]
845
+ env:
846
+ GITHUB_PERSONAL_ACCESS_TOKEN: "{{env.GITHUB_TOKEN}}"
847
+ only:
848
+ - search_repositories
849
+ - get_issue
850
+ - create_issue
851
+ ```
852
+
853
+ #### SSE MCP Tools
854
+
855
+ Connect to HTTP endpoints implementing the MCP protocol:
856
+
857
+ ```yaml
858
+ - Tool Name:
859
+ url: https://example.com/mcp-endpoint
860
+ env:
861
+ - "Authorization: Bearer {{resource.api_token}}"
862
+ only: [function1, function2] # Optional whitelist
863
+ except: [function3] # Optional blacklist
864
+ ```
865
+
866
+ #### Stdio MCP Tools
867
+
868
+ Connect to local processes implementing the MCP protocol:
869
+
870
+ ```yaml
871
+ - Tool Name:
872
+ command: docker
873
+ args: ["run", "-i", "--rm", "ghcr.io/example/mcp-server"]
874
+ env:
875
+ API_KEY: "{{env.API_KEY}}"
876
+ ```
877
+
878
+ See the [MCP tools example](examples/mcp/) for complete documentation and more examples.
879
+
686
880
  ### Custom Tools
687
881
 
688
882
  You can create your own tools using the [Raix function dispatch pattern](https://github.com/OlympiaAI/raix-rails?tab=readme-ov-file#use-of-toolsfunctions). Custom tools should be placed in `.roast/initializers/` (subdirectories are supported):
data/bin/roast CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
@@ -0,0 +1,53 @@
1
+ # Bash Tool Examples
2
+
3
+ This directory contains example workflows demonstrating the Bash tool, which provides unrestricted command execution for prototyping scenarios.
4
+
5
+ ## ⚠️ Security Warning
6
+
7
+ The Bash tool executes commands without any restrictions. Only use it in:
8
+ - Development environments
9
+ - Trusted contexts
10
+ - Prototyping scenarios where you explicitly want unrestricted access
11
+
12
+ **Never use the Bash tool in production workflows or with untrusted input!**
13
+
14
+ ## Examples
15
+
16
+ ### 1. System Analysis Workflow (`system_analysis.yml`)
17
+
18
+ Demonstrates using Bash for system inspection and analysis tasks that would be restricted by the Cmd tool.
19
+
20
+ ### 2. API Testing Workflow (`api_testing.yml`)
21
+
22
+ Shows how to use Bash for making API calls with curl and processing responses with jq.
23
+
24
+ ### 3. DevOps Automation (`devops_workflow.yml`)
25
+
26
+ Example of using Bash for DevOps tasks like container management and log analysis.
27
+
28
+ ## Disabling Warnings
29
+
30
+ By default, the Bash tool logs warnings about unrestricted execution. To disable these warnings:
31
+
32
+ ```bash
33
+ export ROAST_BASH_WARNINGS=false
34
+ roast execute workflow.yml
35
+ ```
36
+
37
+ ## Best Practices
38
+
39
+ 1. **Use Cmd tool when possible**: If your commands fit within Cmd's allowed list, use it instead
40
+ 2. **Validate inputs**: Always validate any user input before passing to Bash
41
+ 3. **Limit scope**: Use the most restrictive tool that meets your needs
42
+ 4. **Document risks**: Clearly document when and why Bash tool is necessary
43
+ 5. **Environment isolation**: Run Bash workflows in isolated environments when possible
44
+
45
+ ## Comparison with Cmd Tool
46
+
47
+ | Feature | Cmd Tool | Bash Tool |
48
+ |---------|----------|-----------|
49
+ | Command restrictions | Yes (configurable) | No |
50
+ | Default allowed commands | pwd, find, ls, rake, ruby, dev, mkdir | All commands |
51
+ | Security warnings | No | Yes (can be disabled) |
52
+ | Recommended for production | Yes | No |
53
+ | Use case | General automation | Prototyping & development |
@@ -0,0 +1,13 @@
1
+ # Analyze Network Configuration
2
+
3
+ Use the bash tool to gather network information:
4
+
5
+ 1. Check network interfaces (ifconfig or ip addr)
6
+ 2. Display routing table (netstat -nr or ip route)
7
+ 3. Check listening ports (netstat -an | grep LISTEN or lsof -i -P | grep LISTEN)
8
+ 4. Test DNS resolution (nslookup example.com or dig example.com)
9
+ 5. Check current network connections
10
+
11
+ Provide a summary of the network configuration and any interesting findings.
12
+
13
+ Note: Some commands may require different syntax on macOS vs Linux.
@@ -0,0 +1,11 @@
1
+ # Analyze System Information
2
+
3
+ Use the bash tool to gather system information including:
4
+
5
+ 1. Operating system details (uname -a)
6
+ 2. Current disk usage (df -h)
7
+ 3. Memory information (if available via free -m on Linux or vm_stat on macOS)
8
+ 4. Current user and groups (whoami, groups)
9
+ 5. Environment variables (env | grep -E "PATH|HOME|USER")
10
+
11
+ Gather this information and provide a summary of the system's current state.
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,11 @@
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.
@@ -0,0 +1,16 @@
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.
@@ -0,0 +1,24 @@
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.
@@ -0,0 +1,14 @@
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