splashshell 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,34 +1,21 @@
1
- # splashshell
1
+ # SplashShell
2
2
 
3
3
  <div align="center">
4
4
  <img src="https://github.com/user-attachments/assets/1343f694-1c05-4899-9faa-d2b1138aa3ba" alt="social-image" width="640" />
5
5
  </div>
6
6
 
7
- A universal MCP server that exposes any shell (bash, pwsh, powershell, cmd) as a Model Context Protocol server, so AI assistants can run real commands in a real terminal — visible to you, with session state that persists across calls.
8
-
9
- - **Real terminal, real output.** Commands run in a visible ConPTY-backed console. You see every character the AI types, just as if you typed it yourself.
10
- - **Multiple shells side by side.** bash, pwsh, cmd, and others can all be active at the same time. Switch between them per command.
11
- - **Session state persists.** `cd`, environment variables, and shell history carry across calls — it's one continuous shell, not isolated subprocess spawns.
12
- - **Shell integration built in.** OSC 633 markers delimit command boundaries cleanly, so output parsing is reliable even for interleaved prompts and long-running commands.
13
- - **Console re-claim.** Consoles outlive their parent MCP process. When the AI client restarts, the next session reattaches to existing consoles.
14
- - **Auto cwd handoff.** When a same-shell console is busy, a new one is auto-started in the source console's directory and your command runs immediately — no manual `cd` needed.
15
- - **Sub-agent isolation.** Allocate per-agent consoles with `is_subagent` + `agent_id` so parallel agents don't clobber each other's shells.
16
-
17
- > **Architecture diagram**: see the [GitHub README](https://github.com/yotsuda/splashshell#architecture) for a mermaid diagram of the proxy/worker/console layout.
7
+ **A shell MCP server for AI that actually holds a session.** Load `Import-Module Az` once and let AI run 50 follow-up cmdlets in milliseconds each. Watch every command happen in a real terminal window — the same one you can type into yourself.
18
8
 
19
9
  ## Install
20
10
 
21
- No global install is required — `npx` fetches and runs splashshell on demand. The only prerequisite is the [.NET 9 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/9.0) (the package bundles a ~5.6 MB native `splash.exe` that needs it).
22
-
23
- > The `@latest` tag is important: without it, npx will happily keep reusing a stale cached copy even after a new version ships.
24
-
25
- ### Claude Code
11
+ Prerequisite: [.NET 9 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/9.0). No global install needed — `npx` fetches a ~5 MB native binary on first run.
26
12
 
27
13
  ```bash
28
14
  claude mcp add-json splash -s user '{"command":"npx","args":["-y","splashshell@latest"]}'
29
15
  ```
30
16
 
31
- ### Claude Desktop
17
+ <details>
18
+ <summary>Claude Desktop</summary>
32
19
 
33
20
  Add to `%APPDATA%\Claude\claude_desktop_config.json`:
34
21
 
@@ -43,75 +30,78 @@ Add to `%APPDATA%\Claude\claude_desktop_config.json`:
43
30
  }
44
31
  ```
45
32
 
46
- ### Build from source (for development)
33
+ The `@latest` tag is important: without it, npx will happily keep reusing a stale cached copy even after a new version ships.
47
34
 
48
- ```bash
49
- git clone https://github.com/yotsuda/splashshell.git
50
- cd splashshell
51
- dotnet publish -c Release -r win-x64 --no-self-contained -o ./dist
52
- ```
35
+ </details>
53
36
 
54
- The binary is `./dist/splash.exe`. Use the absolute path instead of the `npx` command in your MCP config.
37
+ ## Why SplashShell?
55
38
 
56
- ## Tools
39
+ Other shell MCP servers are either **stateless** (fresh subshell per command, nothing persists) or **headless** (persistent PTY, but invisible to you). SplashShell is neither — and that unlocks things the others can't do.
57
40
 
58
- ### Shell tools
41
+ ### PowerShell becomes a first-class AI environment
59
42
 
60
- | Tool | Description |
61
- |------|-------------|
62
- | `start_console` | Open a visible terminal window. Pick a shell (bash, pwsh, powershell, cmd, or a full path). Optional `cwd`, `banner`, and `reason` parameters. Reuses an existing standby of the same shell unless `reason` is provided. |
63
- | `execute_command` | Run a pipeline. Optionally specify `shell` to target a specific shell type — finds an existing console of that shell, or auto-starts one. Times out cleanly with output cached for `wait_for_completion`. |
64
- | `wait_for_completion` | Block until busy consoles finish and retrieve cached output (use after a command times out). |
43
+ Session persistence helps every shell, but for **PowerShell it's transformative**. Most MCP shell servers spin up a fresh subshell per command — which makes real PowerShell workflows impractical:
65
44
 
66
- Status lines include the console name, shell family, exit code, duration, and current directory:
45
+ - **10,000+ modules on [PowerShell Gallery](https://www.powershellgallery.com/).** Az (Azure), AWS.Tools, Microsoft.Graph (Entra ID / M365), ExchangeOnlineManagement, PnP.PowerShell, SqlServer, ActiveDirectory — plus every CLI in PATH (git, docker, kubectl, terraform, gh, az, aws, gcloud) and full access to .NET types.
46
+ - **30–70 second cold imports, paid once.** `Import-Module Az.Compute, Az.Storage, Az.Network` can take over a minute on the first call. A subshell-per-command MCP server pays that cost on *every* command and the AI gives up on Azure workflows entirely. With SplashShell, the AI imports once and every subsequent cmdlet runs in milliseconds.
47
+ - **Live .NET object graphs.** PowerShell pipes rich objects, not text. After `$vms = Get-AzVM -Status`, the AI can chain arbitrary follow-ups against the live object — filter, group, drill into nested properties — without re-hitting Azure. In a one-shot MCP server, that object vanishes the moment the command returns.
48
+ - **Interactive build-up of complex work.** Set a variable, inspect it, reshape it, feed it back into the next cmdlet. Build a multi-step workflow one command at a time with every previous step's result still in scope.
67
49
 
68
- ```
69
- ✓ #12345 Sapphire (bash) | Status: Completed | Pipeline: ls /tmp | Duration: 0.6s | Location: /tmp
50
+ ```powershell
51
+ # Command 1 — cold import, paid once for the whole session
52
+ Import-Module Az.Compute, Az.Storage
53
+
54
+ # Command 2 — instant; capture into a variable
55
+ $vms = Get-AzVM -Status
56
+
57
+ # Command 3 — instant; same session, $vms still in scope
58
+ $vms | Where-Object PowerState -eq "VM running" |
59
+ Group-Object Location | Sort-Object Count -Descending
70
60
  ```
71
61
 
72
- Each MCP tool call also drains:
62
+ PowerShell on SplashShell is the difference between **"AI can answer one-off questions"** and **"AI can do real infrastructure work."** bash and cmd are fully supported too, but pwsh is where SplashShell shines.
73
63
 
74
- - **Cached results** from any console whose timed-out command has since finished
75
- - **Closed console notifications** when a console window has been closed since the last call
64
+ ### Full transparency, in both directions
76
65
 
77
- ### File tools
66
+ SplashShell opens a **real, visible terminal window**. You see every AI command as it runs — same characters, same output, same prompt — and you can type into the same window yourself at any time. When a command hangs on an interactive prompt, stalls in watch mode, or just needs a Ctrl+C, the AI can read what's currently on the screen and send keystrokes (Enter, y/n, arrow keys, Ctrl+C) back to the running command — diagnosing and responding without human intervention.
78
67
 
79
- Claude Code–compatible file primitives, useful when the MCP client doesn't already provide them.
68
+ ## Tools
80
69
 
81
70
  | Tool | Description |
82
71
  |------|-------------|
83
- | `read_file` | Read a file with line numbers. Supports `offset` / `limit` for paging through large files. Detects binary files. |
84
- | `write_file` | Create or overwrite a file. Creates parent directories as needed. |
85
- | `edit_file` | Replace an exact string in a file. Old string must be unique by default; pass `replace_all` to replace every occurrence. |
86
- | `search_files` | Search file contents with a regular expression. Returns matching lines with file paths and line numbers. Supports `glob` filtering. |
87
- | `find_files` | Find files by glob pattern (e.g., `**/*.cs`). Returns matching paths. |
72
+ | `start_console` | Open a visible terminal. Pick a shell (bash, pwsh, powershell, cmd). Reuses an existing standby of the same shell unless `reason` is provided. |
73
+ | `execute_command` | Run a pipeline. Optionally target a specific `shell`. Times out cleanly with output cached for `wait_for_completion`; timeout responses include a `partialOutput` snapshot for immediate diagnosis. |
74
+ | `wait_for_completion` | Block until busy consoles finish and retrieve cached output. |
75
+ | `peek_console` | Read-only snapshot of what a console is displaying. Windows reads the screen buffer directly; Linux/macOS uses a VT interpreter. Reports busy/idle state, running command, and elapsed time. |
76
+ | `send_input` | Send raw keystrokes to a **busy** console's PTY input. `\r` for Enter, `\x03` for Ctrl+C, `\x1b[A` for arrow up, etc. Max 256 chars. |
77
+
78
+ Plus Claude Code–compatible file primitives: `read_file`, `write_file`, `edit_file`, `search_files`, `find_files`.
88
79
 
89
- ## Multi-shell behavior
80
+ Status lines include console name, shell family, exit code, duration, and cwd:
90
81
 
91
- splashshell tracks the cwd of every console and can switch transparently between same-shell consoles:
82
+ ```
83
+ ✓ #12345 Sapphire (bash) | Status: Completed | Pipeline: ls /tmp | Duration: 0.6s | Location: /tmp
84
+ ```
92
85
 
93
- | Scenario | Behavior |
94
- |---|---|
95
- | First execute on a new shell | Auto-starts a console; warns so you can verify cwd before re-executing |
96
- | Active console matches requested shell | Runs immediately |
97
- | Active console busy, same shell requested | Auto-starts a sibling console **at the source console's cwd** and runs immediately |
98
- | Switch to a same-shell standby | Prepends `cd` preamble so the command runs in the source cwd, then executes |
99
- | Switch to a different shell | Warns to confirm cwd (cross-shell path translation is not implemented) |
100
- | User manually `cd`'d in the active console | Warns so the AI can verify the new cwd before running its next command |
86
+ ## More features
101
87
 
102
- Window titles use the format `#PID Name` (e.g., `#12345 Sapphire`) so you can identify each console at a glance. When the parent MCP process exits, titles change to `#PID ~~~~` to indicate the console is up for re-claim.
88
+ - **Auto-routing when busy** — each console tracks its own cwd; when the active one is busy, the AI is routed to a sibling at the same cwd automatically.
89
+ - **Console re-claim** — consoles outlive their parent MCP process, so AI client restarts don't kill your modules or variables.
90
+ - **Multi-line PowerShell** — heredocs, foreach, try/catch, nested scriptblocks all work via tempfile dot-sourcing.
91
+ - **Sub-agent isolation** — parallel AI agents each get their own consoles so they don't clobber each other's shells.
92
+ - **Cwd drift detection** — manual `cd` in the terminal is detected and the AI is warned before it runs the wrong command in the wrong place.
103
93
 
104
- ## Platform support
94
+ > **Architecture diagram, full routing matrix, and source**: see [yotsuda/splashshell](https://github.com/yotsuda/splashshell#readme).
105
95
 
106
- - **Windows**: ConPTY + Named Pipe (primary target, fully tested)
107
- - **Linux/macOS**: Unix PTY fallback (experimental)
96
+ ## Platform support
108
97
 
109
- ## How it works
98
+ **Windows** is the primary target (ConPTY + Named Pipe, fully tested). Unix PTY fallback for Linux/macOS is experimental.
110
99
 
111
- splashshell runs as a stdio MCP server. When the AI calls `start_console`, splashshell spawns itself in `--console` mode as a ConPTY worker, which hosts the actual shell (cmd.exe, pwsh.exe, bash.exe, etc.) inside a real Windows console window. The parent process streams stdin/stdout over a named pipe, injects shell integration scripts (`ShellIntegration/integration.*`) to emit OSC 633 markers, and parses those markers to delimit command output, track cwd, and capture exit codes.
100
+ ## Known limitations
112
101
 
113
- Result: the AI gets structured command-by-command output, the user gets a real terminal they can type into, and session state (cwd, env, history) persists across every call.
102
+ - **cmd.exe exit codes always read as 0** — cmd's `PROMPT` can't expand `%ERRORLEVEL%` at display time, so AI commands show as `Finished (exit code unavailable)`. Use `pwsh` or `bash` for exit-code-aware work.
103
+ - **Don't `Remove-Module PSReadLine -Force` inside a pwsh session** — PSReadLine's background reader threads survive module unload and steal console input, hanging the next AI command. Not recoverable.
114
104
 
115
105
  ## License
116
106
 
117
- MIT
107
+ MIT. Full release notes and source at [yotsuda/splashshell](https://github.com/yotsuda/splashshell).
package/dist/splash.exe CHANGED
Binary file
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "splashshell",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Shared console MCP server for any shell (bash, pwsh, cmd) — AI and user work in the same terminal. Real-time command visibility, interactive prompt support, session persistence, multi-shell management with automatic cwd handoff.",
5
5
  "license": "MIT",
6
6
  "author": "Yoshifumi Tsuda",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/yotsuda/splashshell.git"
9
+ "url": "git+https://github.com/yotsuda/splashshell.git"
10
10
  },
11
11
  "homepage": "https://github.com/yotsuda/splashshell",
12
12
  "keywords": [