Skip to content

Conversation

@jeremykit
Copy link

@jeremykit jeremykit commented Jan 7, 2026

When validating Claude CLI on Windows with shell: true (for .cmd/.bat files), paths containing spaces were being split by cmd.exe. For example: D:\Program Files\nodejs\claude.cmd was parsed as command D:\Program with arguments Files\nodejs\claude.cmd --version.

This fix adds proper quoting for paths with spaces when using shell: true, preventing cmd.exe from incorrectly splitting the path at space characters.

🤖 Generated with Claude Code

Base Branch

  • This PR targets the develop branch (required for all feature/fix PRs)
  • This PR targets main (hotfix only - maintainers)

Description

Related Issue

Closes #

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📚 Documentation
  • ♻️ Refactor
  • 🧪 Test

Area

  • Frontend
  • Backend
  • Fullstack

Commit Message Format

Follow conventional commits: <type>: <subject>

Types: feat, fix, docs, style, refactor, test, chore

Example: feat: add user authentication system

Checklist

  • I've synced with develop branch
  • I've tested my changes locally
  • I've followed the code principles (SOLID, DRY, KISS)
  • My PR is small and focused (< 400 lines ideally)

CI/Testing Requirements

  • All CI checks pass
  • All existing tests pass
  • New features include test coverage
  • Bug fixes include regression tests

Screenshots

Before After

Feature Toggle

  • Behind localStorage flag: use_feature_name
  • Behind settings toggle
  • Behind environment variable/config
  • N/A - Feature is complete and ready for all users

Breaking Changes

Breaking: Yes / No

Details:

Summary by CodeRabbit

  • Bug Fixes
    • Fixed CLI validation on Windows so executable paths containing spaces are handled reliably during both synchronous and asynchronous checks. This reduces false failures when validating the local CLI and maintains existing invocation behavior and environment handling, improving consistency of detection and version-checking on Windows.

✏️ Tip: You can customize this high-level summary in your review settings.

When validating Claude CLI on Windows with shell: true (for .cmd/.bat files),
paths containing spaces were being split by cmd.exe. For example:
`D:\Program Files\nodejs\claude.cmd` was parsed as command `D:\Program`
with arguments `Files\nodejs\claude.cmd --version`.

This fix adds proper quoting for paths with spaces when using shell: true,
preventing cmd.exe from incorrectly splitting the path at space characters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CLAassistant
Copy link

CLAassistant commented Jan 7, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

Quote the Claude CLI executable on Windows when its path contains spaces and use the quoted command for both synchronous and asynchronous validation invocations (execFileSync / execFile with shell: true).

Changes

Cohort / File(s) Change Summary
Windows CLI Path Handling
apps/frontend/src/main/cli-tool-manager.ts
Add needsQuoting check for spaces/shell-special chars; compute cmdToRun (quoted when needed) and use it for both sync (execFileSync(..., { shell: true })) and async (execFile(..., { shell: true })) Claude CLI validation calls.

Sequence Diagram(s)

(No sequence diagrams generated — changes are a small CLI invocation adjustment and do not introduce a new multi-component control flow.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

bug, area/frontend, size/XS

Suggested reviewers

  • AndyMik90
  • marcefalcondev

Poem

🐰 I hopped through paths with spaces wide,
I wrapped the trail so Claude could glide.
Sync or async, shell now sees,
Commands quoted, no more unease. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: quoting Windows paths with spaces in Claude CLI validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 654170c and 72388e5.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
📚 Learning: 2026-01-04T23:59:48.743Z
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.

Applied to files:

  • apps/frontend/src/main/cli-tool-manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: CodeQL
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)
🔇 Additional comments (3)
apps/frontend/src/main/cli-tool-manager.ts (3)

926-931: LGTM! Windows path quoting fix correctly implemented.

