roast-ai 1.0.2 → 1.2.0

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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/docs/write-comments.md +1 -1
  3. data/.rubocop.yml +12 -1
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +149 -34
  6. data/README.md +56 -3
  7. data/examples/agent_with_multiple_prompts.rb +27 -0
  8. data/examples/custom_logging.rb +4 -2
  9. data/examples/demo/Gemfile.lock +49 -15
  10. data/examples/plugin-gem-example/Gemfile.lock +19 -15
  11. data/examples/simple_chat.rb +1 -1
  12. data/examples/simple_pi_agent.rb +18 -0
  13. data/internal/rubocop/cop/roast/no_test_class_nesting.rb +126 -0
  14. data/internal/rubocop/rubocop-roast.yml +6 -0
  15. data/internal/workflows/maintenance/branch_docs_impact.rb +97 -0
  16. data/internal/workflows/maintenance/deprecated_models_docs_updater.rb +78 -0
  17. data/lib/roast/cog/config.rb +1 -1
  18. data/lib/roast/cog/output.rb +2 -1
  19. data/lib/roast/cog/registry.rb +3 -3
  20. data/lib/roast/cog_input_manager.rb +28 -7
  21. data/lib/roast/cogs/agent/config.rb +2 -2
  22. data/lib/roast/cogs/agent/input.rb +20 -22
  23. data/lib/roast/cogs/agent/providers/claude/claude_invocation.rb +13 -5
  24. data/lib/roast/cogs/agent/providers/claude/messages/result_message.rb +1 -1
  25. data/lib/roast/cogs/agent/providers/claude/tool_result.rb +344 -4
  26. data/lib/roast/cogs/agent/providers/claude/tool_use.rb +356 -1
  27. data/lib/roast/cogs/agent/providers/claude.rb +16 -3
  28. data/lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb +60 -0
  29. data/lib/roast/cogs/agent/providers/pi/messages/tool_result_message.rb +57 -0
  30. data/lib/roast/cogs/agent/providers/pi/pi_invocation.rb +352 -0
  31. data/lib/roast/cogs/agent/providers/pi.rb +41 -0
  32. data/lib/roast/cogs/agent/stats.rb +29 -0
  33. data/lib/roast/cogs/agent/usage.rb +22 -0
  34. data/lib/roast/cogs/agent.rb +5 -6
  35. data/lib/roast/cogs/chat/config.rb +28 -2
  36. data/lib/roast/cogs/chat.rb +82 -10
  37. data/lib/roast/event.rb +1 -0
  38. data/lib/roast/event_monitor.rb +35 -3
  39. data/lib/roast/log.rb +21 -0
  40. data/lib/roast/log_formatter.rb +9 -7
  41. data/lib/roast/version.rb +1 -1
  42. data/lib/roast.rb +1 -3
  43. data/roast-ai.gemspec +2 -1
  44. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +549 -383
  45. data/sorbet/rbi/gems/addressable@2.8.7.rbi +46 -44
  46. data/sorbet/rbi/gems/ast@2.4.3.rbi +7 -6
  47. data/sorbet/rbi/gems/async@2.34.0.rbi +21 -3
  48. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +7 -7
  49. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +198 -1
  50. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +405 -328
  51. data/sorbet/rbi/gems/console@1.34.2.rbi +2 -2
  52. data/sorbet/rbi/gems/docile@1.4.1.rbi +30 -30
  53. data/sorbet/rbi/gems/drb@2.2.3.rbi +25 -25
  54. data/sorbet/rbi/gems/erubi@1.13.1.rbi +2 -0
  55. data/sorbet/rbi/gems/faraday-net_http@3.4.2.rbi +2 -77
  56. data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +2 -57
  57. data/sorbet/rbi/gems/faraday@2.14.1.rbi +382 -75
  58. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +1 -110
  59. data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +0 -139
  60. data/sorbet/rbi/gems/guard@2.19.1.rbi +38 -38
  61. data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +3 -3
  62. data/sorbet/rbi/gems/i18n@1.14.7.rbi +53 -29
  63. data/sorbet/rbi/gems/io-event@1.14.0.rbi +67 -10
  64. data/sorbet/rbi/gems/json@2.18.1.rbi +227 -5
  65. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +83 -0
  66. data/sorbet/rbi/gems/listen@3.9.0.rbi +7 -7
  67. data/sorbet/rbi/gems/logger@1.7.0.rbi +3 -3
  68. data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +21 -21
  69. data/sorbet/rbi/gems/marcel@1.1.0.rbi +1 -1
  70. data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +0 -96
  71. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1 -16
  72. data/sorbet/rbi/gems/net-http@0.9.1.rbi +27 -19
  73. data/sorbet/rbi/gems/netrc@0.11.0.rbi +18 -0
  74. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +20 -20
  75. data/sorbet/rbi/gems/ostruct@0.6.2.rbi +149 -15
  76. data/sorbet/rbi/gems/parser@3.3.8.0.rbi +141 -139
  77. data/sorbet/rbi/gems/prism@1.4.0.rbi +922 -864
  78. data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +56 -35
  79. data/sorbet/rbi/gems/racc@1.8.1.rbi +10 -2
  80. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +12 -12
  81. data/sorbet/rbi/gems/rake@13.3.0.rbi +219 -318
  82. data/sorbet/rbi/gems/{rbi@0.3.6.rbi → rbi@0.3.9.rbi} +612 -2267
  83. data/sorbet/rbi/gems/{rbs@3.9.4.rbi → rbs@4.0.0.dev.5.rbi} +2013 -680
  84. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +151 -113
  85. data/sorbet/rbi/gems/require-hooks@0.2.3.rbi +110 -0
  86. data/sorbet/rbi/gems/rexml@3.4.2.rbi +24 -51
  87. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +506 -815
  88. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +16 -16
  89. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +2692 -2327
  90. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +8 -8
  91. data/sorbet/rbi/gems/ruby_llm@1.8.2.rbi +38 -23
  92. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +1 -1
  93. data/sorbet/rbi/gems/simplecov-html@0.13.2.rbi +2 -131
  94. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +28 -127
  95. data/sorbet/rbi/gems/{spoom@1.6.3.rbi → spoom@1.7.11.rbi} +1139 -2246
  96. data/sorbet/rbi/gems/sqlite3@2.9.0.rbi +91 -1
  97. data/sorbet/rbi/gems/{tapioca@0.16.11.rbi → tapioca@0.17.10.rbi} +721 -835
  98. data/sorbet/rbi/gems/thor@1.4.0.rbi +53 -53
  99. data/sorbet/rbi/gems/tsort@0.2.0.rbi +393 -0
  100. data/sorbet/rbi/gems/type_toolkit@0.0.5.rbi +49 -0
  101. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +144 -143
  102. data/sorbet/rbi/gems/uri@1.1.1.rbi +7 -7
  103. data/sorbet/rbi/gems/vcr@6.3.1.rbi +53 -36
  104. data/sorbet/rbi/gems/webmock@3.25.1.rbi +38 -13
  105. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +39 -272
  106. data/sorbet/rbi/shims/lib/roast/execution_context.rbi +3 -3
  107. data/tutorial/01_your_first_workflow/README.md +9 -5
  108. data/tutorial/01_your_first_workflow/configured_chat.rb +1 -1
  109. data/tutorial/02_chaining_cogs/README.md +2 -2
  110. data/tutorial/02_chaining_cogs/code_review.rb +1 -1
  111. data/tutorial/02_chaining_cogs/session_resumption.rb +1 -1
  112. data/tutorial/03_targets_and_params/README.md +1 -1
  113. data/tutorial/04_configuration_options/README.md +2 -2
  114. data/tutorial/08_iterative_workflows/README.md +1 -1
  115. data/tutorial/README.md +1 -1
  116. metadata +39 -17
  117. data/docs/AGENT_STEPS.md +0 -288
  118. data/docs/INSTRUMENTATION.md +0 -243
  119. data/docs/ITERATION_SYNTAX.md +0 -147
  120. data/docs/VALIDATION.md +0 -178
  121. data/lib/roast/nil_assertions.rb +0 -23
  122. /data/internal/documentation/{architectural-notes.md → comments/architectural-notes.md} +0 -0
  123. /data/internal/documentation/{doc-comments-external.md → comments/doc-comments-external.md} +0 -0
  124. /data/internal/documentation/{doc-comments-internal.md → comments/doc-comments-internal.md} +0 -0
  125. /data/internal/documentation/{doc-comments.md → comments/doc-comments.md} +0 -0
@@ -320,7 +320,7 @@ module Roast
320
320
  # ### See Also
321
321
  # - `chat` - Pure LLM interaction without local system access
322
322
  #
323
- #: (?Symbol?) {(Roast::Cogs::Agent::Input, untyped, Integer) [self: Roast::CogInputContext] -> (String | void)} -> void
323
+ #: (?Symbol?) {(Roast::Cogs::Agent::Input, untyped, Integer) [self: Roast::CogInputContext] -> top} -> void
324
324
  def agent(name = nil, &block); end
325
325
 
326
326
  # Perform pure LLM interaction
@@ -376,7 +376,7 @@ module Roast
376
376
  # ### See Also
377
377
  # - `agent` - Run a coding agent with local filesystem access
378
378
  #
379
- #: (?Symbol?) {(Roast::Cogs::Chat::Input, untyped, Integer) [self: Roast::CogInputContext] -> (String | void)} -> void
379
+ #: (?Symbol?) {(Roast::Cogs::Chat::Input, untyped, Integer) [self: Roast::CogInputContext] -> top} -> void
380
380
  def chat(name = nil, &block); end
381
381
 
382
382
  # Execute a shell command
@@ -438,7 +438,7 @@ module Roast
438
438
  # ### See Also
439
439
  # - `ruby` - Evaluate Ruby code within the workflow context
440
440
  #
441
- #: (?Symbol?) {(Roast::Cogs::Cmd::Input, untyped, Integer) [self: Roast::CogInputContext] -> (String | Array[String] | void)} -> void
441
+ #: (?Symbol?) {(Roast::Cogs::Cmd::Input, untyped, Integer) [self: Roast::CogInputContext] -> top} -> void
442
442
  def cmd(name = nil, &block); end
443
443
 
444
444
  # Evaluate Ruby code within the workflow context
@@ -58,7 +58,7 @@ That's it! Everything happens inside the `execute do ... end` block.
58
58
 
59
59
  ## Your First Chat Cog
60
60
 
61
- The `chat` cog sends a prompt to a cloud-based LLM and gets a response back. Here's a simplest example:
61
+ The `chat` cog sends a prompt to a cloud-based LLM and gets a response back. Here's a simple example:
62
62
 
63
63
  ```ruby
64
64
  execute do
@@ -106,7 +106,7 @@ block:
106
106
  config do
107
107
  chat do
108
108
  model "gpt-4o-mini" # Use OpenAI's fast model
109
- provider :openai # Use OpenAI (can also be :anthropic)
109
+ provider :openai # Use OpenAI (can also be :anthropic, :perplexity or :gemini)
110
110
  show_prompt! # Display the prompt before sending
111
111
  end
112
112
  end
@@ -125,15 +125,19 @@ end
125
125
  Common options you can set:
126
126
 
127
127
  - `model "name"` - Which LLM model to use
128
- - OpenAI: "gpt-4o", "gpt-4o-mini", "gpt-4-turbo"
129
- - Anthropic: "claude-3-5-sonnet-20241022", "claude-3-5-haiku-20241022"
128
+ - OpenAI: "gpt-4o-mini" (default), "gpt-4o", "gpt-5.5", etc.
129
+ - Anthropic: "claude-haiku-4-5" (default), "claude-sonnet-4-6", "claude-opus-4-7", etc.
130
+ - Perplexity: "sonar" (default), "sonar-pro", "sonar-deep-research", etc.
131
+ - Gemini: "gemini-3.1-flash-lite" (default), "gemini-3-flash-preview", "gemini-3.1-pro-preview", etc.
130
132
  - `provider :name` - Which LLM provider
131
- - `:openai` or `:anthropic`
133
+ - `:openai`, `:anthropic`, `:perplexity` or `:gemini`
132
134
  - `show_prompt!` - Display the prompt being sent
133
135
  - `show_response!` - Display the response (on by default)
134
136
  - `show_stats!` - Display token usage statistics (on by default)
135
137
  - `no_display!` - Turn off all output (useful when you just want to pass the output to a subsequent cog)
136
138
 
139
+ **Note:** Unlike the api key and api base url, the model is **not** environment-controlled. You must set it inside a `config` block (shown above). The same applies to `provider` and other DSL options.
140
+
137
141
  ## Running the Workflows
138
142
 
139
143
  To run any workflow in this chapter:
@@ -10,7 +10,7 @@ config do
10
10
  # Configure all chat cogs in this workflow
11
11
  chat do
12
12
  model "gpt-4o-mini" # Use OpenAI's fast, cost-effective model
13
- provider :openai # Use OpenAI (alternative: :anthropic)
13
+ provider :openai # Use OpenAI (alternative: :anthropic, :perplexity or :gemini)
14
14
  show_prompt! # Display the prompt before sending it
15
15
  show_response! # Display the response (this is the default)
16
16
  show_stats! # Display token usage statistics (default)
@@ -42,11 +42,11 @@ end
42
42
  ```
