Plugin: trim shell launcher wrappers from command approvals#33
Open
huntharo wants to merge 1 commit intopwrdrvr:mainfrom
Open
Plugin: trim shell launcher wrappers from command approvals#33huntharo wants to merge 1 commit intopwrdrvr:mainfrom
huntharo wants to merge 1 commit intopwrdrvr:mainfrom
Conversation
Strips /bin/zsh -lc '...', bash -lc '...', and similar wrappers from the Command block in approval prompts. Matches upstream Codex Desktop behavior (strip_bash_lc_and_escape in codex-rs/tui/src/exec_command.rs). The raw command is preserved for approval transport; only the display is simplified. Adds stripShellLauncher() helper to pending-input.ts with test coverage for all common launcher variants. Fixes pwrdrvr#9
mvanhorn
reviewed
Mar 22, 2026
mvanhorn
left a comment
There was a problem hiding this comment.
Summary
The regex handles the common launcher patterns correctly - greedy [\s\S]* with backreference matches the outermost quotes, and the fallback returns the raw command unchanged. Good call preserving the raw command for approval transport and only simplifying the display.
Recommendation
Looks good to merge.
Review assisted by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strips
/bin/zsh -lc '...',bash -lc '...', and similar shell launcher wrappers from the Command block in approval prompts, matching the display behavior of Codex Desktop and CLI.Why this matters
Command approval prompts currently show the full shell invocation:
The shell launcher is an implementation detail — users shouldn't need to read past it to understand what Codex is about to run. The expected display is:
This matches upstream behavior documented in #9, which identifies
strip_bash_lc_and_escape()incodex-rs/tui/src/exec_command.rsas the reference implementation.Changes
stripShellLauncher(command: string): stringtosrc/pending-input.ts. Detects the pattern[/path/]shell -lc '...'using a single regex coveringbash,zsh,sh,dash,ksh,tcsh, andfishwith or without an absolute path prefix. Falls back to the raw command if no match.stripShellLauncher()inbuildPendingPromptText()(src/pending-input.ts:703) before passing tobuildMarkdownCodeBlock. The raw command is unchanged for approval transport — only the display is simplified.stripShellLauncherso it can be tested directly.Testing
Added 7 test cases to
src/pending-input.test.tscovering:/bin/zsh -lc '...'/bin/bash -lc '...'bash -lc '...'zsh -lc '...'with double-quoted inner content/usr/bin/zsh -lc '...'git status,npm install)All 122 tests pass (
pnpm typecheck+pnpm test).Fixes #9
This contribution was developed with AI assistance (Claude Code).