ninja-terminals 2.4.1 → 2.4.3

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
@@ -14,6 +14,8 @@ Run the one-time setup command:
14
14
  npx --yes ninja-terminals --setup
15
15
  ```
16
16
 
17
+ > **On Windows?** Run it inside WSL2 — see [WINDOWS-SETUP.md](WINDOWS-SETUP.md).
18
+
17
19
  ## Quick Start
18
20
 
19
21
  ### As MCP Server (Recommended)
package/mcp-server.js CHANGED
@@ -42,8 +42,14 @@ const {
42
42
  // ── Config ──────────────────────────────────────────────────
43
43
  const PREFERRED_HTTP_PORT = parseInt(process.env.HTTP_PORT || process.env.PORT || '3300', 10);
44
44
  let HTTP_PORT = PREFERRED_HTTP_PORT;
45
- const CLAUDE_CMD = process.env.CLAUDE_CMD || process.env.CLAUDE_CHROME_CMD || 'claude --chrome --model claude-opus-4-5-20251101';
46
- const SHELL = process.env.SHELL || '/bin/zsh';
45
+ // Default to plain `claude` so workers use the account's current default model
46
+ // (no stale pinned model that breaks when retired). Override flags/model via
47
+ // CLAUDE_CMD env if needed.
48
+ const CLAUDE_CMD = process.env.CLAUDE_CMD || process.env.CLAUDE_CHROME_CMD || 'claude';
49
+ // Windows has no $SHELL / /bin/zsh — default to PowerShell (handles drive
50
+ // changes via `cd` and emits clean ANSI for status detection).
51
+ const IS_WIN = process.platform === 'win32';
52
+ const SHELL = IS_WIN ? (process.env.NINJA_SHELL || 'powershell.exe') : (process.env.SHELL || '/bin/zsh');
47
53
  const PROJECT_DIR = __dirname;
48
54
  const INJECT_GUIDANCE = process.env.INJECT_GUIDANCE !== 'false';
49
55
 
@@ -155,15 +161,23 @@ function spawnTerminal(label, scope = [], cwd = null, tier = 'pro') {
155
161
  FORCE_COLOR: '1',
156
162
  CLICOLOR_FORCE: '1',
157
163
  HOME: os.homedir(),
158
- PATH: `${os.homedir()}/.local/bin:/opt/homebrew/bin:${process.env.PATH || ''}`,
164
+ // On Windows, keep the native PATH untouched (mac/linux bin dirs would
165
+ // corrupt it via the ';' delimiter). On POSIX, prepend the usual bins.
166
+ PATH: IS_WIN
167
+ ? (process.env.PATH || '')
168
+ : [`${os.homedir()}/.local/bin`, '/opt/homebrew/bin', process.env.PATH || '']
169
+ .filter(Boolean).join(path.delimiter),
159
170
  SHELL_SESSIONS_DISABLE: '1',
160
171
  NINJA_TERMINAL_ID: String(id),
161
172
  },
162
173
  });
163
174
 
164
- // Launch claude after shell starts
175
+ // Launch claude after shell starts. Two separate writes (cd, then command)
176
+ // instead of `&&` — works across bash/zsh/PowerShell/cmd, which disagree on
177
+ // command chaining (`&&` is unsupported in Windows PowerShell 5).
165
178
  setTimeout(() => {
166
- ptyProcess.write(`cd "${workDir}" && ${CLAUDE_CMD}\r`);
179
+ ptyProcess.write(`cd "${workDir}"\r`);
180
+ setTimeout(() => ptyProcess.write(`${CLAUDE_CMD}\r`), 250);
167
181
  }, 500);
168
182
 
169
183
  const terminal = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ninja-terminals",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "MCP server for multi-terminal Claude Code orchestration with DAG task management, parallel execution, and self-improvement",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -38,8 +38,14 @@ const {
38
38
  const PREFERRED_PORT = parseInt(process.env.PORT || process.env.HTTP_PORT || '3300', 10);
39
39
  const BIND_HOST = process.env.NINJA_BIND_HOST || '127.0.0.1';
40
40
  const DEFAULT_TERMINALS = parseInt(process.env.DEFAULT_TERMINALS || '4', 10);
41
- const CLAUDE_CMD = process.env.CLAUDE_CMD || process.env.CLAUDE_CHROME_CMD || 'claude --chrome --model claude-opus-4-5-20251101';
42
- const SHELL = process.env.SHELL || '/bin/zsh';
41
+ // Default to plain `claude` so workers use the account's current default model
42
+ // (no stale pinned model that breaks when retired). Override flags/model via
43
+ // CLAUDE_CMD env if needed.
44
+ const CLAUDE_CMD = process.env.CLAUDE_CMD || process.env.CLAUDE_CHROME_CMD || 'claude';
45
+ // Windows has no $SHELL / /bin/zsh — default to PowerShell (handles drive
46
+ // changes via `cd` and emits clean ANSI for status detection).
47
+ const IS_WIN = process.platform === 'win32';
48
+ const SHELL = IS_WIN ? (process.env.NINJA_SHELL || 'powershell.exe') : (process.env.SHELL || '/bin/zsh');
43
49
  const PROJECT_DIR = __dirname;
44
50
  const DEFAULT_CWD = process.env.DEFAULT_CWD || null; // Set to target project path to avoid cross-project prompts
45
51
  const INJECT_GUIDANCE = process.env.INJECT_GUIDANCE !== 'false'; // Default true, set INJECT_GUIDANCE=false to disable
@@ -194,7 +200,7 @@ function spawnTerminal(label, scope = [], cwd = null, tier = 'pro', agentType =
194
200
  }
195
201
  }
196
202
 
197
- const ptyProcess = pty.spawn(SHELL, ['-l'], {
203
+ const ptyProcess = pty.spawn(SHELL, IS_WIN ? [] : ['-l'], {
198
204
  name: 'xterm-256color',
199
205
  cols,
200
206
  rows,
@@ -206,7 +212,12 @@ function spawnTerminal(label, scope = [], cwd = null, tier = 'pro', agentType =
206
212
  FORCE_COLOR: '1',
207
213
  CLICOLOR_FORCE: '1',
208
214
  HOME: require('os').homedir(),
209
- PATH: `${require('os').homedir()}/.local/bin:/opt/homebrew/bin:${process.env.PATH || ''}`,
215
+ // On Windows, keep the native PATH untouched (mac/linux bin dirs would
216
+ // corrupt it via the ';' delimiter). On POSIX, prepend the usual bins.
217
+ PATH: IS_WIN
218
+ ? (process.env.PATH || '')
219
+ : [`${require('os').homedir()}/.local/bin`, '/opt/homebrew/bin', process.env.PATH || '']
220
+ .filter(Boolean).join(path.delimiter),
210
221
  SHELL_SESSIONS_DISABLE: '1',
211
222
  NINJA_TERMINAL_ID: String(id),
212
223
  },
@@ -214,11 +225,13 @@ function spawnTerminal(label, scope = [], cwd = null, tier = 'pro', agentType =
214
225
 
215
226
  // After shell starts, cd to work dir and launch agent (if not shell)
216
227
  const agentCmd = AGENT_COMMANDS[agentType] || null;
228
+ // Two separate writes (cd, then command) instead of `&&` — works across
229
+ // bash/zsh/PowerShell/cmd, which disagree on chaining (`&&` is unsupported
230
+ // in Windows PowerShell 5).
217
231
  setTimeout(() => {
232
+ ptyProcess.write(`cd "${workDir}"\r`);
218
233
  if (agentCmd) {
219
- ptyProcess.write(`cd "${workDir}" && ${agentCmd}\r`);
220
- } else {
221
- ptyProcess.write(`cd "${workDir}"\r`);
234
+ setTimeout(() => ptyProcess.write(`${agentCmd}\r`), 250);
222
235
  }
223
236
  }, 500);
224
237