From b433c32db1fde671179e8c56856fcd01182022ed Mon Sep 17 00:00:00 2001 From: mperkins0155 <236283383+mperkins0155@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:44:59 -0500 Subject: [PATCH 1/2] fix: Windows cross-platform support in CLI Three Windows-only bugs prevented the CLI from running on native Windows (non-WSL): 1. Doubled drive letter (`C:\C:\Users\...` -> MODULE_NOT_FOUND). `new URL('.', import.meta.url).pathname` yields `/C:/...` on Windows, and `path.resolve` then prepends the cwd drive. Use `fileURLToPath()` instead, which is correct on all platforms. - packages/cli/bin/tinyagi.mjs (REPO_ROOT) - packages/cli/lib/defaults.mjs (SCRIPT_DIR) 2. "Missing prerequisites: node, npm" even when both are installed. `commandExists()` ran the POSIX builtin `command -v` through cmd.exe, which has no such command. Use `where` on win32, `command -v` elsewhere. - packages/cli/src/install.ts Verified on Windows 11 / Node 25: build, install detection, agent/provider list, and daemon start/stop (API on :3777) all work. --- packages/cli/bin/tinyagi.mjs | 3 ++- packages/cli/lib/defaults.mjs | 3 ++- packages/cli/src/install.ts | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/cli/bin/tinyagi.mjs b/packages/cli/bin/tinyagi.mjs index 0c81fe4f..6c900bff 100755 --- a/packages/cli/bin/tinyagi.mjs +++ b/packages/cli/bin/tinyagi.mjs @@ -3,6 +3,7 @@ import { execSync, spawn } from 'child_process'; import fs from 'fs'; import path from 'path'; +import { fileURLToPath } from 'url'; // ── Constants ──────────────────────────────────────────────────────────────── @@ -21,7 +22,7 @@ function log(color, msg) { process.stdout.write(`${color}${msg}${NC}\n`); } -const REPO_ROOT = path.resolve(new URL('.', import.meta.url).pathname, '../../..'); +const REPO_ROOT = path.resolve(fileURLToPath(new URL('.', import.meta.url)), '../../..'); const CLI_DIR = path.join(REPO_ROOT, 'packages/cli/dist'); // ── CLI Script Runner ──────────────────────────────────────────────────────── diff --git a/packages/cli/lib/defaults.mjs b/packages/cli/lib/defaults.mjs index 575bc6df..2f75fd39 100644 --- a/packages/cli/lib/defaults.mjs +++ b/packages/cli/lib/defaults.mjs @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; import os from 'os'; +import { fileURLToPath } from 'url'; const TINYAGI_HOME = process.env.TINYAGI_HOME || path.join(os.homedir(), '.tinyagi'); const SETTINGS_FILE = path.join(TINYAGI_HOME, 'settings.json'); @@ -40,7 +41,7 @@ function expandHome(p) { * Determine SCRIPT_DIR (repo root) — same logic as tinyagi.sh. * When running from packages/cli/lib/defaults.mjs, go up 3 levels. */ -const SCRIPT_DIR = path.resolve(new URL('.', import.meta.url).pathname, '../../..'); +const SCRIPT_DIR = path.resolve(fileURLToPath(new URL('.', import.meta.url)), '../../..'); function copyDirSync(src, dest) { fs.mkdirSync(dest, { recursive: true }); diff --git a/packages/cli/src/install.ts b/packages/cli/src/install.ts index 6f707444..032a13d9 100644 --- a/packages/cli/src/install.ts +++ b/packages/cli/src/install.ts @@ -24,8 +24,11 @@ function log(color: string, msg: string): void { } function commandExists(cmd: string): boolean { + const probe = process.platform === 'win32' + ? `where ${cmd}` + : `command -v ${cmd}`; try { - execSync(`command -v ${cmd}`, { stdio: 'ignore' }); + execSync(probe, { stdio: 'ignore' }); return true; } catch { return false; From 10750b37b9bc063a2b030330c13d52e8dc626f24 Mon Sep 17 00:00:00 2001 From: mperkins0155 <236283383+mperkins0155@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:49:28 -0500 Subject: [PATCH 2/2] fix(office): spawn npm with shell on Windows `tinyagi office` failed with `spawn npm ENOENT` on Windows because npm resolves to npm.cmd, which child_process.spawn can't find without a shell. Pass shell:true on win32 so the office dashboard launches. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/cli/bin/tinyagi.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/bin/tinyagi.mjs b/packages/cli/bin/tinyagi.mjs index 6c900bff..1d85364a 100755 --- a/packages/cli/bin/tinyagi.mjs +++ b/packages/cli/bin/tinyagi.mjs @@ -240,7 +240,7 @@ switch (command) { execSync(`cd "${officeDir}" && npm run build`, { stdio: 'inherit' }); } log(GREEN, 'Starting TinyOffice on http://localhost:3000'); - const child = spawn('npm', ['run', 'start'], { cwd: officeDir, stdio: 'inherit' }); + const child = spawn('npm', ['run', 'start'], { cwd: officeDir, stdio: 'inherit', shell: process.platform === 'win32' }); child.on('exit', (code) => process.exit(code || 0)); break; }