neon-init 0.17.0 → 0.17.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","names":[],"sources":["../../../src/lib/phases/status.ts"],"sourcesContent":["import { isAuthenticated } from \"../auth.js\";\nimport { inspectProject } from \"../inspect.js\";\nimport type { StatusResponse } from \"../types.js\";\n\nexport interface StatusOptions {\n\tagent?: string;\n}\n\nexport async function handleStatusPhase(\n\t_options: StatusOptions,\n): Promise<StatusResponse> {\n\tconst authed = await isAuthenticated();\n\n\tconst inspection = await inspectProject([\n\t\t{ id: \"database_url\", description: \"\", lookFor: [] },\n\t\t{ id: \"skills\", description: \"\", lookFor: [] },\n\t\t{ id: \"migrations\", description: \"\", lookFor: [] },\n\t]);\n\n\tconst hasDatabaseUrl = inspection.databaseUrl === true;\n\tconst skillsInstalled = inspection.skillsInstalled === true;\n\tconst migrationTool = (inspection.migrationTool as string | null) ?? null;\n\tconst hasMigrations =\n\t\tmigrationTool !== null &&\n\t\tmigrationTool !== \"none\" &&\n\t\tinspection.migrationDir !== \"none\";\n\n\tconst recommendations: StatusResponse[\"recommendations\"] = [];\n\n\tif (!authed) {\n\t\trecommendations.push({\n\t\t\tpriority: \"high\",\n\t\t\tmessage: \"Not authenticated with Neon\",\n\t\t\tcommand: `neonctl init --agent --json --data '{\"step\":\"auth\"}'`,\n\t\t});\n\t}\n\n\tif (!hasDatabaseUrl) {\n\t\trecommendations.push({\n\t\t\tpriority: \"high\",\n\t\t\tmessage: \"No DATABASE_URL found in .env\",\n\t\t\tcommand: `neonctl init --agent --json --data '{\"step\":\"db\"}'`,\n\t\t});\n\t}\n\n\tif (!skillsInstalled) {\n\t\trecommendations.push({\n\t\t\tpriority: \"medium\",\n\t\t\tmessage: \"Neon agent skills not detected in this project\",\n\t\t\tcommand: `neonctl init --agent --json --data '{\"step\":\"skills\",\"install\":true}'`,\n\t\t});\n\t}\n\n\tif (migrationTool && !hasMigrations) {\n\t\trecommendations.push({\n\t\t\tpriority: \"medium\",\n\t\t\tmessage: `${migrationTool} detected but no migrations found`,\n\t\t\tcommand: `neonctl init --agent --json --data '{\"step\":\"migrations\"}'`,\n\t\t});\n\t}\n\n\treturn {\n\t\tauth: {\n\t\t\tauthenticated: authed,\n\t\t},\n\t\ttooling: {\n\t\t\tmcpServer: { configured: null },\n\t\t\tskills: { installed: skillsInstalled },\n\t\t},\n\t\tproject: {\n\t\t\tdatabaseUrl: hasDatabaseUrl,\n\t\t},\n\t\tmigrations: {\n\t\t\ttool: migrationTool,\n\t\t\thasMigrations,\n\t\t},\n\t\trecommendations,\n\t};\n}\n"],"mappings":";;;AAQA,eAAsB,kBACrB,UAC0B;CAC1B,MAAM,SAAS,MAAM,gBAAgB;CAErC,MAAM,aAAa,MAAM,eAAe;EACvC;GAAE,IAAI;GAAgB,aAAa;GAAI,SAAS,CAAC;EAAE;EACnD;GAAE,IAAI;GAAU,aAAa;GAAI,SAAS,CAAC;EAAE;EAC7C;GAAE,IAAI;GAAc,aAAa;GAAI,SAAS,CAAC;EAAE;CAClD,CAAC;CAED,MAAM,iBAAiB,WAAW,gBAAgB;CAClD,MAAM,kBAAkB,WAAW,oBAAoB;CACvD,MAAM,gBAAiB,WAAW,iBAAmC;CACrE,MAAM,gBACL,kBAAkB,QAClB,kBAAkB,UAClB,WAAW,iBAAiB;CAE7B,MAAM,kBAAqD,CAAC;CAE5D,IAAI,CAAC,QACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,CAAC,gBACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,CAAC,iBACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,iBAAiB,CAAC,eACrB,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS,GAAG,cAAc;EAC1B,SAAS;CACV,CAAC;CAGF,OAAO;EACN,MAAM,EACL,eAAe,OAChB;EACA,SAAS;GACR,WAAW,EAAE,YAAY,KAAK;GAC9B,QAAQ,EAAE,WAAW,gBAAgB;EACtC;EACA,SAAS,EACR,aAAa,eACd;EACA,YAAY;GACX,MAAM;GACN;EACD;EACA;CACD;AACD"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../src/lib/phases/status.ts"],"sourcesContent":["import { isAuthenticated } from \"../auth.js\";\nimport { inspectProject } from \"../inspect.js\";\nimport type { StatusResponse } from \"../types.js\";\n\nexport interface StatusOptions {\n\tagent?: string;\n}\n\nexport async function handleStatusPhase(\n\t_options: StatusOptions,\n): Promise<StatusResponse> {\n\tconst authed = await isAuthenticated();\n\n\tconst inspection = await inspectProject([\n\t\t{ id: \"mcp_server\", description: \"\", lookFor: [] },\n\t\t{ id: \"database_url\", description: \"\", lookFor: [] },\n\t\t{ id: \"skills\", description: \"\", lookFor: [] },\n\t\t{ id: \"migrations\", description: \"\", lookFor: [] },\n\t]);\n\n\tconst hasDatabaseUrl = inspection.databaseUrl === true;\n\tconst mcpConfigured = inspection.mcpConfigured === true;\n\tconst skillsInstalled = inspection.skillsInstalled === true;\n\tconst migrationTool = (inspection.migrationTool as string | null) ?? null;\n\tconst hasMigrations =\n\t\tmigrationTool !== null &&\n\t\tmigrationTool !== \"none\" &&\n\t\tinspection.migrationDir !== \"none\";\n\n\tconst recommendations: StatusResponse[\"recommendations\"] = [];\n\n\tif (!authed) {\n\t\trecommendations.push({\n\t\t\tpriority: \"high\",\n\t\t\tmessage: \"Not authenticated with Neon\",\n\t\t\tcommand: `neonctl init --agent --data '{\"step\":\"auth\"}'`,\n\t\t});\n\t}\n\n\tif (!hasDatabaseUrl) {\n\t\trecommendations.push({\n\t\t\tpriority: \"high\",\n\t\t\tmessage: \"No DATABASE_URL found in .env\",\n\t\t\tcommand: `neonctl init --agent --data '{\"step\":\"db\"}'`,\n\t\t});\n\t}\n\n\tif (!skillsInstalled) {\n\t\trecommendations.push({\n\t\t\tpriority: \"medium\",\n\t\t\tmessage: \"Neon agent skills not detected in this project\",\n\t\t\tcommand: `neonctl init --agent --data '{\"step\":\"skills\",\"install\":true}'`,\n\t\t});\n\t}\n\n\tif (migrationTool && !hasMigrations) {\n\t\trecommendations.push({\n\t\t\tpriority: \"medium\",\n\t\t\tmessage: `${migrationTool} detected but no migrations found`,\n\t\t\tcommand: `neonctl init --agent --data '{\"step\":\"migrations\"}'`,\n\t\t});\n\t}\n\n\treturn {\n\t\tauth: {\n\t\t\tauthenticated: authed,\n\t\t},\n\t\ttooling: {\n\t\t\tmcpServer: {\n\t\t\t\tconfigured: mcpConfigured,\n\t\t\t\tscope: inspection.mcpScope || null,\n\t\t\t},\n\t\t\tskills: {\n\t\t\t\tinstalled: skillsInstalled,\n\t\t\t\tscope: inspection.skillsScope || null,\n\t\t\t},\n\t\t},\n\t\tproject: {\n\t\t\tdatabaseUrl: hasDatabaseUrl,\n\t\t},\n\t\tmigrations: {\n\t\t\ttool: migrationTool,\n\t\t\thasMigrations,\n\t\t},\n\t\trecommendations,\n\t};\n}\n"],"mappings":";;;AAQA,eAAsB,kBACrB,UAC0B;CAC1B,MAAM,SAAS,MAAM,gBAAgB;CAErC,MAAM,aAAa,MAAM,eAAe;EACvC;GAAE,IAAI;GAAc,aAAa;GAAI,SAAS,CAAC;EAAE;EACjD;GAAE,IAAI;GAAgB,aAAa;GAAI,SAAS,CAAC;EAAE;EACnD;GAAE,IAAI;GAAU,aAAa;GAAI,SAAS,CAAC;EAAE;EAC7C;GAAE,IAAI;GAAc,aAAa;GAAI,SAAS,CAAC;EAAE;CAClD,CAAC;CAED,MAAM,iBAAiB,WAAW,gBAAgB;CAClD,MAAM,gBAAgB,WAAW,kBAAkB;CACnD,MAAM,kBAAkB,WAAW,oBAAoB;CACvD,MAAM,gBAAiB,WAAW,iBAAmC;CACrE,MAAM,gBACL,kBAAkB,QAClB,kBAAkB,UAClB,WAAW,iBAAiB;CAE7B,MAAM,kBAAqD,CAAC;CAE5D,IAAI,CAAC,QACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,CAAC,gBACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,CAAC,iBACJ,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS;EACT,SAAS;CACV,CAAC;CAGF,IAAI,iBAAiB,CAAC,eACrB,gBAAgB,KAAK;EACpB,UAAU;EACV,SAAS,GAAG,cAAc;EAC1B,SAAS;CACV,CAAC;CAGF,OAAO;EACN,MAAM,EACL,eAAe,OAChB;EACA,SAAS;GACR,WAAW;IACV,YAAY;IACZ,OAAO,WAAW,YAAY;GAC/B;GACA,QAAQ;IACP,WAAW;IACX,OAAO,WAAW,eAAe;GAClC;EACD;EACA,SAAS,EACR,aAAa,eACd;EACA,YAAY;GACX,MAAM;GACN;EACD;EACA;CACD;AACD"}
@@ -6,8 +6,8 @@ declare function routeCommand(args: string[]): Promise<PhaseResponse>;
6
6
  /**
7
7
  * Routes a --data JSON payload with a "step" field to the appropriate phase
8
8
  * handler. This lets agents use a single command surface:
9
- * neon-init --agent --json --data '{"step":"auth"}'
10
- * neon-init --agent --json --data '{"step":"db","projectId":"xyz"}'
9
+ * neon-init --agent --data '{"step":"auth"}'
10
+ * neon-init --agent --data '{"step":"db","projectId":"xyz"}'
11
11
  */
