Skip to content

fix(config, cli): Render shell commands correctly in user output - #1210

Merged
JeanMertz merged 2 commits into
mainfrom
jp-q
Oct 6, 2026
Merged

JeanMertz merged 2 commits into
mainfrom
jp-q

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

A command configured with shell = true rendered with a newline in the middle of it and a quote on the wrong side of the space, so the label confirmation prompt broke across two lines and showed /bin/sh -c' before the command itself. It now reads sh -c 'git rev-parse --show-toplevel', and arguments are shell-quoted so a multi-word argument stays one token instead of looking like two. Every message that names a command picks this up: label prompts and failures, tool spawn errors, and custom parameter formatter errors.

JP also logs an INFO line naming the editor it is about to open, so a trace shows which program was handed the terminal:

{"message":"Opening configured editor.","editor":"nvim"}

Without it, an editor that exits without touching the draft is indistinguishable from a user who saved an empty file. A conversation carrying editor.cmd = "true" from a non-interactive run drops every query as empty and says nothing about why.

CommandConfig splits the two jobs its Display was serving. shell_command_line returns the string passed to sh -c, and is what the editor, tool, and label executors call; Display is the readable form, distinct enough now that spawning through it would fail visibly rather than work by accident until the two drifted apart.

A command configured with `shell = true` rendered with a newline in the
middle of it and a quote on the wrong side of the space, so the label
confirmation prompt broke across two lines and showed `/bin/sh -c'`
before the command itself. It now reads `sh -c 'git rev-parse
--show-toplevel'`, and arguments are shell-quoted so a multi-word
argument stays one token instead of looking like two. Every message that
names a command picks this up: label prompts and failures, tool spawn
errors, and custom parameter formatter errors.

JP also logs an INFO line naming the editor it is about to open, so a
trace shows which program was handed the terminal:

```json
{"message":"Opening configured editor.","editor":"nvim"}
```

Without it, an editor that exits without touching the draft is
indistinguishable from a user who saved an empty file. A conversation
carrying `editor.cmd = "true"` from a non-interactive run drops every
query as empty and says nothing about why.

`CommandConfig` splits the two jobs its `Display` was serving.
`shell_command_line` returns the string passed to `sh -c`, and is what
the editor, tool, and label executors call; `Display` is the readable
form, distinct enough now that spawning through it would fail visibly
rather than work by accident until the two drifted apart.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz
JeanMertz merged commit a8b46b6 into main Oct 6, 2026
22 checks passed
@JeanMertz
JeanMertz deleted the jp-q branch October 6, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant