Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Windows

on:
workflow_call:
workflow_dispatch:
push:
branches: [main]

jobs:
build:
name: Build Windows x86_64
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install

- name: Build Tauri app
run: bun run tauri build --target x86_64-pc-windows-msvc

- name: Create artifacts directory
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist/windows-x86_64 | Out-Null
Copy-Item src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe dist/windows-x86_64/ -ErrorAction SilentlyContinue
Copy-Item src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi dist/windows-x86_64/ -ErrorAction SilentlyContinue

# Generate checksums
Get-ChildItem dist/windows-x86_64 -File | ForEach-Object {
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
"$hash $($_.Name)" | Out-File -Append -Encoding ascii dist/windows-x86_64/checksums.txt
}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-x86_64
path: dist/windows-x86_64/*
56 changes: 53 additions & 3 deletions src-tauri/src/claude_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ fn try_which_command() -> Option<ClaudeInstallation> {
fn try_which_command() -> Option<ClaudeInstallation> {
debug!("Trying 'where claude' to find binary...");

match Command::new("where").arg("claude").output() {
let mut cmd = Command::new("where");
cmd.arg("claude");
suppress_console_window_std(&mut cmd);

match cmd.output() {
Ok(output) if output.status.success() => {
let output_str = String::from_utf8_lossy(&output.stdout).trim().to_string();

Expand Down Expand Up @@ -481,7 +485,10 @@ fn find_standard_installations() -> Vec<ClaudeInstallation> {
}

// Also check if claude is available in PATH (without full path)
if let Ok(output) = Command::new("claude.exe").arg("--version").output() {
let mut path_check_cmd = Command::new("claude.exe");
path_check_cmd.arg("--version");
suppress_console_window_std(&mut path_check_cmd);
if let Ok(output) = path_check_cmd.output() {
if output.status.success() {
debug!("claude.exe is available in PATH");
let version = extract_version_from_output(&output.stdout);
Expand All @@ -500,7 +507,11 @@ fn find_standard_installations() -> Vec<ClaudeInstallation> {

/// Get Claude version by running --version command
fn get_claude_version(path: &str) -> Result<Option<String>, String> {
match Command::new(path).arg("--version").output() {
let mut cmd = Command::new(path);
cmd.arg("--version");
suppress_console_window_std(&mut cmd);

match cmd.output() {
Ok(output) => {
if output.status.success() {
Ok(extract_version_from_output(&output.stdout))
Expand Down Expand Up @@ -616,6 +627,43 @@ fn compare_versions(a: &str, b: &str) -> Ordering {
Ordering::Equal
}

/// Windows process creation flag that prevents a console window from being
/// allocated for the child process. Without this, every spawn of the Claude
/// CLI (and any console subprocess it spawns in turn, e.g. an MCP server)
/// flashes a visible CMD window on top of the app.
#[cfg(target_os = "windows")]
const CREATE_NO_WINDOW: u32 = 0x08000000;

/// Configures a tokio [`Command`](tokio::process::Command) to not open a
/// visible console window when spawned on Windows. No-op on other platforms.
/// Does not affect stdout/stderr piping - `Stdio::piped()` is independent of
/// console window allocation.
pub fn suppress_console_window(cmd: &mut tokio::process::Command) {
#[cfg(target_os = "windows")]
{
cmd.creation_flags(CREATE_NO_WINDOW);
}
#[cfg(not(target_os = "windows"))]
{
let _ = cmd;
}
}

/// Same as [`suppress_console_window`] but for a plain `std::process::Command`,
/// used by the short-lived binary-detection commands below (`where`,
/// `--version`) which also run on every prompt via `find_claude_binary`.
fn suppress_console_window_std(cmd: &mut Command) {
#[cfg(target_os = "windows")]
{
use std::os::windows::process::CommandExt;
cmd.creation_flags(CREATE_NO_WINDOW);
}
#[cfg(not(target_os = "windows"))]
{
let _ = cmd;
}
}

/// Helper function to create a Command with proper environment variables
/// This ensures commands like Claude can find Node.js and other dependencies
pub fn create_command_with_env(program: &str) -> Command {
Expand Down Expand Up @@ -689,5 +737,7 @@ pub fn create_command_with_env(program: &str) -> Command {
}
}

suppress_console_window_std(&mut cmd);

cmd
}
2 changes: 2 additions & 0 deletions src-tauri/src/commands/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,8 @@ fn create_command_with_env(program: &str) -> Command {
tokio_cmd.env("PATH", "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin");
}

crate::claude_binary::suppress_console_window(&mut tokio_cmd);

tokio_cmd
}

Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/commands/claude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ fn create_command_with_env(program: &str) -> Command {
}
}

crate::claude_binary::suppress_console_window(&mut tokio_cmd);

tokio_cmd
}

Expand Down
3 changes: 3 additions & 0 deletions src-tauri/src/web_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ async fn execute_claude_command(
cmd.current_dir(&project_path);
cmd.stdout(std::process::Stdio::piped());
cmd.stderr(std::process::Stdio::piped());
crate::claude_binary::suppress_console_window(&mut cmd);

println!(
"[TRACE] Command: {} {:?} (in dir: {})",
Expand Down Expand Up @@ -609,6 +610,7 @@ async fn continue_claude_command(
cmd.current_dir(&project_path);
cmd.stdout(std::process::Stdio::piped());
cmd.stderr(std::process::Stdio::piped());
crate::claude_binary::suppress_console_window(&mut cmd);

// Spawn and stream output
let mut child = cmd
Expand Down Expand Up @@ -698,6 +700,7 @@ async fn resume_claude_command(
cmd.current_dir(&project_path);
cmd.stdout(std::process::Stdio::piped());
cmd.stderr(std::process::Stdio::piped());
crate::claude_binary::suppress_console_window(&mut cmd);

println!(
"[resume_claude_command] Command: {} {:?} (in dir: {})",
Expand Down
4 changes: 3 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
"rpm",
"appimage",
"app",
"dmg"
"dmg",
"msi",
"nsis"
],
"icon": [
"icons/32x32.png",
Expand Down
1 change: 1 addition & 0 deletions src/components/AgentExecution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface ClaudeStreamMessage {
type: "system" | "assistant" | "user" | "result";
subtype?: string;
message?: {
id?: string;
content?: any[];
usage?: {
input_tokens: number;
Expand Down
Loading