Skip to content

fix: use conditional shell in runVersion for claude and opencode agents #183

@subsy

Description

@subsy

Summary

The runVersion function in claude.ts and opencode.ts uses shell: true unconditionally when spawning the version check command. This is unnecessary on Linux/macOS when the command is already a resolved absolute path.

Current behavior

// claude.ts and opencode.ts
const proc = spawn(command, ['--version'], {
  stdio: ['ignore', 'pipe', 'pipe'],
  shell: true,  // Always uses shell
});

Expected behavior

Match the pattern used by the newer agent plugins (codex, gemini, kiro):

// Only use shell on Windows where direct spawn may not work
const useShell = process.platform === 'win32';
const proc = spawn(command, ['--version'], {
  stdio: ['ignore', 'pipe', 'pipe'],
  shell: useShell,
});

Why this matters

  • Avoids unnecessary shell invocation on Linux/macOS
  • Reduces potential for shell interpretation issues
  • Aligns with the established pattern in newer agent plugins
  • Slightly more efficient (no shell process overhead)

Files to update

  • src/plugins/agents/builtin/claude.ts
  • src/plugins/agents/builtin/opencode.ts

Note

The droid plugin (src/plugins/agents/droid/index.ts) was checked and already uses conditional shell (isWindows check at line 174).

Related

The newer agents (codex.ts, gemini.ts, kiro.ts) already implement the correct conditional pattern.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions