feat: ! prefix for direct shell execution#2993
Open
lanshi17 wants to merge 14 commits into
Open
Conversation
3f11952 to
d9bdcae
Compare
Commands now run in the project directory (c.cpRoot), not wherever the process started. Matches the bash tool's behavior where cmd.Dir is set to the workspace directory.
TUI: - Shell commands show first 10 lines after collapse instead of 'N lines' - Ctrl+B toggles between preview and full output for the most recent shell command - Input box border turns green and status shows 'Shell' mode tag when typing ! Desktop: - Shell tool cards auto-expand showing first 10 lines of output - 'show all N lines' button to reveal full output - Cmd+B / Ctrl+B toggles the most recent shell card - Composer caret changes to $ and border turns green in shell mode - ShellExpandProvider context coordinates global toggle hotkey
- toggleShellOutput now caps expanded output at shellExpandMaxLines (200) to prevent huge transcript entries from hanging the TUI or pushing the input box off-screen. - Added shellExpandMaxLines constant alongside shellPreviewLines. - Ensured innerW fallback when width is very small.
- Mouse left-click on the '… N more lines (click/Ctrl+B)' hint line toggles shell output expand/collapse - Hint text updated to mention click alongside Ctrl+B - ShellModeHint updated: 'click output to expand' / '点击输出展开' - Avoids tmux Ctrl+B conflict — mouse click works everywhere
Upstream changed App.ctrl to activeCtrl() for multi-tab support.
- TUI: check empty command before entering tuiRunning state, show usage notice directly instead of calling RunShell which would return without emitting TurnDone, leaving the TUI stuck in 'thinking' state. - Desktop: show notice directly for bare !, skip empty RunShell round-trip.
When Esc cancels a running shell command, the cancel may complete synchronously (the process is killed and runGuarded finishes before the TUI re-enters the event loop). In that case, ctrl.Running() is already false and the TUI can transition to idle immediately instead of waiting for a TurnDone event that may have already been consumed.
e3372e8 to
28782dc
Compare
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
RunShell()to Controller — executes shell commands directly (bypassing the AI model) and streams output as ToolDispatch/ToolProgress/ToolResult events!prefix in all three frontends: TUI Enter handler, desktophandleSend, and ControllerSubmit(HTTP/SSE)Test Plan
go test ./internal/control/— 18 tests pass (5 new shell tests)go test ./internal/i18n/— catalog drift-guard passesgo build ./cmd/reasonix/— binary builds!echo helloin TUI shows tool card with output!ls -lalists project directory!shows usage notice