neon 9.9.2 → 9.9.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 (38) hide show
  1. package/README.md +3 -2
  2. package/dist/_chunks/{auth-SCu1foxg.js → auth-CFa969Ck.js} +5 -1
  3. package/dist/_chunks/{checkout-CC3Y_LUJ.js → checkout-D9CSqjde.js} +5 -4
  4. package/dist/_chunks/{claim-C4DWuUCK.js → claim-Dzsw8sdd.js} +1 -1
  5. package/dist/_chunks/{config-Cc0NZ9Rn.js → config-CtP-1YSw.js} +2 -2
  6. package/dist/_chunks/{deploy-CKKy88xM.js → deploy-DQNsheXC.js} +1 -1
  7. package/dist/_chunks/{dev-BeaZHcw_.js → dev-EmQkh84H.js} +3 -3
  8. package/dist/_chunks/{git-D1hFEGIH.js → git-DJ-QP4YF.js} +2 -2
  9. package/dist/_chunks/{link-Dz9ROPcr.js → link-Caoa3_y8.js} +2 -2
  10. package/dist/_chunks/{profile-Bcs3EiSZ.js → profile-DWyfpl03.js} +1 -1
  11. package/dist/_chunks/{status-ts-VXi7s.js → status-DLH8CtHh.js} +1 -1
  12. package/dist/_chunks/{user-C1pTJS9O.js → user-iNYSe0KI.js} +28 -3
  13. package/dist/auth_recovery.js +1 -1
  14. package/dist/commands/auth.js +1 -1
  15. package/dist/commands/checkout.js +1 -1
  16. package/dist/commands/claim.js +1 -1
  17. package/dist/commands/config.js +1 -1
  18. package/dist/commands/deploy.js +1 -1
  19. package/dist/commands/dev.js +1 -1
  20. package/dist/commands/env.js +1 -1
  21. package/dist/commands/functions_new.js +1 -1
  22. package/dist/commands/git.js +1 -1
  23. package/dist/commands/index.js +12 -12
  24. package/dist/commands/link.js +1 -1
  25. package/dist/commands/manifest.js +1 -1
  26. package/dist/commands/profile.js +1 -1
  27. package/dist/commands/status.js +1 -1
  28. package/dist/commands/subscribe.js +1 -1
  29. package/dist/commands/user.js +1 -1
  30. package/dist/errors.js +5 -2
  31. package/dist/index.js +1 -1
  32. package/dist/init/auth.js +2 -2
  33. package/dist/init/deploy.js +2 -2
  34. package/dist/init/link.js +2 -2
  35. package/dist/init/run.js +3 -3
  36. package/dist/utils/enrichers.js +4 -1
  37. package/package.json +5 -5
  38. package/dist/_chunks/{env-6tb3p9iY.js → env-aWCqnWaF.js} +1 -1
package/README.md CHANGED
@@ -83,7 +83,7 @@ neon projects list --api-key <neon_api_key>
83
83
 
84
84
  For information about obtaining an Neon API key, see [Authentication](https://neon.com/docs/reference/api/get-started), in the _Neon API Reference_.
85
85
 
86
- To check which account and credential a command uses, run `neon me` with the same `--profile` or `--api-key` option and environment as that command. The `Authentication` row names the source, such as `OAuth (profile DEFAULT)`, `API key (profile work)`, `API key (--api-key)`, or `API key (NEON_API_KEY)`. An organization API key has no user, so `neon me` shows its `Organization` id instead, and `-o json` prints `{"account_id": "org-…", "auth_method": "api_key_org"}`; check `auth_method` to tell it apart from a user. When no credential is usable, `neon me` exits 1 with `Not signed in` and the `neon login` command to run; it never starts a sign-in itself.
86
+ To check which account and credential a command uses, run `neon me` with the same `--profile` or `--api-key` option and environment as that command. The `Authentication` row names the source, such as `OAuth (profile DEFAULT)`, `API key (profile work)`, `API key (--api-key)`, or `API key (NEON_API_KEY)`. An organization API key has no user, so `neon me` shows its `Organization` id instead, and `-o json` prints `{"account_id": "org-…", "auth_method": "api_key_org"}`; check `auth_method` to tell it apart from a user. In a directory linked by `neon claim create`, `neon me` shows the Claimable project's `Project ID` and `Project Expires At` and an `Authentication` row of `Claimable project`, and `-o json` prints `{"auth_method": "claimable", "project_id": "…", "project_expires_at": "…"}`. When no credential is usable, `neon me` exits 1 with `Not signed in` and the `neon login` command to run; it never starts a sign-in itself.
87
87
 
88
88
  ## Create a project without an account
89
89
 
@@ -156,6 +156,7 @@ operations are allowed before claim.
156
156
 
157
157
  ```bash
158
158
  neon claim status # lifecycle and transfer status
159
+ neon me # the Claimable project this directory uses
159
160
  neon projects get <project-id> # regular CLI command, same agent token
160
161
  neon psql --role-name neondb_owner -- -c "select now()"
161
162
  neon config plan
@@ -1610,7 +1611,7 @@ Every subcommand except `list` takes `--org-id`. Without it, the CLI uses the or
1610
1611
  | orgs (`org`) | `list`, `get`, `members`, `invitations`, `spending-limit` | Manage organizations |
1611
1612
  | [projects](https://neon.com/docs/reference/cli-projects) | `list`, `create`, `update`, `delete`, `get` | Manage projects |
1612
1613
  | [ip-allow](https://neon.com/docs/reference/cli-ip-allow) | `list`, `add`, `remove`, `reset` | Manage IP Allow |
1613
- | [me](https://neon.com/docs/reference/cli-me) | | Show the current user or organization |
1614
+ | [me](https://neon.com/docs/reference/cli-me) | | Show the current user, organization, or Claimable project |
1614
1615
  | [branches](https://neon.com/docs/reference/cli-branches) | `list`, `create`, `rename`, `add-compute`, `set-default`, `set-expiration`, `delete`, `get` | Manage branches |
1615
1616
  | postgres (`pg`, `lakebase`) | `computes`, `databases`, `roles`, `connection-string`, `psql` | Manage Postgres and connect to it |
1616
1617
  | [databases](https://neon.com/docs/reference/cli-databases) | `list`, `create`, `delete` | Manage databases |
@@ -393,7 +393,11 @@ const ensureAuth = async (props) => {
393
393
  setAuthContext({
394
394
  source: "claimable",
395
395
  configDir: props.configDir,
396
- credentialsPath: path
396
+ credentialsPath: path,
397
+ claimableProject: {
398
+ id: stored.projectId,
399
+ expiresAt: stored.expiresAt
400
+ }
397
401
  });
398
402
  log.debug("Using the linked Claimable Neon project's short-lived access token");
399
403
  return;
@@ -3,6 +3,7 @@ import { isCi } from "../env.js";
3
3
  import { log } from "../log.js";
4
4
  import { isNeonApiError } from "../api.js";
5
5
  import { applyContext, contextBranch, readContextFile } from "../context.js";
6
+ import { ProjectNotLinkedError } from "../errors.js";
6
7
  import { getCliName } from "../utils/cli_name.js";
7
8
  import { isClaimableEnvTarget } from "../claimable/state.js";
8
9
  import { loadEnvFileIntoProcess } from "../env_file.js";
@@ -11,9 +12,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
11
12
  import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
12
13
  import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
13
14
  import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
14
- import { n as autoPullEnvAfterPin } from "./env-6tb3p9iY.js";
15
- import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-Cc0NZ9Rn.js";
16
- import { i as handler$1 } from "./link-Dz9ROPcr.js";
15
+ import { n as autoPullEnvAfterPin } from "./env-aWCqnWaF.js";
16
+ import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-CtP-1YSw.js";
17
+ import { i as handler$1 } from "./link-Caoa3_y8.js";
17
18
  import chalk from "chalk";
18
19
  import prompts from "prompts";
19
20
  // src/commands/checkout.ts
@@ -339,7 +340,7 @@ const tryAutoDetectProject = async (props) => {
339
340
  try {
340
341
  return (await fillSingleProject(props)).projectId;
341
342
  } catch (err) {
342
- if (isNeonApiError(err)) throw err;
343
+ if (isNeonApiError(err) || err instanceof ProjectNotLinkedError) throw err;
343
344
  log.debug("checkout: could not auto-detect a single project: %s", err instanceof Error ? err.message : String(err));
344
345
  return;
345
346
  }
@@ -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-6tb3p9iY.js";
15
+ import { c as pull } from "./env-aWCqnWaF.js";
16
16
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
17
17
  import open from "open";
18
18
  import prompts from "prompts";
@@ -7,7 +7,7 @@ import "../config.js";
7
7
  import { contextBranch, ensureDirectoryGitignored, readContextFile } from "../context.js";
8
8
  import { DetailedError } from "../errors.js";
9
9
  import { getCliName } from "../utils/cli_name.js";
10
- import { l as existingApiClient } from "./auth-SCu1foxg.js";
10
+ import { l as existingApiClient } from "./auth-CFa969Ck.js";
11
11
  import { NEON_SERVICES, NEON_SERVICE_LABELS, deprecatedServiceMessage, servicesFlagValue, servicesOption } from "../neon_services.js";
12
12
  import { FUNCTION_FILENAME, FUNCTION_SLUG, FUNCTION_TEMPLATE, REQUIRED_PACKAGES, dataApiChoiceFromView, parseConfigInitServices, renderFunctionSource, renderNeonConfig, renderNeonConfigFromView } from "../config_template.js";
13
13
  import { TYPESCRIPT_EXTENSION, asRelativeModulePath, editNeonConfig } from "../config_edit.js";
@@ -26,7 +26,7 @@ import { readGitContext } from "../utils/git.js";
26
26
  import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
27
27
  import { pickServicesInteractively } from "../utils/service_picker.js";
28
28
  import { zipBundle } from "../utils/zip.js";
29
- import { n as autoPullEnvAfterPin } from "./env-6tb3p9iY.js";
29
+ import { n as autoPullEnvAfterPin } from "./env-aWCqnWaF.js";
30
30
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
31
31
  import { dirname, join, relative, resolve } from "node:path";
32
32
  import chalk from "chalk";
@@ -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-Cc0NZ9Rn.js";
3
+ import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-CtP-1YSw.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 { getCliName } from "../utils/cli_name.js";
4
4
  import { isClaimableEnvTarget } from "../claimable/state.js";
5
5
  import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
6
6
  import { t as NEON_DEV_FUNCTION_PORTS } from "./env-EJU-0InB.js";
7
+ import { branchIdResolve } from "../utils/enrichers.js";
8
+ import { bundleEntry } from "../utils/esbuild.js";
7
9
  import { a as resolveDevEnv } from "./env-CFBmcKyo.js";
10
+ import { f as envFlag } from "./config-CtP-1YSw.js";
8
11
  import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
9
12
  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-Cc0NZ9Rn.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-Dz9ROPcr.js";
9
- import { o as handler$1 } from "./checkout-CC3Y_LUJ.js";
8
+ import { o as quoteFlagValue } from "./link-Caoa3_y8.js";
9
+ import { o as handler$1 } from "./checkout-D9CSqjde.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-6tb3p9iY.js";
17
- import { h as initCmd } from "./config-Cc0NZ9Rn.js";
16
+ import { n as autoPullEnvAfterPin } from "./env-aWCqnWaF.js";
17
+ import { h as initCmd } from "./config-CtP-1YSw.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";
@@ -11,7 +11,7 @@ import { auth, revokeToken } from "../auth.js";
11
11
  import { t as credentialInputs } from "./auth_selection-D81EvEz9.js";
12
12
  import { hostUpdateFor, hostsForProfile, issuingHosts } from "../hosts.js";
13
13
  import { readOutgoingCredential, retirePreviousCredential, revokeTokenSet, withdrawKey } from "../retire_credential.js";
14
- import { m as usableCredential, n as authFlow } from "./auth-SCu1foxg.js";
14
+ import { m as usableCredential, n as authFlow } from "./auth-CFa969Ck.js";
15
15
  import { identityFromAuthDetails, isApiKeyMethod, mintedKeyName, notAnApiKeyMessage } from "../profile_keys.js";
16
16
  import { writer } from "../writer.js";
17
17
  import { noPassthrough, single } from "../utils/flags.js";
@@ -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-Cc0NZ9Rn.js";
3
+ import { y as status } from "./config-CtP-1YSw.js";
4
4
  // src/commands/status.ts
5
5
  var status_exports = /* @__PURE__ */ __exportAll({
6
6
  builder: () => builder,
@@ -12,20 +12,45 @@ var user_exports = /* @__PURE__ */ __exportAll({
12
12
  userDetails: () => userDetails
13
13
  });
14
14
  const command = "me";
15
- const describe = "Show the current user or organization";
15
+ const describe = "Show the current user, organization, or Claimable project";
16
16
  const builder = (yargs) => yargs.option("context-file", { hidden: true });
17
17
  const handler = async (args) => {
18
18
  await me(args);
19
19
  };
20
20
  const me = async (props) => {
21
21
  if (!props.apiClient) return;
22
+ const auth = getAuthContext();
23
+ if (auth?.source === "claimable" && auth.claimableProject) {
24
+ const identity = {
25
+ auth_method: "claimable",
26
+ project_id: auth.claimableProject.id,
27
+ project_expires_at: auth.claimableProject.expiresAt
28
+ };
29
+ if (props.output === "json" || props.output === "yaml") {
30
+ writer(props).end(identity, { fields: [
31
+ "auth_method",
32
+ "project_id",
33
+ "project_expires_at"
34
+ ] });
35
+ return;
36
+ }
37
+ writer(props).end({
38
+ ...identity,
39
+ authentication: authenticationLabel(auth)
40
+ }, { fields: [
41
+ "project_id",
42
+ "project_expires_at",
43
+ "authentication"
44
+ ] });
45
+ return;
46
+ }
22
47
  const data = await currentUserOrOrgKey(props.apiClient);
23
48
  if ("auth_method" in data) {
24
49
  if (props.output === "json" || props.output === "yaml") {
25
50
  writer(props).end(data, { fields: ["account_id", "auth_method"] });
26
51
  return;
27
52
  }
28
- writer(props).end(orgKeyDetails(data, getAuthContext()), { fields: ["organization", "authentication"] });
53
+ writer(props).end(orgKeyDetails(data, auth), { fields: ["organization", "authentication"] });
29
54
  return;
30
55
  }
31
56
  if (props.output === "json" || props.output === "yaml") {
@@ -37,7 +62,7 @@ const me = async (props) => {
37
62
  ] });
38
63
  return;
39
64
  }
40
- writer(props).end(userDetails(data, getAuthContext()), { fields: [
65
+ writer(props).end(userDetails(data, auth), { fields: [
41
66
  "login",
42
67
  "email",
43
68
  "name",
@@ -2,7 +2,7 @@ import { t as storeFor } from "./_chunks/credential_io-BHwacMdt.js";
2
2
  import { log } from "./log.js";
3
3
  import { authFailureMessage, getAuthContext, locationFromContext } from "./auth_context.js";
4
4
  import { AuthRefreshError } from "./auth.js";
5
- import { d as isAccessTokenUsable, p as refreshStoredCredentials } from "./_chunks/auth-SCu1foxg.js";
5
+ import { d as isAccessTokenUsable, p as refreshStoredCredentials } from "./_chunks/auth-CFa969Ck.js";
6
6
  // src/auth_recovery.ts
7
7
  const supersededOnDisk = (rejectedToken) => {
8
8
  if (rejectedToken === void 0) return false;
@@ -1 +1 @@
1
- export { t as aliases, n as authFlow, i as builder, a as command, o as deleteCredentialsAt, s as describe, c as ensureAuth, l as existingApiClient, u as handler, d as isAccessTokenUsable, f as locationForAuth, p as refreshStoredCredentials, m as usableCredential } from "../_chunks/auth-SCu1foxg.js";
1
+ export { t as aliases, n as authFlow, i as builder, a as command, o as deleteCredentialsAt, s as describe, c as ensureAuth, l as existingApiClient, u as handler, d as isAccessTokenUsable, f as locationForAuth, p as refreshStoredCredentials, m as usableCredential } from "../_chunks/auth-CFa969Ck.js";
@@ -1 +1 @@
1
- export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CC3Y_LUJ.js";
1
+ export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-D9CSqjde.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-C4DWuUCK.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-Dzsw8sdd.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-Cc0NZ9Rn.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-CtP-1YSw.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CKKy88xM.js";
1
+ export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-DQNsheXC.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 localFunctionPortsEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-BeaZHcw_.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 localFunctionPortsEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-EmQkh84H.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-6tb3p9iY.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-aWCqnWaF.js";
@@ -9,7 +9,7 @@ import { writer } from "../writer.js";
9
9
  import { formatInitDone, printInitDone } from "../init/chrome.js";
10
10
  import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
11
11
  import { displayPath } from "./env_output.js";
12
- import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-Cc0NZ9Rn.js";
12
+ import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-CtP-1YSw.js";
13
13
  import { recommendedOperations } from "../functions/registry.js";
14
14
  import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
15
15
  import { describeRegistrySources, openRegistry } from "../functions/source.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-D1hFEGIH.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-DJ-QP4YF.js";
@@ -1,30 +1,30 @@
1
- import { r as auth_exports } from "../_chunks/auth-SCu1foxg.js";
1
+ import { r as auth_exports } from "../_chunks/auth-CFa969Ck.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-6tb3p9iY.js";
6
- import { c as config_exports } from "../_chunks/config-Cc0NZ9Rn.js";
5
+ import { o as env_exports } from "../_chunks/env-aWCqnWaF.js";
6
+ import { c as config_exports } from "../_chunks/config-CtP-1YSw.js";
7
7
  import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
8
- import { a as link_exports } from "../_chunks/link-Dz9ROPcr.js";
8
+ import { a as link_exports } from "../_chunks/link-Caoa3_y8.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-CC3Y_LUJ.js";
16
- import { o as claim_exports } from "../_chunks/claim-C4DWuUCK.js";
15
+ import { n as checkout_exports } from "../_chunks/checkout-D9CSqjde.js";
16
+ import { o as claim_exports } from "../_chunks/claim-Dzsw8sdd.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";
19
19
  import { r as data_api_exports } from "../_chunks/data_api-BpSGbdZf.js";
20
20
  import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
21
- import { r as deploy_exports } from "../_chunks/deploy-CKKy88xM.js";
22
- import { s as dev_exports } from "../_chunks/dev-BeaZHcw_.js";
21
+ import { r as deploy_exports } from "../_chunks/deploy-DQNsheXC.js";
22
+ import { s as dev_exports } from "../_chunks/dev-EmQkh84H.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
26
  import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
27
- import { o as git_exports } from "../_chunks/git-D1hFEGIH.js";
27
+ import { o as git_exports } from "../_chunks/git-DJ-QP4YF.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";
@@ -37,13 +37,13 @@ import { o as orgs_exports } from "../_chunks/orgs-BrvAWM8Z.js";
37
37
  import { o as psql_exports } from "../_chunks/psql-BcxiPR4W.js";
38
38
  import { f as roles_exports } from "../_chunks/roles-BELJqjTy.js";
39
39
  import { o as postgres_exports } from "../_chunks/postgres-BbEt_7c9.js";
40
- import { o as profile_exports } from "../_chunks/profile-Bcs3EiSZ.js";
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
43
  import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
44
- import { a as status_exports } from "../_chunks/status-ts-VXi7s.js";
44
+ import { a as status_exports } from "../_chunks/status-DLH8CtHh.js";
45
45
  import { d as triggers_exports } from "../_chunks/triggers-m3IBjiph.js";
46
- import { s as user_exports } from "../_chunks/user-C1pTJS9O.js";
46
+ import { s as user_exports } from "../_chunks/user-iNYSe0KI.js";
47
47
  import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
48
48
  // src/commands/index.ts
49
49
  var commands_default = [
@@ -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-Dz9ROPcr.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-Caoa3_y8.js";
@@ -35,7 +35,7 @@ const commandManifest = [
35
35
  },
36
36
  {
37
37
  command: "me",
38
- describe: "Show the current user or organization",
38
+ describe: "Show the current user, organization, or Claimable project",
39
39
  load: () => import("./user.js")
40
40
  },
41
41
  {
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-Bcs3EiSZ.js";
1
+ export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-DWyfpl03.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-ts-VXi7s.js";
1
+ export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-DLH8CtHh.js";
@@ -1,6 +1,6 @@
1
1
  import { writer } from "../writer.js";
2
- import { o as resolveNeonEnvVars } from "../_chunks/env-CFBmcKyo.js";
3
2
  import { branchIdFromProps } from "../utils/enrichers.js";
3
+ import { o as resolveNeonEnvVars } from "../_chunks/env-CFBmcKyo.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", {
@@ -1 +1 @@
1
- export { t as authenticationLabel, n as builder, r as command, i as describe, a as handler, o as userDetails } from "../_chunks/user-C1pTJS9O.js";
1
+ export { t as authenticationLabel, n as builder, r as command, i as describe, a as handler, o as userDetails } from "../_chunks/user-iNYSe0KI.js";
package/dist/errors.js CHANGED
@@ -6,6 +6,8 @@ var DetailedError = class extends Error {
6
6
  this.detail = detail;
7
7
  }
8
8
  };
9
+ /** No project was given or linked, and the API key cannot list projects to pick one. */
10
+ var ProjectNotLinkedError = class extends Error {};
9
11
  const ERROR_MATCHERS = [
10
12
  [/^Unknown command: (.*)$/, "UNKNOWN_COMMAND"],
11
13
  [/^Missing required argument: (.*)$/, "MISSING_ARGUMENT"],
@@ -23,7 +25,8 @@ const ERROR_MATCHERS = [
23
25
  [/^Could not install the Neon dependencies/, "DEPENDENCY_INSTALL_FAILED"],
24
26
  [/^Could not reach neonstatus\.com /, "NETWORK_ERROR"],
25
27
  [/^Timed out waiting for neonstatus\.com /, "REQUEST_TIMEOUT"],
26
- [/ (is|are) no longer pulled\. Pull NEON_BRANCH_ID /, "LEGACY_FUNCTION_ENV_KEY"]
28
+ [/ (is|are) no longer pulled\. Pull NEON_BRANCH_ID /, "LEGACY_FUNCTION_ENV_KEY"],
29
+ [/^No Neon project is linked here/, "PROJECT_NOT_LINKED"]
27
30
  ];
28
31
  const matchErrorCode = (message) => {
29
32
  if (!message) return "UNKNOWN_ERROR";
@@ -92,4 +95,4 @@ const isNetworkError = (err) => {
92
95
  }
93
96
  return false;
94
97
  };
95
- export { DetailedError, NETWORK_ERROR_MESSAGE, isNetworkError, isUnexpectedError, matchErrorCode };
98
+ export { DetailedError, NETWORK_ERROR_MESSAGE, ProjectNotLinkedError, isNetworkError, isUnexpectedError, matchErrorCode };
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { analyticsMiddleware, closeAnalytics, initAnalyticsClientMiddleware, isA
10
10
  import { getCliName } from "./utils/cli_name.js";
11
11
  import { AuthRefreshError, defaultClientID } from "./auth.js";
12
12
  import { invocationHosts } from "./hosts.js";
13
- import { c as ensureAuth } from "./_chunks/auth-SCu1foxg.js";
13
+ import { c as ensureAuth } from "./_chunks/auth-CFa969Ck.js";
14
14
  import { recoverFrom401 } from "./auth_recovery.js";
15
15
  import { UsageError, failOnUsageError, isBareParentCommand, showHelp, showUsageErrorHelp } from "./help.js";
16
16
  import { lazyCommands, preloadCommand } from "./commands/manifest.js";
package/dist/init/auth.js CHANGED
@@ -2,9 +2,9 @@ import { isNeonApiError } from "../api.js";
2
2
  import { r as defaultDir } from "../_chunks/paths-B55ZfOg1.js";
3
3
  import "../config.js";
4
4
  import "../auth.js";
5
- import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-SCu1foxg.js";
5
+ import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-CFa969Ck.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { c as pull } from "../_chunks/env-6tb3p9iY.js";
7
+ import { c as pull } from "../_chunks/env-aWCqnWaF.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;
@@ -1,10 +1,10 @@
1
1
  import { isNeonApiError } from "../api.js";
2
2
  import { contextBranch, readContextFile } from "../context.js";
3
- import { c as ensureAuth } from "../_chunks/auth-SCu1foxg.js";
3
+ import { c as ensureAuth } from "../_chunks/auth-CFa969Ck.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-Cc0NZ9Rn.js";
7
+ import { r as applyCmd } from "../_chunks/config-CtP-1YSw.js";
8
8
  import { authContext } from "./auth.js";
9
9
  import { existsSync } from "node:fs";
10
10
  import { missingFunctionEnv } from "@neon/config";
package/dist/init/link.js CHANGED
@@ -2,9 +2,9 @@ import { isNeonApiError } from "../api.js";
2
2
  import { r as defaultDir } from "../_chunks/paths-B55ZfOg1.js";
3
3
  import "../config.js";
4
4
  import "../auth.js";
5
- import { c as ensureAuth } from "../_chunks/auth-SCu1foxg.js";
5
+ import { c as ensureAuth } from "../_chunks/auth-CFa969Ck.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { s as runLink } from "../_chunks/link-Dz9ROPcr.js";
7
+ import { s as runLink } from "../_chunks/link-Caoa3_y8.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
@@ -15,8 +15,8 @@ import { getAgentDisplayName } from "../mcp/agents.js";
15
15
  import { missingPluginsCommands, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "../plugins/targets.js";
16
16
  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";
17
17
  import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
18
- import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-Cc0NZ9Rn.js";
19
- import { o as quoteFlagValue, s as runLink } from "../_chunks/link-Dz9ROPcr.js";
18
+ import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-CtP-1YSw.js";
19
+ import { o as quoteFlagValue, s as runLink } from "../_chunks/link-Caoa3_y8.js";
20
20
  import { runAuthenticatedLink } from "./link.js";
21
21
  import { mcpInstallableAgents } from "../mcp/targets.js";
22
22
  import { skillsInstallableAgents } from "../skills/targets.js";
@@ -26,7 +26,7 @@ import { pullInitEnv, resolveInitConfigApi } from "./auth.js";
26
26
  import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
27
27
  import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
28
28
  import { runToolingSteps, toolingStepCommandText } from "./tooling.js";
29
- import { l as create } from "../_chunks/claim-C4DWuUCK.js";
29
+ import { l as create } from "../_chunks/claim-Dzsw8sdd.js";
30
30
  import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
31
31
  import { detectInitEnvironment } from "./detect.js";
32
32
  import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties, recordInitError, recordInitExit } from "./funnel.js";
@@ -1,5 +1,7 @@
1
- import { isNeonApiError, messageFromBody } from "../api.js";
1
+ import { codeFromBody, isNeonApiError, messageFromBody } from "../api.js";
2
2
  import { isConfigAdd, isConfigInit, isCurrentBranchProbe, isFunctionsTemplateCommand } from "../context.js";
3
+ import { ProjectNotLinkedError } from "../errors.js";
4
+ import { getCliName } from "./cli_name.js";
3
5
  import { looksLikeBranchId } from "./formats.js";
4
6
  // src/utils/enrichers.ts
5
7
  const BRANCHES_LIST_LIMIT = 100;
@@ -151,6 +153,7 @@ const fillSingleProject = async (props) => {
151
153
  };
152
154
  } catch (error) {
153
155
  if (isNeonApiError(error) && error.status === 400 && messageFromBody(error.data)?.includes("org_id is required")) throw new Error("Multiple projects found, please provide one with the --project-id option");
156
+ if (!props.orgId && isNeonApiError(error) && error.status === 404 && !codeFromBody(error.data)) throw new ProjectNotLinkedError(`No Neon project is linked here, and a project-scoped API key cannot list projects to pick one (${error.message}). Run the command from the directory you linked with \`${getCliName()} link\`, or pass --project-id (and --branch for a branch other than the default).`);
154
157
  throw error;
