neon 9.9.6 → 9.9.7

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.
@@ -1,5 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { codeFromBody, isNeonApiError } from "../api.js";
3
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
3
4
  import { writer } from "../writer.js";
4
5
  import { describeOperation, getEndpoints, loadSpec } from "../utils/openapi.js";
5
6
  import { readFileSync } from "node:fs";
@@ -47,7 +48,7 @@ function parseTypedValue(raw) {
47
48
  /** Split a `key=value` pair on the first `=`. */
48
49
  function parseKeyValue(input) {
49
50
  const eq = input.indexOf("=");
50
- if (eq === -1) throw new Error(`Invalid "key=value" pair: "${input}".`);
51
+ if (eq === -1) throw new Error(`Invalid "key=value" pair: ${REDACTED_INVALID_VALUE}.`);
51
52
  return {
52
53
  key: input.slice(0, eq),
53
54
  value: input.slice(eq + 1)
@@ -96,13 +97,20 @@ function parseHeaders(pairs) {
96
97
  const headers = {};
97
98
  for (const pair of pairs) {
98
99
  const idx = pair.indexOf(":");
99
- if (idx === -1) throw new Error(`Invalid header "${pair}". Expected "key:value".`);
100
- headers[pair.slice(0, idx).trim()] = pair.slice(idx + 1).trim();
100
+ if (idx === -1) throw new Error(`Invalid header ${REDACTED_INVALID_VALUE}. Expected "key:value".`);
101
+ const name = pair.slice(0, idx).trim();
102
+ const value = pair.slice(idx + 1).trim();
103
+ try {
104
+ new Headers().append(name, value);
105
+ } catch {
106
+ throw new Error(`Invalid header ${REDACTED_INVALID_VALUE}. Header names must be HTTP tokens and values cannot contain line breaks.`);
107
+ }
108
+ headers[name] = value;
101
109
  }
102
110
  return headers;
103
111
  }
104
112
  function assertMethod(method) {
105
- if (!HTTP_METHODS.includes(method)) throw new Error(`Unsupported method "${method}". Use one of: ${HTTP_METHODS.join(", ")}.`);
113
+ if (!HTTP_METHODS.includes(method)) throw new Error(`Unsupported method ${REDACTED_INVALID_VALUE}.${didYouMean([method], HTTP_METHODS)} Use one of: ${HTTP_METHODS.join(", ")}.`);
106
114
  }
107
115
  const JSON_TOKEN = /("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false)\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g;
108
116
  /** Color the tokens of serialized JSON without changing a byte of the text itself. */
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { isCi } from "../env.js";
3
3
  import { log } from "../log.js";
4
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
4
5
  import { recordCommandSuccessExtras, recordScaffoldedTemplate } from "../analytics.js";
5
6
  import { getCliName } from "../utils/cli_name.js";
6
7
  import { helpCsv, helpEpilogue } from "../utils/help_text.js";
@@ -137,7 +138,7 @@ const resolveTemplateList = async (props) => props.template && findTemplate(FALL
137
138
  const resolveSelectedTemplate = async (props, interactive, templates) => {
138
139
  if (props.template) {
139
140
  const template = findTemplate(templates, props.template);
140
- if (!template) throw new Error(`Unknown template "${props.template}". Available templates: ${templateIds(templates)}.`);
141
+ if (!template) throw new Error(`Unknown template ${REDACTED_INVALID_VALUE}.${didYouMean([props.template], templates.map((candidate) => candidate.id))} Available templates: ${templateIds(templates)}.`);
141
142
  return template;
142
143
  }
143
144
  if (props.default) {
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { log } from "../log.js";
3
3
  import { isNeonApiError, retryOnLock } from "../api.js";
4
+ import { REDACTED_INVALID_VALUE } from "../errors.js";
4
5
  import { getCliName } from "../utils/cli_name.js";
5
6
  import { deleteCustomDomain, listCustomDomains, registerCustomDomain } from "../custom_domains_api.js";
6
7
  import { createDeployment, deleteFunction, getFunction, listFunctions } from "../functions_api.js";
@@ -219,7 +220,7 @@ const parseEnv = (entries) => {
219
220
  const map = {};
220
221
  for (const entry of entries) {
221
222
  const eq = entry.indexOf("=");
222
- if (eq <= 0) throw new Error(`Invalid --env value "${entry}". Expected KEY=VALUE.`);
223
+ if (eq <= 0) throw new Error(`Invalid --env value ${REDACTED_INVALID_VALUE}. Expected KEY=VALUE.`);
223
224
  map[entry.slice(0, eq)] = entry.slice(eq + 1);
224
225
  }
225
226
  return JSON.stringify(map);
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { log } from "../log.js";
3
3
  import { codeFromBody, isNeonApiError, retryOnLock } from "../api.js";
4
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
4
5
  import { stripAnsi } from "../human_table.js";
5
6
  import { writer } from "../writer.js";
6
7
  import { noPassthrough, single } from "../utils/flags.js";
@@ -1356,8 +1357,8 @@ const pluginsGet = async (props) => {
1356
1357
  }));
1357
1358
  const plugin = data[props.pluginName];
1358
1359
  if (plugin === void 0) {
1359
- const available = Object.keys(data).join(", ");
1360
- throw new Error(`Unknown plugin "${props.pluginName}". Available plugins: ${available}`);
1360
+ const available = Object.keys(data);
1361
+ throw new Error(`Unknown plugin ${REDACTED_INVALID_VALUE}.${didYouMean([props.pluginName], available)} Available plugins: ${available.join(", ")}`);
1361
1362
  }
1362
1363
  if (props.output === "json" || props.output === "yaml") {
1363
1364
  const fields = typeof plugin === "object" && !Array.isArray(plugin) ? Object.keys(plugin) : [];
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
2
2
  import { log } from "../log.js";
3
3
  import { isNeonApiError, retryOnLock } from "../api.js";
4
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
4
5
  import { writer } from "../writer.js";
5
6
  import { looksLikeBranchId, looksLikeLSN, looksLikeSnapshotId, looksLikeTimestamp, toIso } from "../utils/formats.js";
6
7
  import { branchIdResolve, fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
@@ -300,7 +301,7 @@ const parseScheduleJson = (raw) => {
300
301
  const record = entry;
301
302
  const frequency = record.frequency;
302
303
  if (typeof frequency !== "string") throw new Error(`--schedule entry ${index} is missing a string "frequency".`);
303
- if (!isSnapshotFrequency(frequency)) throw new Error(`--schedule entry ${index} has an unsupported "frequency": "${frequency}". Use one of: ${SNAPSHOT_FREQUENCIES.join(", ")}.`);
304
+ if (!isSnapshotFrequency(frequency)) throw new Error(`--schedule entry ${index} has an unsupported "frequency": ${REDACTED_INVALID_VALUE}.${didYouMean([frequency], SNAPSHOT_FREQUENCIES)} Use one of: ${SNAPSHOT_FREQUENCIES.join(", ")}.`);
304
305
  const item = { frequency };
305
306
  for (const key of [
306
307
  "hour",
@@ -1 +1 @@
1
- export { n as buildBody, r as buildQuery, i as builder, a as colorizeJson, o as command, s as describe, c as handler, l as parseHeaders, u as parseKeyValue, d as parseTypedValue, f as setDeep } from "../_chunks/api-1MKsfpY3.js";
1
+ export { n as buildBody, r as buildQuery, i as builder, a as colorizeJson, o as command, s as describe, c as handler, l as parseHeaders, u as parseKeyValue, d as parseTypedValue, f as setDeep } from "../_chunks/api-BZh2r_lx.js";
@@ -1 +1 @@
1
- export { n as builder, r as command, i as describe, a as handler } from "../_chunks/bootstrap-B73qVB39.js";
1
+ export { n as builder, r as command, i as describe, a as handler } from "../_chunks/bootstrap-yotTpFtF.js";
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as command, i as deploymentPollDelay, a as describe, s as handler } from "../_chunks/functions-PHaU-kRb.js";
1
+ export { t as aliases, n as builder, r as command, i as deploymentPollDelay, a as describe, s as handler } from "../_chunks/functions-v9z7zjWD.js";
@@ -1,5 +1,6 @@
1
1
  import { isInteractiveTerminal } from "../env.js";
2
2
  import { log } from "../log.js";
3
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
3
4
  import { recordScaffoldedTemplate } from "../analytics.js";
4
5
  import { getCliName } from "../utils/cli_name.js";
5
6
  import { projectConfigPath, projectDir } from "../project.js";
@@ -51,7 +52,10 @@ const writeTemplates = (props, entries) => writer(props).end(entries.map((entry)
51
52
  const listTemplates = async (props) => {
52
53
  writeTemplates(props, (await openRegistry()).entries);
53
54
  };
54
- const unknownTemplate = (id, registry) => /* @__PURE__ */ new Error(`Unknown function template "${id}" in ${describeRegistrySources(registry.sources)}. Available templates: ${registry.entries.map((entry) => entry.id).join(", ")}.`);
55
+ const unknownTemplate = (id, registry) => {
56
+ const ids = registry.entries.map((entry) => entry.id);
57
+ return /* @__PURE__ */ new Error(`Unknown function template ${REDACTED_INVALID_VALUE} in ${describeRegistrySources(registry.sources)}.${didYouMean([id], ids)} Available templates: ${ids.join(", ")}.`);
58
+ };
55
59
  const pickOperations = async (operations, provider) => {
56
60
  const answer = await prompts({
57
61
  type: "multiselect",
@@ -1,5 +1,5 @@
1
1
  import { r as auth_exports } from "../_chunks/auth-CFa969Ck.js";
2
- import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
2
+ import { t as api_exports } from "../_chunks/api-BZh2r_lx.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
5
  import { o as env_exports } from "../_chunks/env-C3HQJO8Z.js";
@@ -9,7 +9,7 @@ import { a as link_exports } from "../_chunks/link-BVa6Nfji.js";
9
9
  import { o as mcp_exports } from "../_chunks/mcp-g8C-BZIb.js";
10
10
  import { c as plugins_exports } from "../_chunks/plugins-CEylQlgK.js";
11
11
  import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
12
- import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
12
+ import { t as bootstrap_exports } from "../_chunks/bootstrap-yotTpFtF.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
15
  import { n as checkout_exports } from "../_chunks/checkout-CczPpuT9.js";
@@ -23,14 +23,14 @@ import { s as dev_exports } from "../_chunks/dev-DVB7fGiG.js";
23
23
  import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
24
24
  import { c as docs_exports } from "../_chunks/docs-DjYRHjGY.js";
25
25
  import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
26
- import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
26
+ import { o as functions_exports } from "../_chunks/functions-v9z7zjWD.js";
27
27
  import { o as git_exports } from "../_chunks/git-BZY1WeAw.js";
28
28
  import { o as incidents_exports } from "../_chunks/incidents-BSFkUu1P.js";
29
29
  import { a as init_exports } from "../_chunks/init-BSwLzxjX.js";
30
30
  import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
31
31
  import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
32
32
  import { l as logs_exports } from "../_chunks/logs-CcVpwdDs.js";
33
- import { a as neon_auth_exports } from "../_chunks/neon_auth-mfyjde2x.js";
33
+ import { a as neon_auth_exports } from "../_chunks/neon_auth-DE6X6FFV.js";
34
34
  import { a as open_exports } from "../_chunks/open-T2nI89Oh.js";
35
35
  import { c as operations_exports } from "../_chunks/operations-D7qGkKo3.js";
36
36
  import { o as orgs_exports } from "../_chunks/orgs-BrvAWM8Z.js";
@@ -40,7 +40,7 @@ import { o as postgres_exports } from "../_chunks/postgres-BbEt_7c9.js";
40
40
  import { o as profile_exports } from "../_chunks/profile-DWyfpl03.js";
41
41
  import { s as realtime_exports } from "../_chunks/realtime-cV7-c2-O.js";
42
42
  import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
43
- import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
43
+ import { s as snapshots_exports } from "../_chunks/snapshots-BolN3uBz.js";
44
44
  import { a as status_exports } from "../_chunks/status-BBnw48qR.js";
45
45
  import { d as triggers_exports } from "../_chunks/triggers-m3IBjiph.js";
46
46
  import { s as user_exports } from "../_chunks/user-iNYSe0KI.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler } from "../_chunks/neon_auth-mfyjde2x.js";
1
+ export { t as builder, n as command, r as describe, i as handler } from "../_chunks/neon_auth-DE6X6FFV.js";
@@ -1 +1 @@
1
- export { t as SNAPSHOT_FIELDS, n as aliases, r as builder, i as command, a as describe, o as handler } from "../_chunks/snapshots-DxNhjcco.js";
1
+ export { t as SNAPSHOT_FIELDS, n as aliases, r as builder, i as command, a as describe, o as handler } from "../_chunks/snapshots-BolN3uBz.js";
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "./errors.js";
1
2
  import { NEON_SERVICES } from "./neon_services.js";
2
3
  import { n as NEON_ENV_VAR_KEYS } from "./_chunks/env-EJU-0InB.js";
3
4
  // src/env_services.ts
@@ -101,8 +102,7 @@ const parseEnvPullKeys = (raw, flag) => {
101
102
  const unknown = names.filter((name) => !ENV_PULL_KEYS.some((key) => key === name));
102
103
  if (unknown.length > 0) {
103
104
  const displayNames = unknown.map(redactUnknownEnvValue);
104
- const suggestions = [...new Set(unknown.map(suggestEnvPullKey).filter((key) => key !== null))];
105
- const suggestion = suggestions.length > 0 ? ` Did you mean ${suggestions.join(" or ")}?` : "";
105
+ const suggestion = didYouMean(unknown.filter((name) => !name.includes("=")), ENV_PULL_KEYS);
106
106
  throw new Error(`Unknown env variable${unknown.length === 1 ? "" : "s"} ${displayNames.join(", ")}.${suggestion} ${supported}`);
107
107
  }
108
108
  return ENV_PULL_KEYS.filter((key) => names.includes(key));
@@ -112,23 +112,9 @@ const redactUnknownEnvValue = (value) => {
112
112
  const separator = value.indexOf("=");
113
113
  if (separator !== -1) {
114
114
  const key = value.slice(0, separator);
115
- return isKnownEnvPullKey(key) ? `${key}=<redacted>` : "<redacted invalid value>";
115
+ return isKnownEnvPullKey(key) ? `${key}=<redacted>` : REDACTED_INVALID_VALUE;
116
116
  }
117
- return "<redacted invalid value>";
118
- };
119
- const suggestEnvPullKey = (value) => {
120
- if (value.includes("=")) return null;
121
- const closest = ENV_PULL_KEYS.map((key) => [key, editDistance(value, key)]).sort((a, b) => a[1] - b[1])[0];
122
- return closest && closest[1] <= 2 ? closest[0] : null;
123
- };
124
- const editDistance = (left, right) => {
125
- let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
126
- for (let leftIndex = 1; leftIndex <= left.length; leftIndex += 1) {
127
- const current = [leftIndex];
128
- for (let rightIndex = 1; rightIndex <= right.length; rightIndex += 1) current[rightIndex] = Math.min((previous[rightIndex] ?? 0) + 1, (current[rightIndex - 1] ?? 0) + 1, (previous[rightIndex - 1] ?? 0) + (left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1));
129
- previous = current;
130
- }
131
- return previous[right.length] ?? right.length;
117
+ return REDACTED_INVALID_VALUE;
132
118
  };
133
119
  /** Narrow yargs' array option value without accepting any other runtime shape. */
134
120
  const envPullFlagValue = (value) => Array.isArray(value) ? value.map(String) : void 0;
package/dist/errors.js CHANGED
@@ -96,4 +96,31 @@ const isNetworkError = (err) => {
96
96
  }
97
97
  return false;
98
98
  };
99
- export { DetailedError, NETWORK_ERROR_MESSAGE, ProjectNotLinkedError, isNetworkError, isUnexpectedError, matchErrorCode };
99
+ /**
100
+ * Stands in for a flag value the CLI rejected. Error messages are sent as `CLI Error`
101
+ * telemetry, and a value typed into the wrong flag is sometimes a pasted secret, so an error
102
+ * names only values it can vouch for (a valid choice, a key it knows) and replaces the rest.
103
+ */
104
+ const REDACTED_INVALID_VALUE = "<redacted invalid value>";
105
+ /**
106
+ * ` Did you mean x?` for rejected values within two edits of a valid choice, else `""`. The
107
+ * error cannot show what was typed, so a near miss is named by the choice it was close to.
108
+ */
109
+ const didYouMean = (rejected, choices) => {
110
+ const suggestions = [...new Set(rejected.map((value) => closestChoice(value, choices)).filter((choice) => choice !== void 0))];
111
+ return suggestions.length > 0 ? ` Did you mean ${suggestions.join(" or ")}?` : "";
112
+ };
113
+ const closestChoice = (value, choices) => {
114
+ const closest = choices.map((choice) => [choice, editDistance(value, choice)]).sort((a, b) => a[1] - b[1])[0];
115
+ return closest && closest[1] <= 2 ? closest[0] : void 0;
116
+ };
117
+ const editDistance = (left, right) => {
118
+ let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
119
+ for (let leftIndex = 1; leftIndex <= left.length; leftIndex += 1) {
120
+ const current = [leftIndex];
121
+ for (let rightIndex = 1; rightIndex <= right.length; rightIndex += 1) current[rightIndex] = Math.min((previous[rightIndex] ?? 0) + 1, (current[rightIndex - 1] ?? 0) + 1, (previous[rightIndex - 1] ?? 0) + (left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1));
122
+ previous = current;
123
+ }
124
+ return previous[right.length] ?? right.length;
125
+ };
126
+ export { DetailedError, NETWORK_ERROR_MESSAGE, ProjectNotLinkedError, REDACTED_INVALID_VALUE, didYouMean, isNetworkError, isUnexpectedError, matchErrorCode };
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  // src/functions/registry.ts
2
3
  const MAX_PATH_LENGTH = 255;
3
4
  const MAX_FILE_BYTES = 262144;
@@ -25,7 +26,10 @@ function assertValid(validate, data, label) {
25
26
  const recommendedOperations = (operations) => operations.filter((operation) => operation.recommended);
26
27
  const resolveOperationById = (operations, id) => {
27
28
  const operation = operations.find((candidate) => candidate.id === id);
28
- if (!operation) throw new Error(`Unknown operation "${id}". Available operations: ${operations.map((candidate) => candidate.id).join(", ")}.`);
29
+ if (!operation) {
30
+ const ids = operations.map((candidate) => candidate.id);
31
+ throw new Error(`Unknown operation ${REDACTED_INVALID_VALUE}.${didYouMean([id], ids)} Available operations: ${ids.join(", ")}.`);
32
+ }
29
33
  return operation;
30
34
  };
31
35
  const parseRegistryIndex = (text, validate) => {
package/dist/help.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE } from "./errors.js";
1
2
  import { globalOptionsTrailer, helpWidth, wrapHelpText } from "./utils/help_text.js";
2
3
  import { consumeBlockIfMatches, consumeNextMatching, drawPointer, splitColumns } from "./utils/ui.js";
3
4
  import chalk from "chalk";
@@ -269,8 +270,15 @@ const failOnUsageError = (msg, err, usage) => {
269
270
  if (typeof usage !== "object" || usage === null || !("help" in usage) || typeof usage.help !== "function") throw new Error("yargs no longer passes its usage instance to .fail(); update failOnUsageError for the installed yargs");
270
271
  const help = usage.help();
271
272
  if (typeof help !== "string") throw new Error("yargs usage.help() did not return a string");
272
- throw new UsageError(msg ?? "Invalid usage", help);
273
+ throw new UsageError(redactRejectedChoices(msg ?? "Invalid usage"), help);
273
274
  };
275
+ /**
276
+ * yargs answers a value outside `choices` with `Argument: <key>, Given: <values>, Choices:
277
+ * <choices>`, one line per flag, in English because `index.ts` pins `.locale("en")`. Each
278
+ * given value is JSON-quoted, which leaves U+2028/U+2029 unescaped, hence `[^\n]` over `.`;
279
+ * the match runs to the last `, Choices: ` so a value containing that text is still covered.
280
+ */
281
+ const redactRejectedChoices = (msg) => msg.replace(/^(\s*Argument: [^,\n]+, Given: )[^\n]*(, Choices: )/gm, `$1${REDACTED_INVALID_VALUE}$2`);
274
282
  function assertYargsInternals(argv) {
275
283
  if (!("getInternalMethods" in argv) || typeof argv.getInternalMethods !== "function") throw new Error("yargs no longer exposes getInternalMethods(); update isBareParentCommand for the installed yargs");
276
284
  }
package/dist/init/plan.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { getCliName } from "../utils/cli_name.js";
2
3
  import { tryResolveAddMcpAgentId, uniqueAgentIds } from "../mcp/agents.js";
3
4
  import { supportsSkills } from "./agents.js";
@@ -293,7 +294,7 @@ const resolveNamedAgents = (raw) => {
293
294
  for (const item of raw) {
294
295
  if (item === "*") throw new Error("--agent * is not accepted. Pass --agent <name> for each coding agent, or omit --agent to detect or pick.");
295
296
  const id = tryResolveAddMcpAgentId(item);
296
- if (!id) throw new Error(`Unknown agent: "${item}". Supported agents: ${available.join(", ")}`);
297
+ if (!id) throw new Error(`Unknown agent: ${REDACTED_INVALID_VALUE}.${didYouMean([item], available)} Supported agents: ${available.join(", ")}`);
297
298
  resolved.push(id);
298
299
  }
299
300
  return uniqueAgentIds(resolved);
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { agents, detectGlobalAgents, detectProjectAgents as detectProjectAgents$1, getAgentTypes } from "add-mcp";
2
3
  // src/mcp/agents.ts
3
4
  const UNSUPPORTED_AGENTS = /* @__PURE__ */ new Set(["mastracode"]);
@@ -61,7 +62,7 @@ function tryResolveAddMcpAgentId(rawAgent) {
61
62
  }
62
63
  function resolveAddMcpAgentId(rawAgent) {
63
64
  const resolved = tryResolveAddMcpAgentId(rawAgent);
64
- if (!resolved) throw new Error(`Unknown agent: "${rawAgent}". Supported agents: ${listMcpAgentIds().join(", ")}`);
65
+ if (!resolved) throw new Error(`Unknown agent: ${REDACTED_INVALID_VALUE}.${didYouMean([rawAgent], listMcpAgentIds())} Supported agents: ${listMcpAgentIds().join(", ")}`);
65
66
  return resolved;
66
67
  }
67
68
  async function detectInstalledAgents() {
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { getCliName } from "../utils/cli_name.js";
2
3
  import { chmodSync, existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
4
  import { basename, dirname, join, relative } from "node:path";
@@ -24,7 +25,7 @@ function isMcpCategory(value) {
24
25
  function parseMcpCategories(raw) {
25
26
  const out = [];
26
27
  for (const value of raw) {
27
- if (!isMcpCategory(value)) throw new Error(`Unknown MCP category: "${value}". Supported categories: ${NEON_MCP_CATEGORIES.join(", ")}`);
28
+ if (!isMcpCategory(value)) throw new Error(`Unknown MCP category: ${REDACTED_INVALID_VALUE}.${didYouMean([value], NEON_MCP_CATEGORIES)} Supported categories: ${NEON_MCP_CATEGORIES.join(", ")}`);
28
29
  out.push(value);
29
30
  }
30
31
  return out;
package/dist/mcp/plan.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { tryResolveAddMcpAgentId } from "./agents.js";
2
3
  import { detectMcpAgents, mcpInstallableAgents } from "./targets.js";
3
4
  import { collectYesAgents, noDetectedAgentsMessage } from "../init/plan.js";
@@ -32,7 +33,7 @@ async function resolveMcpPlan(options) {
32
33
  }),
33
34
  resolveSpecified: (raw) => {
34
35
  const id = tryResolveAddMcpAgentId(raw);
35
- if (!id) throw new Error(`Unknown agent: "${raw}". Supported agents: ${available.join(", ")}`);
36
+ if (!id) throw new Error(`Unknown agent: ${REDACTED_INVALID_VALUE}.${didYouMean([raw], available)} Supported agents: ${available.join(", ")}`);
36
37
  return id;
37
38
  },
38
39
  pick: prompt ? options.pickAgents ?? pickAgentsInteractively : void 0,
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "./errors.js";
1
2
  // src/neon_services.ts
2
3
  /**
3
4
  * Every Neon service a `--service` flag can name, spelled the way a user types it — one
@@ -76,19 +77,20 @@ const parseServices = (raw, options) => {
76
77
  return canonical;
77
78
  });
78
79
  const unsupported = resolved.filter((name) => !allowed.some((service) => service === name));
79
- if (unsupported.length > 0) throw new Error(`${unsupportedMessage(unsupported, flag)} ${supported}`);
80
+ if (unsupported.length > 0) throw new Error(`${unsupportedMessage(unsupported, allowed, flag)} ${supported}`);
80
81
  for (const [used, canonical] of deprecated) onDeprecated?.(used, canonical);
81
82
  return allowed.filter((service) => resolved.includes(service));
82
83
  };
83
84
  /**
84
85
  * The sentences explaining why a selection was refused. A real Neon service this command
85
86
  * cannot act on is a different mistake from a typo — different cause, different fix — so the
86
- * two are never answered with the same word.
87
+ * two are never answered with the same word. Only a real service is named; anything else is
88
+ * redacted, since it could be a secret pasted into the wrong flag.
87
89
  */
88
- const unsupportedMessage = (unsupported, flag) => {
90
+ const unsupportedMessage = (unsupported, allowed, flag) => {
89
91
  const known = unsupported.filter((name) => NEON_SERVICES.some((service) => service === name));
90
92
  const unknown = unsupported.filter((name) => !known.some((service) => service === name));
91
- return [unknown.length > 0 ? `Unknown service${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")}.` : void 0, ...known.map((service) => `${service} is not something ${flag} can select.`)].filter((part) => part !== void 0).join(" ");
93
+ return [unknown.length > 0 ? `Unknown service${unknown.length === 1 ? "" : "s"} ${unknown.map(() => REDACTED_INVALID_VALUE).join(", ")}.${didYouMean(unknown, allowed)}` : void 0, ...known.map((service) => `${service} is not something ${flag} can select.`)].filter((part) => part !== void 0).join(" ");
92
94
  };
93
95
  /** Every spelling of the services flag, so a habit picked up on one command works on another. */
94
96
  const SERVICE_FLAG_NAMES = [
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { getAgentDisplayName, tryResolveAddMcpAgentId } from "../mcp/agents.js";
2
3
  import "../init/agents.js";
3
4
  import { detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "./targets.js";
@@ -63,7 +64,7 @@ async function resolvePluginsPlan(options) {
63
64
  resolveSpecified: (raw) => {
64
65
  if (raw === "*") throw new Error("neon plugins does not accept --agent *. Pass --agent <name> for each coding agent, or omit --agent to use detected agents.");
65
66
  const id = tryResolveAddMcpAgentId(raw);
66
- if (!id) throw new Error(`Unknown agent: "${raw}". Supported agents: ${available.join(", ")}`);
67
+ if (!id) throw new Error(`Unknown agent: ${REDACTED_INVALID_VALUE}.${didYouMean([raw], available)} Supported agents: ${available.join(", ")}`);
67
68
  return id;
68
69
  },
69
70
  pick: prompt ? options.pickAgents ?? pickAgentsInteractively : void 0,
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { helpCsv } from "../utils/help_text.js";
2
3
  // src/skills/catalog.ts
3
4
  const AGENT_SKILLS_SOURCE = "neondatabase/agent-skills";
@@ -58,7 +59,7 @@ const defaultSkillEntries = () => NEON_SKILL_CATALOG.filter((entry) => entry.def
58
59
  function resolveSkillId(raw) {
59
60
  if (raw === "*") throw new Error("neon skills does not accept --skill *. Pass --skill <name> for each skill, or omit --skill to install the default skills with -y.");
60
61
  const entry = CATALOG_BY_SKILL.get(raw);
61
- if (entry === void 0) throw new Error(`Unknown skill: "${raw}". Supported skills: ${listSkillIds().join(", ")}`);
62
+ if (entry === void 0) throw new Error(`Unknown skill: ${REDACTED_INVALID_VALUE}.${didYouMean([raw], listSkillIds())} Supported skills: ${listSkillIds().join(", ")}`);
62
63
  return entry;
63
64
  }
64
65
  function uniqueSkillEntries(entries) {
@@ -1,3 +1,4 @@
1
+ import { REDACTED_INVALID_VALUE, didYouMean } from "../errors.js";
1
2
  import { tryResolveAddMcpAgentId } from "../mcp/agents.js";
2
3
  import "../init/agents.js";
3
4
  import { detectSkillsAgents, skillsInstallableAgents } from "./targets.js";
@@ -51,7 +52,7 @@ async function resolveSkillsPlan(options) {
51
52
  resolveSpecified: (raw) => {
52
53
  if (raw === "*") throw new Error("neon skills does not accept --agent *. Pass --agent <name> for each coding agent, or omit --agent to use detected agents.");
53
54
  const id = tryResolveAddMcpAgentId(raw);
54
- if (!id) throw new Error(`Unknown agent: "${raw}". Supported agents: ${available.join(", ")}`);
55
+ if (!id) throw new Error(`Unknown agent: ${REDACTED_INVALID_VALUE}.${didYouMean([raw], available)} Supported agents: ${available.join(", ")}`);
55
56
  return id;
56
57
  },
57
58
  pick: prompt ? options.pickAgents ?? pickAgentsInteractively : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "9.9.6",
3
+ "version": "9.9.7",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -112,8 +112,8 @@
112
112
  "tsx": "4.22.3",
113
113
  "typescript": "^5.9.0",
114
114
  "vitest": "^3.0.9",
115
- "@neon-internals/env-core": "0.0.57",
116
115
  "@neon-internals/cli-core": "0.0.0",
116
+ "@neon-internals/env-core": "0.0.57",
117
117
  "@neon/e2e-harness": "0.0.0",
118
118
  "@neon/env": "2.1.9",
119
119
  "@neon/functions": "0.11.0"