neon 8.23.2 → 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.
@@ -11,9 +11,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
11
11
  import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
12
12
  import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
13
13
  import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
14
- import { n as autoPullEnvAfterPin } from "./env-BtG4vH55.js";
15
- import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-CgtJH8xE.js";
16
- import { i as handler$1 } from "./link-CNO-HxHN.js";
14
+ import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
15
+ import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-DZ3cDaOS.js";
16
+ import { i as handler$1 } from "./link-VYCSKqU-.js";
17
17
  import chalk from "chalk";
18
18
  import prompts from "prompts";
19
19
  // src/commands/checkout.ts
@@ -12,7 +12,7 @@ import { projectConfigPath } from "../project.js";
12
12
  import { resolveEnvFilePath } from "../env_file.js";
13
13
  import { writer } from "../writer.js";
14
14
  import { noPassthrough } from "../utils/flags.js";
15
- import { c as pull } from "./env-BtG4vH55.js";
15
+ import { c as pull } from "./env-BOt9AZ1j.js";
16
16
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
17
17
  import open from "open";
18
18
  import prompts from "prompts";
@@ -5,6 +5,7 @@ import { getApiClient } from "../api.js";
5
5
  import { r as defaultDir } from "./paths-B55ZfOg1.js";
6
6
  import "../config.js";
7
7
  import { contextBranch, ensureDirectoryGitignored, readContextFile } from "../context.js";
8
+ import { DetailedError } from "../errors.js";
8
9
  import { getCliName } from "../utils/cli_name.js";
9
10
  import { l as existingApiClient } from "./auth-rup6nemJ.js";
10
11
  import { NEON_SERVICES, NEON_SERVICE_LABELS, deprecatedServiceMessage, servicesFlagValue, servicesOption } from "../neon_services.js";
@@ -14,7 +15,7 @@ import { toNeonConfigView } from "../config_format.js";
14
15
  import { declaredNeonServices } from "../config_services.js";
15
16
  import { loadProjectConfig, neonConfigFilename, projectConfigPath, projectDir } from "../project.js";
16
17
  import { loadEnvFileIntoProcess } from "../env_file.js";
17
- import { formatInstallCommand, installArgs, resolvePackageManager, runCommand } from "../utils/package_manager.js";
18
+ import { formatInstallCommand, installArgs, resolvePackageManager, runCommandWithDetail } from "../utils/package_manager.js";
18
19
  import { writer } from "../writer.js";
19
20
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
20
21
  import { assertAiGatewayProvisionable, warnAiGateway } from "../utils/ai_gateway_notice.js";
@@ -26,7 +27,7 @@ import { readGitContext } from "../utils/git.js";
26
27
  import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
27
28
  import { pickServicesInteractively } from "../utils/service_picker.js";
28
29
  import { zipBundle } from "../utils/zip.js";
29
- import { n as autoPullEnvAfterPin } from "./env-BtG4vH55.js";
30
+ import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
30
31
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
31
32
  import { dirname, join, relative, resolve } from "node:path";
32
33
  import chalk from "chalk";
@@ -128,9 +129,9 @@ const DEPENDENCY_FIELDS = [
128
129
  "peerDependencies",
129
130
  "optionalDependencies"
130
131
  ];
131
- var ConfigInstallFailed = class extends Error {
132
- constructor(command) {
133
- super("Could not install the Neon dependencies.");
132
+ var ConfigInstallFailed = class extends DetailedError {
133
+ constructor(command, pm, detail) {
134
+ super(`Could not install the Neon dependencies with ${pm} (${detail}).`, detail);
134
135
  this.name = "ConfigInstallFailed";
135
136
  this.command = command;
136
137
  }
@@ -268,7 +269,7 @@ const installCommandFrom = (dir, pm, missing, options) => {
268
269
  };
269
270
  /** Install the config packages the project is missing, or say how to. */
270
271
  const ensureConfigPackages = async (cwd, props) => {
271
- const run = props.run ?? runCommand;
272
+ const run = props.run ?? runCommandWithDetail;
272
273
  const missing = missingDependencies(cwd);
273
274
  if (missing.length === 0) {
274
275
  if (!props.silent) log.info("%s are already installed.", REQUIRED_PACKAGES.join(" and "));
@@ -288,9 +289,10 @@ const ensureConfigPackages = async (cwd, props) => {
288
289
  }
289
290
  ensureDirectoryGitignored(join(cwd, "node_modules"));
290
291
  if (!props.silent) log.info("Installing %s with %s…", missing.join(", "), pm);
291
- if (!await run(pm, args, cwd)) {
292
- if (props.requireInstall) throw new ConfigInstallFailed(installHint);
293
- log.warning("Could not install the config packages automatically. Run by hand: %s", installHint);
292
+ const result = await run(pm, args, cwd);
293
+ if (!result.ok) {
294
+ if (props.requireInstall) throw new ConfigInstallFailed(installHint, pm, result.detail);
295
+ log.warning("Could not install the config packages automatically with %s (%s). Run by hand: %s", pm, result.detail, installHint);
294
296
  }
295
297
  };
296
298
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { fillSingleProject } from "../utils/enrichers.js";
3
- import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-CgtJH8xE.js";
3
+ import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-DZ3cDaOS.js";
4
4
  import { DEPLOY_COMMANDS_EPILOGUE } from "../commands/deploy_help.js";
5
5
  // src/commands/deploy.ts
6
6
  var deploy_exports = /* @__PURE__ */ __exportAll({
@@ -4,12 +4,12 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
4
4
  import { getCliName } from "../utils/cli_name.js";
5
5
  import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
6
6
  import { l as functionBaseUrlKey } from "./env-JgoSsmyt.js";
7
- import { branchIdResolve } from "../utils/enrichers.js";
8
- import { bundleEntry } from "../utils/esbuild.js";
9
7
  import { a as resolveDevEnv } from "./env-CIFMBEon.js";
10
- import { f as envFlag } from "./config-CgtJH8xE.js";
11
8
  import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
12
9
  import { resolveWatchInputs } from "../dev/inputs.js";
10
+ import { branchIdResolve } from "../utils/enrichers.js";
11
+ import { bundleEntry } from "../utils/esbuild.js";
12
+ import { f as envFlag } from "./config-DZ3cDaOS.js";
13
13
  import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
14
14
  import { basename, dirname, join, relative, resolve } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
5
5
  import { writer } from "../writer.js";
6
6
  import { neonSafeBranchName } from "../utils/branch_name.js";
7
7
  import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
8
- import { o as quoteFlagValue } from "./link-CNO-HxHN.js";
9
- import { o as handler$1 } from "./checkout-CNBIS3gA.js";
8
+ import { o as quoteFlagValue } from "./link-VYCSKqU-.js";
9
+ import { o as handler$1 } from "./checkout-Bsfl-B0h.js";
10
10
  import { existsSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import chalk from "chalk";
@@ -13,8 +13,8 @@ import { writer } from "../writer.js";
13
13
  import { createBranch, pickBranchInteractively } from "../utils/branch_picker.js";
14
14
  import { looksLikeBranchId } from "../utils/formats.js";
15
15
  import { listAllProjectBranches } from "../utils/enrichers.js";
16
- import { n as autoPullEnvAfterPin } from "./env-BtG4vH55.js";
17
- import { h as initCmd } from "./config-CgtJH8xE.js";
16
+ import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
17
+ import { h as initCmd } from "./config-DZ3cDaOS.js";
18
18
  import { formatLinkSummary } from "../commands/link_output.js";
19
19
  import { r as REGIONS } from "./projects-a3X4OFEJ.js";
20
20
  import prompts from "prompts";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { fillSingleProject } from "../utils/enrichers.js";
3
- import { y as status } from "./config-CgtJH8xE.js";
3
+ import { y as status } from "./config-DZ3cDaOS.js";
4
4
  // src/commands/status.ts
5
5
  var status_exports = /* @__PURE__ */ __exportAll({
6
6
  builder: () => builder,
@@ -1 +1 @@
1
- export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CNBIS3gA.js";
1
+ export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-Bsfl-B0h.js";
@@ -1 +1 @@
1
- export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-DhV0f_5o.js";
1
+ export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-B3tMeMuo.js";
@@ -1 +1 @@
1
- export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-CgtJH8xE.js";
1
+ export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-DZ3cDaOS.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-Bs5gmi4Q.js";
1
+ export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CF4PxuNX.js";
@@ -1 +1 @@
1
- export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-DxiIp4c9.js";
1
+ export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-BnHQENZM.js";
@@ -1 +1 @@
1
- export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-BtG4vH55.js";
1
+ export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-BOt9AZ1j.js";
@@ -3,12 +3,12 @@ import { log } from "../log.js";
3
3
  import { getCliName } from "../utils/cli_name.js";
4
4
  import { projectConfigPath, projectDir } from "../project.js";
5
5
  import { resolveEnvFilePath } from "../env_file.js";
6
- import { installArgs, resolvePackageManager, runCommand } from "../utils/package_manager.js";
6
+ import { installArgs, resolvePackageManager, runCommandWithDetail } from "../utils/package_manager.js";
7
7
  import { writer } from "../writer.js";
8
8
  import { formatInitDone, printInitDone } from "../init/chrome.js";
9
9
  import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
10
10
  import { displayPath } from "./env_output.js";
11
- import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-CgtJH8xE.js";
11
+ import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-DZ3cDaOS.js";
12
12
  import { recommendedOperations } from "../functions/registry.js";
13
13
  import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
14
14
  import { describeRegistrySource, openRegistry } from "../functions/source.js";
@@ -143,7 +143,7 @@ const scaffoldFromTemplate = async (options) => {
143
143
  });
144
144
  let installed = false;
145
145
  if (install && dependencies.length > 0) {
146
- installed = await (options.run ?? runCommand)(pm, installArgs(pm, dependencies, { exact: true }), projectRoot);
146
+ installed = (await (options.run ?? runCommandWithDetail)(pm, installArgs(pm, dependencies, { exact: true }), projectRoot)).ok;
147
147
  if (!installed) log.warning("Could not install %s. Run by hand: `%s`", dependencies.join(", "), installHint(dependencies, true));
148
148
  }
149
149
  const cli = getCliName();
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-DRUZBCmZ.js";
1
+ export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-CRYW7ku0.js";
@@ -2,29 +2,29 @@ import { r as auth_exports } from "../_chunks/auth-rup6nemJ.js";
2
2
  import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
3
3
  import { n as api_keys_exports } from "../_chunks/api_keys-CTFHd5m_.js";
4
4
  import { n as ask_exports } from "../_chunks/ask-Xlek1Pxh.js";
5
- import { o as env_exports } from "../_chunks/env-BtG4vH55.js";
6
- import { c as config_exports } from "../_chunks/config-CgtJH8xE.js";
5
+ import { o as env_exports } from "../_chunks/env-BOt9AZ1j.js";
6
+ import { c as config_exports } from "../_chunks/config-DZ3cDaOS.js";
7
7
  import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
8
- import { a as link_exports } from "../_chunks/link-CNO-HxHN.js";
8
+ import { a as link_exports } from "../_chunks/link-VYCSKqU-.js";
9
9
  import { o as mcp_exports } from "../_chunks/mcp-SvqWzHnT.js";
10
10
  import { c as plugins_exports } from "../_chunks/plugins-BwUZQ6Ic.js";
11
11
  import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
12
12
  import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
13
13
  import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
14
14
  import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
15
- import { n as checkout_exports } from "../_chunks/checkout-CNBIS3gA.js";
16
- import { o as claim_exports } from "../_chunks/claim-DhV0f_5o.js";
15
+ import { n as checkout_exports } from "../_chunks/checkout-Bsfl-B0h.js";
16
+ import { o as claim_exports } from "../_chunks/claim-B3tMeMuo.js";
17
17
  import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
18
18
  import { a as credentials_exports } from "../_chunks/credentials-BMBNmW0t.js";
19
19
  import { r as data_api_exports } from "../_chunks/data_api-CHDwvMTG.js";
20
20
  import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
21
- import { r as deploy_exports } from "../_chunks/deploy-Bs5gmi4Q.js";
22
- import { s as dev_exports } from "../_chunks/dev-DxiIp4c9.js";
21
+ import { r as deploy_exports } from "../_chunks/deploy-CF4PxuNX.js";
22
+ import { s as dev_exports } from "../_chunks/dev-BnHQENZM.js";
23
23
  import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
24
24
  import { c as docs_exports } from "../_chunks/docs-BpLiSTmm.js";
25
25
  import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
26
26
  import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
27
- import { o as git_exports } from "../_chunks/git-DRUZBCmZ.js";
27
+ import { o as git_exports } from "../_chunks/git-CRYW7ku0.js";
28
28
  import { a as init_exports } from "../_chunks/init-D2fClHtC.js";
29
29
  import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
30
30
  import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
@@ -40,7 +40,7 @@ import { o as profile_exports } from "../_chunks/profile-CArcjyS4.js";
40
40
  import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
41
41
  import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
42
42
  import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
43
- import { a as status_exports } from "../_chunks/status-BlrzeKyA.js";
43
+ import { a as status_exports } from "../_chunks/status-rt-0bUaQ.js";
44
44
  import { d as triggers_exports } from "../_chunks/triggers-BfvyeJUC.js";
45
45
  import { s as user_exports } from "../_chunks/user-D9mC430O.js";
46
46
  import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-CNO-HxHN.js";
1
+ export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-VYCSKqU-.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-BlrzeKyA.js";
1
+ export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-rt-0bUaQ.js";
@@ -1,6 +1,6 @@
1
1
  import { writer } from "../writer.js";
2
- import { branchIdFromProps } from "../utils/enrichers.js";
3
2
  import { o as resolveNeonEnvVars } from "../_chunks/env-CIFMBEon.js";
3
+ import { branchIdFromProps } from "../utils/enrichers.js";
4
4
  import YAML from "yaml";
5
5
  // src/commands/subscribe.ts
6
6
  const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
package/dist/errors.js CHANGED
@@ -1,9 +1,25 @@
1
1
  // src/errors.ts
2
+ /** An error whose cause is known as a bounded code (`ERESOLVE`, `ENOENT`, `exit code 1`). */
3
+ var DetailedError = class extends Error {
4
+ constructor(message, detail) {
5
+ super(message);
6
+ this.detail = detail;
7
+ }
8
+ };
2
9
  const ERROR_MATCHERS = [
3
10
  [/^Unknown command: (.*)$/, "UNKNOWN_COMMAND"],
4
11
  [/^Missing required argument: (.*)$/, "MISSING_ARGUMENT"],
5
12
  [/^Failed to open web browser. (.*)$/, "AUTH_BROWSER_FAILED"],
6
- [/^Setup did not finish\.$/, "NEON_INIT_FAILED"]
13
+ [/^Setup did not finish\.$/, "NEON_INIT_FAILED"],
14
+ [/^No interactive terminal\./, "NON_INTERACTIVE"],
15
+ [/^Authentication timed out after /, "AUTH_TIMEOUT"],
16
+ [/^neon skills needs Node\.js /, "NODE_VERSION_UNSUPPORTED"],
17
+ [/needs npx \(Node\.js\)/, "NPX_NOT_FOUND"],
18
+ [/spawn git ENOENT/, "GIT_NOT_FOUND"],
19
+ [/^(Failed to install Neon agent skills|skills CLI failed)/, "SKILLS_CLI_FAILED"],
20
+ [/^Cannot install the Neon plugin for /, "AGENT_COMMAND_UNAVAILABLE"],
21
+ [/^(Failed to install the Neon plugin for: |plugins CLI (failed|timed out))/, "PLUGINS_CLI_FAILED"],
22
+ [/^Could not install the Neon dependencies/, "DEPENDENCY_INSTALL_FAILED"]
7
23
  ];
8
24
  const matchErrorCode = (message) => {
9
25
  if (!message) return "UNKNOWN_ERROR";
@@ -72,4 +88,4 @@ const isNetworkError = (err) => {
72
88
  }
73
89
  return false;
74
90
  };
75
- export { NETWORK_ERROR_MESSAGE, isNetworkError, isUnexpectedError, matchErrorCode };
91
+ export { DetailedError, NETWORK_ERROR_MESSAGE, isNetworkError, isUnexpectedError, matchErrorCode };
package/dist/init/auth.js CHANGED
@@ -4,7 +4,7 @@ import "../config.js";
4
4
  import "../auth.js";
5
5
  import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-rup6nemJ.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { c as pull } from "../_chunks/env-BtG4vH55.js";
7
+ import { c as pull } from "../_chunks/env-BOt9AZ1j.js";
8
8
  import { c as setupNeonMcp } from "../_chunks/mcp-SvqWzHnT.js";
9
9
  // src/init/auth.ts
10
10
  const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
package/dist/init/copy.js CHANGED
@@ -136,9 +136,9 @@ const claimableThenServicesNext = (expiresAt) => [
136
136
  "Refresh local environment variables:",
137
137
  `${getCliName()} env pull`
138
138
  ];
139
- const installFailedNext = (command, envPull) => ({
139
+ const installFailedNext = (command, envPull, reason) => ({
140
140
  heading: HEADING_FAILED,
141
- body: "Could not install the Neon dependencies.",
141
+ body: reason,
142
142
  next: [
143
143
  "Install the dependencies, then run neon init again:",
144
144
  command,
@@ -4,7 +4,7 @@ import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
4
4
  import { recoverFrom401 } from "../auth_recovery.js";
5
5
  import { loadProjectConfig } from "../project.js";
6
6
  import { loadEnvFileIntoProcess } from "../env_file.js";
7
- import { r as applyCmd } from "../_chunks/config-CgtJH8xE.js";
7
+ import { r as applyCmd } from "../_chunks/config-DZ3cDaOS.js";
8
8
  import { authContext } from "./auth.js";
9
9
  import { existsSync } from "node:fs";
10
10
  // src/init/deploy.ts
@@ -1,6 +1,6 @@
1
1
  import pkg_default from "../pkg.js";
2
2
  import { codeFromBody, isNeonApiError } from "../api.js";
3
- import { isNetworkError, matchErrorCode } from "../errors.js";
3
+ import { DetailedError, isNetworkError, matchErrorCode } from "../errors.js";
4
4
  import { redactCredentialTokenIds, trackEvent } from "../analytics.js";
5
5
  import { AuthRefreshError } from "../auth.js";
6
6
  import { randomUUID } from "node:crypto";
@@ -110,6 +110,7 @@ const initEndProperties = (input) => {
110
110
  error_step: reported?.step ?? null,
111
111
  error_code: reported === void 0 ? null : initErrorCode(reported.error),
112
112
  error_message: reported === void 0 ? null : initErrorMessage(reported.error),
113
+ error_detail: reported?.error instanceof DetailedError ? reported.error.detail : null,
113
114
  error_steps: [...new Set(input.errors.map((entry) => entry.step))]
114
115
  };
115
116
  };
package/dist/init/link.js CHANGED
@@ -4,7 +4,7 @@ import "../config.js";
4
4
  import "../auth.js";
5
5
  import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { s as runLink } from "../_chunks/link-CNO-HxHN.js";
7
+ import { s as runLink } from "../_chunks/link-VYCSKqU-.js";
8
8
  // src/init/link.ts
9
9
  const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
10
10
  const authenticationFailed = () => /* @__PURE__ */ new Error("Authentication failed.");
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";
@@ -587,7 +587,7 @@ const runInit = async (props) => {
587
587
  });
588
588
  } catch (error) {
589
589
  if (error instanceof ConfigInstallFailed) {
590
- const failed = installFailedNext(error.command, linkDeferredPull);
590
+ const failed = installFailedNext(error.command, linkDeferredPull, error.message);
591
591
  printInitDone(formatInitDone({
592
592
  heading: failed.heading,
593
593
  body: failed.body,
@@ -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.2",
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,8 +114,8 @@
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/env": "1.6.15",
118
117
  "@neon/functions": "0.11.0",
118
+ "@neon/env": "1.6.15",
119
119
  "@neon/e2e-harness": "0.0.0"
120
120
  },
121
121
  "publishConfig": {
@@ -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";