roast-ai 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/CLAUDE.md +3 -1
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +15 -10
  6. data/README.md +214 -20
  7. data/bin/roast +1 -1
  8. data/examples/bash_prototyping/README.md +53 -0
  9. data/examples/bash_prototyping/analyze_network/prompt.md +13 -0
  10. data/examples/bash_prototyping/analyze_system/prompt.md +11 -0
  11. data/examples/bash_prototyping/api_testing.yml +14 -0
  12. data/examples/bash_prototyping/check_processes/prompt.md +11 -0
  13. data/examples/bash_prototyping/generate_report/prompt.md +16 -0
  14. data/examples/bash_prototyping/process_json_response/prompt.md +24 -0
  15. data/examples/bash_prototyping/system_analysis.yml +14 -0
  16. data/examples/bash_prototyping/test_public_api/prompt.md +22 -0
  17. data/examples/cmd/README.md +99 -0
  18. data/examples/cmd/analyze_project/prompt.md +57 -0
  19. data/examples/cmd/basic_demo/prompt.md +48 -0
  20. data/examples/cmd/basic_workflow.yml +17 -0
  21. data/examples/cmd/check_repository/prompt.md +57 -0
  22. data/examples/cmd/create_and_verify/prompt.md +56 -0
  23. data/examples/cmd/dev_workflow.yml +26 -0
  24. data/examples/cmd/explore_project/prompt.md +67 -0
  25. data/examples/cmd/explorer_workflow.yml +21 -0
  26. data/examples/cmd/smart_tool_selection/prompt.md +99 -0
  27. data/examples/grading/README.md +71 -0
  28. data/examples/grading/read_dependencies/prompt.md +4 -2
  29. data/examples/grading/run_coverage.rb +9 -0
  30. data/examples/grading/workflow.yml +0 -2
  31. data/examples/mcp/README.md +223 -0
  32. data/examples/mcp/analyze_changes/prompt.md +8 -0
  33. data/examples/mcp/analyze_issues/prompt.md +4 -0
  34. data/examples/mcp/analyze_schema/prompt.md +4 -0
  35. data/examples/mcp/check_data_quality/prompt.md +5 -0
  36. data/examples/mcp/check_documentation/prompt.md +4 -0
  37. data/examples/mcp/create_recommendations/prompt.md +5 -0
  38. data/examples/mcp/database_workflow.yml +29 -0
  39. data/examples/mcp/env_demo/workflow.yml +34 -0
  40. data/examples/mcp/fetch_pr_context/prompt.md +4 -0
  41. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +2 -0
  42. data/examples/mcp/filesystem_demo/list_files/prompt.md +6 -0
  43. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +7 -0
  44. data/examples/mcp/filesystem_demo/workflow.yml +38 -0
  45. data/examples/mcp/generate_insights/prompt.md +4 -0
  46. data/examples/mcp/generate_report/prompt.md +6 -0
  47. data/examples/mcp/generate_review/prompt.md +16 -0
  48. data/examples/mcp/github_workflow.yml +32 -0
  49. data/examples/mcp/multi_mcp_workflow.yml +58 -0
  50. data/examples/mcp/post_review/prompt.md +3 -0
  51. data/examples/mcp/save_report/prompt.md +6 -0
  52. data/examples/mcp/search_issues/prompt.md +2 -0
  53. data/examples/mcp/summarize/prompt.md +1 -0
  54. data/examples/mcp/test_filesystem/prompt.md +6 -0
  55. data/examples/mcp/test_github/prompt.md +8 -0
  56. data/examples/mcp/test_read/prompt.md +1 -0
  57. data/examples/mcp/workflow.yml +35 -0
  58. data/examples/shared_config/README.md +52 -0
  59. data/examples/shared_config/example_with_shared_config/workflow.yml +6 -0
  60. data/examples/shared_config/shared.yml +7 -0
  61. data/examples/step_configuration/README.md +0 -3
  62. data/examples/step_configuration/workflow.yml +0 -3
  63. data/examples/tool_config_example/README.md +109 -0
  64. data/examples/tool_config_example/example_step/prompt.md +42 -0
  65. data/examples/tool_config_example/workflow.yml +17 -0
  66. data/examples/workflow_generator/workflow.yml +0 -1
  67. data/lib/roast/helpers/function_caching_interceptor.rb +0 -4
  68. data/lib/roast/helpers/prompt_loader.rb +0 -1
  69. data/lib/roast/tools/bash.rb +62 -0
  70. data/lib/roast/tools/cmd.rb +121 -34
  71. data/lib/roast/tools/coding_agent.rb +86 -7
  72. data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +87 -0
  73. data/lib/roast/tools/search_file.rb +13 -1
  74. data/lib/roast/tools.rb +5 -5
  75. data/lib/roast/version.rb +1 -1
  76. data/lib/roast/workflow/base_step.rb +29 -21
  77. data/lib/roast/workflow/base_workflow.rb +8 -10
  78. data/lib/roast/workflow/configuration.rb +68 -3
  79. data/lib/roast/workflow/configuration_loader.rb +63 -4
  80. data/lib/roast/workflow/configuration_parser.rb +0 -3
  81. data/lib/roast/workflow/error_handler.rb +0 -1
  82. data/lib/roast/workflow/file_state_repository.rb +0 -1
  83. data/lib/roast/workflow/iteration_executor.rb +0 -1
  84. data/lib/roast/workflow/output_manager.rb +0 -1
  85. data/lib/roast/workflow/prompt_step.rb +1 -1
  86. data/lib/roast/workflow/step_executor_coordinator.rb +5 -3
  87. data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -1
  88. data/lib/roast/workflow/step_loader.rb +35 -8
  89. data/lib/roast/workflow/step_orchestrator.rb +4 -2
  90. data/lib/roast/workflow/workflow_execution_context.rb +0 -2
  91. data/lib/roast/workflow/workflow_executor.rb +1 -3
  92. data/lib/roast/workflow/workflow_initializer.rb +66 -2
  93. data/lib/roast/workflow/workflow_runner.rb +1 -2
  94. data/lib/roast.rb +8 -0
  95. data/package-lock.json +6 -0
  96. data/roast.gemspec +2 -1
  97. metadata +73 -3
