diff --git a/.grokkit/recipes/result-refactor.md b/.grokkit/recipes/result-refactor.md index 427d5d9..b886e6f 100644 --- a/.grokkit/recipes/result-refactor.md +++ b/.grokkit/recipes/result-refactor.md @@ -39,12 +39,17 @@ Refactors all error handling in the target package to use the new Result[T] patt ## Execution Steps -### Step 1: Discover files +### Step 1: Explore project structure +**Objective:** Get a clear view of the current project layout. +**Instructions:** Use safe read-only shell commands to show the directory tree and key files. +**Expected output:** A tree view and relevant file contents. + +### Step 2: Discover files **Objective:** Find every file that needs changing. **Instructions:** Recursively scan `{{.package_path}}` for `.go` files containing `if err != nil`. **Expected output:** A clean list of full file paths (one per line). If none, say "No files found matching the criteria." -### Step 2: Refactor each file +### Step 3: Refactor each file **Objective:** Generate the updated code. **Instructions:** For each file from Step 1: - Read the full original content. @@ -59,7 +64,7 @@ Refactors all error handling in the target package to use the new Result[T] patt ] ``` -### Step 3: Apply or patch +### Step 4: Apply or patch **Objective:** Safely write changes or create reviewable output. **Instructions:** diff --git a/internal/recipe/runner.go b/internal/recipe/runner.go index b053746..04039fd 100644 --- a/internal/recipe/runner.go +++ b/internal/recipe/runner.go @@ -49,6 +49,13 @@ func (r *Runner) Run() error { r.handleApplyStep(refactorJSONs) continue + // NEW: Read-only shell commands (ls, cat, tree, git status, etc.) + case strings.Contains(titleLower, "read-only") || strings.Contains(titleLower, "inspect") || + strings.Contains(titleLower, "explore") || strings.Contains(titleLower, "shell") || + strings.Contains(titleLower, "show") || strings.Contains(titleLower, "list"): + r.executeReadOnlyShell(step, previousResults) + continue + default: prompt := fmt.Sprintf(`Recipe Overview: %s