Repository: vitejs/vite
File: packages/create-vite/src/index.ts (TypeScript)

Code before:
  }

  // Only prompt for immediate if not already determined
  if (immediate === undefined) {
    const immediateResult = await prompts.confirm({
      message: 'Install and start now?',
    })
    if (prompts.isCancel(immediateResult)) return cancel()
    immediate = immediateResult

    // If user wants immediate install, prompt for package manager
    if (immediate && !agent) {
      const agentResult = await prompts.select({
        message: 'Select a package manager:',
        options: [
          { label: 'npm', value: 'npm' },
          { label: 'yarn', value: 'yarn' },
          { label: 'pnpm', value: 'pnpm' },
          { label: 'bun', value: 'bun' },
        ],
        initialValue: pkgManager,
      })
      if (prompts.isCancel(agentResult)) return cancel()
      agent = agentResult
    }
  }

  const root = path.join(cwd, targetDir)
  fs.mkdirSync(root, { recursive: true })

  // determine template
  let isReactSwc = false
  if (template.includes('-swc')) {
    isReactSwc = true
    template = template.replace('-swc', '')
  }

  const { customCommand } =
    FRAMEWORKS.flatMap((f) => f.variants).find((v) => v.name === template) ?? {}

  if (customCommand) {
    const fullCustomCommand = getFullCustomCommand(customCommand, pkgInfo)

    const [command, ...args] = fullCustomCommand.split(' ')
    // we replace TARGET_DIR here because targetDir may include a space
    const replacedArgs = args.map((arg) =>
      arg.replace('TARGET_DIR', () => targetDir),
    )
    const { status } = spawn.sync(command, replacedArgs, {
      stdio: 'inherit',
    })

Review comment (suggestion):
```suggestion
  // 5. Ask about immediate install and package manager
  let immediate = argImmediate
  // If agent is specified but immediate is not explicitly set, default immediate to true
  if (argAgent && immediate === undefined) {
    immediate = true
  }
  if (immediate === undefined) {
    const immediateResult = await prompts.confirm({
      message: 'Install and start now?',
    })
    if (prompts.isCancel(immediateResult)) return cancel()
    immediate = immediateResult
  }

  const pkgManager = pkgInfo ? pkgInfo.name : 'npm'
  let agent = argAgent
  if (immediate && !agent) {
    const agentResult = await prompts.select({
      message: 'Select a package manager:',
      options: [
        { label: 'npm', value: 'npm' },
        { label: 'yarn', value: 'yarn' },
        { label: 'pnpm', value: 'pnpm' },
        { label: 'bun', value: 'bun' },
      ],
      initialValue: pkgManager,
    })
    if (prompts.isCancel(agentResult)) return cancel()
    agent = agentResult
  }
```

Code after:
            hint: command,
          }
        }),
      })
      if (prompts.isCancel(variant)) return cancel()

      template = variant
    } else {
      template = 'vanilla-ts'
    }
  }

  const pkgManager = pkgInfo ? pkgInfo.name : 'npm'

  // 5. Ask about immediate install and package manager
  let immediate = argImmediate
  if (immediate === undefined) {
    if (interactive) {
      const immediateResult = await prompts.confirm({
        message: `Install with ${pkgManager} and start now?`,
      })
      if (prompts.isCancel(immediateResult)) return cancel()
      immediate = immediateResult
    } else {
      immediate = false
    }
  }

  const root = path.join(cwd, targetDir)
  fs.mkdirSync(root, { recursive: true })

  // determine template
  let isReactSwc = false
  if (template.includes('-swc')) {
    isReactSwc = true
    template = template.replace('-swc', '')
  }

  const { customCommand } =
    FRAMEWORKS.flatMap((f) => f.variants).find((v) => v.name === template) ?? {}

  if (customCommand) {
    const fullCustomCommand = getFullCustomCommand(customCommand, pkgInfo)

    const [command, ...args] = fullCustomCommand.split(' ')
    // we replace TARGET_DIR here because targetDir may include a space
    const replacedArgs = args.map((arg) =>
      arg.replace('TARGET_DIR', () => targetDir),
    )
    const { status } = spawn.sync(command, replacedArgs, {
      stdio: 'inherit',