Skip to content

feat(create-db): add JSON output support for regions command#77

Merged
aidankmcalister merged 1 commit intomainfrom
aman/regions-json-output
Feb 6, 2026
Merged

feat(create-db): add JSON output support for regions command#77
aidankmcalister merged 1 commit intomainfrom
aman/regions-json-output

Conversation

@AmanVarshney01
Copy link
Member

@AmanVarshney01 AmanVarshney01 commented Feb 6, 2026

Summary

  • add a dedicated RegionsFlags schema with --json (-j) support
  • wire regions command input through the router so help/docs include the flag
  • update handleRegions to print machine-readable JSON when --json is set
  • keep default human-readable regions output unchanged

Tests

  • npx vitest run __tests__/flags.test.ts __tests__/cli.test.ts __tests__/create.test.ts -t "regions" --reporter=verbose

Docs

  • update create-db/README.md with regions --json usage and output example

Summary by CodeRabbit

  • New Features

    • Added support for JSON output in the regions command using the --json flag, allowing structured region data retrieval.
  • Documentation

    • Updated with examples and guidance for JSON output when using the regions command.
  • Tests

    • Added test coverage for regions JSON output functionality and flag validation.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Walkthrough

The changes implement JSON output support for the regions CLI command through a new RegionsFlags schema with a --json option, updated handleRegions function to accept input parameters, and corresponding test coverage with documentation examples.

Changes

Cohort / File(s) Summary
Flags Definition
create-db/src/cli/flags.ts, create-db/__tests__/flags.test.ts
Introduces RegionsFlags zod schema with a json boolean flag (alias j, default false) and RegionsFlagsInput type; adds comprehensive test suite validating schema defaults and type inference.
Regions Command
create-db/src/cli/commands/regions.ts
Updates handleRegions function signature to accept RegionsFlagsInput parameter; adds conditional logic to output JSON via printJson when input.json is truthy, otherwise proceeds to formatted list output.
Router Configuration
create-db/src/index.ts
Expands imports and exports to include RegionsFlags and RegionsFlagsInput; updates regions route to apply RegionsFlags as input schema and pass input object to handleRegions handler.
Test Suite
create-db/__tests__/cli.test.ts, create-db/__tests__/create.test.ts
Adds assertion verifying regions help output includes --json option; introduces new test case validating regions --json produces parseable JSON array with region objects containing id and status fields.
Documentation
create-db/README.md
Expands JSON output section with explicit examples for regions --json invocation, resulting array structure, and new "List available regions as JSON" example under Regions section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(create-db): add JSON output support for regions command' directly and specifically describes the main change: adding JSON output support to the regions command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Preview CLIs & Workers are live!

Test the CLIs locally under tag pr77-aman-regions-json-output-21758026280:

npx create-db@pr77
npx create-pg@pr77
npx create-postgres@pr77

Worker URLs
• Create-DB Worker: https://create-db-temp.prisma.io
• Claim-DB Worker: https://create-db.prisma.io

These will live as long as this PR exists under tag pr77-aman-regions-json-output-21758026280.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 6, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
claim-db-worker f7530e8 Commit Preview URL

Branch Preview URL
Feb 06 2026, 04:36 PM

@aidankmcalister aidankmcalister merged commit 8221f62 into main Feb 6, 2026
6 checks passed
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.

2 participants