neon 9.9.5 → 9.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -507,7 +507,7 @@ The branch argument is **optional**: run `neon checkout` with no branch in an in
507
507
  Branch **id vs name** is detected automatically (a `br-…` value is treated as an id):
508
508
 
509
509
  - **id** — matched strictly by id. A non-existent id is a hard "not found" error (ids are server-assigned, so checkout never creates one, including with `--create`).
510
- - **name** — matched by name. If the name doesn't exist, pass `--create` to create it (equivalent to `neon branch create --name <name>`: branched from the project's default branch with a read-write compute, or from `neon.ts` when that file is present), then check it out. `--create` is a no-op when the name already exists. Without `--create`, an interactive terminal offers to create the branch; in CI or with no TTY the error names `--create`.
510
+ - **name** — matched by name. If the name doesn't exist, pass `--create` to create it (equivalent to `neon branch create --name <name>`: branched from the project's default branch with a read-write compute, or from `neon.ts` when that file is present), then check it out. When the name already exists, `--create` checks out that branch unchanged and prints a `WARNING:` line saying nothing was created; the exit code stays 0. Without `--create`, an interactive terminal offers to create the branch; in CI or with no TTY the error names `--create`.
511
511
 
512
512
  The project is resolved through the standard neon chain, each entry winning over the next:
513
513
 
@@ -527,6 +527,10 @@ $ neon checkout dev --create --project-id polished-snowflake-12345678
527
527
  Created branch dev (br-dev-branch-12345678).
528
528
  Checked out branch br-dev-branch-12345678 on project polished-snowflake-12345678. Updated /path/to/cwd/.neon.
529
529
 
530
+ $ neon checkout dev --create --project-id polished-snowflake-12345678
531
+ WARNING: Branch dev (br-dev-branch-12345678) already exists, so --create did not create a new one; checking out the existing branch unchanged. Pass a new name for a fresh branch.
532
+ Checked out branch br-dev-branch-12345678 on project polished-snowflake-12345678. Updated /path/to/cwd/.neon.
533
+
530
534
  $ cat .neon
531
535
  {
532
536
  "orgId": "org-abc123",
@@ -50,7 +50,7 @@ const builder = (argv) => argv.usage("$0 checkout [id|name] [options]").position
50
50
  default: true
51
51
  },
52
52
  create: {
53
- describe: "Create the named branch if it does not exist, then check it out",
53
+ describe: "Create the named branch if it does not exist, then check it out. New branches start from the parent set in neon.ts, else the project's default branch. An existing branch is checked out unchanged.",
54
54
  type: "boolean",
55
55
  default: false
56
56
  },
@@ -106,6 +106,7 @@ const handler = async (props) => {
106
106
  cwd
107
107
  });
108
108
  const orgId = await (orgRead ?? resolveOrgId(props, projectId));
109
+ if (props.create && !created) log.warning("Branch %s (%s) already exists, so --create did not create a new one; checking out the existing branch unchanged. Pass a new name for a fresh branch.", branchName, branchId);
109
110
  applyContext(props.contextFile, {
110
111
  projectId,
111
112
  ...orgId ? { orgId } : {},
@@ -6,7 +6,7 @@ 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
8
  import { o as quoteFlagValue } from "./link-BVa6Nfji.js";
9
- import { o as handler$1 } from "./checkout-CLHGCpZx.js";
9
+ import { o as handler$1 } from "./checkout-CczPpuT9.js";
10
10
  import { existsSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import chalk from "chalk";
@@ -6,11 +6,11 @@ import { writer } from "../writer.js";
6
6
  import { noPassthrough } from "../utils/flags.js";
7
7
  import { getAgentDisplayName } from "../mcp/agents.js";
8
8
  import "../init/agents.js";
9
- import { pluginsCommandProblemText, pluginsInstallableAgents } from "../plugins/targets.js";
9
+ import { pluginsCommandProblemText, pluginsGitProblem, pluginsInstallableAgents } from "../plugins/targets.js";
10
10
  import { AGENT_PLUGIN_SKIP_MESSAGE } from "../init/copy.js";
11
11
  import { NEON_MCP_URL } from "../mcp/install.js";
12
12
  import { canPickAgentsInteractively, skippableAgentPicker } from "../utils/agent_picker.js";
13
- import { resolvePluginsPlan } from "../plugins/plan.js";
13
+ import { pluginsGitError, resolvePluginsPlan } from "../plugins/plan.js";
14
14
  import { NEON_PLUGIN_NAME, PLUGIN_SKILLS, PLUGIN_SOURCE, neonPluginsRetryCommand, pluginsAddArgs, runPluginsCli } from "../plugins/run.js";
15
15
  // src/commands/plugins.ts
16
16
  var plugins_exports = /* @__PURE__ */ __exportAll({
@@ -73,6 +73,10 @@ const installPlugins = async (options) => {
73
73
  });
74
74
  for (const agent of plan.skipped) log.warning("Skipping %s: no plugins mapping.", getAgentDisplayName(agent));
75
75
  for (const row of plan.unusableCommands) log.warning("Skipping %s: the plugin installs through \"%s\", which %s.", getAgentDisplayName(row.agent), row.command.name, pluginsCommandProblemText(row));
76
+ if (plan.targets.length > 0) {
77
+ const git = pluginsGitProblem({ cwd });
78
+ if (git !== void 0) throw pluginsGitError(git);
79
+ }
76
80
  const rows = [];
77
81
  const failed = [];
78
82
  for (const [index, mapped] of plan.targets.entries()) {
@@ -1 +1 @@
1
- export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CLHGCpZx.js";
1
+ export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CczPpuT9.js";
@@ -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-CIXLNUoh.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-BZY1WeAw.js";
@@ -7,12 +7,12 @@ import { c as config_exports } from "../_chunks/config-C8BQIoM2.js";
7
7
  import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
8
8
  import { a as link_exports } from "../_chunks/link-BVa6Nfji.js";
9
9
  import { o as mcp_exports } from "../_chunks/mcp-g8C-BZIb.js";
10
- import { c as plugins_exports } from "../_chunks/plugins-BwUZQ6Ic.js";
10
+ import { c as plugins_exports } from "../_chunks/plugins-CEylQlgK.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-CLHGCpZx.js";
15
+ import { n as checkout_exports } from "../_chunks/checkout-CczPpuT9.js";
16
16
  import { o as claim_exports } from "../_chunks/claim-BoN9NPTy.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-KV1jlK-n.js";
@@ -24,7 +24,7 @@ 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
26
  import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
27
- import { o as git_exports } from "../_chunks/git-CIXLNUoh.js";
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";
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as command, i as describe, a as handler, o as installPlugins, s as pluginsInstallError, l as reportPluginsInstall } from "../_chunks/plugins-BwUZQ6Ic.js";
1
+ export { t as aliases, n as builder, r as command, i as describe, a as handler, o as installPlugins, s as pluginsInstallError, l as reportPluginsInstall } from "../_chunks/plugins-CEylQlgK.js";
package/dist/errors.js CHANGED
@@ -19,6 +19,7 @@ const ERROR_MATCHERS = [
19
19
  [/^neon skills needs Node\.js /, "NODE_VERSION_UNSUPPORTED"],
20
20
  [/needs npx \(Node\.js\)/, "NPX_NOT_FOUND"],
21
21
  [/spawn git ENOENT/, "GIT_NOT_FOUND"],
22
+ [/^Installing the Neon plugin needs Git, /, "GIT_NOT_FOUND"],
22
23
  [/^(Failed to install Neon agent skills|skills CLI failed)/, "SKILLS_CLI_FAILED"],
23
24
  [/^Cannot install the Neon plugin for /, "AGENT_COMMAND_UNAVAILABLE"],
24
25
  [/^(Failed to install the Neon plugin for: |plugins CLI (failed|timed out))/, "PLUGINS_CLI_FAILED"],
@@ -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-g8C-BZIb.js";
10
- import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-BwUZQ6Ic.js";
10
+ import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-CEylQlgK.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";
@@ -6,6 +6,12 @@ import { detectAgent } from "../init/detect_host.js";
6
6
  import { agentChoicesFrom, pickAgentsInteractively, resolveAgentSelection } from "../utils/agent_picker.js";
7
7
  // src/plugins/plan.ts
8
8
  const unusablePluginsCommandsError = (unusable) => new Error(unusable.map((row) => `Cannot install the Neon plugin for ${getAgentDisplayName(row.agent)}: "${row.command.name}" ${pluginsCommandProblemText(row)}. ${pluginsCommandFix(row)}, then retry.`).join("\n"));
9
+ const gitErrorPrefix = "Installing the Neon plugin needs Git, and \"git\"";
10
+ const gitFix = (problem) => {
11
+ if (problem.kind === "missing") return "Install Git (https://git-scm.com/downloads) or add it to PATH";
12
+ return /^(xcrun|xcode-select):/.test(problem.detail) ? "Install the Command Line Tools (xcode-select --install) or install Git" : "Repair or reinstall Git";
13
+ };
14
+ const pluginsGitError = (problem) => /* @__PURE__ */ new Error(`${gitErrorPrefix} ${problem.kind === "missing" ? "was not found on PATH" : `did not run ("git --version" failed: ${problem.detail})`}. ${gitFix(problem)}, then retry.`);
9
15
  const assertPluginsCanRun = (options) => {
10
16
  if (options.yes || options.interactive || options.hasAgents) return;
11
17
  throw new Error("No interactive terminal. Pass -y to install into detected agents, or --agent <name> to name them.");
@@ -92,4 +98,4 @@ async function resolvePluginsPlan(options) {
92
98
  targets: mappedPluginsTargets(agents)
93
99
  };
94
100
  }
95
- export { assertPluginsCanRun, resolvePluginsPlan, unusablePluginsCommandsError };
101
+ export { assertPluginsCanRun, pluginsGitError, resolvePluginsPlan, unusablePluginsCommandsError };
@@ -87,28 +87,19 @@ const withPath = (env, path) => {
87
87
  [key ?? "PATH"]: path
88
88
  };
89
89
  };
90
- /**
91
- * Runs `<command> --version` the way the plugins CLI spawns the command (no shell, the npx
92
- * search PATH, its child env), so a command it could not run is caught before it runs.
93
- */
94
- const probePluginsCommand = (command, options) => {
95
- const resolved = which.sync(command.name, {
96
- nothrow: true,
97
- path: options.searchPath
98
- });
99
- if (resolved === null) return { kind: "missing" };
100
- const result = spawnSync(resolved, ["--version"], {
101
- cwd: options.cwd,
102
- env: withPath(pluginsChildEnv(), options.searchPath),
103
- encoding: "utf8",
104
- stdio: [
105
- "ignore",
106
- "pipe",
107
- "pipe"
108
- ],
109
- timeout: VERSION_TIMEOUT_MS,
110
- windowsHide: true
111
- });
90
+ const versionRunOptions = (options) => ({
91
+ cwd: options.cwd,
92
+ env: withPath(pluginsChildEnv(), options.searchPath),
93
+ encoding: "utf8",
94
+ stdio: [
95
+ "ignore",
96
+ "pipe",
97
+ "pipe"
98
+ ],
99
+ timeout: VERSION_TIMEOUT_MS,
100
+ windowsHide: true
101
+ });
102
+ const versionRunProblem = (result) => {
112
103
  if (result.error !== void 0) {
113
104
  const code = "code" in result.error && typeof result.error.code === "string" ? result.error.code : void 0;
114
105
  return {
@@ -116,7 +107,6 @@ const probePluginsCommand = (command, options) => {
116
107
  detail: code === "ETIMEDOUT" ? `timed out after ${VERSION_TIMEOUT_MS / 1e3} seconds` : code ?? result.error.message
117
108
  };
118
109
  }
119
- const output = `${result.stdout}\n${result.stderr}`;
120
110
  if (result.status !== 0) {
121
111
  const line = firstLine(result.stderr) || firstLine(result.stdout);
122
112
  return {
@@ -124,7 +114,40 @@ const probePluginsCommand = (command, options) => {
124
114
  detail: line.length > 0 ? line.slice(0, 160).replace(/\.$/, "") : result.signal !== null ? `killed by ${result.signal}` : `exit code ${result.status}`
125
115
  };
126
116
  }
127
- return pluginsCommandVersionProblem(command, output);
117
+ };
118
+ /**
119
+ * Runs `<command> --version` the way the plugins CLI spawns the command (no shell, the npx
120
+ * search PATH, its child env), so a command it could not run is caught before it runs.
121
+ */
122
+ const probePluginsCommand = (command, options) => {
123
+ const resolved = which.sync(command.name, {
124
+ nothrow: true,
125
+ path: options.searchPath
126
+ });
127
+ if (resolved === null) return { kind: "missing" };
128
+ const result = spawnSync(resolved, ["--version"], versionRunOptions(options));
129
+ return versionRunProblem(result) ?? pluginsCommandVersionProblem(command, `${result.stdout}\n${result.stderr}`);
130
+ };
131
+ /**
132
+ * The plugins CLI runs `git clone` through a shell, so this probe runs `git --version`
133
+ * through one too: without a shell, Node cannot run a Windows `git.cmd`. A slow git is
134
+ * left to the plugins CLI rather than blocking the install.
135
+ */
136
+ const pluginsGitProblem = (options) => {
137
+ const searchPath = pluginsCommandSearchPath(options.cwd, options.path ?? process.env.PATH ?? "");
138
+ if (which.sync("git", {
139
+ nothrow: true,
140
+ path: searchPath
141
+ }) === null) return { kind: "missing" };
142
+ const result = spawnSync("git --version", {
143
+ ...versionRunOptions({
144
+ cwd: options.cwd,
145
+ searchPath
146
+ }),
147
+ shell: true
148
+ });
149
+ if (result.error !== void 0 && "code" in result.error && result.error.code === "ETIMEDOUT") return;
150
+ return versionRunProblem(result);
128
151
  };
129
152
  const commandRows = (agents, options, check) => {
130
153
  const searchPath = pluginsCommandSearchPath(options.cwd, options.path ?? process.env.PATH ?? "");
@@ -216,4 +239,4 @@ const mappedPluginsTargets = (agents) => {
216
239
  if (mapped.length === 0) throw new Error(`None of the selected agents can install plugins. Supported agents: ${pluginsInstallableAgents().join(", ")}`);
217
240
  return mapped;
218
241
  };
219
- export { bootstrapPluginAgents, detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsInstallableAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
242
+ export { bootstrapPluginAgents, detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsGitProblem, pluginsInstallableAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "9.9.5",
3
+ "version": "9.9.6",
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/cli-core": "0.0.0",
116
115
  "@neon-internals/env-core": "0.0.57",
116
+ "@neon-internals/cli-core": "0.0.0",
117
117
  "@neon/e2e-harness": "0.0.0",
118
118
  "@neon/env": "2.1.9",
119
119
  "@neon/functions": "0.11.0"