Skip to content

Add --json flag to db connect #60

Closed

Description

@TrivCodez

Description

db connect outputs a plain text connection string. Adding --json would output {"connectionString": "...", "branch": "...", "pooled": false} for programmatic use.

Location

src/commands/connect.ts

Reference pattern

See db branch inspect in branch.ts line 279-280 for how --json is implemented:

.option("--json", "Output as JSON")

And in the action:

if (options.json) {
  console.log(JSON.stringify({ ... }, null, 2));
  return;
}

What to do

  1. Add .option("--json", "Output as JSON") to the command
  2. In the action, check options.json and output a JSON object with connectionString, branch, pooled, host, port fields instead of the plain text

Acceptance criteria

  • db connect --json outputs valid JSON
  • db connect my-branch --json includes branch name in JSON
  • db connect --pooled --json shows pooled: true
  • npm run build passes with no errors

⏰ This issue must be claimed and completed within 1 week. If not, it will be automatically done in the next release.

Labels

good first issue, help wanted, enhancement

Activity

  1. added
    good first issue
    help wanted
    enhancement
    on Jul 20, 2026
  2. TrivCodez commented on Jul 21, 2026

    @TrivCodez
    ContributorAuthor

    Hey @SankeerthNara @jordansilly77-stack 👋

    I've already contributed a bit to the repo and was looking through the open issues. This one (#60 — Add --json flag to db connect) is tagged as both a good first issue and help wanted, so I wanted to check if either of you have any interest in picking it up.

    If you're free and keen, happy to help review or offer pointers. Just want to keep the momentum going on this project — it's a great CLI and there's a lot of low-hanging fruit here that would make a real difference.

    No pressure at all — just putting it out there!

  3. SankeerthNara commented on Jul 22, 2026

    @SankeerthNara
    Contributor

    Could you assign this to me

  4. SankeerthNara commented on Jul 22, 2026

    @SankeerthNara
    Contributor

    Hey @TrivCodez , Is there anything else you want me to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions