Skip to content

add interactive plan review to --plan mode #113

@umputun

Description

@umputun

currently ralphex --plan presents three options after generating a plan draft: Accept, Revise, Reject. the "Revise" option asks for text feedback, which works but is limiting - you have to describe what to change instead of just editing the plan directly.

the idea: add a 4th option "Interactive review" that opens $EDITOR with the plan draft in a temp file. user edits directly, and on save+close ralphex computes a unified diff and feeds it back as revision feedback. closing without changes re-shows the menu. this gives a proper editing experience without requiring any specific terminal emulator.

why this matters:

  • text-based revision feedback is imprecise ("add more details to task 3" vs just writing the details)
  • direct editing is faster and more natural for plan refinement
  • works everywhere $EDITOR works - no kitty/tmux/terminal-specific hacks needed since ralphex --plan owns its own terminal

approach:

  • contained in pkg/input only - the runner does not care about feedback format, it just passes the string through
  • editor lookup: $VISUAL then $EDITOR then vi (matches git convention)
  • diff via go-difflib (already vendored through testify)
  • editorFunc field on TerminalCollector for testability (same pattern as existing stdin/stdout fields)
  • also fix bufio.Reader reuse - current AskDraftReview creates separate readers which will lose buffered data when wrapped in a loop

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions