neon 8.23.1 → 8.23.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.
Files changed (40) hide show
  1. package/README.md +5 -8
  2. package/dist/_chunks/{bootstrap-Dh7-KDmw.js → bootstrap-B73qVB39.js} +3 -2
  3. package/dist/_chunks/{checkout-CNBIS3gA.js → checkout-Bsfl-B0h.js} +3 -3
  4. package/dist/_chunks/{claim-DhV0f_5o.js → claim-B3tMeMuo.js} +1 -1
  5. package/dist/_chunks/{config-CgtJH8xE.js → config-DZ3cDaOS.js} +11 -9
  6. package/dist/_chunks/{deploy-Bs5gmi4Q.js → deploy-CF4PxuNX.js} +1 -1
  7. package/dist/_chunks/{dev-DxiIp4c9.js → dev-BnHQENZM.js} +3 -3
  8. package/dist/_chunks/{git-DRUZBCmZ.js → git-CRYW7ku0.js} +2 -2
  9. package/dist/_chunks/{link-CNO-HxHN.js → link-VYCSKqU-.js} +2 -2
  10. package/dist/_chunks/{plugins-7cxVcgay.js → plugins-BwUZQ6Ic.js} +10 -24
  11. package/dist/_chunks/{status-BlrzeKyA.js → status-rt-0bUaQ.js} +1 -1
  12. package/dist/commands/bootstrap.js +1 -1
  13. package/dist/commands/checkout.js +1 -1
  14. package/dist/commands/claim.js +1 -1
  15. package/dist/commands/config.js +1 -1
  16. package/dist/commands/deploy.js +1 -1
  17. package/dist/commands/dev.js +1 -1
  18. package/dist/commands/env.js +1 -1
  19. package/dist/commands/functions_new.js +3 -3
  20. package/dist/commands/git.js +1 -1
  21. package/dist/commands/index.js +11 -11
  22. package/dist/commands/link.js +1 -1
  23. package/dist/commands/plugins.js +1 -1
  24. package/dist/commands/status.js +1 -1
  25. package/dist/commands/subscribe.js +1 -1
  26. package/dist/errors.js +18 -2
  27. package/dist/init/auth.js +1 -1
  28. package/dist/init/copy.js +2 -2
  29. package/dist/init/deploy.js +1 -1
  30. package/dist/init/funnel.js +2 -1
  31. package/dist/init/link.js +1 -1
  32. package/dist/init/plan.js +20 -13
  33. package/dist/init/run.js +9 -21
  34. package/dist/init/tooling.js +1 -2
  35. package/dist/plugins/plan.js +19 -34
  36. package/dist/plugins/run.js +8 -5
  37. package/dist/plugins/targets.js +13 -20
  38. package/dist/utils/package_manager.js +126 -7
  39. package/package.json +5 -5
  40. package/dist/_chunks/{env-BtG4vH55.js → env-BOt9AZ1j.js} +1 -1
package/dist/init/plan.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getCliName } from "../utils/cli_name.js";
2
2
  import { tryResolveAddMcpAgentId, uniqueAgentIds } from "../mcp/agents.js";
3
3
  import { supportsSkills } from "./agents.js";
4
- import { pluginsInstallableAgents } from "../plugins/targets.js";
4
+ import { bootstrapPluginAgents, pluginsInstallableAgents } from "../plugins/targets.js";
5
5
  import { mcpInstallableAgents } from "../mcp/targets.js";
6
6
  import { skillsInstallableAgents } from "../skills/targets.js";
7
7
  import { agentArgv } from "../utils/agent_flag.js";
@@ -86,22 +86,26 @@ const noDetectedAgentsMessage = (input) => {
86
86
  const name = input.nameAgent === true;
87
87
  let hint;
88
88
  if (input.fix === "pass-yes") {
89
- const detected = input.scope === "project" ? "Pass -y to use project folders, else the host CLI agent" : "Pass -y to use installed apps, else the host CLI agent";
89
+ const detected = input.scope === "project" ? "Pass -y to use project folders, else the host CLI agent" : input.scope === "global" ? "Pass -y to use installed apps, else the host CLI agent" : "Pass -y to use project folders, else the host CLI agent, else installed apps";
90
90
  hint = name ? `${detected}, --agent <name> to name them, or run from a terminal to pick one.` : `${detected}, or run from a terminal to pick one.`;
91
91
  } else hint = name ? "Pass --agent <name>, run this command from a supported agent, or omit -y in a terminal to pick one." : "Run this command from a supported agent, or omit -y in a terminal to pick one.";
92
92
  return `${lead} ${hint} Supported agents: ${input.supported.join(", ")}`;
93
93
  };
94
94
  const INIT_NEEDS_YES_OR_TERMINAL = "No interactive terminal. Pass -y to use defaults, or run this command in a terminal to pick.";
95
95
  const initYesSupportedAgents = () => uniqueAgentIds([
96
- ...pluginsInstallableAgents("project"),
96
+ ...pluginsInstallableAgents(),
97
97
  ...skillsInstallableAgents(),
98
98
  ...mcpInstallableAgents("global")
99
99
  ]);
100
- const initPluginAgents = () => pluginsInstallableAgents("project");
100
+ const initPluginAgents = () => pluginsInstallableAgents();
101
101
  const initSkillsMcpAgents = () => {
102
102
  const plugin = new Set(initPluginAgents());
103
103
  return initYesSupportedAgents().filter((id) => !plugin.has(id));
104
104
  };
105
+ const bootstrapSkillsMcpAgents = () => {
106
+ const plugin = new Set(bootstrapPluginAgents());
107
+ return initYesSupportedAgents().filter((id) => !plugin.has(id));
108
+ };
105
109
  const resolveYesAgentList = (input) => {
106
110
  if (input.detected.length > 0) return uniqueAgentIds(input.detected);
107
111
  if (input.host !== null) return [input.host];
@@ -122,8 +126,8 @@ async function collectYesAgents(sources) {
122
126
  });
123
127
  }
124
128
  const chooseYesAgentTooling = (agents) => {
125
- const projectPlugin = new Set(pluginsInstallableAgents("project"));
126
- const [pluginFirst, ...pluginRest] = agents.filter((id) => projectPlugin.has(id));
129
+ const bootstrapPlugin = new Set(bootstrapPluginAgents());
130
+ const [pluginFirst, ...pluginRest] = agents.filter((id) => bootstrapPlugin.has(id));
127
131
  if (pluginFirst !== void 0) return {
128
132
  setup: "plugin",
129
133
  agents: [pluginFirst, ...pluginRest]
@@ -139,9 +143,9 @@ const chooseYesAgentTooling = (agents) => {
139
143
  };
140
144
  };
141
145
  const FALLBACK_SKILLS_AGENTS = ["cursor", "codex"];
142
- const splitInitTooling = (agents, pluginScope, mcpConfigLocation = pluginScope, unavailablePluginAgents = []) => {
146
+ const splitInitTooling = (agents, mcpConfigLocation, unavailablePluginAgents = []) => {
143
147
  const unavailable = new Set(unavailablePluginAgents);
144
- const pluginSet = new Set(pluginsInstallableAgents(pluginScope).filter((id) => !unavailable.has(id)));
148
+ const pluginSet = new Set(pluginsInstallableAgents().filter((id) => !unavailable.has(id)));
145
149
  const mcpSet = new Set(mcpInstallableAgents(mcpConfigLocation));
146
150
  const pluginAgents = uniqueAgentIds(agents.filter((id) => pluginSet.has(id)));
147
151
  const rest = uniqueAgentIds(agents.filter((id) => !pluginSet.has(id)));
@@ -166,7 +170,7 @@ const splitInitTooling = (agents, pluginScope, mcpConfigLocation = pluginScope,
166
170
  };
167
171
  };
168
172
  const recommendedTooling = (detected, unavailablePluginAgents = []) => {
169
- const split = splitInitTooling(detected, "global", "global", unavailablePluginAgents);
173
+ const split = splitInitTooling(detected, "global", unavailablePluginAgents);
170
174
  if (split.setup === "skip") return {
171
175
  setup: "skills",
172
176
  agents: FALLBACK_SKILLS_AGENTS
@@ -176,7 +180,6 @@ const recommendedTooling = (detected, unavailablePluginAgents = []) => {
176
180
  const planInitToolingSteps = (input) => {
177
181
  const pluginOptions = (agents) => ({
178
182
  yes: input.yes,
179
- global: input.pluginScope === "global",
180
183
  agents
181
184
  });
182
185
  const skillsOptions = (agents) => ({
@@ -242,9 +245,13 @@ const funnelAgentSetup = (tooling) => {
242
245
  if (tooling.mcpAgents.length === 0) return "skills";
243
246
  return "skills-mcp";
244
247
  };
248
+ /**
249
+ * The plugin step gets the routed agents: re-detecting inside `neon plugins` would also
250
+ * pick up agents this routing leaves to skills and MCP.
251
+ */
245
252
  const planYesAgentSteps = (tooling) => planToolingSteps(tooling, {
246
253
  yes: true,
247
- named: false
254
+ named: tooling.setup === "plugin"
248
255
  });
249
256
  const NAMED_AGENTS_UNSUPPORTED = "None of the selected agents can install the Neon plugin, skills, or MCP.";
250
257
  const NAMED_AGENTS_MIXED = "Cannot install the plugin and skills/MCP in one run.";
@@ -257,7 +264,7 @@ const mixedRerun = (command, ids, context) => {
257
264
  return `\`${tokens.join(" ")}\``;
258
265
  };
259
266
  const namedAgentsMixedMessage = (named, command, context) => {
260
- const plugin = new Set(initPluginAgents());
267
+ const plugin = new Set(bootstrapPluginAgents());
261
268
  const pluginNamed = uniqueAgentIds(named.filter((id) => plugin.has(id)));
262
269
  const otherNamed = uniqueAgentIds(named.filter((id) => !plugin.has(id)));
263
270
  return `${NAMED_AGENTS_MIXED} Plugin: ${pluginNamed.join(", ")}. Skills/MCP: ${otherNamed.join(", ")}. Re-run ${mixedRerun(command, pluginNamed, context)} or ${mixedRerun(command, otherNamed, context)}.`;
@@ -324,4 +331,4 @@ const resolveInitAgentSetup = async (input) => {
324
331
  if (input.interactive) return input.pick();
325
332
  throw new Error(INIT_NEEDS_YES_OR_TERMINAL);
326
333
  };
327
- export { FALLBACK_SKILLS_AGENTS, INIT_NEEDS_YES_OR_TERMINAL, NAMED_AGENTS_MIXED, NAMED_AGENTS_UNSUPPORTED, assertNamedAgentTooling, bootstrapInitStep, chooseYesAgentTooling, collectYesAgents, directoryIsEmpty, funnelAgentSetup, initPluginAgents, initSkillsMcpAgents, initYesSupportedAgents, linkInputArgv, namedAgentsMixedMessage, namedAgentsNeedSplit, noDetectedAgentsMessage, planAgentSteps, planConfigInitStep, planInitToolingSteps, planLinkStep, planToolingSteps, planYesAgentSteps, postScaffoldActions, projectContextFile, recommendedTooling, resolveInitAgentSetup, resolveNamedAgents, resolveYesAgentList, splitInitTooling };
334
+ export { FALLBACK_SKILLS_AGENTS, INIT_NEEDS_YES_OR_TERMINAL, NAMED_AGENTS_MIXED, NAMED_AGENTS_UNSUPPORTED, assertNamedAgentTooling, bootstrapInitStep, bootstrapSkillsMcpAgents, chooseYesAgentTooling, collectYesAgents, directoryIsEmpty, funnelAgentSetup, initPluginAgents, initSkillsMcpAgents, initYesSupportedAgents, linkInputArgv, namedAgentsMixedMessage, namedAgentsNeedSplit, noDetectedAgentsMessage, planAgentSteps, planConfigInitStep, planInitToolingSteps, planLinkStep, planToolingSteps, planYesAgentSteps, postScaffoldActions, projectContextFile, recommendedTooling, resolveInitAgentSetup, resolveNamedAgents, resolveYesAgentList, splitInitTooling };
package/dist/init/run.js CHANGED
@@ -14,8 +14,8 @@ import { getAgentDisplayName } from "../mcp/agents.js";
14
14
  import { missingPluginsCommands, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "../plugins/targets.js";
15
15
  import { AGENTS_NOT_INSTALLED, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, MCP_API_KEY_NEEDS_AUTH, MCP_SCOPED_NEEDS_PROJECT, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, PROGRESS, PROJECT_PINNED_OFFLINE, claimableNext, claimableThenServicesNext, configInitNext, envPullFailedNext, existingConfigNext, installFailedNext, mcpAfterLinkNext, mcpConfigLocationSkipped, mcpConfigLocationUnavailable, mcpKeyFailedNext, namedAgentsUnavailable, newConfigNext, offlinePinNext, skippedLinkNext, toolingFailedNext, unattendedUnauthedNext } from "./copy.js";
16
16
  import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
17
- import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-CgtJH8xE.js";
18
- import { o as quoteFlagValue, s as runLink } from "../_chunks/link-CNO-HxHN.js";
17
+ import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-DZ3cDaOS.js";
18
+ import { o as quoteFlagValue, s as runLink } from "../_chunks/link-VYCSKqU-.js";
19
19
  import { runAuthenticatedLink } from "./link.js";
20
20
  import { mcpInstallableAgents } from "../mcp/targets.js";
21
21
  import { skillsInstallableAgents } from "../skills/targets.js";
@@ -25,7 +25,7 @@ import { pullInitEnv, resolveInitConfigApi } from "./auth.js";
25
25
  import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
26
26
  import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
27
27
  import { runToolingSteps, toolingStepCommandText } from "./tooling.js";
28
- import { l as create } from "../_chunks/claim-DhV0f_5o.js";
28
+ import { l as create } from "../_chunks/claim-B3tMeMuo.js";
29
29
  import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
30
30
  import { detectInitEnvironment } from "./detect.js";
31
31
  import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties, recordInitError, recordInitExit } from "./funnel.js";
@@ -62,11 +62,6 @@ const extrasSetup = (setup) => {
62
62
  if (setup === null) return;
63
63
  return setup;
64
64
  };
65
- const pluginScopeFor = (agents, preferred) => {
66
- if (preferred === "global") return "global";
67
- const project = new Set(pluginsInstallableAgents("project"));
68
- return agents.some((id) => !project.has(id) && pluginsInstallableAgents("global").includes(id)) ? "global" : "project";
69
- };
70
65
  const warnUnusablePluginCommands = (unusable, tooling) => {
71
66
  if (tooling.setup !== "skills-mcp" && tooling.setup !== "mixed") return;
72
67
  const routed = /* @__PURE__ */ new Set([...tooling.skillsAgents, ...tooling.mcpAgents]);
@@ -277,17 +272,14 @@ const runInit = async (props) => {
277
272
  return missingCommands;
278
273
  };
279
274
  const unavailablePluginAgents = () => unusablePluginCommands().map((row) => row.agent);
280
- const pluginReady = (agents) => agents.filter((id) => !unavailablePluginAgents().includes(id));
281
275
  let tooling = { setup: "skip" };
282
276
  let mcpAuth = props.mcpAuth;
283
277
  let mcpAuthChosen = props.mcpAuth !== void 0;
284
278
  let mcpConfigLocation = props.mcpConfigLocation ?? "global";
285
279
  let selectedSkills = props.skill;
286
280
  let delayMcp = false;
287
- let pluginScope = recommended ? "global" : "project";
288
281
  if (recommended) {
289
- pluginScope = "global";
290
- tooling = named.length > 0 ? splitInitTooling(named, "global", "global", unavailablePluginAgents()) : recommendedTooling(detection.detectedAgents, unavailablePluginAgents());
282
+ tooling = named.length > 0 ? splitInitTooling(named, "global", unavailablePluginAgents()) : recommendedTooling(detection.detectedAgents, unavailablePluginAgents());
291
283
  if (named.length === 0 && detection.detectedAgents.length === 0) printInitProgress(NO_AGENTS_FALLBACK_STATUS);
292
284
  warnUnusablePluginCommands(unusablePluginCommands(), tooling);
293
285
  mcpAuth = !detection.authenticated && (tooling.setup === "skills-mcp" || tooling.setup === "mixed") ? "oauth" : mcpAuth;
@@ -303,8 +295,7 @@ const runInit = async (props) => {
303
295
  if (inferred.kind === "skip") tooling = { setup: "skip" };
304
296
  else if (inferred.kind === "auto") {
305
297
  const autoAgents = named.length > 0 ? named : detection.detectedAgents;
306
- pluginScope = pluginScopeFor(pluginReady(autoAgents), "project");
307
- tooling = splitInitTooling(autoAgents, pluginScope, mcpConfigLocation, unavailablePluginAgents());
298
+ tooling = splitInitTooling(autoAgents, mcpConfigLocation, unavailablePluginAgents());
308
299
  warnUnusablePluginCommands(unusablePluginCommands(), tooling);
309
300
  if (tooling.setup === "skip" && yes && named.length === 0) {
310
301
  tooling = recommendedTooling([]);
@@ -313,7 +304,6 @@ const runInit = async (props) => {
313
304
  } else {
314
305
  const setup = inferred.kind === "ask" ? await (props.pickAgentSetup ?? pickAgentSetupInteractively)() : inferred.kind;
315
306
  if (setup !== "skip") {
316
- pluginScope = pluginScopeFor(targets, "project");
317
307
  const namedFallback = named.length === 0;
318
308
  const pickAgents = (setup, available) => pickOrDetectAgents({
319
309
  named,
@@ -328,11 +318,11 @@ const runInit = async (props) => {
328
318
  pickAgents: props.pickAgents
329
319
  });
330
320
  if (setup === "plugin" || setup === "skills") {
331
- const selected = await pickAgents(setup, setup === "plugin" ? uniqueAgents([...pluginsInstallableAgents("project"), ...pluginsInstallableAgents("global")]) : [...skillsInstallableAgents()]);
321
+ const selected = await pickAgents(setup, setup === "plugin" ? pluginsInstallableAgents() : [...skillsInstallableAgents()]);
332
322
  if (selected === void 0) tooling = { setup: "skip" };
333
323
  else if (setup === "plugin") {
334
- pluginScope = pluginScopeFor(selected, pluginScope);
335
- tooling = splitInitTooling(selected.filter((id) => pluginsInstallableAgents(pluginScope).includes(id)), pluginScope);
324
+ const pluginAgents = new Set(pluginsInstallableAgents());
325
+ tooling = splitInitTooling(selected.filter((id) => pluginAgents.has(id)), mcpConfigLocation);
336
326
  } else tooling = skillsTooling(selected, namedFallback);
337
327
  } else {
338
328
  const skillsAvailable = skillsInstallableAgents();
@@ -416,7 +406,6 @@ const runInit = async (props) => {
416
406
  const toolingSteps = planInitToolingSteps({
417
407
  tooling: earlyTooling,
418
408
  yes: true,
419
- pluginScope,
420
409
  skillsGlobal: recommended,
421
410
  mcpOauth,
422
411
  mcpProject: mcpConfigLocation === "project",
@@ -530,7 +519,6 @@ const runInit = async (props) => {
530
519
  const mcpSteps = planInitToolingSteps({
531
520
  tooling: mcpOnly,
532
521
  yes: true,
533
- pluginScope,
534
522
  skillsGlobal: recommended,
535
523
  mcpOauth,
536
524
  mcpProject: mcpConfigLocation === "project",
@@ -599,7 +587,7 @@ const runInit = async (props) => {
599
587
  });
600
588
  } catch (error) {
601
589
  if (error instanceof ConfigInstallFailed) {
602
- const failed = installFailedNext(error.command, linkDeferredPull);
590
+ const failed = installFailedNext(error.command, linkDeferredPull, error.message);
603
591
  printInitDone(formatInitDone({
604
592
  heading: failed.heading,
605
593
  body: failed.body,
@@ -7,7 +7,7 @@ import { CannotMintApiKeyError } from "../mcp/mint.js";
7
7
  import { detectAgent } from "./detect_host.js";
8
8
  import { AgentSelectionSkipped, canPickAgentsInteractively } from "../utils/agent_picker.js";
9
9
  import { a as mcpInstallError, s as reportMcpInstall } from "../_chunks/mcp-SvqWzHnT.js";
10
- import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-7cxVcgay.js";
10
+ import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-BwUZQ6Ic.js";
11
11
  import { c as skillsInstallError, o as installSkills, s as reportSkillsInstall } from "../_chunks/skills-Bv8oKKwE.js";
12
12
  import { runAuthenticatedMcp } from "./auth.js";
13
13
  import { raceSigint } from "./cancelled.js";
@@ -26,7 +26,6 @@ const toolingStepCommandText = (step) => {
26
26
  case "plugins": {
27
27
  const { options } = step;
28
28
  if (options.yes) flags.push("-y");
29
- if (options.global) flags.push("--global");
30
29
  for (const agent of options.agents ?? []) flags.push("--agent", agent);
31
30
  break;
32
31
  }
@@ -1,6 +1,6 @@
1
1
  import { getAgentDisplayName, tryResolveAddMcpAgentId } from "../mcp/agents.js";
2
2
  import "../init/agents.js";
3
- import { detectPluginsAgents, getPluginsTargetName, isUserScopeOnlyPluginsTarget, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "./targets.js";
3
+ import { detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "./targets.js";
4
4
  import { collectYesAgents, noDetectedAgentsMessage } from "../init/plan.js";
5
5
  import { detectAgent } from "../init/detect_host.js";
6
6
  import { agentChoicesFrom, pickAgentsInteractively, resolveAgentSelection } from "../utils/agent_picker.js";
@@ -14,6 +14,17 @@ const commandLookup = (options) => ({
14
14
  cwd: options.cwd,
15
15
  ...options.commandPath !== void 0 ? { path: options.commandPath } : {}
16
16
  });
17
+ /** Project folders, then (only with -y) the host CLI agent, then installed apps. */
18
+ const detectPluginsTargets = async (options, available) => {
19
+ const project = detectProjectPluginsAgents(options.cwd);
20
+ if (options.agents.length > 0) return project;
21
+ const first = options.yes ? await collectYesAgents({
22
+ detected: () => project,
23
+ detectAgent: options.detectAgent ?? detectAgent,
24
+ acceptHost: (id) => available.has(id) || getPluginsTargetName(id) !== void 0
25
+ }) : project;
26
+ return first.length > 0 ? first : detectInstalledPluginsAgents(options.detectInstalledAgents);
27
+ };
17
28
  async function resolvePluginsPlan(options) {
18
29
  assertPluginsCanRun({
19
30
  yes: options.yes,
@@ -21,19 +32,9 @@ async function resolvePluginsPlan(options) {
21
32
  hasAgents: options.agents.length > 0
22
33
  });
23
34
  const prompt = options.interactive && !options.yes;
24
- const scope = options.global ? "global" : "project";
25
- const available = pluginsInstallableAgents(scope);
35
+ const available = pluginsInstallableAgents();
26
36
  const availableSet = new Set(available);
27
- const scoped = await detectPluginsAgents({
28
- scope,
29
- cwd: options.cwd,
30
- ...options.detectInstalledAgents ? { detectInstalledAgents: options.detectInstalledAgents } : {}
31
- });
32
- const detected = options.yes && options.agents.length === 0 ? await collectYesAgents({
33
- detected: () => scoped,
34
- detectAgent: options.detectAgent ?? detectAgent,
35
- acceptHost: (id) => availableSet.has(id) || getPluginsTargetName(id) !== void 0
36
- }) : scoped;
37
+ const detected = await detectPluginsTargets(options, availableSet);
37
38
  const unusableDetected = new Map((prompt && options.agents.length === 0 ? missingPluginsCommands(detected, commandLookup(options)) : []).map((row) => [row.agent, row]));
38
39
  const choices = agentChoicesFrom(available, detected).map((choice) => {
39
40
  const row = unusableDetected.get(choice.id);
@@ -48,7 +49,7 @@ async function resolvePluginsPlan(options) {
48
49
  detected: detected.filter((id) => !unusableDetected.has(id)),
49
50
  message: "Which coding agents should get the Neon plugin? (space to toggle, enter to confirm)",
50
51
  nonInteractiveMessage: noDetectedAgentsMessage({
51
- scope,
52
+ scope: "project-then-installed",
52
53
  supported: available,
53
54
  fix: options.yes ? "run-without-yes" : "pass-yes",
54
55
  nameAgent: true
@@ -64,17 +65,11 @@ async function resolvePluginsPlan(options) {
64
65
  });
65
66
  const agents = [];
66
67
  const skipped = [];
67
- const userScopeSkipped = [];
68
68
  for (const id of selected) {
69
- const target = getPluginsTargetName(id);
70
- if (target === void 0) {
69
+ if (getPluginsTargetName(id) === void 0) {
71
70
  skipped.push(id);
72
71
  continue;
73
72
  }
74
- if (scope === "project" && isUserScopeOnlyPluginsTarget(target)) {
75
- userScopeSkipped.push(id);
76
- continue;
77
- }
78
73
  agents.push(id);
79
74
  }
80
75
  const unusableCommands = unusablePluginsCommands(agents, commandLookup(options));
@@ -83,28 +78,18 @@ async function resolvePluginsPlan(options) {
83
78
  const missingAgents = new Set(unusableCommands.map((row) => row.agent));
84
79
  const installable = agents.filter((id) => !missingAgents.has(id));
85
80
  return {
86
- scope,
87
81
  agents: installable,
88
82
  skipped,
89
- userScopeSkipped,
90
83
  unusableCommands,
91
- targets: installable.length === 0 ? [] : mappedPluginsTargets(installable, scope)
84
+ targets: installable.length === 0 ? [] : mappedPluginsTargets(installable)
92
85
  };
93
86
  }
94
- if (agents.length === 0) {
95
- if (userScopeSkipped.length > 0 && skipped.length === 0) {
96
- const names = userScopeSkipped.map((id) => getAgentDisplayName(id)).join(", ");
97
- throw new Error(`${names}: plugins are user-level. Pass --global. Without --global: ${pluginsInstallableAgents("project").join(", ")}`);
98
- }
99
- throw new Error(`None of the selected agents can install plugins. Supported agents: ${available.join(", ")}`);
100
- }
87
+ if (agents.length === 0) throw new Error(`None of the selected agents can install plugins. Supported agents: ${available.join(", ")}`);
101
88
  return {
102
- scope,
103
89
  agents,
104
90
  skipped,
105
- userScopeSkipped,
106
91
  unusableCommands,
107
- targets: mappedPluginsTargets(agents, scope)
92
+ targets: mappedPluginsTargets(agents)
108
93
  };
109
94
  }
110
95
  export { assertPluginsCanRun, resolvePluginsPlan, unusablePluginsCommandsError };
@@ -14,25 +14,28 @@ const PLUGIN_SKILLS = [
14
14
  "neon-realtime"
15
15
  ];
16
16
  const PLUGINS_CLI_TIMEOUT_MS = 12e4;
17
- const pluginsScopeFlag = (global) => global ? "user" : "project";
17
+ /**
18
+ * Exact version so an upstream release cannot change install behavior under a shipped
19
+ * CLI. Bump it only with a green `e2e/plugins.e2e.test.ts` run.
20
+ */
21
+ const PLUGINS_CLI_VERSION = "1.3.6";
18
22
  const pluginsAddArgs = (options) => {
19
23
  if (options.target.length === 0) throw new Error("plugins add needs a -t target.");
20
24
  return [
21
25
  "-y",
22
- "plugins",
26
+ `plugins@${PLUGINS_CLI_VERSION}`,
23
27
  "add",
24
28
  PLUGIN_SOURCE,
25
29
  "-t",
26
30
  options.target,
27
31
  "-s",
28
- pluginsScopeFlag(options.global),
32
+ "user",
29
33
  "-y"
30
34
  ];
31
35
  };
32
36
  const neonPluginsRetryCommand = (options) => {
33
37
  const args = ["plugins"];
34
38
  for (const agent of options.agents) args.push("--agent", agent);
35
- if (options.global) args.push("--global");
36
39
  args.push("-y");
37
40
  return `neon ${args.map(quoteNpxArg).join(" ")}`;
38
41
  };
@@ -122,4 +125,4 @@ const killProcessTree = (pid) => {
122
125
  };
123
126
  const isCommandMissing = (error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
124
127
  const isExecaFailure = (error) => typeof error === "object" && error !== null && "shortMessage" in error && typeof error.shortMessage === "string";
125
- export { NEON_PLUGIN_NAME, PLUGINS_CLI_TIMEOUT_MS, PLUGIN_SKILLS, PLUGIN_SOURCE, neonPluginsRetryCommand, pluginsAddArgs, pluginsCliFailureMessage, pluginsScopeFlag, quoteNpxArg, runPluginsCli };
128
+ export { NEON_PLUGIN_NAME, PLUGINS_CLI_TIMEOUT_MS, PLUGINS_CLI_VERSION, PLUGIN_SKILLS, PLUGIN_SOURCE, neonPluginsRetryCommand, pluginsAddArgs, pluginsCliFailureMessage, quoteNpxArg, runPluginsCli };
@@ -32,7 +32,11 @@ const PLUGINS_TARGET_BY_TYPE = {
32
32
  "kimi-code": { target: "kimi" }
33
33
  };
34
34
  const pluginsTargets = () => [...new Set(Object.values(PLUGINS_TARGET_BY_TYPE))];
35
- const USER_SCOPE_ONLY_TARGETS = /* @__PURE__ */ new Set([
35
+ /**
36
+ * Agents whose own plugin system is user-level only. `neon bootstrap` sets them up with
37
+ * project-local skills and MCP instead of the plugin.
38
+ */
39
+ const BOOTSTRAP_SKILLS_MCP_TARGETS = /* @__PURE__ */ new Set([
36
40
  "vscode",
37
41
  "github-copilot",
38
42
  "grok",
@@ -184,30 +188,19 @@ function getPluginsTargetName(agent) {
184
188
  function supportsPlugins(agent) {
185
189
  return getPluginsTargetName(agent) !== void 0;
186
190
  }
187
- function isUserScopeOnlyPluginsTarget(target) {
188
- return USER_SCOPE_ONLY_TARGETS.has(target);
189
- }
190
- const pluginsMappedAgents = () => listMcpAgentIds().filter((id) => supportsPlugins(id));
191
- const pluginsInstallableAgents = (scope) => pluginsMappedAgents().filter((id) => {
192
- if (scope === "global") return true;
191
+ const pluginsInstallableAgents = () => listMcpAgentIds().filter((id) => supportsPlugins(id));
192
+ const bootstrapPluginAgents = () => pluginsInstallableAgents().filter((id) => {
193
193
  const target = getPluginsTargetName(id);
194
- return target !== void 0 && !isUserScopeOnlyPluginsTarget(target);
194
+ return target !== void 0 && !BOOTSTRAP_SKILLS_MCP_TARGETS.has(target);
195
195
  });
196
- const detectPluginsAgents = async (options) => {
197
- const detected = options.scope === "project" ? detectProjectAgents(options.cwd) : await (options.detectInstalledAgents ?? detectInstalledAgents)();
198
- return uniqueAgentIds(detected).filter((id) => supportsPlugins(id));
199
- };
200
- const detectInstallablePluginsAgents = async (options) => {
201
- const installable = new Set(pluginsInstallableAgents(options.scope));
202
- return (await detectPluginsAgents(options)).filter((id) => installable.has(id));
203
- };
204
- const mappedPluginsTargets = (agents, scope) => {
196
+ const detectProjectPluginsAgents = (cwd) => uniqueAgentIds(detectProjectAgents(cwd)).filter((id) => supportsPlugins(id));
197
+ const detectInstalledPluginsAgents = async (detect = detectInstalledAgents) => uniqueAgentIds(await detect()).filter((id) => supportsPlugins(id));
198
+ const mappedPluginsTargets = (agents) => {
205
199
  const mapped = [];
206
200
  const byTarget = /* @__PURE__ */ new Map();
207
201
  for (const agent of agents) {
208
202
  const target = getPluginsTargetName(agent);
209
203
  if (target === void 0) continue;
210
- if (scope === "project" && isUserScopeOnlyPluginsTarget(target)) continue;
211
204
  const existing = byTarget.get(target);
212
205
  if (existing !== void 0) {
213
206
  if (!existing.agents.includes(agent)) existing.agents.push(agent);
@@ -220,7 +213,7 @@ const mappedPluginsTargets = (agents, scope) => {
220
213
  byTarget.set(target, row);
221
214
  mapped.push(row);
222
215
  }
223
- if (mapped.length === 0) throw new Error(`None of the selected agents can install plugins. Supported agents: ${pluginsInstallableAgents(scope).join(", ")}`);
216
+ if (mapped.length === 0) throw new Error(`None of the selected agents can install plugins. Supported agents: ${pluginsInstallableAgents().join(", ")}`);
224
217
  return mapped;
225
218
  };
226
- export { detectInstallablePluginsAgents, detectPluginsAgents, getPluginsTargetName, isUserScopeOnlyPluginsTarget, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsInstallableAgents, pluginsMappedAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
219
+ export { bootstrapPluginAgents, detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsInstallableAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
@@ -1,6 +1,7 @@
1
1
  import { log } from "../log.js";
2
2
  import { existsSync, realpathSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
+ import { stripVTControlCharacters } from "node:util";
4
5
  import { spawn, spawnSync } from "node:child_process";
5
6
  import which from "which";
6
7
  // src/utils/package_manager.ts
@@ -328,20 +329,138 @@ const commandEnv = (overlay, base = process.env) => {
328
329
  * exited cleanly; a non-zero exit is reported but never throws — the caller
329
330
  * decides whether to treat it as fatal.
330
331
  */
331
- const runCommand = (cmd, args, cwd, env) => new Promise((resolvePromise) => {
332
+ const runCommand = (cmd, args, cwd, env) => runCommandWithDetail(cmd, args, cwd, env).then((result) => result.ok);
333
+ const PACKAGE_MANAGER_ERROR_LINES = [{
334
+ pattern: /^npm (?:ERR!|error) code (\S+)$/gm,
335
+ known: /* @__PURE__ */ new Set([
336
+ "CERT_HAS_EXPIRED",
337
+ "E401",
338
+ "E403",
339
+ "E404",
340
+ "E500",
341
+ "E502",
342
+ "E503",
343
+ "EACCES",
344
+ "EAI_AGAIN",
345
+ "EBADENGINE",
346
+ "EBADPLATFORM",
347
+ "ECONNREFUSED",
348
+ "ECONNRESET",
349
+ "EEXIST",
350
+ "EINTEGRITY",
351
+ "EJSONPARSE",
352
+ "ENOENT",
353
+ "ENOSPC",
354
+ "ENOTEMPTY",
355
+ "ENOTFOUND",
356
+ "ENOTSUP",
357
+ "ENOWORKSPACES",
358
+ "EOVERRIDE",
359
+ "EPERM",
360
+ "ERESOLVE",
361
+ "ERR_SOCKET_TIMEOUT",
362
+ "ETARGET",
363
+ "ETIMEDOUT",
364
+ "EUNSUPPORTEDPROTOCOL",
365
+ "SELF_SIGNED_CERT_IN_CHAIN",
366
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY"
367
+ ])
368
+ }, {
369
+ pattern: /^\s*(ERR_PNPM_[A-Z0-9_]+)\b/gm,
370
+ known: /* @__PURE__ */ new Set([
371
+ "ERR_PNPM_ADDING_TO_ROOT",
372
+ "ERR_PNPM_BAD_PM_VERSION",
373
+ "ERR_PNPM_EACCES",
374
+ "ERR_PNPM_ENOENT",
375
+ "ERR_PNPM_EPERM",
376
+ "ERR_PNPM_FETCH_401",
377
+ "ERR_PNPM_FETCH_403",
378
+ "ERR_PNPM_FETCH_404",
379
+ "ERR_PNPM_IGNORED_BUILDS",
380
+ "ERR_PNPM_LOCKFILE_BREAKING_CHANGE",
381
+ "ERR_PNPM_META_FETCH_FAIL",
382
+ "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
383
+ "ERR_PNPM_NO_MATCHING_VERSION",
384
+ "ERR_PNPM_NO_OFFLINE_META",
385
+ "ERR_PNPM_NO_OFFLINE_TARBALL",
386
+ "ERR_PNPM_OUTDATED_LOCKFILE",
387
+ "ERR_PNPM_PEER_DEP_ISSUES",
388
+ "ERR_PNPM_TARBALL_INTEGRITY",
389
+ "ERR_PNPM_UNSUPPORTED_ENGINE",
390
+ "ERR_PNPM_WORKSPACE_PKG_NOT_FOUND"
391
+ ])
392
+ }];
393
+ /** The most specific failure code available, without any of the child's free-form output. */
394
+ const installFailureDetail = (input) => {
395
+ if (input.spawnErrorCode !== void 0) return input.spawnErrorCode;
396
+ const output = stripVTControlCharacters(input.output);
397
+ for (const { pattern, known } of PACKAGE_MANAGER_ERROR_LINES) for (const match of output.matchAll(pattern)) {
398
+ const code = match[1];
399
+ if (code !== void 0 && known.has(code)) return code;
400
+ }
401
+ return input.exitCode === null ? "killed" : `exit code ${input.exitCode}`;
402
+ };
403
+ /**
404
+ * {@link runCommand} that also says why the command failed. Each of stdout and stderr that is
405
+ * not a terminal is piped, copied to ours as it arrives, and scanned for the package manager's
406
+ * error code (pnpm prints its code on stdout). A terminal stream stays inherited, so prompts
407
+ * and colors are unchanged.
408
+ */
409
+ const runCommandWithDetail = (cmd, args, cwd, env) => new Promise((resolvePromise) => {
410
+ const pipeUnlessTerminal = (stream) => stream.isTTY === true ? "inherit" : "pipe";
332
411
  const child = spawn(cmd, args, {
333
412
  cwd,
334
- stdio: "inherit",
413
+ stdio: [
414
+ "inherit",
415
+ pipeUnlessTerminal(process.stdout),
416
+ pipeUnlessTerminal(process.stderr)
417
+ ],
335
418
  shell: process.platform === "win32",
336
419
  env: commandEnv(env)
337
420
  });
421
+ let output = "";
422
+ const forward = (source, target) => {
423
+ source.on("data", (chunk) => {
424
+ output = (output + chunk.toString("utf8")).slice(-65536);
425
+ if (!target.write(chunk)) {
426
+ source.pause();
427
+ target.once("drain", () => source.resume());
428
+ }
429
+ });
430
+ };
431
+ if (child.stdout) forward(child.stdout, process.stdout);
432
+ if (child.stderr) forward(child.stderr, process.stderr);
433
+ const flushed = (stream) => new Promise((resolveFlush) => stream.write("", () => resolveFlush()));
434
+ let settled = false;
435
+ const settle = (result) => {
436
+ if (settled) return;
437
+ settled = true;
438
+ Promise.all([flushed(process.stdout), flushed(process.stderr)]).then(() => resolvePromise(result));
439
+ };
338
440
  child.on("error", (err) => {
339
- log.warning("Could not run `%s %s`: %s", cmd, args.join(" "), err instanceof Error ? err.message : String(err));
340
- resolvePromise(false);
441
+ log.warning("Could not run `%s %s`: %s", cmd, args.join(" "), err.message);
442
+ settle({
443
+ ok: false,
444
+ detail: installFailureDetail({
445
+ spawnErrorCode: "code" in err && typeof err.code === "string" ? `spawn ${err.code}` : "spawn failed",
446
+ exitCode: null,
447
+ output
448
+ })
449
+ });
341
450
  });
342
451
  child.on("close", (code) => {
343
- if (code !== 0) log.warning("`%s %s` exited with code %d.", cmd, args.join(" "), code);
344
- resolvePromise(code === 0);
452
+ if (code === 0) {
453
+ settle({ ok: true });
454
+ return;
455
+ }
456
+ log.warning("`%s %s` exited with code %d.", cmd, args.join(" "), code);
457
+ settle({
458
+ ok: false,
459
+ detail: installFailureDetail({
460
+ exitCode: code,
461
+ output
462
+ })
463
+ });
345
464
  });
346
465
  });
347
- export { DO_NOT_SUBSTITUTE_HINT, MISSING_BINARY_HINT, commandEnv, detectCliInstallMethod, detectInvokingPackageManager, detectProjectPackageManager, formatExecCommand, formatInstallCommand, globalInstallCommand, inferPackageManager, installArgs, installedPackageManagers, recommendedCliUpgradeCommand, resolveInvokingPackageManager, resolvePackageManager, runCommand };
466
+ export { DO_NOT_SUBSTITUTE_HINT, MISSING_BINARY_HINT, commandEnv, detectCliInstallMethod, detectInvokingPackageManager, detectProjectPackageManager, formatExecCommand, formatInstallCommand, globalInstallCommand, inferPackageManager, installArgs, installFailureDetail, installedPackageManagers, recommendedCliUpgradeCommand, resolveInvokingPackageManager, resolvePackageManager, runCommand, runCommandWithDetail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "8.23.1",
3
+ "version": "8.23.3",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -74,9 +74,9 @@
74
74
  "yargs": "17.7.2",
75
75
  "yoctocolors": "^2.1.2",
76
76
  "@neon/config-runtime": "1.11.7",
77
- "@neon/realtime": "0.2.0",
77
+ "@neon/config": "1.11.3",
78
78
  "@neon/sdk": "7.10.0",
79
- "@neon/config": "1.11.3"
79
+ "@neon/realtime": "0.2.0"
80
80
  },
81
81
  "optionalDependencies": {
82
82
  "@napi-rs/keyring": "1.3.0",
@@ -114,9 +114,9 @@
114
114
  "vitest": "^3.0.9",
115
115
  "@neon-internals/cli-core": "0.0.0",
116
116
  "@neon-internals/env-core": "0.0.45",
117
+ "@neon/functions": "0.11.0",
117
118
  "@neon/env": "1.6.15",
118
- "@neon/e2e-harness": "0.0.0",
119
- "@neon/functions": "0.11.0"
119
+ "@neon/e2e-harness": "0.0.0"
120
120
  },
121
121
  "publishConfig": {
122
122
  "access": "public",
@@ -7,9 +7,9 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
7
7
  import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
8
8
  import { t as NEON_ENV_VAR_KEYS, u as isFunctionBaseUrlKey } from "./env-JgoSsmyt.js";
9
9
  import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
10
+ import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
10
11
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
11
12
  import { warnAiGateway } from "../utils/ai_gateway_notice.js";
12
- import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
13
13
  import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
14
14
  import { existsSync } from "node:fs";
15
15
  import chalk from "chalk";