@@ -0,0 +1,22 @@
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.
@@ -0,0 +1,99 @@
1
+ # Command Tool Examples
2
+
3
+ Learn how to execute system commands in your Roast workflows using the Cmd tool. This example demonstrates how to define allowed commands and use them as functions within your workflows.
4
+
5
+ ## Overview
6
+
7
+ The `Cmd` tool allows you to define a list of approved system commands that can be executed by the AI. Each allowed command is treated as a distinct function, providing several benefits:
8
+
9
+ - **Security**: Only explicitly allowed commands can be run, preventing unauthorized system access.
10
+ - **Clarity**: Each command has a clear, defined purpose within the workflow.
11
+ - **Intelligent Usage**: Custom descriptions can be provided to help the AI choose the correct command for a given task.
12
+
13
+ ## Configuration
14
+
15
+ You can configure the `Cmd` tool in your workflow YAML file.
16
+
17
+ ### Basic Configuration
18
+
19
+ List the commands that the AI is allowed to execute:
20
+
21
+ ```yaml
22
+ tools:
23
+ - Roast::Tools::Cmd:
24
+ allowed_commands:
25
+ - pwd
26
+ - ls
27
+ - echo
28
+ ```
29
+
30
+ Each command listed here (`pwd`, `ls`, `echo`) becomes a function the AI can call. For example, the AI can call `pwd()` to get the current directory, or `ls(args: "-la")` to list files.
31
+
32
+ ### Enhanced Configuration with Descriptions
33
+
34
+ For more complex commands or to provide better guidance to the AI, you can include a description:
35
+
36
+ ```yaml
37
+ tools:
38
+ - Roast::Tools::Cmd:
39
+ allowed_commands:
40
+ - pwd
41
+ - ls
42
+ - name: git
43
+ description: "git CLI - version control system (e.g., git status, git log)"
44
+ - name: npm
45
+ description: "npm CLI - Node.js package manager (e.g., npm install, npm run)"
46
+ - name: docker
47
+ description: "Docker CLI - container platform (e.g., docker ps, docker run)"
48
+ ```
49
+ These descriptions help the AI understand the purpose of each command and its common subcommands or arguments.
50
+
51
+ ## How It Works
52
+
53
+ When the `Cmd` tool is configured, each entry in `allowed_commands` is registered as a function available to the AI.
54
+
55
+ - `pwd` becomes `pwd()`
56
+ - `ls` becomes `ls(args: <string>)`
57
+ - `git` (with a description) becomes `git(args: <string>)`
58
+
59
+ The AI can then choose to call these functions with appropriate arguments (passed via the `args` parameter) to accomplish its tasks.
60
+
61
+ ## Example Workflows
62
+
63
+ This directory contains several example workflows demonstrating different uses of the `Cmd` tool:
64
+
65
+ - **`basic_workflow.yml`**: Introduces simple command execution.
66
+ - **`explorer_workflow.yml`**: Uses commands to navigate and understand a project structure.
67
+ - **`dev_workflow.yml`**: Showcases how descriptions guide the AI in selecting tools for development-related tasks.
68
+
69
+ ## Running the Examples
70
+
71
+ To run an example workflow:
72
+ ```bash
73
+ bin/roast execute examples/cmd/NAME_OF_WORKFLOW.yml
74
+ ```
75
+ For instance:
76
+ ```bash
77
+ bin/roast execute examples/cmd/basic_workflow.yml
78
+ ```
79
+
80
+ ## Security
81
+
82
+ Explicitly defining `allowed_commands` is crucial for security:
83
+ - You maintain full control over which system commands the AI can execute.
84
+ - It creates self-documenting configurations, making workflows safer and more predictable.
85
+
86
+ ## Best Practices
87
+
88
+ - **Start Simple**: Begin with basic commands like `pwd` and `ls`.
89
+ - **Use Descriptions for Clarity**: Provide descriptions for commands that are not universally understood or have complex arguments/subcommands. This helps both the AI and human readers.
90
+ - **Scope Appropriately**: Only allow commands that are necessary for the workflow's intended purpose.
91
+
92
+ ## Why Use Custom Descriptions?
93
+
94
+ Custom descriptions are particularly useful when:
95
+ - Dealing with domain-specific or less common commands.
96
+ - Disambiguating between commands with similar names or overlapping functionality.
97
+ - Guiding the AI to make more informed decisions about tool selection.
98
+
99
+ Good descriptions enhance the AI's ability to use commands effectively and make your workflows more robust.
@@ -0,0 +1,57 @@
1
+ # Project Analysis
2
+
3
+ You need to analyze the current project to identify its type, available tools, and development setup. Gather comprehensive information to understand the project's nature and configuration.
4
+
5
+ Investigate the project to determine:
6
+
7
+ 1. Your current working location
8
+ 2. The project structure and contents
9
+ 3. Whether this is a Node.js project (look for package.json)
10
+ 4. Whether Docker is configured (look for Dockerfile or docker-compose.yml)
11
+ 5. Whether there's a Makefile for build automation
12
+ 6. The version control state
13
+
14
+ Based on your findings, determine:
15
+ - Project type (Node.js application, containerized service, make-based project, etc.)
16
+ - Available development tools and configurations
17
+ - How dependencies are managed
18
+ - Version control status
19
+ - Recommended next steps for development
20
+
21
+ RESPONSE FORMAT
22
+ Provide your analysis in JSON format:
23
+
24
+ <json>
25
+ {
26
+ "project_analysis": {
27
+ "working_directory": "/path/to/project",
28
+ "project_type": "Identified based on available files",
29
+ "detected_tools": {
30
+ "node_project": {
31
+ "has_package_json": false,
32
+ "has_lock_file": false,
33
+ "package_manager": "none"
34
+ },
35
+ "containerization": {
36
+ "has_dockerfile": false,
37
+ "has_compose": false,
38
+ "docker_ready": false
39
+ },
40
+ "build_system": {
41
+ "has_makefile": false,
42
+ "make_targets": []
43
+ },
44
+ "version_control": {
45
+ "has_git": true,
46
+ "working_tree_clean": false,
47
+ "uncommitted_changes": 3
48
+ }
49
+ },
50
+ "recommendations": [
51
+ "Relevant recommendations based on what was found"
52
+ ],
53
+ "confidence": "high"
54
+ },
55
+ "analysis_complete": true
56
+ }
57
+ </json>
@@ -0,0 +1,48 @@
1
+ # Basic Command Demonstration
2
+
3
+ You are demonstrating basic command functions. Execute several simple commands to show how the command tool system works.
4
+
5
+ **SPECIFIC TASKS:**
6
+ 1. Show the current working directory: use `pwd`
7
+ 2. List all files with details: use `ls -la`
8
+ 3. Display celebratory message: use `echo "🎉 Command functions are working!"`
9
+ 4. List examples directory: use `ls examples/`
10
+
11
+ **EFFICIENCY RULES:**
12
+ - Execute each command ONLY ONCE
13
+ - DO NOT repeat any command
14
+ - Follow the exact order above
15
+
16
+ Each command execution demonstrates how commands are called as functions in the workflow, with security enforced through the workflow's configuration.
17
+
18
+ RESPONSE FORMAT
19
+ Provide a summary of your command executions in JSON format:
20
+
21
+ <json>
22
+ {
23
+ "demonstration_complete": true,
24
+ "commands_executed": [
25
+ {
26
+ "command": "pwd",
27
+ "purpose": "Show current working directory",
28
+ "output_summary": "Current directory path"
29
+ },
30
+ {
31
+ "command": "ls -la",
32
+ "purpose": "List all files with details",
33
+ "output_summary": "Directory listing with permissions and sizes"
34
+ },
35
+ {
36
+ "command": "echo \"🎉 Command functions are working!\"",
37
+ "purpose": "Display test message",
38
+ "output_summary": "Success message displayed"
39
+ },
40
+ {
41
+ "command": "ls examples/",
42
+ "purpose": "List examples directory",
43
+ "output_summary": "Contents of examples directory"
44
+ }
45
+ ],
46
+ "conclusion": "Successfully demonstrated basic command functions with security constraints"
47
+ }
48
+ </json>
@@ -0,0 +1,17 @@
1
+ name: Basic Command Functions
2
+ model: default
3
+
4
+ # Learn the basics of using command functions in Roast
5
+
6
+ tools:
7
+ - Roast::Tools::Cmd:
8
+ allowed_commands:
9
+ - pwd
10
+ - ls
11
+ - echo
12
+ - mkdir
13
+ - cat
14
+
15
+ steps:
16
+ - basic_demo
17
+ - create_and_verify
@@ -0,0 +1,57 @@
1
+ # Repository Status Check
2
+
3
+ You need to analyze the Git repository status and provide a comprehensive overview of the repository state, history, and configuration.
4
+
5
+ **SPECIFIC COMMANDS TO USE:**
6
+ 1. Check repository status: `git status`
7
+ 2. Show current branch: `git branch --show-current`
8
+ 3. List recent commits: `git log --oneline -10`
9
+ 4. Show remote repositories: `git remote -v`
10
+
11
+ **EFFICIENCY RULES:**
12
+ - Run each command ONLY ONCE - do not repeat any git command
13
+ - DO NOT try different variations of the same command (e.g., different log formats)
14
+ - Gather all needed information with these 4 commands only
15
+
16
+ From these commands, analyze:
17
+ - Current branch and its state
18
+ - Working directory status (clean/dirty)
19
+ - Recent commit activity
20
+ - Remote repository configuration
21
+ - Overall repository health
22
+
23
+ RESPONSE FORMAT
24
+ Provide your analysis in JSON format:
25
+
26
+ <json>
27
+ {
28
+ "repository_status": {
29
+ "current_branch": "main",
30
+ "working_directory": {
31
+ "is_clean": false,
32
+ "modified_files": 3,
33
+ "untracked_files": 2,
34
+ "staged_changes": 1
35
+ },
36
+ "recent_activity": {
37
+ "total_recent_commits": 10,
38
+ "latest_commit": {
39
+ "hash": "abc1234",
40
+ "message": "Latest commit message"
41
+ },
42
+ "activity_summary": "Regular commits indicate active development"
43
+ },
44
+ "remotes": {
45
+ "origin": {
46
+ "fetch_url": "https://github.com/user/repo.git",
47
+ "push_url": "https://github.com/user/repo.git"
48
+ }
49
+ },
50
+ "repository_health": {
51
+ "status": "healthy",
52
+ "notes": "Repository has uncommitted changes but is otherwise in good state"
53
+ }
54
+ },
55
+ "analysis_complete": true
56
+ }
57
+ </json>
@@ -0,0 +1,56 @@
1
+ # Creating and Verifying Files
2
+
3
+ You need to demonstrate file creation and verification capabilities. Create a test directory and file, then verify the operations were successful.
4
+
5
+ **EXECUTE THESE COMMANDS IN ORDER:**
6
+ 1. Create directory: `mkdir -p test_cmd_demo`
7
+ 2. Create file: `echo "This file was created by command functions!" > test_cmd_demo/demo.txt`
8
+ 3. Verify directory: `ls -la test_cmd_demo/`
9
+ 4. Verify content: `cat test_cmd_demo/demo.txt`
10
+ 5. Show completion: `echo "Demo complete! You can remove test_cmd_demo when ready."`
11
+
12
+ **EFFICIENCY RULE:** Execute each command exactly once in the order shown above.
13
+
14
+ This exercise demonstrates how command functions can be combined for practical file operations while maintaining security through the workflow's command restrictions.
15
+
16
+ RESPONSE FORMAT
17
+ Report the results in JSON format:
18
+
19
+ <json>
20
+ {
21
+ "task_completed": true,
22
+ "operations": [
23
+ {
24
+ "step": "create_directory",
25
+ "command": "mkdir -p test_cmd_demo",
26
+ "success": true,
27
+ "result": "Directory created successfully"
28
+ },
29
+ {
30
+ "step": "create_file",
31
+ "command": "echo \"This file was created by command functions!\" > test_cmd_demo/demo.txt",
32
+ "success": true,
33
+ "result": "File created with content"
34
+ },
35
+ {
36
+ "step": "verify_creation",
37
+ "command": "ls -la test_cmd_demo/",
38
+ "success": true,
39
+ "result": "Directory listing shows demo.txt file"
40
+ },
41
+ {
42
+ "step": "verify_content",
43
+ "command": "cat test_cmd_demo/demo.txt",
44
+ "success": true,
45
+ "result": "File contents match expected text"
46
+ },
47
+ {
48
+ "step": "completion_message",
49
+ "command": "echo \"Demo complete! You can remove test_cmd_demo when ready.\"",
50
+ "success": true,
51
+ "result": "Completion message displayed"
52
+ }
53
+ ],
54
+ "summary": "Successfully demonstrated file creation and verification using command functions"
55
+ }
56
+ </json>
@@ -0,0 +1,26 @@
1
+ name: Development Tools Workflow
2
+ model: default
3
+
4
+ # Demonstrates how custom descriptions guide intelligent tool selection
5
+
6
+ tools:
7
+ - Roast::Tools::Cmd:
8
+ allowed_commands:
9
+ - pwd
10
+ - ls
11
+ - name: git
12
+ description: "git CLI - version control system with subcommands like status, commit, branch"
13
+ - name: npm
14
+ description: "npm CLI - Node.js package manager with subcommands like install, run, test"
15
+ - name: docker
16
+ description: "Docker CLI - container platform with subcommands like ps, run, build"
17
+ - name: curl
18
+ description: "curl command - make HTTP requests with options like -X, -H, -d"
19
+ - name: jq
20
+ description: "jq command - process JSON data with filters like '.key', '.[].name'"
21
+ - name: make
22
+ description: "make command - run build targets defined in Makefile"
23
+
24
+ steps:
25
+ - analyze_project
26
+ - smart_tool_selection
@@ -0,0 +1,67 @@
1
+ # Exploring Your Project Structure
2
+
3
+ You need to analyze the project structure and provide a comprehensive overview. Gather information about the project layout, documentation, and configuration.
4
+
5
+ **IMPORTANT COMMAND SYNTAX:**
6
+ - The `find` command requires a path: `find . -name "*.md"` (not `find -name "*.md"`)
7
+ - Use `head` to limit output: `find . -name "*.md" | head -10`
8
+ - Check files efficiently - don't repeat commands
9
+
10
+ Explore the project by:
11
+
12
+ 1. Identifying your current location: use `pwd`
13
+ 2. Listing all files and directories: use `ls -la`
14
+ 3. Finding documentation files: use `find . -name "*.md" -type f | head -10`
15
+ 4. Examining the README: use `cat README.md | head -20` (if it exists)
16
+ 5. Locating configuration files: use `find . -name "*.yml" -o -name "*.yaml" | grep -E "(config|workflow)" | head -10`
17
+
18
+ **EFFICIENCY RULES:**
19
+ - Run each command ONLY ONCE
20
+ - If a file doesn't exist, note it and move on
21
+ - DO NOT retry failed commands
22
+
23
+ Based on your exploration, analyze:
24
+ - Project root location and overall structure
25
+ - Key directories and their likely purposes
26
+ - Available documentation
27
+ - Configuration files present
28
+ - General project organization
29
+
30
+ RESPONSE FORMAT
31
+ Provide your analysis in JSON format:
32
+
33
+ <json>
34
+ {
35
+ "project_analysis": {
36
+ "current_directory": "/path/to/project",
37
+ "total_items": {
38
+ "files": 0,
39
+ "directories": 0,
40
+ "hidden_items": 0
41
+ },
42
+ "documentation": {
43
+ "readme_found": true,
44
+ "readme_summary": "Brief summary of README contents",
45
+ "other_docs": ["list of other .md files found"]
46
+ },
47
+ "configuration": {
48
+ "config_files": ["list of .yml/.yaml configuration files"],
49
+ "workflow_files": ["list of workflow-related files"]
50
+ },
51
+ "project_structure": {
52
+ "key_directories": [
53
+ {
54
+ "name": "src",
55
+ "purpose": "Source code directory"
56
+ },
57
+ {
58
+ "name": "test",
59
+ "purpose": "Test files directory"
60
+ }
61
+ ],
62
+ "project_type": "Identified project type based on files present"
63
+ }
64
+ },
65
+ "exploration_complete": true
66
+ }
67
+ </json>
@@ -0,0 +1,21 @@
1
+ name: Project Explorer
2
+ model: default
3
+
4
+ # Navigate and explore your project using command functions
5
+
6
+ tools:
7
+ - Roast::Tools::Cmd:
8
+ allowed_commands:
9
+ - pwd
10
+ - ls
11
+ - find
12
+ - name: cat
13
+ description: "cat command - display file contents, concatenate files, works with pipes"
14
+ - name: git
15
+ description: "git CLI - version control system with subcommands like status, log, branch"
16
+ - name: grep
17
+ description: "grep command - search text patterns with options like -E, -r, -i"
18
+
19
+ steps:
20
+ - explore_project
21
+ - check_repository
@@ -0,0 +1,99 @@
1
+ # Intelligent Tool Selection Examples
2
+
3
+ You are demonstrating intelligent tool selection by completing various development tasks. Select and use the most appropriate tools based on what each task requires.
4
+
5
+ **CRITICAL GUIDELINES:**
6
+ - When working with JSON data, you MUST use jq to parse it - never return raw JSON
7
+ - Be efficient - if a command fails, do NOT repeat it
8
+ - Combine tools with pipes when needed (e.g., `curl -s ... | jq ...`)
9
+ - Check for files ONLY ONCE - if they don't exist, note it and move on
10
+
11
+ Complete the following development tasks:
12
+
13
+ ## Task 1: API Health Check
14
+ Check if the GitHub API is accessible and responding properly.
15
+ - Target: https://api.github.com
16
+ - Goal: Verify the API returns a successful response (check HTTP status)
17
+
18
+ ## Task 2: Parse JSON Response
19
+ Fetch GitHub's public information and extract specific data fields.
20
+ - Target: https://api.github.com/users/github
21
+ - Extract: The name and company fields from the JSON response
22
+ - **REQUIRED**: Use curl to fetch and jq to parse in a single command: `curl -s <url> | jq '<filter>'`
23
+
24
+ ## Task 3: Check Container Environment
25
+ Determine if Docker is available and check for running containers.
26
+ - Try `docker ps` ONCE
27
+ - If Docker daemon is not running, note this and move on - do NOT retry
28
+
29
+ ## Task 4: Check for Node.js Project
30
+ Investigate if this is a Node.js project and examine its dependencies.
31
+ - Check for package.json ONCE with `ls package.json`
32
+ - If not found, note this and move on - do NOT retry
33
+
34
+ ## Task 5: Check Build System
35
+ Determine if a build system is configured and what targets are available.
36
+ - Check for Makefile ONCE with `ls Makefile`
37
+ - If not found, note this and move on - do NOT retry
38
+
39
+ **EFFICIENCY REMINDER**: Each file check or failed command should be attempted ONLY ONCE.
40
+
41
+ RESPONSE FORMAT
42
+ Report your findings in JSON format:
43
+
44
+ <json>
45
+ {
46
+ "tool_selection_demo": {
47
+ "task_1_api_check": {
48
+ "tool_selected": "curl",
49
+ "command_used": "curl -I https://api.github.com",
50
+ "rationale": "Selected HTTP request tool for API check",
51
+ "result": {
52
+ "api_accessible": true,
53
+ "status_code": 200
54
+ }
55
+ },
56
+ "task_2_json_parsing": {
57
+ "tools_selected": ["curl", "jq"],
58
+ "command_used": "curl -s https://api.github.com/users/github | jq '.name, .company'",
59
+ "rationale": "Combined tools for fetching and parsing JSON",
60
+ "result": {
61
+ "data_extracted": true,
62
+ "fields": {
63
+ "name": "GitHub",
64
+ "company": "@github"
65
+ }
66
+ }
67
+ },
68
+ "task_3_containers": {
69
+ "tool_selected": "docker",
70
+ "command_used": "docker ps",
71
+ "rationale": "Selected container platform tool",
72
+ "result": {
73
+ "docker_available": false,
74
+ "error": "Docker daemon not running",
75
+ "containers_running": 0
76
+ }
77
+ },
78
+ "task_4_nodejs": {
79
+ "tool_selected": "ls",
80
+ "command_used": "ls package.json",
81
+ "rationale": "Checked for package.json existence",
82
+ "result": {
83
+ "is_node_project": false,
84
+ "package_json_found": false
85
+ }
86
+ },
87
+ "task_5_build": {
88
+ "tool_selected": "ls",
89
+ "command_used": "ls Makefile",
90
+ "rationale": "Checked for Makefile existence",
91
+ "result": {
92
+ "makefile_found": false,
93
+ "targets": []
94
+ }
95
+ }
96
+ },
97
+ "summary": "Successfully demonstrated intelligent tool selection based on task requirements"
98
+ }
99
+ </json>
@@ -0,0 +1,71 @@
1
+ # Test Grading Workflow
2
+
3
+ This workflow acts as a senior software engineer and testing expert to evaluate the quality of test files based on best practices and guidelines.
4
+
5
+ ## Prerequisites
6
+
7
+ This example uses `shadowenv` for environment management, which is specific to Shopify's development environment. If you're not using shadowenv, you'll need to adapt the commands to your own setup.
8
+
9
+ ### If you're using shadowenv:
10
+ ```bash
11
+ brew install shadowenv
12
+ ```
13
+
14
+ ### If you're NOT using shadowenv:
15
+ You'll need to modify the `run_coverage.rb` file to remove the shadowenv commands. Look for lines like:
16
+ ```ruby
17
+ command = "shadowenv exec -- bundle exec ruby ..."
18
+ ```
19
+
20
+ And change them to match your environment:
21
+ ```ruby
22
+ # For standard Ruby/Bundler setup:
23
+ command = "bundle exec ruby ..."
24
+
25
+ # Or if you're using rbenv/rvm:
26
+ command = "ruby ..."
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ # Run the grading workflow on a test file
33
+ roast execute examples/grading/workflow.yml path/to/your_test.rb
34
+ ```
35
+
36
+ ## How it Works
37
+
38
+ 1. **read_dependencies**: Analyzes the test file and its dependencies
39
+ 2. **run_coverage**: Executes the test with coverage tracking
40
+ 3. **generate_grades**: Evaluates test quality across multiple dimensions
41
+ 4. **verify_test_helpers**: Checks for proper test helper usage
42
+ 5. **verify_mocks_and_stubs**: Ensures appropriate use of test doubles
43
+ 6. **analyze_coverage**: Reviews code coverage metrics
44
+ 7. **generate_recommendations**: Provides improvement suggestions
45
+ 8. **calculate_final_grade**: Computes an overall grade (A-F scale)
46
+ 9. **format_result**: Formats the final output
47
+
48
+ ## Customization
49
+
50
+ Feel free to adapt this workflow to your testing environment:
51
+
52
+ - **Different test frameworks**: Modify `run_coverage.rb` to work with RSpec, Jest, pytest, etc.
53
+ - **Coverage tools**: Replace the coverage command with your preferred tool (SimpleCov, Istanbul, Coverage.py)
54
+ - **Grading criteria**: Adjust the prompts in each step to match your team's standards
55
+ - **Environment setup**: Remove or replace shadowenv with your environment management tool
56
+
57
+ ## Example Output
58
+
59
+ ```
60
+ ========== TEST GRADE REPORT ==========
61
+ Test file: test/example_test.rb
62
+
63
+ FINAL GRADE:
64
+ Score: 85/100
65
+ Letter Grade: B
66
+
67
+ RECOMMENDATIONS:
68
+ - Add edge case testing for error conditions
69
+ - Improve test descriptions for clarity
70
+ - Consider extracting common setup to helper methods
71
+ ```
@@ -5,10 +5,12 @@ The first dependency you should always look for is the source file for the prime
5
5
  If you can identify other important application-level dependencies then read them too.
6
6
  How many extra dependencies to research is left to your discretion, but ALWAYS make sure you have the subject under test (SUT) in your context before responding.
7
7
 
8
- Once you are finished using tool functions, respond with the relative path to the source file of the SUT inside <sut> tags.
8
+ Once you are finished using tool functions, respond with the relative path to the source file of the SUT inside <sut> tags. IMPORTANT: Include the full relative path from the project root, including any directory prefixes like lib/, app/, etc.
9
9
 
10
10
  Example:
11
11
 
12
12
  If you are told to find the dependencies of `test/services/country_db_interface_test.rb`,
13
- then you would use the functions as explained above and ultimately respond with `<sut>./app/services/country_db_interface.rb</sut>`
13
+ then you would use the functions as explained above and ultimately respond with `<sut>app/services/country_db_interface.rb</sut>`
14
+
15
+ If the file is found at `lib/roast/workflow/workflow_initializer.rb`, respond with `<sut>lib/roast/workflow/workflow_initializer.rb</sut>` (include the lib/ prefix)
14
16
 
@@ -30,7 +30,16 @@ class RunCoverage < Roast::Workflow::BaseStep
30
30
 
31
31
  # Resolve paths to prevent issues when pwd differs from project root
32
32
  resolved_subject_file = Roast::Helpers::PathResolver.resolve(subject_file)
33
+ unless File.exist?(resolved_subject_file)
34
+ Roast::Helpers::Logger.error("Subject file not found: #{resolved_subject_file}")
35
+ exit(1)
36
+ end
37
+
33
38
  resolved_test_file = Roast::Helpers::PathResolver.resolve(test_file)
39
+ unless File.exist?(resolved_test_file)
40
+ Roast::Helpers::Logger.error("Test file not found: #{resolved_test_file}")
41
+ exit(1)
42
+ end
34
43
 
35
44
  # Run the test_runner using shadowenv for environment consistency
36
45
  command = "shadowenv exec --dir . -- #{test_runner_path} #{resolved_test_file} #{resolved_subject_file}"