roast-ai 0.3.0 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28055339ac18d63a1abd7151943558a114df2e48930c63aa63c65536d193061b
4
- data.tar.gz: c5be17b70caa32f73dca316ab4816d0b92c0c7121747b3e5492f58124e815f87
3
+ metadata.gz: 4f94565fdc94547f9ab2fa57b401930d189c2e63f5f31897165a07cf6828b10d
4
+ data.tar.gz: '068450417abc06ed7fb98af7c36ec972d6671b23e0e85cfdadde8a934c327fdc'
5
5
  SHA512:
6
- metadata.gz: d5b300fd001d8cc55ecdb5751bc891840732f63be8e951e2c4333a178fde6c2197a2b0063f3add45b48e85251e9b2ee28119d237322bb8f89af86c2208345c1f
7
- data.tar.gz: c579010aedef591cd1a72fb6cd34c15db38fc225550aa17a841397e5f8849c09c5f87cf81da3f04f2300c5dcac704ab2d8a0f78fe8fd443fabfe62e67780a015
6
+ metadata.gz: 07e5a581c469a37d3f0371627c92ef0b465cfeb5e977a90221a3cdb7783193de7a1c6600df3b1235705ef65e0e76f566bf88730621172314d3bc0ba70adc5dc4
7
+ data.tar.gz: 12e7ae70eee847f11eac8c4e593e11b5a94c0574634254a559d41d006e8fac01dc7b7c26fa2ba1a80fc13de0172ac810ff390e8bda2555e96489c0385f815537
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ 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
+
8
20
  ## [0.3.0] - 2025-06-04
9
21
 
10
22
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roast-ai (0.3.0)
4
+ roast-ai (0.3.1)
5
5
  activesupport (>= 7.0)
6
6
  cli-ui
7
7
  diff-lcs (~> 1.5)
