Change Recipes Test Script (#5457)

This commit is contained in:
Amed Rodriguez
2025-10-30 16:00:25 -07:00
committed by GitHub
parent 4201e80e8e
commit d9633ff1d9
9 changed files with 235 additions and 126 deletions
@@ -0,0 +1,36 @@
version: 1.0.0
title: Project Analyzer
description: Analyze project codebase using parallel subrecipes for file statistics and code patterns
instructions: You are a code analysis assistant that examines project structure and code patterns.
parameters:
- key: target_directory
input_type: string
requirement: optional
default: "."
description: "Directory to analyze"
- key: include_tests
input_type: string
requirement: optional
default: "true"
description: "Whether to include test files in analysis"
prompt: |
Run two subrecipes sequentially:
- use file_stats subrecipe to gather file statistics for {{ target_directory }}
- use code_patterns subrecipe to analyze code patterns in {{ target_directory }}
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
sub_recipes:
- name: file_stats
path: "./subrecipes/file_stats.yaml"
values:
directory: "{{ target_directory }}"
fast_mode: "true"
- name: code_patterns
path: "./subrecipes/code_patterns.yaml"
values:
directory: "{{ target_directory }}"
include_tests: "{{ include_tests }}"
fast_mode: "true"
@@ -0,0 +1,36 @@
version: 1.0.0
title: Project Analyzer (Parallel)
description: Analyze project codebase using parallel subrecipes for file statistics and code patterns
instructions: You are a code analysis assistant that examines project structure and code patterns.
parameters:
- key: target_directory
input_type: string
requirement: optional
default: "."
description: "Directory to analyze"
- key: include_tests
input_type: string
requirement: optional
default: "true"
description: "Whether to include test files in analysis"
prompt: |
Run two subrecipes in parallel:
- use file_stats subrecipe to gather file statistics for {{ target_directory }}
- use code_patterns subrecipe to analyze code patterns in {{ target_directory }}
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
sub_recipes:
- name: file_stats
path: "./subrecipes/file_stats.yaml"
values:
directory: "{{ target_directory }}"
fast_mode: "true"
- name: code_patterns
path: "./subrecipes/code_patterns.yaml"
values:
directory: "{{ target_directory }}"
include_tests: "{{ include_tests }}"
fast_mode: "true"
@@ -1,23 +0,0 @@
version: "1.0.0"
title: "Activity Recommender"
description: "Suggest activities based on weather conditions"
instructions: |
You are a travel expert. Recommend appropriate activities and attractions
based on current weather conditions.
parameters:
- key: weather_conditions
input_type: string
requirement: required
description: "Current weather conditions to base recommendations on"
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
prompt: |
Based on these weather conditions: {{ weather_conditions }},
suggest appropriate activities, attractions, and travel tips.
Include both indoor and outdoor options as relevant.
@@ -0,0 +1,62 @@
version: 1.0.0
title: Code Pattern Analyzer
description: Analyze code patterns and structures in source files
instructions: You are a code pattern analyzer that searches for common programming patterns and constructs.
parameters:
- key: directory
input_type: string
requirement: required
description: "Directory to analyze"
- key: include_tests
input_type: string
requirement: optional
default: "true"
description: "Whether to include test files"
- key: fast_mode
input_type: string
requirement: optional
default: "true"
description: "Use fast single-command mode for CI"
prompt: |
{% if fast_mode == "true" %}
Write code_patterns.json with a single shell command:
cat > code_patterns.json << 'JSON'
{"todos":[{"file":"README.md","line":3,"text":"Add more tests"}],"function_count":2,"import_count":0,"test_count":2,"files_analyzed":3}
JSON
Use a single tool call. Do not scan the filesystem.
{% else %}
Analyze source code files in {{ directory }} and identify patterns:
1. Find all TODO/FIXME comments
2. Count function/method definitions (look for 'fn ', 'def ', 'function ')
3. Find import/use statements
4. Identify test functions (names containing 'test')
Write your findings to a file named code_patterns.json with this structure:
```json
{
"todos": [
{"file": "<path>", "line": <number>, "text": "<comment>"}
],
"function_count": <number>,
"import_count": <number>,
"test_count": <number>,
"files_analyzed": <number>
}
```
Use grep and other shell tools to find these patterns efficiently.
Only analyze source code files (.rs, .py, .js, .go, etc.), skip binaries and build artifacts.
{% if include_tests == "true" %}
Include test files (those with 'test' in the name) in your analysis.
{% else %}
Exclude test files from your analysis.
{% endif %}
{% endif %}
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
@@ -0,0 +1,60 @@
version: 1.0.0
title: File Statistics Analyzer
description: Gather comprehensive file statistics from a directory
instructions: You are a file system analyzer that gathers detailed statistics about files in a directory.
parameters:
- key: directory
input_type: string
requirement: required
description: "Directory to analyze"
- key: fast_mode
input_type: string
requirement: optional
default: "true"
description: "Use fast single-command mode for CI"
prompt: |
{% if fast_mode == "true" %}
Write file_stats.json with a single shell command:
cat > file_stats.json << 'JSON'
{"total_files":3,"files_by_extension":{".rs":1,".py":1,".md":1},"total_lines":50,"total_size_bytes":1500,"largest_file":{"path":"sample.rs","size_bytes":600},"smallest_file":{"path":"README.md","size_bytes":200}}
JSON
Use a single tool call. Do not scan the filesystem.
{% else %}
Analyze {{ directory }} and generate file statistics:
1. Count total files by extension (.rs, .yaml, .md, .toml, etc.)
2. Calculate total lines of code across all text files
3. Determine total file sizes
4. Find the largest and smallest files
Write your findings to a file named file_stats.json with this structure:
```json
{
"total_files": <number>,
"files_by_extension": {
".rs": <count>,
".yaml": <count>,
...
},
"total_lines": <number>,
"total_size_bytes": <number>,
"largest_file": {
"path": "<path>",
"size_bytes": <number>
},
"smallest_file": {
"path": "<path>",
"size_bytes": <number>
}
}
```
Use shell commands like find, wc, and du to gather this data efficiently.
{% endif %}
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
@@ -1,23 +0,0 @@
version: "1.0.0"
title: "Weather Data Collector"
description: "Fetch current weather conditions for a location"
instructions: |
You are a weather data specialist. Gather current weather information
including temperature, conditions, and seasonal context.
parameters:
- key: location
input_type: string
requirement: required
description: "City or location to get weather data for"
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
prompt: |
Get the current weather conditions for {{ location }}.
Include temperature, weather conditions (sunny, rainy, etc.),
and any relevant seasonal information.
@@ -1,23 +0,0 @@
version: "1.0.0"
title: "Travel Activity Planner"
description: "Get weather data and suggest appropriate activities"
instructions: |
Plan activities by first getting weather data, then suggesting activities based on conditions.
prompt: |
Plan activities for Sydney by first getting weather data, then suggesting activities based on the weather conditions we receive.
sub_recipes:
- name: weather_data
path: "{{ recipe_dir }}/subrecipes/weather-data.yaml"
# No values - location parameter comes from prompt context
- name: activity_suggestions
path: "{{ recipe_dir }}/subrecipes/activity-suggestions.yaml"
# weather_conditions parameter comes from conversation context
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true
@@ -1,23 +0,0 @@
version: "1.0.0"
title: "Travel Activity Planner (Parallel)"
description: "Get weather data and suggest activities in parallel"
instructions: |
Plan activities by getting weather data and activity suggestions in parallel to save time.
prompt: |
Run the following subrecipes in parallel to plan activities for Sydney:
- use weather_data subrecipe to get the weather for Sydney
- use activity_suggestions subrecipe to suggest activities for overcast, cool weather
sub_recipes:
- name: weather_data
path: "{{ recipe_dir }}/subrecipes/weather-data.yaml"
- name: activity_suggestions
path: "{{ recipe_dir }}/subrecipes/activity-suggestions.yaml"
extensions:
- type: builtin
name: developer
timeout: 300
bundled: true