From 737b6111e09f7a4ca65bdf9131ce7c8ee2b5b25d Mon Sep 17 00:00:00 2001 From: Prateek Date: Mon, 16 Feb 2026 15:12:23 +0530 Subject: [PATCH] fix: resolve variable scope issue in init command validation - Move path variable outside if block to fix TypeScript scope error - Only validate path existence if projectId is provided - Use inline tilde expansion instead of missing expandHome import Fixes build error that prevented setup.sh from completing. Co-Authored-By: Claude Sonnet 4.5 --- packages/cli/src/commands/init.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 05289f21c..8ad063f6d 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -268,9 +268,10 @@ export function registerInit(program: Command): void { projects: {} as Record, }; + let projectPath = ""; if (projectId) { const repo = await prompt(rl, "GitHub repo (owner/repo)", env.ownerRepo || ""); - const path = await prompt( + projectPath = await prompt( rl, "Local path to repo", env.isGitRepo ? workingDir : `~/${projectId}`, @@ -290,7 +291,7 @@ export function registerInit(program: Command): void { const projectConfig: Record = { repo, - path, + path: projectPath, defaultBranch, }; @@ -324,7 +325,14 @@ export function registerInit(program: Command): void { { name: "Git", pass: (await execSilent("git", ["--version"])) !== null }, { name: "tmux", pass: env.hasTmux }, { name: "GitHub CLI", pass: env.hasGh }, - { name: "Repo path exists", pass: existsSync(expandHome(path)) }, + ...(projectPath + ? [ + { + name: "Repo path exists", + pass: existsSync(projectPath.replace(/^~/, process.env.HOME || "")), + }, + ] + : []), ]; for (const { name, pass } of checks) {