Skip to content

Add --project-id/--org-id/--branch-id to neon init - #426

Closed
jeff-at-neon wants to merge 1 commit into
mainfrom
feat/init-existing-project-ids
Closed

Add --project-id/--org-id/--branch-id to neon init#426
jeff-at-neon wants to merge 1 commit into
mainfrom
feat/init-existing-project-ids

Conversation

@jeff-at-neon

Copy link
Copy Markdown
Contributor

Summary

  • Adds three optional flags to neon init--project-id, --org-id, --branch-id — that streamline setup for users who already have a Neon project, in both agent and interactive modes.
  • When --project-id is provided, the getting-started flow collapses its org/project select-or-create-or-context chain into a single verified neon link step (verifies the IDs against the account, infers the org, records the branch, and writes .neon). --org-id alone scopes project selection to that org and skips org selection; --branch-id is recorded in .neon so neon env pull targets that branch.
  • IDs are validated at the CLI boundary (new shared assertSafeId in src/init/ids.ts) before any shell interpolation, so a malformed ID is rejected early in the caller's expected shape (JSON in agent mode).
  • The --data '{"step":"db"}' agent path also gains branchId, threaded into the connection-string command and project_ready payload.

Behavior

Provided Effect
--project-id Skips org + project selection; one verified link, then env pull
--org-id alone Skips org selection; still lists/creates a project in that org
--branch-id Recorded in .neon so env pull targets that branch

The no-ID path is byte-identical to before (only the --help snapshot changed, to list the new flags).

Test plan

  • pnpm typecheck (tsc --noEmit)
  • biome check (error-on-warnings) clean on changed files
  • vitest run init suites — 310/310 pass (agent_snapshot, init, route_command, orchestrate)
  • Regenerated --help snapshot (adds the three flags only)
  • Smoke test on built binary: flags appear in --help; malformed --project-id rejected as JSON in agent mode
  • Consider whether a changeset is needed for the neon package release

This pull request and its description were written by Isaac.

Let returning users skip org/project discovery by naming an existing
project up front. When --project-id is given, the getting-started flow
collapses its org/project select-or-create chain into a single verified
`neon link` step (infers org, records branch, writes .neon); --org-id
alone scopes project selection to that org, and --branch-id targets a
branch for env pull. Works in both agent and interactive modes.

Co-authored-by: Isaac
@jeff-at-neon

Copy link
Copy Markdown
Contributor Author

Superseded by #428, which makes neon init minimal (install tooling, then hand off to the agent). The --project-id/--org-id/--branch-id flags this PR added are removed there since init no longer links projects.

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.

1 participant