fix: skip onboarding wizard when extension provider already configured (#589)
Extension-based providers like pi-claude-cli may not require credentials in auth.json, causing shouldRunOnboarding() to always return true and repeat the wizard every launch. Now checks if a defaultProvider is already set in settings before triggering the wizard.
This commit is contained in:
parent
2042a30232
commit
17fbf7d925
3 changed files with 11 additions and 5 deletions
|
|
@ -6,6 +6,9 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Onboarding wizard no longer repeats every launch for extension-based providers (e.g. pi-claude-cli) that may not require credentials in auth.json
|
||||
|
||||
## [2.19.0] - 2026-03-16
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -130,8 +130,11 @@ const authStorage = AuthStorage.create(authFilePath)
|
|||
loadStoredEnvKeys(authStorage)
|
||||
migratePiCredentials(authStorage)
|
||||
|
||||
const modelRegistry = new ModelRegistry(authStorage)
|
||||
const settingsManager = SettingsManager.create(agentDir)
|
||||
|
||||
// Run onboarding wizard on first launch (no LLM provider configured)
|
||||
if (!isPrintMode && shouldRunOnboarding(authStorage)) {
|
||||
if (!isPrintMode && shouldRunOnboarding(authStorage, settingsManager.getDefaultProvider())) {
|
||||
await runOnboarding(authStorage)
|
||||
|
||||
// Clean up stdin state left by @clack/prompts.
|
||||
|
|
@ -156,9 +159,6 @@ if (!isPrintMode && process.stdout.columns && process.stdout.columns < 40) {
|
|||
)
|
||||
}
|
||||
|
||||
const modelRegistry = new ModelRegistry(authStorage)
|
||||
const settingsManager = SettingsManager.create(agentDir)
|
||||
|
||||
// --list-models: print available models and exit (no TTY needed)
|
||||
if (cliFlags.listModels !== undefined) {
|
||||
const models = modelRegistry.getAvailable()
|
||||
|
|
|
|||
|
|
@ -146,10 +146,13 @@ function isCancelError(p: ClackModule, err: unknown): boolean {
|
|||
*
|
||||
* Returns false (skip wizard) when:
|
||||
* - Any LLM provider is already available via auth.json, env vars, runtime overrides, or fallback auth
|
||||
* - A default provider is already configured in settings (covers extension-based providers
|
||||
* that may not require credentials in auth.json)
|
||||
* - Not a TTY (piped input, subagent, CI)
|
||||
*/
|
||||
export function shouldRunOnboarding(authStorage: AuthStorage): boolean {
|
||||
export function shouldRunOnboarding(authStorage: AuthStorage, settingsDefaultProvider?: string): boolean {
|
||||
if (!process.stdin.isTTY) return false
|
||||
if (settingsDefaultProvider) return false
|
||||
// Check if any LLM provider has credentials
|
||||
const hasLlmAuth = LLM_PROVIDER_IDS.some(id => authStorage.hasAuth(id))
|
||||
return !hasLlmAuth
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue