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 <noreply@anthropic.com>
This commit is contained in:
parent
239f07c1e2
commit
737b6111e0
|
|
@ -268,9 +268,10 @@ export function registerInit(program: Command): void {
|
|||
projects: {} as Record<string, unknown>,
|
||||
};
|
||||
|
||||
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<string, unknown> = {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue