|
1 | | -shell Mode (CLI TUI) |
2 | | - |
3 | | -Overview |
4 | | - |
5 | | -- shell mode lets users run shell commands directly from the chat input by starting their input with an exclamation mark (!). |
6 | | -- It is intended for quick terminal command execution without leaving the TUI. |
7 | | - |
8 | | -Activation |
9 | | - |
10 | | -- shell mode is activated when the current input (trimmed) starts with ! |
11 | | - - Example: "!git status" or " !ls -la" both activate shell mode. |
12 | | -- Visual indicator: |
13 | | - - Input border color changes to yellow. |
14 | | - - The input prompt indicator changes to a yellow "$". |
15 | | - - The input placeholder includes "! for shell mode". |
16 | | - |
17 | | -Deactivation / Exiting shell Mode |
18 | | - |
19 | | -- Pressing Enter to submit the input exits shell mode immediately after submission, regardless of the command result. |
20 | | -- Pressing Esc when the input (trimmed) is exactly ! clears the input and exits shell mode. |
21 | | -- Editing the input so it no longer starts with ! also exits shell mode and restores normal input behavior. |
22 | | - |
23 | | -Interaction with other input helpers |
24 | | - |
25 | | -- When in shell mode (input starts with !): |
26 | | - - "@" file search suggestions are disabled. |
27 | | - - "/" slash command UI is disabled. |
28 | | -- When in slash command mode (input starts with /): |
29 | | - - "@" file search suggestions are disabled. |
30 | | - |
31 | | -Submission behavior |
32 | | - |
33 | | -- On submit (Enter) with a shell-mode input: |
34 | | - - The leading ! is removed and the remainder is treated as the shell command to run. |
35 | | - - The TUI immediately appends an assistant message representing a shell tool call, with status set to calling, so users can see that the command is in progress. |
36 | | - - The shell command is executed asynchronously; when it completes, the tool call status is updated to done (or error) and the output is populated. |
37 | | - |
38 | | -Execution semantics |
39 | | - |
40 | | -- The command is executed in the same way as terminal tool commands, minus permissions |
41 | | - |
42 | | -Output handling |
43 | | - |
44 | | -- Stdout is streamed into memory; Stderr is captured and appended as a trailing "Stderr: ..." section on success. |
45 | | -- If the process exits non-zero and Stderr contains content, the tool call is marked as error and the error text is shown. |
46 | | -- Output is truncated to the first 5000 lines if exceeded. |
47 | | -- Timeout behavior: If no output is received for 30 seconds (configurable in tests), the process is terminated and the result includes a note like: |
48 | | - "[Command timed out after 30 seconds of no output]". |
49 | | - |
50 | | -Keyboard behaviors (summary) |
51 | | - |
52 | | -- Enter: submit input. If in shell mode, exits shell mode after submission and shows the pending shell tool call immediately. |
53 | | -- Shift+Enter: new line. |
54 | | -- Backslash (\) at end-of-line: inserts a new line (line continuation) as usual. |
55 | | -- Esc: if only ! (trimmed) is present, clears input and exits shell mode; otherwise cancels streaming or closes suggestions depending on context. |
56 | | - |
57 | | -Scope / Modes |
58 | | - |
59 | | -- shell mode applies to interactive (TUI/standard) CLI usage. It is not part of headless (-p/--print) processing. |
60 | | - |
61 | | -Error handling |
62 | | - |
63 | | -- Command execution errors are captured and surfaced in the tool call as status error with human-readable error text (including Stderr when available). |
64 | | - |
65 | | -Examples |
66 | | - |
67 | | -- "!git status" → shows a shell tool call immediately, then populates with the git status output. |
68 | | -- "!echo hello" → shows a shell tool call immediately, then output "hello". |
69 | | -- "!some-unknown-cmd" → shows a shell tool call immediately, then sets status to error with an error message. |
70 | | - Shell Mode (CLI TUI) |
| 1 | +Shell Mode (CLI TUI) |
71 | 2 |
|
72 | 3 | Overview |
73 | 4 |
|
|
0 commit comments