roast-ai 0.4.7 → 0.4.9
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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +3 -3
- data/README.md +9 -5
- data/Rakefile +2 -0
- data/dsl/less_simple.rb +112 -0
- data/dsl/prototype.rb +17 -0
- data/dsl/simple.rb +5 -7
- data/dsl/step_communication.rb +18 -0
- data/examples/README.md +9 -0
- data/examples/available_tools_demo/workflow.yml +1 -1
- data/examples/basic_prompt_workflow/workflow.md +1 -0
- data/examples/basic_prompt_workflow/workflow.yml +14 -0
- data/examples/grading/README.md +1 -26
- data/examples/grading/analyze_coverage/prompt.md +1 -1
- data/examples/grading/calculate_final_grade.rb +10 -13
- data/examples/grading/format_result.rb +5 -8
- data/examples/grading/generate_grades/prompt.md +1 -1
- data/examples/grading/generate_recommendations/prompt.md +1 -1
- data/examples/grading/read_dependencies/prompt.md +0 -1
- data/examples/grading/verify_test_helpers/prompt.md +1 -1
- data/examples/grading/workflow.md +1 -4
- data/examples/grading/workflow.yml +3 -16
- data/lib/roast/dsl/cog/config.rb +31 -0
- data/lib/roast/dsl/cog/stack.rb +21 -0
- data/lib/roast/dsl/cog/store.rb +26 -0
- data/lib/roast/dsl/cog.rb +70 -0
- data/lib/roast/dsl/cog_execution_context.rb +29 -0
- data/lib/roast/dsl/cogs/cmd.rb +55 -0
- data/lib/roast/dsl/cogs/graph.rb +53 -0
- data/lib/roast/dsl/cogs.rb +65 -0
- data/lib/roast/dsl/config_context.rb +54 -0
- data/lib/roast/dsl/executor.rb +62 -7
- data/lib/roast/dsl/workflow_execution_context.rb +47 -0
- data/lib/roast/error.rb +7 -0
- data/lib/roast/errors.rb +3 -3
- data/lib/roast/graph/edge.rb +25 -0
- data/lib/roast/graph/node.rb +40 -0
- data/lib/roast/graph/quantum_edge.rb +27 -0
- data/lib/roast/graph/threaded_exec.rb +93 -0
- data/lib/roast/graph.rb +233 -0
- data/lib/roast/resources/api_resource.rb +2 -2
- data/lib/roast/resources/url_resource.rb +2 -2
- data/lib/roast/tools/apply_diff.rb +1 -1
- data/lib/roast/tools/ask_user.rb +1 -1
- data/lib/roast/tools/bash.rb +1 -1
- data/lib/roast/tools/cmd.rb +2 -2
- data/lib/roast/tools/coding_agent.rb +2 -2
- data/lib/roast/tools/grep.rb +1 -1
- data/lib/roast/tools/read_file.rb +1 -1
- data/lib/roast/tools/search_file.rb +1 -1
- data/lib/roast/tools/swarm.rb +1 -1
- data/lib/roast/tools/update_files.rb +2 -2
- data/lib/roast/tools/write_file.rb +1 -1
- data/lib/roast/tools.rb +1 -1
- data/lib/roast/value_objects/api_token.rb +1 -1
- data/lib/roast/value_objects/uri_base.rb +1 -1
- data/lib/roast/value_objects/workflow_path.rb +1 -1
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_step.rb +2 -3
- data/lib/roast/workflow/base_workflow.rb +38 -2
- data/lib/roast/workflow/command_executor.rb +1 -1
- data/lib/roast/workflow/configuration_loader.rb +1 -1
- data/lib/roast/workflow/error_handler.rb +1 -1
- data/lib/roast/workflow/step_executor_registry.rb +1 -1
- data/lib/roast/workflow/step_loader.rb +3 -8
- data/lib/roast/workflow/workflow_executor.rb +1 -1
- data/lib/roast.rb +7 -2
- data/sorbet/config +2 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/activesupport.rbi +495 -0
- data/sorbet/rbi/annotations/faraday.rbi +17 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/mocha.rbi +34 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/annotations/webmock.rbi +9 -0
- data/sorbet/rbi/gems/rbs-inline@0.12.0.rbi +2170 -0
- data/sorbet/rbi/gems/{rexml@3.4.1.rbi → rexml@3.4.2.rbi} +284 -239
- data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +11 -0
- data/sorbet/rbi/shims/lib/roast/dsl/workflow_execution_context.rbi +11 -0
- data/sorbet/rbi/todo.rbi +7 -0
- metadata +37 -231
- data/CHANGELOG.md +0 -369
- data/examples/agent_continue/add_documentation/prompt.md +0 -5
- data/examples/agent_continue/add_error_handling/prompt.md +0 -5
- data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
- data/examples/agent_continue/combined_workflow.yml +0 -24
- data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
- data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
- data/examples/agent_continue/document_with_context/prompt.md +0 -5
- data/examples/agent_continue/explore_api/prompt.md +0 -6
- data/examples/agent_continue/implement_client/prompt.md +0 -6
- data/examples/agent_continue/inline_workflow.yml +0 -20
- data/examples/agent_continue/refactor_code/prompt.md +0 -2
- data/examples/agent_continue/verify_changes/prompt.md +0 -6
- data/examples/agent_continue/workflow.yml +0 -27
- data/examples/agent_workflow/README.md +0 -75
- data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
- data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
- data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
- data/examples/agent_workflow/workflow.png +0 -0
- data/examples/agent_workflow/workflow.yml +0 -16
- data/examples/api_workflow/README.md +0 -85
- data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
- data/examples/api_workflow/generate_report/prompt.md +0 -10
- data/examples/api_workflow/prompt.md +0 -10
- data/examples/api_workflow/transform_data/prompt.md +0 -10
- data/examples/api_workflow/workflow.png +0 -0
- data/examples/api_workflow/workflow.yml +0 -30
- data/examples/apply_diff_demo/README.md +0 -58
- data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
- data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
- data/examples/apply_diff_demo/workflow.yml +0 -24
- data/examples/available_tools_demo/workflow.png +0 -0
- data/examples/bash_prototyping/README.md +0 -53
- data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
- data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
- data/examples/bash_prototyping/api_testing.png +0 -0
- data/examples/bash_prototyping/api_testing.yml +0 -14
- data/examples/bash_prototyping/check_processes/prompt.md +0 -11
- data/examples/bash_prototyping/generate_report/prompt.md +0 -16
- data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
- data/examples/bash_prototyping/system_analysis.png +0 -0
- data/examples/bash_prototyping/system_analysis.yml +0 -14
- data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
- data/examples/case_when/README.md +0 -58
- data/examples/case_when/detect_language/prompt.md +0 -16
- data/examples/case_when/workflow.png +0 -0
- data/examples/case_when/workflow.yml +0 -58
- data/examples/cmd/README.md +0 -99
- data/examples/cmd/analyze_project/prompt.md +0 -57
- data/examples/cmd/basic_demo/prompt.md +0 -48
- data/examples/cmd/basic_workflow.png +0 -0
- data/examples/cmd/basic_workflow.yml +0 -16
- data/examples/cmd/check_repository/prompt.md +0 -57
- data/examples/cmd/create_and_verify/prompt.md +0 -56
- data/examples/cmd/dev_workflow.png +0 -0
- data/examples/cmd/dev_workflow.yml +0 -26
- data/examples/cmd/explore_project/prompt.md +0 -67
- data/examples/cmd/explorer_workflow.png +0 -0
- data/examples/cmd/explorer_workflow.yml +0 -21
- data/examples/cmd/smart_tool_selection/prompt.md +0 -99
- data/examples/coding_agent_with_model.yml +0 -20
- data/examples/coding_agent_with_retries.yml +0 -30
- data/examples/conditional/README.md +0 -161
- data/examples/conditional/check_condition/prompt.md +0 -1
- data/examples/conditional/simple_workflow.png +0 -0
- data/examples/conditional/simple_workflow.yml +0 -15
- data/examples/conditional/workflow.png +0 -0
- data/examples/conditional/workflow.yml +0 -23
- data/examples/context_management_demo/README.md +0 -43
- data/examples/context_management_demo/workflow.yml +0 -42
- data/examples/direct_coerce_syntax/README.md +0 -32
- data/examples/direct_coerce_syntax/workflow.png +0 -0
- data/examples/direct_coerce_syntax/workflow.yml +0 -36
- data/examples/dot_notation/README.md +0 -37
- data/examples/dot_notation/workflow.png +0 -0
- data/examples/dot_notation/workflow.yml +0 -44
- data/examples/exit_on_error/README.md +0 -50
- data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
- data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
- data/examples/exit_on_error/workflow.png +0 -0
- data/examples/exit_on_error/workflow.yml +0 -19
- data/examples/grading/js_test_runner +0 -31
- data/examples/grading/rb_test_runner +0 -19
- data/examples/grading/run_coverage.rb +0 -54
- data/examples/grading/workflow.png +0 -0
- data/examples/grading/workflow.rb.md +0 -6
- data/examples/grading/workflow.ts+tsx.md +0 -6
- data/examples/instrumentation.rb +0 -76
- data/examples/interpolation/README.md +0 -50
- data/examples/interpolation/analyze_file/prompt.md +0 -1
- data/examples/interpolation/analyze_patterns/prompt.md +0 -27
- data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
- data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
- data/examples/interpolation/sample.js +0 -48
- data/examples/interpolation/sample.rb +0 -42
- data/examples/interpolation/workflow.md +0 -1
- data/examples/interpolation/workflow.png +0 -0
- data/examples/interpolation/workflow.yml +0 -21
- data/examples/iteration/IMPLEMENTATION.md +0 -88
- data/examples/iteration/README.md +0 -68
- data/examples/iteration/analyze_complexity/prompt.md +0 -22
- data/examples/iteration/generate_recommendations/prompt.md +0 -21
- data/examples/iteration/generate_report/prompt.md +0 -129
- data/examples/iteration/implement_fix/prompt.md +0 -25
- data/examples/iteration/prioritize_issues/prompt.md +0 -24
- data/examples/iteration/prompts/analyze_file.md +0 -28
- data/examples/iteration/prompts/generate_summary.md +0 -24
- data/examples/iteration/prompts/update_report.md +0 -29
- data/examples/iteration/prompts/write_report.md +0 -22
- data/examples/iteration/read_file/prompt.md +0 -9
- data/examples/iteration/select_next_issue/prompt.md +0 -25
- data/examples/iteration/simple_workflow.md +0 -39
- data/examples/iteration/simple_workflow.yml +0 -58
- data/examples/iteration/update_fix_count/prompt.md +0 -26
- data/examples/iteration/verify_fix/prompt.md +0 -29
- data/examples/iteration/workflow.png +0 -0
- data/examples/iteration/workflow.yml +0 -42
- data/examples/json_handling/README.md +0 -32
- data/examples/json_handling/workflow.png +0 -0
- data/examples/json_handling/workflow.yml +0 -52
- data/examples/mcp/README.md +0 -223
- data/examples/mcp/analyze_changes/prompt.md +0 -8
- data/examples/mcp/analyze_issues/prompt.md +0 -4
- data/examples/mcp/analyze_schema/prompt.md +0 -4
- data/examples/mcp/check_data_quality/prompt.md +0 -5
- data/examples/mcp/check_documentation/prompt.md +0 -4
- data/examples/mcp/create_recommendations/prompt.md +0 -5
- data/examples/mcp/database_workflow.png +0 -0
- data/examples/mcp/database_workflow.yml +0 -29
- data/examples/mcp/env_demo/workflow.png +0 -0
- data/examples/mcp/env_demo/workflow.yml +0 -34
- data/examples/mcp/fetch_pr_context/prompt.md +0 -4
- data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
- data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
- data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
- data/examples/mcp/filesystem_demo/workflow.png +0 -0
- data/examples/mcp/filesystem_demo/workflow.yml +0 -38
- data/examples/mcp/generate_insights/prompt.md +0 -4
- data/examples/mcp/generate_report/prompt.md +0 -6
- data/examples/mcp/generate_review/prompt.md +0 -16
- data/examples/mcp/github_workflow.png +0 -0
- data/examples/mcp/github_workflow.yml +0 -32
- data/examples/mcp/multi_mcp_workflow.png +0 -0
- data/examples/mcp/multi_mcp_workflow.yml +0 -58
- data/examples/mcp/post_review/prompt.md +0 -3
- data/examples/mcp/save_report/prompt.md +0 -6
- data/examples/mcp/search_issues/prompt.md +0 -2
- data/examples/mcp/summarize/prompt.md +0 -1
- data/examples/mcp/test_filesystem/prompt.md +0 -6
- data/examples/mcp/test_github/prompt.md +0 -8
- data/examples/mcp/test_read/prompt.md +0 -1
- data/examples/mcp/workflow.png +0 -0
- data/examples/mcp/workflow.yml +0 -35
- data/examples/no_model_fallback/README.md +0 -17
- data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
- data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
- data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
- data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
- data/examples/no_model_fallback/sample.rb +0 -42
- data/examples/no_model_fallback/workflow.yml +0 -19
- data/examples/openrouter_example/README.md +0 -48
- data/examples/openrouter_example/analyze_input/prompt.md +0 -16
- data/examples/openrouter_example/generate_response/prompt.md +0 -9
- data/examples/openrouter_example/workflow.png +0 -0
- data/examples/openrouter_example/workflow.yml +0 -12
- data/examples/pre_post_processing/README.md +0 -111
- data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
- data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
- data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
- data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
- data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
- data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
- data/examples/pre_post_processing/post_processing/output.txt +0 -24
- data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
- data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
- data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
- data/examples/pre_post_processing/workflow.png +0 -0
- data/examples/pre_post_processing/workflow.yml +0 -21
- data/examples/retry/workflow.yml +0 -23
- data/examples/rspec_to_minitest/README.md +0 -68
- data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
- data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
- data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
- data/examples/rspec_to_minitest/workflow.md +0 -10
- data/examples/rspec_to_minitest/workflow.png +0 -0
- data/examples/rspec_to_minitest/workflow.yml +0 -40
- data/examples/shared_config/README.md +0 -52
- data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
- data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
- data/examples/shared_config/shared.png +0 -0
- data/examples/shared_config/shared.yml +0 -7
- data/examples/single_target_prepost/README.md +0 -36
- data/examples/single_target_prepost/post_processing/output.txt +0 -27
- data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
- data/examples/single_target_prepost/workflow.png +0 -0
- data/examples/single_target_prepost/workflow.yml +0 -20
- data/examples/smart_coercion_defaults/README.md +0 -65
- data/examples/smart_coercion_defaults/workflow.png +0 -0
- data/examples/smart_coercion_defaults/workflow.yml +0 -44
- data/examples/step_configuration/README.md +0 -84
- data/examples/step_configuration/workflow.png +0 -0
- data/examples/step_configuration/workflow.yml +0 -57
- data/examples/swarm_example.yml +0 -25
- data/examples/tool_config_example/README.md +0 -109
- data/examples/tool_config_example/example_step/prompt.md +0 -42
- data/examples/tool_config_example/workflow.png +0 -0
- data/examples/tool_config_example/workflow.yml +0 -17
- data/examples/user_input/README.md +0 -90
- data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
- data/examples/user_input/funny_name/workflow.png +0 -0
- data/examples/user_input/funny_name/workflow.yml +0 -25
- data/examples/user_input/generate_summary/prompt.md +0 -11
- data/examples/user_input/simple_input_demo/workflow.png +0 -0
- data/examples/user_input/simple_input_demo/workflow.yml +0 -35
- data/examples/user_input/survey_workflow.png +0 -0
- data/examples/user_input/survey_workflow.yml +0 -71
- data/examples/user_input/welcome_message/prompt.md +0 -3
- data/examples/user_input/workflow.png +0 -0
- data/examples/user_input/workflow.yml +0 -73
- data/examples/workflow_generator/README.md +0 -27
- data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
- data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
- data/examples/workflow_generator/get_user_input/prompt.md +0 -14
- data/examples/workflow_generator/info_from_roast.rb +0 -22
- data/examples/workflow_generator/workflow.png +0 -0
- data/examples/workflow_generator/workflow.yml +0 -34
- data/package-lock.json +0 -6
- /data/sorbet/rbi/gems/{rack@2.2.17.rbi → rack@2.2.18.rbi} +0 -0
@@ -1,161 +0,0 @@
|
|
1
|
-
# Conditional Execution in Roast Workflows
|
2
|
-
|
3
|
-
This example demonstrates how to use conditional execution (`if` and `unless`) in Roast workflows.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
Conditional execution allows workflows to execute different steps based on runtime conditions. This feature supports:
|
8
|
-
|
9
|
-
- `if` conditions - execute steps when a condition is true
|
10
|
-
- `unless` conditions - execute steps when a condition is false
|
11
|
-
- `then` branches - steps to execute when the condition matches
|
12
|
-
- `else` branches - steps to execute when the condition doesn't match (optional, only for `if`)
|
13
|
-
|
14
|
-
## Syntax
|
15
|
-
|
16
|
-
### If Statement
|
17
|
-
|
18
|
-
```yaml
|
19
|
-
- if: "{{expression}}"
|
20
|
-
then:
|
21
|
-
- step1
|
22
|
-
- step2
|
23
|
-
else:
|
24
|
-
- step3
|
25
|
-
- step4
|
26
|
-
```
|
27
|
-
|
28
|
-
### Unless Statement
|
29
|
-
|
30
|
-
```yaml
|
31
|
-
- unless: "{{expression}}"
|
32
|
-
then:
|
33
|
-
- step1
|
34
|
-
- step2
|
35
|
-
```
|
36
|
-
|
37
|
-
## Condition Types
|
38
|
-
|
39
|
-
Conditions can be:
|
40
|
-
|
41
|
-
1. **Ruby Expressions** - Wrapped in `{{...}}`
|
42
|
-
```yaml
|
43
|
-
- if: "{{output.previous_step.success == true}}"
|
44
|
-
```
|
45
|
-
|
46
|
-
2. **Bash Commands** - Wrapped in `$(...)`
|
47
|
-
```yaml
|
48
|
-
- if: "$(test -f /path/to/file && echo true || echo false)"
|
49
|
-
```
|
50
|
-
|
51
|
-
3. **Step References** - Reference to previous step output
|
52
|
-
```yaml
|
53
|
-
- if: "check_condition" # References a previous step
|
54
|
-
```
|
55
|
-
|
56
|
-
4. **File Checks**
|
57
|
-
```yaml
|
58
|
-
- if: "{{File.exist?('/tmp/myfile.txt')}}"
|
59
|
-
```
|
60
|
-
|
61
|
-
## Examples
|
62
|
-
|
63
|
-
### Basic Example
|
64
|
-
|
65
|
-
```yaml
|
66
|
-
name: Conditional Example
|
67
|
-
tools:
|
68
|
-
- Roast::Tools::Cmd
|
69
|
-
|
70
|
-
steps:
|
71
|
-
- check_status: "echo 'success'"
|
72
|
-
|
73
|
-
- if: "{{output.check_status.strip == 'success'}}"
|
74
|
-
then:
|
75
|
-
- success_action: "echo 'Operation succeeded!'"
|
76
|
-
else:
|
77
|
-
- failure_action: "echo 'Operation failed!'"
|
78
|
-
```
|
79
|
-
|
80
|
-
### Unless Example
|
81
|
-
|
82
|
-
```yaml
|
83
|
-
name: Unless Example
|
84
|
-
tools: []
|
85
|
-
|
86
|
-
steps:
|
87
|
-
- check_file: "test -f /tmp/important.txt && echo exists || echo missing"
|
88
|
-
|
89
|
-
- unless: "{{output.check_file.strip == 'exists'}}"
|
90
|
-
then:
|
91
|
-
- create_file: "touch /tmp/important.txt"
|
92
|
-
- notify: "echo 'Created missing file'"
|
93
|
-
```
|
94
|
-
|
95
|
-
### Nested Conditionals
|
96
|
-
|
97
|
-
```yaml
|
98
|
-
name: Nested Conditionals
|
99
|
-
tools: []
|
100
|
-
|
101
|
-
steps:
|
102
|
-
- outer_check: "echo 'true'"
|
103
|
-
- inner_check: "echo 'false'"
|
104
|
-
|
105
|
-
- if: "{{output.outer_check.strip == 'true'}}"
|
106
|
-
then:
|
107
|
-
- if: "{{output.inner_check.strip == 'true'}}"
|
108
|
-
then:
|
109
|
-
- both_true: "echo 'Both conditions are true'"
|
110
|
-
else:
|
111
|
-
- only_outer: "echo 'Only outer condition is true'"
|
112
|
-
else:
|
113
|
-
- outer_false: "echo 'Outer condition is false'"
|
114
|
-
```
|
115
|
-
|
116
|
-
### Platform-Specific Actions
|
117
|
-
|
118
|
-
```yaml
|
119
|
-
name: Platform Detection
|
120
|
-
tools:
|
121
|
-
- Roast::Tools::Cmd
|
122
|
-
|
123
|
-
steps:
|
124
|
-
- detect_os: "uname -s"
|
125
|
-
|
126
|
-
- if: "{{output.detect_os.strip == 'Darwin'}}"
|
127
|
-
then:
|
128
|
-
- mac_setup: "brew --version || echo 'Homebrew not installed'"
|
129
|
-
else:
|
130
|
-
- if: "{{output.detect_os.strip == 'Linux'}}"
|
131
|
-
then:
|
132
|
-
- linux_setup: "apt-get --version || yum --version"
|
133
|
-
else:
|
134
|
-
- unknown_os: "echo 'Unknown operating system'"
|
135
|
-
```
|
136
|
-
|
137
|
-
## Best Practices
|
138
|
-
|
139
|
-
1. **Use Clear Conditions**: Make your conditions explicit and easy to understand
|
140
|
-
2. **Handle Edge Cases**: Always consider what happens when conditions fail
|
141
|
-
3. **Test Both Branches**: Ensure both `then` and `else` branches work correctly
|
142
|
-
4. **Avoid Deep Nesting**: Keep conditional logic simple and readable
|
143
|
-
5. **Use Unless Sparingly**: `unless` can be less intuitive than `if` with negation
|
144
|
-
|
145
|
-
## Debugging
|
146
|
-
|
147
|
-
To debug conditional execution:
|
148
|
-
|
149
|
-
1. Check the workflow output to see which branch was executed
|
150
|
-
2. Look for keys like `if_condition_name` or `unless_condition_name` in the output
|
151
|
-
3. These keys contain information about the condition evaluation and branch taken
|
152
|
-
|
153
|
-
## Running the Example
|
154
|
-
|
155
|
-
```bash
|
156
|
-
# Run the simple conditional example
|
157
|
-
roast execute examples/conditional/simple_workflow.yml
|
158
|
-
|
159
|
-
# Run the full conditional example (requires API configuration)
|
160
|
-
roast execute examples/conditional/workflow.yml
|
161
|
-
```
|
@@ -1 +0,0 @@
|
|
1
|
-
Check if the OS is macOS or Linux and return true if it's macOS, false otherwise.
|
Binary file
|
@@ -1,15 +0,0 @@
|
|
1
|
-
name: Simple Conditional Test
|
2
|
-
tools: []
|
3
|
-
|
4
|
-
steps:
|
5
|
-
- set_value: "$(echo 'true')"
|
6
|
-
|
7
|
-
- if: "{{output.set_value.strip == 'true'}}"
|
8
|
-
then:
|
9
|
-
- success: "$(echo 'If condition worked!')"
|
10
|
-
else:
|
11
|
-
- failure: "$(echo 'If condition failed!')"
|
12
|
-
|
13
|
-
- unless: "{{output.set_value.strip == 'false'}}"
|
14
|
-
then:
|
15
|
-
- unless_success: "$(echo 'Unless condition worked!')"
|
Binary file
|
@@ -1,23 +0,0 @@
|
|
1
|
-
name: Conditional Execution Example
|
2
|
-
tools:
|
3
|
-
- Roast::Tools::Cmd
|
4
|
-
|
5
|
-
steps:
|
6
|
-
- check_os: "$(uname -s)"
|
7
|
-
|
8
|
-
- if: "{{output.check_os.strip == 'Darwin'}}"
|
9
|
-
then:
|
10
|
-
- mac_message: "$(echo 'Running on macOS!')"
|
11
|
-
- mac_info: "$(sw_vers)"
|
12
|
-
else:
|
13
|
-
- linux_message: "$(echo 'Running on Linux!')"
|
14
|
-
- linux_info: "$(lsb_release -a)"
|
15
|
-
|
16
|
-
- check_file: "$(test -f /tmp/roast_test.txt && echo exists || echo missing)"
|
17
|
-
|
18
|
-
- unless: "{{output.check_file.strip == 'exists'}}"
|
19
|
-
then:
|
20
|
-
- create_file: "$(touch /tmp/roast_test.txt && echo 'File created')"
|
21
|
-
|
22
|
-
- verify_file: "$(ls -la /tmp/roast_test.txt)"
|
23
|
-
- cleanup: "$(rm -f /tmp/roast_test.txt)"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# Context Management Demo
|
2
|
-
|
3
|
-
This example demonstrates Roast's automatic context management feature, which helps prevent workflow failures when conversation history exceeds the LLM's context window.
|
4
|
-
|
5
|
-
## Features Demonstrated
|
6
|
-
|
7
|
-
1. **Automatic Token Tracking**: Monitors token usage throughout workflow execution
|
8
|
-
2. **Configurable Thresholds**: Set when to trigger warnings or compaction
|
9
|
-
3. **Context Preservation**: Specify critical steps to retain during compaction
|
10
|
-
|
11
|
-
## Configuration
|
12
|
-
|
13
|
-
```yaml
|
14
|
-
context_management:
|
15
|
-
enabled: true # Enable context management
|
16
|
-
strategy: auto # Compaction strategy (auto, summarize, prune, none)
|
17
|
-
threshold: 0.8 # Trigger at 80% of context window
|
18
|
-
max_tokens: 10000 # Override default limit (for demo purposes)
|
19
|
-
retain_steps: # Steps to always keep in full
|
20
|
-
- analyze_requirements
|
21
|
-
- generate_summary
|
22
|
-
```
|
23
|
-
|
24
|
-
## Running the Demo
|
25
|
-
|
26
|
-
```bash
|
27
|
-
roast execute context_management_demo
|
28
|
-
```
|
29
|
-
|
30
|
-
The workflow intentionally generates verbose responses to demonstrate how context management handles large amounts of text without failing.
|
31
|
-
|
32
|
-
## What to Observe
|
33
|
-
|
34
|
-
1. **Token Usage Warnings**: Watch for warnings as the context approaches limits
|
35
|
-
2. **Automatic Handling**: The workflow continues even with large outputs
|
36
|
-
3. **Preserved Context**: Critical steps remain accessible throughout execution
|
37
|
-
|
38
|
-
## Customization
|
39
|
-
|
40
|
-
Try modifying the configuration:
|
41
|
-
- Lower `max_tokens` to trigger compaction sooner
|
42
|
-
- Change `strategy` to test different compaction approaches
|
43
|
-
- Add more steps to `retain_steps` to preserve additional context
|
@@ -1,42 +0,0 @@
|
|
1
|
-
name: Context Management Demo
|
2
|
-
tools:
|
3
|
-
- Roast::Tools::ReadFile
|
4
|
-
- Roast::Tools::WriteFile
|
5
|
-
|
6
|
-
# Context management configuration
|
7
|
-
context_management:
|
8
|
-
enabled: true
|
9
|
-
strategy: auto
|
10
|
-
threshold: 0.8 # Trigger compaction at 80% of context window
|
11
|
-
max_tokens: 10000 # Demo with smaller limit for testing
|
12
|
-
retain_steps:
|
13
|
-
- analyze_requirements
|
14
|
-
- generate_summary
|
15
|
-
|
16
|
-
steps:
|
17
|
-
- analyze_requirements: |
|
18
|
-
Analyze this text and list the key requirements:
|
19
|
-
|
20
|
-
We need a system that can:
|
21
|
-
1. Process customer orders
|
22
|
-
2. Track inventory levels
|
23
|
-
3. Generate reports
|
24
|
-
4. Handle refunds
|
25
|
-
5. Integrate with payment systems
|
26
|
-
|
27
|
-
- expand_details: |
|
28
|
-
For each requirement from the previous step, provide detailed implementation notes,
|
29
|
-
technical considerations, and potential challenges. Be very thorough and verbose
|
30
|
-
to help test the context management system.
|
31
|
-
|
32
|
-
- generate_more_context: |
|
33
|
-
Now describe the database schema needed for this system. Include all tables,
|
34
|
-
relationships, indexes, and data types. Be extremely detailed.
|
35
|
-
|
36
|
-
- add_api_design: |
|
37
|
-
Design a complete REST API for this system. Include all endpoints, request/response
|
38
|
-
formats, authentication, and error handling. Provide examples for each endpoint.
|
39
|
-
|
40
|
-
- generate_summary: |
|
41
|
-
Create a concise executive summary of the system design. Focus on the key decisions
|
42
|
-
and trade-offs made during the design process.
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Direct Coerce Syntax
|
2
|
-
|
3
|
-
This example demonstrates the simplified syntax for specifying `coerce_to` and other configuration options directly on iteration steps.
|
4
|
-
|
5
|
-
## Direct Syntax
|
6
|
-
|
7
|
-
Configuration options are specified directly on the step:
|
8
|
-
|
9
|
-
```yaml
|
10
|
-
- repeat:
|
11
|
-
until: "condition"
|
12
|
-
coerce_to: boolean
|
13
|
-
print_response: true
|
14
|
-
model: "claude-3-haiku"
|
15
|
-
steps: [...]
|
16
|
-
```
|
17
|
-
|
18
|
-
## Benefits
|
19
|
-
|
20
|
-
1. **Cleaner YAML** - No unnecessary nesting
|
21
|
-
2. **More intuitive** - Configuration options are at the same level as other step properties
|
22
|
-
3. **Consistent** - Matches how other step properties are specified
|
23
|
-
|
24
|
-
## Supported Options
|
25
|
-
|
26
|
-
All step configuration options can be specified directly:
|
27
|
-
- `coerce_to` - Type coercion (boolean, llm_boolean, iterable)
|
28
|
-
- `print_response` - Whether to print LLM responses
|
29
|
-
- `loop` - Auto-loop behavior
|
30
|
-
- `json` - JSON response mode
|
31
|
-
- `params` - Additional parameters
|
32
|
-
- `model` - Model override
|
Binary file
|
@@ -1,36 +0,0 @@
|
|
1
|
-
name: Direct Coerce Syntax Demo
|
2
|
-
description: Demonstrates the simplified coerce_to syntax without config blocks
|
3
|
-
|
4
|
-
steps:
|
5
|
-
# Example 1: Direct coerce_to on repeat
|
6
|
-
- repeat:
|
7
|
-
until: "check_api_ready"
|
8
|
-
coerce_to: boolean # Direct syntax - no config block needed
|
9
|
-
max_iterations: 5
|
10
|
-
steps:
|
11
|
-
- check_api_ready:
|
12
|
-
prompt: "Check if the API endpoint returns a 200 status"
|
13
|
-
- wait: 2
|
14
|
-
|
15
|
-
# Example 2: Direct coerce_to on each
|
16
|
-
- get_data_sources:
|
17
|
-
prompt: "List available data sources, one per line"
|
18
|
-
|
19
|
-
- each: "get_data_sources"
|
20
|
-
as: "source"
|
21
|
-
coerce_to: iterable # Direct syntax
|
22
|
-
steps:
|
23
|
-
- validate_source: "Validating {{source}}..."
|
24
|
-
- process_source:
|
25
|
-
prompt: "Process data from {{source}}"
|
26
|
-
|
27
|
-
# Example 3: Multiple configuration options
|
28
|
-
- repeat:
|
29
|
-
until: "all_tests_pass"
|
30
|
-
coerce_to: llm_boolean # Override default
|
31
|
-
print_response: true # Other options work too
|
32
|
-
max_iterations: 10
|
33
|
-
steps:
|
34
|
-
- run_tests: "$(rake test)"
|
35
|
-
- all_tests_pass:
|
36
|
-
prompt: "Did all tests pass successfully?"
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Dot Notation Access Example
|
2
|
-
|
3
|
-
This example demonstrates the new dot notation access feature for workflow outputs.
|
4
|
-
|
5
|
-
## Usage
|
6
|
-
|
7
|
-
With the new dot notation feature, you can access output values using Ruby's method syntax instead of hash syntax:
|
8
|
-
|
9
|
-
### Before (hash syntax):
|
10
|
-
```yaml
|
11
|
-
until: "output[:update_fix_count][:fixes_applied] >= 5 || output[:select_next_issue][:no_issues_left] == true"
|
12
|
-
```
|
13
|
-
|
14
|
-
### After (dot notation):
|
15
|
-
```yaml
|
16
|
-
until: "output.update_fix_count.fixes_applied >= 5 || output.select_next_issue.no_issues_left?"
|
17
|
-
```
|
18
|
-
|
19
|
-
### Even cleaner (omitting output prefix):
|
20
|
-
```yaml
|
21
|
-
until: "update_fix_count.fixes_applied >= 5 || select_next_issue.no_issues_left?"
|
22
|
-
```
|
23
|
-
|
24
|
-
## Features
|
25
|
-
|
26
|
-
1. **Nested access**: `output.step_name.nested.value`
|
27
|
-
2. **Boolean predicates**: `output.step_name.is_complete?` returns false for nil/false values
|
28
|
-
3. **Direct access**: Omit the `output.` prefix for cleaner syntax
|
29
|
-
4. **Backward compatible**: Hash syntax still works (`output[:step_name][:value]`)
|
30
|
-
|
31
|
-
## Example Workflow
|
32
|
-
|
33
|
-
See `workflow.yml` for a complete example that demonstrates:
|
34
|
-
- Setting values in output
|
35
|
-
- Using dot notation in conditions
|
36
|
-
- Boolean predicate methods
|
37
|
-
- Nested value access
|
Binary file
|
@@ -1,44 +0,0 @@
|
|
1
|
-
name: dot_notation_example
|
2
|
-
description: Example demonstrating dot notation access for workflow outputs
|
3
|
-
|
4
|
-
steps:
|
5
|
-
initialize:
|
6
|
-
prompt: |
|
7
|
-
Initialize the workflow with some sample data.
|
8
|
-
|
9
|
-
Set output.counter to 0
|
10
|
-
Set output.config.max_iterations to 5
|
11
|
-
Set output.config.enabled to true
|
12
|
-
|
13
|
-
process_items:
|
14
|
-
repeat:
|
15
|
-
# Using dot notation in conditions
|
16
|
-
until: "counter >= config.max_iterations || !config.enabled?"
|
17
|
-
steps:
|
18
|
-
- increment_counter
|
19
|
-
- check_status
|
20
|
-
|
21
|
-
increment_counter:
|
22
|
-
prompt: |
|
23
|
-
Increment the counter by 1.
|
24
|
-
Current counter value: {{counter}}
|
25
|
-
|
26
|
-
Set output.counter to {{counter}} + 1
|
27
|
-
|
28
|
-
check_status:
|
29
|
-
prompt: |
|
30
|
-
Check if we should continue processing.
|
31
|
-
|
32
|
-
Current counter: {{counter}}
|
33
|
-
Max iterations: {{config.max_iterations}}
|
34
|
-
|
35
|
-
If counter is 3, set output.config.enabled to false
|
36
|
-
Set output.status.last_checked to current counter value
|
37
|
-
|
38
|
-
summarize:
|
39
|
-
prompt: |
|
40
|
-
Summarize the results:
|
41
|
-
- Total iterations: {{counter}}
|
42
|
-
- Last checked at: {{status.last_checked}}
|
43
|
-
- Was enabled: {{config.enabled}}
|
44
|
-
- Hit max iterations: {{counter >= config.max_iterations ? "Yes" : "No"}}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Exit on Error Example
|
2
|
-
|
3
|
-
This example demonstrates how to use the `exit_on_error` configuration option to continue workflow execution even when a command fails.
|
4
|
-
|
5
|
-
## Use Case
|
6
|
-
|
7
|
-
When running a linter like RuboCop on a file with syntax errors or style violations, the command will exit with a non-zero status. By default, this would halt the workflow. However, we often want to:
|
8
|
-
|
9
|
-
1. Capture the linter output (including errors)
|
10
|
-
2. Analyze what went wrong
|
11
|
-
3. Apply fixes based on the analysis
|
12
|
-
|
13
|
-
## Configuration
|
14
|
-
|
15
|
-
The key configuration is in the step configuration section:
|
16
|
-
|
17
|
-
```yaml
|
18
|
-
lint_check:
|
19
|
-
exit_on_error: false
|
20
|
-
```
|
21
|
-
|
22
|
-
This tells Roast to:
|
23
|
-
- Continue workflow execution even if the command fails
|
24
|
-
- Capture the full output (stdout and stderr)
|
25
|
-
- Append the exit status to the output
|
26
|
-
|
27
|
-
## Output Format
|
28
|
-
|
29
|
-
When a command fails with `exit_on_error: false`, the output will look like:
|
30
|
-
|
31
|
-
```
|
32
|
-
lib/example.rb:5:3: C: Style/StringLiterals: Prefer double-quoted strings
|
33
|
-
'hello'
|
34
|
-
^^^^^^^
|
35
|
-
[Exit status: 1]
|
36
|
-
```
|
37
|
-
|
38
|
-
This allows subsequent steps to process both the error output and the exit status.
|
39
|
-
|
40
|
-
## Running the Example
|
41
|
-
|
42
|
-
```bash
|
43
|
-
roast execute workflow.yml path/to/file.rb
|
44
|
-
```
|
45
|
-
|
46
|
-
The workflow will:
|
47
|
-
1. Run RuboCop on the file
|
48
|
-
2. Continue even if RuboCop finds issues
|
49
|
-
3. Analyze the linter output
|
50
|
-
4. Apply fixes based on the analysis
|
@@ -1,9 +0,0 @@
|
|
1
|
-
The linter output from the previous step shows issues with the code.
|
2
|
-
Please analyze the output and identify the specific problems that need to be fixed.
|
3
|
-
|
4
|
-
Focus on:
|
5
|
-
- Syntax errors
|
6
|
-
- Style violations
|
7
|
-
- Best practice violations
|
8
|
-
|
9
|
-
Provide a structured list of issues found.
|
Binary file
|
@@ -1,19 +0,0 @@
|
|
1
|
-
name: Linting with Error Recovery
|
2
|
-
tools:
|
3
|
-
- Roast::Tools::ReadFile
|
4
|
-
- Roast::Tools::WriteFile
|
5
|
-
- Roast::Tools::CodingAgent
|
6
|
-
|
7
|
-
steps:
|
8
|
-
# Run linter on the file - may fail if there are syntax errors
|
9
|
-
- lint_check: $(rubocop {{file}})
|
10
|
-
|
11
|
-
# Analyze linter output and fix issues even if linter failed
|
12
|
-
- analyze_lint_output
|
13
|
-
|
14
|
-
# Apply fixes based on the analysis
|
15
|
-
- apply_fixes
|
16
|
-
|
17
|
-
# Step configuration
|
18
|
-
lint_check:
|
19
|
-
exit_on_error: false # Continue even if rubocop exits with non-zero status
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
if ARGV.length != 2
|
5
|
-
puts "Usage: #{File.basename($PROGRAM_NAME)} SUBJECT_FILE TEST_FILE"
|
6
|
-
exit 1
|
7
|
-
end
|
8
|
-
|
9
|
-
subject_file, test_file = ARGV
|
10
|
-
|
11
|
-
def detect_package_manager
|
12
|
-
return "pnpm" if File.exist?(File.join(Dir.pwd, "pnpm-lock.yaml"))
|
13
|
-
return "yarn" if File.exist?(File.join(Dir.pwd, "yarn.lock"))
|
14
|
-
|
15
|
-
"npm"
|
16
|
-
end
|
17
|
-
|
18
|
-
jest_options = [
|
19
|
-
"--verbose",
|
20
|
-
"--no-colors",
|
21
|
-
"--ci",
|
22
|
-
"--coverageReporters=text-summary",
|
23
|
-
"--collectCoverageFrom=#{subject_file}",
|
24
|
-
]
|
25
|
-
|
26
|
-
# Assumes the test command is `test:coverage`
|
27
|
-
# Both admin-web and checkout-web use this command
|
28
|
-
command = "#{detect_package_manager} run test:coverage -- #{test_file} #{jest_options.join(" ")}"
|
29
|
-
|
30
|
-
$stderr.puts "Running: #{command}"
|
31
|
-
puts Roast::Helpers::CmdRunner.system(command)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "rubygems"
|
5
|
-
require "bundler/setup"
|
6
|
-
|
7
|
-
require "roast/helpers/minitest_coverage_runner"
|
8
|
-
|
9
|
-
# Suppress fancy minitest reporting
|
10
|
-
ENV["RM_INFO"] = "true"
|
11
|
-
|
12
|
-
if ARGV.length != 2
|
13
|
-
puts "Usage: #{File.basename($PROGRAM_NAME)} SUBJECT_FILE TEST_FILE"
|
14
|
-
exit 1
|
15
|
-
end
|
16
|
-
|
17
|
-
test_file, subject_file = ARGV
|
18
|
-
|
19
|
-
Roast::Helpers::MinitestCoverageRunner.new(test_file, subject_file).run
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class RunCoverage < Roast::Workflow::BaseStep
|
4
|
-
def call
|
5
|
-
# Run the test with coverage analysis
|
6
|
-
run_test_with_coverage
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def run_test_with_coverage
|
12
|
-
subject_file = workflow.output["read_dependencies"]
|
13
|
-
subject_file = subject_file.match(%r{<sut>(.*?)</sut>})&.[](1) || subject_file
|
14
|
-
test_file = workflow.file
|
15
|
-
extension = File.extname(test_file).gsub(".", "")
|
16
|
-
|
17
|
-
# Handle JS/TS test files
|
18
|
-
extension = "js" if ["js", "jsx", "ts", "tsx"].include?(extension)
|
19
|
-
|
20
|
-
# Get the absolute path to the test_runner executable
|
21
|
-
test_runner_path = File.expand_path("#{extension}_test_runner", __dir__)
|
22
|
-
|
23
|
-
# Make sure the test_runner executable exists
|
24
|
-
unless File.exist?(test_runner_path)
|
25
|
-
Roast::Helpers::Logger.error("Test runner executable not found: #{test_runner_path}")
|
26
|
-
exit(1)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Resolve paths to prevent issues when pwd differs from project root
|
30
|
-
resolved_subject_file = Roast::Helpers::PathResolver.resolve(subject_file)
|
31
|
-
unless File.exist?(resolved_subject_file)
|
32
|
-
Roast::Helpers::Logger.error("Subject file not found: #{resolved_subject_file}")
|
33
|
-
exit(1)
|
34
|
-
end
|
35
|
-
|
36
|
-
resolved_test_file = Roast::Helpers::PathResolver.resolve(test_file)
|
37
|
-
unless File.exist?(resolved_test_file)
|
38
|
-
Roast::Helpers::Logger.error("Test file not found: #{resolved_test_file}")
|
39
|
-
exit(1)
|
40
|
-
end
|
41
|
-
|
42
|
-
# Run the test_runner using shadowenv for environment consistency
|
43
|
-
command = "shadowenv exec --dir . -- #{test_runner_path} #{resolved_test_file} #{resolved_subject_file}"
|
44
|
-
output, status = Roast::Helpers::CmdRunner.capture2(command)
|
45
|
-
|
46
|
-
unless status.success?
|
47
|
-
Roast::Helpers::Logger.error("Test runner exited with non-zero status: #{status.exitstatus}")
|
48
|
-
Roast::Helpers::Logger.error(output)
|
49
|
-
exit(status.exitstatus)
|
50
|
-
end
|
51
|
-
|
52
|
-
output
|
53
|
-
end
|
54
|
-
end
|
Binary file
|
@@ -1,6 +0,0 @@
|
|
1
|
-
As a senior Ruby engineer and testing expert, evaluate the quality of this Ruby test file. Next I will now provide the source code of the test that we will be analyzing, and then step you through a series of analysis activities, before finally asking you to provided a final report.
|
2
|
-
|
3
|
-
<test>
|
4
|
-
# <%= file %>
|
5
|
-
<%= File.read(file) %>
|
6
|
-
</test>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
As a senior front-end engineer and testing expert, evaluate the quality of this test file. Next I will now provide the source code of the test that we will be analyzing, and then step you through a series of analysis activities, before finally asking you to provided a final report.
|
2
|
-
|
3
|
-
<test>
|
4
|
-
# <%= file %>
|
5
|
-
<%= File.read(file) %>
|
6
|
-
</test>
|