Commit ca9e89a
committed
feat: neon-init v2 agent-driven state machine
Redesigns neon-init as a stateless state machine where each CLI invocation
returns a typed JSON response with a `nextAction` that tells the agent
exactly what to do next. Key changes:
- Orchestrator inspects filesystem (MCP config, skills, DATABASE_URL) to
skip phases that are already satisfied — no unnecessary round-trips
- Phase handlers for auth, setup, getting-started, db, neon-auth,
migrations, mcp, skills, and status as composable subcommands
- `responseMapping` supports inline `{ action: NextAction }` to eliminate
CLI round-trips (e.g. auth OAuth launches directly after user confirms)
- Auth verified responses use `run_neon_init` instead of `complete` to
prevent agents from getting distracted by neonctl output
- `ensureSkillsUpToDate()` with 12-hour freshness window — called from
phase handlers, skips if skills-lock.json or global skills dir is recent
- Agent detection via TTY: IDE env vars + non-TTY stdin = agent invocation,
IDE env vars + TTY stdin = human in terminal → interactive mode
- Interactive mode with clack prompts, Neon green branding via picocolors
patch, org/project selection, .neon context file
- Extension install fallback chain: marketplace → VSIX download (corporate
proxy or Open VSX) → manual instructions
- Input validation (assertSafeId) for org/project IDs in shell commands
- Filesystem inspection module (inspect.ts) shared by orchestrator, setup,
and status phases
- 95 tests across 11 test files
Co-authored-by: Isaac1 parent 0032d34 commit ca9e89a
35 files changed
Lines changed: 6887 additions & 187 deletions
File tree
- packages/init
- scripts
- src
- lib
- phases
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments