fixed: download template failed due to spaces in project name#14
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/commands/create.ts (1)
265-273:⚠️ Potential issue | 🟠 MajorSwitch to
execFilewith an argv array to fix Windows compatibility.This still breaks on Windows.
exec()usescmd.exeon Windows, which does not recognize single quotes ('...') for argument quoting—only double quotes ("). Arguments with spaces (like "My App") will still fail. To fix spaces reliably across all platforms, avoid shell parsing entirely by usingexecFilewith an argv array.Suggested fix
-import { exec } from 'node:child_process'; +import { execFile } from 'node:child_process'; ... -const execAsync = promisify(exec); +const execFileAsync = promisify(execFile); ... - const esc = (s: string) => `'${s.replace(/'/g, "'\\''")}'`; - const command = `npx create-insforge-app ${esc(targetDir)} --frame ${frame} --base-url ${esc(projectConfig.oss_host)} --anon-key ${esc(anonKey)} --skip-install`; + const cmd = process.platform === 'win32' ? 'npx.cmd' : 'npx'; + const args = [ + 'create-insforge-app', + targetDir, + '--frame', + frame, + '--base-url', + projectConfig.oss_host, + '--anon-key', + anonKey, + '--skip-install', + ]; ... - await execAsync(command, { + await execFileAsync(cmd, args, { maxBuffer: 10 * 1024 * 1024, cwd: tempDir, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/create.ts` around lines 265 - 273, The current use of execAsync with a shell-quoted command (variables: esc, command) breaks on Windows; replace this with a shell-free execFile call so arguments are passed as an argv array. Remove the manual quoting via esc and instead call execFile (or a promisified execFile) with executable "npx" and args ["create-insforge-app", targetDir, "--frame", frame, "--base-url", projectConfig.oss_host, "--anon-key", anonKey, "--skip-install"], preserving options {cwd: tempDir, maxBuffer: 10*1024*1024}; ensure you import or use the promisified execFile equivalent and update the call site that currently uses execAsync(command, ...).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/commands/create.ts`:
- Around line 265-273: The current use of execAsync with a shell-quoted command
(variables: esc, command) breaks on Windows; replace this with a shell-free
execFile call so arguments are passed as an argv array. Remove the manual
quoting via esc and instead call execFile (or a promisified execFile) with
executable "npx" and args ["create-insforge-app", targetDir, "--frame", frame,
"--base-url", projectConfig.oss_host, "--anon-key", anonKey, "--skip-install"],
preserving options {cwd: tempDir, maxBuffer: 10*1024*1024}; ensure you import or
use the promisified execFile equivalent and update the call site that currently
uses execAsync(command, ...).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d86f3825-bc30-468a-b8a9-e7326ff3ace2
📒 Files selected for processing (1)
src/commands/create.ts
Summary by CodeRabbit