Skip to content

Plugin: trim shell launcher wrappers from command approvals #9

@huntharo

Description

@huntharo

Problem

Command approval prompts in Telegram/Discord currently show the full shell launcher wrapper, for example:

/bin/zsh -lc 'git add README.md && git commit -m "docs: simplify README opening"'

That is noisier than Codex Desktop and the CLI, which appear to show only the command payload that matters.

Expected behavior

For command approvals that are just a shell wrapper around a payload, chat clients should show a compact display form such as:

git add README.md && git commit -m "docs: simplify README opening"

Current plugin behavior

The plugin currently renders the first string it finds under command-like keys and prints it verbatim in the approval prompt.

Relevant code:

  • src/pending-input.ts
    • buildPendingPromptText() looks for command, cmd, displayCommand, rawCommand, and shellCommand
    • whatever string is found is rendered directly in the Command: fenced block
  • There does not appear to be a normalization or pretty-print step for shell launchers such as /bin/zsh -lc, /bin/bash -lc, or similar wrapper forms.

Likely direction

  • Prefer a cleaner upstream-provided display field if one exists in the approval payload.
  • Otherwise add a local formatter that detects common shell launcher wrappers and unwraps the inner command safely for display.
  • Keep the raw command available internally for approval response handling and logging; only the user-facing prompt should be simplified.

Repro

Trigger a command approval for something like:

/bin/zsh -lc 'git add README.md && git commit -m "docs: simplify README opening"'

Observe that Telegram/Discord shows the full wrapper instead of the simplified command body.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions