Skip to content

Conversation

@7ttp
Copy link
Contributor

@7ttp 7ttp commented Jan 22, 2026

Summary

Fixes interactive prompts being written to output files when using stdout redirection with supabase gen types.

Problem

When running supabase gen types > types.ts, the interactive project reference prompt was being written to the output file instead of the terminal. This corrupted the generated TypeScript file with prompt text.

Solution

Interactive prompts now always write to stderr by passing tea.WithOutput(os.Stderr) to the Bubble Tea program in project_ref.go. This ensures prompts remain visible in the terminal while keeping stdout clean for piped output.

Related

@7ttp 7ttp requested a review from a team as a code owner January 22, 2026 06:29
if !term.IsTerminal(int(os.Stdout.Fd())) {
opts = append(opts, tea.WithOutput(os.Stderr))
}
return PromptProjectRef(ctx, "Select a project:", opts...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Interactive prompts should always be written to stderr. Can you double check the implementation of PromptProjectRef?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah aight, Fixed to always use stderr.
Removed the conditional and now always passing tea.WithOutput(os.Stderr).
PromptProjectRef correctly passes opts through to PromptChoice.
Tested with supabase gen types > file.ts and output is clean.

@7ttp 7ttp force-pushed the fix/parser-atomic-and-stdout branch from 5ef206a to 1ed55d0 Compare January 22, 2026 08:59
@7ttp 7ttp requested a review from sweatybridge January 23, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supabase CLI command to generate types failing

2 participants