vercel 50.37.2 → 50.37.3
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/chunks/{chunk-TI3A6VCV.js → chunk-JTUEV67U.js} +2 -2
- package/dist/chunks/{chunk-GCUHLRDW.js → chunk-LRGCB3GI.js} +1 -1
- package/dist/chunks/chunk-NKBY7GFB.js +247 -0
- package/dist/chunks/{chunk-LJ7BOV6R.js → chunk-PBUKJWLL.js} +1 -1
- package/dist/commands/deploy/index.js +3 -3
- package/dist/commands/link/index.js +1 -3
- package/dist/commands-bulk.js +1170 -1071
- package/dist/index.js +3 -3
- package/dist/version.mjs +1 -1
- package/package.json +12 -12
- package/dist/chunks/chunk-ZZ6SYVWP.js +0 -384
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
printIndications,
|
|
10
10
|
require_dist as require_dist2,
|
|
11
11
|
sleep
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LRGCB3GI.js";
|
|
13
13
|
import {
|
|
14
14
|
suggestNextCommands
|
|
15
15
|
} from "./chunk-XR53KVJD.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-QIZEWDZG.js";
|
|
23
23
|
import {
|
|
24
24
|
showPluginTipIfNeeded
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-NKBY7GFB.js";
|
|
26
26
|
import {
|
|
27
27
|
CommandTimeout
|
|
28
28
|
} from "./chunk-BU4VHI53.js";
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
global_path_default
|
|
9
|
+
} from "./chunk-AACAZGTQ.js";
|
|
10
|
+
import {
|
|
11
|
+
output_manager_default
|
|
12
|
+
} from "./chunk-FDJURQMQ.js";
|
|
13
|
+
import {
|
|
14
|
+
require_source
|
|
15
|
+
} from "./chunk-S7KYDPEM.js";
|
|
16
|
+
import {
|
|
17
|
+
__toESM
|
|
18
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
19
|
+
|
|
20
|
+
// src/util/agent/auto-install-agentic.ts
|
|
21
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
22
|
+
import { readFile, writeFile, readdir } from "fs/promises";
|
|
23
|
+
import { access } from "fs/promises";
|
|
24
|
+
import { join } from "path";
|
|
25
|
+
import { homedir } from "os";
|
|
26
|
+
import { spawn } from "child_process";
|
|
27
|
+
import { KNOWN_AGENTS } from "@vercel/detect-agent";
|
|
28
|
+
var PREFS_FILE = "agent-preferences.json";
|
|
29
|
+
var AGENT_TO_TARGET = {
|
|
30
|
+
[KNOWN_AGENTS.CLAUDE]: "claude-code",
|
|
31
|
+
[KNOWN_AGENTS.COWORK]: "claude-code",
|
|
32
|
+
[KNOWN_AGENTS.CURSOR]: "cursor",
|
|
33
|
+
[KNOWN_AGENTS.CURSOR_CLI]: "cursor"
|
|
34
|
+
};
|
|
35
|
+
async function fileExists(filePath) {
|
|
36
|
+
try {
|
|
37
|
+
await access(filePath);
|
|
38
|
+
return true;
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function readPrefs() {
|
|
44
|
+
try {
|
|
45
|
+
const raw = await readFile(
|
|
46
|
+
join(global_path_default(), PREFS_FILE),
|
|
47
|
+
"utf-8"
|
|
48
|
+
);
|
|
49
|
+
return JSON.parse(raw);
|
|
50
|
+
} catch {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function writePrefs(prefs) {
|
|
55
|
+
try {
|
|
56
|
+
await writeFile(
|
|
57
|
+
join(global_path_default(), PREFS_FILE),
|
|
58
|
+
JSON.stringify(prefs, null, 2),
|
|
59
|
+
"utf-8"
|
|
60
|
+
);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function getPluginTargets(agentName) {
|
|
65
|
+
if (agentName && AGENT_TO_TARGET[agentName]) {
|
|
66
|
+
return [AGENT_TO_TARGET[agentName]];
|
|
67
|
+
}
|
|
68
|
+
const home = homedir();
|
|
69
|
+
const targets = [];
|
|
70
|
+
if (await fileExists(join(home, ".claude"))) {
|
|
71
|
+
targets.push("claude-code");
|
|
72
|
+
}
|
|
73
|
+
if (await fileExists(join(home, ".cursor"))) {
|
|
74
|
+
targets.push("cursor");
|
|
75
|
+
}
|
|
76
|
+
return targets;
|
|
77
|
+
}
|
|
78
|
+
async function isPluginInClaudeRegistry() {
|
|
79
|
+
try {
|
|
80
|
+
const raw = await readFile(
|
|
81
|
+
join(homedir(), ".claude", "plugins", "installed_plugins.json"),
|
|
82
|
+
"utf-8"
|
|
83
|
+
);
|
|
84
|
+
const data = JSON.parse(raw);
|
|
85
|
+
const plugins = data?.plugins ?? {};
|
|
86
|
+
return Object.keys(plugins).some(
|
|
87
|
+
(key) => key.toLowerCase().includes("vercel-plugin")
|
|
88
|
+
);
|
|
89
|
+
} catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function isPluginInCursorPlugins() {
|
|
94
|
+
const pluginsDir = join(homedir(), ".cursor", "plugins");
|
|
95
|
+
try {
|
|
96
|
+
const entries = await readdir(pluginsDir, { withFileTypes: true });
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
if (!entry.isDirectory())
|
|
99
|
+
continue;
|
|
100
|
+
if (entry.name.includes("vercel-plugin")) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
async function isPluginInstalledForTarget(target) {
|
|
110
|
+
if (target === "claude-code") {
|
|
111
|
+
return isPluginInClaudeRegistry();
|
|
112
|
+
}
|
|
113
|
+
if (target === "cursor") {
|
|
114
|
+
return await isPluginInClaudeRegistry() || await isPluginInCursorPlugins();
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
async function confirm(client, message, autoConfirm) {
|
|
119
|
+
if (autoConfirm && !client.isAgent) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (!client.stdin.isTTY) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return client.input.confirm(message, true);
|
|
126
|
+
}
|
|
127
|
+
async function autoInstallAgentTooling(client, options) {
|
|
128
|
+
try {
|
|
129
|
+
const prefs = await readPrefs();
|
|
130
|
+
if (!prefs.pluginDismissed) {
|
|
131
|
+
const targets = await getPluginTargets(client.agentName);
|
|
132
|
+
const uninstalledTargets = [];
|
|
133
|
+
for (const target of targets) {
|
|
134
|
+
if (!await isPluginInstalledForTarget(target)) {
|
|
135
|
+
uninstalledTargets.push(target);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (uninstalledTargets.length > 0) {
|
|
139
|
+
if (client.isAgent && !client.stdin.isTTY) {
|
|
140
|
+
const next = uninstalledTargets.map((target) => ({
|
|
141
|
+
command: `npx plugins add vercel/vercel-plugin --target ${target} -y`,
|
|
142
|
+
when: `Install Vercel plugin for ${target}`
|
|
143
|
+
}));
|
|
144
|
+
client.stdout.write(
|
|
145
|
+
`${JSON.stringify(
|
|
146
|
+
{
|
|
147
|
+
status: "action_required",
|
|
148
|
+
reason: "plugin_install",
|
|
149
|
+
message: "The Vercel plugin enhances your agent experience. Would you like to install it?",
|
|
150
|
+
next
|
|
151
|
+
},
|
|
152
|
+
null,
|
|
153
|
+
2
|
|
154
|
+
)}
|
|
155
|
+
`
|
|
156
|
+
);
|
|
157
|
+
prefs.pluginDismissed = true;
|
|
158
|
+
await writePrefs(prefs);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const targetList = uninstalledTargets.join(", ");
|
|
162
|
+
output_manager_default.log(
|
|
163
|
+
`The Vercel plugin installs on your agent harness (${targetList}) to give your AI agent the ability to manage deployments, environments, and more.`
|
|
164
|
+
);
|
|
165
|
+
const accepted = await confirm(
|
|
166
|
+
client,
|
|
167
|
+
"Install the Vercel plugin?",
|
|
168
|
+
options?.autoConfirm
|
|
169
|
+
);
|
|
170
|
+
if (accepted) {
|
|
171
|
+
let interrupted = false;
|
|
172
|
+
for (const target of uninstalledTargets) {
|
|
173
|
+
if (interrupted)
|
|
174
|
+
break;
|
|
175
|
+
output_manager_default.spinner(`Installing Vercel plugin for ${target}...`);
|
|
176
|
+
const exitCode = await new Promise((resolve) => {
|
|
177
|
+
const child = spawn(
|
|
178
|
+
"npx",
|
|
179
|
+
[
|
|
180
|
+
"plugins",
|
|
181
|
+
"add",
|
|
182
|
+
"vercel/vercel-plugin",
|
|
183
|
+
"--target",
|
|
184
|
+
target,
|
|
185
|
+
"-y"
|
|
186
|
+
],
|
|
187
|
+
{ stdio: "pipe" }
|
|
188
|
+
);
|
|
189
|
+
const onSigint = () => {
|
|
190
|
+
interrupted = true;
|
|
191
|
+
child.kill();
|
|
192
|
+
};
|
|
193
|
+
process.once("SIGINT", onSigint);
|
|
194
|
+
child.on("close", (c) => {
|
|
195
|
+
process.removeListener("SIGINT", onSigint);
|
|
196
|
+
resolve(c ?? 1);
|
|
197
|
+
});
|
|
198
|
+
child.on("error", () => {
|
|
199
|
+
process.removeListener("SIGINT", onSigint);
|
|
200
|
+
resolve(1);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
output_manager_default.stopSpinner();
|
|
204
|
+
if (interrupted) {
|
|
205
|
+
output_manager_default.log("Plugin installation cancelled.");
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
if (exitCode === 0) {
|
|
209
|
+
output_manager_default.success(`Installed Vercel plugin for ${target}`);
|
|
210
|
+
} else {
|
|
211
|
+
output_manager_default.debug(`Failed to install Vercel plugin for ${target}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
prefs.pluginDismissed = true;
|
|
216
|
+
await writePrefs(prefs);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} catch (err) {
|
|
221
|
+
output_manager_default.debug(`Auto-install agent tooling failed: ${err}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function showPluginTipIfNeeded() {
|
|
225
|
+
try {
|
|
226
|
+
const prefs = await readPrefs();
|
|
227
|
+
if (prefs.pluginDismissed)
|
|
228
|
+
return;
|
|
229
|
+
const targets = await getPluginTargets();
|
|
230
|
+
for (const target of targets) {
|
|
231
|
+
if (!await isPluginInstalledForTarget(target)) {
|
|
232
|
+
output_manager_default.log(
|
|
233
|
+
import_chalk.default.dim(
|
|
234
|
+
"Tip: Run `npx plugins add vercel/vercel-plugin` to enhance your agent experience"
|
|
235
|
+
)
|
|
236
|
+
);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} catch {
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
autoInstallAgentTooling,
|
|
246
|
+
showPluginTipIfNeeded
|
|
247
|
+
};
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
purchaseDomainIfAvailable,
|
|
14
14
|
require_cjs,
|
|
15
15
|
setupDomain
|
|
16
|
-
} from "../../chunks/chunk-
|
|
16
|
+
} from "../../chunks/chunk-JTUEV67U.js";
|
|
17
17
|
import {
|
|
18
18
|
readLocalConfig
|
|
19
|
-
} from "../../chunks/chunk-
|
|
19
|
+
} from "../../chunks/chunk-LRGCB3GI.js";
|
|
20
20
|
import {
|
|
21
21
|
highlight
|
|
22
22
|
} from "../../chunks/chunk-V5P25P7F.js";
|
|
@@ -32,7 +32,7 @@ import "../../chunks/chunk-QIZEWDZG.js";
|
|
|
32
32
|
import {
|
|
33
33
|
validateJsonOutput
|
|
34
34
|
} from "../../chunks/chunk-XPKWKPWA.js";
|
|
35
|
-
import "../../chunks/chunk-
|
|
35
|
+
import "../../chunks/chunk-NKBY7GFB.js";
|
|
36
36
|
import {
|
|
37
37
|
getSubcommand
|
|
38
38
|
} from "../../chunks/chunk-YPQSDAEW.js";
|
|
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
autoInstallAgentTooling
|
|
9
|
-
} from "../../chunks/chunk-
|
|
9
|
+
} from "../../chunks/chunk-NKBY7GFB.js";
|
|
10
10
|
import {
|
|
11
11
|
getSubcommand
|
|
12
12
|
} from "../../chunks/chunk-YPQSDAEW.js";
|
|
@@ -153,7 +153,6 @@ async function link(client) {
|
|
|
153
153
|
return 1;
|
|
154
154
|
}
|
|
155
155
|
await autoInstallAgentTooling(client, {
|
|
156
|
-
skipAgentInit: true,
|
|
157
156
|
autoConfirm: yes2
|
|
158
157
|
});
|
|
159
158
|
return 0;
|
|
@@ -224,7 +223,6 @@ async function link(client) {
|
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
225
|
await autoInstallAgentTooling(client, {
|
|
227
|
-
skipAgentInit: true,
|
|
228
226
|
autoConfirm: yes
|
|
229
227
|
});
|
|
230
228
|
return 0;
|