neon 4.7.0 → 4.8.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/README.md +37 -59
- package/dist/_chunks/{auth_selection-ktL6uoEe.js → auth_selection-pitMFzDe.js} +1 -1
- package/dist/_chunks/{credential_io-B1JxWELN.js → credential_io-YeAxg9Xn.js} +2 -2
- package/dist/_chunks/{paths-g3DRqJiD.js → paths-DMq0Lt7a.js} +1 -1
- package/dist/_chunks/{profiles-D95AeZ5v.js → profiles-CvnFEQyd.js} +1 -1
- package/dist/analytics.js +2 -2
- package/dist/auth_context.js +1 -1
- package/dist/commands/auth.js +12 -9
- package/dist/commands/bootstrap.js +72 -43
- package/dist/commands/claim.js +1 -1
- package/dist/commands/init.js +80 -79
- package/dist/commands/link.js +78 -63
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/plugins.js +4 -4
- package/dist/commands/profile.js +4 -4
- package/dist/commands/skills.js +1 -1
- package/dist/config.js +1 -1
- package/dist/credential_io.js +1 -1
- package/dist/index.js +1 -1
- package/dist/init/child.js +36 -0
- package/dist/init/plan.js +47 -0
- package/dist/init/tooling.js +43 -0
- package/dist/init/wizard.js +42 -0
- package/dist/mcp/targets.js +1 -1
- package/dist/plugins/plan.js +1 -1
- package/dist/plugins/targets.js +5 -1
- package/dist/retire_credential.js +1 -1
- package/dist/utils/middlewares.js +1 -1
- package/dist/utils/package_manager.js +10 -5
- package/package.json +13 -14
- package/dist/init/auth.js +0 -53
- package/dist/init/build_config.js +0 -4
- package/dist/init/detect_agent.js +0 -63
- package/dist/init/editors.js +0 -19
- package/dist/init/enrich_output.js +0 -61
- package/dist/init/extension.js +0 -154
- package/dist/init/inspect.js +0 -249
- package/dist/init/interactive.js +0 -529
- package/dist/init/neonctl.js +0 -139
- package/dist/init/orchestrate.js +0 -189
- package/dist/init/phases/auth.js +0 -195
- package/dist/init/phases/cleanup.js +0 -27
- package/dist/init/phases/db.js +0 -257
- package/dist/init/phases/getting_started.js +0 -218
- package/dist/init/phases/mcp.js +0 -219
- package/dist/init/phases/migrations.js +0 -250
- package/dist/init/phases/neon_auth.js +0 -116
- package/dist/init/phases/setup.js +0 -582
- package/dist/init/phases/skills.js +0 -86
- package/dist/init/phases/status.js +0 -82
- package/dist/init/profile_cli.js +0 -56
- package/dist/init/resolve_context.js +0 -105
- package/dist/init/route_command.js +0 -93
- package/dist/init/skills.js +0 -206
- package/dist/init/types.js +0 -1
- package/dist/init/vsix.js +0 -89
package/dist/init/inspect.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { resolve, sep } from "node:path";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { agents, getAgentTypes } from "add-mcp";
|
|
5
|
-
//#region src/init/inspect.ts
|
|
6
|
-
/**
|
|
7
|
-
* Filesystem-based project inspection for interactive (agentless) mode.
|
|
8
|
-
* Replaces the "agent_check" pattern — instead of asking an agent to look,
|
|
9
|
-
* we examine the filesystem directly.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Runs filesystem checks based on the agent_check descriptors.
|
|
13
|
-
* Maps check IDs to concrete inspection functions.
|
|
14
|
-
*/
|
|
15
|
-
async function inspectProject(checks) {
|
|
16
|
-
const results = {};
|
|
17
|
-
const cwd = process.cwd();
|
|
18
|
-
for (const check of checks) switch (check.id) {
|
|
19
|
-
case "mcp_server": {
|
|
20
|
-
const hits = findNeonMcpAgents(cwd);
|
|
21
|
-
results.mcpAgents = hits;
|
|
22
|
-
results.mcpConfigured = hits.length > 0;
|
|
23
|
-
results.mcpScope = mcpScopeFromHits(hits);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case "connection_string":
|
|
27
|
-
results.connectionString = checkConnectionString(cwd);
|
|
28
|
-
break;
|
|
29
|
-
case "database_url":
|
|
30
|
-
results.databaseUrl = checkDatabaseUrl(cwd);
|
|
31
|
-
break;
|
|
32
|
-
case "project_stack": {
|
|
33
|
-
const stack = detectProjectStack(cwd);
|
|
34
|
-
results.framework = stack.framework;
|
|
35
|
-
results.orm = stack.orm;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case "migrations": {
|
|
39
|
-
const migrations = detectMigrations(cwd);
|
|
40
|
-
results.migrationTool = migrations.tool;
|
|
41
|
-
results.migrationDir = migrations.dir;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
case "skills": {
|
|
45
|
-
const skillsScope = checkSkillsInstalled(cwd);
|
|
46
|
-
results.skillsInstalled = skillsScope !== false;
|
|
47
|
-
results.skillsScope = skillsScope;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case "ide_type":
|
|
51
|
-
results.isVscodeIde = checkVscodeIde();
|
|
52
|
-
break;
|
|
53
|
-
case "has_app": results.hasApp = checkHasApp(cwd);
|
|
54
|
-
}
|
|
55
|
-
return results;
|
|
56
|
-
}
|
|
57
|
-
function mcpScopeFromHits(hits) {
|
|
58
|
-
if (hits.some((hit) => hit.scope === "project")) return "project";
|
|
59
|
-
if (hits.some((hit) => hit.scope === "global")) return "global";
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
function addMcpBakedHome() {
|
|
63
|
-
const cursorPath = agents.cursor.configPath;
|
|
64
|
-
const suffix = `${sep}.cursor${sep}mcp.json`;
|
|
65
|
-
if (cursorPath.endsWith(suffix)) return cursorPath.slice(0, -suffix.length);
|
|
66
|
-
return homedir();
|
|
67
|
-
}
|
|
68
|
-
function rebaseAddMcpHome(configPath) {
|
|
69
|
-
const currentHome = process.env.HOME || process.env.USERPROFILE || homedir();
|
|
70
|
-
const baked = addMcpBakedHome();
|
|
71
|
-
if (configPath.startsWith(baked)) return currentHome + configPath.slice(baked.length);
|
|
72
|
-
return configPath;
|
|
73
|
-
}
|
|
74
|
-
function agentProjectPath(id, cwd) {
|
|
75
|
-
const agent = agents[id];
|
|
76
|
-
if (agent.resolveConfigPath && agent.localConfigPath) return agent.resolveConfigPath(agent, {
|
|
77
|
-
local: true,
|
|
78
|
-
cwd
|
|
79
|
-
});
|
|
80
|
-
if (agent.localConfigPath) return resolve(cwd, agent.localConfigPath);
|
|
81
|
-
}
|
|
82
|
-
function agentGlobalPath(id, cwd) {
|
|
83
|
-
const agent = agents[id];
|
|
84
|
-
if (agent.resolveConfigPath) return rebaseAddMcpHome(agent.resolveConfigPath(agent, {
|
|
85
|
-
local: false,
|
|
86
|
-
cwd
|
|
87
|
-
}));
|
|
88
|
-
return rebaseAddMcpHome(agent.configPath);
|
|
89
|
-
}
|
|
90
|
-
function fileHasNeonMcp(configPath) {
|
|
91
|
-
if (!existsSync(configPath)) return false;
|
|
92
|
-
try {
|
|
93
|
-
const content = readFileSync(configPath, "utf-8");
|
|
94
|
-
if (content.toLowerCase().includes("mcp.neon.tech")) return true;
|
|
95
|
-
if (/"neon"\s*:/i.test(content)) return true;
|
|
96
|
-
if (/\[mcp_servers\.neon\]/i.test(content)) return true;
|
|
97
|
-
if (/^neon\s*=/im.test(content)) return true;
|
|
98
|
-
return false;
|
|
99
|
-
} catch {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function findNeonMcpAgents(cwd) {
|
|
104
|
-
const hits = [];
|
|
105
|
-
for (const id of getAgentTypes()) {
|
|
106
|
-
const projectPath = agentProjectPath(id, cwd);
|
|
107
|
-
if (projectPath && fileHasNeonMcp(projectPath)) {
|
|
108
|
-
hits.push({
|
|
109
|
-
agent: id,
|
|
110
|
-
scope: "project"
|
|
111
|
-
});
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (fileHasNeonMcp(agentGlobalPath(id, cwd))) hits.push({
|
|
115
|
-
agent: id,
|
|
116
|
-
scope: "global"
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return hits;
|
|
120
|
-
}
|
|
121
|
-
function checkConnectionString(cwd) {
|
|
122
|
-
for (const envFile of [".env", ".env.local"]) {
|
|
123
|
-
const envPath = resolve(cwd, envFile);
|
|
124
|
-
if (existsSync(envPath)) try {
|
|
125
|
-
const content = readFileSync(envPath, "utf-8");
|
|
126
|
-
if (/^DATABASE_URL=.*neon/m.test(content) || /^PGHOST=.*neon/m.test(content)) return true;
|
|
127
|
-
} catch {}
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
function detectProjectStack(cwd) {
|
|
132
|
-
const result = {
|
|
133
|
-
framework: "none",
|
|
134
|
-
orm: "none"
|
|
135
|
-
};
|
|
136
|
-
const pkgPath = resolve(cwd, "package.json");
|
|
137
|
-
if (!existsSync(pkgPath)) return result;
|
|
138
|
-
try {
|
|
139
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
140
|
-
const allDeps = {
|
|
141
|
-
...pkg.dependencies,
|
|
142
|
-
...pkg.devDependencies
|
|
143
|
-
};
|
|
144
|
-
if (allDeps.next) result.framework = "next";
|
|
145
|
-
else if (allDeps.remix || allDeps["@remix-run/node"]) result.framework = "remix";
|
|
146
|
-
else if (allDeps.express) result.framework = "express";
|
|
147
|
-
else if (allDeps.hono) result.framework = "hono";
|
|
148
|
-
else if (allDeps.fastify) result.framework = "fastify";
|
|
149
|
-
else if (allDeps["@sveltejs/kit"]) result.framework = "sveltekit";
|
|
150
|
-
else if (allDeps.nuxt) result.framework = "nuxt";
|
|
151
|
-
else if (allDeps.astro) result.framework = "astro";
|
|
152
|
-
if (allDeps.prisma || allDeps["@prisma/client"]) result.orm = "prisma";
|
|
153
|
-
else if (allDeps["drizzle-orm"]) result.orm = "drizzle";
|
|
154
|
-
else if (allDeps.knex) result.orm = "knex";
|
|
155
|
-
else if (allDeps.typeorm) result.orm = "typeorm";
|
|
156
|
-
else if (allDeps.sequelize) result.orm = "sequelize";
|
|
157
|
-
else if (allDeps["@neondatabase/serverless"]) result.orm = "neon-serverless";
|
|
158
|
-
} catch {}
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
function detectMigrations(cwd) {
|
|
162
|
-
if (existsSync(resolve(cwd, "prisma", "schema.prisma"))) {
|
|
163
|
-
const migrationsDir = resolve(cwd, "prisma", "migrations");
|
|
164
|
-
return {
|
|
165
|
-
tool: "prisma",
|
|
166
|
-
dir: existsSync(migrationsDir) ? "prisma/migrations" : "none"
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
if (existsSync(resolve(cwd, "drizzle.config.ts")) || existsSync(resolve(cwd, "drizzle.config.js"))) {
|
|
170
|
-
const drizzleDir = resolve(cwd, "drizzle");
|
|
171
|
-
return {
|
|
172
|
-
tool: "drizzle",
|
|
173
|
-
dir: existsSync(drizzleDir) ? "drizzle" : "none"
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
if (existsSync(resolve(cwd, "knexfile.js")) || existsSync(resolve(cwd, "knexfile.ts"))) {
|
|
177
|
-
const migrationsDir = resolve(cwd, "migrations");
|
|
178
|
-
return {
|
|
179
|
-
tool: "knex",
|
|
180
|
-
dir: existsSync(migrationsDir) ? "migrations" : "none"
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
tool: "none",
|
|
185
|
-
dir: "none"
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function checkDatabaseUrl(cwd) {
|
|
189
|
-
const envPath = resolve(cwd, ".env");
|
|
190
|
-
if (existsSync(envPath)) try {
|
|
191
|
-
const content = readFileSync(envPath, "utf-8");
|
|
192
|
-
if (/^DATABASE_URL=/m.test(content)) return true;
|
|
193
|
-
} catch {}
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
function checkSkillsInstalled(cwd) {
|
|
197
|
-
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
198
|
-
const skillNames = ["neon", "neon-postgres"];
|
|
199
|
-
const projectDirs = [
|
|
200
|
-
resolve(cwd, ".cursor", "skills"),
|
|
201
|
-
resolve(cwd, ".claude", "skills"),
|
|
202
|
-
resolve(cwd, ".agents", "skills")
|
|
203
|
-
];
|
|
204
|
-
if (skillNames.every((skill) => projectDirs.some((dir) => existsSync(resolve(dir, skill, "SKILL.md"))))) return "project";
|
|
205
|
-
const claudeMd = resolve(cwd, "CLAUDE.md");
|
|
206
|
-
if (existsSync(claudeMd)) try {
|
|
207
|
-
const content = readFileSync(claudeMd, "utf-8");
|
|
208
|
-
if (content.includes("neon-postgres") && content.includes("neon/SKILL.md")) return "project";
|
|
209
|
-
} catch {}
|
|
210
|
-
const globalDirs = [
|
|
211
|
-
resolve(home, ".cursor", "skills"),
|
|
212
|
-
resolve(home, ".claude", "skills"),
|
|
213
|
-
resolve(home, ".agents", "skills")
|
|
214
|
-
];
|
|
215
|
-
if (skillNames.every((skill) => globalDirs.some((dir) => existsSync(resolve(dir, skill, "SKILL.md"))))) return "global";
|
|
216
|
-
if (skillNames.some((skill) => projectDirs.some((dir) => existsSync(resolve(dir, skill, "SKILL.md"))))) return "project-partial";
|
|
217
|
-
if (skillNames.some((skill) => globalDirs.some((dir) => existsSync(resolve(dir, skill, "SKILL.md"))))) return "global-partial";
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
function checkVscodeIde() {
|
|
221
|
-
const env = process.env;
|
|
222
|
-
return !!(env.TERM_PROGRAM === "vscode" || env.TERM_PROGRAM === "cursor" || env.TERM_PROGRAM === "windsurf" || env.VSCODE_PID || env.VSCODE_CWD);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Detects whether the current directory contains an application.
|
|
226
|
-
* Returns true if package.json has dependencies or common source directories exist.
|
|
227
|
-
*/
|
|
228
|
-
function checkHasApp(cwd) {
|
|
229
|
-
const pkgPath = resolve(cwd, "package.json");
|
|
230
|
-
if (existsSync(pkgPath)) try {
|
|
231
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
232
|
-
const deps = Object.keys(pkg.dependencies ?? {});
|
|
233
|
-
const devDeps = Object.keys(pkg.devDependencies ?? {});
|
|
234
|
-
if (deps.length > 0 || devDeps.length > 0) return true;
|
|
235
|
-
} catch {}
|
|
236
|
-
for (const indicator of [
|
|
237
|
-
"src",
|
|
238
|
-
"app",
|
|
239
|
-
"pages",
|
|
240
|
-
"lib",
|
|
241
|
-
"index.ts",
|
|
242
|
-
"index.js",
|
|
243
|
-
"main.ts",
|
|
244
|
-
"main.js"
|
|
245
|
-
]) if (existsSync(resolve(cwd, indicator))) return true;
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
//#endregion
|
|
249
|
-
export { inspectProject };
|