data/README.md CHANGED
@@ -270,6 +270,31 @@ Roast supports several types of steps:
270
270
  ```
271
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.
272
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
+
273
298
  #### Shared Configuration
274
299
 
275
300
  Roast supports sharing common configuration and steps across multiple workflows using a `shared.yml` file.
@@ -0,0 +1,71 @@
1
+ # Test Grading Workflow
2
+
3
+ This workflow acts as a senior software engineer and testing expert to evaluate the quality of test files based on best practices and guidelines.
4
+
5
+ ## Prerequisites
6
+
7
+ This example uses `shadowenv` for environment management, which is specific to Shopify's development environment. If you're not using shadowenv, you'll need to adapt the commands to your own setup.
8
+
9
+ ### If you're using shadowenv:
10
+ ```bash
11
+ brew install shadowenv
12
+ ```
13
+
14
+ ### If you're NOT using shadowenv:
15
+ You'll need to modify the `run_coverage.rb` file to remove the shadowenv commands. Look for lines like:
16
+ ```ruby
17
+ command = "shadowenv exec -- bundle exec ruby ..."
18
+ ```
19
+
20
+ And change them to match your environment:
21
+ ```ruby
22
+ # For standard Ruby/Bundler setup:
23
+ command = "bundle exec ruby ..."
24
+
25
+ # Or if you're using rbenv/rvm:
26
+ command = "ruby ..."
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ # Run the grading workflow on a test file
33
+ roast execute examples/grading/workflow.yml path/to/your_test.rb
34
+ ```
35
+
36
+ ## How it Works
37
+
38
+ 1. **read_dependencies**: Analyzes the test file and its dependencies
39
+ 2. **run_coverage**: Executes the test with coverage tracking
40
+ 3. **generate_grades**: Evaluates test quality across multiple dimensions
41
+ 4. **verify_test_helpers**: Checks for proper test helper usage
42
+ 5. **verify_mocks_and_stubs**: Ensures appropriate use of test doubles
43
+ 6. **analyze_coverage**: Reviews code coverage metrics
44
+ 7. **generate_recommendations**: Provides improvement suggestions
45
+ 8. **calculate_final_grade**: Computes an overall grade (A-F scale)
46
+ 9. **format_result**: Formats the final output
47
+
48
+ ## Customization
49
+
50
+ Feel free to adapt this workflow to your testing environment:
51
+
52
+ - **Different test frameworks**: Modify `run_coverage.rb` to work with RSpec, Jest, pytest, etc.
53
+ - **Coverage tools**: Replace the coverage command with your preferred tool (SimpleCov, Istanbul, Coverage.py)
54
+ - **Grading criteria**: Adjust the prompts in each step to match your team's standards
55
+ - **Environment setup**: Remove or replace shadowenv with your environment management tool
56
+
57
+ ## Example Output
58
+
59
+ ```
60
+ ========== TEST GRADE REPORT ==========
61
+ Test file: test/example_test.rb
62
+
63
+ FINAL GRADE:
64
+ Score: 85/100
65
+ Letter Grade: B
66
+
67
+ RECOMMENDATIONS:
68
+ - Add edge case testing for error conditions
69
+ - Improve test descriptions for clarity
70
+ - Consider extracting common setup to helper methods
71
+ ```
data/lib/roast/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Roast
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -45,6 +45,8 @@ module Roast
45
45
  # Process target and resource
46
46
  @target = ConfigurationLoader.extract_target(@config_hash, options)
47
47
  process_resource
48
+
49
+ mark_last_step_for_output
48
50
  end
49
51
 
50
52
  def context_path
@@ -102,6 +104,60 @@ module Roast
102
104
  @target = @resource.value if has_target?
103
105
  end
104
106
  end
107
+
108
+ def mark_last_step_for_output
109
+ return if @steps.empty?
110
+
111
+ last_step = find_last_executable_step(@steps.last)
112
+ return unless last_step
113
+
114
+ # Get the step name/key
115
+ step_key = extract_step_key(last_step)
116
+ return unless step_key
117
+
118
+ # Ensure config exists for this step
119
+ @config_hash[step_key] ||= {}
120
+
121
+ # Only set print_response if not already explicitly configured
122
+ @config_hash[step_key]["print_response"] = true unless @config_hash[step_key].key?("print_response")
123
+ end
124
+
125
+ def find_last_executable_step(step)
126
+ case step
127
+ when String
128
+ step
129
+ when Hash
130
+ # Check if it's a special step type (if, unless, each, repeat, case)
131
+ if step.key?("if") || step.key?("unless")
132
+ # For conditional steps, try to find the last step in the "then" branch
133
+ then_steps = step["then"] || step["steps"]
134
+ find_last_executable_step(then_steps.last) if then_steps&.any?
135
+ elsif step.key?("each") || step.key?("repeat")
136
+ # For iteration steps, we can't reliably determine the last step
137
+ nil
138
+ elsif step.key?("case")
139
+ # For case steps, we can't reliably determine the last step
140
+ nil
141
+ elsif step.size == 1
142
+ # Regular hash step with variable assignment
143
+ step
144
+ end
145
+ when Array
146
+ # For parallel steps, we can't determine a single "last" step
147
+ nil
148
+ else
149
+ step
150
+ end
151
+ end
152
+
153
+ def extract_step_key(step)
154
+ case step
155
+ when String
156
+ step
157
+ when Hash
158
+ step.keys.first
159
+ end
160
+ end
105
161
  end
106
162
  end
107
163
  end
@@ -9,7 +9,7 @@ module Roast
9
9
 
10
10
  def call
11
11
  prompt(name)
12
- result = chat_completion
12
+ result = chat_completion(print_response:, json:, params:)
13
13
 
14
14
  # Apply coercion if configured
15
15
  apply_coercion(result)
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: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
@@ -190,6 +190,7 @@ files:
190
190
  - examples/exit_on_error/analyze_lint_output/prompt.md
191
191
  - examples/exit_on_error/apply_fixes/prompt.md
192
192
  - examples/exit_on_error/workflow.yml
193
+ - examples/grading/README.md
193
194
  - examples/grading/analyze_coverage/prompt.md
194
195
  - examples/grading/calculate_final_grade.rb
195
196
  - examples/grading/format_result.rb