splashshell 0.4.0 → 0.15.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 — REPL-sharing MCP for AI Co-Driving
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 REPL-sharing MCP server for AI that actually holds a session.** Shell, Python, Node, a language debugger — whatever you'd open a REPL window for, splashshell keeps it live between tool calls. 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
+ No runtime prerequisite — splashshell ships as a self-contained NativeAOT binary (~13 MB, Windows x64). `npx` fetches it 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,99 @@ 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
+ splashshell gives AI a **stateful and visible** REPL session — the same window you can read along with and type into yourself. That combination unlocks workflows other MCP servers can't support: secrets the AI never sees, full PowerShell module ecosystems, real debugger sessions.
57
40
 
58
- ### Shell tools
41
+ ### Sensitive operations stay sensitive
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
+ When a command needs a passphrase, MFA code, or other secret — `Read-Host -AsSecureString`, `gpg --sign`, `ssh-add`, `sudo`, cloud CLI MFA prompts — you type it directly into the visible window. The keystrokes go to the running program, not to the terminal output stream the AI sees. The AI orchestrates the workflow ("run the publish build, sign with my key, then push the tag") but never sees the secret itself.
65
44
 
66
- Status lines include the console name, shell family, exit code, duration, and current directory:
45
+ This is impossible with stdin-piped MCP shells, where the AI must somehow supply the secret. Interactive build pipelines that involve code-signing keys, hardware token PINs, or two-factor codes work naturally on splashshell — the human stays in the loop only for the moment that requires them, and the AI handles everything around it.
67
46
 
47
+ ### PowerShell becomes a first-class AI environment
48
+
49
+ 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:
50
+
51
+ - **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.
52
+ - **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.
53
+ - **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.
54
+ - **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.
55
+
56
+ ```powershell
57
+ # Command 1 — cold import, paid once for the whole session
58
+ Import-Module Az.Compute, Az.Storage
59
+
60
+ # Command 2 — instant; capture into a variable
61
+ $vms = Get-AzVM -Status
62
+
63
+ # Command 3 — instant; same session, $vms still in scope
64
+ $vms | Where-Object PowerState -eq "VM running" |
65
+ Group-Object Location | Sort-Object Count -Descending
68
66
  ```
69
- ✓ #12345 Sapphire (bash) | Status: Completed | Pipeline: ls /tmp | Duration: 0.6s | Location: /tmp
70
- ```
71
67
 
72
- Each MCP tool call also drains:
68
+ 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.
69
+
70
+ ### Full transparency, in both directions
71
+
72
+ 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.
73
73
 
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
74
+ ### 19 adapters: shells, language REPLs, and debuggers
76
75
 
77
- ### File tools
76
+ splashshell ships **19 adapters** — 4 shells, 12 language REPLs, 3 debuggers — each with the same persistence, OSC 633 lifecycle tracking, and shared-terminal transparency:
78
77
 
79
- Claude Code–compatible file primitives, useful when the MCP client doesn't already provide them.
78
+ - **Shells (4)**: pwsh / powershell, bash, zsh, cmd
79
+ - **REPLs (12)**: Python, Node.js, Deno (TypeScript), Lua, Racket, CCL / ABCL / SBCL (Common Lisp), jshell (Java), groovysh (Groovy), F# Interactive, SQLite3
80
+ - **Debuggers (3)**: pdb (Python), perldb (Perl), jdb (Java) — driven via a unified `commands.debugger` vocabulary (step_in / step_over / continue / print / backtrace / breakpoint_set / ...) so AI agents drive any debugger with the same operation names regardless of underlying syntax
81
+
82
+ Tell the AI to drive a `groovysh` REPL for Spring Boot exploration, a `sqlite3` session for ad-hoc data shaping, or a `perldb` breakpoint loop to chase a bug in a live Perl program — all via the same `execute_command`.
83
+
84
+ ## Tools
80
85
 
81
86
  | Tool | Description |
82
87
  |------|-------------|
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. |
88
+ | `list_shells` | Enumerate every adapter this splashshell build accepts as the `shell` argument — shells, REPLs, and debuggers — with their resolved executable paths and any startup load issues. Use before `start_console` to see what's available, or to diagnose an unrecognized shell name. |
89
+ | `start_console` | Open a visible terminal. Pick a shell (bash, pwsh, powershell, cmd) or any registered REPL / debugger adapter. Reuses an existing standby of the same adapter unless `reason` is provided. |
90
+ | `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. |
91
+ | `wait_for_completion` | Block until busy consoles finish and retrieve cached output. |
92
+ | `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. |
93
+ | `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. |
88
94
 
89
- ## Multi-shell behavior
95
+ Plus Claude Code–compatible file primitives: `read_file`, `write_file`, `edit_file`, `search_files`, `find_files`.
90
96
 
91
- splashshell tracks the cwd of every console and can switch transparently between same-shell consoles:
97
+ Status lines include console name, shell family, exit code, duration, and cwd:
92
98
 
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 |
99
+ ```
100
+ ✓ #12345 Sapphire (bash) | Status: Completed | Pipeline: ls /tmp | Duration: 0.6s | Location: /tmp
101
+ ```
101
102
 
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.
103
+ ## Reliability features
104
+
105
+ - **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
106
+ - **Console re-claim**: consoles outlive their parent MCP process — AI client restarts don't kill loaded modules or variables
107
+ - **Cwd drift detection**: a manual `cd` in the terminal triggers a verification warning before the AI runs in the wrong place
108
+ - **Sub-agent isolation**: parallel AI agents get their own consoles, no cross-contamination
109
+ - **Multi-line PowerShell**: heredocs, `foreach`, `try`/`catch`, nested scriptblocks all work via tempfile dot-sourcing
110
+
111
+ > **Architecture diagram, full routing matrix, and source**: see [yotsuda/SplashShell](https://github.com/yotsuda/SplashShell#readme).
103
112
 
104
113
  ## Platform support
105
114
 
106
- - **Windows**: ConPTY + Named Pipe (primary target, fully tested)
107
- - **Linux/macOS**: Unix PTY fallback (experimental)
115
+ **Windows** is the primary target (ConPTY + Named Pipe, fully tested). Unix PTY fallback for Linux/macOS is experimental.
116
+
117
+ ## Known limitations
108
118
 
109
- ## How it works
119
+ - **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.
120
+ - **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.
110
121
 
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.
122
+ ## Migration
112
123
 
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.
124
+ Back to `splashshell` at v0.15.0. First shipped as `splashshell` for v0.1.0–v0.5.0, then `@ytsuda/splash` for v0.7.0 and `@ytsuda/ripple` for v0.8.0–v0.14.1. Both `@ytsuda/ripple` and `@ytsuda/splash` are deprecated; uninstall them and install `splashshell` to keep receiving updates. Rename the `ripple` entry in your MCP config to `splash`, and move custom adapters from `~/.ripple/adapters` to `~/.splashshell/adapters`.
114
125
 
115
126
  ## License
116
127
 
117
- MIT
128
+ MIT. Full release notes and source at [yotsuda/SplashShell](https://github.com/yotsuda/SplashShell).
package/bin/cli.mjs CHANGED
@@ -1,26 +1,83 @@
1
1
  #!/usr/bin/env node
2
+ //
3
+ // splashshell meta-package launcher.
4
+ //
5
+ // On install, npm inspects each optionalDependency's "os" and "cpu"
6
+ // fields and only installs the subpackage that matches the current
7
+ // platform. This script figures out which one that is and spawns
8
+ // its binary with stdio inherited.
9
+ //
10
+ // MCP clients talk to splashshell over stdio pipes. The Node process here
11
+ // is a transparent relay: process.argv is forwarded verbatim, stdio
12
+ // is inherited so pipes pass through, and SIGTERM / SIGINT / SIGHUP
13
+ // are forwarded to the child so client-initiated shutdown propagates.
2
14
 
3
- import { spawn } from "child_process";
4
- import { fileURLToPath } from "url";
5
- import { dirname, join } from "path";
15
+ import { spawn } from "node:child_process";
16
+ import { createRequire } from "node:module";
6
17
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const exe = join(__dirname, "..", "dist", "splash.exe");
18
+ const require = createRequire(import.meta.url);
9
19
 
10
- const child = spawn(exe, process.argv.slice(2), {
20
+ // process.platform is one of 'win32' / 'linux' / 'darwin' / …
21
+ // process.arch is one of 'x64' / 'arm64' / …
22
+ // Keep this map in sync with the meta package.json's
23
+ // optionalDependencies list and with the workflow matrix.
24
+ const PLATFORM_PACKAGES = {
25
+ "win32-x64": { pkg: "@ytsuda/splashshell-win32-x64", exe: "splashshell.exe" },
26
+ "linux-x64": { pkg: "@ytsuda/splashshell-linux-x64", exe: "splashshell" },
27
+ "darwin-arm64": { pkg: "@ytsuda/splashshell-darwin-arm64", exe: "splashshell" },
28
+ };
29
+
30
+ const key = `${process.platform}-${process.arch}`;
31
+ const entry = PLATFORM_PACKAGES[key];
32
+
33
+ if (!entry) {
34
+ const supported = Object.keys(PLATFORM_PACKAGES).join(", ");
35
+ console.error(
36
+ `splashshell: unsupported platform ${key}. Supported: ${supported}.\n` +
37
+ `If you need another platform, please open an issue at https://github.com/yotsuda/SplashShell/issues`
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ let binPath;
43
+ try {
44
+ binPath = require.resolve(`${entry.pkg}/bin/${entry.exe}`);
45
+ } catch (err) {
46
+ console.error(
47
+ `splashshell: ${entry.pkg} is not installed (${err && err.code ? err.code : err}).\n` +
48
+ `This usually means the optional dependency for your platform was skipped at install time.\n` +
49
+ `Try reinstalling: npm i -g splashshell`
50
+ );
51
+ process.exit(1);
52
+ }
53
+
54
+ const child = spawn(binPath, process.argv.slice(2), {
11
55
  stdio: "inherit",
12
- windowsHide: true,
56
+ windowsHide: false,
13
57
  });
14
58
 
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
- );
59
+ // Forward signals so clients (including MCP hosts) that SIGTERM /
60
+ // SIGINT the wrapper reach the actual splashshell process. Without this,
61
+ // Ctrl+C from an MCP host would kill only the Node wrapper and leave
62
+ // a zombie splashshell process holding the PTY open.
63
+ for (const sig of ["SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT"]) {
64
+ process.on(sig, () => {
65
+ try { child.kill(sig); } catch { /* child may have already exited */ }
66
+ });
67
+ }
68
+
69
+ child.on("exit", (code, signal) => {
70
+ if (signal) {
71
+ // Re-raise the signal on the wrapper so the exit status mirrors
72
+ // a direct invocation (shells inspect $? / %ERRORLEVEL% and
73
+ // $status accordingly).
74
+ process.kill(process.pid, signal);
22
75
  } else {
23
- console.error(err.message);
76
+ process.exit(code ?? 0);
24
77
  }
78
+ });
79
+
80
+ child.on("error", (err) => {
81
+ console.error(`splashshell: failed to launch ${binPath}: ${err.message}`);
25
82
  process.exit(1);
26
83
  });
package/package.json CHANGED
@@ -1,38 +1,57 @@
1
1
  {
2
2
  "name": "splashshell",
3
- "version": "0.4.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.",
3
+ "version": "0.15.0",
4
+ "description": "REPL-sharing MCP server — AI and humans co-drive the same visible terminal. 19 embedded adapters: shells (bash, pwsh, zsh, cmd), language REPLs (Python, Node, Deno, Lua, Racket, CCL/ABCL/SBCL Common Lisp, F# Interactive, jshell, Groovy, SQLite3), and debuggers (pdb, perldb, jdb). Session persists across tool calls; secrets typed in the visible window stay out of AI's view.",
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
- "homepage": "https://github.com/yotsuda/splashshell",
11
+ "homepage": "https://github.com/yotsuda/SplashShell",
12
12
  "keywords": [
13
13
  "mcp",
14
14
  "mcp-server",
15
15
  "model-context-protocol",
16
+ "claude",
17
+ "claude-code",
18
+ "anthropic",
19
+ "ai-agent",
20
+ "ai-shell",
21
+ "co-driving",
22
+ "shared-terminal",
23
+ "visible-terminal",
24
+ "shared-console",
16
25
  "shell",
26
+ "terminal",
27
+ "repl",
28
+ "debugger",
29
+ "pty",
30
+ "conpty",
17
31
  "bash",
18
32
  "pwsh",
19
33
  "powershell",
34
+ "zsh",
20
35
  "cmd",
21
- "terminal",
22
- "conpty",
23
- "shared-console",
24
- "claude",
25
- "ai"
26
- ],
27
- "os": [
28
- "win32"
36
+ "python",
37
+ "node",
38
+ "deno",
39
+ "racket",
40
+ "common-lisp",
41
+ "groovy",
42
+ "fsharp",
43
+ "sqlite"
29
44
  ],
30
45
  "bin": {
31
- "splash": "bin/cli.mjs"
46
+ "splashshell": "bin/cli.mjs"
47
+ },
48
+ "optionalDependencies": {
49
+ "@ytsuda/splashshell-win32-x64": "0.15.0",
50
+ "@ytsuda/splashshell-linux-x64": "0.15.0",
51
+ "@ytsuda/splashshell-darwin-arm64": "0.15.0"
32
52
  },
33
53
  "files": [
34
54
  "bin/",
35
- "dist/",
36
55
  "README.md",
37
56
  "LICENSE"
38
57
  ]
package/dist/splash.exe DELETED
Binary file