Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix: WSL/Unix compatibility improvements
trohitgf0db051c1c3b
diff --git a/bin/cli.js b/bin/cli.jsold mode 100644new mode 100755diff --git a/install.sh b/install.shold mode 100644new mode 100755index 6c1ea196..550e32bb--- a/install.sh+++ b/install.sh@@ -57,29 +57,52 @@ is_wsl() {[[ -n "$WSL_DISTRO_NAME" ]] || [[ -n "$WSL_INTEROP" ]] || grep -qi microsoft /proc/version 2>/dev/null}-# Configure npm for WSL (use Linux-native path instead of Windows mount)+# Configure npm for WSL (fix nvm conflicts and Windows paths)setup_wsl_npm() {- if is_wsl; then- local npm_prefix- npm_prefix=$(npm config get prefix 2>/dev/null || echo "")-- # Check if npm is using Windows path (/mnt/c/...)- if [[ "$npm_prefix" == /mnt/* ]]; then- info "WSL detected: Configuring npm to use Linux-native path..."- mkdir -p "$HOME/.npm-global"- npm config set prefix "$HOME/.npm-global"- export PATH="$HOME/.npm-global/bin:$PATH"-- # Add to .bashrc if not already there- if ! grep -q 'npm-global' "$HOME/.bashrc" 2>/dev/null; then- echo '' >> "$HOME/.bashrc"- echo '# npm global packages (WSL)' >> "$HOME/.bashrc"- echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> "$HOME/.bashrc"- info "Added npm-global to PATH in ~/.bashrc"- fi+ if ! is_wsl; then+ return 0+ fi++ info "WSL detected: Checking npm configuration..."++ # If using nvm, remove any conflicting prefix from .npmrc+ if [[ -n "$NVM_DIR" ]] || [[ -d "$HOME/.nvm" ]]; then+ if grep -q '^prefix=' "$HOME/.npmrc" 2>/dev/null; then+ info "Removing conflicting npm prefix (nvm detected)..."+ sed -i '/^prefix=/d' "$HOME/.npmrc"+ # Also remove globalconfig if present+ sed -i '/^globalconfig=/d' "$HOME/.npmrc" 2>/dev/null || true+ fi- success "npm configured for WSL"+ # Source nvm to ensure proper paths+ export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"+ if [[ -s "$NVM_DIR/nvm.sh" ]]; then+ source "$NVM_DIR/nvm.sh"fi++ success "npm configured for nvm on WSL"+ return 0+ fi++ # No nvm - check if npm is using Windows path+ local npm_prefix+ npm_prefix=$(npm config get prefix 2>/dev/null || echo "")++ if [[ "$npm_prefix" == /mnt/* ]]; then+ info "Configuring npm to use Linux-native path..."+ mkdir -p "$HOME/.npm-global"+ npm config set prefix "$HOME/.npm-global"+ export PATH="$HOME/.npm-global/bin:$PATH"++ # Add to .bashrc if not already there+ if ! grep -q 'npm-global' "$HOME/.bashrc" 2>/dev/null; then+ echo '' >> "$HOME/.bashrc"+ echo '# npm global packages (WSL)' >> "$HOME/.bashrc"+ echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> "$HOME/.bashrc"+ info "Added npm-global to PATH in ~/.bashrc"+ fi++ success "npm configured for WSL"fi}diff --git a/package.json b/package.jsonindex d5d55a96..07319f6f 100644--- a/package.json+++ b/package.json@@ -35,6 +35,7 @@"files": ["bin/","scripts/",+ "workflows/","client/src/","client/public/","client/dist/",diff --git a/scripts/build.js b/scripts/build.jsold mode 100644new mode 100755diff --git a/scripts/clean.js b/scripts/clean.jsold mode 100644new mode 100755diff --git a/scripts/daemon.js b/scripts/daemon.jsold mode 100644new mode 100755diff --git a/scripts/docker.js b/scripts/docker.jsold mode 100644new mode 100755diff --git a/scripts/install.js b/scripts/install.jsold mode 100644new mode 100755diff --git a/scripts/postinstall.js b/scripts/postinstall.jsold mode 100644new mode 100755index b3f6d0a5..c2299ac4--- a/scripts/postinstall.js+++ b/scripts/postinstall.js@@ -8,10 +8,36 @@import { spawn } from 'child_process';import { resolve, dirname } from 'path';import { fileURLToPath } from 'url';+import { existsSync, chmodSync } from 'fs';const __dirname = dirname(fileURLToPath(import.meta.url));const ROOT = resolve(__dirname, '..');+// Fix executable permissions on Unix (npm doesn't preserve them from git)+function fixPermissions() {+ if (process.platform === 'win32') return;++ const files = [+ resolve(ROOT, 'bin/cli.js'),+ resolve(ROOT, 'scripts/start.js'),+ resolve(ROOT, 'scripts/stop.js'),+ resolve(ROOT, 'scripts/build.js'),+ resolve(ROOT, 'scripts/clean.js'),+ resolve(ROOT, 'scripts/install.js'),+ resolve(ROOT, 'install.sh'),+ ];++ for (const file of files) {+ if (existsSync(file)) {+ try {+ chmodSync(file, 0o755);+ } catch (e) {+ // Ignore permission errors+ }+ }+ }+}+const isCI = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';if (isCI) {@@ -46,6 +72,9 @@ function runScript(scriptPath) {async function main() {try {+ // Fix executable permissions on Unix+ fixPermissions();+// Run full installationconsole.log('Installing dependencies...');await runScript(resolve(__dirname, 'install.js'));diff --git a/scripts/serve-client.js b/scripts/serve-client.jsold mode 100644new mode 100755diff --git a/scripts/start.js b/scripts/start.jsold mode 100644new mode 100755diff --git a/scripts/stop.js b/scripts/stop.jsold mode 100644new mode 100755diff --git a/scripts/sync-version.js b/scripts/sync-version.jsold mode 100644new mode 100755