From 077527304ea9b1490031a53a983b97570c4178b0 Mon Sep 17 00:00:00 2001 From: Developers Digest <124798203+developersdigest@users.noreply.github.com> Date: Thu, 16 Apr 2026 09:47:21 -0400 Subject: [PATCH] Update create-flow.ts --- src/utils/agent-scaffold/create-flow.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/agent-scaffold/create-flow.ts b/src/utils/agent-scaffold/create-flow.ts index 6ffaa4b59..2f998e921 100644 --- a/src/utils/agent-scaffold/create-flow.ts +++ b/src/utils/agent-scaffold/create-flow.ts @@ -187,6 +187,22 @@ export async function handleCreate( process.exit(1); } + // If the user passed exactly one --key but no --provider, assume they + // want that provider as the default. Matches the common "I have one key, + // just set it up" mental model. + if (!selectedProvider && options.key?.length) { + const flagKeys = parseKeyFlags(options.key); + const providerEnvVars = new Map( + availableProviders.map((p) => [p.envVar, p.id]) + ); + const matched = Object.keys(flagKeys) + .map((envVar) => providerEnvVars.get(envVar)) + .filter((id): id is string => !!id); + if (matched.length === 1) { + selectedProvider = getSelectedProvider(availableProviders, matched[0]); + } + } + if (!selectedProvider) { if (process.stdin.isTTY) { const providerId = await select({