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
5 changes: 3 additions & 2 deletions packages/cli/bin/tinyagi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { execSync, spawn } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

// ── Constants ────────────────────────────────────────────────────────────────

Expand All @@ -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 ────────────────────────────────────────────────────────
Expand Down Expand Up @@ -239,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;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/lib/defaults.mjs
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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 });
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Comment on lines +27 to +31
return true;
} catch {
return false;
Expand Down