Repository navigation
feat(tui): syntax-highlight bash commands in permission prompt - #51851
Closed
OmentaElvis wants to merge 1 commit into
Closed
OmentaElvis wants to merge 1 commit into
OmentaElvis wants to merge 1 commit into
Conversation
- Render bash permission commands with <code filetype="bash"> and a separate muted `$` prefix to avoid tree-sitter parsing the bare `$`. - Add `generateCommandSyntax()` to theme layer, which remaps `function.call` to `syntaxFunction` + bold for shell context only, leaving global syntax rules unchanged. - Wire `commandSyntax` memo through theme context and use it in the permission prompt. - Add unit test asserting the shell-specific override preserves arguments and distinguishes the command name. This improves auditability of shell permission requests (e.g. `rm -f ...` is immediately distinguishable from its arguments) without affecting highlighting for other languages.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
This was referenced Oct 12, 2026
1 task done
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.
Issue for this PR
Closes #
Type of change
What does this PR do?
Adds syntax highlighting to shell commands in the TUI permission prompt. Previously, the full command was rendered as a single flat line of plain text, making it harder to quickly distinguish dangerous verbs (like
rm,curl, orsudo) from their arguments at a glance.The change renders bash commands with
<code filetype="bash">and uses a separate muted$prefix to avoid having tree-sitter parse the bare$. A scopedgenerateCommandSyntax()override remapsfunction.call(the command name) tosyntaxFunctionand bolds it for shell context only. Arguments and other tokens remain unchanged relative to the existing theme. This keeps the global syntax table untouched so highlighting for other languages is unaffected.The result is a small visual anchor: the verb pops while flags, paths, pipes, and operators remain in their existing theme colors. This makes it faster to scan a permission request and decide whether a command needs closer scrutiny.
How did you verify your code works?
bun test test/theme.test.tsinpackages/tui(9/9 passing, 20 assertions). The new test verifiesfunction.callis bolded and mapped tosyntaxFunctionin the shell-specific syntax, whilevariable.parameter(arguments) stays onsyntaxVariableand the base syntax remains unchanged.bun typecheckinpackages/tuipasses (tsgo --noEmit).bunx prettier --checkon the modified files passes.bun test --only-failuresinpackages/tuistill passes with no new failures.ls, pipes,&&, here-doc style constructs, andrm -f) shows the command name is visually distinct from its arguments. Screenshots comparing before (unhighlighted) and after (highlighted across multiple themes) are included.Screenshots / recordings
See attached comparison: one "before" screenshot (no highlighting) and multiple "after" screenshots showing shell commands highlighted across different themes. The highlighted versions make the command verb easier to spot at a glance, which helps with quick auditing of permission requests.
before:

after across various theme samples:






Checklist