43
43
 
44
44
  This returns the cog's output, or `nil` if the cog didn't run (we'll learn about conditionally skipping steps in a later
45
- lesson.
45
+ lesson).
46
46
 
47
47
  ### Different Output Methods
48
48
 
49
- Different cog types provide different types of output. Here are few highlights:
49
+ Different cog types provide different types of output. Here are a few highlights:
50
50
 
51
51
  - `chat(:name).response` - The text response from a chat cog
52
52
  - `agent(:name).response` - The text response from an agent cog
@@ -8,7 +8,7 @@
8
8
 
9
9
  config do
10
10
  agent do
11
- model "claude-3-5-haiku-20241022"
11
+ model "claude-haiku-4-5-20251001"
12
12
  provider :claude
13
13
  end
14
14
 
@@ -10,7 +10,7 @@ config do
10
10
  show_stats!
11
11
  end
12
12
  chat(:recall_code) do
13
- model "gpt-4.1-nano"
13
+ model "gpt-5.4-nano"
14
14
  end
15
15
  agent do
16
16
  model "haiku"
@@ -177,7 +177,7 @@ execute do
177
177
  agent(:process) do
178
178
  files = targets.join("\n")
179
179
  format = kwarg(:format) || "detailed"
180
- "Process these files and provide a #{format} report:\n#{files}) "
180
+ "Process these files and provide a #{format} report:\n#{files} "
181
181
  end
182
182
 
183
183
  cmd(:grep_pattern) do
@@ -45,7 +45,7 @@ config do
45
45
  end
46
46
 
47
47
  agent do
48
- model "claude-3-5-haiku-20241022"
48
+ model "claude-haiku-4-5"
49
49
  provider :claude
50
50
  end
51
51
  end
@@ -125,7 +125,7 @@ the prompt, response, usage statistics, and (for the agent cog) incremental prog
125
125
  For the `cmd` cog, you can control the display of standard output and standard error.
126
126
 
127
127
  - `show_stdout!` / `no_show_stdout!` - Control stdout display
128
- - `show_stderr!` / `no_show_stderr!` - Control stdout display
128
+ - `show_stderr!` / `no_show_stderr!` - Control stderr display
129
129
 
130
130
  And for all cog types, you can quickly apply some typical configurations
131
131
 
@@ -89,7 +89,7 @@ execute(:process_numbers) do
89
89
  ruby(:check) do |_, _, index|
90
90
  # Skip processing for multiples of 3
91
91
  if index % 3 == 0
92
- puts " Skipping every third 3 iteration"
92
+ puts " Skipping every third iteration"
93
93
  next!
94
94
  end
95
95
  puts "Processing #{index}"
data/tutorial/README.md CHANGED
@@ -14,7 +14,7 @@ run coding agents, process data, and so much more.
14
14
 
15
15
  - Ruby installed (3.4.2+)
16
16
  - Roast gem installed
17
- - API keys for your AI providers of choice (to use LLM chat)
17
+ - API keys for your AI provider (see [Configuration](https://github.com/Shopify/roast/blob/main/README.md#configuration) for setup)
18
18
  - Claude Code CLI installed and configured (to use coding agents)
19
19
 
20
20
  ## How to Use This Tutorial
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roast-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
@@ -57,14 +57,28 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '1.8'
60
+ version: '1.13'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '1.8'
67
+ version: '1.13'
68
+ - !ruby/object:Gem::Dependency
69
+ name: type_toolkit
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.0.5
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.0.5
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: zeitwerk
70
84
  requirement: !ruby/object:Gem::Requirement
@@ -112,11 +126,8 @@ files:
112
126
  - bin/srb-rbi
113
127
  - bin/tapioca
114
128
  - dev.yml
115
- - docs/AGENT_STEPS.md
116
- - docs/INSTRUMENTATION.md
117
- - docs/ITERATION_SYNTAX.md
118
- - docs/VALIDATION.md
119
129
  - examples/agent_sessions.rb
130
+ - examples/agent_with_multiple_prompts.rb
120
131
  - examples/async_cogs.rb
121
132
  - examples/async_cogs_complex.rb
122
133
  - examples/call.rb
@@ -152,6 +163,7 @@ files:
152
163
  - examples/shell_sanitization.rb
153
164
  - examples/simple_agent.rb
154
165
  - examples/simple_chat.rb
166
+ - examples/simple_pi_agent.rb
155
167
  - examples/simple_repeat.rb
156
168
  - examples/skip.rb
157
169
  - examples/step_communication.rb
@@ -160,10 +172,14 @@ files:
160
172
  - examples/temporary_directory.rb
161
173
  - examples/working_directory.rb
162
174
  - exe/roast
163
- - internal/documentation/architectural-notes.md
164
- - internal/documentation/doc-comments-external.md
165
- - internal/documentation/doc-comments-internal.md
166
- - internal/documentation/doc-comments.md
175
+ - internal/documentation/comments/architectural-notes.md
176
+ - internal/documentation/comments/doc-comments-external.md
177
+ - internal/documentation/comments/doc-comments-internal.md
178
+ - internal/documentation/comments/doc-comments.md
179
+ - internal/rubocop/cop/roast/no_test_class_nesting.rb
180
+ - internal/rubocop/rubocop-roast.yml
181
+ - internal/workflows/maintenance/branch_docs_impact.rb
182
+ - internal/workflows/maintenance/deprecated_models_docs_updater.rb
167
183
  - lib/roast-ai.rb
168
184
  - lib/roast.rb
169
185
  - lib/roast/cli.rb
@@ -195,6 +211,10 @@ files:
195
211
  - lib/roast/cogs/agent/providers/claude/messages/user_message.rb
196
212
  - lib/roast/cogs/agent/providers/claude/tool_result.rb
197
213
  - lib/roast/cogs/agent/providers/claude/tool_use.rb
214
+ - lib/roast/cogs/agent/providers/pi.rb
215
+ - lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb
216
+ - lib/roast/cogs/agent/providers/pi/messages/tool_result_message.rb
217
+ - lib/roast/cogs/agent/providers/pi/pi_invocation.rb
198
218
  - lib/roast/cogs/agent/stats.rb
199
219
  - lib/roast/cogs/agent/usage.rb
200
220
  - lib/roast/cogs/chat.rb
@@ -215,7 +235,6 @@ files:
215
235
  - lib/roast/execution_manager.rb
216
236
  - lib/roast/log.rb
217
237
  - lib/roast/log_formatter.rb
218
- - lib/roast/nil_assertions.rb
219
238
  - lib/roast/output_router.rb
220
239
  - lib/roast/system_cog.rb
221
240
  - lib/roast/system_cog/params.rb
@@ -299,9 +318,10 @@ files:
299
318
  - sorbet/rbi/gems/rake@13.3.0.rbi
300
319
  - sorbet/rbi/gems/rb-fsevent@0.11.2.rbi
301
320
  - sorbet/rbi/gems/rb-inotify@0.11.1.rbi
302
- - sorbet/rbi/gems/rbi@0.3.6.rbi
303
- - sorbet/rbi/gems/rbs@3.9.4.rbi
321
+ - sorbet/rbi/gems/rbi@0.3.9.rbi
322
+ - sorbet/rbi/gems/rbs@4.0.0.dev.5.rbi
304
323
  - sorbet/rbi/gems/regexp_parser@2.10.0.rbi
324
+ - sorbet/rbi/gems/require-hooks@0.2.3.rbi
305
325
  - sorbet/rbi/gems/rexml@3.4.2.rbi
306
326
  - sorbet/rbi/gems/rubocop-ast@1.45.1.rbi
307
327
  - sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi
@@ -315,11 +335,13 @@ files:
315
335
  - sorbet/rbi/gems/simplecov-html@0.13.2.rbi
316
336
  - sorbet/rbi/gems/simplecov@0.22.0.rbi
317
337
  - sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi
318
- - sorbet/rbi/gems/spoom@1.6.3.rbi
338
+ - sorbet/rbi/gems/spoom@1.7.11.rbi
319
339
  - sorbet/rbi/gems/sqlite3@2.9.0.rbi
320
- - sorbet/rbi/gems/tapioca@0.16.11.rbi
340
+ - sorbet/rbi/gems/tapioca@0.17.10.rbi
321
341
  - sorbet/rbi/gems/thor@1.4.0.rbi
322
342
  - sorbet/rbi/gems/traces@0.18.2.rbi
343
+ - sorbet/rbi/gems/tsort@0.2.0.rbi
344
+ - sorbet/rbi/gems/type_toolkit@0.0.5.rbi
323
345
  - sorbet/rbi/gems/tzinfo@2.0.6.rbi
324
346
  - sorbet/rbi/gems/unicode-display_width@3.1.4.rbi
325
347
  - sorbet/rbi/gems/unicode-emoji@4.0.4.rbi
@@ -384,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
406
  - !ruby/object:Gem::Version
385
407
  version: '0'
386
408
  requirements: []
387
- rubygems_version: 4.0.6
409
+ rubygems_version: 4.0.14
388
410
  specification_version: 4
389
411
  summary: A framework for executing structured AI workflows in Ruby
390
412
  test_files: []
data/docs/AGENT_STEPS.md DELETED
@@ -1,288 +0,0 @@
1
- # Agent Steps in Roast
2
-
3
- Agent steps provide a way to send prompts directly to a coding agent (like Claude Code) without going through the standard LLM translation layer. This document explains when and how to use agent steps effectively.
4
-
5
- ## What are Agent Steps?
6
-
7
- Agent steps are denoted by prefixing a step name with `^`. They bypass the normal LLM processing and send your prompt content directly to the CodingAgent tool.
8
-
9
- ```yaml
10
- steps:
11
- # File-based prompts
12
- - analyze_code # Regular step - processed by LLM first
13
- - ^implement_fix # Agent step - direct to CodingAgent
14
-
15
- # Inline prompts
16
- - Analyze the code quality and suggest improvements # Regular inline
17
- - ^Fix all ESLint errors and apply Prettier formatting # Agent inline
18
- ```
19
-
20
- Both file-based prompts (with directories like `implement_fix/prompt.md`) and inline prompts (text with spaces) are supported.
21
-
22
- ## Agent Step Configuration Options
23
-
24
- Agent steps support two special configuration options:
25
-
26
- ### `continue` (boolean, default: false)
27
- When set to `true`, the agent continues from its previous session instead of starting fresh. This is useful for iterative development where you want the agent to maintain context across multiple steps.
28
-
29
- ### `include_context_summary` (boolean, default: false)
30
- When set to `true`, the agent receives an AI-generated summary of the workflow context as a system directive. This summary is intelligently tailored to the agent's upcoming task, including only relevant information from previous steps. The summary is generated by analyzing:
31
- - The agent's prompt to understand what context would be helpful
32
- - Previous step outputs and their relevance to the current task
33
- - Workflow description and configuration
34
- - Current working directory
35
-
36
- This helps the agent understand what has been done so far without overwhelming it with irrelevant details. NOTE: Without this option, the agent relies solely on what it is instructed to do either by the prompt or your specific step instructions.
37
-
38
- ```yaml
39
- steps:
40
- - analyze_code
41
- - implement_fix: ^Fix the issues identified in the analysis
42
- - add_tests: ^Prepare and publish PR
43
-
44
- implement_fix:
45
- include_context_summary: true # Include a summary of the workflow context so far
46
-
47
- add_tests:
48
- continue: true # does not need context since is continuing from the previous step
49
- ```
50
-
51
- ## When to Use Agent Steps
52
-
53
- ### Use Agent Steps When:
54
-
55
- 1. **You need precise control over tool usage**
56
- - When you want to ensure specific tools are used in a particular way
57
- - When the task requires exact file manipulations or code transformations
58
-
59
- 2. **Complex multi-file operations**
60
- - When coordinating changes across multiple files
61
- - When the operation requires specific sequencing of edits
62
-
63
- 3. **Performance optimization**
64
- - When you want to skip the LLM interpretation layer
65
- - For well-defined tasks that don't need additional context
66
-
67
- ### Use Regular Steps When:
68
-
69
- 1. **You need natural language processing**
70
- - When the prompt benefits from LLM interpretation
71
- - When you want the LLM to add context or reasoning
72
-
73
- 2. **Flexible, adaptive responses**
74
- - When the exact approach might vary based on context
75
- - When you want the LLM to make judgment calls
76
-
77
- ## Practical Examples
78
-
79
- ### Example 1: Database Migration
80
-
81
- **Regular Step (analyze_migration/prompt.md):**
82
- ```markdown
83
- Look at the user's database schema and determine what migrations might be needed to support the new features they've described. Consider best practices for database design.
84
- ```
85
-
86
- This benefits from LLM interpretation because:
87
- - It needs to understand "best practices" in context
88
- - It should make judgments about schema design
89
- - The approach varies based on the specific features
90
-
91
- **Agent Step (^apply_migration/prompt.md):**
92
- ```markdown
93
- Create a new migration file with the following specifications:
94
-
95
- 1. Create a new migration file: db/migrate/{{timestamp}}_add_user_preferences.rb
96
- 2. The migration must include:
97
- - Add column :users, :preferences, :jsonb, default: {}
98
- - Add index :users, :preferences, using: :gin
99
- - Add column :users, :notification_settings, :jsonb, default: {}
100
- 3. Ensure proper up/down methods
101
- 4. Follow Rails migration conventions exactly
102
- ```
103
-
104
- This is better as an agent step because:
105
- - The instructions are precise and technical
106
- - No interpretation needed - just execution of steps known beforehand
107
-
108
- ### Example 2: Code Refactoring
109
-
110
- **Regular Step (identify_code_smells/prompt.md):**
111
- ```markdown
112
- Review the provided code and identify any code smells or anti-patterns. Consider things like:
113
- - Long methods that do too much
114
- - Duplicated code
115
- - Poor naming
116
- - Tight coupling
117
- - Missing abstractions
118
-
119
- Explain why each identified issue is problematic.
120
- ```
121
-
122
- This works well as a regular step because it requires judgment and explanation.
123
-
124
- **Agent Step (^extract_method/prompt.md):**
125
- ```markdown
126
- Extract the authentication logic from UserController#create into a separate method:
127
-
128
- 1. Read file: app/controllers/user_controller.rb
129
- 2. Find the code block from line 15-28 (the authentication logic)
130
- 3. Create a new private method called `authenticate_user_params`
131
- 4. Move the authentication logic to this new method
132
- 5. Replace the original code with a call to the new method
133
- 6. Ensure all variables are properly passed
134
-
135
- Use MultiEdit to make all changes in a single operation.
136
- Preserve exact indentation and formatting.
137
- ```
138
-
139
- This is ideal as an agent step because:
140
- - Specific line numbers and method names
141
- - Exact refactoring instructions
142
- - No room for interpretation
143
-
144
- ### Example 3: Test Generation
145
-
146
- **Regular Step (plan_test_coverage/prompt.md):**
147
- ```markdown
148
- Analyze the {{file}} and determine what test cases would provide comprehensive coverage. Consider:
149
- - Happy path scenarios
150
- - Edge cases
151
- - Error conditions
152
- - Boundary values
153
-
154
- Focus on behavior, not implementation details.
155
- ```
156
-
157
- **Agent Step (^implement_tests/prompt.md):**
158
- ```markdown
159
- Create test file: test/models/user_validator_test.rb
160
-
161
- Implement exactly these test cases:
162
- 1. test "validates email format"
163
- - Use valid emails: ["user@example.com", "test.user+tag@domain.co.uk"]
164
- - Use invalid emails: ["invalid", "@example.com", "user@", "user space@example.com"]
165
-
166
- 2. test "validates age is positive integer"
167
- - Valid: [18, 25, 100]
168
- - Invalid: [-1, 0, 17, 101, "twenty", nil]
169
-
170
- 3. test "validates username uniqueness"
171
- - Create user with username "testuser"
172
- - Attempt to create second user with same username
173
- - Assert validation error on :username
174
-
175
- Use minitest assertion style.
176
- Each test must be independent.
177
- Use setup method for common test data.
178
- ```
179
-
180
- ### Example 4: API Integration
181
-
182
- **Regular Step (design_api_client/prompt.md):**
183
- ```markdown
184
- Design a client for the {{api_name}} API that follows Ruby best practices. Consider:
185
- - Error handling strategies
186
- - Rate limiting
187
- - Authentication patterns
188
- - Response parsing
189
- - Testing approach
190
-
191
- Suggest an architecture that will be maintainable and extensible.
192
- ```
193
-
194
- **Agent Step (^implement_api_client/prompt.md):**
195
- ```markdown
196
- Implement the API client with this exact structure:
197
-
198
- 1. Create file: lib/external_apis/weather_api/client.rb
199
- ```ruby
200
- module ExternalApis
201
- module WeatherApi
202
- class Client
203
- include HTTParty
204
- base_uri 'https://api.weather.com/v1'
205
-
206
- def initialize(api_key)
207
- @api_key = api_key
208
- @options = { headers: { 'Authorization' => "Bearer #{api_key}" } }
209
- end
210
-
211
- def current_weather(location)
212
- response = self.class.get("/current", @options.merge(query: { location: location }))
213
- handle_response(response)
214
- end
215
-
216
- private
217
-
218
- def handle_response(response)
219
- raise ApiError, response.message unless response.success?
220
- response.parsed_response
221
- end
222
- end
223
- end
224
- end
225
- ```
226
-
227
- 2. Create file: lib/external_apis/weather_api/api_error.rb
228
- Define custom exception class
229
-
230
- 3. Update file: config/initializers/weather_api.rb
231
- Add configuration for API endpoint and timeout
232
-
233
- Use exact module structure and method signatures shown.
234
- ```
235
-
236
- ## Best Practices
237
-
238
- 1. **Be explicit about tool usage in agent steps**
239
- ```markdown
240
- # Good agent step
241
- Use MultiEdit tool to update the following files:
242
- - app/models/user.rb: Add validation
243
- - test/models/user_test.rb: Add test case
244
- ```
245
-
246
- 2. **Include specific line numbers or code markers when possible**
247
- ```markdown
248
- # Good agent step
249
- In app/controllers/application_controller.rb:
250
- - Find method `authenticate_user!` (around line 45)
251
- - Add the following before the redirect_to call:
252
- session[:return_to] = request.fullpath
253
- ```
254
-
255
- 3. **Specify exact formatting requirements**
256
- ```markdown
257
- # Good agent step
258
- Create method with exactly this signature:
259
- def calculate_tax(amount, rate = 0.08)
260
-
261
- Ensure:
262
- - Two-space indentation
263
- - No trailing whitespace
264
- - Blank line before method definition
265
- ```
266
-
267
- 4. **Chain agent steps for complex operations**
268
- ```yaml
269
- steps:
270
- # First understand the system
271
- - analyze_current_architecture
272
-
273
- # Then execute precise changes
274
- - ^create_service_objects
275
- - ^update_controllers
276
- - ^add_test_coverage
277
-
278
- # Finally verify
279
- - verify_all_tests_pass
280
- ```
281
-
282
- ## Summary
283
-
284
- Agent steps are powerful when you need direct control over tool usage and precise execution of technical tasks. They complement regular steps by handling the implementation details while regular steps handle the analysis and planning.
285
-
286
- The `continue` and `include_context_summary` options make agent steps even more powerful for iterative development workflows where maintaining context is important.
287
-
288
- Choose agent steps when precision matters more than interpretation. Choose regular steps when context and judgment are important.