Skip to content

feat: add bang mode for direct shell command execution#3013

Merged
taciturnaxolotl merged 10 commits into
charmbracelet:mainfrom
taigrr:feat/bang-mode
Jun 19, 2026
Merged

feat: add bang mode for direct shell command execution#3013
taciturnaxolotl merged 10 commits into
charmbracelet:mainfrom
taigrr:feat/bang-mode

Conversation

@taigrr

@taigrr taigrr commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds ! prefix support for running shell commands directly without triggering the LLM
  • Command + output persisted as a user message so the LLM has context on follow-up prompts
  • Full client-server implementation: backend runs the command in the workspace directory, result flows through the existing message pubsub to the UI

Test plan

  • Type !ls in the input — should display directory listing without LLM response
  • Type !echo hello — output appears as user message in chat
  • Follow up with a normal prompt — LLM should see the previous shell output as context
  • Test with non-zero exit code (!false) — should not error, just show empty output

Closes: #2430

@meowgorithm

Copy link
Copy Markdown
Member

Awesome. Are we pulling in the user's environment variables when invoking a shell (similar to what we do with the bash tool)? If not, I imagine we should.

@taigrr

taigrr commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

yes happens by default since the process is a child process

Comment thread internal/workspace/app_workspace.go Outdated
@meowgorithm

Copy link
Copy Markdown
Member

Small note that this will need a patch on non-client-server-mode. Otherwise working pretty nicely.

Comment thread internal/shell/run.go Fixed
@taciturnaxolotl taciturnaxolotl force-pushed the feat/bang-mode branch 6 times, most recently from 368e118 to 43a3eae Compare June 10, 2026 20:49
@taciturnaxolotl taciturnaxolotl force-pushed the feat/bang-mode branch 2 times, most recently from 9de5353 to 4ee60f4 Compare June 17, 2026 14:53
taigrr and others added 2 commits June 18, 2026 09:22
Prefix any input with ! to run it as a shell command without triggering
the LLM. The command and output are persisted as a user message so the
LLM has context on follow-up prompts.
@taciturnaxolotl taciturnaxolotl force-pushed the feat/bang-mode branch 2 times, most recently from 34b6cfa to f6dbee6 Compare June 18, 2026 14:03
@taciturnaxolotl taciturnaxolotl force-pushed the feat/bang-mode branch 3 times, most recently from 11c1cb5 to bf32eb9 Compare June 18, 2026 22:39
@taciturnaxolotl taciturnaxolotl enabled auto-merge (squash) June 19, 2026 01:58
@taciturnaxolotl taciturnaxolotl merged commit 99a5fad into charmbracelet:main Jun 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

! for shell commands (bang mode)

7 participants