grokkit/.grokkit/recipes/template-recipe.md

67 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

---
name: my-awesome-recipe
description: Short description of what this recipe does
version: 1.0
parameters:
package_path:
type: string
default: internal
description: Directory or package to operate on
dry_run:
type: bool
default: true
description: If true, only generate a patch
project_languages:
- go
extensions:
go:
- .go
search_pattern: "if err != nil"
allowed_shell_commands:
- go test ./...
- go fmt ./...
- go vet ./...
---
# My Awesome Recipe
**Overview**
One-sentence summary of what the whole recipe accomplishes.
## Execution Steps
### Step 1: Discover files
**Objective:** Find every file that needs changing.
**Instructions:** Recursively scan `{{.package_path}}` for files containing the search pattern.
**Expected output:** A clean list of full file paths (one per line). If none, say "No files found matching the criteria."
### Step 2: Do the work
**Objective:** Perform the main task on each discovered file.
**Instructions:** For each file from Step 1:
- Read the full original content.
- Do whatever transformation is needed.
- Return **ONLY** this exact JSON (no extra text, no markdown):
```json
{
"file": "path/to/file.ext",
"content": "the complete new file content here"
}
```
**Expected output:** A JSON array containing one object per file.
### Step 3: Apply or patch
**Objective:** Safely write changes or create reviewable output.
**Instructions:**
- If dry_run is true → create a unified diff patch file for review.
- If false → write the new files (backup originals as .bak).
- Expected output: Confirmation of what was written + full path to any patch file.
### Final Summary
Give me a concise executive summary: number of files changed, any warnings or patterns you noticed, and your recommended next step.