roast-ai 0.4.7 → 0.4.8
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/Gemfile.lock +1 -1
- data/Rakefile +2 -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/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_step.rb +2 -3
- data/lib/roast/workflow/step_loader.rb +2 -7
- data/lib/roast.rb +6 -1
- metadata +4 -239
- 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/README.md +0 -71
- data/examples/grading/analyze_coverage/prompt.md +0 -52
- data/examples/grading/calculate_final_grade.rb +0 -67
- data/examples/grading/format_result.rb +0 -64
- data/examples/grading/generate_grades/prompt.md +0 -105
- data/examples/grading/generate_recommendations/output.txt +0 -17
- data/examples/grading/generate_recommendations/prompt.md +0 -60
- data/examples/grading/js_test_runner +0 -31
- data/examples/grading/rb_test_runner +0 -19
- data/examples/grading/read_dependencies/prompt.md +0 -16
- data/examples/grading/run_coverage.rb +0 -54
- data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
- data/examples/grading/verify_test_helpers/prompt.md +0 -53
- data/examples/grading/workflow.md +0 -8
- 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/grading/workflow.yml +0 -41
- 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
@@ -1,85 +0,0 @@
|
|
1
|
-
# API Workflow Example
|
2
|
-
|
3
|
-
This example demonstrates a targetless workflow that interacts with APIs rather than operating on specific files.
|
4
|
-
|
5
|
-
## Structure
|
6
|
-
|
7
|
-
The workflow consists of three steps that work together to create a complete API integration process:
|
8
|
-
|
9
|
-
1. `fetch_api_data` - Simulates fetching data from a weather API and returns a structured JSON response
|
10
|
-
2. `transform_data` - Processes the JSON data into a human-readable markdown format
|
11
|
-
3. `generate_report` - Creates a polished report with recommendations based on the weather data
|
12
|
-
|
13
|
-
## Running the Example
|
14
|
-
|
15
|
-
To run this example, you need to have a valid API token. The example is configured to fetch a token using a shell command:
|
16
|
-
|
17
|
-
```yaml
|
18
|
-
# Dynamic API token using shell command
|
19
|
-
api_token: $(print-token --key)
|
20
|
-
```
|
21
|
-
|
22
|
-
You can modify this to use your own token source, such as:
|
23
|
-
|
24
|
-
```yaml
|
25
|
-
# Using an environment variable
|
26
|
-
api_token: $(echo $OPENAI_API_KEY)
|
27
|
-
|
28
|
-
# Or a direct value (not recommended for production)
|
29
|
-
api_token: $(echo "sk-your-actual-token")
|
30
|
-
```
|
31
|
-
|
32
|
-
Then run the workflow:
|
33
|
-
|
34
|
-
```bash
|
35
|
-
# Run the targetless workflow
|
36
|
-
roast execute examples/api_workflow/workflow.yml
|
37
|
-
|
38
|
-
# Save the output to a file
|
39
|
-
roast execute examples/api_workflow/workflow.yml -o weather_report.md
|
40
|
-
```
|
41
|
-
|
42
|
-
## How Targetless Workflows Work
|
43
|
-
|
44
|
-
Targetless workflows operate without a specific target file. This is useful for:
|
45
|
-
|
46
|
-
- API integrations
|
47
|
-
- Content generation
|
48
|
-
- Data analysis
|
49
|
-
- Report creation
|
50
|
-
- Interactive tools
|
51
|
-
|
52
|
-
Unlike file-based workflows that process each target separately, targetless workflows run once and can retrieve their own data sources (like API calls) or generate content from scratch.
|
53
|
-
|
54
|
-
## Workflow Definition
|
55
|
-
|
56
|
-
```yaml
|
57
|
-
name: API Integration Workflow
|
58
|
-
# Default model for all steps
|
59
|
-
model: gpt-4o-mini
|
60
|
-
|
61
|
-
tools:
|
62
|
-
- Roast::Tools::ReadFile
|
63
|
-
- Roast::Tools::Grep
|
64
|
-
- Roast::Tools::WriteFile
|
65
|
-
|
66
|
-
steps:
|
67
|
-
- fetch_api_data
|
68
|
-
- transform_data
|
69
|
-
- generate_report
|
70
|
-
|
71
|
-
# Tool configurations for API calls (no need to specify model here since it uses global model)
|
72
|
-
fetch_api_data:
|
73
|
-
print_response: true
|
74
|
-
```
|
75
|
-
|
76
|
-
## Creating Your Own Targetless Workflows
|
77
|
-
|
78
|
-
To create your own targetless workflow:
|
79
|
-
|
80
|
-
1. Create a workflow YAML file without a `target` parameter
|
81
|
-
2. Define the steps your workflow will execute
|
82
|
-
3. Create prompt files for each step
|
83
|
-
4. Run the workflow with `roast execute your_workflow.yml`
|
84
|
-
|
85
|
-
Your steps can use the workflow's `output` hash to pass data between them, just like in file-based workflows.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
You are an assistant helping with retrieving data from an API source.
|
2
|
-
|
3
|
-
Your task is to simulate fetching data from a weather API using mock data.
|
4
|
-
|
5
|
-
1. Imagine you are retrieving current weather conditions for various cities
|
6
|
-
2. Create a structured JSON response that represents typical weather API data
|
7
|
-
3. The response should include temperature, conditions, wind, and other relevant weather metrics
|
8
|
-
4. Format the response as valid JSON that could be parsed programmatically
|
9
|
-
|
10
|
-
Return only the JSON data without any additional explanation.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
You are an assistant helping to generate a final weather report.
|
2
|
-
|
3
|
-
Based on the transformed data from the previous step, create a polished report that could be sent to stakeholders.
|
4
|
-
|
5
|
-
1. Take the transformed weather data and enhance it with recommendations and insights
|
6
|
-
2. Add relevant suggestions based on the weather conditions (like what to wear, activities that would be appropriate, etc.)
|
7
|
-
3. Include a "forecast overview" section that summarizes the key points
|
8
|
-
4. Format the output as a professional-looking report with proper headings and structure
|
9
|
-
|
10
|
-
The report should be comprehensive yet concise, easy to scan, and provide actionable insights based on the weather data.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# API Integration Workflow
|
2
|
-
|
3
|
-
This workflow demonstrates how to create an API integration that:
|
4
|
-
1. Fetches data from an external source
|
5
|
-
2. Transforms the data into a usable format
|
6
|
-
3. Generates a report based on the processed data
|
7
|
-
|
8
|
-
The workflow doesn't require a target file because it's designed to work with external APIs and data sources rather than processing specific files.
|
9
|
-
|
10
|
-
You'll be working through a weather data processing example. This is a simulation to demonstrate the workflow pattern - no actual API calls are made.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
You are an assistant helping to transform API data.
|
2
|
-
|
3
|
-
Your task is to process weather data from a JSON format into a more readable summary.
|
4
|
-
|
5
|
-
1. Review the weather data provided in the previous step
|
6
|
-
2. Transform the technical JSON data into a human-readable summary
|
7
|
-
3. Format the output as markdown with appropriate sections and highlights
|
8
|
-
4. Focus on the most relevant information that would be useful to a typical user
|
9
|
-
|
10
|
-
Return a well-formatted markdown summary of the weather data.
|
Binary file
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# API Integration Workflow
|
2
|
-
|
3
|
-
# This workflow demonstrates how to create an API integration that:
|
4
|
-
# 1. Fetches data from an external source
|
5
|
-
# 2. Transforms the data into a usable format
|
6
|
-
# 3. Generates a report based on the processed data
|
7
|
-
|
8
|
-
# The workflow doesn't require a target file because it's designed to work with external APIs and data sources rather than processing specific files.
|
9
|
-
|
10
|
-
# You'll be working through a weather data processing example. This is a simulation to demonstrate the workflow pattern - no actual API calls are made.
|
11
|
-
|
12
|
-
name: API Integration Workflow
|
13
|
-
model: gpt-4o-mini
|
14
|
-
|
15
|
-
tools:
|
16
|
-
- Roast::Tools::ReadFile
|
17
|
-
- Roast::Tools::Grep
|
18
|
-
- Roast::Tools::WriteFile
|
19
|
-
|
20
|
-
# For demonstration purposes only - in production you would use a real token command
|
21
|
-
# api_token: $(echo "demo_token_123456")
|
22
|
-
|
23
|
-
steps:
|
24
|
-
- fetch_api_data
|
25
|
-
- transform_data
|
26
|
-
- generate_report
|
27
|
-
|
28
|
-
# Tool configurations for API calls
|
29
|
-
fetch_api_data:
|
30
|
-
print_response: true
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# Apply Diff Demo
|
2
|
-
|
3
|
-
This example demonstrates the `apply_diff` tool, which shows users a colored diff of proposed changes and applies them only after user confirmation.
|
4
|
-
|
5
|
-
## What this workflow does
|
6
|
-
|
7
|
-
1. **Creates a sample file** - Generates `hello.txt` with simple text content
|
8
|
-
2. **Applies a simple change** - Uses `apply_diff` to modify the greeting and ask for user confirmation
|
9
|
-
|
10
|
-
## Key features demonstrated
|
11
|
-
|
12
|
-
- **Interactive approval** - The `apply_diff` tool shows a clear, colored diff and waits for user confirmation
|
13
|
-
- **Safe modifications** - Changes are only applied when the user explicitly approves them
|
14
|
-
- **Colored visualization** - Diff format shows exactly what will be changed with:
|
15
|
-
- **Red** lines starting with `-` for removed content
|
16
|
-
- **Green** lines starting with `+` for added content
|
17
|
-
- **Cyan** line numbers and context (`@@` lines)
|
18
|
-
- **Bold** diff headers
|
19
|
-
- **Optional descriptions** - You can provide context about why a change is being made
|
20
|
-
|
21
|
-
## Running the workflow
|
22
|
-
|
23
|
-
```bash
|
24
|
-
bin/roast examples/apply_diff_demo/workflow.yml
|
25
|
-
```
|
26
|
-
|
27
|
-
## Expected interaction
|
28
|
-
|
29
|
-
When you run this workflow, you'll see:
|
30
|
-
|
31
|
-
1. The workflow creates a simple `hello.txt` file
|
32
|
-
2. It proposes changing "Hello World!" to "Hello, Apply Diff Demo!"
|
33
|
-
3. It shows you a colored diff of the proposed change:
|
34
|
-
```
|
35
|
-
📝 Proposed change for hello.txt:
|
36
|
-
Description: Update greeting to be more specific to the demo
|
37
|
-
|
38
|
-
diff --git a/hello.txt b/hello.txt
|
39
|
-
index 1234567..abcdefg 100644
|
40
|
-
--- a/hello.txt
|
41
|
-
+++ b/hello.txt
|
42
|
-
@@ -1,3 +1,3 @@
|
43
|
-
-Hello World!
|
44
|
-
+Hello, Apply Diff Demo!
|
45
|
-
This is a demo file.
|
46
|
-
We will modify this file in the next step.
|
47
|
-
```
|
48
|
-
4. It asks for your confirmation: `Apply this change? (y/n)`
|
49
|
-
5. If you say "y", it applies the change; if "n", it cancels
|
50
|
-
6. Finally, it reads the file again to show the result
|
51
|
-
|
52
|
-
## Tools used
|
53
|
-
|
54
|
-
- `Roast::Tools::WriteFile` - Creates the initial sample file
|
55
|
-
- `Roast::Tools::ReadFile` - Reads files to show results
|
56
|
-
- `Roast::Tools::ApplyDiff` - Shows colored diffs and applies changes with user confirmation
|
57
|
-
|
58
|
-
This pattern is useful for any workflow where you want to make targeted changes to files but give users control over what actually gets applied.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Apply Simple Change
|
2
|
-
|
3
|
-
Now use the apply_diff function to modify the `hello.txt` file. Let's change the greeting from "Hello World!" to "Hello, Apply Diff Demo!".
|
4
|
-
|
5
|
-
Use the apply_diff function with:
|
6
|
-
- `file_path`: "hello.txt"
|
7
|
-
- `old_content`: "Hello World!"
|
8
|
-
- `new_content`: "Hello, Apply Diff Demo!"
|
9
|
-
- `description`: "Update greeting to be more specific to the demo"
|
10
|
-
|
11
|
-
This will show the user a colored diff of the proposed change and ask for their confirmation before applying it.
|
12
|
-
|
13
|
-
After the change is applied (or declined), read the file again to show the final result.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Apply Diff Demo
|
2
|
-
#
|
3
|
-
# This workflow demonstrates the apply_diff tool which shows users a diff
|
4
|
-
# and applies changes based on their confirmation. It's useful for making
|
5
|
-
# targeted changes to files with user approval.
|
6
|
-
|
7
|
-
name: Apply Diff Demo
|
8
|
-
model: gpt-4o-mini
|
9
|
-
|
10
|
-
tools:
|
11
|
-
- Roast::Tools::WriteFile
|
12
|
-
- Roast::Tools::ReadFile
|
13
|
-
- Roast::Tools::ApplyDiff
|
14
|
-
|
15
|
-
steps:
|
16
|
-
- create_sample_file
|
17
|
-
- apply_simple_change
|
18
|
-
|
19
|
-
# Step configurations
|
20
|
-
create_sample_file:
|
21
|
-
print_response: false
|
22
|
-
|
23
|
-
apply_simple_change:
|
24
|
-
print_response: true
|
Binary file
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Bash Tool Examples
|
2
|
-
|
3
|
-
This directory contains example workflows demonstrating the Bash tool, which provides unrestricted command execution for prototyping scenarios.
|
4
|
-
|
5
|
-
## ⚠️ Security Warning
|
6
|
-
|
7
|
-
The Bash tool executes commands without any restrictions. Only use it in:
|
8
|
-
- Development environments
|
9
|
-
- Trusted contexts
|
10
|
-
- Prototyping scenarios where you explicitly want unrestricted access
|
11
|
-
|
12
|
-
**Never use the Bash tool in production workflows or with untrusted input!**
|
13
|
-
|
14
|
-
## Examples
|
15
|
-
|
16
|
-
### 1. System Analysis Workflow (`system_analysis.yml`)
|
17
|
-
|
18
|
-
Demonstrates using Bash for system inspection and analysis tasks that would be restricted by the Cmd tool.
|
19
|
-
|
20
|
-
### 2. API Testing Workflow (`api_testing.yml`)
|
21
|
-
|
22
|
-
Shows how to use Bash for making API calls with curl and processing responses with jq.
|
23
|
-
|
24
|
-
### 3. DevOps Automation (`devops_workflow.yml`)
|
25
|
-
|
26
|
-
Example of using Bash for DevOps tasks like container management and log analysis.
|
27
|
-
|
28
|
-
## Disabling Warnings
|
29
|
-
|
30
|
-
By default, the Bash tool logs warnings about unrestricted execution. To disable these warnings:
|
31
|
-
|
32
|
-
```bash
|
33
|
-
export ROAST_BASH_WARNINGS=false
|
34
|
-
roast execute workflow.yml
|
35
|
-
```
|
36
|
-
|
37
|
-
## Best Practices
|
38
|
-
|
39
|
-
1. **Use Cmd tool when possible**: If your commands fit within Cmd's allowed list, use it instead
|
40
|
-
2. **Validate inputs**: Always validate any user input before passing to Bash
|
41
|
-
3. **Limit scope**: Use the most restrictive tool that meets your needs
|
42
|
-
4. **Document risks**: Clearly document when and why Bash tool is necessary
|
43
|
-
5. **Environment isolation**: Run Bash workflows in isolated environments when possible
|
44
|
-
|
45
|
-
## Comparison with Cmd Tool
|
46
|
-
|
47
|
-
| Feature | Cmd Tool | Bash Tool |
|
48
|
-
|---------|----------|-----------|
|
49
|
-
| Command restrictions | Yes (configurable) | No |
|
50
|
-
| Default allowed commands | pwd, find, ls, rake, ruby, dev, mkdir | All commands |
|
51
|
-
| Security warnings | No | Yes (can be disabled) |
|
52
|
-
| Recommended for production | Yes | No |
|
53
|
-
| Use case | General automation | Prototyping & development |
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Analyze Network Configuration
|
2
|
-
|
3
|
-
Use the bash tool to gather network information:
|
4
|
-
|
5
|
-
1. Check network interfaces (ifconfig or ip addr)
|
6
|
-
2. Display routing table (netstat -nr or ip route)
|
7
|
-
3. Check listening ports (netstat -an | grep LISTEN or lsof -i -P | grep LISTEN)
|
8
|
-
4. Test DNS resolution (nslookup example.com or dig example.com)
|
9
|
-
5. Check current network connections
|
10
|
-
|
11
|
-
Provide a summary of the network configuration and any interesting findings.
|
12
|
-
|
13
|
-
Note: Some commands may require different syntax on macOS vs Linux.
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Analyze System Information
|
2
|
-
|
3
|
-
Use the bash tool to gather system information including:
|
4
|
-
|
5
|
-
1. Operating system details (uname -a)
|
6
|
-
2. Current disk usage (df -h)
|
7
|
-
3. Memory information (if available via free -m on Linux or vm_stat on macOS)
|
8
|
-
4. Current user and groups (whoami, groups)
|
9
|
-
5. Environment variables (env | grep -E "PATH|HOME|USER")
|
10
|
-
|
11
|
-
Gather this information and provide a summary of the system's current state.
|
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
name: API Testing with Bash
|
2
|
-
model: gpt-4o-mini
|
3
|
-
tools:
|
4
|
-
- Roast::Tools::Bash
|
5
|
-
- Roast::Tools::WriteFile
|
6
|
-
|
7
|
-
# Demonstrates using Bash for API testing with curl and jq
|
8
|
-
# These commands would be restricted by the Cmd tool
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- test_public_api
|
12
|
-
- process_json_response
|
13
|
-
- test_multiple_endpoints
|
14
|
-
- generate_api_report
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Check Running Processes
|
2
|
-
|
3
|
-
Use the bash tool to analyze running processes:
|
4
|
-
|
5
|
-
1. List all processes (ps aux or ps -ef)
|
6
|
-
2. Find the top 5 CPU-consuming processes
|
7
|
-
3. Find the top 5 memory-consuming processes
|
8
|
-
4. Check if any specific development services are running (like databases, web servers)
|
9
|
-
5. Count total number of processes
|
10
|
-
|
11
|
-
Note: The exact commands may vary between macOS and Linux. Use appropriate commands for the detected OS.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Generate System Analysis Report
|
2
|
-
|
3
|
-
Based on all the information gathered in previous steps:
|
4
|
-
|
5
|
-
1. Create a comprehensive markdown report summarizing:
|
6
|
-
- System specifications and OS details
|
7
|
-
- Resource usage (CPU, memory, disk)
|
8
|
-
- Active processes and services
|
9
|
-
- Network configuration
|
10
|
-
- Any potential issues or interesting findings
|
11
|
-
|
12
|
-
2. Save the report to `system_analysis_report.md` using the write_file tool
|
13
|
-
|
14
|
-
3. Include timestamps and organize the information in a clear, readable format
|
15
|
-
|
16
|
-
The report should be suitable for sharing with other developers or for documentation purposes.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Process JSON Responses
|
2
|
-
|
3
|
-
Use bash with jq (if available) to process JSON responses:
|
4
|
-
|
5
|
-
1. First check if jq is installed:
|
6
|
-
```bash
|
7
|
-
which jq
|
8
|
-
```
|
9
|
-
|
10
|
-
2. If jq is available, use it to parse JSON:
|
11
|
-
```bash
|
12
|
-
curl -s https://api.github.com/users/github | jq '.name, .public_repos'
|
13
|
-
```
|
14
|
-
|
15
|
-
3. If jq is not available, use alternative methods like:
|
16
|
-
- grep with regular expressions
|
17
|
-
- sed/awk for parsing
|
18
|
-
- Python one-liners if Python is available
|
19
|
-
|
20
|
-
4. Extract specific fields from the API responses
|
21
|
-
5. Count items in arrays
|
22
|
-
6. Filter data based on conditions
|
23
|
-
|
24
|
-
Show different approaches for JSON processing depending on available tools.
|
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
name: System Analysis with Bash
|
2
|
-
model: gpt-4o-mini
|
3
|
-
tools:
|
4
|
-
- Roast::Tools::Bash
|
5
|
-
- Roast::Tools::WriteFile
|
6
|
-
|
7
|
-
# This workflow demonstrates using Bash for system analysis tasks
|
8
|
-
# that would be restricted by the Cmd tool
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- analyze_system
|
12
|
-
- check_processes
|
13
|
-
- analyze_network
|
14
|
-
- generate_report
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Test Public API Endpoints
|
2
|
-
|
3
|
-
Use the bash tool to test various public APIs:
|
4
|
-
|
5
|
-
1. Test GitHub API:
|
6
|
-
```bash
|
7
|
-
curl -s https://api.github.com/users/github
|
8
|
-
```
|
9
|
-
|
10
|
-
2. Test a public JSON placeholder API:
|
11
|
-
```bash
|
12
|
-
curl -s https://jsonplaceholder.typicode.com/posts/1
|
13
|
-
```
|
14
|
-
|
15
|
-
3. Check response headers:
|
16
|
-
```bash
|
17
|
-
curl -I https://api.github.com
|
18
|
-
```
|
19
|
-
|
20
|
-
4. Test with different HTTP methods if appropriate
|
21
|
-
|
22
|
-
Analyze the responses and note the structure of the returned data.
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# Case/When/Else Example
|
2
|
-
|
3
|
-
This example demonstrates the use of `case/when/else` control flow in Roast workflows.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
The `case/when/else` construct allows you to execute different steps based on the value of an expression, similar to Ruby's case statement or switch statements in other languages.
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```yaml
|
12
|
-
- case: <expression>
|
13
|
-
when:
|
14
|
-
<value1>:
|
15
|
-
- <steps>
|
16
|
-
<value2>:
|
17
|
-
- <steps>
|
18
|
-
else:
|
19
|
-
- <steps>
|
20
|
-
```
|
21
|
-
|
22
|
-
## Features Demonstrated
|
23
|
-
|
24
|
-
1. **Basic case/when/else**: Detect file language and execute language-specific analysis
|
25
|
-
2. **Bash command evaluation**: Use environment variables to determine deployment strategy
|
26
|
-
3. **Complex expressions**: Use Ruby expressions to categorize numeric values
|
27
|
-
|
28
|
-
## Expression Types
|
29
|
-
|
30
|
-
The `case` expression can be:
|
31
|
-
- A simple string value
|
32
|
-
- An interpolated workflow output: `{{ workflow.output.variable }}`
|
33
|
-
- A Ruby expression: `{{ workflow.output.count > 10 ? 'high' : 'low' }}`
|
34
|
-
- A bash command: `$(echo $ENVIRONMENT)`
|
35
|
-
- A reference to a previous step's output
|
36
|
-
|
37
|
-
## How It Works
|
38
|
-
|
39
|
-
1. The `case` expression is evaluated to produce a value
|
40
|
-
2. The value is compared against each key in the `when` clause
|
41
|
-
3. If a match is found, the steps under that key are executed
|
42
|
-
4. If no match is found and an `else` clause exists, those steps are executed
|
43
|
-
5. If no match is found and no `else` clause exists, execution continues
|
44
|
-
|
45
|
-
## Running the Example
|
46
|
-
|
47
|
-
```bash
|
48
|
-
roast execute examples/case_when/workflow.yml
|
49
|
-
```
|
50
|
-
|
51
|
-
This will process all Ruby, JavaScript, Python, and Go files in the current directory, detecting their language and running appropriate analysis steps.
|
52
|
-
|
53
|
-
## Use Cases
|
54
|
-
|
55
|
-
- **Multi-language projects**: Different linting/testing for different file types
|
56
|
-
- **Environment-specific workflows**: Different deployment steps for prod/staging/dev
|
57
|
-
- **Conditional processing**: Different handling based on file size, complexity, or other metrics
|
58
|
-
- **Error handling**: Different recovery strategies based on error types
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Detect Programming Language
|
2
|
-
|
3
|
-
Based on the file extension and content, determine the primary programming language of this file:
|
4
|
-
- If it's a `.rb` file, return "ruby"
|
5
|
-
- If it's a `.js` file, return "javascript"
|
6
|
-
- If it's a `.py` file, return "python"
|
7
|
-
- If it's a `.go` file, return "go"
|
8
|
-
- Otherwise, return "unknown"
|
9
|
-
|
10
|
-
Return ONLY the language name in lowercase, nothing else.
|
11
|
-
|
12
|
-
File: <%= context.resource_uri %>
|
13
|
-
Content:
|
14
|
-
```
|
15
|
-
<%= context.resource %>
|
16
|
-
```
|
Binary file
|
@@ -1,58 +0,0 @@
|
|
1
|
-
name: "Case/When/Else Example"
|
2
|
-
|
3
|
-
tools:
|
4
|
-
- Roast::Tools::Cmd
|
5
|
-
- Roast::Tools::ReadFile
|
6
|
-
- Roast::Tools::WriteFile
|
7
|
-
|
8
|
-
target: "**/*.{rb,js,py,go}"
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- detect_language
|
12
|
-
|
13
|
-
- case: "{{ workflow.output.detect_language }}"
|
14
|
-
when:
|
15
|
-
ruby:
|
16
|
-
- analyze_ruby
|
17
|
-
- generate_ruby_report
|
18
|
-
javascript:
|
19
|
-
- analyze_javascript
|
20
|
-
- generate_js_report
|
21
|
-
python:
|
22
|
-
- analyze_python
|
23
|
-
- generate_python_report
|
24
|
-
go:
|
25
|
-
- analyze_go
|
26
|
-
- generate_go_report
|
27
|
-
else:
|
28
|
-
- analyze_generic
|
29
|
-
- generate_generic_report
|
30
|
-
|
31
|
-
# Another example using bash command for case expression
|
32
|
-
- get_environment: $(echo $ENVIRONMENT || echo "development")
|
33
|
-
|
34
|
-
- case: "{{ workflow.output.get_environment }}"
|
35
|
-
when:
|
36
|
-
production:
|
37
|
-
- production_checks
|
38
|
-
- deploy_production
|
39
|
-
staging:
|
40
|
-
- staging_checks
|
41
|
-
- deploy_staging
|
42
|
-
development:
|
43
|
-
- run_tests
|
44
|
-
- local_deploy
|
45
|
-
else:
|
46
|
-
- unknown_environment
|
47
|
-
|
48
|
-
# Example with numeric case values
|
49
|
-
- count_issues
|
50
|
-
|
51
|
-
- case: "{{ workflow.output.count_issues.to_i > 10 ? 'high' : workflow.output.count_issues.to_i > 5 ? 'medium' : 'low' }}"
|
52
|
-
when:
|
53
|
-
high:
|
54
|
-
- high_priority_alert
|
55
|
-
medium:
|
56
|
-
- medium_priority_notice
|
57
|
-
low:
|
58
|
-
- low_priority_info
|