Repository navigation
Enhancement: show each chained command on its own line in approvals - #5225
Open
stefanroex wants to merge 2 commits into
Open
stefanroex wants to merge 2 commits into
stefanroex wants to merge 2 commits into
Conversation
Agents often write a sequence of shell commands as one long line, chained with &&, || and pipes. That is hard to read, especially when you have to approve it. formatShellCommandForDisplay puts each chained command of a long one-liner on its own line, and only splits a pipeline when its line is still too long. It only adds line breaks after operators at the top level of the command, never inside quotes, substitutions, subshells or if/for blocks. The result is still valid shell and shows exactly what will run. A command that already spans several lines, or that contains something it does not fully understand (such as a case statement or an unbalanced quote), is returned unchanged.
A long one-liner in the approval card now shows each chained command on its own line, so you can see what an agent wants to run before you approve it, instead of scrolling along one long line. The card keeps its compact four-line preview: a long chain shows its first four lines with a "Show N more lines" control, just like a multi-line script.
This branch has not been deployed
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.
Human comments
What was wrong
Agents often chain several commands into one line with
&&,|and;. The approval card shows that as a single line, and some get so long that it's hard to grasp what you're actually approving.What changed
formatShellCommandForDisplayin@bb/thread-view. Commands over 80 characters get a new line after each top-level&&,||and;, and after pipes only if the line is still too long. It never breaks inside quotes, substitutions, subshells orif/forblocks, and returns anything it can't parse unchanged.No wire, CLI or SDK changes. The timeline is unchanged.
How you verified
pnpm exec turbo run typecheck lint test --filter=@bb/app --filter=@bb/thread-viewpasses.