Skip to content

refactor(config): introduce CommandConfig and shlex-based parsing#664

Merged
JeanMertz merged 8 commits into
mainfrom
prr231
May 20, 2026
Merged

refactor(config): introduce CommandConfig and shlex-based parsing#664
JeanMertz merged 8 commits into
mainfrom
prr231

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

Extract a generic CommandConfig / CommandConfigOrString type under jp_config::types::command, replacing the tool-scoped ToolCommandConfig. The new type lives at the config-types layer so it can be shared by tools, labels, and any other consumer that needs to model an external command.

String shorthands now use shell-word semantics via shlex instead of split_ascii_whitespace. This means quoting is respected at config-parse time, so command = "nvim -c 'set ft=md'" correctly passes two arguments (-c and set ft=md) rather than three. Inputs with unbalanced quotes are rejected at parse time rather than producing garbage at spawn time.

The same shlex-based splitting is applied to EditorConfig::command and EditorConfig::path when reading editor env-vars (JP_EDITOR, VISUAL, EDITOR). Previously only the first whitespace-separated token was used; now JP_EDITOR="code --wait" correctly invokes code with --wait as an argument. Env-var values with unbalanced quoting are skipped and the next variable in the list is tried instead.

JeanMertz added 8 commits May 20, 2026 16:04
Extract a generic `CommandConfig` / `CommandConfigOrString` type under
`jp_config::types::command`, replacing the tool-scoped
`ToolCommandConfig`. The new type lives at the config-types layer so it
can be shared by tools, labels, and any other consumer that needs to
model an external command.

String shorthands now use shell-word semantics via `shlex` instead of
`split_ascii_whitespace`. This means quoting is respected at
config-parse time, so `command = "nvim -c 'set ft=md'"` correctly passes
two arguments (`-c` and `set ft=md`) rather than three. Inputs with
unbalanced quotes are rejected at parse time rather than producing
garbage at spawn time.

The same `shlex`-based splitting is applied to `EditorConfig::command`
and `EditorConfig::path` when reading editor env-vars (`JP_EDITOR`,
`VISUAL`, `EDITOR`). Previously only the first whitespace-separated
token was used; now `JP_EDITOR="code --wait"` correctly invokes `code`
with `--wait` as an argument. Env-var values with unbalanced quoting are
skipped and the next variable in the list is tried instead.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…parsing

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 2b92a88 into main May 20, 2026
14 checks passed
@JeanMertz JeanMertz deleted the prr231 branch May 20, 2026 14:53
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