Skip to content

fix(cli): use correct PATH delimiter and skip S_IXUSR on Windows in cbm_find_cli#161

Open
slvnlrt wants to merge 1 commit intoDeusData:mainfrom
slvnlrt:fix/windows-find-cli-path-delimiter
Open

fix(cli): use correct PATH delimiter and skip S_IXUSR on Windows in cbm_find_cli#161
slvnlrt wants to merge 1 commit intoDeusData:mainfrom
slvnlrt:fix/windows-find-cli-path-delimiter

Conversation

@slvnlrt
Copy link
Copy Markdown

@slvnlrt slvnlrt commented Mar 27, 2026

Summary

cbm_find_cli() never finds OpenCode or Aider on Windows due to two issues:

  1. PATH delimiter: uses : on all platforms, but Windows uses ;. This splits C:\Users\... at the drive letter colon, producing garbage paths.
  2. S_IXUSR check: stat() on Windows does not set Unix permission bits. npm installs CLI shims as extensionless files (e.g. opencode, not opencode.exe), which stat() finds but the S_IXUSR check always rejects.

Fixes #159

Changes

src/cli/cli.ccbm_find_cli():

  • Use ; as PATH delimiter on Windows (#ifdef _WIN32)
  • Skip S_IXUSR check on Windows — just verify file exists with stat() == 0

tests/test_cli.ccli_find_cli_on_path, cli_find_cli_fallback_paths:

  • Replaced SKIP("PATH search differs on Windows") with cross-platform test cases that run on both Unix and Windows
  • Tests create extensionless files (like npm shims) and verify detection

Test plan

  • Windows: scripts/test.sh passes (previously skipped tests now run)
  • Windows: codebase-memory-mcp install -y detects OpenCode when installed via npm
  • Linux/macOS: no regression — : delimiter and S_IXUSR behavior unchanged

@slvnlrt slvnlrt force-pushed the fix/windows-find-cli-path-delimiter branch from f27c74d to 4eeec46 Compare March 27, 2026 12:46
@DeusData DeusData added bug Something isn't working editor/integration Editor compatibility and CLI integration labels Mar 27, 2026
@slvnlrt slvnlrt changed the title fix(cli): use correct PATH delimiter and .exe extension on Windows in cbm_find_cli fix(cli): use correct PATH delimiter and skip S_IXUSR on Windows in cbm_find_cli Mar 27, 2026
…bm_find_cli

Two issues prevent cbm_find_cli() from finding OpenCode/Aider on Windows:

1. PATH delimiter: uses ':' on all platforms, but Windows uses ';'.
   This splits 'C:\Users\...' at the drive letter colon, producing
   garbage paths.

2. S_IXUSR check: stat() on Windows does not set Unix permission bits,
   so the executable check always fails even when the file exists.
   npm installs CLI shims as extensionless files (e.g. 'opencode',
   not 'opencode.exe'), which stat() finds but S_IXUSR rejects.

Fix: use ';' delimiter on Windows, and check only file existence
(stat() == 0) instead of S_IXUSR.

Tests: replaced SKIP("PATH search differs on Windows") with
cross-platform test cases that run on both Unix and Windows.

Fixes DeusData#159
@slvnlrt slvnlrt force-pushed the fix/windows-find-cli-path-delimiter branch from 4eeec46 to 4cc7890 Compare March 27, 2026 14:26
@slvnlrt slvnlrt marked this pull request as ready for review March 27, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working editor/integration Editor compatibility and CLI integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cbm_find_cli() fails on Windows: wrong PATH delimiter and S_IXUSR check

2 participants