Skip to content

Make neon init minimal: install tooling, then hand off to the agent - #428

Open
jeff-at-neon wants to merge 13 commits into
mainfrom
feat/minimal-neon-init
Open

Make neon init minimal: install tooling, then hand off to the agent#428
jeff-at-neon wants to merge 13 commits into
mainfrom
feat/minimal-neon-init

Conversation

@jeff-at-neon

@jeff-at-neon jeff-at-neon commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes neon init minimal: it authenticates and installs the Neon tooling (MCP server, agent skills, and — in a VS Code–based IDE — the editor extension), then hands off to the agent. It no longer selects an organization or project, links the directory, pulls environment variables, asks which features to enable, or provisions Auth / Object Storage / Functions / AI Gateway. Connecting a database and configuring features is driven by the installed Neon skill (or a manual neon link).

Changes

  • Orchestrator (orchestrate.ts): reduced to auth → inspect(mcp + skills) → setup(install) → hand-off. No .neon reads/writes, no connection-string resolution.
  • Setup (phases/setup.ts): installs the Neon CLI, MCP server, skills, and (optionally) the editor extension, then returns a terminal hand-off. Dropped feature selection, preview mode, template scaffolding, and .neon writes.
  • Interactive (interactive.ts): installs tooling, then directs the user to finish in their agent or run neon link. Removed the template picker, feature prompt, and Neon Auth handling.
  • Flags removed from neon init: --preview, --project-id, --org-id, --branch-id, --skip-migrations.
  • Agent --data protocol reduced to auth, setup, mcp, and skills. Removed the getting-started, db, migrations, neon-auth, status, and finalize steps.
  • Deleted phases/support modules: getting_started, neon_auth (the phase only — the top-level neon neon-auth command is unchanged), migrations, db, cleanup, status, resolve_context, ids.
  • The standalone neon bootstrap command is unaffected.

Tests

  • Rewrote orchestrate, setup, route_command, and init unit tests for the minimal flow and pruned the agent_snapshot matrix (removed-step cases dropped, snapshot regenerated).
  • Updated the init e2e test: the removed org/project/env sequence is replaced with a check that the setup step still answers with an agent_check and installs nothing into the project just by being asked; the unknown-step guard is kept.

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
`neon init` now authenticates and installs the Neon tooling (MCP server,
agent skills, and the editor extension in a VS Code–based IDE), then hands
off to the agent. It no longer selects an org/project, links the directory,
pulls env vars, asks which features to enable, or provisions Auth / Object
Storage / Functions / AI Gateway — the installed Neon skill drives that from
here (or run `neon link` yourself).

- Removed flags: --preview, --project-id, --org-id, --branch-id, --skip-migrations.
- Agent --data steps reduced to auth, setup, mcp, skills (getting-started,
  db, migrations, neon-auth, status, finalize removed).
- Interactive init no longer scaffolds templates or configures Neon Auth.
- Deleted phases/support: getting_started, neon_auth (phase only; the
  top-level `neon neon-auth` command stays), migrations, db, cleanup, status,
  resolve_context, ids.
- The standalone `neon bootstrap` command is unaffected.

Co-authored-by: Isaac
`neon init` no longer emits the getting-started org/project/env sequence, so
the e2e that drove `{step:"getting-started"}` (and asserted the emitted
`orgs list` / `projects create` / `env pull` commands) no longer applies —
it was hitting the "Unknown step" error and exiting 1.

Replace it with a credential-free check that the `setup` step still answers
with an `agent_check` and installs nothing into the working directory just by
being asked, and keep the unknown-step guard.

Co-authored-by: Isaac
jeff-at-neon and others added 10 commits August 14, 2026 11:14
`neon init` installs the Neon CLI (ensureNeonctl), so once a `neon` binary is on
PATH the flow now emits bare `neon ...` for the commands it hands to agents/users
— driving the installed CLI directly instead of paying npx's resolution cost on
every command. When nothing is installed yet (a first run started with
`npx neon init`, before setup installs the CLI), it falls back to `npx -y neon`
so the emitted command still works. Detection runs per call, at response-build
time, so the prefix reflects the machine's current state.

Regenerated the agent_snapshot fixtures: the hermetic run has a `neon` stub on
PATH, so the emitted prefix is now `CI= neon`.

Co-authored-by: Isaac
`neon init` now installs and version-checks the `neon` npm package (its binary,
`npm view`, and the local-dev-symlink guard all target `neon`) instead of
`neonctl`. This lines up with the command prefix the flow emits (`neon`), so the
CLI it installs is the one the agent is told to run.

Updated the agent_snapshot PATH stub to version `neon` (rather than `neonctl`)
and regenerated the fixtures — the only change is the recorded subprocesses
(`neon --version` / `npm view neon version`).

Co-authored-by: Isaac
The defaults option now reads "Use defaults (MCP: global, skills:project-level, install extension later) (Recommended)". Regenerated the agent_snapshot fixtures for the new label.

Co-authored-by: Isaac
- Factor the `neon` vs `npx -y neon` choice into a shared neonBin() helper and
  use it for the `neon init` chaining commands too (enrich_output), not just
  neonctlCmd — so a first run started with `npx neon init` doesn't emit chaining
  commands that fail before the CLI is installed.
- Correct the neonctlCmd doc (the neon package ships only the `neon` binary).
- Recognize a bare bin symlink in isLocalDevSymlink: a `neon` symlink resolving
  outside node_modules is a developer build, so skip the global install instead
  of failing with EEXIST when npm can't overwrite it. Gated on the bin being a
  symlink so real installs and test stubs still take the normal path.

Co-authored-by: Isaac
Co-authored-by: Isaac
Reconciles the minimal-init rewrite with main's independent rework of the
same init subsystem:

- --profile: adopt main's #447 behavior (init honors --profile/--config-dir
  via auth.ts + profile_cli.ts) and drop this branch's refusal block.
- MCP install: adopt main's #440 add-mcp library (installNeonMcpServer) in
  both the setup phase and the interactive flow, replacing the direct
  `npx add-mcp` calls.
- neonBin(): folded into profile_cli's neonInitAgentCmd and neonctlCmd so
  emitted commands use the installed `neon` binary when present, else
  `npx -y neon`.
- interactive.ts: re-derived minimal on main's AgentType API — installs
  tooling, then hands off to the agent (no template scaffolding, feature
  selection, Neon Auth, or link/pull).
- skills.ts / neonctl.ts: took main's supersets (preview param unused by
  minimal init; neon-package install already on main).
- Removed the status/resolve_context modules and status.test.ts; updated
  tests that referenced the removed steps.

Co-authored-by: Isaac
`enrich_output` stays real in this test, so the emitted command runs through
`neonBin()`, which prefers an installed `neon` on PATH and falls back to
`npx -y neon`. Mock `which` so the assertion is stable whether or not the test
machine has `neon` installed globally (it passed locally with a dev symlink on
PATH, but CI has none), and expect the `npx -y neon` form to match.

Co-authored-by: Isaac
- interactive.ts: remove the unused `homeDir` guard carried over from main's
  version — the minimal flow never reads it (agent selection uses
  detectInstalledAgents, skills install reads HOME internally).
- route_command.test.ts: the setup phase installs MCP through the add-mcp
  library now, not `npx add-mcp`; update the mock comment accordingly.

Co-authored-by: Isaac
…on editor change

- setup.ts: the manual skills-install fallback (shown when auto-install fails)
  built `skills add --agent <raw agentId>`, but the skills CLI expects the
  mapped skills-agent name (e.g. vscode → github-copilot). Use
  getSkillsAgentName(agentId) so the printed commands actually work — matching
  the mapping the real install (ensureSkillsUpToDate) and phases/skills.ts use.

- interactive.ts: when the user picks "Configure a different agent", re-check
  whether the extension is installed for the newly chosen editors. Previously
  `extensionAlreadyInstalled` kept the value from the initial agent set, so the
  extension prompt could be wrongly shown or suppressed after switching.

Co-authored-by: Isaac
Drops vsix.ts, extension.ts, scripts/set-vsx-gallery.mjs, and the
generated build_config.ts entirely. Removes the installExtension option,
extension_installed check, and the install step from the agent setup
flow. Interactive mode no longer offers the extension prompt or install
loop. Collapses the now-identical defaults/customize branches in
handleSetupPhase and simplifies mergeCliInspection (no longer needs
inspectProject). Stale snapshot deleted; will regenerate on next build+test.

Co-authored-by: Isaac <no-reply@databricks.com>
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