roast-ai 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +20 -0
- data/CLAUDE.md +52 -1
- data/Gemfile +3 -1
- data/Gemfile.lock +63 -16
- data/README.md +90 -5
- data/bin/roast +1 -1
- data/claude-swarm.yml +210 -0
- data/docs/AGENT_STEPS.md +264 -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.yml +16 -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.yml +32 -0
- data/examples/available_tools_demo/write_summary/prompt.md +6 -0
- data/examples/case_when/detect_language/prompt.md +2 -2
- data/examples/grading/run_coverage.rb +0 -2
- 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/mcp/README.md +3 -3
- data/examples/mcp/analyze_changes/prompt.md +1 -1
- data/examples/mcp/database_workflow.yml +1 -1
- data/examples/mcp/fetch_pr_context/prompt.md +1 -1
- data/examples/mcp/github_workflow.yml +1 -1
- data/examples/mcp/post_review/prompt.md +1 -1
- 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/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.yml +26 -0
- data/examples/user_input/generate_summary/prompt.md +11 -0
- data/examples/user_input/simple_input_demo/workflow.yml +35 -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.yml +73 -0
- data/examples/workflow_generator/create_workflow_files/prompt.md +1 -1
- 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/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/tools/ask_user.rb +0 -2
- data/lib/roast/tools/bash.rb +0 -3
- data/lib/roast/tools/cmd.rb +0 -3
- data/lib/roast/tools/coding_agent.rb +1 -8
- 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/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 +26 -0
- data/lib/roast/workflow/api_configuration.rb +0 -4
- data/lib/roast/workflow/base_iteration_step.rb +0 -4
- data/lib/roast/workflow/base_step.rb +54 -28
- data/lib/roast/workflow/base_workflow.rb +2 -21
- 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 +3 -66
- data/lib/roast/workflow/configuration_loader.rb +0 -2
- data/lib/roast/workflow/configuration_parser.rb +1 -7
- data/lib/roast/workflow/dot_access_hash.rb +16 -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 +0 -2
- data/lib/roast/workflow/output_manager.rb +0 -2
- data/lib/roast/workflow/replay_handler.rb +0 -3
- data/lib/roast/workflow/resource_resolver.rb +0 -3
- data/lib/roast/workflow/session_manager.rb +0 -3
- data/lib/roast/workflow/state_manager.rb +0 -2
- data/lib/roast/workflow/step_executor_coordinator.rb +34 -11
- 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_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 +30 -16
- data/lib/roast/workflow/step_orchestrator.rb +3 -2
- data/lib/roast/workflow/step_type_resolver.rb +28 -1
- data/lib/roast/workflow/validator.rb +0 -4
- data/lib/roast/workflow/workflow_executor.rb +0 -16
- data/lib/roast/workflow/workflow_initializer.rb +1 -8
- data/lib/roast/workflow/workflow_runner.rb +0 -7
- data/lib/roast/workflow.rb +0 -15
- data/lib/roast.rb +55 -10
- data/roast.gemspec +2 -1
- data/schema/workflow.json +46 -0
- metadata +43 -6
- data/lib/roast/helpers.rb +0 -12
@@ -2,19 +2,19 @@ I'll update the count of fixes that have been successfully applied.
|
|
2
2
|
|
3
3
|
Current fix count:
|
4
4
|
```
|
5
|
-
|
5
|
+
<%= output.update_fix_count || 0 %>
|
6
6
|
```
|
7
7
|
|
8
8
|
Verification result from the previous step:
|
9
9
|
```json
|
10
|
-
|
10
|
+
<%= output.verify_fix %>
|
11
11
|
```
|
12
12
|
|
13
13
|
I'll increment the fix count if the verification was successful or partial, but not if it failed.
|
14
14
|
|
15
15
|
```javascript
|
16
|
-
let currentCount = parseInt(
|
17
|
-
let verificationStatus = "
|
16
|
+
let currentCount = parseInt(<%= output.update_fix_count || 0 %>);
|
17
|
+
let verificationStatus = "<%= output.verify_fix.status %>";
|
18
18
|
|
19
19
|
if (verificationStatus === "success" || verificationStatus === "partial") {
|
20
20
|
currentCount += 1;
|
@@ -2,17 +2,17 @@ I'll verify that the fix implemented in the previous step correctly addresses th
|
|
2
2
|
|
3
3
|
Here are the details of the issue that was fixed:
|
4
4
|
```json
|
5
|
-
|
5
|
+
<%= output.select_next_issue %>
|
6
6
|
```
|
7
7
|
|
8
8
|
And here is the implementation of the fix:
|
9
9
|
```json
|
10
|
-
|
10
|
+
<%= output.implement_fix %>
|
11
11
|
```
|
12
12
|
|
13
13
|
Now I'll read the updated file to verify the changes:
|
14
14
|
```ruby
|
15
|
-
|
15
|
+
<%= read_file(output.select_next_issue.file_path) %>
|
16
16
|
```
|
17
17
|
|
18
18
|
I'll evaluate the fix based on these criteria:
|
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
|
@@ -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.
|
@@ -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,
|
@@ -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.
|
@@ -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.
|
@@ -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}}"
|
@@ -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
|
@@ -0,0 +1,73 @@
|
|
1
|
+
name: interactive_deployment
|
2
|
+
description: Interactive deployment workflow with user confirmations
|
3
|
+
model: gpt-4o
|
4
|
+
|
5
|
+
steps:
|
6
|
+
# Collect deployment information
|
7
|
+
- input:
|
8
|
+
prompt: "Which environment do you want to deploy to?"
|
9
|
+
name: environment
|
10
|
+
type: choice
|
11
|
+
options:
|
12
|
+
- development
|
13
|
+
- staging
|
14
|
+
- production
|
15
|
+
required: true
|
16
|
+
|
17
|
+
- input:
|
18
|
+
prompt: "Enter the deployment tag/version:"
|
19
|
+
name: deploy_tag
|
20
|
+
required: true
|
21
|
+
default: "latest"
|
22
|
+
|
23
|
+
# Show deployment plan
|
24
|
+
- bash:
|
25
|
+
command: |
|
26
|
+
echo "==================================="
|
27
|
+
echo " DEPLOYMENT PLAN"
|
28
|
+
echo "==================================="
|
29
|
+
echo "Environment: {{workflow.output.environment}}"
|
30
|
+
echo "Version: {{workflow.output.deploy_tag}}"
|
31
|
+
echo "Timestamp: {{Date.today}}"
|
32
|
+
echo "==================================="
|
33
|
+
|
34
|
+
# Confirm deployment
|
35
|
+
- input:
|
36
|
+
prompt: "Deploy {{workflow.output.deploy_tag}} to {{workflow.output.environment}}?"
|
37
|
+
type: boolean
|
38
|
+
default: false
|
39
|
+
name: confirm_deploy
|
40
|
+
|
41
|
+
# Execute deployment if confirmed
|
42
|
+
- if: "{{workflow.output.confirm_deploy}}"
|
43
|
+
then:
|
44
|
+
- bash:
|
45
|
+
command: echo "🚀 Starting deployment to {{workflow.output.environment}}..."
|
46
|
+
|
47
|
+
# Simulate deployment steps
|
48
|
+
- bash:
|
49
|
+
command: |
|
50
|
+
echo "🚀 Deploying version {{workflow.output.deploy_tag}} to {{workflow.output.environment}}"
|
51
|
+
echo "📦 Pulling Docker image: myapp:{{workflow.output.deploy_tag}}"
|
52
|
+
sleep 2
|
53
|
+
echo "🔄 Rolling out to {{workflow.output.environment}} cluster"
|
54
|
+
sleep 2
|
55
|
+
echo "✅ Deployment completed successfully!"
|
56
|
+
|
57
|
+
# Post-deployment verification
|
58
|
+
- input:
|
59
|
+
prompt: "Run smoke tests?"
|
60
|
+
type: boolean
|
61
|
+
default: true
|
62
|
+
name: run_tests
|
63
|
+
|
64
|
+
- if: "{{workflow.output.run_tests}}"
|
65
|
+
then:
|
66
|
+
- bash:
|
67
|
+
command: |
|
68
|
+
echo "🧪 Running smoke tests..."
|
69
|
+
sleep 1
|
70
|
+
echo "✅ All tests passed!"
|
71
|
+
else:
|
72
|
+
- bash:
|
73
|
+
command: echo "❌ Deployment cancelled by user."
|
@@ -15,7 +15,7 @@ Extract the workflow name from the user input JSON and create the workflow in th
|
|
15
15
|
|
16
16
|
Steps to complete:
|
17
17
|
|
18
|
-
1. **Create the main directory**: Use Cmd to create the "
|
18
|
+
1. **Create the main directory**: Use Cmd to create the "<%= workflow_name %>" directory
|
19
19
|
2. **Create step directories**: Create subdirectories for each workflow step
|
20
20
|
3. **Create workflow.yml**: Write the main workflow configuration file
|
21
21
|
4. **Create step prompt files**: Write each step's prompt.md file
|
data/lib/roast/errors.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Roast
|
4
|
-
|
5
|
-
|
4
|
+
module Errors
|
5
|
+
# Custom error for API resource not found (404) responses
|
6
|
+
class ResourceNotFoundError < StandardError; end
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
# Custom error for when API authentication fails
|
9
|
+
class AuthenticationError < StandardError; end
|
10
|
+
end
|
9
11
|
end
|
data/lib/roast/helpers/logger.rb
CHANGED
@@ -1,54 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "logger"
|
4
|
-
require "forwardable"
|
5
|
-
|
6
3
|
module Roast
|
7
4
|
module Helpers
|
8
5
|
# Central logger for the Roast application
|
9
6
|
class Logger
|
10
|
-
extend Forwardable
|
11
7
|
VALID_LOG_LEVELS = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL"].freeze
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
# Delegate info and warn methods to the underlying logger
|
16
|
-
def_delegators :logger, :info, :warn
|
17
|
-
|
18
|
-
# Create a specialized debug method that ensures proper functionality
|
19
|
-
def debug(message)
|
20
|
-
logger.debug(message)
|
21
|
-
end
|
22
|
-
|
23
|
-
def error(message)
|
24
|
-
# Add any custom error handling logic here
|
25
|
-
logger.error(message)
|
26
|
-
end
|
27
|
-
|
28
|
-
def fatal(message)
|
29
|
-
# Add any custom fatal error handling logic here
|
30
|
-
logger.fatal(message)
|
31
|
-
end
|
32
|
-
|
33
|
-
def initialize(stdout: $stdout, log_level: ENV["ROAST_LOG_LEVEL"] || "INFO")
|
34
|
-
@log_level = validate_log_level(log_level)
|
35
|
-
@logger = create_logger(stdout)
|
36
|
-
end
|
9
|
+
delegate_missing_to :@logger
|
37
10
|
|
38
|
-
|
39
|
-
@log_level = validate_log_level(level)
|
40
|
-
logger.level = ::Logger.const_get(@log_level)
|
41
|
-
end
|
11
|
+
attr_reader :logger
|
42
12
|
|
43
13
|
class << self
|
44
|
-
|
14
|
+
delegate_missing_to :instance
|
45
15
|
|
46
16
|
def instance
|
47
17
|
@instance ||= new
|
48
18
|
end
|
49
19
|
|
50
|
-
#
|
51
|
-
|
20
|
+
# Override Kernel#warn to ensure proper delegation
|
21
|
+
def warn(*args)
|
22
|
+
instance.warn(*args)
|
23
|
+
end
|
52
24
|
|
53
25
|
# For testing purposes
|
54
26
|
def reset
|
@@ -58,6 +30,11 @@ module Roast
|
|
58
30
|
|
59
31
|
private
|
60
32
|
|
33
|
+
def initialize(stdout: $stdout, log_level: ENV["ROAST_LOG_LEVEL"] || "INFO")
|
34
|
+
@log_level = validate_log_level(log_level)
|
35
|
+
@logger = create_logger(stdout)
|
36
|
+
end
|
37
|
+
|
61
38
|
def validate_log_level(level)
|
62
39
|
level_str = level.to_s.upcase
|
63
40
|
unless VALID_LOG_LEVELS.include?(level_str)
|