neon-init 0.13.1 → 0.15.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.
- package/dist/cli.js +368 -33
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +220 -41
- package/dist/index.js.map +1 -1
- package/dist/interactive.d.ts +12 -0
- package/dist/interactive.d.ts.map +1 -0
- package/dist/interactive.js +495 -0
- package/dist/interactive.js.map +1 -0
- package/dist/lib/agents.d.ts +23 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/agents.js +148 -0
- package/dist/lib/agents.js.map +1 -0
- package/dist/lib/auth.d.ts +10 -3
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +20 -13
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/bootstrap.d.ts +30 -0
- package/dist/lib/bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap.js +61 -0
- package/dist/lib/bootstrap.js.map +1 -0
- package/dist/lib/build-config.d.ts +5 -0
- package/dist/lib/build-config.d.ts.map +1 -0
- package/dist/lib/build-config.js +6 -0
- package/dist/lib/build-config.js.map +1 -0
- package/dist/lib/detect-agent.d.ts +22 -0
- package/dist/lib/detect-agent.d.ts.map +1 -0
- package/dist/lib/detect-agent.js +65 -0
- package/dist/lib/detect-agent.js.map +1 -0
- package/dist/lib/editors.d.ts.map +1 -1
- package/dist/lib/editors.js +1 -2
- package/dist/lib/editors.js.map +1 -1
- package/dist/lib/extension.d.ts +11 -3
- package/dist/lib/extension.d.ts.map +1 -1
- package/dist/lib/extension.js +29 -9
- package/dist/lib/extension.js.map +1 -1
- package/dist/lib/inspect.d.ts +28 -0
- package/dist/lib/inspect.d.ts.map +1 -0
- package/dist/lib/inspect.js +190 -0
- package/dist/lib/inspect.js.map +1 -0
- package/dist/lib/install.d.ts +10 -4
- package/dist/lib/install.d.ts.map +1 -1
- package/dist/lib/install.js +74 -71
- package/dist/lib/install.js.map +1 -1
- package/dist/lib/neonctl.d.ts +32 -0
- package/dist/lib/neonctl.d.ts.map +1 -0
- package/dist/lib/neonctl.js +149 -0
- package/dist/lib/neonctl.js.map +1 -0
- package/dist/lib/phases/auth.d.ts +12 -0
- package/dist/lib/phases/auth.d.ts.map +1 -0
- package/dist/lib/phases/auth.js +188 -0
- package/dist/lib/phases/auth.js.map +1 -0
- package/dist/lib/phases/cleanup.d.ts +12 -0
- package/dist/lib/phases/cleanup.d.ts.map +1 -0
- package/dist/lib/phases/cleanup.js +29 -0
- package/dist/lib/phases/cleanup.js.map +1 -0
- package/dist/lib/phases/db.d.ts +17 -0
- package/dist/lib/phases/db.d.ts.map +1 -0
- package/dist/lib/phases/db.js +258 -0
- package/dist/lib/phases/db.js.map +1 -0
- package/dist/lib/phases/getting-started.d.ts +26 -0
- package/dist/lib/phases/getting-started.d.ts.map +1 -0
- package/dist/lib/phases/getting-started.js +195 -0
- package/dist/lib/phases/getting-started.js.map +1 -0
- package/dist/lib/phases/mcp.d.ts +15 -0
- package/dist/lib/phases/mcp.d.ts.map +1 -0
- package/dist/lib/phases/mcp.js +179 -0
- package/dist/lib/phases/mcp.js.map +1 -0
- package/dist/lib/phases/migrations.d.ts +14 -0
- package/dist/lib/phases/migrations.d.ts.map +1 -0
- package/dist/lib/phases/migrations.js +239 -0
- package/dist/lib/phases/migrations.js.map +1 -0
- package/dist/lib/phases/neon-auth.d.ts +13 -0
- package/dist/lib/phases/neon-auth.d.ts.map +1 -0
- package/dist/lib/phases/neon-auth.js +117 -0
- package/dist/lib/phases/neon-auth.js.map +1 -0
- package/dist/lib/phases/setup.d.ts +41 -0
- package/dist/lib/phases/setup.d.ts.map +1 -0
- package/dist/lib/phases/setup.js +689 -0
- package/dist/lib/phases/setup.js.map +1 -0
- package/dist/lib/phases/skills.d.ts +14 -0
- package/dist/lib/phases/skills.d.ts.map +1 -0
- package/dist/lib/phases/skills.js +80 -0
- package/dist/lib/phases/skills.js.map +1 -0
- package/dist/lib/phases/status.d.ts +10 -0
- package/dist/lib/phases/status.d.ts.map +1 -0
- package/dist/lib/phases/status.js +65 -0
- package/dist/lib/phases/status.js.map +1 -0
- package/dist/lib/resolve-context.d.ts +19 -0
- package/dist/lib/resolve-context.d.ts.map +1 -0
- package/dist/lib/resolve-context.js +112 -0
- package/dist/lib/resolve-context.js.map +1 -0
- package/dist/lib/route-command.d.ts +8 -0
- package/dist/lib/route-command.d.ts.map +1 -0
- package/dist/lib/route-command.js +195 -0
- package/dist/lib/route-command.js.map +1 -0
- package/dist/lib/skills.d.ts +21 -4
- package/dist/lib/skills.d.ts.map +1 -1
- package/dist/lib/skills.js +129 -22
- package/dist/lib/skills.js.map +1 -1
- package/dist/lib/types.d.ts +146 -13
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/vsix.d.ts +15 -0
- package/dist/lib/vsix.d.ts.map +1 -0
- package/dist/lib/vsix.js +91 -0
- package/dist/lib/vsix.js.map +1 -0
- package/dist/v2.d.ts +31 -0
- package/dist/v2.d.ts.map +1 -0
- package/dist/v2.js +147 -0
- package/dist/v2.js.map +1 -0
- package/package.json +9 -4
- package/dist/lib/mcp-config.d.ts +0 -24
- package/dist/lib/mcp-config.d.ts.map +0 -1
- package/dist/lib/mcp-config.js +0 -51
- package/dist/lib/mcp-config.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { detectAgent } from "./detect-agent.js";
|
|
2
|
+
//#region src/lib/route-command.ts
|
|
3
|
+
/**
|
|
4
|
+
* Routes neon-init CLI args to the appropriate phase handler directly,
|
|
5
|
+
* without shelling out. This is the in-process equivalent of calling
|
|
6
|
+
* `neon-init <subcommand> <flags>`.
|
|
7
|
+
*/
|
|
8
|
+
function resolveAgent(explicit) {
|
|
9
|
+
return explicit ?? detectAgent() ?? void 0;
|
|
10
|
+
}
|
|
11
|
+
/** Known short flag aliases (mirrors yargs config in cli.ts) */
|
|
12
|
+
const SHORT_FLAG_MAP = { a: "agent" };
|
|
13
|
+
function parseArgs(args) {
|
|
14
|
+
const result = {};
|
|
15
|
+
let i = 0;
|
|
16
|
+
if (args.length > 0 && !args[0].startsWith("-")) {
|
|
17
|
+
result._command = args[0];
|
|
18
|
+
i = 1;
|
|
19
|
+
}
|
|
20
|
+
while (i < args.length) {
|
|
21
|
+
const arg = args[i];
|
|
22
|
+
if (arg.startsWith("--")) {
|
|
23
|
+
const key = arg.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
24
|
+
const nextArg = args[i + 1];
|
|
25
|
+
if (nextArg !== void 0 && !nextArg.startsWith("-")) {
|
|
26
|
+
result[key] = nextArg;
|
|
27
|
+
i += 2;
|
|
28
|
+
} else {
|
|
29
|
+
result[key] = true;
|
|
30
|
+
i += 1;
|
|
31
|
+
}
|
|
32
|
+
} else if (arg.startsWith("-") && !arg.startsWith("--") && arg.length === 2) {
|
|
33
|
+
const shortKey = arg[1];
|
|
34
|
+
const longKey = SHORT_FLAG_MAP[shortKey] ?? shortKey;
|
|
35
|
+
const nextArg = args[i + 1];
|
|
36
|
+
if (nextArg !== void 0 && !nextArg.startsWith("-")) {
|
|
37
|
+
result[longKey] = nextArg;
|
|
38
|
+
i += 2;
|
|
39
|
+
} else {
|
|
40
|
+
result[longKey] = true;
|
|
41
|
+
i += 1;
|
|
42
|
+
}
|
|
43
|
+
} else i += 1;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
function toBool(val) {
|
|
48
|
+
if (val === true || val === "true") return true;
|
|
49
|
+
if (val === false || val === "false") return false;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
async function routeCommand(args) {
|
|
53
|
+
const parsed = parseArgs(args);
|
|
54
|
+
const command = parsed._command;
|
|
55
|
+
const agent = resolveAgent(parsed.agent);
|
|
56
|
+
switch (command) {
|
|
57
|
+
case "finalize": {
|
|
58
|
+
const { handleCleanup } = await import("./phases/cleanup.js");
|
|
59
|
+
return handleCleanup();
|
|
60
|
+
}
|
|
61
|
+
case "auth": {
|
|
62
|
+
const { handleAuthPhase } = await import("./phases/auth.js");
|
|
63
|
+
return handleAuthPhase({
|
|
64
|
+
agent,
|
|
65
|
+
method: parsed.method,
|
|
66
|
+
verify: parsed.verify === true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
case "mcp": {
|
|
70
|
+
const { handleMcpPhase } = await import("./phases/mcp.js");
|
|
71
|
+
return handleMcpPhase({
|
|
72
|
+
agent,
|
|
73
|
+
status: parsed.status === true,
|
|
74
|
+
install: parsed.install === true || parsed.update === true,
|
|
75
|
+
scope: parsed.scope ?? "global",
|
|
76
|
+
mcpConfigured: toBool(parsed.mcpConfigured)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
case "skills": {
|
|
80
|
+
const { handleSkillsPhase } = await import("./phases/skills.js");
|
|
81
|
+
return handleSkillsPhase({
|
|
82
|
+
agent,
|
|
83
|
+
status: parsed.status === true,
|
|
84
|
+
install: parsed.install === true,
|
|
85
|
+
update: parsed.update === true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
case "setup": {
|
|
89
|
+
const { handleSetupPhase } = await import("./phases/setup.js");
|
|
90
|
+
if (typeof parsed.data === "string") {
|
|
91
|
+
let data;
|
|
92
|
+
try {
|
|
93
|
+
data = JSON.parse(parsed.data);
|
|
94
|
+
} catch {
|
|
95
|
+
throw new Error("Invalid JSON in --data flag");
|
|
96
|
+
}
|
|
97
|
+
for (const key of [
|
|
98
|
+
"mcpConfigured",
|
|
99
|
+
"connectionString",
|
|
100
|
+
"isVscodeIde",
|
|
101
|
+
"installExtension",
|
|
102
|
+
"execute"
|
|
103
|
+
]) if (data[key] === "true") data[key] = true;
|
|
104
|
+
else if (data[key] === "false") data[key] = false;
|
|
105
|
+
return handleSetupPhase({
|
|
106
|
+
agent,
|
|
107
|
+
...data
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return handleSetupPhase({
|
|
111
|
+
agent,
|
|
112
|
+
mcpConfigured: toBool(parsed.mcpConfigured),
|
|
113
|
+
connectionString: toBool(parsed.connectionString),
|
|
114
|
+
framework: parsed.framework,
|
|
115
|
+
orm: parsed.orm,
|
|
116
|
+
migrationTool: parsed.migrationTool,
|
|
117
|
+
migrationDir: parsed.migrationDir,
|
|
118
|
+
isVscodeIde: toBool(parsed.isVscodeIde),
|
|
119
|
+
mode: parsed.mode,
|
|
120
|
+
mcpScope: parsed.mcpScope,
|
|
121
|
+
skillsScope: parsed.skillsScope,
|
|
122
|
+
installExtension: toBool(parsed.installExtension) === true,
|
|
123
|
+
execute: parsed.execute === true
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
case "getting-started": {
|
|
127
|
+
const { handleGettingStartedPhase } = await import("./phases/getting-started.js");
|
|
128
|
+
if (typeof parsed.data === "string") {
|
|
129
|
+
let data;
|
|
130
|
+
try {
|
|
131
|
+
data = JSON.parse(parsed.data);
|
|
132
|
+
} catch {
|
|
133
|
+
throw new Error("Invalid JSON in --data flag");
|
|
134
|
+
}
|
|
135
|
+
return handleGettingStartedPhase({
|
|
136
|
+
agent,
|
|
137
|
+
...data
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return handleGettingStartedPhase({
|
|
141
|
+
agent,
|
|
142
|
+
hasConnectionString: parsed.hasConnectionString === true,
|
|
143
|
+
framework: parsed.framework,
|
|
144
|
+
orm: parsed.orm,
|
|
145
|
+
migrationTool: parsed.migrationTool,
|
|
146
|
+
migrationDir: parsed.migrationDir
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
case "db": {
|
|
150
|
+
const { handleDbPhase } = await import("./phases/db.js");
|
|
151
|
+
return handleDbPhase({
|
|
152
|
+
agent,
|
|
153
|
+
orgId: parsed.orgId,
|
|
154
|
+
projectId: parsed.projectId,
|
|
155
|
+
orgsResult: parsed.orgsResult,
|
|
156
|
+
projectsResult: parsed.projectsResult,
|
|
157
|
+
framework: parsed.framework,
|
|
158
|
+
orm: parsed.orm,
|
|
159
|
+
error: parsed.error
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
case "neon-auth": {
|
|
163
|
+
const { handleNeonAuthPhase } = await import("./phases/neon-auth.js");
|
|
164
|
+
return handleNeonAuthPhase({
|
|
165
|
+
agent,
|
|
166
|
+
setup: parsed.setup === true,
|
|
167
|
+
info: parsed.info === true,
|
|
168
|
+
projectId: parsed.projectId
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
case "migrations": {
|
|
172
|
+
const { handleMigrationsPhase } = await import("./phases/migrations.js");
|
|
173
|
+
return handleMigrationsPhase({
|
|
174
|
+
agent,
|
|
175
|
+
tool: parsed.tool,
|
|
176
|
+
migrationDir: parsed.migrationDir,
|
|
177
|
+
scaffold: parsed.scaffold,
|
|
178
|
+
apply: parsed.apply === true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
default: {
|
|
182
|
+
const { orchestrate } = await import("../v2.js");
|
|
183
|
+
return orchestrate({
|
|
184
|
+
agent,
|
|
185
|
+
skipNeonAuth: parsed.skipNeonAuth === true,
|
|
186
|
+
skipMigrations: parsed.skipMigrations === true,
|
|
187
|
+
preview: parsed.preview === true
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { routeCommand };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=route-command.js.map
|
|
@@ -0,0 +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\tskipMigr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,EAAE,gBAAgB,MAAM,OAAO;GACrC,OAAO,YAAY;IAClB;IACA,cAAc,OAAO,iBAAiB;IACtC,gBAAgB,OAAO,mBAAmB;IAC1C,SAAS,OAAO,YAAY;GAC7B,CAAC;EACF;CACD;AACD"}
|
package/dist/lib/skills.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import { Editor } from "./types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/skills.d.ts
|
|
4
|
-
|
|
4
|
+
declare const SKILL_REFERENCE_URLS: Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetches the "Getting Started with Neon" skill content from the public URL.
|
|
7
|
+
* Returns the markdown content, or null if the fetch fails.
|
|
8
|
+
*/
|
|
9
|
+
declare function fetchSkillContent(): Promise<string | null>;
|
|
10
|
+
interface InstallSkillsOptions {
|
|
11
|
+
json?: boolean;
|
|
12
|
+
scope?: "global" | "project";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Installs Neon agent skills using Vercel's skills CLI.
|
|
16
|
+
*/
|
|
17
|
+
declare function installAgentSkills(selectedEditors: Editor[], options?: InstallSkillsOptions): Promise<boolean>;
|
|
5
18
|
/**
|
|
6
|
-
*
|
|
19
|
+
* Ensures Neon agent skills are up to date. Runs `skills add` if the skills
|
|
20
|
+
* haven't been updated within the freshness window (12 hours).
|
|
21
|
+
*
|
|
22
|
+
* Designed to be called from any phase handler — cheap to call repeatedly
|
|
23
|
+
* since it's a no-op when skills are fresh.
|
|
7
24
|
*/
|
|
8
|
-
declare function
|
|
25
|
+
declare function ensureSkillsUpToDate(agent: string, scope?: "global" | "project"): Promise<boolean>;
|
|
9
26
|
//#endregion
|
|
10
|
-
export { installAgentSkills };
|
|
27
|
+
export { InstallSkillsOptions, SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, installAgentSkills };
|
|
11
28
|
//# sourceMappingURL=skills.d.ts.map
|
package/dist/lib/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","names":[],"sources":["../../src/lib/skills.ts"],"
|
|
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"}
|
package/dist/lib/skills.js
CHANGED
|
@@ -1,33 +1,69 @@
|
|
|
1
|
+
import { getSkillsAgentName } from "./agents.js";
|
|
2
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
1
4
|
import { log, spinner } from "@clack/prompts";
|
|
2
5
|
import { execa } from "execa";
|
|
3
|
-
|
|
6
|
+
import { dim } from "yoctocolors";
|
|
4
7
|
//#region src/lib/skills.ts
|
|
8
|
+
const SKILL_BASE_URL = "https://neon.com/docs/ai/skills/neon-postgres/references";
|
|
9
|
+
const SKILL_REFERENCE_URLS = {
|
|
10
|
+
gettingStarted: `${SKILL_BASE_URL}/getting-started.md`,
|
|
11
|
+
connectionMethods: `${SKILL_BASE_URL}/connection-methods.md`,
|
|
12
|
+
neonAuth: `${SKILL_BASE_URL}/neon-auth.md`,
|
|
13
|
+
serverlessDriver: `${SKILL_BASE_URL}/neon-serverless.md`,
|
|
14
|
+
neonCli: `${SKILL_BASE_URL}/neon-cli.md`,
|
|
15
|
+
devtools: `${SKILL_BASE_URL}/devtools.md`,
|
|
16
|
+
branching: `${SKILL_BASE_URL}/branching.md`,
|
|
17
|
+
neonJs: `${SKILL_BASE_URL}/neon-js.md`
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Fetches the "Getting Started with Neon" skill content from the public URL.
|
|
21
|
+
* Returns the markdown content, or null if the fetch fails.
|
|
22
|
+
*/
|
|
23
|
+
async function fetchSkillContent() {
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(SKILL_REFERENCE_URLS.gettingStarted, { signal: AbortSignal.timeout(1e4) });
|
|
26
|
+
if (!response.ok) return null;
|
|
27
|
+
return await response.text();
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
5
32
|
/**
|
|
6
|
-
* Maps
|
|
33
|
+
* Maps Editor display names to the skills CLI agent name.
|
|
34
|
+
* Used only by the v1 installAgentSkills function.
|
|
7
35
|
*/
|
|
8
|
-
function
|
|
36
|
+
function editorToSkillsAgent(editor) {
|
|
9
37
|
switch (editor) {
|
|
10
38
|
case "Cursor": return "cursor";
|
|
11
|
-
case "VS Code":
|
|
39
|
+
case "VS Code":
|
|
40
|
+
case "GitHub Copilot CLI": return "github-copilot";
|
|
12
41
|
case "Claude CLI": return "claude-code";
|
|
42
|
+
case "Codex": return "codex";
|
|
43
|
+
case "OpenCode": return "opencode";
|
|
44
|
+
case "Antigravity": return "antigravity";
|
|
45
|
+
case "Cline":
|
|
46
|
+
case "Cline CLI": return "cline";
|
|
47
|
+
case "Gemini CLI": return "gemini-cli";
|
|
48
|
+
case "Goose": return "goose";
|
|
49
|
+
case "Claude Desktop": return "claude-code";
|
|
50
|
+
case "MCPorter": return "mcporter";
|
|
51
|
+
case "Zed": return "zed";
|
|
13
52
|
default: return "";
|
|
14
53
|
}
|
|
15
54
|
}
|
|
16
55
|
/**
|
|
17
|
-
* Installs Neon agent skills using Vercel's skills CLI
|
|
56
|
+
* Installs Neon agent skills using Vercel's skills CLI.
|
|
18
57
|
*/
|
|
19
|
-
async function installAgentSkills(selectedEditors) {
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
58
|
+
async function installAgentSkills(selectedEditors, options) {
|
|
59
|
+
const quiet = options?.json === true;
|
|
60
|
+
const editorsWithSkills = selectedEditors.filter((e) => editorToSkillsAgent(e) !== "");
|
|
61
|
+
if (editorsWithSkills.length === 0) return true;
|
|
62
|
+
const skillsSpinner = quiet ? null : spinner();
|
|
63
|
+
skillsSpinner?.start("Installing agent skills for Neon in this project...");
|
|
23
64
|
let anyFailed = false;
|
|
24
|
-
for (const editor of
|
|
25
|
-
const agentName =
|
|
26
|
-
if (agentName === "") {
|
|
27
|
-
log.error(`Unsupported editor: ${editor}`);
|
|
28
|
-
anyFailed = true;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
65
|
+
for (const editor of editorsWithSkills) {
|
|
66
|
+
const agentName = editorToSkillsAgent(editor);
|
|
31
67
|
try {
|
|
32
68
|
await execa("npx", [
|
|
33
69
|
"skills",
|
|
@@ -37,25 +73,96 @@ async function installAgentSkills(selectedEditors) {
|
|
|
37
73
|
"neon-postgres",
|
|
38
74
|
"--agent",
|
|
39
75
|
agentName,
|
|
76
|
+
...options?.scope === "global" ? ["-g"] : [],
|
|
40
77
|
"-y"
|
|
41
78
|
], {
|
|
42
79
|
stdio: "pipe",
|
|
43
80
|
timeout: 1e4
|
|
44
81
|
});
|
|
45
82
|
} catch (error) {
|
|
46
|
-
log.error(`Failed to install agent skills for ${editor}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
83
|
+
if (!quiet) log.error(`Failed to install agent skills for ${editor}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
47
84
|
anyFailed = true;
|
|
48
85
|
}
|
|
49
86
|
}
|
|
50
87
|
if (anyFailed) {
|
|
51
|
-
skillsSpinner
|
|
52
|
-
log.info("You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon-postgres");
|
|
88
|
+
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");
|
|
53
90
|
return false;
|
|
54
91
|
}
|
|
55
|
-
skillsSpinner
|
|
92
|
+
skillsSpinner?.stop(dim("Agent skills installed ✓"));
|
|
56
93
|
return true;
|
|
57
94
|
}
|
|
58
|
-
|
|
95
|
+
const SKILLS_FRESHNESS_MS = 720 * 60 * 1e3;
|
|
96
|
+
/**
|
|
97
|
+
* Agent skills directory paths by agent, keyed by scope.
|
|
98
|
+
* These are the directories that `skills add` writes to.
|
|
99
|
+
*/
|
|
100
|
+
const GLOBAL_SKILLS_DIRS = (() => {
|
|
101
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
102
|
+
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")]
|
|
108
|
+
};
|
|
109
|
+
})();
|
|
110
|
+
/**
|
|
111
|
+
* Checks whether skills were recently updated (within the freshness window).
|
|
112
|
+
* Checks both project-level (skills-lock.json mtime) and global (skills dir mtime).
|
|
113
|
+
*/
|
|
114
|
+
function skillsAreFresh(agent) {
|
|
115
|
+
const now = Date.now();
|
|
116
|
+
const cwd = process.cwd();
|
|
117
|
+
const lockPath = resolve(cwd, "skills-lock.json");
|
|
118
|
+
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
|
+
}
|
|
123
|
+
}
|
|
124
|
+
} catch {}
|
|
125
|
+
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
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Ensures Neon agent skills are up to date. Runs `skills add` if the skills
|
|
136
|
+
* haven't been updated within the freshness window (12 hours).
|
|
137
|
+
*
|
|
138
|
+
* Designed to be called from any phase handler — cheap to call repeatedly
|
|
139
|
+
* since it's a no-op when skills are fresh.
|
|
140
|
+
*/
|
|
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",
|
|
148
|
+
"add",
|
|
149
|
+
"neondatabase/agent-skills",
|
|
150
|
+
"--skill",
|
|
151
|
+
"neon-postgres",
|
|
152
|
+
"--agent",
|
|
153
|
+
agentName,
|
|
154
|
+
...scope === "global" ? ["-g"] : [],
|
|
155
|
+
"-y"
|
|
156
|
+
], {
|
|
157
|
+
stdio: "pipe",
|
|
158
|
+
timeout: 6e4
|
|
159
|
+
});
|
|
160
|
+
return true;
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
59
165
|
//#endregion
|
|
60
|
-
export { installAgentSkills };
|
|
166
|
+
export { SKILL_REFERENCE_URLS, ensureSkillsUpToDate, fetchSkillContent, installAgentSkills };
|
|
167
|
+
|
|
61
168
|
//# sourceMappingURL=skills.js.map
|
package/dist/lib/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","names":[],"sources":["../../src/lib/skills.ts"],"sourcesContent":["import { log, spinner } from \"@clack/prompts\";\nimport { execa } from \"execa\";\nimport type { Editor } from \"./types.js\";\n\n/**\n * Maps editor names to the corresponding agent names used by the skills CLI\n */\nfunction getSkillsAgentName(editor: Editor): string {\n\tswitch (editor) {\n\t\tcase \"Cursor\":\n\t\t\treturn \"cursor\";\n\t\tcase \"VS Code\":\n\t\t\treturn \"github-copilot\";\n\t\tcase \"Claude CLI\":\n\t\t\treturn \"claude-code\";\n\t\tdefault:\n\t\t\treturn \"\";\n\t}\n}\n\n/**\n * Installs Neon agent skills using Vercel's skills CLI\n */\nexport async function installAgentSkills(\n\tselectedEditors: Editor[],\n): Promise<boolean> {\n\tif (selectedEditors.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst skillsSpinner = spinner();\n\tskillsSpinner.start(\"Installing agent skills for Neon...\");\n\n\tlet anyFailed = false;\n\n\t// Run skills add for each selected editor/agent\n\tfor (const editor of selectedEditors) {\n\t\tconst agentName = getSkillsAgentName(editor);\n\n\t\tif (agentName === \"\") {\n\t\t\tlog.error(`Unsupported editor: ${editor}`);\n\t\t\tanyFailed = true;\n\t\t\tcontinue;\n\t\t}\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\"-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\tlog.error(\n\t\t\t\t`Failed to install agent skills for ${editor}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t);\n\t\t\tanyFailed = true;\n\t\t}\n\t}\n\n\tif (anyFailed) {\n\t\tskillsSpinner.stop(\"Agent skills installation completed with errors\");\n\t\tlog.info(\n\t\t\t\"You can manually install skills by running: npx skills add neondatabase/agent-skills --skill neon-postgres\",\n\t\t);\n\t\treturn false;\n\t}\n\n\tskillsSpinner.stop(\"Agent skills installed ✓\");\n\treturn true;\n}\n"],"mappings":";;;;;;;AAOA,SAAS,mBAAmB,QAAwB;AACnD,SAAQ,QAAR;EACC,KAAK,SACJ,QAAO;EACR,KAAK,UACJ,QAAO;EACR,KAAK,aACJ,QAAO;EACR,QACC,QAAO;;;;;;AAOV,eAAsB,mBACrB,iBACmB;AACnB,KAAI,gBAAgB,WAAW,EAC9B,QAAO;CAGR,MAAM,gBAAgB,SAAS;AAC/B,eAAc,MAAM,sCAAsC;CAE1D,IAAI,YAAY;AAGhB,MAAK,MAAM,UAAU,iBAAiB;EACrC,MAAM,YAAY,mBAAmB,OAAO;AAE5C,MAAI,cAAc,IAAI;AACrB,OAAI,MAAM,uBAAuB,SAAS;AAC1C,eAAY;AACZ;;AAGD,MAAI;AACH,SAAM,MACL,OACA;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,EACD;IACC,OAAO;IACP,SAAS;IACT,CACD;WACO,OAAO;AACf,OAAI,MACH,sCAAsC,OAAO,IAAI,iBAAiB,QAAQ,MAAM,UAAU,kBAC1F;AACD,eAAY;;;AAId,KAAI,WAAW;AACd,gBAAc,KAAK,kDAAkD;AACrE,MAAI,KACH,6GACA;AACD,SAAO;;AAGR,eAAc,KAAK,2BAA2B;AAC9C,QAAO"}
|
|
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,kBAAkB,GAAG,eAAe;CACpC,SAAS,GAAG,eAAe;CAC3B,UAAU,GAAG,eAAe;CAC5B,WAAW,GAAG,eAAe;CAC7B,QAAQ,GAAG,eAAe;AAC3B;;;;;AAMA,eAAsB,oBAA4C;CACjE,IAAI;EACH,MAAM,WAAW,MAAM,MAAM,qBAAqB,gBAAgB,EACjE,QAAQ,YAAY,QAAQ,GAAK,EAClC,CAAC;EACD,IAAI,CAAC,SAAS,IAAI,OAAO;EACzB,OAAO,MAAM,SAAS,KAAK;CAC5B,QAAQ;EACP,OAAO;CACR;AACD;;;;;AAMA,SAAS,oBAAoB,QAAwB;CACpD,QAAQ,QAAR;EACC,KAAK,UACJ,OAAO;EACR,KAAK;EACL,KAAK,sBACJ,OAAO;EACR,KAAK,cACJ,OAAO;EACR,KAAK,SACJ,OAAO;EACR,KAAK,YACJ,OAAO;EACR,KAAK,eACJ,OAAO;EACR,KAAK;EACL,KAAK,aACJ,OAAO;EACR,KAAK,cACJ,OAAO;EACR,KAAK,SACJ,OAAO;EACR,KAAK,kBAC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AQ,CAAC;CAC1C;AACD,EAAA,CAAG;;;;;AAMH,SAAS,eAAe,OAAwB;CAC/C,MAAM,MAAM,KAAK,IAAI;CACrB,MAAM,MAAM,QAAQ,IAAI;CAIxB,MAAM,WAAW,QAAQ,KAAK,kBAAkB;CAChD,IAAI,WAAW,QAAQ,GACtB,IAAI;EAEH,IADgB,aAAa,UAAU,OAC7B,CAAC,CAAC,SAAS,eAAe;OAGlC,WACC,QACC,KACA,WACA,UACA,iBACA,UACD,CACD,KACA,WACC,QACC,KACA,WACA,UACA,iBACA,UACD,CACD,KACA,WACC,QACC,KACA,WACA,UACA,iBACA,UACD,CACD;QAGI,MADU,SAAS,QAAQ,CAAC,CAAC,UACf,qBAAqB,OAAO;GAAA;EAAI;CAGrD,QAAQ,CAAC;CAKV,MAAM,aAAa,mBADDA,mBAAyB,KACG,MAAM,CAAC;CACrD,KAAK,MAAM,OAAO,YAAY;EAC7B,MAAM,cAAc,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"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,22 +1,155 @@
|
|
|
1
1
|
//#region src/lib/types.d.ts
|
|
2
|
-
type Editor = "Cursor" | "VS Code" | "Claude CLI";
|
|
2
|
+
type Editor = "Cursor" | "VS Code" | "Claude CLI" | "Claude Desktop" | "Codex" | "OpenCode" | "Antigravity" | "Cline" | "Cline CLI" | "Gemini CLI" | "GitHub Copilot CLI" | "Goose" | "MCPorter" | "Zed";
|
|
3
3
|
type InstallStatus = "success" | "failed";
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
interface InitResult {
|
|
5
|
+
success: boolean;
|
|
6
|
+
auth: boolean;
|
|
7
|
+
authRequired?: boolean;
|
|
8
|
+
authInstructions?: string;
|
|
9
|
+
agentInstructions?: string;
|
|
10
|
+
editors: {
|
|
11
|
+
editor: Editor;
|
|
12
|
+
status: InstallStatus;
|
|
13
|
+
type: "mcp" | "extension";
|
|
14
|
+
}[];
|
|
15
|
+
skills: {
|
|
16
|
+
installed: boolean;
|
|
17
|
+
gettingStarted: string | null;
|
|
18
|
+
references: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
neonctl: {
|
|
21
|
+
authenticated: boolean;
|
|
22
|
+
commands: {
|
|
23
|
+
listOrgs: string;
|
|
24
|
+
listProjects: string;
|
|
25
|
+
createProject: string;
|
|
26
|
+
getConnectionString: string;
|
|
10
27
|
};
|
|
11
28
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
mcpServer: {
|
|
30
|
+
configured: boolean;
|
|
31
|
+
requiresRestart: boolean;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
type Phase = "auth" | "tooling" | "setup" | "db" | "neon_auth" | "migrations";
|
|
35
|
+
type NextAction = AskUserAction | RunCommandAction | RunNeonInitAction | AgentCheckAction | AgentActionAction | RestartRequiredAction | CompleteAction;
|
|
36
|
+
interface AskUserAction {
|
|
37
|
+
type: "ask_user";
|
|
38
|
+
question: string;
|
|
39
|
+
options: (string | {
|
|
40
|
+
value: string;
|
|
41
|
+
label: string;
|
|
42
|
+
})[];
|
|
43
|
+
context?: string;
|
|
44
|
+
/** Maps each option value to the next CLI invocation args, or an inline action to execute directly */
|
|
45
|
+
responseMapping: Record<string, {
|
|
46
|
+
args: string[];
|
|
47
|
+
} | {
|
|
48
|
+
action: NextAction;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
interface RunCommandAction {
|
|
52
|
+
type: "run_command";
|
|
53
|
+
command: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
timeout?: number;
|
|
56
|
+
onSuccess: RunNeonInitAction;
|
|
57
|
+
onFailure?: Record<string, NextAction>;
|
|
58
|
+
}
|
|
59
|
+
interface RunNeonInitAction {
|
|
60
|
+
type: "run_neon_init";
|
|
61
|
+
args: string[];
|
|
62
|
+
}
|
|
63
|
+
interface AgentCheck {
|
|
64
|
+
id: string;
|
|
65
|
+
description: string;
|
|
66
|
+
lookFor: string[];
|
|
67
|
+
}
|
|
68
|
+
interface AgentCheckAction {
|
|
69
|
+
type: "agent_check";
|
|
70
|
+
/** Step-by-step workflow for the agent describing the exact order of operations */
|
|
71
|
+
instructions?: string;
|
|
72
|
+
checks: AgentCheck[];
|
|
73
|
+
/** Questions to ask the user — respect the phase field for ordering relative to checks */
|
|
74
|
+
userPreferences?: UserPreference[];
|
|
75
|
+
reportBack: RunNeonInitAction;
|
|
76
|
+
}
|
|
77
|
+
interface UserPreference {
|
|
78
|
+
id: string;
|
|
79
|
+
question: string;
|
|
80
|
+
options: (string | {
|
|
81
|
+
value: string;
|
|
82
|
+
label: string;
|
|
83
|
+
})[];
|
|
84
|
+
context?: string;
|
|
85
|
+
default?: string;
|
|
86
|
+
/** Only present this preference if another preference was answered with the specified value */
|
|
87
|
+
condition?: {
|
|
88
|
+
preferenceId: string;
|
|
89
|
+
equals: string;
|
|
90
|
+
};
|
|
91
|
+
/** When to ask this preference relative to the inspection checks */
|
|
92
|
+
phase?: "before_checks" | "after_checks";
|
|
93
|
+
/** Preferences with the same group should be presented together as a single form */
|
|
94
|
+
group?: string;
|
|
95
|
+
}
|
|
96
|
+
interface AgentStep {
|
|
97
|
+
id: string;
|
|
98
|
+
description: string;
|
|
99
|
+
command?: string;
|
|
100
|
+
}
|
|
101
|
+
interface AgentActionAction {
|
|
102
|
+
type: "agent_action";
|
|
103
|
+
prerequisite?: string;
|
|
104
|
+
steps: AgentStep[];
|
|
105
|
+
onComplete: RunNeonInitAction | CompleteAction;
|
|
106
|
+
}
|
|
107
|
+
interface RestartRequiredAction {
|
|
108
|
+
type: "restart_required";
|
|
109
|
+
reason: string;
|
|
110
|
+
resumeCommand: string;
|
|
111
|
+
}
|
|
112
|
+
interface CompleteAction {
|
|
113
|
+
type: "complete";
|
|
114
|
+
message: string;
|
|
115
|
+
}
|
|
116
|
+
interface PhaseResponse {
|
|
117
|
+
phase: Phase;
|
|
118
|
+
status: string;
|
|
119
|
+
nextAction: NextAction;
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
}
|
|
122
|
+
interface StatusResponse {
|
|
123
|
+
auth: {
|
|
124
|
+
authenticated: boolean;
|
|
125
|
+
user?: string;
|
|
126
|
+
};
|
|
127
|
+
tooling: {
|
|
128
|
+
mcpServer: {
|
|
129
|
+
configured: boolean | null;
|
|
130
|
+
location?: string;
|
|
131
|
+
};
|
|
132
|
+
skills: {
|
|
133
|
+
installed: boolean;
|
|
17
134
|
};
|
|
135
|
+
extension?: {
|
|
136
|
+
installed: boolean;
|
|
137
|
+
editor: string;
|
|
138
|
+
} | null;
|
|
139
|
+
};
|
|
140
|
+
project: {
|
|
141
|
+
databaseUrl: boolean;
|
|
142
|
+
};
|
|
143
|
+
migrations: {
|
|
144
|
+
tool: string | null;
|
|
145
|
+
hasMigrations: boolean;
|
|
18
146
|
};
|
|
147
|
+
recommendations: {
|
|
148
|
+
priority: string;
|
|
149
|
+
message: string;
|
|
150
|
+
command: string;
|
|
151
|
+
}[];
|
|
19
152
|
}
|
|
20
153
|
//#endregion
|
|
21
|
-
export { Editor, InstallStatus,
|
|
154
|
+
export { AgentActionAction, AgentCheck, AgentCheckAction, AgentStep, AskUserAction, CompleteAction, Editor, InitResult, InstallStatus, NextAction, Phase, PhaseResponse, RestartRequiredAction, RunCommandAction, RunNeonInitAction, StatusResponse, UserPreference };
|
|
22
155
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/lib/types.ts"],"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/lib/types.ts"],"mappings":";KAAY,MAAA;AAAA,KAgBA,aAAA,GAhBM,SAAA,GAAA,QAAA;AAgBN,UAMK,UAAA,CANQ;EAMR,OAAA,EAAA,OAAU;EAAA,IAAA,EAAA,OAAA;cAOjB,CAAA,EAAA,OAAA;kBACA,CAAA,EAAA,MAAA;mBAMI,CAAA,EAAA,MAAA;EAAM,OAAA,EAAA;IAqBR,MAAK,EA5BP,MA4BO;IAUL,MAAA,EArCF,aAqCY;IAAA,IAAA,EAAA,KAAA,GAAA,WAAA;KACnB;QACA,EAAA;IACA,SAAA,EAAA,OAAA;IACA,cAAA,EAAA,MAAA,GAAA,IAAA;IACA,UAAA,EApCW,MAoCX,CAAA,MAAA,EAAA,MAAA,CAAA;;SAEA,EAAA;IAAc,aAAA,EAAA,OAAA;IAEA,QAAA,EAAA;MAAa,QAAA,EAAA,MAAA;MAQG,YAAA,EAAA,MAAA;MAFf,aAAA,EAAA,MAAA;MAAM,mBAAA,EAAA,MAAA;IAMP,CAAA;EAAgB,CAAA;WAKrB,EAAA;IACgB,UAAA,EAAA,OAAA;IAAf,eAAA,EAAA,OAAA;EAAM,CAAA;AAGnB;AAKiB,KA7CL,KAAA,GA6Ce,MAAA,GAAA,SAAA,GAAA,OAAA,GAAA,IAAA,GAAA,WAAA,GAAA,YAAA;AAMV,KAzCL,UAAA,GACT,aAwC8B,GAvC9B,gBAuC8B,GAtC9B,iBAsC8B,GArC9B,gBAqC8B,GApC9B,iBAoC8B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