12
12
  declare function routeDataStep(data: Record<string, unknown>, agent: string | undefined): Promise<unknown>;
13
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"route-command.d.ts","names":[],"sources":["../../src/lib/route-command.ts"],"mappings":";;;;AAuEoD,iBAA9B,YAAA,CAA8B,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,OAAA,CAAQ,aAAR,CAAA;AAAO;AAiL3D;;;;AAGU;iBAHY,aAAA,OACf,qDAEJ"}
1
+ {"version":3,"file":"route-command.d.ts","names":[],"sources":["../../src/lib/route-command.ts"],"mappings":";;;;AAuEoD,iBAA9B,YAAA,CAA8B,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,OAAA,CAAQ,aAAR,CAAA;AAAO;AAgL3D;;;;AAGU;iBAHY,aAAA,OACf,qDAEJ"}
@@ -182,7 +182,6 @@ async function routeCommand(args) {
182
182
  const { orchestrate } = await import("../v2.js");
183
183
  return orchestrate({
184
184
  agent,
185
- skipNeonAuth: parsed.skipNeonAuth === true,
186
185
  skipMigrations: parsed.skipMigrations === true,
187
186
  preview: parsed.preview === true
188
187
  });
@@ -192,11 +191,12 @@ async function routeCommand(args) {
192
191
  /**
193
192
  * Routes a --data JSON payload with a "step" field to the appropriate phase
194
193
  * handler. This lets agents use a single command surface:
195
- * neon-init --agent --json --data '{"step":"auth"}'
196
- * neon-init --agent --json --data '{"step":"db","projectId":"xyz"}'
194
+ * neon-init --agent --data '{"step":"auth"}'
195
+ * neon-init --agent --data '{"step":"db","projectId":"xyz"}'
197
196
  */
198
197
  async function routeDataStep(data, agent) {
199
- const { step, ...rest } = data;
198
+ const { step, agentId, ...rest } = data;
199
+ const resolvedAgent = typeof agentId === "string" ? agentId : agent;
200
200
  if (rest.data !== void 0 && Object.keys(rest).length === 1) {
201
201
  let nested = rest.data;
202
202
  if (typeof nested === "string") try {
@@ -211,62 +211,62 @@ async function routeDataStep(data, agent) {
211
211
  case "auth": {
212
212
  const { handleAuthPhase } = await import("./phases/auth.js");
213
213
  return handleAuthPhase({
214
- agent,
214
+ agent: resolvedAgent,
215
215
  ...rest
216
216
  });
217
217
  }
218
218
  case "db": {
219
219
  const { handleDbPhase } = await import("./phases/db.js");
220
220
  return handleDbPhase({
221
- agent,
221
+ agent: resolvedAgent,
222
222
  ...rest
223
223
  });
224
224
  }
225
225
  case "setup": {
226
226
  const { handleSetupPhase } = await import("./phases/setup.js");
227
227
  return handleSetupPhase({
228
- agent,
228
+ agent: resolvedAgent,
229
229
  ...rest
230
230
  });
231
231
  }
232
232
  case "getting-started": {
233
233
  const { handleGettingStartedPhase } = await import("./phases/getting-started.js");
234
234
  return handleGettingStartedPhase({
235
- agent,
235
+ agent: resolvedAgent,
236
236
  ...rest
237
237
  });
238
238
  }
239
239
  case "mcp": {
240
240
  const { handleMcpPhase } = await import("./phases/mcp.js");
241
241
  return handleMcpPhase({
242
- agent,
242
+ agent: resolvedAgent,
243
243
  ...rest
244
244
  });
245
245
  }
246
246
  case "skills": {
247
247
  const { handleSkillsPhase } = await import("./phases/skills.js");
248
248
  return handleSkillsPhase({
249
- agent,
249
+ agent: resolvedAgent,
250
250
  ...rest
251
251
  });
252
252
  }
253
253
  case "migrations": {
254
254
  const { handleMigrationsPhase } = await import("./phases/migrations.js");
255
255
  return handleMigrationsPhase({
256
- agent,
256
+ agent: resolvedAgent,
257
257
  ...rest
258
258
  });
259
259
  }
260
260
  case "neon-auth": {
261
261
  const { handleNeonAuthPhase } = await import("./phases/neon-auth.js");
262
262
  return handleNeonAuthPhase({
263
- agent,
263
+ agent: resolvedAgent,
264
264
  ...rest
265
265
  });
266
266
  }
267
267
  case "status": {
268
268
  const { handleStatusPhase } = await import("./phases/status.js");
269
- return handleStatusPhase({ agent });
269
+ return handleStatusPhase({ agent: resolvedAgent });
270
270
  }
271
271
  case "finalize": {
272
272
  const { handleCleanup } = await import("./phases/cleanup.js");
@@ -1 +1 @@
1
- {"version":3,"file":"route-command.js","names":[],"sources":["../../src/lib/route-command.ts"],"sourcesContent":["/**\n * Routes neon-init CLI args to the appropriate phase handler directly,\n * without shelling out. This is the in-process equivalent of calling\n * `neon-init <subcommand> <flags>`.\n */\n\nimport { detectAgent } from \"./detect-agent.js\";\nimport type { PhaseResponse } from \"./types.js\";\n\nfunction resolveAgent(explicit: string | undefined): string | undefined {\n\treturn explicit ?? detectAgent() ?? undefined;\n}\n\n/** Known short flag aliases (mirrors yargs config in cli.ts) */\nconst SHORT_FLAG_MAP: Record<string, string> = {\n\ta: \"agent\",\n};\n\nfunction parseArgs(args: string[]): Record<string, string | boolean> {\n\tconst result: Record<string, string | boolean> = {};\n\tlet i = 0;\n\n\t// First arg may be the subcommand\n\tif (args.length > 0 && !args[0].startsWith(\"-\")) {\n\t\tresult._command = args[0];\n\t\ti = 1;\n\t}\n\n\twhile (i < args.length) {\n\t\tconst arg = args[i];\n\t\tif (arg.startsWith(\"--\")) {\n\t\t\tconst key = arg\n\t\t\t\t.slice(2)\n\t\t\t\t.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n\t\t\tconst nextArg = args[i + 1];\n\t\t\tif (nextArg !== undefined && !nextArg.startsWith(\"-\")) {\n\t\t\t\tresult[key] = nextArg;\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tresult[key] = true;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else if (\n\t\t\targ.startsWith(\"-\") &&\n\t\t\t!arg.startsWith(\"--\") &&\n\t\t\targ.length === 2\n\t\t) {\n\t\t\tconst shortKey = arg[1];\n\t\t\tconst longKey = SHORT_FLAG_MAP[shortKey] ?? shortKey;\n\t\t\tconst nextArg = args[i + 1];\n\t\t\tif (nextArg !== undefined && !nextArg.startsWith(\"-\")) {\n\t\t\t\tresult[longKey] = nextArg;\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tresult[longKey] = true;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else {\n\t\t\ti += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction toBool(val: string | boolean | undefined): boolean | null {\n\tif (val === true || val === \"true\") return true;\n\tif (val === false || val === \"false\") return false;\n\treturn null;\n}\n\nexport async function routeCommand(args: string[]): Promise<PhaseResponse> {\n\tconst parsed = parseArgs(args);\n\tconst command = parsed._command as string | undefined;\n\tconst agent = resolveAgent(parsed.agent as string | undefined);\n\n\tswitch (command) {\n\t\tcase \"finalize\": {\n\t\t\tconst { handleCleanup } = await import(\"./phases/cleanup.js\");\n\t\t\treturn handleCleanup();\n\t\t}\n\n\t\tcase \"auth\": {\n\t\t\tconst { handleAuthPhase } = await import(\"./phases/auth.js\");\n\t\t\treturn handleAuthPhase({\n\t\t\t\tagent,\n\t\t\t\tmethod: parsed.method as \"existing\" | \"new\" | undefined,\n\t\t\t\tverify: parsed.verify === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"mcp\": {\n\t\t\tconst { handleMcpPhase } = await import(\"./phases/mcp.js\");\n\t\t\treturn handleMcpPhase({\n\t\t\t\tagent,\n\t\t\t\tstatus: parsed.status === true,\n\t\t\t\tinstall: parsed.install === true || parsed.update === true,\n\t\t\t\tscope: (parsed.scope as \"global\" | \"project\") ?? \"global\",\n\t\t\t\tmcpConfigured: toBool(parsed.mcpConfigured),\n\t\t\t});\n\t\t}\n\n\t\tcase \"skills\": {\n\t\t\tconst { handleSkillsPhase } = await import(\"./phases/skills.js\");\n\t\t\treturn handleSkillsPhase({\n\t\t\t\tagent,\n\t\t\t\tstatus: parsed.status === true,\n\t\t\t\tinstall: parsed.install === true,\n\t\t\t\tupdate: parsed.update === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"setup\": {\n\t\t\tconst { handleSetupPhase } = await import(\"./phases/setup.js\");\n\n\t\t\t// --data JSON path\n\t\t\tif (typeof parsed.data === \"string\") {\n\t\t\t\tlet data: Record<string, unknown>;\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(parsed.data);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(\"Invalid JSON in --data flag\");\n\t\t\t\t}\n\n\t\t\t\t// Normalize string booleans\n\t\t\t\tfor (const key of [\n\t\t\t\t\t\"mcpConfigured\",\n\t\t\t\t\t\"connectionString\",\n\t\t\t\t\t\"isVscodeIde\",\n\t\t\t\t\t\"installExtension\",\n\t\t\t\t\t\"execute\",\n\t\t\t\t]) {\n\t\t\t\t\tif (data[key] === \"true\") data[key] = true;\n\t\t\t\t\telse if (data[key] === \"false\") data[key] = false;\n\t\t\t\t}\n\n\t\t\t\treturn handleSetupPhase({\n\t\t\t\t\tagent,\n\t\t\t\t\t...data,\n\t\t\t\t} as Parameters<typeof handleSetupPhase>[0]);\n\t\t\t}\n\n\t\t\treturn handleSetupPhase({\n\t\t\t\tagent,\n\t\t\t\tmcpConfigured: toBool(parsed.mcpConfigured),\n\t\t\t\tconnectionString: toBool(parsed.connectionString),\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\tmigrationTool: parsed.migrationTool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t\tisVscodeIde: toBool(parsed.isVscodeIde),\n\t\t\t\tmode: parsed.mode as \"defaults\" | \"customize\" | undefined,\n\t\t\t\tmcpScope: parsed.mcpScope as \"global\" | \"project\" | undefined,\n\t\t\t\tskillsScope: parsed.skillsScope as\n\t\t\t\t\t| \"global\"\n\t\t\t\t\t| \"project\"\n\t\t\t\t\t| undefined,\n\t\t\t\tinstallExtension: toBool(parsed.installExtension) === true,\n\t\t\t\texecute: parsed.execute === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"getting-started\": {\n\t\t\tconst { handleGettingStartedPhase } = await import(\n\t\t\t\t\"./phases/getting-started.js\"\n\t\t\t);\n\n\t\t\tif (typeof parsed.data === \"string\") {\n\t\t\t\tlet data: Record<string, unknown>;\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(parsed.data);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(\"Invalid JSON in --data flag\");\n\t\t\t\t}\n\t\t\t\treturn handleGettingStartedPhase({\n\t\t\t\t\tagent,\n\t\t\t\t\t...data,\n\t\t\t\t} as Parameters<typeof handleGettingStartedPhase>[0]);\n\t\t\t}\n\n\t\t\treturn handleGettingStartedPhase({\n\t\t\t\tagent,\n\t\t\t\thasConnectionString: parsed.hasConnectionString === true,\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\tmigrationTool: parsed.migrationTool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"db\": {\n\t\t\tconst { handleDbPhase } = await import(\"./phases/db.js\");\n\t\t\treturn handleDbPhase({\n\t\t\t\tagent,\n\t\t\t\torgId: parsed.orgId as string | undefined,\n\t\t\t\tprojectId: parsed.projectId as string | undefined,\n\t\t\t\torgsResult: parsed.orgsResult as string | undefined,\n\t\t\t\tprojectsResult: parsed.projectsResult as string | undefined,\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\terror: parsed.error as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"neon-auth\": {\n\t\t\tconst { handleNeonAuthPhase } = await import(\n\t\t\t\t\"./phases/neon-auth.js\"\n\t\t\t);\n\t\t\treturn handleNeonAuthPhase({\n\t\t\t\tagent,\n\t\t\t\tsetup: parsed.setup === true,\n\t\t\t\tinfo: parsed.info === true,\n\t\t\t\tprojectId: parsed.projectId as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"migrations\": {\n\t\t\tconst { handleMigrationsPhase } = await import(\n\t\t\t\t\"./phases/migrations.js\"\n\t\t\t);\n\t\t\treturn handleMigrationsPhase({\n\t\t\t\tagent,\n\t\t\t\ttool: parsed.tool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t\tscaffold: parsed.scaffold as \"prisma\" | \"drizzle\" | undefined,\n\t\t\t\tapply: parsed.apply === true,\n\t\t\t});\n\t\t}\n\n\t\tdefault: {\n\t\t\t// No subcommand — run the orchestrator\n\t\t\tconst { orchestrate } = await import(\"../v2.js\");\n\t\t\treturn orchestrate({\n\t\t\t\tagent,\n\t\t\t\tskipNeonAuth: parsed.skipNeonAuth === true,\n\t\t\t\tskipMigrations: parsed.skipMigrations === true,\n\t\t\t\tpreview: parsed.preview === true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Routes a --data JSON payload with a \"step\" field to the appropriate phase\n * handler. This lets agents use a single command surface:\n * neon-init --agent --json --data '{\"step\":\"auth\"}'\n * neon-init --agent --json --data '{\"step\":\"db\",\"projectId\":\"xyz\"}'\n */\nexport async function routeDataStep(\n\tdata: Record<string, unknown>,\n\tagent: string | undefined,\n): Promise<unknown> {\n\tconst { step, ...rest } = data;\n\n\t// Agents sometimes nest the actual payload inside a \"data\" key:\n\t// {\"step\":\"setup\",\"data\":{\"mode\":\"defaults\",...}}\n\t// or as a JSON string:\n\t// {\"step\":\"setup\",\"data\":\"{\\\"mode\\\":\\\"defaults\\\",...}\"}\n\t// Unwrap it so the phase handler gets the right options.\n\tif (rest.data !== undefined && Object.keys(rest).length === 1) {\n\t\tlet nested = rest.data;\n\t\tif (typeof nested === \"string\") {\n\t\t\ttry {\n\t\t\t\tnested = JSON.parse(nested);\n\t\t\t} catch {\n\t\t\t\t// leave as-is\n\t\t\t}\n\t\t}\n\t\tif (typeof nested === \"object\" && nested !== null) {\n\t\t\tObject.assign(rest, nested);\n\t\t\tdelete rest.data;\n\t\t}\n\t}\n\n\tswitch (step) {\n\t\tcase \"auth\": {\n\t\t\tconst { handleAuthPhase } = await import(\"./phases/auth.js\");\n\t\t\treturn handleAuthPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleAuthPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"db\": {\n\t\t\tconst { handleDbPhase } = await import(\"./phases/db.js\");\n\t\t\treturn handleDbPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleDbPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"setup\": {\n\t\t\tconst { handleSetupPhase } = await import(\"./phases/setup.js\");\n\t\t\treturn handleSetupPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleSetupPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"getting-started\": {\n\t\t\tconst { handleGettingStartedPhase } = await import(\n\t\t\t\t\"./phases/getting-started.js\"\n\t\t\t);\n\t\t\treturn handleGettingStartedPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleGettingStartedPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"mcp\": {\n\t\t\tconst { handleMcpPhase } = await import(\"./phases/mcp.js\");\n\t\t\treturn handleMcpPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleMcpPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"skills\": {\n\t\t\tconst { handleSkillsPhase } = await import(\"./phases/skills.js\");\n\t\t\treturn handleSkillsPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleSkillsPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"migrations\": {\n\t\t\tconst { handleMigrationsPhase } = await import(\n\t\t\t\t\"./phases/migrations.js\"\n\t\t\t);\n\t\t\treturn handleMigrationsPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleMigrationsPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"neon-auth\": {\n\t\t\tconst { handleNeonAuthPhase } = await import(\n\t\t\t\t\"./phases/neon-auth.js\"\n\t\t\t);\n\t\t\treturn handleNeonAuthPhase({ agent, ...rest } as Parameters<\n\t\t\t\ttypeof handleNeonAuthPhase\n\t\t\t>[0]);\n\t\t}\n\n\t\tcase \"status\": {\n\t\t\tconst { handleStatusPhase } = await import(\"./phases/status.js\");\n\t\t\treturn handleStatusPhase({ agent });\n\t\t}\n\n\t\tcase \"finalize\": {\n\t\t\tconst { handleCleanup } = await import(\"./phases/cleanup.js\");\n\t\t\treturn handleCleanup();\n\t\t}\n\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown step: \"${step}\". Valid steps: auth, db, setup, getting-started, mcp, skills, migrations, neon-auth, status, finalize`,\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AASA,SAAS,aAAa,UAAkD;CACvE,OAAO,YAAY,YAAY,KAAK,KAAA;AACrC;;AAGA,MAAM,iBA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O,GAAG;GAAK,CAExC;EACL;EAEA,KAAK,UAAU;GACd,MAAM,EAAE,sBAAsB,MAAM,OAAO;GAC3C,OAAO,kBAAkB,EAAE,MAAM,CAAC;EACnC;EAEA,KAAK,YAAY;GAChB,MAAM,EAAE,kBAAkB,MAAM,OAAO;GACvC,OAAO,cAAc;EACtB;EAEA,SACC,MAAM,IAAI,MACT,kBAAkB,KAAK,uGACxB;CACF;AACD"}
1
+ {"version":3,"file":"route-command.js","names":[],"sources":["../../src/lib/route-command.ts"],"sourcesContent":["/**\n * Routes neon-init CLI args to the appropriate phase handler directly,\n * without shelling out. This is the in-process equivalent of calling\n * `neon-init <subcommand> <flags>`.\n */\n\nimport { detectAgent } from \"./detect-agent.js\";\nimport type { PhaseResponse } from \"./types.js\";\n\nfunction resolveAgent(explicit: string | undefined): string | undefined {\n\treturn explicit ?? detectAgent() ?? undefined;\n}\n\n/** Known short flag aliases (mirrors yargs config in cli.ts) */\nconst SHORT_FLAG_MAP: Record<string, string> = {\n\ta: \"agent\",\n};\n\nfunction parseArgs(args: string[]): Record<string, string | boolean> {\n\tconst result: Record<string, string | boolean> = {};\n\tlet i = 0;\n\n\t// First arg may be the subcommand\n\tif (args.length > 0 && !args[0].startsWith(\"-\")) {\n\t\tresult._command = args[0];\n\t\ti = 1;\n\t}\n\n\twhile (i < args.length) {\n\t\tconst arg = args[i];\n\t\tif (arg.startsWith(\"--\")) {\n\t\t\tconst key = arg\n\t\t\t\t.slice(2)\n\t\t\t\t.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n\t\t\tconst nextArg = args[i + 1];\n\t\t\tif (nextArg !== undefined && !nextArg.startsWith(\"-\")) {\n\t\t\t\tresult[key] = nextArg;\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tresult[key] = true;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else if (\n\t\t\targ.startsWith(\"-\") &&\n\t\t\t!arg.startsWith(\"--\") &&\n\t\t\targ.length === 2\n\t\t) {\n\t\t\tconst shortKey = arg[1];\n\t\t\tconst longKey = SHORT_FLAG_MAP[shortKey] ?? shortKey;\n\t\t\tconst nextArg = args[i + 1];\n\t\t\tif (nextArg !== undefined && !nextArg.startsWith(\"-\")) {\n\t\t\t\tresult[longKey] = nextArg;\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tresult[longKey] = true;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else {\n\t\t\ti += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction toBool(val: string | boolean | undefined): boolean | null {\n\tif (val === true || val === \"true\") return true;\n\tif (val === false || val === \"false\") return false;\n\treturn null;\n}\n\nexport async function routeCommand(args: string[]): Promise<PhaseResponse> {\n\tconst parsed = parseArgs(args);\n\tconst command = parsed._command as string | undefined;\n\tconst agent = resolveAgent(parsed.agent as string | undefined);\n\n\tswitch (command) {\n\t\tcase \"finalize\": {\n\t\t\tconst { handleCleanup } = await import(\"./phases/cleanup.js\");\n\t\t\treturn handleCleanup();\n\t\t}\n\n\t\tcase \"auth\": {\n\t\t\tconst { handleAuthPhase } = await import(\"./phases/auth.js\");\n\t\t\treturn handleAuthPhase({\n\t\t\t\tagent,\n\t\t\t\tmethod: parsed.method as \"existing\" | \"new\" | undefined,\n\t\t\t\tverify: parsed.verify === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"mcp\": {\n\t\t\tconst { handleMcpPhase } = await import(\"./phases/mcp.js\");\n\t\t\treturn handleMcpPhase({\n\t\t\t\tagent,\n\t\t\t\tstatus: parsed.status === true,\n\t\t\t\tinstall: parsed.install === true || parsed.update === true,\n\t\t\t\tscope: (parsed.scope as \"global\" | \"project\") ?? \"global\",\n\t\t\t\tmcpConfigured: toBool(parsed.mcpConfigured),\n\t\t\t});\n\t\t}\n\n\t\tcase \"skills\": {\n\t\t\tconst { handleSkillsPhase } = await import(\"./phases/skills.js\");\n\t\t\treturn handleSkillsPhase({\n\t\t\t\tagent,\n\t\t\t\tstatus: parsed.status === true,\n\t\t\t\tinstall: parsed.install === true,\n\t\t\t\tupdate: parsed.update === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"setup\": {\n\t\t\tconst { handleSetupPhase } = await import(\"./phases/setup.js\");\n\n\t\t\t// --data JSON path\n\t\t\tif (typeof parsed.data === \"string\") {\n\t\t\t\tlet data: Record<string, unknown>;\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(parsed.data);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(\"Invalid JSON in --data flag\");\n\t\t\t\t}\n\n\t\t\t\t// Normalize string booleans\n\t\t\t\tfor (const key of [\n\t\t\t\t\t\"mcpConfigured\",\n\t\t\t\t\t\"connectionString\",\n\t\t\t\t\t\"isVscodeIde\",\n\t\t\t\t\t\"installExtension\",\n\t\t\t\t\t\"execute\",\n\t\t\t\t]) {\n\t\t\t\t\tif (data[key] === \"true\") data[key] = true;\n\t\t\t\t\telse if (data[key] === \"false\") data[key] = false;\n\t\t\t\t}\n\n\t\t\t\treturn handleSetupPhase({\n\t\t\t\t\tagent,\n\t\t\t\t\t...data,\n\t\t\t\t} as Parameters<typeof handleSetupPhase>[0]);\n\t\t\t}\n\n\t\t\treturn handleSetupPhase({\n\t\t\t\tagent,\n\t\t\t\tmcpConfigured: toBool(parsed.mcpConfigured),\n\t\t\t\tconnectionString: toBool(parsed.connectionString),\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\tmigrationTool: parsed.migrationTool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t\tisVscodeIde: toBool(parsed.isVscodeIde),\n\t\t\t\tmode: parsed.mode as \"defaults\" | \"customize\" | undefined,\n\t\t\t\tmcpScope: parsed.mcpScope as \"global\" | \"project\" | undefined,\n\t\t\t\tskillsScope: parsed.skillsScope as\n\t\t\t\t\t| \"global\"\n\t\t\t\t\t| \"project\"\n\t\t\t\t\t| undefined,\n\t\t\t\tinstallExtension: toBool(parsed.installExtension) === true,\n\t\t\t\texecute: parsed.execute === true,\n\t\t\t});\n\t\t}\n\n\t\tcase \"getting-started\": {\n\t\t\tconst { handleGettingStartedPhase } = await import(\n\t\t\t\t\"./phases/getting-started.js\"\n\t\t\t);\n\n\t\t\tif (typeof parsed.data === \"string\") {\n\t\t\t\tlet data: Record<string, unknown>;\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(parsed.data);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(\"Invalid JSON in --data flag\");\n\t\t\t\t}\n\t\t\t\treturn handleGettingStartedPhase({\n\t\t\t\t\tagent,\n\t\t\t\t\t...data,\n\t\t\t\t} as Parameters<typeof handleGettingStartedPhase>[0]);\n\t\t\t}\n\n\t\t\treturn handleGettingStartedPhase({\n\t\t\t\tagent,\n\t\t\t\thasConnectionString: parsed.hasConnectionString === true,\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\tmigrationTool: parsed.migrationTool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"db\": {\n\t\t\tconst { handleDbPhase } = await import(\"./phases/db.js\");\n\t\t\treturn handleDbPhase({\n\t\t\t\tagent,\n\t\t\t\torgId: parsed.orgId as string | undefined,\n\t\t\t\tprojectId: parsed.projectId as string | undefined,\n\t\t\t\torgsResult: parsed.orgsResult as string | undefined,\n\t\t\t\tprojectsResult: parsed.projectsResult as string | undefined,\n\t\t\t\tframework: parsed.framework as string | undefined,\n\t\t\t\torm: parsed.orm as string | undefined,\n\t\t\t\terror: parsed.error as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"neon-auth\": {\n\t\t\tconst { handleNeonAuthPhase } = await import(\n\t\t\t\t\"./phases/neon-auth.js\"\n\t\t\t);\n\t\t\treturn handleNeonAuthPhase({\n\t\t\t\tagent,\n\t\t\t\tsetup: parsed.setup === true,\n\t\t\t\tinfo: parsed.info === true,\n\t\t\t\tprojectId: parsed.projectId as string | undefined,\n\t\t\t});\n\t\t}\n\n\t\tcase \"migrations\": {\n\t\t\tconst { handleMigrationsPhase } = await import(\n\t\t\t\t\"./phases/migrations.js\"\n\t\t\t);\n\t\t\treturn handleMigrationsPhase({\n\t\t\t\tagent,\n\t\t\t\ttool: parsed.tool as string | undefined,\n\t\t\t\tmigrationDir: parsed.migrationDir as string | undefined,\n\t\t\t\tscaffold: parsed.scaffold as \"prisma\" | \"drizzle\" | undefined,\n\t\t\t\tapply: parsed.apply === true,\n\t\t\t});\n\t\t}\n\n\t\tdefault: {\n\t\t\t// No subcommand — run the orchestrator\n\t\t\tconst { orchestrate } = await import(\"../v2.js\");\n\t\t\treturn orchestrate({\n\t\t\t\tagent,\n\t\t\t\tskipMigrations: parsed.skipMigrations === true,\n\t\t\t\tpreview: parsed.preview === true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Routes a --data JSON payload with a \"step\" field to the appropriate phase\n * handler. This lets agents use a single command surface:\n * neon-init --agent --data '{\"step\":\"auth\"}'\n * neon-init --agent --data '{\"step\":\"db\",\"projectId\":\"xyz\"}'\n */\nexport async function routeDataStep(\n\tdata: Record<string, unknown>,\n\tagent: string | undefined,\n): Promise<unknown> {\n\tconst { step, agentId, ...rest } = data;\n\n\t// Allow agentId override from data JSON, fall back to caller-provided agent\n\tconst resolvedAgent = typeof agentId === \"string\" ? agentId : agent;\n\n\t// Agents sometimes nest the actual payload inside a \"data\" key:\n\t// {\"step\":\"setup\",\"data\":{\"mode\":\"defaults\",...}}\n\t// or as a JSON string:\n\t// {\"step\":\"setup\",\"data\":\"{\\\"mode\\\":\\\"defaults\\\",...}\"}\n\t// Unwrap it so the phase handler gets the right options.\n\tif (rest.data !== undefined && Object.keys(rest).length === 1) {\n\t\tlet nested = rest.data;\n\t\tif (typeof nested === \"string\") {\n\t\t\ttry {\n\t\t\t\tnested = JSON.parse(nested);\n\t\t\t} catch {\n\t\t\t\t// leave as-is\n\t\t\t}\n\t\t}\n\t\tif (typeof nested === \"object\" && nested !== null) {\n\t\t\tObject.assign(rest, nested);\n\t\t\tdelete rest.data;\n\t\t}\n\t}\n\n\tswitch (step) {\n\t\tcase \"auth\": {\n\t\t\tconst { handleAuthPhase } = await import(\"./phases/auth.js\");\n\t\t\treturn handleAuthPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleAuthPhase>[0]);\n\t\t}\n\n\t\tcase \"db\": {\n\t\t\tconst { handleDbPhase } = await import(\"./phases/db.js\");\n\t\t\treturn handleDbPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleDbPhase>[0]);\n\t\t}\n\n\t\tcase \"setup\": {\n\t\t\tconst { handleSetupPhase } = await import(\"./phases/setup.js\");\n\t\t\treturn handleSetupPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleSetupPhase>[0]);\n\t\t}\n\n\t\tcase \"getting-started\": {\n\t\t\tconst { handleGettingStartedPhase } = await import(\n\t\t\t\t\"./phases/getting-started.js\"\n\t\t\t);\n\t\t\treturn handleGettingStartedPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleGettingStartedPhase>[0]);\n\t\t}\n\n\t\tcase \"mcp\": {\n\t\t\tconst { handleMcpPhase } = await import(\"./phases/mcp.js\");\n\t\t\treturn handleMcpPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleMcpPhase>[0]);\n\t\t}\n\n\t\tcase \"skills\": {\n\t\t\tconst { handleSkillsPhase } = await import(\"./phases/skills.js\");\n\t\t\treturn handleSkillsPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleSkillsPhase>[0]);\n\t\t}\n\n\t\tcase \"migrations\": {\n\t\t\tconst { handleMigrationsPhase } = await import(\n\t\t\t\t\"./phases/migrations.js\"\n\t\t\t);\n\t\t\treturn handleMigrationsPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleMigrationsPhase>[0]);\n\t\t}\n\n\t\tcase \"neon-auth\": {\n\t\t\tconst { handleNeonAuthPhase } = await import(\n\t\t\t\t\"./phases/neon-auth.js\"\n\t\t\t);\n\t\t\treturn handleNeonAuthPhase({\n\t\t\t\tagent: resolvedAgent,\n\t\t\t\t...rest,\n\t\t\t} as Parameters<typeof handleNeonAuthPhase>[0]);\n\t\t}\n\n\t\tcase \"status\": {\n\t\t\tconst { handleStatusPhase } = await import(\"./phases/status.js\");\n\t\t\treturn handleStatusPhase({ agent: resolvedAgent });\n\t\t}\n\n\t\tcase \"finalize\": {\n\t\t\tconst { handleCleanup } = await import(\"./phases/cleanup.js\");\n\t\t\treturn handleCleanup();\n\t\t}\n\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown step: \"${step}\". Valid steps: auth, db, setup, getting-started, mcp, skills, migrations, neon-auth, status, finalize`,\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AASA,SAAS,aAAa,UAAkD;CACvE,OAAO,YAAY,YAAY,KAAK,KAAA;AACrC;;AAGA,MAAM,iBAAyC,EAC9C,GAAG,QACJ;AAEA,SAAS,UAAU,MAAkD;CACpE,MAAM,SAA2C,CAAC;CAClD,IAAI,IAAI;CAGR,IAAI,KAAK,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC,WAAW,GAAG,GAAG;EAChD,OAAO,WAAW,KAAK;EACvB,IAAI;CACL;CAEA,OAAO,IAAI,KAAK,QAAQ;EACvB,MAAM,MAAM,KAAK;EACjB,IAAI,IAAI,WAAW,IAAI,GAAG;GACzB,MAAM,MAAM,IACV,MAAM,CAAC,CAAC,CACR,QAAQ,cAAc,GAAG,MAAM,EAAE,Y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@@
1
1
  import { Editor } from "./types.js";
2
2
 
3
3
  //#region src/lib/skills.d.ts
4
+ /** Returns the skill list based on whether preview mode is active */
5
+ declare function getSkillList(preview?: boolean): string[];
4
6
  declare const SKILL_REFERENCE_URLS: Record<string, string>;
5
7
  /**
6
8
  * Fetches the "Getting Started with Neon" skill content from the public URL.
@@ -10,6 +12,7 @@ declare function fetchSkillContent(): Promise<string | null>;
10
12
  interface InstallSkillsOptions {
11
13
  json?: boolean;
12
14
  scope?: "global" | "project";
15
+ preview?: boolean;
13
16
  }
14
17
  /**
15
18
  * Installs Neon agent skills using Vercel's skills CLI.
@@ -22,7 +25,7 @@ declare function installAgentSkills(selectedEditors: Editor[], options?: Install
22
25
  * Designed to be called from any phase handler — cheap to call repeatedly
23
26
  * since it's a no-op when skills are fresh.
24
27
  */
25
- declare function ensureSkillsUpToDate(agent: string, scope?: "global" | "project"): Promise<boolean>;
28
+ declare function ensureSkillsUpToDate(agent: string | undefined, scope?: "global" | "project", preview?: boolean): Promise<boolean>;
26
29
  //#endregion
27
- export { InstallSkillsOptions, SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, installAgentSkills };
30
+ export { InstallSkillsOptions, SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, getSkillList, installAgentSkills };
28
31
  //# sourceMappingURL=skills.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","names":[],"sources":["../../src/lib/skills.ts"],"mappings":";;;cAWa,sBAAsB;;AAAnC;AAeA;AAiDA;AAQsB,iBAzDA,iBAAA,CAAA,CAyDkB,EAzDG,OAyDH,CAAA,MAAA,GAAA,IAAA,CAAA;AAAA,UARvB,oBAAA,CAQuB;MACtB,CAAA,EAAA,OAAA;OACP,CAAA,EAAA,QAAA,GAAA,SAAA;;AACD;AA8JV;;iBAjKsB,kBAAA,kBACJ,oBACP,uBACR;;;;;;;;iBA8JmB,oBAAA,+CAGnB"}
1
+ {"version":3,"file":"skills.d.ts","names":[],"sources":["../../src/lib/skills.ts"],"mappings":";;;;iBAuCgB,YAAA;AAAA,cAOH,oBAPe,EAOO,MAPP,CAAA,MAAA,EAAA,MAAA,CAAA;AAO5B;AAeA;AAiDA;AASA;AAAwC,iBA1DlB,iBAAA,CAAA,CA0DkB,EA1DG,OA0DH,CAAA,MAAA,GAAA,IAAA,CAAA;AACtB,UAVD,oBAAA,CAUC;MACP,CAAA,EAAA,OAAA;OACR,CAAA,EAAA,QAAA,GAAA,SAAA;EAAO,OAAA,CAAA,EAAA,OAAA;AAmJV;;;;iBAtJsB,kBAAA,kBACJ,oBACP,uBACR;;;;;;;;iBAmJmB,oBAAA,8EAInB"}
@@ -1,10 +1,45 @@
1
1
  import { getSkillsAgentName } from "./agents.js";
2
- import { existsSync, readFileSync, statSync } from "node:fs";
2
+ import { existsSync, statSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  import { log, spinner } from "@clack/prompts";
5
5
  import { execa } from "execa";
6
6
  import { dim } from "yoctocolors";
7
7
  //#region src/lib/skills.ts
8
+ /**
9
+ * Ensures the `skills` CLI is globally installed so npx doesn't need
10
+ * to download it (which can fail behind corporate proxies / sandboxes).
11
+ */
12
+ async function ensureSkillsCli() {
13
+ try {
14
+ await execa("skills", ["--version"], {
15
+ stdio: "pipe",
16
+ timeout: 5e3
17
+ });
18
+ } catch {
19
+ try {
20
+ await execa("npm", [
21
+ "install",
22
+ "-g",
23
+ "skills"
24
+ ], {
25
+ stdio: "pipe",
26
+ timeout: 6e4
27
+ });
28
+ } catch {}
29
+ }
30
+ }
31
+ /** Base skills installed for all invocations */
32
+ const BASE_SKILLS = ["neon", "neon-postgres"];
33
+ /** Additional skills installed for preview (non-bootstrap) invocations */
34
+ const PREVIEW_SKILLS = [
35
+ "neon-object-storage",
36
+ "neon-functions",
37
+ "neon-ai-gateway"
38
+ ];
39
+ /** Returns the skill list based on whether preview mode is active */
40
+ function getSkillList(preview) {
41
+ return preview ? [...BASE_SKILLS, ...PREVIEW_SKILLS] : BASE_SKILLS;
42
+ }
8
43
  const SKILL_BASE_URL = "https://neon.com/docs/ai/skills/neon-postgres/references";
9
44
  const SKILL_REFERENCE_URLS = {
10
45
  gettingStarted: `${SKILL_BASE_URL}/getting-started.md`,
@@ -62,31 +97,32 @@ async function installAgentSkills(selectedEditors, options) {
62
97
  const skillsSpinner = quiet ? null : spinner();
63
98
  skillsSpinner?.start("Installing agent skills for Neon in this project...");
64
99
  let anyFailed = false;
100
+ await ensureSkillsCli();
101
+ const skills = getSkillList(options?.preview);
65
102
  for (const editor of editorsWithSkills) {
66
103
  const agentName = editorToSkillsAgent(editor);
67
- try {
68
- await execa("npx", [
69
- "skills",
104
+ for (const skill of skills) try {
105
+ await execa("skills", [
70
106
  "add",
71
107
  "neondatabase/agent-skills",
72
108
  "--skill",
73
- "neon-postgres",
109
+ skill,
74
110
  "--agent",
75
111
  agentName,
76
112
  ...options?.scope === "global" ? ["-g"] : [],
77
113
  "-y"
78
114
  ], {
79
115
  stdio: "pipe",
80
- timeout: 1e4
116
+ timeout: 12e4
81
117
  });
82
118
  } catch (error) {
83
- if (!quiet) log.error(`Failed to install agent skills for ${editor}: ${error instanceof Error ? error.message : "Unknown error"}`);
119
+ if (!quiet) log.error(`Failed to install skill ${skill} for ${editor}: ${error instanceof Error ? error.message : "Unknown error"}`);
84
120
  anyFailed = true;
85
121
  }
86
122
  }
87
123
  if (anyFailed) {
88
124
  skillsSpinner?.stop("Agent skills installation for this project completed with errors");
89
- if (!quiet) log.info("You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon-postgres");
125
+ if (!quiet) log.info("You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon --skill neon-postgres");
90
126
  return false;
91
127
  }
92
128
  skillsSpinner?.stop(dim("Agent skills installed ✓"));
@@ -99,36 +135,37 @@ const SKILLS_FRESHNESS_MS = 720 * 60 * 1e3;
99
135
  */
100
136
  const GLOBAL_SKILLS_DIRS = (() => {
101
137
  const home = process.env.HOME || process.env.USERPROFILE || "";
138
+ const agentsDir = resolve(home, ".agents", "skills");
102
139
  return {
103
- cursor: [resolve(home, ".cursor", "skills")],
104
- "claude-code": [resolve(home, ".claude", "skills")],
105
- "github-copilot": [resolve(home, ".vscode", "skills")],
106
- codex: [resolve(home, ".codex", "skills")],
107
- cline: [resolve(home, ".cline", "skills")]
140
+ cursor: [resolve(home, ".cursor", "skills"), agentsDir],
141
+ "claude-code": [resolve(home, ".claude", "skills"), agentsDir],
142
+ "github-copilot": [resolve(home, ".vscode", "skills"), agentsDir],
143
+ codex: [resolve(home, ".codex", "skills"), agentsDir],
144
+ cline: [resolve(home, ".cline", "skills"), agentsDir]
108
145
  };
109
146
  })();
110
147
  /**
111
148
  * Checks whether skills were recently updated (within the freshness window).
112
149
  * Checks both project-level (skills-lock.json mtime) and global (skills dir mtime).
113
150
  */
114
- function skillsAreFresh(agent) {
151
+ function skillsAreFresh(agent, requiredSkills) {
115
152
  const now = Date.now();
116
153
  const cwd = process.cwd();
154
+ const projectSkillDirs = [
155
+ ".agents",
156
+ ".cursor",
157
+ ".claude"
158
+ ];
117
159
  const lockPath = resolve(cwd, "skills-lock.json");
118
160
  if (existsSync(lockPath)) try {
119
- if (readFileSync(lockPath, "utf-8").includes("neon-postgres")) {
120
- if (existsSync(resolve(cwd, ".agents", "skills", "neon-postgres", "SKILL.md")) || existsSync(resolve(cwd, ".cursor", "skills", "neon-postgres", "SKILL.md")) || existsSync(resolve(cwd, ".claude", "skills", "neon-postgres", "SKILL.md"))) {
121
- if (now - statSync(lockPath).mtimeMs < SKILLS_FRESHNESS_MS) return true;
122
- }
161
+ if (now - statSync(lockPath).mtimeMs < SKILLS_FRESHNESS_MS) {
162
+ if (requiredSkills.every((skill) => projectSkillDirs.some((dir) => existsSync(resolve(cwd, dir, "skills", skill, "SKILL.md"))))) return true;
123
163
  }
124
164
  } catch {}
125
165
  const globalDirs = GLOBAL_SKILLS_DIRS[getSkillsAgentName(agent)] ?? [];
126
- for (const dir of globalDirs) {
127
- const neonSkillMd = resolve(dir, "neon-postgres", "SKILL.md");
128
- if (existsSync(neonSkillMd)) try {
129
- if (now - statSync(neonSkillMd).mtimeMs < SKILLS_FRESHNESS_MS) return true;
130
- } catch {}
131
- }
166
+ for (const dir of globalDirs) if (requiredSkills.every((skill) => existsSync(resolve(dir, skill, "SKILL.md")))) try {
167
+ if (now - statSync(resolve(dir, requiredSkills[0], "SKILL.md")).mtimeMs < SKILLS_FRESHNESS_MS) return true;
168
+ } catch {}
132
169
  return false;
133
170
  }
134
171
  /**
@@ -138,31 +175,46 @@ function skillsAreFresh(agent) {
138
175
  * Designed to be called from any phase handler — cheap to call repeatedly
139
176
  * since it's a no-op when skills are fresh.
140
177
  */
141
- async function ensureSkillsUpToDate(agent, scope) {
142
- if (skillsAreFresh(agent)) return true;
143
- const agentName = getSkillsAgentName(agent);
144
- try {
145
- await execa("npx", [
146
- "-y",
147
- "skills",
178
+ async function ensureSkillsUpToDate(agent, scope, preview) {
179
+ const resolvedAgent = agent || "cursor";
180
+ const skills = getSkillList(preview);
181
+ if (skillsAreFresh(resolvedAgent, skills)) return true;
182
+ await ensureSkillsCli();
183
+ const agentName = getSkillsAgentName(resolvedAgent);
184
+ let allOk = true;
185
+ const home = process.env.HOME || process.env.USERPROFILE || "";
186
+ const cwd = process.cwd();
187
+ const checkDirs = scope === "global" ? [
188
+ resolve(home, ".cursor", "skills"),
189
+ resolve(home, ".claude", "skills"),
190
+ resolve(home, ".agents", "skills")
191
+ ] : [
192
+ resolve(cwd, ".cursor", "skills"),
193
+ resolve(cwd, ".claude", "skills"),
194
+ resolve(cwd, ".agents", "skills")
195
+ ];
196
+ const missingSkills = skills.filter((skill) => !checkDirs.some((dir) => existsSync(resolve(dir, skill, "SKILL.md"))));
197
+ if (missingSkills.length === 0) return true;
198
+ for (const skill of missingSkills) try {
199
+ await execa("skills", [
148
200
  "add",
149
201
  "neondatabase/agent-skills",
150
202
  "--skill",
151
- "neon-postgres",
203
+ skill,
152
204
  "--agent",
153
205
  agentName,
154
206
  ...scope === "global" ? ["-g"] : [],
155
207
  "-y"
156
208
  ], {
157
209
  stdio: "pipe",
158
- timeout: 6e4
210
+ timeout: 12e4
159
211
  });
160
- return true;
161
212
  } catch {
162
- return false;
213
+ allOk = false;
163
214
  }
215
+ return allOk;
164
216
  }
165
217
  //#endregion
166
- export { SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, installAgentSkills };
218
+ export { SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, getSkillList, installAgentSkills };
167
219
 
168
220
  //# sourceMappingURL=skills.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skills.js","names":["getSkillsAgentNameFromId"],"sources":["../../src/lib/skills.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { log, spinner } from \"@clack/prompts\";\nimport { execa } from \"execa\";\nimport { dim } from \"yoctocolors\";\nimport { getSkillsAgentName as getSkillsAgentNameFromId } from \"./agents.js\";\nimport type { Editor } from \"./types.js\";\n\nconst SKILL_BASE_URL =\n\t\"https://neon.com/docs/ai/skills/neon-postgres/references\";\n\nexport const SKILL_REFERENCE_URLS: Record<string, string> = {\n\tgettingStarted: `${SKILL_BASE_URL}/getting-started.md`,\n\tconnectionMethods: `${SKILL_BASE_URL}/connection-methods.md`,\n\tneonAuth: `${SKILL_BASE_URL}/neon-auth.md`,\n\tserverlessDriver: `${SKILL_BASE_URL}/neon-serverless.md`,\n\tneonCli: `${SKILL_BASE_URL}/neon-cli.md`,\n\tdevtools: `${SKILL_BASE_URL}/devtools.md`,\n\tbranching: `${SKILL_BASE_URL}/branching.md`,\n\tneonJs: `${SKILL_BASE_URL}/neon-js.md`,\n};\n\n/**\n * Fetches the \"Getting Started with Neon\" skill content from the public URL.\n * Returns the markdown content, or null if the fetch fails.\n */\nexport async function fetchSkillContent(): Promise<string | null> {\n\ttry {\n\t\tconst response = await fetch(SKILL_REFERENCE_URLS.gettingStarted, {\n\t\t\tsignal: AbortSignal.timeout(10000),\n\t\t});\n\t\tif (!response.ok) return null;\n\t\treturn await response.text();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Maps Editor display names to the skills CLI agent name.\n * Used only by the v1 installAgentSkills function.\n */\nfunction editorToSkillsAgent(editor: Editor): string {\n\tswitch (editor) {\n\t\tcase \"Cursor\":\n\t\t\treturn \"cursor\";\n\t\tcase \"VS Code\":\n\t\tcase \"GitHub Copilot CLI\":\n\t\t\treturn \"github-copilot\";\n\t\tcase \"Claude CLI\":\n\t\t\treturn \"claude-code\";\n\t\tcase \"Codex\":\n\t\t\treturn \"codex\";\n\t\tcase \"OpenCode\":\n\t\t\treturn \"opencode\";\n\t\tcase \"Antigravity\":\n\t\t\treturn \"antigravity\";\n\t\tcase \"Cline\":\n\t\tcase \"Cline CLI\":\n\t\t\treturn \"cline\";\n\t\tcase \"Gemini CLI\":\n\t\t\treturn \"gemini-cli\";\n\t\tcase \"Goose\":\n\t\t\treturn \"goose\";\n\t\tcase \"Claude Desktop\":\n\t\t\treturn \"claude-code\";\n\t\tcase \"MCPorter\":\n\t\t\treturn \"mcporter\";\n\t\tcase \"Zed\":\n\t\t\treturn \"zed\";\n\t\tdefault:\n\t\t\treturn \"\";\n\t}\n}\n\nexport interface InstallSkillsOptions {\n\tjson?: boolean;\n\tscope?: \"global\" | \"project\";\n}\n\n/**\n * Installs Neon agent skills using Vercel's skills CLI.\n */\nexport async function installAgentSkills(\n\tselectedEditors: Editor[],\n\toptions?: InstallSkillsOptions,\n): Promise<boolean> {\n\tconst quiet = options?.json === true;\n\n\tconst editorsWithSkills = selectedEditors.filter(\n\t\t(e) => editorToSkillsAgent(e) !== \"\",\n\t);\n\n\tif (editorsWithSkills.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst skillsSpinner = quiet ? null : spinner();\n\tskillsSpinner?.start(\"Installing agent skills for Neon in this project...\");\n\n\tlet anyFailed = false;\n\n\tfor (const editor of editorsWithSkills) {\n\t\tconst agentName = editorToSkillsAgent(editor);\n\n\t\ttry {\n\t\t\tawait execa(\n\t\t\t\t\"npx\",\n\t\t\t\t[\n\t\t\t\t\t\"skills\",\n\t\t\t\t\t\"add\",\n\t\t\t\t\t\"neondatabase/agent-skills\",\n\t\t\t\t\t\"--skill\",\n\t\t\t\t\t\"neon-postgres\",\n\t\t\t\t\t\"--agent\",\n\t\t\t\t\tagentName,\n\t\t\t\t\t...(options?.scope === \"global\" ? [\"-g\"] : []),\n\t\t\t\t\t\"-y\",\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tstdio: \"pipe\",\n\t\t\t\t\ttimeout: 10000,\n\t\t\t\t},\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (!quiet)\n\t\t\t\tlog.error(\n\t\t\t\t\t`Failed to install agent skills for ${editor}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t);\n\t\t\tanyFailed = true;\n\t\t}\n\t}\n\n\tif (anyFailed) {\n\t\tskillsSpinner?.stop(\n\t\t\t\"Agent skills installation for this project completed with errors\",\n\t\t);\n\t\tif (!quiet)\n\t\t\tlog.info(\n\t\t\t\t\"You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon-postgres\",\n\t\t\t);\n\t\treturn false;\n\t}\n\n\tskillsSpinner?.stop(dim(\"Agent skills installed ✓\"));\n\treturn true;\n}\n\n// ---------------------------------------------------------------------------\n// Evergreen skills: ensure skills are up to date (at most once per 12 hours)\n// ---------------------------------------------------------------------------\n\nconst SKILLS_FRESHNESS_MS = 12 * 60 * 60 * 1000; // 12 hours\n\n/**\n * Agent skills directory paths by agent, keyed by scope.\n * These are the directories that `skills add` writes to.\n */\nconst GLOBAL_SKILLS_DIRS: Record<string, string[]> = (() => {\n\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\treturn {\n\t\tcursor: [resolve(home, \".cursor\", \"skills\")],\n\t\t\"claude-code\": [resolve(home, \".claude\", \"skills\")],\n\t\t\"github-copilot\": [resolve(home, \".vscode\", \"skills\")],\n\t\tcodex: [resolve(home, \".codex\", \"skills\")],\n\t\tcline: [resolve(home, \".cline\", \"skills\")],\n\t};\n})();\n\n/**\n * Checks whether skills were recently updated (within the freshness window).\n * Checks both project-level (skills-lock.json mtime) and global (skills dir mtime).\n */\nfunction skillsAreFresh(agent: string): boolean {\n\tconst now = Date.now();\n\tconst cwd = process.cwd();\n\n\t// Check project-level: skills-lock.json must reference neon-postgres\n\t// AND the skill file must actually exist on disk\n\tconst lockPath = resolve(cwd, \"skills-lock.json\");\n\tif (existsSync(lockPath)) {\n\t\ttry {\n\t\t\tconst content = readFileSync(lockPath, \"utf-8\");\n\t\t\tif (content.includes(\"neon-postgres\")) {\n\t\t\t\t// Verify the actual skill file exists (lock file can be stale)\n\t\t\t\tconst skillExists =\n\t\t\t\t\texistsSync(\n\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\".agents\",\n\t\t\t\t\t\t\t\"skills\",\n\t\t\t\t\t\t\t\"neon-postgres\",\n\t\t\t\t\t\t\t\"SKILL.md\",\n\t\t\t\t\t\t),\n\t\t\t\t\t) ||\n\t\t\t\t\texistsSync(\n\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\".cursor\",\n\t\t\t\t\t\t\t\"skills\",\n\t\t\t\t\t\t\t\"neon-postgres\",\n\t\t\t\t\t\t\t\"SKILL.md\",\n\t\t\t\t\t\t),\n\t\t\t\t\t) ||\n\t\t\t\t\texistsSync(\n\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\".claude\",\n\t\t\t\t\t\t\t\"skills\",\n\t\t\t\t\t\t\t\"neon-postgres\",\n\t\t\t\t\t\t\t\"SKILL.md\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\tif (skillExists) {\n\t\t\t\t\tconst mtime = statSync(lockPath).mtimeMs;\n\t\t\t\t\tif (now - mtime < SKILLS_FRESHNESS_MS) return true;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\t// Check global: neon-postgres SKILL.md inside agent-specific skills directories\n\tconst agentName = getSkillsAgentNameFromId(agent);\n\tconst globalDirs = GLOBAL_SKILLS_DIRS[agentName] ?? [];\n\tfor (const dir of globalDirs) {\n\t\tconst neonSkillMd = resolve(dir, \"neon-postgres\", \"SKILL.md\");\n\t\tif (existsSync(neonSkillMd)) {\n\t\t\ttry {\n\t\t\t\tconst mtime = statSync(neonSkillMd).mtimeMs;\n\t\t\t\tif (now - mtime < SKILLS_FRESHNESS_MS) return true;\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Ensures Neon agent skills are up to date. Runs `skills add` if the skills\n * haven't been updated within the freshness window (12 hours).\n *\n * Designed to be called from any phase handler — cheap to call repeatedly\n * since it's a no-op when skills are fresh.\n */\nexport async function ensureSkillsUpToDate(\n\tagent: string,\n\tscope?: \"global\" | \"project\",\n): Promise<boolean> {\n\tif (skillsAreFresh(agent)) return true;\n\n\tconst agentName = getSkillsAgentNameFromId(agent);\n\ttry {\n\t\tawait execa(\n\t\t\t\"npx\",\n\t\t\t[\n\t\t\t\t\"-y\",\n\t\t\t\t\"skills\",\n\t\t\t\t\"add\",\n\t\t\t\t\"neondatabase/agent-skills\",\n\t\t\t\t\"--skill\",\n\t\t\t\t\"neon-postgres\",\n\t\t\t\t\"--agent\",\n\t\t\t\tagentName,\n\t\t\t\t...(scope === \"global\" ? [\"-g\"] : []),\n\t\t\t\t\"-y\",\n\t\t\t],\n\t\t\t{ stdio: \"pipe\", timeout: 60000 },\n\t\t);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;;;;AAQA,MAAM,iBACL;AAED,MAAa,uBAA+C;CAC3D,gBAAgB,GAAG,eAAe;CAClC,mBAAmB,GAAG,eAAe;CACrC,UAAU,GAAG,eAAe;CAC5B,kBA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,QAAQ,KAAK,iBAAiB,UAAU;EAC5D,IAAI,WAAW,WAAW,GACzB,IAAI;GAEH,IAAI,MADU,SAAS,WAAW,CAAC,CAAC,UAClB,qBAAqB,OAAO;EAC/C,QAAQ,CAAC;CAEX;CAEA,OAAO;AACR;;;;;;;;AASA,eAAsB,qBACrB,OACA,OACmB;CACnB,IAAI,eAAe,KAAK,GAAG,OAAO;CAElC,MAAM,YAAYA,mBAAyB,KAAK;CAChD,IAAI;EACH,MAAM,MACL,OACA;GACC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAI,UAAU,WAAW,CAAC,IAAI,IAAI,CAAC;GACnC;EACD,GACA;GAAE,OAAO;GAAQ,SAAS;EAAM,CACjC;EACA,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"skills.js","names":["getSkillsAgentNameFromId"],"sources":["../../src/lib/skills.ts"],"sourcesContent":["import { existsSync, statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { log, spinner } from \"@clack/prompts\";\nimport { execa } from \"execa\";\nimport { dim } from \"yoctocolors\";\nimport { getSkillsAgentName as getSkillsAgentNameFromId } from \"./agents.js\";\nimport type { Editor } from \"./types.js\";\n\n/**\n * Ensures the `skills` CLI is globally installed so npx doesn't need\n * to download it (which can fail behind corporate proxies / sandboxes).\n */\nasync function ensureSkillsCli(): Promise<void> {\n\ttry {\n\t\tawait execa(\"skills\", [\"--version\"], { stdio: \"pipe\", timeout: 5000 });\n\t} catch {\n\t\t// Not installed — install it globally\n\t\ttry {\n\t\t\tawait execa(\"npm\", [\"install\", \"-g\", \"skills\"], {\n\t\t\t\tstdio: \"pipe\",\n\t\t\t\ttimeout: 60000,\n\t\t\t});\n\t\t} catch {\n\t\t\t// Best effort — npx will fall back to downloading\n\t\t}\n\t}\n}\n\n/** Base skills installed for all invocations */\nconst BASE_SKILLS = [\"neon\", \"neon-postgres\"];\n\n/** Additional skills installed for preview (non-bootstrap) invocations */\nconst PREVIEW_SKILLS = [\n\t\"neon-object-storage\",\n\t\"neon-functions\",\n\t\"neon-ai-gateway\",\n];\n\n/** Returns the skill list based on whether preview mode is active */\nexport function getSkillList(preview?: boolean): string[] {\n\treturn preview ? [...BASE_SKILLS, ...PREVIEW_SKILLS] : BASE_SKILLS;\n}\n\nconst SKILL_BASE_URL =\n\t\"https://neon.com/docs/ai/skills/neon-postgres/references\";\n\nexport const SKILL_REFERENCE_URLS: Record<string, string> = {\n\tgettingStarted: `${SKILL_BASE_URL}/getting-started.md`,\n\tconnectionMethods: `${SKILL_BASE_URL}/connection-methods.md`,\n\tneonAuth: `${SKILL_BASE_URL}/neon-auth.md`,\n\tserverlessDriver: `${SKILL_BASE_URL}/neon-serverless.md`,\n\tneonCli: `${SKILL_BASE_URL}/neon-cli.md`,\n\tdevtools: `${SKILL_BASE_URL}/devtools.md`,\n\tbranching: `${SKILL_BASE_URL}/branching.md`,\n\tneonJs: `${SKILL_BASE_URL}/neon-js.md`,\n};\n\n/**\n * Fetches the \"Getting Started with Neon\" skill content from the public URL.\n * Returns the markdown content, or null if the fetch fails.\n */\nexport async function fetchSkillContent(): Promise<string | null> {\n\ttry {\n\t\tconst response = await fetch(SKILL_REFERENCE_URLS.gettingStarted, {\n\t\t\tsignal: AbortSignal.timeout(10000),\n\t\t});\n\t\tif (!response.ok) return null;\n\t\treturn await response.text();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Maps Editor display names to the skills CLI agent name.\n * Used only by the v1 installAgentSkills function.\n */\nfunction editorToSkillsAgent(editor: Editor): string {\n\tswitch (editor) {\n\t\tcase \"Cursor\":\n\t\t\treturn \"cursor\";\n\t\tcase \"VS Code\":\n\t\tcase \"GitHub Copilot CLI\":\n\t\t\treturn \"github-copilot\";\n\t\tcase \"Claude CLI\":\n\t\t\treturn \"claude-code\";\n\t\tcase \"Codex\":\n\t\t\treturn \"codex\";\n\t\tcase \"OpenCode\":\n\t\t\treturn \"opencode\";\n\t\tcase \"Antigravity\":\n\t\t\treturn \"antigravity\";\n\t\tcase \"Cline\":\n\t\tcase \"Cline CLI\":\n\t\t\treturn \"cline\";\n\t\tcase \"Gemini CLI\":\n\t\t\treturn \"gemini-cli\";\n\t\tcase \"Goose\":\n\t\t\treturn \"goose\";\n\t\tcase \"Claude Desktop\":\n\t\t\treturn \"claude-code\";\n\t\tcase \"MCPorter\":\n\t\t\treturn \"mcporter\";\n\t\tcase \"Zed\":\n\t\t\treturn \"zed\";\n\t\tdefault:\n\t\t\treturn \"\";\n\t}\n}\n\nexport interface InstallSkillsOptions {\n\tjson?: boolean;\n\tscope?: \"global\" | \"project\";\n\tpreview?: boolean;\n}\n\n/**\n * Installs Neon agent skills using Vercel's skills CLI.\n */\nexport async function installAgentSkills(\n\tselectedEditors: Editor[],\n\toptions?: InstallSkillsOptions,\n): Promise<boolean> {\n\tconst quiet = options?.json === true;\n\n\tconst editorsWithSkills = selectedEditors.filter(\n\t\t(e) => editorToSkillsAgent(e) !== \"\",\n\t);\n\n\tif (editorsWithSkills.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst skillsSpinner = quiet ? null : spinner();\n\tskillsSpinner?.start(\"Installing agent skills for Neon in this project...\");\n\n\tlet anyFailed = false;\n\n\tawait ensureSkillsCli();\n\tconst skills = getSkillList(options?.preview);\n\n\tfor (const editor of editorsWithSkills) {\n\t\tconst agentName = editorToSkillsAgent(editor);\n\n\t\t// Install one skill at a time — the skills CLI has a bug with multiple\n\t\t// --skill flags where it creates directories but doesn't copy all SKILL.md files.\n\t\tfor (const skill of skills) {\n\t\t\ttry {\n\t\t\t\tawait execa(\n\t\t\t\t\t\"skills\",\n\t\t\t\t\t[\n\t\t\t\t\t\t\"add\",\n\t\t\t\t\t\t\"neondatabase/agent-skills\",\n\t\t\t\t\t\t\"--skill\",\n\t\t\t\t\t\tskill,\n\t\t\t\t\t\t\"--agent\",\n\t\t\t\t\t\tagentName,\n\t\t\t\t\t\t...(options?.scope === \"global\" ? [\"-g\"] : []),\n\t\t\t\t\t\t\"-y\",\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tstdio: \"pipe\",\n\t\t\t\t\t\ttimeout: 120000,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tif (!quiet)\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`Failed to install skill ${skill} for ${editor}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t\t);\n\t\t\t\tanyFailed = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (anyFailed) {\n\t\tskillsSpinner?.stop(\n\t\t\t\"Agent skills installation for this project completed with errors\",\n\t\t);\n\t\tif (!quiet)\n\t\t\tlog.info(\n\t\t\t\t\"You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon --skill neon-postgres\",\n\t\t\t);\n\t\treturn false;\n\t}\n\n\tskillsSpinner?.stop(dim(\"Agent skills installed ✓\"));\n\treturn true;\n}\n\n// ---------------------------------------------------------------------------\n// Evergreen skills: ensure skills are up to date (at most once per 12 hours)\n// ---------------------------------------------------------------------------\n\nconst SKILLS_FRESHNESS_MS = 12 * 60 * 60 * 1000; // 12 hours\n\n/**\n * Agent skills directory paths by agent, keyed by scope.\n * These are the directories that `skills add` writes to.\n */\nconst GLOBAL_SKILLS_DIRS: Record<string, string[]> = (() => {\n\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\t// .agents/skills is the generic directory used by multiple agents\n\tconst agentsDir = resolve(home, \".agents\", \"skills\");\n\treturn {\n\t\tcursor: [resolve(home, \".cursor\", \"skills\"), agentsDir],\n\t\t\"claude-code\": [resolve(home, \".claude\", \"skills\"), agentsDir],\n\t\t\"github-copilot\": [resolve(home, \".vscode\", \"skills\"), agentsDir],\n\t\tcodex: [resolve(home, \".codex\", \"skills\"), agentsDir],\n\t\tcline: [resolve(home, \".cline\", \"skills\"), agentsDir],\n\t};\n})();\n\n/**\n * Checks whether skills were recently updated (within the freshness window).\n * Checks both project-level (skills-lock.json mtime) and global (skills dir mtime).\n */\nfunction skillsAreFresh(agent: string, requiredSkills: string[]): boolean {\n\tconst now = Date.now();\n\tconst cwd = process.cwd();\n\tconst projectSkillDirs = [\".agents\", \".cursor\", \".claude\"];\n\n\t// Check project-level: ALL required skills must exist on disk\n\t// and skills-lock.json must be recent\n\tconst lockPath = resolve(cwd, \"skills-lock.json\");\n\tif (existsSync(lockPath)) {\n\t\ttry {\n\t\t\tconst mtime = statSync(lockPath).mtimeMs;\n\t\t\tif (now - mtime < SKILLS_FRESHNESS_MS) {\n\t\t\t\tconst allExist = requiredSkills.every((skill) =>\n\t\t\t\t\tprojectSkillDirs.some((dir) =>\n\t\t\t\t\t\texistsSync(\n\t\t\t\t\t\t\tresolve(cwd, dir, \"skills\", skill, \"SKILL.md\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (allExist) return true;\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\t// Check global: ALL required skills must exist in agent-specific dirs\n\tconst agentName = getSkillsAgentNameFromId(agent);\n\tconst globalDirs = GLOBAL_SKILLS_DIRS[agentName] ?? [];\n\tfor (const dir of globalDirs) {\n\t\tconst allExist = requiredSkills.every((skill) =>\n\t\t\texistsSync(resolve(dir, skill, \"SKILL.md\")),\n\t\t);\n\t\tif (allExist) {\n\t\t\t// Check freshness of any one skill file\n\t\t\ttry {\n\t\t\t\tconst mtime = statSync(\n\t\t\t\t\tresolve(dir, requiredSkills[0], \"SKILL.md\"),\n\t\t\t\t).mtimeMs;\n\t\t\t\tif (now - mtime < SKILLS_FRESHNESS_MS) return true;\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Ensures Neon agent skills are up to date. Runs `skills add` if the skills\n * haven't been updated within the freshness window (12 hours).\n *\n * Designed to be called from any phase handler — cheap to call repeatedly\n * since it's a no-op when skills are fresh.\n */\nexport async function ensureSkillsUpToDate(\n\tagent: string | undefined,\n\tscope?: \"global\" | \"project\",\n\tpreview?: boolean,\n): Promise<boolean> {\n\tconst resolvedAgent = agent || \"cursor\";\n\tconst skills = getSkillList(preview);\n\tif (skillsAreFresh(resolvedAgent, skills)) return true;\n\n\tawait ensureSkillsCli();\n\tconst agentName = getSkillsAgentNameFromId(resolvedAgent);\n\tlet allOk = true;\n\n\t// Only install skills that don't already have SKILL.md on disk.\n\t// Re-installing existing skills can trigger sandbox permission prompts.\n\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\tconst cwd = process.cwd();\n\tconst checkDirs =\n\t\tscope === \"global\"\n\t\t\t? [\n\t\t\t\t\tresolve(home, \".cursor\", \"skills\"),\n\t\t\t\t\tresolve(home, \".claude\", \"skills\"),\n\t\t\t\t\tresolve(home, \".agents\", \"skills\"),\n\t\t\t\t]\n\t\t\t: [\n\t\t\t\t\tresolve(cwd, \".cursor\", \"skills\"),\n\t\t\t\t\tresolve(cwd, \".claude\", \"skills\"),\n\t\t\t\t\tresolve(cwd, \".agents\", \"skills\"),\n\t\t\t\t];\n\n\tconst missingSkills = skills.filter(\n\t\t(skill) =>\n\t\t\t!checkDirs.some((dir) =>\n\t\t\t\texistsSync(resolve(dir, skill, \"SKILL.md\")),\n\t\t\t),\n\t);\n\n\tif (missingSkills.length === 0) return true;\n\n\t// Install one skill at a time — the skills CLI has a bug with multiple\n\t// --skill flags where it creates directories but doesn't copy all SKILL.md files.\n\tfor (const skill of missingSkills) {\n\t\ttry {\n\t\t\tawait execa(\n\t\t\t\t\"skills\",\n\t\t\t\t[\n\t\t\t\t\t\"add\",\n\t\t\t\t\t\"neondatabase/agent-skills\",\n\t\t\t\t\t\"--skill\",\n\t\t\t\t\tskill,\n\t\t\t\t\t\"--agent\",\n\t\t\t\t\tagentName,\n\t\t\t\t\t...(scope === \"global\" ? [\"-g\"] : []),\n\t\t\t\t\t\"-y\",\n\t\t\t\t],\n\t\t\t\t{ stdio: \"pipe\", timeout: 120000 },\n\t\t\t);\n\t\t} catch {\n\t\t\tall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,IAAI;CACxB,MAAM,YACL,UAAU,WACP;EACA,QAAQ,MAAM,WAAW,QAAQ;EACjC,QAAQ,MAAM,WAAW,QAAQ;EACjC,QAAQ,MAAM,WAAW,QAAQ;CAClC,IACC;EACA,QAAQ,KAAK,WAAW,QAAQ;EAChC,QAAQ,KAAK,WAAW,QAAQ;EAChC,QAAQ,KAAK,WAAW,QAAQ;CACjC;CAEH,MAAM,gBAAgB,OAAO,QAC3B,UACA,CAAC,UAAU,MAAM,QAChB,WAAW,QAAQ,KAAK,OAAO,UAAU,CAAC,CAC3C,CACF;CAEA,IAAI,cAAc,WAAW,GAAG,OAAO;CAIvC,KAAK,MAAM,SAAS,eACnB,IAAI;EACH,MAAM,MACL,UACA;GACC;GACA;GACA;GACA;GACA;GACA;GACA,GAAI,UAAU,WAAW,CAAC,IAAI,IAAI,CAAC;GACnC;EACD,GACA;GAAE,OAAO;GAAQ,SAAS;EAAO,CAClC;CACD,QAAQ;EACP,QAAQ;CACT;CAGD,OAAO;AACR"}
@@ -128,10 +128,12 @@ interface StatusResponse {
128
128
  tooling: {
129
129
  mcpServer: {
130
130
  configured: boolean | null;
131
+ scope?: string | null;
131
132
  location?: string;
132
133
  };
133
134
  skills: {
134
135
  installed: boolean;
136
+ scope?: string | null;
135
137
  };
136
138
  extension?: {
137
139
  installed: boolean;
package/dist/v2.d.ts CHANGED
@@ -3,7 +3,6 @@ import { PhaseResponse } from "./lib/types.js";
3
3
  //#region src/v2.d.ts
4
4
  interface OrchestratorOptions {
5
5
  agent?: string;
6
- skipNeonAuth?: boolean;
7
6
  skipMigrations?: boolean;
8
7
  /** Enable preview features (e.g. project bootstrapping from templates) */
9
8
  preview?: boolean;
package/dist/v2.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","names":[],"sources":["../src/v2.ts"],"mappings":";;;UAYiB,mBAAA;;EAAA,YAAA,CAAA,EAAA,OAAmB;EAyBd,cAAW,CAAA,EAAA,OAAA;EAAA;SACvB,CAAA,EAAA,OAAA;;;AACA;;;;;;;;;;;;;;;;iBAFY,WAAA,UACZ,sBACP,QAAQ"}
1
+ {"version":3,"file":"v2.d.ts","names":[],"sources":["../src/v2.ts"],"mappings":";;;UAYiB,mBAAA;;EAAA,cAAA,CAAA,EAAA,OAAmB;EAwBd;EAAW,OAAA,CAAA,EAAA,OAAA;;;;AAEvB;;;;;;;;;;;;;;;iBAFY,WAAA,UACZ,sBACP,QAAQ"}
package/dist/v2.js CHANGED
@@ -62,13 +62,39 @@ async function orchestrate(options) {
62
62
  }
63
63
  ]);
64
64
  const hasApp = options.preview ? inspection.hasApp === true : true;
65
- const toolingInstalled = inspection.mcpConfigured && inspection.skillsInstalled;
65
+ let skillsInstalled = inspection.skillsInstalled;
66
+ if (options.preview && skillsInstalled && inspection.skillsScope) {
67
+ const { getSkillList } = await import("./lib/skills.js");
68
+ const previewSkills = getSkillList(true);
69
+ const { existsSync: exists } = await import("node:fs");
70
+ const { resolve: resolvePath } = await import("node:path");
71
+ const home = process.env.HOME || process.env.USERPROFILE || "";
72
+ const dirs = inspection.skillsScope === "project" ? [
73
+ resolvePath(cwd, ".cursor", "skills"),
74
+ resolvePath(cwd, ".claude", "skills"),
75
+ resolvePath(cwd, ".agents", "skills")
76
+ ] : [
77
+ resolvePath(home, ".cursor", "skills"),
78
+ resolvePath(home, ".claude", "skills"),
79
+ resolvePath(home, ".agents", "skills")
80
+ ];
81
+ if (!previewSkills.every((skill) => dirs.some((dir) => exists(resolvePath(dir, skill, "SKILL.md"))))) {
82
+ skillsInstalled = false;
83
+ inspection.skillsScope = `${inspection.skillsScope}-partial`;
84
+ }
85
+ }
86
+ const toolingInstalled = inspection.mcpConfigured && skillsInstalled;
66
87
  const hasNeonConnection = inspection.connectionString === true;
67
88
  if (!hasApp || !toolingInstalled) {
68
89
  cleanupInitState(resolve(cwd, ".neon"));
69
90
  return handleSetupPhase({
70
91
  agent: options.agent,
71
- hasApp
92
+ preview: options.preview,
93
+ hasApp,
94
+ mcpConfigured: inspection.mcpConfigured ?? null,
95
+ mcpScope: inspection.mcpScope || void 0,
96
+ skillsInstalled: skillsInstalled ?? null,
97
+ skillsScope: inspection.skillsScope || void 0
72
98
  });
73
99
  }
74
100
  const neonContextPath = resolve(cwd, ".neon");
@@ -94,11 +120,10 @@ async function orchestrate(options) {
94
120
  writeFileSync(neonContextPath, `${JSON.stringify(merged, null, 2)}\n`);
95
121
  }
96
122
  } catch {}
97
- const hasFeatureRequirements = features.length > 0;
98
- if (hasFeatureRequirements ? features.includes("auth") : !options.skipNeonAuth) {
123
+ if (features.includes("auth")) {
99
124
  if (!checkNeonAuth(cwd)) return handleNeonAuthPhase({
100
125
  agent: options.agent,
101
- setup: hasFeatureRequirements
126
+ setup: true
102
127
  });
103
128
  }
104
129
  if (!options.skipMigrations) return handleMigrationsPhase({ agent: options.agent });