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
28 changes: 27 additions & 1 deletion packages/openui-cli/src/commands/create-chat-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,33 @@ export async function runCreateChatApp(options: CreateChatAppOptions): Promise<v
? "bun"
: "npm";

console.info(getStartedMessage(name, devCmd));
if (!options.noInteractive) {
const apiKeyArgs = await resolveArgs(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolveOne was meant as a utility for when the value can be passed from both the cli as flags and in interactive mode. Since we don't want this in non-interactive mode or a flag for this, you can directly use inquirer here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Also, this can be reorganized into a fn in the lib/ folder to clean up the command and keep it as a high-level orchestrator.

Copy link
Contributor

@AbhinRustagi AbhinRustagi Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a merge conflict to be resolved with the skill option.

I think it can be extended to a 3-step scenario

  • Ask for OpenAI SDK BaseUrl (read a comment/issue about someone using OpenRouter, I personally used Gemini) (default value can be something like "Use OpenAI")
  • (If they add a custom url) Ask for model name
  • Ask for Api Key

Wdyt?

Drawbacks: prolongs the setup process

{
openaiApiKey: {
prompt: {
type: "input",
message: "Enter your OpenAI API key (leave blank to skip):",
},
required: true,
},
},
true,
);

const apiKey = (apiKeyArgs as { openaiApiKey: string }).openaiApiKey.trim();

if (apiKey) {
const envPath = path.join(targetDir, ".env");
fs.writeFileSync(envPath, `OPENAI_API_KEY=${apiKey}\n`);
console.info("\n✅ .env file created with your API key.\n");
console.info(`Get started:\n\ncd ${name}\n${devCmd} run dev\n`);
} else {
console.info(getStartedMessage(name, devCmd));
}
} else {
console.info(getStartedMessage(name, devCmd));
}
}

const getStartedMessage = (name: string, devCmd: string) =>
Expand Down