neon-init 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/cli.js +366 -30
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +15 -3
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +218 -13
  6. package/dist/index.js.map +1 -1
  7. package/dist/interactive.d.ts +12 -0
  8. package/dist/interactive.d.ts.map +1 -0
  9. package/dist/interactive.js +495 -0
  10. package/dist/interactive.js.map +1 -0
  11. package/dist/lib/agents.d.ts +6 -1
  12. package/dist/lib/agents.d.ts.map +1 -1
  13. package/dist/lib/agents.js +62 -1
  14. package/dist/lib/agents.js.map +1 -1
  15. package/dist/lib/auth.d.ts +10 -3
  16. package/dist/lib/auth.d.ts.map +1 -1
  17. package/dist/lib/auth.js +21 -12
  18. package/dist/lib/auth.js.map +1 -1
  19. package/dist/lib/bootstrap.d.ts +30 -0
  20. package/dist/lib/bootstrap.d.ts.map +1 -0
  21. package/dist/lib/bootstrap.js +61 -0
  22. package/dist/lib/bootstrap.js.map +1 -0
  23. package/dist/lib/build-config.d.ts +5 -0
  24. package/dist/lib/build-config.d.ts.map +1 -0
  25. package/dist/lib/build-config.js +6 -0
  26. package/dist/lib/build-config.js.map +1 -0
  27. package/dist/lib/detect-agent.d.ts +22 -0
  28. package/dist/lib/detect-agent.d.ts.map +1 -0
  29. package/dist/lib/detect-agent.js +65 -0
  30. package/dist/lib/detect-agent.js.map +1 -0
  31. package/dist/lib/editors.d.ts.map +1 -1
  32. package/dist/lib/editors.js.map +1 -1
  33. package/dist/lib/extension.d.ts +11 -3
  34. package/dist/lib/extension.d.ts.map +1 -1
  35. package/dist/lib/extension.js +28 -7
  36. package/dist/lib/extension.js.map +1 -1
  37. package/dist/lib/inspect.d.ts +28 -0
  38. package/dist/lib/inspect.d.ts.map +1 -0
  39. package/dist/lib/inspect.js +190 -0
  40. package/dist/lib/inspect.js.map +1 -0
  41. package/dist/lib/install.d.ts +10 -4
  42. package/dist/lib/install.d.ts.map +1 -1
  43. package/dist/lib/install.js +37 -20
  44. package/dist/lib/install.js.map +1 -1
  45. package/dist/lib/neonctl.d.ts +51 -0
  46. package/dist/lib/neonctl.d.ts.map +1 -0
  47. package/dist/lib/neonctl.js +184 -0
  48. package/dist/lib/neonctl.js.map +1 -0
  49. package/dist/lib/phases/auth.d.ts +12 -0
  50. package/dist/lib/phases/auth.d.ts.map +1 -0
  51. package/dist/lib/phases/auth.js +197 -0
  52. package/dist/lib/phases/auth.js.map +1 -0
  53. package/dist/lib/phases/cleanup.d.ts +12 -0
  54. package/dist/lib/phases/cleanup.d.ts.map +1 -0
  55. package/dist/lib/phases/cleanup.js +29 -0
  56. package/dist/lib/phases/cleanup.js.map +1 -0
  57. package/dist/lib/phases/db.d.ts +17 -0
  58. package/dist/lib/phases/db.d.ts.map +1 -0
  59. package/dist/lib/phases/db.js +259 -0
  60. package/dist/lib/phases/db.js.map +1 -0
  61. package/dist/lib/phases/getting-started.d.ts +26 -0
  62. package/dist/lib/phases/getting-started.d.ts.map +1 -0
  63. package/dist/lib/phases/getting-started.js +196 -0
  64. package/dist/lib/phases/getting-started.js.map +1 -0
  65. package/dist/lib/phases/mcp.d.ts +15 -0
  66. package/dist/lib/phases/mcp.d.ts.map +1 -0
  67. package/dist/lib/phases/mcp.js +179 -0
  68. package/dist/lib/phases/mcp.js.map +1 -0
  69. package/dist/lib/phases/migrations.d.ts +14 -0
  70. package/dist/lib/phases/migrations.d.ts.map +1 -0
  71. package/dist/lib/phases/migrations.js +239 -0
  72. package/dist/lib/phases/migrations.js.map +1 -0
  73. package/dist/lib/phases/neon-auth.d.ts +13 -0
  74. package/dist/lib/phases/neon-auth.d.ts.map +1 -0
  75. package/dist/lib/phases/neon-auth.js +118 -0
  76. package/dist/lib/phases/neon-auth.js.map +1 -0
  77. package/dist/lib/phases/setup.d.ts +41 -0
  78. package/dist/lib/phases/setup.d.ts.map +1 -0
  79. package/dist/lib/phases/setup.js +689 -0
  80. package/dist/lib/phases/setup.js.map +1 -0
  81. package/dist/lib/phases/skills.d.ts +14 -0
  82. package/dist/lib/phases/skills.d.ts.map +1 -0
  83. package/dist/lib/phases/skills.js +80 -0
  84. package/dist/lib/phases/skills.js.map +1 -0
  85. package/dist/lib/phases/status.d.ts +10 -0
  86. package/dist/lib/phases/status.d.ts.map +1 -0
  87. package/dist/lib/phases/status.js +65 -0
  88. package/dist/lib/phases/status.js.map +1 -0
  89. package/dist/lib/resolve-context.d.ts +19 -0
  90. package/dist/lib/resolve-context.d.ts.map +1 -0
  91. package/dist/lib/resolve-context.js +112 -0
  92. package/dist/lib/resolve-context.js.map +1 -0
  93. package/dist/lib/route-command.d.ts +8 -0
  94. package/dist/lib/route-command.d.ts.map +1 -0
  95. package/dist/lib/route-command.js +195 -0
  96. package/dist/lib/route-command.js.map +1 -0
  97. package/dist/lib/skills.d.ts +20 -3
  98. package/dist/lib/skills.d.ts.map +1 -1
  99. package/dist/lib/skills.js +116 -12
  100. package/dist/lib/skills.js.map +1 -1
  101. package/dist/lib/types.d.ts +150 -1
  102. package/dist/lib/types.d.ts.map +1 -1
  103. package/dist/lib/vsix.d.ts +15 -0
  104. package/dist/lib/vsix.d.ts.map +1 -0
  105. package/dist/lib/vsix.js +91 -0
  106. package/dist/lib/vsix.js.map +1 -0
  107. package/dist/v2.d.ts +31 -0
  108. package/dist/v2.d.ts.map +1 -0
  109. package/dist/v2.js +147 -0
  110. package/dist/v2.js.map +1 -0
  111. package/package.json +7 -3
@@ -0,0 +1,196 @@
1
+ import { neonctlCmd } from "../neonctl.js";
2
+ import { SKILL_REFERENCE_URLS, ensureSkillsUpToDate } from "../skills.js";
3
+ //#region src/lib/phases/getting-started.ts
4
+ /**
5
+ * Initiates the "Get started with Neon" workflow.
6
+ *
7
+ * Steps are concrete and executable — each has a CLI command to run
8
+ * or a specific file operation. The agent should attempt each step
9
+ * in order and actually perform the action using the neonctl CLI.
10
+ */
11
+ async function handleGettingStartedPhase(options) {
12
+ if (options.agent) await ensureSkillsUpToDate(options.agent);
13
+ const steps = [];
14
+ if (!options.hasConnectionString) {
15
+ if (options.preview) steps.push({
16
+ id: "select_org",
17
+ description: [
18
+ "List the user's Neon organizations using the CLI command below.",
19
+ "If only one org exists, use it automatically.",
20
+ "If multiple orgs exist, ask the user which one to use.",
21
+ "Remember the selected org ID for the next steps."
22
+ ].join(" "),
23
+ command: `${neonctlCmd()} orgs list --output json`
24
+ }, {
25
+ id: "select_or_create_project",
26
+ description: [
27
+ "List existing Neon projects in the selected organization using the CLI command below (replace <org-id> with the selected org ID).",
28
+ "IMPORTANT: Preview features require a project in the AWS us-east-2 region created on or after 2026-06-11.",
29
+ "Filter the project list to ONLY show projects where region_id is 'aws-us-east-2' AND created_at is on or after '2026-06-11'.",
30
+ "If eligible projects exist, present them alongside a 'Create new project' option.",
31
+ "If no eligible projects exist, tell the user and proceed directly to creating a new one.",
32
+ "IMPORTANT: Always include --org-id when creating a project to avoid interactive prompts."
33
+ ].join(" "),
34
+ command: `${neonctlCmd()} projects list --org-id <org-id> --output json`
35
+ }, {
36
+ id: "create_project_if_needed",
37
+ description: [
38
+ "If the user chose to create a new project, create it in the AWS us-east-2 region using the CLI command below (replace <org-id> and <project-name>).",
39
+ "Ask the user for a project name (suggest the current directory name).",
40
+ "If the user chose an existing eligible project, skip this step."
41
+ ].join(" "),
42
+ command: `${neonctlCmd()} projects create --name <project-name> --org-id <org-id> --region-id aws-us-east-2 --output json`
43
+ });
44
+ else steps.push({
45
+ id: "select_org",
46
+ description: [
47
+ "List the user's Neon organizations using the CLI command below.",
48
+ "If only one org exists, use it automatically.",
49
+ "If multiple orgs exist, ask the user which one to use.",
50
+ "Remember the selected org ID for the next steps."
51
+ ].join(" "),
52
+ command: `${neonctlCmd()} orgs list --output json`
53
+ }, {
54
+ id: "select_or_create_project",
55
+ description: [
56
+ "List existing Neon projects in the selected organization using the CLI command below (replace <org-id> with the selected org ID).",
57
+ "Ask the user whether they want to use an existing project or create a new one.",
58
+ "If creating new, ask the user for a project name (suggest the current directory name).",
59
+ "IMPORTANT: Always include --org-id when creating a project to avoid interactive prompts."
60
+ ].join(" "),
61
+ command: `${neonctlCmd()} projects list --org-id <org-id> --output json`
62
+ }, {
63
+ id: "create_project_if_needed",
64
+ description: ["If the user chose to create a new project, create it using the CLI command below (replace <org-id> and <project-name>).", "If the user chose an existing project, skip this step."].join(" "),
65
+ command: `${neonctlCmd()} projects create --name <project-name> --org-id <org-id> --output json`
66
+ });
67
+ steps.push({
68
+ id: "create_neon_context",
69
+ description: [
70
+ "Update the .neon context file in the project root with the selected org and project IDs.",
71
+ "IMPORTANT: If a .neon file already exists, you MUST read it first, then merge the new orgId and projectId into the existing content. Do NOT overwrite the file — other fields (like _init, branch, etc.) must be preserved.",
72
+ "If no .neon file exists, create one.",
73
+ "The file is JSON. Add/update only the orgId and projectId fields: {\"orgId\": \"<org-id>\", \"projectId\": \"<project-id>\", ...existing fields}.",
74
+ "This file is safe to commit — it contains no secrets."
75
+ ].join(" ")
76
+ });
77
+ steps.push({
78
+ id: "install_dependencies",
79
+ description: [
80
+ "Check if node_modules exists in the project root.",
81
+ "If not, install project dependencies using the appropriate package manager (check for pnpm-lock.yaml, yarn.lock, bun.lockb, or default to npm).",
82
+ "This must be done before `neonctl env pull` because the project's Neon config file may import packages that need to be installed first."
83
+ ].join(" "),
84
+ command: "npm install"
85
+ });
86
+ steps.push({
87
+ id: "pull_env",
88
+ description: [
89
+ "Now that the .neon context file is in place and dependencies are installed, run `neonctl env pull` to populate the project's environment variables.",
90
+ "This automatically writes the database connection string (and any other Neon-managed env vars) to the correct env file.",
91
+ "It reads the .neon context file to determine the project, and writes to the appropriate env file for the project.",
92
+ "Ensure the target env file is listed in .gitignore."
93
+ ].join(" "),
94
+ command: `${neonctlCmd()} env pull`
95
+ });
96
+ if (options.orm === "prisma") steps.push({
97
+ id: "install_driver",
98
+ description: ["Install the @neondatabase/serverless driver adapter for Prisma.", "This enables Prisma to use Neon's serverless driver for edge/serverless deployments."].join(" "),
99
+ command: "npm install @neondatabase/serverless @prisma/adapter-neon"
100
+ });
101
+ else if (options.orm === "drizzle" || options.orm === "drizzle-orm") steps.push({
102
+ id: "install_driver",
103
+ description: "Install the Neon serverless driver for Drizzle.",
104
+ command: "npm install @neondatabase/serverless"
105
+ });
106
+ else if (!options.orm || options.orm === "none") steps.push({
107
+ id: "install_driver",
108
+ description: "Install the Neon serverless driver for direct database access.",
109
+ command: "npm install @neondatabase/serverless"
110
+ });
111
+ }
112
+ if (options.migrationTool && options.migrationTool !== "none") {
113
+ const tool = options.migrationTool.toLowerCase();
114
+ const migrationDir = options.migrationDir;
115
+ const hasMigrationDir = migrationDir && migrationDir !== "none";
116
+ if (tool === "drizzle") steps.push({
117
+ id: "run_migrations",
118
+ description: [
119
+ hasMigrationDir ? `Check if the ${migrationDir} directory contains .sql migration files.` : "Check if a drizzle migrations directory exists with .sql files.",
120
+ "If .sql files exist, apply them with `npx drizzle-kit migrate`.",
121
+ "If the directory is empty or missing but a drizzle schema file exists (e.g. src/db/schema.ts, drizzle/schema.ts), run `npx drizzle-kit generate` first to create migrations, then `npx drizzle-kit migrate` to apply them.",
122
+ "If neither schema nor migrations exist, skip this step."
123
+ ].join(" "),
124
+ command: "npx drizzle-kit migrate"
125
+ });
126
+ else if (tool === "prisma") steps.push({
127
+ id: "run_migrations",
128
+ description: [
129
+ hasMigrationDir ? `Check if the ${migrationDir} directory contains migration folders.` : "Check if prisma/migrations contains migration folders.",
130
+ "If migrations exist, apply them with `npx prisma migrate deploy`.",
131
+ "If the migrations directory is empty or missing but prisma/schema.prisma has models defined, run `npx prisma migrate dev --name init` to create and apply the initial migration.",
132
+ "If no models are defined, skip this step."
133
+ ].join(" "),
134
+ command: "npx prisma migrate deploy"
135
+ });
136
+ else if (tool === "knex") steps.push({
137
+ id: "run_migrations",
138
+ description: `Apply existing knex migrations to the Neon database.`,
139
+ command: "npx knex migrate:latest"
140
+ });
141
+ } else if (options.preview) steps.push({
142
+ id: "run_migrations",
143
+ description: [
144
+ "Check the scaffolded project for a migration tool and schema.",
145
+ "Look for: drizzle.config.ts/js (Drizzle), prisma/schema.prisma (Prisma), or knexfile.ts/js (Knex).",
146
+ "If Drizzle is found: check if a drizzle migrations directory exists with .sql files. If .sql files exist, run `npx drizzle-kit migrate`. If the directory is empty or missing but a schema file exists, run `npx drizzle-kit generate` first, then `npx drizzle-kit migrate`.",
147
+ "If Prisma is found: check if prisma/migrations contains migration folders. If yes, run `npx prisma migrate deploy`. If not but models exist, run `npx prisma migrate dev --name init`.",
148
+ "If no migration tool is found, skip this step."
149
+ ].join(" ")
150
+ });
151
+ steps.push({
152
+ id: "verify_connection",
153
+ description: [
154
+ "Verify the database connection works by running a SQL query against the Neon database.",
155
+ "Write and run a short script that connects using DATABASE_URL from the project's env file and executes `SELECT 1` (or queries a table from the migration if migrations were run).",
156
+ "Do NOT use the neonctl CLI or MCP tools for this — use a direct database connection to verify end-to-end connectivity."
157
+ ].join(" ")
158
+ });
159
+ return {
160
+ phase: "setup",
161
+ status: "getting_started",
162
+ nextAction: {
163
+ type: "agent_action",
164
+ prerequisite: SKILL_REFERENCE_URLS.gettingStarted,
165
+ steps,
166
+ onComplete: buildOnComplete(options)
167
+ }
168
+ };
169
+ }
170
+ function buildOnComplete(options) {
171
+ const agentArgs = options.agent ? ["--agent", options.agent] : [];
172
+ const features = options.features ?? [];
173
+ const hasFeatureRequirements = features.length > 0;
174
+ if (hasFeatureRequirements && !features.includes("auth")) return {
175
+ type: "run_neon_init",
176
+ args: [
177
+ "finalize",
178
+ "--json",
179
+ ...agentArgs
180
+ ]
181
+ };
182
+ const authSetup = hasFeatureRequirements && features.includes("auth") ? ["--setup"] : [];
183
+ return {
184
+ type: "run_neon_init",
185
+ args: [
186
+ "neon-auth",
187
+ "--json",
188
+ ...agentArgs,
189
+ ...authSetup
190
+ ]
191
+ };
192
+ }
193
+ //#endregion
194
+ export { handleGettingStartedPhase };
195
+
196
+ //# sourceMappingURL=getting-started.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getting-started.js","names":[],"sources":["../../../src/lib/phases/getting-started.ts"],"sourcesContent":["import { neonctlCmd } from \"../neonctl.js\";\nimport { ensureSkillsUpToDate, SKILL_REFERENCE_URLS } from \"../skills.js\";\nimport type { PhaseResponse } from \"../types.js\";\n\nexport interface GettingStartedPhaseOptions {\n\tagent?: string;\n\thasConnectionString?: boolean;\n\tframework?: string;\n\torm?: string;\n\tmigrationTool?: string;\n\tmigrationDir?: string;\n\t/** Neon features required by the project (from .neon or template) */\n\tfeatures?: string[];\n\t/** Preview mode — restricts project creation to new projects in AWS us-east */\n\tpreview?: boolean;\n}\n\n/**\n * Initiates the \"Get started with Neon\" workflow.\n *\n * Steps are concrete and executable — each has a CLI command to run\n * or a specific file operation. The agent should attempt each step\n * in order and actually perform the action using the neonctl CLI.\n */\nexport async function handleGettingStartedPhase(\n\toptions: GettingStartedPhaseOptions,\n): Promise<PhaseResponse> {\n\t// Ensure skills are up to date (no-op if recently updated)\n\tif (options.agent) {\n\t\tawait ensureSkillsUpToDate(options.agent);\n\t}\n\tconst steps: { id: string; description: string; command?: string }[] = [];\n\n\tif (!options.hasConnectionString) {\n\t\tif (options.preview) {\n\t\t\t// Preview mode: new project in AWS us-east-2, or existing eligible project\n\t\t\tsteps.push(\n\t\t\t\t{\n\t\t\t\t\tid: \"select_org\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"List the user's Neon organizations using the CLI command below.\",\n\t\t\t\t\t\t\"If only one org exists, use it automatically.\",\n\t\t\t\t\t\t\"If multiple orgs exist, ask the user which one to use.\",\n\t\t\t\t\t\t\"Remember the selected org ID for the next steps.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} orgs list --output json`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"select_or_create_project\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"List existing Neon projects in the selected organization using the CLI command below (replace <org-id> with the selected org ID).\",\n\t\t\t\t\t\t\"IMPORTANT: Preview features require a project in the AWS us-east-2 region created on or after 2026-06-11.\",\n\t\t\t\t\t\t\"Filter the project list to ONLY show projects where region_id is 'aws-us-east-2' AND created_at is on or after '2026-06-11'.\",\n\t\t\t\t\t\t\"If eligible projects exist, present them alongside a 'Create new project' option.\",\n\t\t\t\t\t\t\"If no eligible projects exist, tell the user and proceed directly to creating a new one.\",\n\t\t\t\t\t\t\"IMPORTANT: Always include --org-id when creating a project to avoid interactive prompts.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} projects list --org-id <org-id> --output json`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"create_project_if_needed\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"If the user chose to create a new project, create it in the AWS us-east-2 region using the CLI command below (replace <org-id> and <project-name>).\",\n\t\t\t\t\t\t\"Ask the user for a project name (suggest the current directory name).\",\n\t\t\t\t\t\t\"If the user chose an existing eligible project, skip this step.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} projects create --name <project-name> --org-id <org-id> --region-id aws-us-east-2 --output json`,\n\t\t\t\t},\n\t\t\t);\n\t\t} else {\n\t\t\t// Standard mode: let user choose existing or create new\n\t\t\tsteps.push(\n\t\t\t\t{\n\t\t\t\t\tid: \"select_org\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"List the user's Neon organizations using the CLI command below.\",\n\t\t\t\t\t\t\"If only one org exists, use it automatically.\",\n\t\t\t\t\t\t\"If multiple orgs exist, ask the user which one to use.\",\n\t\t\t\t\t\t\"Remember the selected org ID for the next steps.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} orgs list --output json`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"select_or_create_project\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"List existing Neon projects in the selected organization using the CLI command below (replace <org-id> with the selected org ID).\",\n\t\t\t\t\t\t\"Ask the user whether they want to use an existing project or create a new one.\",\n\t\t\t\t\t\t\"If creating new, ask the user for a project name (suggest the current directory name).\",\n\t\t\t\t\t\t\"IMPORTANT: Always include --org-id when creating a project to avoid interactive prompts.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} projects list --org-id <org-id> --output json`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"create_project_if_needed\",\n\t\t\t\t\tdescription: [\n\t\t\t\t\t\t\"If the user chose to create a new project, create it using the CLI command below (replace <org-id> and <project-name>).\",\n\t\t\t\t\t\t\"If the user chose an existing project, skip this step.\",\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\tcommand: `${neonctlCmd()} projects create --name <project-name> --org-id <org-id> --output json`,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Create/update .neon context file\n\t\tsteps.push({\n\t\t\tid: \"create_neon_context\",\n\t\t\tdescription: [\n\t\t\t\t\"Update the .neon context file in the project root with the selected org and project IDs.\",\n\t\t\t\t\"IMPORTANT: If a .neon file already exists, you MUST read it first, then merge the new orgId and projectId into the existing content. Do NOT overwrite the file — other fields (like _init, branch, etc.) must be preserved.\",\n\t\t\t\t\"If no .neon file exists, create one.\",\n\t\t\t\t'The file is JSON. Add/update only the orgId and projectId fields: {\"orgId\": \"<org-id>\", \"projectId\": \"<project-id>\", ...existing fields}.',\n\t\t\t\t\"This file is safe to commit — it contains no secrets.\",\n\t\t\t].join(\" \"),\n\t\t});\n\n\t\t// Install project dependencies (required before env pull — config files may import packages)\n\t\tsteps.push({\n\t\t\tid: \"install_dependencies\",\n\t\t\tdescription: [\n\t\t\t\t\"Check if node_modules exists in the project root.\",\n\t\t\t\t\"If not, install project dependencies using the appropriate package manager (check for pnpm-lock.yaml, yarn.lock, bun.lockb, or default to npm).\",\n\t\t\t\t\"This must be done before `neonctl env pull` because the project's Neon config file may import packages that need to be installed first.\",\n\t\t\t].join(\" \"),\n\t\t\tcommand: \"npm install\",\n\t\t});\n\n\t\t// Pull environment variables (connection string, etc.) from Neon\n\t\tsteps.push({\n\t\t\tid: \"pull_env\",\n\t\t\tdescription: [\n\t\t\t\t\"Now that the .neon context file is in place and dependencies are installed, run `neonctl env pull` to populate the project's environment variables.\",\n\t\t\t\t\"This automatically writes the database connection string (and any other Neon-managed env vars) to the correct env file.\",\n\t\t\t\t\"It reads the .neon context file to determine the project, and writes to the appropriate env file for the project.\",\n\t\t\t\t\"Ensure the target env file is listed in .gitignore.\",\n\t\t\t].join(\" \"),\n\t\t\tcommand: `${neonctlCmd()} env pull`,\n\t\t});\n\n\t\t// Step 6: Install Neon serverless driver if needed\n\t\tif (options.orm === \"prisma\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"install_driver\",\n\t\t\t\tdescription: [\n\t\t\t\t\t\"Install the @neondatabase/serverless driver adapter for Prisma.\",\n\t\t\t\t\t\"This enables Prisma to use Neon's serverless driver for edge/serverless deployments.\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tcommand:\n\t\t\t\t\t\"npm install @neondatabase/serverless @prisma/adapter-neon\",\n\t\t\t});\n\t\t} else if (options.orm === \"drizzle\" || options.orm === \"drizzle-orm\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"install_driver\",\n\t\t\t\tdescription: \"Install the Neon serverless driver for Drizzle.\",\n\t\t\t\tcommand: \"npm install @neondatabase/serverless\",\n\t\t\t});\n\t\t} else if (!options.orm || options.orm === \"none\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"install_driver\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Install the Neon serverless driver for direct database access.\",\n\t\t\t\tcommand: \"npm install @neondatabase/serverless\",\n\t\t\t});\n\t\t}\n\t}\n\n\t// Run migrations if applicable\n\tif (options.migrationTool && options.migrationTool !== \"none\") {\n\t\tconst tool = options.migrationTool.toLowerCase();\n\t\tconst migrationDir = options.migrationDir;\n\t\tconst hasMigrationDir = migrationDir && migrationDir !== \"none\";\n\n\t\tif (tool === \"drizzle\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"run_migrations\",\n\t\t\t\tdescription: [\n\t\t\t\t\thasMigrationDir\n\t\t\t\t\t\t? `Check if the ${migrationDir} directory contains .sql migration files.`\n\t\t\t\t\t\t: \"Check if a drizzle migrations directory exists with .sql files.\",\n\t\t\t\t\t\"If .sql files exist, apply them with `npx drizzle-kit migrate`.\",\n\t\t\t\t\t\"If the directory is empty or missing but a drizzle schema file exists (e.g. src/db/schema.ts, drizzle/schema.ts), run `npx drizzle-kit generate` first to create migrations, then `npx drizzle-kit migrate` to apply them.\",\n\t\t\t\t\t\"If neither schema nor migrations exist, skip this step.\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tcommand: \"npx drizzle-kit migrate\",\n\t\t\t});\n\t\t} else if (tool === \"prisma\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"run_migrations\",\n\t\t\t\tdescription: [\n\t\t\t\t\thasMigrationDir\n\t\t\t\t\t\t? `Check if the ${migrationDir} directory contains migration folders.`\n\t\t\t\t\t\t: \"Check if prisma/migrations contains migration folders.\",\n\t\t\t\t\t\"If migrations exist, apply them with `npx prisma migrate deploy`.\",\n\t\t\t\t\t\"If the migrations directory is empty or missing but prisma/schema.prisma has models defined, run `npx prisma migrate dev --name init` to create and apply the initial migration.\",\n\t\t\t\t\t\"If no models are defined, skip this step.\",\n\t\t\t\t].join(\" \"),\n\t\t\t\tcommand: \"npx prisma migrate deploy\",\n\t\t\t});\n\t\t} else if (tool === \"knex\") {\n\t\t\tsteps.push({\n\t\t\t\tid: \"run_migrations\",\n\t\t\t\tdescription: `Apply existing knex migrations to the Neon database.`,\n\t\t\t\tcommand: \"npx knex migrate:latest\",\n\t\t\t});\n\t\t}\n\t} else if (options.preview) {\n\t\t// Bootstrap flow: migration tool wasn't detected because the project was\n\t\t// inspected before scaffolding. Detect and run migrations from the scaffolded template.\n\t\tsteps.push({\n\t\t\tid: \"run_migrations\",\n\t\t\tdescription: [\n\t\t\t\t\"Check the scaffolded project for a migration tool and schema.\",\n\t\t\t\t\"Look for: drizzle.config.ts/js (Drizzle), prisma/schema.prisma (Prisma), or knexfile.ts/js (Knex).\",\n\t\t\t\t\"If Drizzle is found: check if a drizzle migrations directory exists with .sql files. If .sql files exist, run `npx drizzle-kit migrate`. If the directory is empty or missing but a schema file exists, run `npx drizzle-kit generate` first, then `npx drizzle-kit migrate`.\",\n\t\t\t\t\"If Prisma is found: check if prisma/migrations contains migration folders. If yes, run `npx prisma migrate deploy`. If not but models exist, run `npx prisma migrate dev --name init`.\",\n\t\t\t\t\"If no migration tool is found, skip this step.\",\n\t\t\t].join(\" \"),\n\t\t});\n\t}\n\n\t// Verify the connection\n\tsteps.push({\n\t\tid: \"verify_connection\",\n\t\tdescription: [\n\t\t\t\"Verify the database connection works by running a SQL query against the Neon database.\",\n\t\t\t\"Write and run a short script that connects using DATABASE_URL from the project's env file and executes `SELECT 1` (or queries a table from the migration if migrations were run).\",\n\t\t\t\"Do NOT use the neonctl CLI or MCP tools for this — use a direct database connection to verify end-to-end connectivity.\",\n\t\t].join(\" \"),\n\t});\n\n\treturn {\n\t\tphase: \"setup\",\n\t\tstatus: \"getting_started\",\n\t\tnextAction: {\n\t\t\ttype: \"agent_action\",\n\t\t\tprerequisite: SKILL_REFERENCE_URLS.gettingStarted,\n\t\t\tsteps,\n\t\t\tonComplete: buildOnComplete(options),\n\t\t},\n\t};\n}\n\nfunction buildOnComplete(\n\toptions: GettingStartedPhaseOptions,\n): import(\"../types.js\").RunNeonInitAction {\n\tconst agentArgs = options.agent ? [\"--agent\", options.agent] : [];\n\tconst features = options.features ?? [];\n\tconst hasFeatureRequirements = features.length > 0;\n\n\t// If features are specified and auth is not required, go to finalize\n\tif (hasFeatureRequirements && !features.includes(\"auth\")) {\n\t\treturn {\n\t\t\ttype: \"run_neon_init\",\n\t\t\targs: [\"finalize\", \"--json\", ...agentArgs],\n\t\t};\n\t}\n\n\t// Chain to neon-auth — if user already selected auth via features, go straight to setup\n\tconst authSetup =\n\t\thasFeatureRequirements && features.includes(\"auth\") ? [\"--setup\"] : [];\n\treturn {\n\t\ttype: \"run_neon_init\",\n\t\targs: [\"neon-auth\", \"--json\", ...agentArgs, ...authSetup],\n\t};\n}\n"],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { Editor, PhaseResponse } from "../types.js";
2
+
3
+ //#region src/lib/phases/mcp.d.ts
4
+ interface McpPhaseOptions {
5
+ agent?: string;
6
+ editor?: Editor;
7
+ status?: boolean;
8
+ install?: boolean;
9
+ scope?: "global" | "project";
10
+ mcpConfigured?: boolean | null;
11
+ }
12
+ declare function handleMcpPhase(options: McpPhaseOptions): Promise<PhaseResponse>;
13
+ //#endregion
14
+ export { McpPhaseOptions, handleMcpPhase };
15
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","names":[],"sources":["../../../src/lib/phases/mcp.ts"],"mappings":";;;UAIiB,eAAA;;EAAA,MAAA,CAAA,EAEP,MAFO;EASK,MAAA,CAAA,EAAA,OAAA;EAAc,OAAA,CAAA,EAAA,OAAA;OAC1B,CAAA,EAAA,QAAA,GAAA,SAAA;eACC,CAAA,EAAA,OAAA,GAAA,IAAA;;AAAD,iBAFY,cAAA,CAEZ,OAAA,EADA,eACA,CAAA,EAAP,OAAO,CAAC,aAAD,CAAA"}
@@ -0,0 +1,179 @@
1
+ import { resolveAddMcpAgentId } from "../agents.js";
2
+ import { isAuthenticated } from "../auth.js";
3
+ //#region src/lib/phases/mcp.ts
4
+ async function handleMcpPhase(options) {
5
+ const agentArgs = options.agent ? [
6
+ "--agent",
7
+ options.agent,
8
+ "--json"
9
+ ] : ["--json"];
10
+ if (options.status) return {
11
+ phase: "tooling",
12
+ status: "status",
13
+ nextAction: {
14
+ type: "agent_check",
15
+ checks: [{
16
+ id: "mcp_server",
17
+ description: "Check if the Neon MCP server is already configured in your MCP server list",
18
+ lookFor: ["An MCP server entry named 'Neon' or with URL containing 'mcp.neon.tech'"]
19
+ }],
20
+ reportBack: {
21
+ type: "run_neon_init",
22
+ args: [
23
+ "mcp",
24
+ "--json",
25
+ ...options.agent ? ["--agent", options.agent] : [],
26
+ "--mcp-configured",
27
+ "<true|false>"
28
+ ]
29
+ }
30
+ }
31
+ };
32
+ if (options.install) {
33
+ if (!await isAuthenticated()) return {
34
+ phase: "tooling",
35
+ status: "auth_required",
36
+ nextAction: {
37
+ type: "run_neon_init",
38
+ args: ["auth", "--json"]
39
+ }
40
+ };
41
+ const scope = options.scope ?? "global";
42
+ const mcpAgentId = resolveAddMcpAgentId(options.agent ?? "claude-code");
43
+ const isCursor = mcpAgentId === "cursor" || options.agent?.toLowerCase() === "cursor";
44
+ const isClaudeCode = mcpAgentId === "claude-code" || options.agent?.toLowerCase() === "claude-code";
45
+ const installCmd = [
46
+ "npx -y add-mcp https://mcp.neon.tech/mcp",
47
+ scope === "global" ? "-g" : "",
48
+ "-n Neon",
49
+ "-y",
50
+ `-a ${mcpAgentId}`
51
+ ].filter(Boolean).join(" ");
52
+ let enableNote = "";
53
+ if (isCursor && scope === "project") enableNote = " Note: Cursor disables project-level MCP servers by default — after installation, open Cursor Settings > MCP and toggle the \"Neon\" server on.";
54
+ else if (isClaudeCode) enableNote = " Note: Claude Code requires approval for newly added MCP servers. When prompted, approve the \"Neon\" server to enable it.";
55
+ return {
56
+ phase: "tooling",
57
+ status: "installing",
58
+ nextAction: {
59
+ type: "run_command",
60
+ command: installCmd,
61
+ description: `Installing Neon MCP server (${scope} scope) for ${mcpAgentId}.${enableNote}`,
62
+ timeout: 6e4,
63
+ onSuccess: {
64
+ type: "run_neon_init",
65
+ args: [
66
+ "skills",
67
+ "--json",
68
+ ...options.agent ? ["--agent", options.agent] : [],
69
+ "--install"
70
+ ]
71
+ },
72
+ onFailure: { other: {
73
+ type: "ask_user",
74
+ question: "Failed to install the Neon MCP server automatically. Would you like to try again or configure it manually?",
75
+ options: [{
76
+ value: "retry",
77
+ label: "Try again"
78
+ }, {
79
+ value: "manual",
80
+ label: "I'll configure it manually"
81
+ }],
82
+ responseMapping: {
83
+ retry: { args: [
84
+ "mcp",
85
+ "--json",
86
+ ...options.agent ? ["--agent", options.agent] : [],
87
+ "--install"
88
+ ] },
89
+ manual: { args: agentArgs }
90
+ }
91
+ } }
92
+ }
93
+ };
94
+ }
95
+ if (options.mcpConfigured === true) return {
96
+ phase: "tooling",
97
+ status: "mcp_configured",
98
+ nextAction: {
99
+ type: "run_neon_init",
100
+ args: [
101
+ "skills",
102
+ "--json",
103
+ ...options.agent ? ["--agent", options.agent] : [],
104
+ "--install"
105
+ ]
106
+ }
107
+ };
108
+ if (options.mcpConfigured === false) return {
109
+ phase: "tooling",
110
+ status: "install_needed",
111
+ nextAction: {
112
+ type: "ask_user",
113
+ question: "The Neon MCP server is not yet configured. Would you like to install it?",
114
+ options: [
115
+ {
116
+ value: "defaults",
117
+ label: "Yes, install with default settings"
118
+ },
119
+ {
120
+ value: "project_scope",
121
+ label: "Yes, install for this project only"
122
+ },
123
+ {
124
+ value: "skip",
125
+ label: "Skip for now"
126
+ }
127
+ ],
128
+ context: "The Neon MCP server gives your AI assistant direct access to Neon database operations like creating projects, running queries, and managing branches." + (options.agent?.toLowerCase() === "cursor" || options.editor?.toLowerCase() === "cursor" ? " Note: Cursor disables project-level MCP servers by default. If you choose project scope, you will need to manually enable the Neon server in Cursor Settings > MCP. Global scope is recommended for Cursor." : ""),
129
+ responseMapping: {
130
+ defaults: { args: [
131
+ "mcp",
132
+ "--json",
133
+ ...options.agent ? ["--agent", options.agent] : [],
134
+ "--install"
135
+ ] },
136
+ project_scope: { args: [
137
+ "mcp",
138
+ "--json",
139
+ ...options.agent ? ["--agent", options.agent] : [],
140
+ "--install",
141
+ "--scope",
142
+ "project"
143
+ ] },
144
+ skip: { args: [
145
+ "skills",
146
+ "--json",
147
+ ...options.agent ? ["--agent", options.agent] : [],
148
+ "--install"
149
+ ] }
150
+ }
151
+ }
152
+ };
153
+ return {
154
+ phase: "tooling",
155
+ status: "detection_needed",
156
+ nextAction: {
157
+ type: "agent_check",
158
+ checks: [{
159
+ id: "mcp_server",
160
+ description: "Check if the Neon MCP server is already configured in your MCP server list",
161
+ lookFor: ["An MCP server entry named 'Neon' or with URL containing 'mcp.neon.tech'"]
162
+ }],
163
+ reportBack: {
164
+ type: "run_neon_init",
165
+ args: [
166
+ "mcp",
167
+ "--json",
168
+ ...options.agent ? ["--agent", options.agent] : [],
169
+ "--mcp-configured",
170
+ "<true|false>"
171
+ ]
172
+ }
173
+ }
174
+ };
175
+ }
176
+ //#endregion
177
+ export { handleMcpPhase };
178
+
179
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","names":[],"sources":["../../../src/lib/phases/mcp.ts"],"sourcesContent":["import { resolveAddMcpAgentId } from \"../agents.js\";\nimport { isAuthenticated } from \"../auth.js\";\nimport type { Editor, PhaseResponse } from \"../types.js\";\n\nexport interface McpPhaseOptions {\n\tagent?: string;\n\teditor?: Editor;\n\tstatus?: boolean;\n\tinstall?: boolean;\n\tscope?: \"global\" | \"project\";\n\tmcpConfigured?: boolean | null;\n}\n\nexport async function handleMcpPhase(\n\toptions: McpPhaseOptions,\n): Promise<PhaseResponse> {\n\tconst agentArgs = options.agent\n\t\t? [\"--agent\", options.agent, \"--json\"]\n\t\t: [\"--json\"];\n\n\t// --status: just report what we know\n\tif (options.status) {\n\t\treturn {\n\t\t\tphase: \"tooling\",\n\t\t\tstatus: \"status\",\n\t\t\tnextAction: {\n\t\t\t\ttype: \"agent_check\",\n\t\t\t\tchecks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"mcp_server\",\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"Check if the Neon MCP server is already configured in your MCP server list\",\n\t\t\t\t\t\tlookFor: [\n\t\t\t\t\t\t\t\"An MCP server entry named 'Neon' or with URL containing 'mcp.neon.tech'\",\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\treportBack: {\n\t\t\t\t\ttype: \"run_neon_init\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\t\"mcp\",\n\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t...(options.agent ? [\"--agent\", options.agent] : []),\n\t\t\t\t\t\t\"--mcp-configured\",\n\t\t\t\t\t\t\"<true|false>\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// --install: proceed with installation\n\tif (options.install) {\n\t\tconst authed = await isAuthenticated();\n\t\tif (!authed) {\n\t\t\treturn {\n\t\t\t\tphase: \"tooling\",\n\t\t\t\tstatus: \"auth_required\",\n\t\t\t\tnextAction: {\n\t\t\t\t\ttype: \"run_neon_init\",\n\t\t\t\t\targs: [\"auth\", \"--json\"],\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Build the add-mcp command\n\t\tconst scope = options.scope ?? \"global\";\n\t\tconst mcpAgentId = resolveAddMcpAgentId(options.agent ?? \"claude-code\");\n\t\tconst isCursor =\n\t\t\tmcpAgentId === \"cursor\" ||\n\t\t\toptions.agent?.toLowerCase() === \"cursor\";\n\t\tconst isClaudeCode =\n\t\t\tmcpAgentId === \"claude-code\" ||\n\t\t\toptions.agent?.toLowerCase() === \"claude-code\";\n\t\tconst installCmd = [\n\t\t\t\"npx -y add-mcp https://mcp.neon.tech/mcp\",\n\t\t\tscope === \"global\" ? \"-g\" : \"\",\n\t\t\t\"-n Neon\",\n\t\t\t\"-y\",\n\t\t\t`-a ${mcpAgentId}`,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\" \");\n\n\t\tlet enableNote = \"\";\n\t\tif (isCursor && scope === \"project\") {\n\t\t\tenableNote =\n\t\t\t\t' Note: Cursor disables project-level MCP servers by default — after installation, open Cursor Settings > MCP and toggle the \"Neon\" server on.';\n\t\t} else if (isClaudeCode) {\n\t\t\tenableNote =\n\t\t\t\t' Note: Claude Code requires approval for newly added MCP servers. When prompted, approve the \"Neon\" server to enable it.';\n\t\t}\n\n\t\treturn {\n\t\t\tphase: \"tooling\",\n\t\t\tstatus: \"installing\",\n\t\t\tnextAction: {\n\t\t\t\ttype: \"run_command\",\n\t\t\t\tcommand: installCmd,\n\t\t\t\tdescription: `Installing Neon MCP server (${scope} scope) for ${mcpAgentId}.${enableNote}`,\n\t\t\t\ttimeout: 60000,\n\t\t\t\tonSuccess: {\n\t\t\t\t\ttype: \"run_neon_init\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\t\"skills\",\n\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t...(options.agent ? [\"--agent\", options.agent] : []),\n\t\t\t\t\t\t\"--install\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tonFailure: {\n\t\t\t\t\tother: {\n\t\t\t\t\t\ttype: \"ask_user\",\n\t\t\t\t\t\tquestion:\n\t\t\t\t\t\t\t\"Failed to install the Neon MCP server automatically. Would you like to try again or configure it manually?\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{ value: \"retry\", label: \"Try again\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: \"manual\",\n\t\t\t\t\t\t\t\tlabel: \"I'll configure it manually\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tresponseMapping: {\n\t\t\t\t\t\t\tretry: {\n\t\t\t\t\t\t\t\targs: [\n\t\t\t\t\t\t\t\t\t\"mcp\",\n\t\t\t\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t\t\t\t...(options.agent\n\t\t\t\t\t\t\t\t\t\t? [\"--agent\", options.agent]\n\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t\"--install\",\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmanual: {\n\t\t\t\t\t\t\t\targs: agentArgs,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Agent reported detection result via --mcp-configured\n\tif (options.mcpConfigured === true) {\n\t\t// MCP is done — chain to skills installation (not back to orchestrator,\n\t\t// which would re-check MCP and loop since skills aren't installed yet).\n\t\treturn {\n\t\t\tphase: \"tooling\",\n\t\t\tstatus: \"mcp_configured\",\n\t\t\tnextAction: {\n\t\t\t\ttype: \"run_neon_init\",\n\t\t\t\targs: [\n\t\t\t\t\t\"skills\",\n\t\t\t\t\t\"--json\",\n\t\t\t\t\t...(options.agent ? [\"--agent\", options.agent] : []),\n\t\t\t\t\t\"--install\",\n\t\t\t\t],\n\t\t\t},\n\t\t};\n\t}\n\n\tif (options.mcpConfigured === false) {\n\t\treturn {\n\t\t\tphase: \"tooling\",\n\t\t\tstatus: \"install_needed\",\n\t\t\tnextAction: {\n\t\t\t\ttype: \"ask_user\",\n\t\t\t\tquestion:\n\t\t\t\t\t\"The Neon MCP server is not yet configured. Would you like to install it?\",\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: \"defaults\",\n\t\t\t\t\t\tlabel: \"Yes, install with default settings\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: \"project_scope\",\n\t\t\t\t\t\tlabel: \"Yes, install for this project only\",\n\t\t\t\t\t},\n\t\t\t\t\t{ value: \"skip\", label: \"Skip for now\" },\n\t\t\t\t],\n\t\t\t\tcontext:\n\t\t\t\t\t\"The Neon MCP server gives your AI assistant direct access to Neon database operations like creating projects, running queries, and managing branches.\" +\n\t\t\t\t\t(options.agent?.toLowerCase() === \"cursor\" ||\n\t\t\t\t\toptions.editor?.toLowerCase() === \"cursor\"\n\t\t\t\t\t\t? \" Note: Cursor disables project-level MCP servers by default. If you choose project scope, you will need to manually enable the Neon server in Cursor Settings > MCP. Global scope is recommended for Cursor.\"\n\t\t\t\t\t\t: \"\"),\n\t\t\t\tresponseMapping: {\n\t\t\t\t\tdefaults: {\n\t\t\t\t\t\targs: [\n\t\t\t\t\t\t\t\"mcp\",\n\t\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t\t...(options.agent\n\t\t\t\t\t\t\t\t? [\"--agent\", options.agent]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\"--install\",\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\tproject_scope: {\n\t\t\t\t\t\targs: [\n\t\t\t\t\t\t\t\"mcp\",\n\t\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t\t...(options.agent\n\t\t\t\t\t\t\t\t? [\"--agent\", options.agent]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\"--install\",\n\t\t\t\t\t\t\t\"--scope\",\n\t\t\t\t\t\t\t\"project\",\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\tskip: {\n\t\t\t\t\t\targs: [\n\t\t\t\t\t\t\t\"skills\",\n\t\t\t\t\t\t\t\"--json\",\n\t\t\t\t\t\t\t...(options.agent\n\t\t\t\t\t\t\t\t? [\"--agent\", options.agent]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\"--install\",\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Default: ask the agent to check\n\treturn {\n\t\tphase: \"tooling\",\n\t\tstatus: \"detection_needed\",\n\t\tnextAction: {\n\t\t\ttype: \"agent_check\",\n\t\t\tchecks: [\n\t\t\t\t{\n\t\t\t\t\tid: \"mcp_server\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Check if the Neon MCP server is already configured in your MCP server list\",\n\t\t\t\t\tlookFor: [\n\t\t\t\t\t\t\"An MCP server entry named 'Neon' or with URL containing 'mcp.neon.tech'\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\treportBack: {\n\t\t\t\ttype: \"run_neon_init\",\n\t\t\t\targs: [\n\t\t\t\t\t\"mcp\",\n\t\t\t\t\t\"--json\",\n\t\t\t\t\t...(options.agent ? [\"--agent\", options.agent] : []),\n\t\t\t\t\t\"--mcp-configured\",\n\t\t\t\t\t\"<true|false>\",\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t};\n}\n"],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ import { PhaseResponse } from "../types.js";
2
+
3
+ //#region src/lib/phases/migrations.d.ts
4
+ interface MigrationsPhaseOptions {
5
+ agent?: string;
6
+ tool?: string;
7
+ migrationDir?: string;
8
+ scaffold?: "prisma" | "drizzle";
9
+ apply?: boolean;
10
+ }
11
+ declare function handleMigrationsPhase(options: MigrationsPhaseOptions): Promise<PhaseResponse>;
12
+ //#endregion
13
+ export { MigrationsPhaseOptions, handleMigrationsPhase };
14
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","names":[],"sources":["../../../src/lib/phases/migrations.ts"],"mappings":";;;UAGiB,sBAAA;;EAAA,IAAA,CAAA,EAAA,MAAA;EAQK,YAAA,CAAA,EAAA,MAAA;EAAqB,QAAA,CAAA,EAAA,QAAA,GAAA,SAAA;OACjC,CAAA,EAAA,OAAA;;AACP,iBAFmB,qBAAA,CAEnB,OAAA,EADO,sBACP,CAAA,EAAA,OAAA,CAAQ,aAAR,CAAA"}