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".
This commit is contained in:
parent
66d52917c0
commit
3d9d1cd722
@ -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:**
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user