Skip to content

Integrated terminal: run shells inside MandoCode Desktop - #9

Merged
DevMando merged 1 commit into
mainfrom
feature/integrated-terminal
Jul 17, 2026
Merged

Integrated terminal: run shells inside MandoCode Desktop#9
DevMando merged 1 commit into
mainfrom
feature/integrated-terminal

Conversation

@DevMando

Copy link
Copy Markdown
Owner

Summary

Adds a built-in terminal to MandoCode Desktop, so developers can run real shell commands (PowerShell, cmd, Git Bash, etc.) without leaving the app — the same way Visual Studio and VS Code let you pop open a terminal alongside your work.

Why this matters

Today, a user working with the AI agent has to alt-tab to a separate terminal window to run builds, git commands, or scripts. That context-switch is friction. Bringing the terminal into the app keeps the whole "chat with the agent → run a command → see the result" loop in one place, which is a core expectation for any serious developer tool.

What the user gets

  • Open a terminal in one click — a terminal icon at the bottom of the left sidebar, or the keyboard shortcut Ctrl+** (the same shortcut VS Code uses). **Ctrl+Shift+ opens an additional shell.
  • Slides up from the bottom, sharing the screen with the chat (the chat and input box move up to make room) — it does not cover the conversation.
  • Resize it your way — drag the top edge up or down (the cursor changes to a resize arrow on hover), or use the maximize button to expand it to nearly full height and restore it back.
  • Multiple shells, in tabs — open several terminals at once. The app automatically detects which shells are installed on the machine (PowerShell 7, Windows PowerShell, Command Prompt, Git Bash, WSL) and only offers the ones that are actually available.
  • Opens in the right folder — each new terminal starts in the project folder of whichever agent tab you're currently working in.
  • A real terminal, not a toy — colors, progress bars, and full-screen tools (like vim or interactive git) all work correctly, because it's built on the same underlying technology the Windows Terminal and VS Code use.

Scope / what's NOT in this change

  • No changes to the AI agent, chat, settings, MCP, skills, or any existing feature — this is purely additive.
  • The terminal is a manual tool for the user; the AI does not read from or type into it in this change.

Cost & risk notes (for planning)

  • No new third-party dependencies or licensing to review at the package level — the terminal rendering library is bundled directly into the app and runs fully offline, consistent with the product's offline-first design. (The bundled library, xterm.js, is the same MIT-licensed component used by VS Code.)
  • Nothing spins up until it's used — the terminal and its processes are only created the first time a user opens it, so there's no startup-time or memory cost for users who never touch it.
  • Clean teardown — all shell processes are shut down when the app closes, so nothing is left running in the background.
  • Windows-only, which is expected — this is the Windows desktop app.

How it was validated

  • Builds clean (0 warnings, 0 errors).
  • Verified end-to-end by launching the app and confirming a live PowerShell session runs inside the terminal (real shell + terminal backend processes confirmed running).
  • Exercised open, maximize, resize, and multi-second stability runs.
  • Two subtle Windows-UI startup crashes were found and fixed during development; the app now launches and runs stably.

Reviewer notes

  • ~1,550 lines added across new files (terminal panel UI, shell/session management, the terminal backend, and the bundled web assets) plus small edits to the main window to host the panel and wire the shortcut.
  • The bundled xterm.* files under Assets/web/terminal/ are the third-party library (expected to be large/minified); the reviewable app code is in Controls/, Services/, and MainWindow.*.

A sliding terminal panel with real, fully-interactive shells, embedded in
the desktop app the way Visual Studio / VS Code host terminals.

- Toggles from a bottom rail icon or Ctrl+` (Ctrl+Shift+` = new shell tab)
- Slides up from the bottom, pushing the chat + prompt up; drag the top
  edge (↕ cursor) to resize, or maximize to ~95% and restore
- Tabbed shells, auto-detecting what's installed (PowerShell 7, Windows
  PowerShell, cmd, Git Bash, WSL); each opens in the active agent's folder
- Real terminal fidelity via Windows ConPTY + xterm.js in a WebView2:
  colors, cursor movement, and interactive TUIs (vim, git, progress bars)

Implementation notes:
- Zero new NuGet dependencies. ConPTY is hand-written P/Invoke
  (Services/PseudoConsole.cs); xterm.js is bundled locally under
  Assets/web/terminal and served offline via the existing virtual-host
  mapping, matching the app's offline-first design.
- The panel (and its WebView2/shells) is created lazily on first open, and
  every shell is torn down on window close so no ConPTY processes leak.
- Ctrl+` is handled in Root_KeyDown, not a KeyboardAccelerator, and the
  splitter cursor is set on Loaded, not in a ctor: both avoid a native
  WinUI fast-fail (STATUS_STOWED_EXCEPTION) on OEM keys / early ProtectedCursor.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DevMando
DevMando merged commit 7f78b61 into main Jul 17, 2026
1 check passed
@DevMando
DevMando deleted the feature/integrated-terminal branch July 17, 2026 22:48
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