155
158
  }
156
159
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "9.9.2",
3
+ "version": "9.9.3",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -73,10 +73,10 @@
73
73
  "yaml": "^2.9.0",
74
74
  "yargs": "17.7.2",
75
75
  "yoctocolors": "^2.1.2",
76
- "@neon/sdk": "7.15.0",
77
- "@neon/config": "1.14.6",
78
76
  "@neon/config-runtime": "1.12.9",
79
- "@neon/realtime": "0.2.1"
77
+ "@neon/config": "1.14.6",
78
+ "@neon/realtime": "0.2.1",
79
+ "@neon/sdk": "7.15.0"
80
80
  },
81
81
  "optionalDependencies": {
82
82
  "@napi-rs/keyring": "1.3.0",
@@ -113,8 +113,8 @@
113
113
  "typescript": "^5.9.0",
114
114
  "vitest": "^3.0.9",
115
115
  "@neon-internals/cli-core": "0.0.0",
116
- "@neon-internals/env-core": "0.0.57",
117
116
  "@neon/e2e-harness": "0.0.0",
117
+ "@neon-internals/env-core": "0.0.57",
118
118
  "@neon/env": "2.1.9",
119
119
  "@neon/functions": "0.11.0"
120
120
  },
@@ -7,8 +7,8 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
7
7
  import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
8
8
  import { n as NEON_ENV_VAR_KEYS } from "./env-EJU-0InB.js";
9
9
  import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, isLegacyFunctionBaseUrlKey, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
10
- import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CFBmcKyo.js";
11
10
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
11
+ import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CFBmcKyo.js";
12
12
  import { warnAiGateway } from "../utils/ai_gateway_notice.js";
13
13
  import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
14
14
  import { existsSync } from "node:fs";