Skip to content

Add database type step (SQLite/Postgres) to create-app wizard - #6

Draft
surajair wants to merge 1 commit into
mainfrom
claude/db-type-selection-step-9urs83
Draft

Add database type step (SQLite/Postgres) to create-app wizard#6
surajair wants to merge 1 commit into
mainfrom
claude/db-type-selection-step-9urs83

Conversation

@surajair

Copy link
Copy Markdown
Contributor

Introduce a new "Database type" prompt before the existing SQLite config
step. Choosing PostgreSQL collects a connection URL (validated for a
postgres:// or postgresql:// shape) and pulls the template from the
postgres branch instead of main. SQLite keeps its existing local/
remote flow unchanged.

  • Add chooseDatabaseType step and wire it into the flow
  • Widen DbChoice to 'sqlite' | 'postgres'
  • Resolve template branch per db choice via templateSource()
  • Skip the SQLite config step when postgres is chosen
  • Add postgres URL validator and tests

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Mq5yZj1buYYbGUr1qDDSS3

Introduce a new "Database type" prompt before the existing SQLite config
step. Choosing PostgreSQL collects a connection URL (validated for a
postgres:// or postgresql:// shape) and pulls the template from the
`postgres` branch instead of `main`. SQLite keeps its existing local/
remote flow unchanged.

- Add chooseDatabaseType step and wire it into the flow
- Widen DbChoice to 'sqlite' | 'postgres'
- Resolve template branch per db choice via templateSource()
- Skip the SQLite config step when postgres is chosen
- Add postgres URL validator and tests

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mq5yZj1buYYbGUr1qDDSS3

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the create-app wizard to support choosing a database type (SQLite vs PostgreSQL) up front. PostgreSQL selection collects a connection URL, validates it, skips the SQLite configuration step, and downloads the app template from the postgres branch; SQLite continues to use the existing local/remote flow and pulls from main.

Changes:

  • Added a new chooseDatabaseType step to prompt for SQLite vs PostgreSQL and (for PostgreSQL) collect/validate the connection URL.
  • Updated template download logic to resolve the template branch based on the selected database type.
  • Added URL validation helper for PostgreSQL and expanded test coverage for the new flow.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/steps/download-template.test.ts Verifies correct template source (#main for SQLite, #postgres for PostgreSQL).
tests/steps/choose-database.test.ts Ensures SQLite step is a no-op when PostgreSQL was chosen earlier.
tests/steps/choose-database-type.test.ts Adds coverage for database type selection, URL capture/dequoting, validation, and cancel handling.
tests/lib/postgres-url.test.ts Adds unit tests for PostgreSQL URL shape validation.
tests/commands/create-app.test.ts Updates wizard prompt scripts for new step; adds end-to-end PostgreSQL flow assertions.
src/steps/download-template.ts Switches template download source to be computed from the selected database type.
src/steps/choose-database.ts Skips SQLite configuration when PostgreSQL is selected.
src/steps/choose-database-type.ts Implements new wizard step to select DB type and collect PostgreSQL URL.
src/lib/postgres-url.ts Introduces validatePostgresUrlShape helper to validate postgres:// / postgresql:// URLs with hostname.
src/core/context.ts Expands DbChoice to `'sqlite'
src/constants.ts Adds templateSource(dbChoice) and per-db template branch mapping.
src/commands/create-app-run.ts Wires chooseDatabaseType into the create-app step sequence before SQLite configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@surajair
surajair marked this pull request as draft July 20, 2026 04:01
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.

3 participants