fix: Windows cross-platform support in CLI#281
Open
mperkins0155 wants to merge 2 commits into
Open
Conversation
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.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves cross-platform (notably Windows) compatibility for the CLI by updating command detection and making import.meta.url path resolution reliable on Windows.
Changes:
- Update
commandExiststo usewhereon Windows andcommand -velsewhere - Use
fileURLToPath(import.meta.url)when deriving repo/script directories to avoid Windows URL pathname issues
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/cli/src/install.ts | Switches command probing logic to be Windows-aware (where vs command -v) |
| packages/cli/lib/defaults.mjs | Fixes SCRIPT_DIR calculation using fileURLToPath for Windows-safe paths |
| packages/cli/bin/tinyagi.mjs | Fixes REPO_ROOT calculation using fileURLToPath for Windows-safe paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+27
to
+31
| const probe = process.platform === 'win32' | ||
| ? `where ${cmd}` | ||
| : `command -v ${cmd}`; | ||
| try { | ||
| execSync(`command -v ${cmd}`, { stdio: 'ignore' }); | ||
| execSync(probe, { stdio: 'ignore' }); |
`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) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes three Windows-only bugs that prevented the
tinyagiCLI from running on native Windows (non-WSL).1. Doubled drive letter →
MODULE_NOT_FOUNDnew URL('.', import.meta.url).pathnamereturns/C:/Users/...on Windows. Passing that topath.resolvemakes Node treat the leading/as the current drive root and prepend it, producingC:\C:\Users\...:Fixed by using
fileURLToPath()(correct on all platforms) in:packages/cli/bin/tinyagi.mjs(REPO_ROOT)packages/cli/lib/defaults.mjs(SCRIPT_DIR)2. False "Missing prerequisites: node, npm"
commandExists()ran the POSIX shell builtincommand -vviacmd.exe, which has no such command, so every check failed even with Node/npm installed. Now useswhereonwin32,command -velsewhere (packages/cli/src/install.ts).Testing
Verified on Windows 11, Node v25:
npm run build— cleantinyagi version/install(detects existing build) /agent list/provider list/statusstart/stop— API server onlocalhost:3777, SQLite queue + heartbeat, clean shutdownNo behavior change on macOS/Linux (
fileURLToPathand thecommand -vbranch are unchanged there).