Merge pull request #117 from GiGiDKR/feature/windows-support

feat(platform): Improve cross-platform compatibility with Windows support
This commit is contained in:
viper151
2025-08-06 18:30:45 +02:00
committed by GitHub
6 changed files with 1819 additions and 1285 deletions

View File

@@ -7,6 +7,6 @@
# Backend server port (Express API + WebSocket server)
#API server
PORT=3008
PORT=3001
#Frontend port
VITE_PORT=3009
VITE_PORT=5173

1462
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,13 +39,14 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cors": "^2.8.5",
"cross-spawn": "^7.0.3",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.2",
"lucide-react": "^0.515.0",
"mime-types": "^3.0.1",
"multer": "^2.0.1",
"node-fetch": "^2.7.0",
"node-pty": "^1.0.0",
"node-pty": "^1.1.0-beta34",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
@@ -67,4 +68,4 @@
"tailwindcss": "^3.4.0",
"vite": "^7.0.4"
}
}
}

View File

@@ -1,8 +1,12 @@
import { spawn } from 'child_process';
import crossSpawn from 'cross-spawn';
import { promises as fs } from 'fs';
import path from 'path';
import os from 'os';
// Use cross-spawn on Windows for better command execution
const spawnFunction = process.platform === 'win32' ? crossSpawn : spawn;
let activeClaudeProcesses = new Map(); // Track active processes by session ID
async function spawnClaude(command, options = {}, ws) {
@@ -23,7 +27,11 @@ async function spawnClaude(command, options = {}, ws) {
// Add print flag with command if we have a command
if (command && command.trim()) {
args.push('--print', `"${command.replace(/"/g, '\\"')}"`);
// Separate arguments for better cross-platform compatibility
// This prevents issues with spaces and quotes on Windows
args.push('--print');
args.push(command);
}
// Use cwd (actual project directory) instead of projectPath (Claude's metadata directory)
@@ -63,9 +71,9 @@ async function spawnClaude(command, options = {}, ws) {
const imageNote = `\n\n[Images provided at the following paths:]\n${tempImagePaths.map((p, i) => `${i + 1}. ${p}`).join('\n')}`;
const modifiedCommand = command + imageNote;
// Update the command in args
// Update the command in args - now that --print and command are separate
const printIndex = args.indexOf('--print');
if (printIndex !== -1 && args[printIndex + 1] === command) {
if (printIndex !== -1 && printIndex + 1 < args.length && args[printIndex + 1] === command) {
args[printIndex + 1] = modifiedCommand;
}
}
@@ -227,7 +235,7 @@ async function spawnClaude(command, options = {}, ws) {
console.log('🔍 Full command args:', JSON.stringify(args, null, 2));
console.log('🔍 Final Claude command will be: claude ' + args.join(' '));
const claudeProcess = spawn('claude', args, {
const claudeProcess = spawnFunction('claude', args, {
cwd: workingDir,
stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env } // Inherit all environment variables

File diff suppressed because it is too large Load Diff

View File

@@ -9,11 +9,11 @@ export default defineConfig(({ command, mode }) => {
return {
plugins: [react()],
server: {
port: parseInt(env.VITE_PORT) || 3001,
port: parseInt(env.VITE_PORT) || 5173,
proxy: {
'/api': `http://localhost:${env.PORT || 3002}`,
'/api': `http://localhost:${env.PORT || 3001}`,
'/ws': {
target: `ws://localhost:${env.PORT || 3002}`,
target: `ws://localhost:${env.PORT || 3001}`,
ws: true
},
'/shell': {