feat: add /edit command to cli for on-demand prompt editing#8566
Conversation
Add a /edit slash command that opens a configured editor for composing prompts on demand, with optional prefill text support. - Add /edit [text] command to open editor with optional prefill - Add resolve_editor_command() with GOOSE_PROMPT_EDITOR, $VISUAL, $EDITOR fallback - Add goose_prompt_editor_always config (default false) for always-on mode - Always-on mode restricts to explicit goose_prompt_editor config only - Extract build_template() to deduplicate template construction - Save history before editor launch for crash safety - Use output::render_error() and CMD_* constants for consistency Preserve backward compatibility: users with GOOSE_PROMPT_EDITOR configured expect the editor on every prompt. The new GOOSE_PROMPT_EDITOR_ALWAYS flag defaults to true when GOOSE_PROMPT_EDITOR is set, allowing users to opt-in to the new behavior. Signed-off-by: Adam Miller <admiller@redhat.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 341f9a151b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if editor_always { | ||
| if let Ok(Some(editor_cmd)) = config.get_goose_prompt_editor() { | ||
| if !editor_cmd.is_empty() { |
There was a problem hiding this comment.
Honor editor-always mode with env fallback
When goose_prompt_editor_always is true, this branch still requires get_goose_prompt_editor() to be set before opening an editor, so users who rely on $VISUAL/$EDITOR never enter editor mode and silently fall back to inline input. That makes the new always-on flag ineffective for env-only editor setups, even though /edit supports those fallbacks via resolve_editor_command().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That is intended as it preserves the existing behavior for backwards compatibility.
* main: (37 commits) polish: refine sidebar activity indicators, add placeholder token, and tidy search field (#8606) feat: add /edit command to cli for on-demand prompt editing (#8566) docs(mcp): add Rendex MCP Server extension tutorial (#8541) Lifei/delete tauri backend acp (#8582) chore: set goose binaries as executable in package.json (#8589) feat: add Novita AI as declarative provider (#8432) feat: add Kimi Code provider with OAuth device flow authentication (#8466) fix: chat loading-state model placeholder (#8431) fix: expand tool calls by default when Response Style is Detailed (#8478) fix: create logs dir before writing llm request log (#8522) fix: enable token usage tracking and configurable stream timeout for Ollama provider (#8493) fix tauri-plugin-dialog version constraint to match other plugins (#8542) call goose serve from tauri frontend via goose-acp client (#8549) failed the script when bundle:default fails and cleanup "alpha" (#8580) pass globally unique conversation identifier as sessionId in databricks api call (#8576) fix: use sqlx chrono decode for thread timestamps instead of manual parsing (#8575) docs: remove stale gemini-acp references (#8572) show individual untracked files in git changes widget (#8574) fix: update publishing flow to include new sdk dir (#8573) fix: remove double border on content in chat (#8545) ...
Summary
Add a /edit slash command that opens a configured editor for composing prompts on demand, with optional prefill text support.
Preserve backward compatibility: users with GOOSE_PROMPT_EDITOR configured expect the editor on every prompt. The new GOOSE_PROMPT_EDITOR_ALWAYS flag defaults to true when GOOSE_PROMPT_EDITOR is set, allowing users to opt-in to the new behavior.
Testing
I've tested locally with:
Everything behaved as expected.
Also added new unit tests that cover the new feature / code changes.
Screenshots/Demos (for UX changes)
Asciinema demo recording: https://asciinema.org/a/MI64j2tqmkzUyvhJ