Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/utils/agent-scaffold/create-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading