From 3d9d1cd7225e361ab6a6f278d6d76215e3ba56fd Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 7 Mar 2026 18:58:40 +0000 Subject: [PATCH] feat(recipe): add project exploration step with read-only shell support - Introduce new Step 1 in result-refactor.md for exploring project structure using safe read-only shell commands (e.g., tree, cat). - Rename subsequent steps accordingly. - Add handler in runner.go for read-only shell steps triggered by keywords like "explore" or "inspect". --- .grokkit/recipes/result-refactor.md | 11 ++++++++--- internal/recipe/runner.go | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) 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