The quoting logic correctly addresses the issue where Windows paths with spaces (e.g., D:\Program Files\nodejs\claude.cmd) were being split by cmd.exe when using shell: true. The regex pattern /[ &|<>^%()]/ comprehensively covers cmd.exe special characters that require quoting, and the fix is appropriately scoped to only apply when needsShell is true.


1034-1039: LGTM! Consistent quoting fix applied to async validation.

The async version correctly applies the same Windows path quoting logic as the synchronous version, ensuring consistent behavior across both validation methods. This maintains proper handling of Claude CLI paths containing spaces on Windows.


926-931: Consider adding a test case for Windows paths with spaces.

While the fix looks correct, it would be valuable to verify it works as expected with actual Windows paths containing spaces and other shell-special characters.

You could verify this manually by:

  1. Testing with a Claude CLI installation in a path like C:\Program Files\nodejs\claude.cmd
  2. Confirming the validation succeeds and correctly detects the version

Or consider adding an automated test case that mocks this scenario to prevent regressions.

Also applies to: 1034-1039


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jeremykit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a bug in the Claude CLI validation process on Windows. Previously, paths containing spaces for .cmd or .bat files were misinterpreted by cmd.exe when shell: true was enabled, leading to incorrect command execution. The fix introduces proper quoting for these paths, ensuring that the CLI validation operates as expected on Windows systems.

Highlights

  • Windows Path Handling: Addresses an issue where cmd.exe incorrectly parses paths containing spaces when validating the Claude CLI on Windows, specifically for .cmd or .bat files.
  • Command Execution Fix: Ensures that the execFileSync command properly quotes paths with spaces before execution, preventing cmd.exe from splitting the path into multiple arguments and causing execution errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks for your first PR!

A maintainer will review it soon. Please make sure:

  • Your branch is synced with develop
  • CI checks pass
  • You've followed our contribution guide

Welcome to the Auto Claude community!

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a bug on Windows where Claude CLI validation would fail for paths containing spaces. The fix involves quoting the command path when shell: true is used, which is correct. My review points out that while the synchronous validateClaude function is fixed, its asynchronous counterpart validateClaudeAsync was overlooked and still contains the same bug. It's important to apply the fix there as well for consistent and correct behavior.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/frontend/src/main/cli-tool-manager.ts (1)

1030-1041: Apply the same quoting fix to the async version.

The sync version (validateClaude) now handles Windows paths with spaces (lines 926-932), but this async version lacks the same fix. When validateClaudeAsync is called via detectClaudeAsync, Windows paths with spaces will still fail.

🐛 Proposed fix: Apply consistent quoting logic
   private async validateClaudeAsync(claudeCmd: string): Promise<ToolValidation> {
     try {
       const needsShell = process.platform === 'win32' &&
         (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));
 
+      // When using shell: true on Windows, paths with spaces must be quoted
+      // to prevent cmd.exe from splitting at spaces
+      const cmdToRun = needsShell && claudeCmd.includes(' ')
+        ? `"${claudeCmd}"`
+        : claudeCmd;
+
-      const { stdout } = await execFileAsync(claudeCmd, ['--version'], {
+      const { stdout } = await execFileAsync(cmdToRun, ['--version'], {
         encoding: 'utf-8',
         timeout: 5000,
         windowsHide: true,
         shell: needsShell,
         env: await getAugmentedEnvAsync(),
       });
🤖 Fix all issues with AI agents
In @apps/frontend/src/main/cli-tool-manager.ts:
- Around line 926-932: The code currently wraps claudeCmd in quotes when
needsShell && claudeCmd.includes(' '), which can double-quote an already-quoted
path; update the logic that sets cmdToRun so it only adds surrounding quotes if
claudeCmd is not already enclosed in matching single or double quotes (check
claudeCmd.startsWith('"') && claudeCmd.endsWith('"') or the single-quote
equivalent) and otherwise leave claudeCmd as-is; keep the same execFileSync call
using cmdToRun so behavior is unchanged except preventing double-quoting.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e78390 and b838324.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)

@AndyMik90 AndyMik90 self-assigned this Jan 7, 2026
Copy link
Owner

@AndyMik90 AndyMik90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto Claude PR Review

Merge Verdict: 🟠 NEEDS REVISION

1 issue(s) must be addressed (1 required, 0 recommended), 1 suggestions

Risk Assessment

Factor Level Notes
Complexity Low Based on lines changed
Security Impact None Based on security findings
Scope Coherence Good Based on structural review

Findings Summary

  • High: 1 issue(s)
  • Low: 1 issue(s)

Generated by Auto Claude PR Review

Findings (2 selected of 2 total)

🟠 [7eea1a85ba75] [HIGH] Missing path quoting in async validateClaudeAsync() method

📁 apps/frontend/src/main/cli-tool-manager.ts:1035

The sync method validateClaude() (lines 928-930) was fixed to quote Windows paths with spaces when using shell: true, but the async counterpart validateClaudeAsync() was NOT updated with the same fix. When claudeCmd contains spaces (e.g., 'D:\Program Files\nodejs\claude.cmd') and needsShell is true, the async method will fail because cmd.exe splits the path at spaces. The async method is used by getToolPathAsync() which is called from the Electron main process.

Suggested fix:

Add the same quoting logic to validateClaudeAsync():

```typescript
private async validateClaudeAsync(claudeCmd: string): Promise<ToolValidation> {
  try {
    const needsShell = process.platform === 'win32' &&
      (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));

    // When using shell: true on Windows, paths with spaces must be quoted
    // to prevent cmd.exe from splitting at spaces
    const cmdToRun = needsShell && claudeCmd.includes(' ')
      ? `"${claudeCmd}"`
      : claudeCmd;

    const { stdout } = await execFileAsync(cmdToRun, ['--version'], {
      ...
    });

#### 🔵 [523f33b93260] [LOW] Consider expanding quoting for other cmd.exe special characters
📁 `apps/frontend/src/main/cli-tool-manager.ts:928`

The fix only handles spaces, but Windows cmd.exe also interprets other special characters like &, |, >, <, ^, and % when using shell: true. For example, a path like 'D:\Test&Folder\claude.cmd' would cause cmd.exe to interpret & as a command separator. While this is an edge case for installation paths, expanding the check to include these characters would make the fix more robust.

**Suggested fix:**

Expand the condition to quote paths containing any special cmd.exe characters:

const needsQuoting = needsShell && /[ &|<>^%]/.test(claudeCmd);
const cmdToRun = needsQuoting ? `"${claudeCmd}"` : claudeCmd;

---
*This review was generated by Auto Claude.*

When validating Claude CLI on Windows with shell: true (for .cmd/.bat files),
paths containing spaces were being split by cmd.exe. For example:
`D:\Program Files\nodejs\claude.cmd` was parsed as command `D:\Program`
with arguments `Files\nodejs\claude.cmd --version`.

This fix adds proper quoting for paths with spaces when using shell: true,
preventing cmd.exe from incorrectly splitting the path at space characters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jeremykit jeremykit force-pushed the fix/windows-claude-cli-path-spaces branch from 2f1eb24 to f719ab1 Compare January 7, 2026 14:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/frontend/src/main/cli-tool-manager.ts (1)

1030-1058: Apply the same quoting fix to the async method.

The async counterpart validateClaudeAsync still has the original bug—it passes claudeCmd directly to execFileAsync without quoting paths that contain spaces. This was flagged in a previous review and you acknowledged it, but the fix has not been applied yet.

Windows users with spaces in their Claude CLI path will experience validation failures when the async code path is used.

🐛 Proposed fix to apply the same quoting logic
  private async validateClaudeAsync(claudeCmd: string): Promise<ToolValidation> {
    try {
      const needsShell = process.platform === 'win32' &&
        (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));

+      // When using shell: true on Windows, paths with spaces must be quoted
+      // to prevent cmd.exe from splitting at spaces
+      const cmdToRun = needsShell && claudeCmd.includes(' ')
+        ? `"${claudeCmd}"`
+        : claudeCmd;
+
-      const { stdout } = await execFileAsync(claudeCmd, ['--version'], {
+      const { stdout } = await execFileAsync(cmdToRun, ['--version'], {
        encoding: 'utf-8',
        timeout: 5000,
        windowsHide: true,
        shell: needsShell,
        env: await getAugmentedEnvAsync(),
      });
🤖 Fix all issues with AI agents
In @apps/frontend/src/main/cli-tool-manager.ts:
- Around line 926-932: The code quotes claudeCmd when needsShell &&
claudeCmd.includes(' ') to avoid Windows cmd.exe splitting, but it should avoid
double-quoting already-quoted paths; update the cmdToRun assignment (used when
calling execFileSync) to only wrap claudeCmd in quotes if it’s not already
quoted (e.g., check that claudeCmd does not start with a double quote and does
not end with one) while preserving the existing needsShell && includes(' ')
condition so execFileSync continues to receive the corrected cmdToRun.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b838324 and f719ab1.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)

Copy link
Author

@jeremykit jeremykit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accept

@jeremykit jeremykit requested a review from AndyMik90 January 7, 2026 14:34
Copy link
Author

@jeremykit jeremykit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Owner

@AndyMik90 AndyMik90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto Claude PR Review

No new commits since last review. Previous findings still apply.

Findings (2 selected of 2 total)

🟠 [7eea1a85ba75] [HIGH] Missing path quoting in async validateClaudeAsync() method

📁 apps/frontend/src/main/cli-tool-manager.ts:1035

The sync method validateClaude() (lines 928-930) was fixed to quote Windows paths with spaces when using shell: true, but the async counterpart validateClaudeAsync() was NOT updated with the same fix. When claudeCmd contains spaces (e.g., 'D:\Program Files\nodejs\claude.cmd') and needsShell is true, the async method will fail because cmd.exe splits the path at spaces. The async method is used by getToolPathAsync() which is called from the Electron main process.

Suggested fix:

Add the same quoting logic to validateClaudeAsync():

```typescript
private async validateClaudeAsync(claudeCmd: string): Promise<ToolValidation> {
  try {
    const needsShell = process.platform === 'win32' &&
      (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));

    // When using shell: true on Windows, paths with spaces must be quoted
    // to prevent cmd.exe from splitting at spaces
    const cmdToRun = needsShell && claudeCmd.includes(' ')
      ? `"${claudeCmd}"`
      : claudeCmd;

    const { stdout } = await execFileAsync(cmdToRun, ['--version'], {
      ...
    });

#### 🔵 [523f33b93260] [LOW] Consider expanding quoting for other cmd.exe special characters
📁 `apps/frontend/src/main/cli-tool-manager.ts:928`

The fix only handles spaces, but Windows cmd.exe also interprets other special characters like &, |, >, <, ^, and % when using shell: true. For example, a path like 'D:\Test&Folder\claude.cmd' would cause cmd.exe to interpret & as a command separator. While this is an edge case for installation paths, expanding the check to include these characters would make the fix more robust.

**Suggested fix:**

Expand the condition to quote paths containing any special cmd.exe characters:

const needsQuoting = needsShell && /[ &|<>^%]/.test(claudeCmd);
const cmdToRun = needsQuoting ? `"${claudeCmd}"` : claudeCmd;

---
*This review was generated by Auto Claude.*

@jeremykit jeremykit requested a review from AndyMik90 January 8, 2026 03:40
jeremykit and others added 2 commits January 8, 2026 12:01
When using shell: true on Windows, paths containing spaces must be
quoted to prevent cmd.exe from splitting at spaces.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @apps/frontend/src/main/cli-tool-manager.ts:
- Around line 926-932: Update the cmdToRun assignment in cli-tool-manager.ts
(the code that builds cmdToRun using claudeCmd and needsShell) to guard against
double-quoting by only wrapping claudeCmd in quotes when it contains spaces,
needsShell is true, and it is not already quoted (e.g., check
!claudeCmd.startsWith('"')). Adjust both the synchronous and asynchronous usages
of cmdToRun so they use the same guarded logic to prevent accidentally adding a
second set of quotes.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f719ab1 and 4c6f3bc.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (1)
apps/frontend/src/main/cli-tool-manager.ts (1)

1035-1041: Async version correctly mirrors sync implementation.

The quoting logic here is identical to the synchronous version (lines 926-932), ensuring consistent behavior. The same optional enhancement regarding the double-quoting guard applies here as well.

@jeremykit jeremykit force-pushed the fix/windows-claude-cli-path-spaces branch from c37fae5 to 7184105 Compare January 9, 2026 05:36
@jeremykit
Copy link
Author

@AndyMik90 I've addressed the HIGH priority issue by adding the same quoting fix to validateClaudeAsync() in commit 4c6f3bc.

I've also synced my branch with the latest develop.

Could you please re-review when you have a chance? Thanks!

Copy link
Author

@jeremykit jeremykit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @apps/frontend/src/main/cli-tool-manager.ts:
- Around line 1035-1041: The async validation path in validateClaudeAsync does
not apply the same Windows-quoting logic as validateClaude(), causing commands
with spaces to be split when needsShell is true; update validateClaudeAsync to
generate cmdToRun using the same condition on needsShell, claudeCmd.includes('
'), and !claudeCmd.startsWith('"') and pass that cmdToRun into execFileAsync
(referencing claudeCmd, needsShell, cmdToRun, execFileAsync, and
validateClaudeAsync) so both validateClaude() and validateClaudeAsync handle
Windows paths with spaces consistently.
- Around line 926-932: Change the quote-detection to ensure the path is fully
quoted before skipping quoting: instead of only checking
!claudeCmd.startsWith('"'), update the condition used to build cmdToRun (the
expression referencing needsShell and claudeCmd) to verify both
claudeCmd.startsWith('"') and claudeCmd.endsWith('"') (or equivalent regex) so
you only skip quoting when the string is already fully wrapped in quotes; keep
the rest of the needsShell && space check and use double quotes for the injected
quoting.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c6f3bc and 1524cd9.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/frontend/src/main/cli-tool-manager.ts (1)

926-939: Extract quoting logic into a helper function to normalize path handling

The quoting logic is duplicated (lines 926–939 and 1035–1047) and has a reliability issue: it adds wrapping quotes without first stripping existing ones. When shell: true is used on Windows, Node.js passes the command string verbatim to cmd.exe (with windowsVerbatimArguments = true), and cmd.exe may misinterpret pre-quoted paths due to its own quote-parsing rules.

Centralize the logic into a helper like prepareWindowsShellCommand(command, needsShell) that:

  1. Strips any existing wrapping quotes
  2. Re-applies quotes only when shell: true and whitespace is present

This ensures cmd.exe receives a properly formed command line and eliminates duplication.

Proposed refactor
+function prepareWindowsShellCommand(command: string, needsShell: boolean): string {
+  const trimmed = command.trim();
+  const unwrapped =
+    trimmed.startsWith('"') && trimmed.endsWith('"')
+      ? trimmed.slice(1, -1)
+      : trimmed;
+
+  // Only quote when cmd.exe is involved and whitespace exists
+  return needsShell && /\s/.test(unwrapped) ? `"${unwrapped}"` : unwrapped;
+}
+
   private validateClaude(claudeCmd: string): ToolValidation {
     try {
       // On Windows, .cmd files need shell: true to execute properly.
       // SECURITY NOTE: shell: true is safe here because:
       // 1. claudeCmd comes from internal path detection (user config or known system paths)
       // 2. Only '--version' is passed as an argument (no user input)
       // If claudeCmd origin ever changes to accept user input, use escapeShellArgWindows.
       const needsShell = process.platform === 'win32' &&
         (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));
 
-      // When using shell: true on Windows, paths with spaces must be quoted
-      // to prevent cmd.exe from splitting at spaces
-      const cmdToRun = needsShell && claudeCmd.includes(' ') && !(claudeCmd.startsWith('"') && claudeCmd.endsWith('"'))
-        ? `"${claudeCmd}"`
-        : claudeCmd;
+      const cmdToRun = prepareWindowsShellCommand(claudeCmd, needsShell);
 
       const version = execFileSync(cmdToRun, ['--version'], {
         encoding: 'utf-8',
         timeout: 5000,
         windowsHide: true,
         shell: needsShell,
         env: getAugmentedEnv(),
       }).trim();
   private async validateClaudeAsync(claudeCmd: string): Promise<ToolValidation> {
     try {
       const needsShell = process.platform === 'win32' &&
         (claudeCmd.endsWith('.cmd') || claudeCmd.endsWith('.bat'));
 
-      // When using shell: true on Windows, paths with spaces must be quoted
-      // to prevent cmd.exe from splitting at spaces
-      const cmdToRun = needsShell && claudeCmd.includes(' ') && !(claudeCmd.startsWith('"') && claudeCmd.endsWith('"'))
-      ? `"${claudeCmd}"`
-      : claudeCmd;
+      const cmdToRun = prepareWindowsShellCommand(claudeCmd, needsShell);
 
       const { stdout } = await execFileAsync(cmdToRun, ['--version'], {
         encoding: 'utf-8',
         timeout: 5000,
         windowsHide: true,
         shell: needsShell,
         env: await getAugmentedEnvAsync(),
       });
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1524cd9 and dc50ab5.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)
🔇 Additional comments (2)
apps/frontend/src/main/cli-tool-manager.ts (2)

926-938: Quoting fix addresses cmd.exe path-splitting on Windows

The cmdToRun logic correctly ensures .cmd/.bat paths with spaces aren’t split when shell: true, and it’s applied consistently in both sync and async validation.

Also applies to: 1035-1047


918-925: Verify security context of claudeCmd origin and shell: true usage

The review raises a legitimate security concern: if claudeCmd can originate from user-configurable settings (userConfig.claudePath in settings.json), then the security comment claiming "no user input" is inaccurate. User configuration is user input. With shell: true on Windows, metacharacters like &|<>^\r\n could alter command behavior.

However, the concern requires verification of:

  1. Whether claudeCmd is actually sourced from userConfig.claudePath
  2. What validation (if any) currently exists for claudeCmd
  3. Whether the suggested hardening (metacharacter validation) applies at all call sites (lines 926-939, 1032-1047)

At minimum, update the security comment to acknowledge user configuration as a source and add validation if shell: true is used with user-sourced paths.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @apps/frontend/src/main/cli-tool-manager.ts:
- Around line 1034-1039: The regex used to detect characters requiring quoting
in the async Claude CLI validation (used in needsQuoting where claudeCmd is
tested before calling execFileAsync) currently checks /[ &|<>^%]/; update it to
include parentheses by changing the character class to include () — i.e., add
'(' and ')' inside the brackets so commands containing parentheses are also
quoted consistently with the sync path.
- Around line 926-931: Update the quoting regex used to decide if claudeCmd
needs quoting: in the code that computes needsQuoting (referencing the
needsQuoting variable and claudeCmd), expand the character class `/[ &|<>^%]/`
to include parentheses so it also detects "(" or ")" in paths (e.g., change to
include `()` inside the brackets) before building cmdToRun and calling
execFileSync.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc50ab5 and 654170c.

📒 Files selected for processing (1)
  • apps/frontend/src/main/cli-tool-manager.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/cli-tool-manager.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
📚 Learning: 2026-01-04T23:59:48.743Z
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.

Applied to files:

  • apps/frontend/src/main/cli-tool-manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants