roast-ai 0.3.1 → 0.4.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 +4 -4
- data/.github/workflows/ci.yaml +2 -2
- data/.gitignore +1 -0
- data/CHANGELOG.md +85 -0
- data/CLAUDE.md +106 -9
- data/Gemfile +4 -1
- data/Gemfile.lock +70 -16
- data/README.md +159 -8
- data/bin/console +1 -0
- data/bin/roast +1 -1
- data/claude-swarm.yml +210 -0
- data/docs/AGENT_STEPS.md +288 -0
- data/docs/VALIDATION.md +178 -0
- data/examples/agent_continue/add_documentation/prompt.md +5 -0
- data/examples/agent_continue/add_error_handling/prompt.md +5 -0
- data/examples/agent_continue/analyze_codebase/prompt.md +7 -0
- data/examples/agent_continue/combined_workflow.yml +24 -0
- data/examples/agent_continue/continue_adding_features/prompt.md +4 -0
- data/examples/agent_continue/create_integration_tests/prompt.md +3 -0
- data/examples/agent_continue/document_with_context/prompt.md +5 -0
- data/examples/agent_continue/explore_api/prompt.md +6 -0
- data/examples/agent_continue/implement_client/prompt.md +6 -0
- data/examples/agent_continue/inline_workflow.yml +20 -0
- data/examples/agent_continue/refactor_code/prompt.md +2 -0
- data/examples/agent_continue/verify_changes/prompt.md +6 -0
- data/examples/agent_continue/workflow.yml +27 -0
- data/examples/agent_workflow/README.md +75 -0
- data/examples/agent_workflow/apply_refactorings/prompt.md +22 -0
- data/examples/agent_workflow/identify_code_smells/prompt.md +15 -0
- data/examples/agent_workflow/summarize_improvements/prompt.md +18 -0
- data/examples/agent_workflow/workflow.png +0 -0
- data/examples/agent_workflow/workflow.yml +16 -0
- data/examples/api_workflow/workflow.png +0 -0
- data/examples/apply_diff_demo/README.md +58 -0
- data/examples/apply_diff_demo/apply_simple_change/prompt.md +13 -0
- data/examples/apply_diff_demo/create_sample_file/prompt.md +11 -0
- data/examples/apply_diff_demo/workflow.yml +24 -0
- data/examples/available_tools_demo/README.md +42 -0
- data/examples/available_tools_demo/analyze_files/prompt.md +6 -0
- data/examples/available_tools_demo/explore_directory/prompt.md +6 -0
- data/examples/available_tools_demo/workflow.png +0 -0
- data/examples/available_tools_demo/workflow.yml +32 -0
- data/examples/available_tools_demo/write_summary/prompt.md +6 -0
- data/examples/bash_prototyping/api_testing.png +0 -0
- data/examples/bash_prototyping/system_analysis.png +0 -0
- data/examples/case_when/detect_language/prompt.md +2 -2
- data/examples/case_when/workflow.png +0 -0
- data/examples/cmd/basic_workflow.png +0 -0
- data/examples/cmd/dev_workflow.png +0 -0
- data/examples/cmd/explorer_workflow.png +0 -0
- data/examples/conditional/simple_workflow.png +0 -0
- data/examples/conditional/workflow.png +0 -0
- data/examples/context_management_demo/README.md +43 -0
- data/examples/context_management_demo/workflow.yml +42 -0
- data/examples/direct_coerce_syntax/workflow.png +0 -0
- data/examples/dot_notation/workflow.png +0 -0
- data/examples/exit_on_error/workflow.png +0 -0
- data/examples/grading/run_coverage.rb +0 -2
- data/examples/grading/workflow.png +0 -0
- data/examples/interpolation/workflow.png +0 -0
- data/examples/interpolation/workflow.yml +1 -1
- data/examples/iteration/analyze_complexity/prompt.md +2 -2
- data/examples/iteration/generate_recommendations/prompt.md +2 -2
- data/examples/iteration/implement_fix/prompt.md +2 -2
- data/examples/iteration/prioritize_issues/prompt.md +1 -1
- data/examples/iteration/prompts/analyze_file.md +2 -2
- data/examples/iteration/prompts/generate_summary.md +1 -1
- data/examples/iteration/prompts/update_report.md +3 -3
- data/examples/iteration/prompts/write_report.md +3 -3
- data/examples/iteration/read_file/prompt.md +2 -2
- data/examples/iteration/select_next_issue/prompt.md +2 -2
- data/examples/iteration/update_fix_count/prompt.md +4 -4
- data/examples/iteration/verify_fix/prompt.md +3 -3
- data/examples/iteration/workflow.png +0 -0
- data/examples/json_handling/workflow.png +0 -0
- data/examples/mcp/README.md +3 -3
- data/examples/mcp/analyze_changes/prompt.md +1 -1
- data/examples/mcp/database_workflow.png +0 -0
- data/examples/mcp/database_workflow.yml +1 -1
- data/examples/mcp/env_demo/workflow.png +0 -0
- data/examples/mcp/fetch_pr_context/prompt.md +1 -1
- data/examples/mcp/filesystem_demo/workflow.png +0 -0
- data/examples/mcp/github_workflow.png +0 -0
- data/examples/mcp/github_workflow.yml +1 -1
- data/examples/mcp/multi_mcp_workflow.png +0 -0
- data/examples/mcp/post_review/prompt.md +1 -1
- data/examples/mcp/workflow.png +0 -0
- data/examples/no_model_fallback/README.md +17 -0
- data/examples/no_model_fallback/analyze_file/prompt.md +1 -0
- data/examples/no_model_fallback/analyze_patterns/prompt.md +27 -0
- data/examples/no_model_fallback/generate_report_for_md/prompt.md +10 -0
- data/examples/no_model_fallback/generate_report_for_rb/prompt.md +3 -0
- data/examples/no_model_fallback/sample.rb +42 -0
- data/examples/no_model_fallback/workflow.yml +19 -0
- data/examples/openrouter_example/workflow.png +0 -0
- data/examples/pre_post_processing/analyze_test_file/prompt.md +1 -1
- data/examples/pre_post_processing/improve_test_coverage/prompt.md +1 -1
- data/examples/pre_post_processing/optimize_test_performance/prompt.md +1 -1
- data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +2 -2
- data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +1 -1
- data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +1 -1
- data/examples/pre_post_processing/validate_changes/prompt.md +2 -2
- data/examples/pre_post_processing/workflow.png +0 -0
- data/examples/rspec_to_minitest/workflow.png +0 -0
- data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
- data/examples/shared_config/shared.png +0 -0
- data/examples/single_target_prepost/workflow.png +0 -0
- data/examples/smart_coercion_defaults/workflow.png +0 -0
- data/examples/step_configuration/workflow.png +0 -0
- data/examples/swarm_example.yml +25 -0
- data/examples/tool_config_example/workflow.png +0 -0
- data/examples/user_input/README.md +90 -0
- data/examples/user_input/funny_name/create_backstory/prompt.md +10 -0
- data/examples/user_input/funny_name/workflow.png +0 -0
- data/examples/user_input/funny_name/workflow.yml +26 -0
- data/examples/user_input/generate_summary/prompt.md +11 -0
- data/examples/user_input/simple_input_demo/workflow.png +0 -0
- data/examples/user_input/simple_input_demo/workflow.yml +35 -0
- data/examples/user_input/survey_workflow.png +0 -0
- data/examples/user_input/survey_workflow.yml +71 -0
- data/examples/user_input/welcome_message/prompt.md +3 -0
- data/examples/user_input/workflow.png +0 -0
- data/examples/user_input/workflow.yml +73 -0
- data/examples/workflow_generator/create_workflow_files/prompt.md +1 -1
- data/examples/workflow_generator/workflow.png +0 -0
- data/lib/roast/errors.rb +6 -4
- data/lib/roast/helpers/function_caching_interceptor.rb +0 -2
- data/lib/roast/helpers/logger.rb +12 -35
- data/lib/roast/helpers/minitest_coverage_runner.rb +0 -1
- data/lib/roast/helpers/prompt_loader.rb +0 -2
- data/lib/roast/helpers/timeout_handler.rb +91 -0
- data/lib/roast/resources/api_resource.rb +0 -4
- data/lib/roast/resources/url_resource.rb +0 -3
- data/lib/roast/resources.rb +0 -8
- data/lib/roast/services/context_threshold_checker.rb +42 -0
- data/lib/roast/services/token_counting_service.rb +44 -0
- data/lib/roast/tools/apply_diff.rb +128 -0
- data/lib/roast/tools/ask_user.rb +0 -2
- data/lib/roast/tools/bash.rb +12 -9
- data/lib/roast/tools/cmd.rb +29 -12
- data/lib/roast/tools/coding_agent.rb +65 -17
- data/lib/roast/tools/context_summarizer.rb +108 -0
- data/lib/roast/tools/grep.rb +0 -3
- data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -4
- data/lib/roast/tools/read_file.rb +0 -2
- data/lib/roast/tools/search_file.rb +0 -2
- data/lib/roast/tools/swarm.rb +124 -0
- data/lib/roast/tools/update_files.rb +0 -4
- data/lib/roast/tools/write_file.rb +0 -3
- data/lib/roast/tools.rb +0 -13
- data/lib/roast/value_objects/step_name.rb +14 -3
- data/lib/roast/value_objects/workflow_path.rb +0 -2
- data/lib/roast/value_objects.rb +4 -4
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/agent_step.rb +33 -0
- data/lib/roast/workflow/api_configuration.rb +0 -4
- data/lib/roast/workflow/base_iteration_step.rb +3 -6
- data/lib/roast/workflow/base_step.rb +54 -28
- data/lib/roast/workflow/base_workflow.rb +43 -23
- data/lib/roast/workflow/case_executor.rb +0 -1
- data/lib/roast/workflow/case_step.rb +0 -4
- data/lib/roast/workflow/command_executor.rb +0 -2
- data/lib/roast/workflow/conditional_executor.rb +0 -1
- data/lib/roast/workflow/conditional_step.rb +0 -4
- data/lib/roast/workflow/configuration.rb +5 -67
- data/lib/roast/workflow/configuration_loader.rb +63 -3
- data/lib/roast/workflow/configuration_parser.rb +1 -7
- data/lib/roast/workflow/context_manager.rb +89 -0
- data/lib/roast/workflow/dot_access_hash.rb +16 -1
- data/lib/roast/workflow/each_step.rb +1 -1
- data/lib/roast/workflow/error_handler.rb +0 -3
- data/lib/roast/workflow/expression_evaluator.rb +0 -3
- data/lib/roast/workflow/file_state_repository.rb +0 -5
- data/lib/roast/workflow/input_executor.rb +41 -0
- data/lib/roast/workflow/input_step.rb +163 -0
- data/lib/roast/workflow/iteration_executor.rb +0 -2
- data/lib/roast/workflow/output_handler.rb +1 -3
- data/lib/roast/workflow/output_manager.rb +0 -2
- data/lib/roast/workflow/repeat_step.rb +1 -1
- data/lib/roast/workflow/replay_handler.rb +1 -4
- data/lib/roast/workflow/resource_resolver.rb +0 -3
- data/lib/roast/workflow/session_manager.rb +0 -3
- data/lib/roast/workflow/sqlite_state_repository.rb +342 -0
- data/lib/roast/workflow/state_manager.rb +2 -4
- data/lib/roast/workflow/state_repository_factory.rb +36 -0
- data/lib/roast/workflow/step_completion_reporter.rb +27 -0
- data/lib/roast/workflow/step_executor_coordinator.rb +48 -24
- data/lib/roast/workflow/step_executor_factory.rb +0 -5
- data/lib/roast/workflow/step_executor_registry.rb +1 -4
- data/lib/roast/workflow/step_executor_with_reporting.rb +68 -0
- data/lib/roast/workflow/step_executors/hash_step_executor.rb +0 -3
- data/lib/roast/workflow/step_executors/parallel_step_executor.rb +0 -3
- data/lib/roast/workflow/step_executors/string_step_executor.rb +0 -2
- data/lib/roast/workflow/step_factory.rb +56 -0
- data/lib/roast/workflow/step_loader.rb +31 -17
- data/lib/roast/workflow/step_name_extractor.rb +84 -0
- data/lib/roast/workflow/step_orchestrator.rb +3 -2
- data/lib/roast/workflow/step_type_resolver.rb +28 -1
- data/lib/roast/workflow/validation_command.rb +197 -0
- data/lib/roast/workflow/validator.rb +0 -4
- data/lib/roast/workflow/validators/base_validator.rb +44 -0
- data/lib/roast/workflow/validators/dependency_validator.rb +223 -0
- data/lib/roast/workflow/validators/linting_validator.rb +113 -0
- data/lib/roast/workflow/validators/schema_validator.rb +90 -0
- data/lib/roast/workflow/validators/step_collector.rb +57 -0
- data/lib/roast/workflow/validators/validation_orchestrator.rb +52 -0
- data/lib/roast/workflow/workflow_executor.rb +11 -20
- data/lib/roast/workflow/workflow_initializer.rb +1 -8
- data/lib/roast/workflow/workflow_runner.rb +6 -7
- data/lib/roast/workflow.rb +0 -15
- data/lib/roast/workflow_diagram_generator.rb +298 -0
- data/lib/roast.rb +212 -10
- data/roast.gemspec +4 -2
- data/schema/workflow.json +123 -1
- metadata +143 -6
- data/lib/roast/helpers.rb +0 -12
data/examples/mcp/README.md
CHANGED
@@ -44,7 +44,7 @@ tools:
|
|
44
44
|
- --rm
|
45
45
|
- ghcr.io/example/mcp-server
|
46
46
|
env:
|
47
|
-
API_KEY: "{{
|
47
|
+
API_KEY: "{{ENV['API_KEY']}}"
|
48
48
|
except:
|
49
49
|
- dangerous_function
|
50
50
|
```
|
@@ -116,7 +116,7 @@ tools:
|
|
116
116
|
command: npx
|
117
117
|
args: ["-y", "@modelcontextprotocol/server-github"]
|
118
118
|
env:
|
119
|
-
GITHUB_PERSONAL_ACCESS_TOKEN: "{{
|
119
|
+
GITHUB_PERSONAL_ACCESS_TOKEN: "{{ENV['GITHUB_TOKEN']}}"
|
120
120
|
only:
|
121
121
|
- search_repositories
|
122
122
|
- get_issue
|
@@ -131,7 +131,7 @@ tools:
|
|
131
131
|
command: npx
|
132
132
|
args: ["-y", "@modelcontextprotocol/server-postgres"]
|
133
133
|
env:
|
134
|
-
DATABASE_URL: "{{
|
134
|
+
DATABASE_URL: "{{ENV['DATABASE_URL']}}"
|
135
135
|
only:
|
136
136
|
- query
|
137
137
|
- list_tables
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Using the GitHub tool, post the code review as a comment on PR
|
1
|
+
Using the GitHub tool, post the code review as a comment on PR #<%= ENV['PR_NUMBER'] %>.
|
2
2
|
Format the review in a friendly, constructive manner.
|
3
3
|
Include specific line-by-line suggestions where appropriate.
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# No Model Fallback Example
|
2
|
+
|
3
|
+
This example demonstrates the issue where workflows without explicit model specification do not properly fall back to a default model.
|
4
|
+
|
5
|
+
## Purpose
|
6
|
+
|
7
|
+
This workflow is based on the interpolation example but intentionally omits the `model` field to test the fallback behavior.
|
8
|
+
|
9
|
+
## Expected Behavior
|
10
|
+
|
11
|
+
The workflow should fall back to a default model when no model is specified at the workflow level.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bin/roast examples/no_model_fallback/workflow.yml --file examples/no_model_fallback/sample.rb
|
17
|
+
```
|
@@ -0,0 +1 @@
|
|
1
|
+
Analyze the file at: <%= workflow.file %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Extract some patterns about this file and return in json format like this:
|
2
|
+
|
3
|
+
<json>
|
4
|
+
{
|
5
|
+
"code_patterns": {
|
6
|
+
"class_structure": {
|
7
|
+
"name": "Calculator",
|
8
|
+
"instance_variables": ["@memory"],
|
9
|
+
"method_count": 7,
|
10
|
+
"method_types": {
|
11
|
+
"constructor": ["initialize"],
|
12
|
+
"operations": ["add", "subtract", "multiply", "divide"],
|
13
|
+
"accessors": ["memory"],
|
14
|
+
"utility": ["clear"]
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"error_handling": {
|
18
|
+
"techniques": ["conditional raise", "zero check"],
|
19
|
+
"examples": ["raise \"Division by zero!\" if number.zero?"]
|
20
|
+
},
|
21
|
+
"design_patterns": {
|
22
|
+
"state": "Uses instance variable to maintain calculator state",
|
23
|
+
"command": "Each operation method modifies the internal state"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
</json>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Generate a comprehensive report for the markdown file.
|
2
|
+
|
3
|
+
File content: {{steps.analyze_file}}
|
4
|
+
|
5
|
+
Patterns found: {{steps.analyze_patterns}}
|
6
|
+
|
7
|
+
Please create a detailed report that includes:
|
8
|
+
1. Summary of the file content
|
9
|
+
2. Key patterns identified
|
10
|
+
3. Any recommendations or observations
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Sample Ruby file for testing interpolation in workflows
|
4
|
+
|
5
|
+
class Calculator
|
6
|
+
def initialize
|
7
|
+
@memory = 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def add(number)
|
11
|
+
@memory += number
|
12
|
+
end
|
13
|
+
|
14
|
+
def subtract(number)
|
15
|
+
@memory -= number
|
16
|
+
end
|
17
|
+
|
18
|
+
def multiply(number)
|
19
|
+
@memory *= number
|
20
|
+
end
|
21
|
+
|
22
|
+
def divide(number)
|
23
|
+
raise "Division by zero!" if number.zero?
|
24
|
+
|
25
|
+
@memory /= number
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_reader :memory
|
29
|
+
|
30
|
+
def clear
|
31
|
+
@memory = 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Example usage
|
36
|
+
if __FILE__ == $PROGRAM_NAME
|
37
|
+
calc = Calculator.new
|
38
|
+
calc.add(10)
|
39
|
+
calc.multiply(2)
|
40
|
+
calc.subtract(5)
|
41
|
+
puts "Result: #{calc.memory}"
|
42
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: no_model_fallback_example
|
2
|
+
|
3
|
+
tools:
|
4
|
+
- Roast::Tools::ReadFile
|
5
|
+
|
6
|
+
steps:
|
7
|
+
- analyze_file
|
8
|
+
- analyze_patterns
|
9
|
+
- generate_report_for_{{File.extname(workflow.file).sub('.', '')}}
|
10
|
+
- '$(echo "Processing completed for file: {{File.basename(workflow.file)}}")'
|
11
|
+
|
12
|
+
analyze_patterns:
|
13
|
+
json: true
|
14
|
+
|
15
|
+
generate_report_for_rb:
|
16
|
+
print_response: true
|
17
|
+
|
18
|
+
generate_report_for_md:
|
19
|
+
print_response: true
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Improve Test Coverage
|
2
2
|
|
3
|
-
Based on the analysis of
|
3
|
+
Based on the analysis of <%= file %>, implement the following improvements:
|
4
4
|
|
5
5
|
1. **Add Missing Test Cases**: Write tests for uncovered code paths, edge cases, and error conditions
|
6
6
|
2. **Improve Test Descriptions**: Make test names more descriptive and follow consistent naming conventions
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Aggregate all the metrics collected during the workflow execution:
|
4
4
|
|
5
5
|
Available data:
|
6
|
-
- Pre-processing baseline metrics:
|
7
|
-
- Results from all processed test files:
|
6
|
+
- Pre-processing baseline metrics: <%= pre_processing.gather_baseline_metrics %>
|
7
|
+
- Results from all processed test files: <%= output.targets %>
|
8
8
|
|
9
9
|
Please calculate and provide:
|
10
10
|
|
@@ -9,7 +9,7 @@ Provide a high-level overview of the optimization results, key achievements, and
|
|
9
9
|
|
10
10
|
### Metrics Summary
|
11
11
|
Include the aggregated metrics from the previous step:
|
12
|
-
|
12
|
+
<%= aggregate_metrics %>
|
13
13
|
|
14
14
|
### Detailed Results by File
|
15
15
|
For each processed test file, include:
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Prepare the test environment for optimization. Please:
|
4
4
|
|
5
5
|
1. Ensure all test dependencies are installed
|
6
|
-
2. Create a backup branch for safety: `test-optimization-backup
|
6
|
+
2. Create a backup branch for safety: `test-optimization-backup-<%= timestamp %>`
|
7
7
|
3. Set up any necessary test databases or fixtures
|
8
8
|
4. Configure test parallelization settings if available
|
9
9
|
5. Clear any test caches that might affect benchmarking
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Validate Changes
|
2
2
|
|
3
|
-
Validate the changes made to
|
3
|
+
Validate the changes made to <%= file %>:
|
4
4
|
|
5
5
|
1. **Run the updated tests** and ensure they all pass
|
6
6
|
2. **Check coverage metrics** to verify improvements
|
@@ -11,7 +11,7 @@ Validate the changes made to {{file}}:
|
|
11
11
|
Store the validation results in the workflow state:
|
12
12
|
```json
|
13
13
|
{
|
14
|
-
"file": "
|
14
|
+
"file": "<%= file %>",
|
15
15
|
"tests_passed": true,
|
16
16
|
"coverage_before": 0.0,
|
17
17
|
"coverage_after": 0.0,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Swarm Example Workflow
|
2
|
+
|
3
|
+
# Example workflow demonstrating Roast's integration with Claude Swarm
|
4
|
+
# The Swarm tool is available to the LLM, which can choose to use it when appropriate
|
5
|
+
|
6
|
+
tools:
|
7
|
+
- Roast::Tools::Swarm:
|
8
|
+
path: ".swarm.yml" # Optional - will use default locations if not specified
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- orchestrate_refactoring: |
|
12
|
+
Help me refactor this codebase for better performance. Coordinate multiple
|
13
|
+
Claude agents using the swarm configuration to:
|
14
|
+
1. Analyze the current code structure
|
15
|
+
2. Identify performance bottlenecks
|
16
|
+
3. Implement optimizations
|
17
|
+
4. Ensure backward compatibility
|
18
|
+
|
19
|
+
- specialized_analysis: |
|
20
|
+
Now use the specialized swarm configuration at ./specialized-swarm.yml to run
|
21
|
+
a comprehensive code analysis that includes:
|
22
|
+
- Architecture review
|
23
|
+
- Security audit
|
24
|
+
- Documentation generation
|
25
|
+
- Test coverage analysis
|
Binary file
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# User Input Example
|
2
|
+
|
3
|
+
This example demonstrates how to use the `input` step type in Roast workflows to collect information from users during workflow execution.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
The `input` step type allows workflows to:
|
8
|
+
- Collect text input from users
|
9
|
+
- Ask yes/no questions (boolean)
|
10
|
+
- Present multiple choice options
|
11
|
+
- Securely collect passwords (hidden input)
|
12
|
+
- Store collected values in workflow state for later use
|
13
|
+
|
14
|
+
## Running the Example
|
15
|
+
|
16
|
+
```bash
|
17
|
+
# Run the interactive deployment workflow
|
18
|
+
roast execute examples/user_input/workflow.yml
|
19
|
+
|
20
|
+
# Run a simple survey workflow
|
21
|
+
roast execute examples/user_input/survey_workflow.yml
|
22
|
+
```
|
23
|
+
|
24
|
+
## Input Step Configuration
|
25
|
+
|
26
|
+
### Basic Text Input
|
27
|
+
```yaml
|
28
|
+
- input:
|
29
|
+
prompt: "Enter your name:"
|
30
|
+
name: user_name
|
31
|
+
```
|
32
|
+
|
33
|
+
### Boolean (Yes/No) Input
|
34
|
+
```yaml
|
35
|
+
- input:
|
36
|
+
prompt: "Do you want to continue?"
|
37
|
+
type: boolean
|
38
|
+
default: true
|
39
|
+
name: should_continue
|
40
|
+
```
|
41
|
+
|
42
|
+
### Choice Selection
|
43
|
+
```yaml
|
44
|
+
- input:
|
45
|
+
prompt: "Select environment:"
|
46
|
+
type: choice
|
47
|
+
options:
|
48
|
+
- development
|
49
|
+
- staging
|
50
|
+
- production
|
51
|
+
name: environment
|
52
|
+
```
|
53
|
+
|
54
|
+
### Password Input
|
55
|
+
```yaml
|
56
|
+
- input:
|
57
|
+
prompt: "Enter password:"
|
58
|
+
type: password
|
59
|
+
required: true
|
60
|
+
name: user_password
|
61
|
+
```
|
62
|
+
|
63
|
+
## Configuration Options
|
64
|
+
|
65
|
+
- `prompt` (required): The question or message to display to the user
|
66
|
+
- `name` (optional): Variable name to store the input value in workflow state
|
67
|
+
- `type` (optional): Type of input - `text` (default), `boolean`, `choice`, or `password`
|
68
|
+
- `required` (optional): Whether the input is required (default: false)
|
69
|
+
- `default` (optional): Default value if user presses enter without input
|
70
|
+
- `timeout` (optional): Timeout in seconds for user input
|
71
|
+
- `options` (required for choice type): Array of options for choice selection
|
72
|
+
|
73
|
+
## Accessing Input Values
|
74
|
+
|
75
|
+
Input values stored with a `name` can be accessed in subsequent steps using interpolation:
|
76
|
+
|
77
|
+
```yaml
|
78
|
+
- input:
|
79
|
+
prompt: "Enter project name:"
|
80
|
+
name: project_name
|
81
|
+
|
82
|
+
- prompt: "Creating project: #{state.project_name}"
|
83
|
+
```
|
84
|
+
|
85
|
+
## Non-TTY Environments
|
86
|
+
|
87
|
+
When running in non-TTY environments (e.g., CI/CD pipelines), input steps will:
|
88
|
+
- Use default values if provided
|
89
|
+
- Fail if required inputs have no default
|
90
|
+
- Skip optional inputs without defaults
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Create a hilarious and absurd backstory for someone named <%= workflow.output.user_name %> as a <%= workflow.output.genre %>.
|
2
|
+
|
3
|
+
Make it funny, creative, and include:
|
4
|
+
- A ridiculous origin story
|
5
|
+
- An absurd special ability or talent related to their name
|
6
|
+
- A nemesis with an equally silly name
|
7
|
+
- Their greatest achievement (make it hilariously mundane yet epic)
|
8
|
+
- A catchphrase that makes no sense
|
9
|
+
|
10
|
+
Keep it fun and family-friendly! Format it as an entertaining narrative.
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: funny_name_backstory
|
2
|
+
description: Create a humorous backstory based on your name
|
3
|
+
model: anthropic:claude-3-5-sonnet
|
4
|
+
|
5
|
+
steps:
|
6
|
+
# Collect user's name
|
7
|
+
- input:
|
8
|
+
prompt: "What's your name?"
|
9
|
+
name: user_name
|
10
|
+
required: true
|
11
|
+
|
12
|
+
# Ask for preferences
|
13
|
+
- input:
|
14
|
+
prompt: "Pick a genre for your backstory:"
|
15
|
+
type: choice
|
16
|
+
options:
|
17
|
+
- "Epic Fantasy Adventure"
|
18
|
+
- "Cyberpunk Hacker"
|
19
|
+
- "Time-Traveling Detective"
|
20
|
+
- "Intergalactic Pizza Delivery"
|
21
|
+
- "Victorian-Era Vampire Hunter"
|
22
|
+
- "Professional Cat Whisperer"
|
23
|
+
name: genre
|
24
|
+
|
25
|
+
# Generate the backstory
|
26
|
+
- create_backstory
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Please generate a nicely formatted survey summary based on the following information:
|
2
|
+
|
3
|
+
Survey Participant: <%= workflow.output.developer_name %>
|
4
|
+
Usage Duration: <%= workflow.output.usage_duration %>
|
5
|
+
Experience Rating: <%= workflow.output.experience_rating %>
|
6
|
+
Primary Feature Used: <%= workflow.output.primary_feature %>
|
7
|
+
Additional Feedback Provided: <%= workflow.output.user_feedback %>
|
8
|
+
Contact Permission: <%= workflow.output.allow_contact %>
|
9
|
+
Email (if provided): <%= workflow.output.user_email %>
|
10
|
+
|
11
|
+
Format this as a professional survey summary report with proper headings and thank the participant for their time.
|
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: simple_input_demo
|
2
|
+
description: Simple demonstration of input step functionality
|
3
|
+
model: gpt-4o
|
4
|
+
|
5
|
+
steps:
|
6
|
+
# Text input
|
7
|
+
- input:
|
8
|
+
prompt: "What's your name?"
|
9
|
+
name: user_name
|
10
|
+
required: true
|
11
|
+
|
12
|
+
- input:
|
13
|
+
prompt: "Are you enjoying Roast?"
|
14
|
+
type: boolean
|
15
|
+
default: true
|
16
|
+
name: enjoying_roast
|
17
|
+
|
18
|
+
- input:
|
19
|
+
prompt: "What's your favorite programming language?"
|
20
|
+
type: choice
|
21
|
+
options:
|
22
|
+
- Ruby
|
23
|
+
- Python
|
24
|
+
- JavaScript
|
25
|
+
- Go
|
26
|
+
- Other
|
27
|
+
name: favorite_language
|
28
|
+
|
29
|
+
- input:
|
30
|
+
prompt: "Create a secret password (won't be displayed):"
|
31
|
+
type: password
|
32
|
+
required: true
|
33
|
+
name: secret_password
|
34
|
+
|
35
|
+
- "Summarize the following inputs: {{workflow.output}}"
|
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name: developer_survey
|
2
|
+
description: Collect developer feedback through an interactive survey
|
3
|
+
model: anthropic:claude-3-5-sonnet
|
4
|
+
|
5
|
+
steps:
|
6
|
+
- welcome_message
|
7
|
+
|
8
|
+
# Basic information
|
9
|
+
- input:
|
10
|
+
prompt: "What's your name?"
|
11
|
+
name: developer_name
|
12
|
+
required: true
|
13
|
+
|
14
|
+
- input:
|
15
|
+
prompt: "How long have you been using Roast? (e.g., '2 weeks', '3 months')"
|
16
|
+
name: usage_duration
|
17
|
+
|
18
|
+
# Experience rating
|
19
|
+
- input:
|
20
|
+
prompt: "How would you rate your experience with Roast?"
|
21
|
+
type: choice
|
22
|
+
options:
|
23
|
+
- "⭐ Poor"
|
24
|
+
- "⭐⭐ Below Average"
|
25
|
+
- "⭐⭐⭐ Average"
|
26
|
+
- "⭐⭐⭐⭐ Good"
|
27
|
+
- "⭐⭐⭐⭐⭐ Excellent"
|
28
|
+
name: experience_rating
|
29
|
+
required: true
|
30
|
+
|
31
|
+
# Feature usage
|
32
|
+
- input:
|
33
|
+
prompt: "Which Roast features do you use most? (select primary feature)"
|
34
|
+
type: choice
|
35
|
+
options:
|
36
|
+
- "AI-powered workflows"
|
37
|
+
- "File processing and manipulation"
|
38
|
+
- "Conditional execution (if/case)"
|
39
|
+
- "Iteration features (each/repeat)"
|
40
|
+
- "Tool integrations"
|
41
|
+
- "Other"
|
42
|
+
name: primary_feature
|
43
|
+
|
44
|
+
# Feedback collection
|
45
|
+
- input:
|
46
|
+
prompt: "Would you like to provide additional feedback?"
|
47
|
+
type: boolean
|
48
|
+
default: true
|
49
|
+
name: wants_feedback
|
50
|
+
|
51
|
+
- if: "{{workflow.output.wants_feedback}}"
|
52
|
+
then:
|
53
|
+
- input:
|
54
|
+
prompt: "Please share your feedback (press Enter twice when done):"
|
55
|
+
name: user_feedback
|
56
|
+
|
57
|
+
- input:
|
58
|
+
prompt: "May we contact you about your feedback?"
|
59
|
+
type: boolean
|
60
|
+
default: false
|
61
|
+
name: allow_contact
|
62
|
+
|
63
|
+
- if: "{{workflow.output.allow_contact}}"
|
64
|
+
then:
|
65
|
+
- input:
|
66
|
+
prompt: "Please enter your email:"
|
67
|
+
name: user_email
|
68
|
+
required: true
|
69
|
+
|
70
|
+
# Generate summary
|
71
|
+
- generate_summary
|
Binary file
|