neon 2.44.0 → 2.46.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 +62 -1
- package/dist/_shared/paths.js +3 -4
- package/dist/commands/bootstrap.js +12 -11
- package/dist/commands/checkout.js +7 -6
- package/dist/commands/config.js +2 -1
- package/dist/commands/data_api.js +4 -3
- package/dist/commands/env.js +5 -4
- package/dist/commands/functions.js +3 -2
- package/dist/commands/init.js +82 -37
- package/dist/commands/ip_allow.js +3 -2
- package/dist/commands/link.js +17 -16
- package/dist/commands/projects.js +3 -2
- package/dist/commands/set_context.js +5 -4
- package/dist/current_branch_fast_path.js +2 -1
- package/dist/dev/env.js +8 -7
- package/dist/dev/runtime.js +45 -1
- package/dist/dev/websocket.js +1031 -0
- package/dist/index.js +2 -2
- package/dist/init/agents.js +127 -0
- package/dist/init/auth.js +77 -0
- package/dist/init/bootstrap.js +448 -0
- package/dist/init/build_config.js +2 -0
- package/dist/init/detect_agent.js +108 -0
- package/dist/init/editors.js +62 -0
- package/dist/init/enrich_output.js +71 -0
- package/dist/init/extension.js +191 -0
- package/dist/init/inspect.js +287 -0
- package/dist/init/interactive.js +651 -0
- package/dist/init/neonctl.js +184 -0
- package/dist/init/orchestrate.js +190 -0
- package/dist/init/phases/auth.js +209 -0
- package/dist/init/phases/cleanup.js +27 -0
- package/dist/init/phases/db.js +283 -0
- package/dist/init/phases/getting_started.js +228 -0
- package/dist/init/phases/mcp.js +227 -0
- package/dist/init/phases/migrations.js +251 -0
- package/dist/init/phases/neon_auth.js +135 -0
- package/dist/init/phases/setup.js +729 -0
- package/dist/init/phases/skills.js +89 -0
- package/dist/init/phases/status.js +70 -0
- package/dist/init/resolve_context.js +107 -0
- package/dist/init/route_command.js +100 -0
- package/dist/init/skills.js +248 -0
- package/dist/init/types.js +1 -0
- package/dist/init/vsix.js +111 -0
- package/dist/psql/command/cmd_meta.js +2 -2
- package/dist/psql/core/mainloop.js +1 -1
- package/dist/psql/core/startup.js +1 -1
- package/dist/psql/core/syncVars.js +3 -3
- package/dist/psql/index.js +1 -1
- package/dist/utils/cli_name.js +14 -0
- package/dist/utils/esbuild.js +1 -1
- package/dist/utils/write_sync.js +39 -0
- package/package.json +18 -12
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Detects the IDE/editor the terminal is running in, regardless of which
|
|
4
|
+
* agent is active. Used for extension installation — the extension goes
|
|
5
|
+
* into the IDE, not the agent.
|
|
6
|
+
*
|
|
7
|
+
* Returns an Editor-compatible string: "Cursor", "VS Code", "Windsurf", or null.
|
|
8
|
+
*/
|
|
9
|
+
export function detectIde() {
|
|
10
|
+
const env = process.env;
|
|
11
|
+
// Cursor: check explicit Cursor env vars (set in extension host context)
|
|
12
|
+
if (env.TERM_PROGRAM === "cursor" ||
|
|
13
|
+
env.CURSOR_TRACE_ID !== undefined ||
|
|
14
|
+
env.CURSOR_EXTENSION_HOST_ROLE !== undefined ||
|
|
15
|
+
env.CURSOR_LAYOUT !== undefined ||
|
|
16
|
+
env.CURSOR_SPAWNED_BY_EXTENSION_ID !== undefined) {
|
|
17
|
+
return "Cursor";
|
|
18
|
+
}
|
|
19
|
+
// Cursor: check app paths in env vars (reliable from terminal context)
|
|
20
|
+
if (env.GIT_ASKPASS?.includes("Cursor.app") ||
|
|
21
|
+
env.VSCODE_GIT_ASKPASS_NODE?.includes("Cursor.app") ||
|
|
22
|
+
env.GIT_ASKPASS?.includes("cursor") ||
|
|
23
|
+
env.VSCODE_GIT_ASKPASS_NODE?.includes("cursor")) {
|
|
24
|
+
return "Cursor";
|
|
25
|
+
}
|
|
26
|
+
// Windsurf
|
|
27
|
+
if (env.TERM_PROGRAM === "windsurf") {
|
|
28
|
+
return "Windsurf";
|
|
29
|
+
}
|
|
30
|
+
// At this point we know we're in a VS Code-like environment if any
|
|
31
|
+
// VSCODE_ env vars are set. But is it actually Cursor with generic env vars?
|
|
32
|
+
if (env.TERM_PROGRAM === "vscode" ||
|
|
33
|
+
env.VSCODE_PID !== undefined ||
|
|
34
|
+
env.VSCODE_CWD !== undefined) {
|
|
35
|
+
// Check any remaining env vars that might contain "cursor" (case-insensitive)
|
|
36
|
+
// This catches VSCODE_IPC_HOOK_CLI, PATH additions, etc.
|
|
37
|
+
const envValues = Object.values(env).join("\n").toLowerCase();
|
|
38
|
+
if (envValues.includes("cursor.app") ||
|
|
39
|
+
envValues.includes("/cursor/")) {
|
|
40
|
+
return "Cursor";
|
|
41
|
+
}
|
|
42
|
+
// If only Cursor is installed (not VS Code), it must be Cursor
|
|
43
|
+
if (isCursorInstalled() && !isVSCodeInstalled()) {
|
|
44
|
+
return "Cursor";
|
|
45
|
+
}
|
|
46
|
+
return "VS Code";
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
export function isCursorInstalled() {
|
|
51
|
+
if (process.platform === "darwin") {
|
|
52
|
+
return existsSync("/Applications/Cursor.app");
|
|
53
|
+
}
|
|
54
|
+
if (process.platform === "linux") {
|
|
55
|
+
return existsSync("/usr/share/cursor") || existsSync("/usr/bin/cursor");
|
|
56
|
+
}
|
|
57
|
+
if (process.platform === "win32") {
|
|
58
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
59
|
+
return (existsSync(`${localAppData}\\Programs\\Cursor\\Cursor.exe`) ||
|
|
60
|
+
existsSync(`${localAppData}\\cursor\\Cursor.exe`));
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
export function isVSCodeInstalled() {
|
|
65
|
+
if (process.platform === "darwin") {
|
|
66
|
+
return existsSync("/Applications/Visual Studio Code.app");
|
|
67
|
+
}
|
|
68
|
+
if (process.platform === "linux") {
|
|
69
|
+
return existsSync("/usr/share/code") || existsSync("/usr/bin/code");
|
|
70
|
+
}
|
|
71
|
+
if (process.platform === "win32") {
|
|
72
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
73
|
+
const programFiles = process.env.PROGRAMFILES || "C:\\Program Files";
|
|
74
|
+
return (existsSync(`${localAppData}\\Programs\\Microsoft VS Code\\Code.exe`) || existsSync(`${programFiles}\\Microsoft VS Code\\Code.exe`));
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Detects which agent/IDE is running the CLI from environment variables.
|
|
80
|
+
* Returns the add-mcp compatible agent ID (e.g. "cursor", "claude-code").
|
|
81
|
+
*
|
|
82
|
+
* Delegates IDE detection to detectIde() to avoid duplicating Cursor/VS Code
|
|
83
|
+
* heuristics, then checks for agent-specific env vars.
|
|
84
|
+
*/
|
|
85
|
+
export function detectAgent() {
|
|
86
|
+
const env = process.env;
|
|
87
|
+
// Agent-specific env vars (checked first — these are unambiguous)
|
|
88
|
+
if (env.CLAUDECODE === "1" ||
|
|
89
|
+
env.CLAUDE_CODE === "1" ||
|
|
90
|
+
env.CLAUDE_CLI === "1") {
|
|
91
|
+
return "claude-code";
|
|
92
|
+
}
|
|
93
|
+
if (env.CODEX === "1")
|
|
94
|
+
return "codex";
|
|
95
|
+
if (env.CLINE === "1")
|
|
96
|
+
return "cline";
|
|
97
|
+
// Fall back to IDE detection (Cursor, VS Code, Windsurf)
|
|
98
|
+
const ide = detectIde();
|
|
99
|
+
if (ide) {
|
|
100
|
+
const IDE_TO_AGENT = {
|
|
101
|
+
Cursor: "cursor",
|
|
102
|
+
"VS Code": "vscode",
|
|
103
|
+
Windsurf: "windsurf",
|
|
104
|
+
};
|
|
105
|
+
return IDE_TO_AGENT[ide] ?? null;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { execa } from "execa";
|
|
4
|
+
/**
|
|
5
|
+
* Gets VS Code's global config directory based on the platform
|
|
6
|
+
*/
|
|
7
|
+
export function getVSCodeGlobalConfigDir(homeDir) {
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
if (platform === "darwin") {
|
|
10
|
+
// macOS: ~/Library/Application Support/Code/User
|
|
11
|
+
return resolve(homeDir, "Library", "Application Support", "Code", "User");
|
|
12
|
+
}
|
|
13
|
+
if (platform === "linux") {
|
|
14
|
+
// Linux: ~/.config/Code/User
|
|
15
|
+
return resolve(homeDir, ".config", "Code", "User");
|
|
16
|
+
}
|
|
17
|
+
if (platform === "win32") {
|
|
18
|
+
// Windows: %APPDATA%\Code\User
|
|
19
|
+
const appData = process.env.APPDATA;
|
|
20
|
+
if (appData) {
|
|
21
|
+
return resolve(appData, "Code", "User");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks if Claude CLI is installed
|
|
28
|
+
*/
|
|
29
|
+
async function isClaudeCLIInstalled() {
|
|
30
|
+
try {
|
|
31
|
+
await execa("claude", ["--version"], {
|
|
32
|
+
stdio: "ignore",
|
|
33
|
+
timeout: 5000,
|
|
34
|
+
});
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Detects which editors are installed on the system
|
|
43
|
+
*/
|
|
44
|
+
export async function detectAvailableEditors(homeDir) {
|
|
45
|
+
const editors = [];
|
|
46
|
+
// Check for Cursor (global config directory)
|
|
47
|
+
const cursorDir = resolve(homeDir, ".cursor");
|
|
48
|
+
if (existsSync(cursorDir)) {
|
|
49
|
+
editors.push("Cursor");
|
|
50
|
+
}
|
|
51
|
+
// Check if VS Code's global config directory exists
|
|
52
|
+
const vscodeGlobalDir = getVSCodeGlobalConfigDir(homeDir);
|
|
53
|
+
if (vscodeGlobalDir && existsSync(vscodeGlobalDir)) {
|
|
54
|
+
editors.push("VS Code");
|
|
55
|
+
}
|
|
56
|
+
// Check for Claude CLI by running the command
|
|
57
|
+
const claudeInstalled = await isClaudeCLIInstalled();
|
|
58
|
+
if (claudeInstalled) {
|
|
59
|
+
editors.push("Claude CLI");
|
|
60
|
+
}
|
|
61
|
+
return editors;
|
|
62
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a phase's `args` (e.g. ["neon-auth", "--json", "--setup"]) into the
|
|
3
|
+
* `neon init --agent --data` invocation that reaches the same handler.
|
|
4
|
+
*/
|
|
5
|
+
function argsToCommand(args) {
|
|
6
|
+
const data = {};
|
|
7
|
+
let i = 0;
|
|
8
|
+
// First non-flag arg is the subcommand → step
|
|
9
|
+
if (args.length > 0 && !args[0].startsWith("-")) {
|
|
10
|
+
data.step = args[0];
|
|
11
|
+
i = 1;
|
|
12
|
+
}
|
|
13
|
+
while (i < args.length) {
|
|
14
|
+
const arg = args[i];
|
|
15
|
+
if (arg.startsWith("--")) {
|
|
16
|
+
const key = arg
|
|
17
|
+
.slice(2)
|
|
18
|
+
.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
19
|
+
if (key === "json") {
|
|
20
|
+
i += 1;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const next = args[i + 1];
|
|
24
|
+
if (next !== undefined && !next.startsWith("-")) {
|
|
25
|
+
data[key] = next;
|
|
26
|
+
i += 2;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
data[key] = true;
|
|
30
|
+
i += 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
i += 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return `neon init --agent --data '${JSON.stringify(data)}'`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Walks a phase response object and:
|
|
41
|
+
* 1. Replaces `args` arrays with `command` strings (neon init --data format)
|
|
42
|
+
* 2. Renames `run_neon_init` → `run_shell_command`
|
|
43
|
+
* 3. Adds a description to finalize steps
|
|
44
|
+
*/
|
|
45
|
+
export function enrichResponse(obj) {
|
|
46
|
+
if (obj === null || typeof obj !== "object")
|
|
47
|
+
return obj;
|
|
48
|
+
if (Array.isArray(obj))
|
|
49
|
+
return obj.map(enrichResponse);
|
|
50
|
+
const record = obj;
|
|
51
|
+
const result = {};
|
|
52
|
+
for (const [key, value] of Object.entries(record)) {
|
|
53
|
+
result[key] = enrichResponse(value);
|
|
54
|
+
}
|
|
55
|
+
// Replace args with command in run_neon_init actions and responseMapping entries
|
|
56
|
+
if (Array.isArray(result.args)) {
|
|
57
|
+
result.command = argsToCommand(result.args);
|
|
58
|
+
delete result.args;
|
|
59
|
+
}
|
|
60
|
+
// Rename run_neon_init → run_shell_command so agents don't infer subcommand patterns
|
|
61
|
+
if (result.type === "run_neon_init") {
|
|
62
|
+
result.type = "run_shell_command";
|
|
63
|
+
// Help agents understand finalize is the terminal step
|
|
64
|
+
if (typeof result.command === "string" &&
|
|
65
|
+
result.command.includes('"step":"finalize"')) {
|
|
66
|
+
result.description =
|
|
67
|
+
"Run this command to complete the setup. This is the final step — do not run any other neon init commands after this.";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { unlink } from "node:fs/promises";
|
|
3
|
+
import { execa } from "execa";
|
|
4
|
+
import { downloadVsix, NEON_EXTENSION_ID } from "./vsix.js";
|
|
5
|
+
/**
|
|
6
|
+
* Uses macOS mdfind to locate an app by bundle identifier
|
|
7
|
+
*/
|
|
8
|
+
async function findAppWithMdfind(bundleId) {
|
|
9
|
+
try {
|
|
10
|
+
const result = await execa("mdfind", [`kMDItemCFBundleIdentifier == '${bundleId}'`], { timeout: 5000 });
|
|
11
|
+
const paths = result.stdout.trim().split("\n").filter(Boolean);
|
|
12
|
+
return paths[0] || null;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Known installation paths for VS Code CLI
|
|
20
|
+
*/
|
|
21
|
+
function getVSCodePaths() {
|
|
22
|
+
const platform = process.platform;
|
|
23
|
+
const home = process.env.HOME || "";
|
|
24
|
+
if (platform === "darwin") {
|
|
25
|
+
return [
|
|
26
|
+
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
|
|
27
|
+
"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders",
|
|
28
|
+
`${home}/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code`,
|
|
29
|
+
`${home}/Downloads/Visual Studio Code.app/Contents/Resources/app/bin/code`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
if (platform === "linux") {
|
|
33
|
+
return [
|
|
34
|
+
"/usr/share/code/bin/code",
|
|
35
|
+
"/usr/bin/code",
|
|
36
|
+
"/snap/bin/code",
|
|
37
|
+
"/usr/share/code-insiders/bin/code-insiders",
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
if (platform === "win32") {
|
|
41
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
42
|
+
const programFiles = process.env.PROGRAMFILES || "C:\\Program Files";
|
|
43
|
+
return [
|
|
44
|
+
`${localAppData}\\Programs\\Microsoft VS Code\\bin\\code.cmd`,
|
|
45
|
+
`${programFiles}\\Microsoft VS Code\\bin\\code.cmd`,
|
|
46
|
+
`${localAppData}\\Programs\\Microsoft VS Code Insiders\\bin\\code-insiders.cmd`,
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Known installation paths for Cursor CLI
|
|
53
|
+
*/
|
|
54
|
+
function getCursorPaths() {
|
|
55
|
+
const platform = process.platform;
|
|
56
|
+
const home = process.env.HOME || "";
|
|
57
|
+
if (platform === "darwin") {
|
|
58
|
+
return [
|
|
59
|
+
"/Applications/Cursor.app/Contents/Resources/app/bin/cursor",
|
|
60
|
+
`${home}/Applications/Cursor.app/Contents/Resources/app/bin/cursor`,
|
|
61
|
+
`${home}/Downloads/Cursor.app/Contents/Resources/app/bin/cursor`,
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
if (platform === "linux") {
|
|
65
|
+
return [
|
|
66
|
+
"/usr/share/cursor/bin/cursor",
|
|
67
|
+
"/usr/bin/cursor",
|
|
68
|
+
`${home}/.local/bin/cursor`,
|
|
69
|
+
"/opt/cursor/bin/cursor",
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
if (platform === "win32") {
|
|
73
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
74
|
+
const programFiles = process.env.PROGRAMFILES || "C:\\Program Files";
|
|
75
|
+
return [
|
|
76
|
+
`${localAppData}\\Programs\\Cursor\\resources\\app\\bin\\cursor.cmd`,
|
|
77
|
+
`${localAppData}\\cursor\\Cursor.exe`,
|
|
78
|
+
`${programFiles}\\Cursor\\resources\\app\\bin\\cursor.cmd`,
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Finds the CLI command for an editor by checking known installation paths
|
|
85
|
+
* On macOS, also uses mdfind to locate the app if standard paths fail
|
|
86
|
+
* Falls back to the simple command name if no full path is found (in case it's in PATH)
|
|
87
|
+
*/
|
|
88
|
+
export async function findEditorCommand(editor) {
|
|
89
|
+
let paths;
|
|
90
|
+
let fallbackCommand;
|
|
91
|
+
let bundleId = null;
|
|
92
|
+
if (editor === "VS Code") {
|
|
93
|
+
paths = getVSCodePaths();
|
|
94
|
+
fallbackCommand = "code";
|
|
95
|
+
bundleId = "com.microsoft.VSCode";
|
|
96
|
+
}
|
|
97
|
+
else if (editor === "Cursor") {
|
|
98
|
+
paths = getCursorPaths();
|
|
99
|
+
fallbackCommand = "cursor";
|
|
100
|
+
bundleId = "com.todesktop.230313mzl4w4u92";
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
for (const path of paths) {
|
|
106
|
+
if (existsSync(path)) {
|
|
107
|
+
return path;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// On macOS, try mdfind to locate the app dynamically
|
|
111
|
+
if (process.platform === "darwin" && bundleId) {
|
|
112
|
+
const appPath = await findAppWithMdfind(bundleId);
|
|
113
|
+
if (appPath) {
|
|
114
|
+
const cliPath = `${appPath}/Contents/Resources/app/bin/${fallbackCommand}`;
|
|
115
|
+
if (existsSync(cliPath)) {
|
|
116
|
+
return cliPath;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return fallbackCommand;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Checks if the extension is installed by querying the editor's extension list
|
|
124
|
+
*/
|
|
125
|
+
export async function isExtensionInstalled(editor) {
|
|
126
|
+
const command = await findEditorCommand(editor);
|
|
127
|
+
if (!command) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const result = await execa(command, ["--list-extensions"], {
|
|
132
|
+
timeout: 5000,
|
|
133
|
+
});
|
|
134
|
+
return result.stdout.includes(NEON_EXTENSION_ID);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Installs the Neon Local Connect extension for VS Code or Cursor.
|
|
142
|
+
*
|
|
143
|
+
* Strategy:
|
|
144
|
+
* 1. Try `--install-extension <id>` directly (uses the editor's configured marketplace)
|
|
145
|
+
* 2. If that fails, download .vsix (from proxy or Open VSX) and install locally
|
|
146
|
+
* 3. Set NEON_VSX_GALLERY_URL to use a corporate proxy for the download
|
|
147
|
+
*/
|
|
148
|
+
export async function installExtension(editor) {
|
|
149
|
+
const command = await findEditorCommand(editor);
|
|
150
|
+
if (!command) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
// Try direct marketplace install first
|
|
154
|
+
try {
|
|
155
|
+
await execa(command, ["--install-extension", NEON_EXTENSION_ID], {
|
|
156
|
+
stdio: "pipe",
|
|
157
|
+
timeout: 60000,
|
|
158
|
+
});
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
// Fall through to VSIX download
|
|
163
|
+
}
|
|
164
|
+
// Download .vsix and install locally
|
|
165
|
+
const vsixPath = await downloadVsix();
|
|
166
|
+
if (!vsixPath) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
await execa(command, ["--install-extension", vsixPath], {
|
|
171
|
+
stdio: "pipe",
|
|
172
|
+
timeout: 60000,
|
|
173
|
+
});
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
try {
|
|
181
|
+
await unlink(vsixPath);
|
|
182
|
+
}
|
|
183
|
+
catch { }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Returns the editor types that should use extension installation (vs MCP)
|
|
188
|
+
*/
|
|
189
|
+
export function usesExtension(editor) {
|
|
190
|
+
return editor === "VS Code" || editor === "Cursor";
|
|
191
|
+
}
|