Skip to content

Conversation

@tarunerror
Copy link

User description

Summary

This PR adds full Windows compatibility for OpenCode CLI detection and improves cross-platform support.

Changes

Rust Backend (src-tauri/src/lib.rs)

  • OpenCode executable detection: Now searches for .exe, .cmd, and .bat extensions on Windows
  • npm global path: Added %APPDATA%\npm to search paths for npm-installed OpenCode
  • Config path resolution: Added APPDATA and USERPROFILE environment variable fallbacks for Windows
  • Error messages: Platform-specific install instructions (npm on Windows, brew on macOS)

Frontend (src/App.tsx)

  • Browser extension path: Shows Windows-style path (%USERPROFILE%\.opencode-browser\extension) on Windows
  • Error messages: Platform-aware error messages with appropriate install commands
  • Install UI: Shows npm install -g opencode-ai on Windows, brew install on macOS/Linux

CI/CD (.github/workflows/build-all-platforms.yml)

  • New GitHub Actions workflow to build for all platforms:
    • Windows (x64)
    • macOS Intel (x64)
    • macOS Apple Silicon (ARM64)
    • Linux (x64)

Testing

  • Built and tested on Windows 11
  • OpenCode CLI detection works with npm-installed opencode.cmd
  • All existing macOS/Linux paths remain unchanged

Related Issues

Fixes Windows compatibility issues where OpenCode CLI installed via npm was not detected.


PR Type

Enhancement, Documentation


Description

  • Add full Windows compatibility for OpenCode CLI detection with support for .exe, .cmd, and .bat extensions

  • Implement Windows npm global path (%APPDATA%\npm) to search paths for npm-installed OpenCode

  • Add Windows environment variable fallbacks (APPDATA, USERPROFILE) for config path resolution

  • Display platform-specific install instructions (npm on Windows, brew on macOS/Linux) in error messages

  • Update frontend UI to show Windows-style paths (%USERPROFILE%\.opencode-browser\extension) on Windows

  • Add multi-platform CI/CD GitHub Actions workflow supporting Windows (x64), macOS Intel (x64), macOS Apple Silicon (ARM64), and Linux (x64)

  • Add Windows capability schema for Tauri permissions configuration

  • Simplify release process documentation in AGENTS.md


Diagram Walkthrough

flowchart LR
  A["Windows Detection"] -->|"Platform Check"| B["Platform-Specific Paths"]
  A -->|"Environment Variables"| C["Config Resolution"]
  B -->|"npm path"| D["OpenCode CLI Detection"]
  B -->|"UI Messages"| E["Frontend Display"]
  C -->|"APPDATA/USERPROFILE"| D
  D -->|"Multi-platform Build"| F["CI/CD Workflow"]
  F -->|"Windows/macOS/Linux"| G["Release Artifacts"]
Loading

File Walkthrough

Relevant files
Enhancement
lib.rs
Windows compatibility for OpenCode CLI detection and config paths

src-tauri/src/lib.rs

  • Changed OPENCODE_EXECUTABLE constant to OPENCODE_EXECUTABLES array
    supporting .exe, .cmd, and .bat extensions on Windows
  • Updated resolve_in_path() to accept multiple executable names and
    search for all variants
  • Added Windows npm global path (%APPDATA%\npm) to candidate OpenCode
    paths
  • Enhanced resolve_opencode_config_path() to support Windows environment
    variables (APPDATA, USERPROFILE) for config directory resolution
  • Updated error messages in engine_start() to show platform-specific
    install instructions (npm for Windows, brew for macOS/Linux)
  • Applied consistent code formatting and indentation throughout the file
+469/-437
App.tsx
Platform-aware UI messages and Windows path handling         

src/App.tsx

  • Added platform detection using navigator.platform.includes("Win") to
    show Windows-specific paths and install instructions
  • Updated browser extension path to show
    %USERPROFILE%\.opencode-browser\extension on Windows instead of
    ~/.opencode-browser/extension
  • Modified error messages to display npm install -g opencode-ai on
    Windows and brew install on other platforms
  • Applied extensive code formatting improvements with better line breaks
    and indentation for readability
+686/-210
Configuration changes
build-all-platforms.yml
Multi-platform CI/CD build workflow for all targets           

.github/workflows/build-all-platforms.yml

  • New GitHub Actions workflow for building OpenWork across multiple
    platforms
  • Supports Windows (x64), macOS Intel (x64), macOS Apple Silicon
    (ARM64), and Linux (x64)
  • Includes platform-specific setup steps (Linux dependencies, Rust
    toolchain targets)
  • Automatically creates GitHub releases with platform-specific artifacts
    and download instructions
+111/-0 
settings.local.json
Claude local development settings configuration                   

.claude/settings.local.json

  • New local Claude settings file with permission configuration
  • Grants permissions for Bash, Write, and Edit MCP tools
+9/-0     
windows-schema.json
Add Windows capability schema for Tauri permissions           

src-tauri/gen/schemas/windows-schema.json

  • Added comprehensive JSON schema file for Windows capability
    configuration
  • Defines capability file format with support for single capabilities,
    arrays, and objects
  • Includes extensive permission definitions for core plugins (app,
    event, image, menu, path, resources, tray, webview, window, dialog)
  • Supports platform-specific targeting and remote URL configuration
+2310/-0
Documentation
AGENTS.md
Simplify release process documentation                                     

AGENTS.md

  • Simplified release process documentation by reducing version bump
    requirements
  • Clarified that only package.json needs mandatory updates (with
    Tauri/Rust versions kept in sync)
  • Streamlined release steps from 4 to 3 main steps
  • Updated verification commands to use consistent formatting with
    backticks
+8/-11   

Summary by CodeRabbit

  • New Features

    • Enhanced cross-platform support with Windows-specific installation guidance for missing dependencies
  • Bug Fixes

    • Improved OpenCode CLI detection across multiple standard locations
    • Enhanced error handling and state management in engine lifecycle
  • Documentation

    • Updated release process documentation for multi-platform builds

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

- Support .cmd and .bat extensions for npm-installed OpenCode on Windows
- Add %APPDATA%\npm to search paths for Windows npm global installs
- Add APPDATA and USERPROFILE fallbacks for config path resolution
- Show Windows-specific install instructions (npm install -g opencode-ai)
- Update UI to show platform-appropriate paths and commands
- Add GitHub Actions workflow for building on all platforms (Windows, macOS, Linux)
- Support .cmd and .bat extensions for npm-installed OpenCode on Windows
- Add %APPDATA%\npm to search paths for Windows npm global installs
- Add APPDATA and USERPROFILE fallbacks for config path resolution
- Show Windows-specific install instructions (npm install -g opencode-ai)
- Update UI to show platform-appropriate paths and commands
- Add GitHub Actions workflow for building on all platforms
feat: Add Windows compatibility for OpenCode CLI detection
@benjaminshafii
Copy link
Member

Thanks for tackling Windows support — we really want OpenWork to work smoothly on Windows.

Before we can merge, could you please:

  1. Share a short screen recording on Windows (Loom/MP4 is fine) showing:

    • installing OpenCode via npm install -g opencode-ai
    • OpenWork successfully detects opencode and starts the engine
  2. Rebase on the latest main and resolve the merge conflicts (GitHub currently marks this PR as conflicting).

  3. Keep the PR tightly scoped to “Windows capability”:

    • remove .claude/settings.local.json (local config shouldn’t be committed)
    • consider splitting out the new workflow / large generated schema changes unless they’re required for Windows detection
    • avoid formatting-only churn so the functional changes are easy to review
  4. Confirm that if we detect opencode.cmd/.bat, it can be executed reliably from Rust (often requires invoking cmd.exe /C ...), or adjust the implementation accordingly.

Thank you again — happy to re-review quickly after an update.

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.

2 participants