splashshell 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yoshifumi Tsuda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # splashshell
2
+
3
+ <div align="center">
4
+ <img src="https://github.com/user-attachments/assets/1343f694-1c05-4899-9faa-d2b1138aa3ba" alt="social-image" width="640" />
5
+ </div>
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
18
+
19
+ ```mermaid
20
+ graph TB
21
+ Client["MCP Client<br/>(Claude Code, etc.)"]
22
+
23
+ subgraph Proxy["splashshell proxy (stdio MCP server)"]
24
+ CM["Console Manager<br/>(cwd tracking, re-claim,<br/>cache drain, switching)"]
25
+ Tools["start_console<br/>execute_command<br/>wait_for_completion<br/>read_file / write_file / edit_file<br/>search_files / find_files"]
26
+ end
27
+
28
+ subgraph Consoles["Visible Console Windows (each runs splash --console)"]
29
+ subgraph C1["#9876 Sapphire (bash)"]
30
+ PTY1["ConPTY + bash<br/>(+ OSC 633)"]
31
+ end
32
+ subgraph C2["#5432 Cobalt (pwsh)"]
33
+ PTY2["ConPTY + pwsh<br/>(+ OSC 633)"]
34
+ end
35
+ subgraph C3["#1234 Topaz (cmd)"]
36
+ PTY3["ConPTY + cmd.exe<br/>(+ OSC 633 via PROMPT)"]
37
+ end
38
+ end
39
+
40
+ User["User"] -- "keyboard" --> C1
41
+ User -- "keyboard" --> C2
42
+ User -- "keyboard" --> C3
43
+ Client -- "stdio" --> Proxy
44
+ CM -- "Named Pipe" --> C1
45
+ CM -- "Named Pipe" --> C2
46
+ CM -- "Named Pipe" --> C3
47
+ CM -. "auto-switch<br/>if busy" .-> C1
48
+ CM -. "shell routing" .-> C2
49
+ ```
50
+
51
+ ## Install
52
+
53
+ Requires [.NET 9 Runtime](https://dotnet.microsoft.com/download/dotnet/9.0).
54
+
55
+ ```bash
56
+ git clone https://github.com/yotsuda/splashshell.git
57
+ cd splashshell
58
+ dotnet publish -c Release -r win-x64 --no-self-contained -o ./dist
59
+ ```
60
+
61
+ The binary is `./dist/splash.exe`.
62
+
63
+ ## MCP Setup
64
+
65
+ ### Claude Code
66
+
67
+ ```bash
68
+ claude mcp add splash -s user -- C:\path\to\splash.exe
69
+ ```
70
+
71
+ ### Claude Desktop
72
+
73
+ Add to `%APPDATA%\Claude\claude_desktop_config.json`:
74
+
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "splash": {
79
+ "command": "C:\\path\\to\\splash.exe"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ## Tools
86
+
87
+ ### Shell tools
88
+
89
+ | Tool | Description |
90
+ |------|-------------|
91
+ | `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. |
92
+ | `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`. |
93
+ | `wait_for_completion` | Block until busy consoles finish and retrieve cached output (use after a command times out). |
94
+
95
+ Status lines include the console name, shell family, exit code, duration, and current directory:
96
+
97
+ ```
98
+ ✓ #12345 Sapphire (bash) | Status: Completed | Pipeline: ls /tmp | Duration: 0.6s | Location: /tmp
99
+ ```
100
+
101
+ Each MCP tool call also drains:
102
+
103
+ - **Cached results** from any console whose timed-out command has since finished
104
+ - **Closed console notifications** when a console window has been closed since the last call
105
+
106
+ ### File tools
107
+
108
+ Claude Code–compatible file primitives, useful when the MCP client doesn't already provide them.
109
+
110
+ | Tool | Description |
111
+ |------|-------------|
112
+ | `read_file` | Read a file with line numbers. Supports `offset` / `limit` for paging through large files. Detects binary files. |
113
+ | `write_file` | Create or overwrite a file. Creates parent directories as needed. |
114
+ | `edit_file` | Replace an exact string in a file. Old string must be unique by default; pass `replace_all` to replace every occurrence. |
115
+ | `search_files` | Search file contents with a regular expression. Returns matching lines with file paths and line numbers. Supports `glob` filtering. |
116
+ | `find_files` | Find files by glob pattern (e.g., `**/*.cs`). Returns matching paths. |
117
+
118
+ ## Multi-shell behavior
119
+
120
+ splashshell tracks the cwd of every console and can switch transparently between same-shell consoles:
121
+
122
+ | Scenario | Behavior |
123
+ |---|---|
124
+ | First execute on a new shell | Auto-starts a console; warns so you can verify cwd before re-executing |
125
+ | Active console matches requested shell | Runs immediately |
126
+ | Active console busy, same shell requested | Auto-starts a sibling console **at the source console's cwd** and runs immediately |
127
+ | Switch to a same-shell standby | Prepends `cd` preamble so the command runs in the source cwd, then executes |
128
+ | Switch to a different shell | Warns to confirm cwd (cross-shell path translation is not implemented) |
129
+ | User manually `cd`'d in the active console | Warns so the AI can verify the new cwd before running its next command |
130
+
131
+ 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.
132
+
133
+ ## Platform support
134
+
135
+ - **Windows**: ConPTY + Named Pipe (primary target, fully tested)
136
+ - **Linux/macOS**: Unix PTY fallback (experimental)
137
+
138
+ ## How it works
139
+
140
+ 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.
141
+
142
+ 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.
143
+
144
+ ## License
145
+
146
+ MIT
package/bin/cli.mjs ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "child_process";
4
+ import { fileURLToPath } from "url";
5
+ import { dirname, join } from "path";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const exe = join(__dirname, "..", "dist", "splash.exe");
9
+
10
+ const child = spawn(exe, process.argv.slice(2), {
11
+ stdio: "inherit",
12
+ windowsHide: true,
13
+ });
14
+
15
+ child.on("exit", (code) => process.exit(code ?? 1));
16
+ child.on("error", (err) => {
17
+ if (err.code === "ENOENT") {
18
+ console.error(
19
+ "splash binary not found. This package requires Windows and .NET 9 Desktop Runtime.\n" +
20
+ "Download: https://dotnet.microsoft.com/download/dotnet/9.0"
21
+ );
22
+ } else {
23
+ console.error(err.message);
24
+ }
25
+ process.exit(1);
26
+ });
Binary file
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "splashshell",
3
+ "version": "0.1.0",
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
+ "license": "MIT",
6
+ "author": "Yoshifumi Tsuda",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/yotsuda/splashshell.git"
10
+ },
11
+ "homepage": "https://github.com/yotsuda/splashshell",
12
+ "keywords": [
13
+ "mcp",
14
+ "mcp-server",
15
+ "model-context-protocol",
16
+ "shell",
17
+ "bash",
18
+ "pwsh",
19
+ "powershell",
20
+ "cmd",
21
+ "terminal",
22
+ "conpty",
23
+ "shared-console",
24
+ "claude",
25
+ "ai"
26
+ ],
27
+ "os": [
28
+ "win32"
29
+ ],
30
+ "bin": {
31
+ "splash": "bin/cli.mjs"
32
+ },
33
+ "files": [
34
+ "bin/",
35
+ "dist/",
36
+ "README.md",
37
+ "LICENSE"
38
+ ]
39
+ }