Skip to content

feat(terminal): inline shell mode ($, $$)#68

Merged
jom-sq merged 1 commit intomainfrom
jom/feature-shell-mode-editor-prompt
Feb 23, 2026
Merged

feat(terminal): inline shell mode ($, $$)#68
jom-sq merged 1 commit intomainfrom
jom/feature-shell-mode-editor-prompt

Conversation

@jom-sq
Copy link
Copy Markdown
Collaborator

@jom-sq jom-sq commented Feb 23, 2026

Summary

Implements PR 5 from the Amp CLI feature parity plan.

Inline Shell Mode ($ / $$)

The Amp CLI supports $ prefix in the chat input to run shell commands with output added to agent context, and $$ for "incognito" mode where output is shown but NOT added to context. Our app previously only had a full PTY terminal via Ctrl+T.

How it works:

  • Type $ ls -la → runs in thread workspace, shows output inline in chat
  • Type $$ git status → runs incognito (output dimmed, not in agent context)
  • Commands execute via the existing WebSocket connection with a 30s timeout and 1MB output buffer
  • Shell results render with monospace styling, exit code badges, and incognito indicators
  • A visual indicator appears in the input area while typing a $/$$ prefix, explaining the mode

Editor Prompt (removed)

The Ctrl+G / $EDITOR prompt feature was planned but removed after multiple attempts (Ctrl+G, Ctrl+E, Alt+E) all conflicted with browser or macOS default shortcuts. This is a limitation of the web environment vs the native CLI.

Changes

File Change
shared/websocket.ts Added shell_exec client and shell_result server message types
shared/validation.ts Runtime validation for shell_exec messages
shared/validation.test.ts Tests for shell_exec validation
server/websocket.ts Shell command execution handler (30s timeout, 1MB buffer)
src/utils/parseMarkdown.ts Extended Message type with shell result fields
src/components/terminal/useTerminalWebSocket.ts sendShellExec() + shell_result handler
src/components/terminal/Terminal.tsx $/$$ prefix detection in handleSendMessage
src/components/terminal/TerminalInput.tsx Shell mode visual indicator
src/components/terminal/TerminalMessages.tsx Shell result rendering component
src/styles/terminal.css Shell result styles (monospace, exit code badges, dimmed incognito)

Testing

  • pnpm check passes (format, lint, typecheck, build)
  • pnpm test passes (227 tests)
  • Manual: $ ls -la runs and shows output inline
  • Manual: $$ git status runs incognito (dimmed output)

@jom-sq jom-sq force-pushed the jom/feature-shell-mode-editor-prompt branch 2 times, most recently from d99d34d to 7a98e49 Compare February 23, 2026 20:41
@jom-sq jom-sq marked this pull request as ready for review February 23, 2026 20:47
@jom-sq jom-sq changed the title feat(terminal): inline shell mode ($, $$) and Ctrl+G editor prompt feat(terminal): inline shell mode ($, $$) Feb 23, 2026
Add shell command execution directly from the chat input:
- $ prefix: runs command, output added to agent context
- $$ prefix: runs command in incognito mode (output not in context)

Implementation:
- WebSocket protocol: new shell_exec (client) and shell_result (server) message types
- Server: spawns commands in thread workspace with 30s timeout, 1MB buffer
- UI: monospace output rendering with exit code badges and incognito indicators
- Visual indicator in input area showing mode explanation while typing
- Runtime validation for new message types with tests

Co-authored-by: Amp <amp@ampcode.com>
@jom-sq jom-sq force-pushed the jom/feature-shell-mode-editor-prompt branch from 9cd6ee4 to d85a3a8 Compare February 23, 2026 21:04
@jom-sq jom-sq merged commit e40d1ee into main Feb 23, 2026
4 checks passed
@jom-sq jom-sq deleted the jom/feature-shell-mode-editor-prompt branch February 23, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant