neon 9.7.1 → 9.8.0
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 +6 -6
- package/dist/_chunks/{auth-B1AqRN6z.js → auth-DY5Bm7Ym.js} +1 -1
- package/dist/_chunks/{checkout-C5RXRmRy.js → checkout-DZa--fO4.js} +2 -2
- package/dist/_chunks/{config-ClvDw0Xs.js → config-DFj1Btk-.js} +1 -1
- package/dist/_chunks/{credentials-BMBNmW0t.js → credentials-KV1jlK-n.js} +13 -2
- package/dist/_chunks/{data_api-CHDwvMTG.js → data_api-BpSGbdZf.js} +1 -1
- package/dist/_chunks/{deploy-D1T3_cYZ.js → deploy-CVJIahZE.js} +1 -1
- package/dist/_chunks/{dev-hNDBX-5l.js → dev-CtIzg7vq.js} +1 -1
- package/dist/_chunks/{git-DbJwG1SU.js → git-ax3xtNoz.js} +2 -2
- package/dist/_chunks/{incidents-D6rDn1g2.js → incidents-BSFkUu1P.js} +5 -1
- package/dist/_chunks/{init-D2fClHtC.js → init-BSwLzxjX.js} +4 -4
- package/dist/_chunks/{link-CHscI_10.js → link-Z2_mLhVn.js} +11 -13
- package/dist/_chunks/{profile-Bf5qqUN1.js → profile-Qoyql0AR.js} +1 -1
- package/dist/_chunks/{status-DdagkQp2.js → status-DRWS1u6H.js} +1 -1
- package/dist/_chunks/{user-D9mC430O.js → user-C1pTJS9O.js} +34 -2
- package/dist/auth.js +5 -5
- package/dist/auth_recovery.js +1 -1
- package/dist/commands/auth.js +1 -1
- package/dist/commands/checkout.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/credentials.js +1 -1
- package/dist/commands/data_api.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/incidents.js +1 -1
- package/dist/commands/index.js +14 -14
- package/dist/commands/init.js +1 -1
- package/dist/commands/link.js +1 -1
- package/dist/commands/manifest.js +1 -1
- package/dist/commands/profile.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/user.js +1 -1
- package/dist/dev/runtime.js +1 -1
- package/dist/functions/scaffold.js +3 -1
- package/dist/index.js +1 -1
- package/dist/init/auth.js +1 -1
- package/dist/init/chrome.js +1 -0
- package/dist/init/copy.js +1 -1
- package/dist/init/deploy.js +2 -2
- package/dist/init/link.js +4 -5
- package/dist/init/run.js +16 -10
- package/dist/utils/package_manager.js +30 -3
- package/package.json +6 -6
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)`. 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. 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
|
|
|
@@ -898,7 +898,7 @@ The target directory must be empty unless you pass `--force` (a lone `.git` is i
|
|
|
898
898
|
|
|
899
899
|
`neon init` sets up coding agents and this directory for Neon. In a terminal it asks **Recommended** or **Custom**. `-y` is Recommended with no prompts. `-y` with `--skill`, MCP flags, `--no-agent-setup`, or `--claimable` is Custom using those flags.
|
|
900
900
|
|
|
901
|
-
Recommended installs the Neon plugin for every detected agent (global config, project folders, and the host CLI). Plugin-capable agents get the plugin; the rest get skills and MCP. If none are detected, it installs the default Neon skills for Cursor and Codex in this directory (`./.agents/skills`) and does not configure MCP. It then links a project when the CLI is authenticated, and writes
|
|
901
|
+
Recommended installs the Neon plugin for every detected agent (global config, project folders, and the host CLI). Plugin-capable agents get the plugin; the rest get skills and MCP. If none are detected, it installs the default Neon skills for Cursor and Codex in this directory (`./.agents/skills`) and does not configure MCP. It then links a project when the CLI is authenticated, and writes `neon.ts` using the package manager already in the directory. When init links an existing project, `neon.ts` is written from that branch's current services, as `neon config init --from-branch` does; a new project, an already-linked directory, or an offline pin gets the starter policy (Postgres only).
|
|
902
902
|
|
|
903
903
|
Unauthenticated `-y` skips linking and prints the next step: sign up at https://neon.com/signup, then `neon login`, `neon link`, or `neon claim create` (no account, expires in 72 hours unless claimed). `-y` never opens a browser. Without `-y`, a signed-out init with no terminal on stdin, stdout, or stderr stops at the link step with the sign-in error that names `neon login`. `-y` with `--project-id` or other account flags links when the CLI is already signed in. Without credentials, `--org-id`, `--project-id`, and `--branch` together write `.neon` offline (as `neon link --no-checks` does), and init prints `neon login` as the next step; Neon checks the IDs on the first command that reaches it. With only some of those flags, init still installs agent tooling and writes `neon.ts`, then prints `neon login` and the `neon link` command with those flags.
|
|
904
904
|
|
|
@@ -906,7 +906,7 @@ When init picks MCP auth (no `--mcp-auth`) and the CLI credential is an organiza
|
|
|
906
906
|
|
|
907
907
|
When the Neon plugin, skills, or MCP setup fails for an agent, init runs the remaining agent steps, links (or writes `.neon` offline), and writes `neon.ts` as it would have, then reports `Neon setup failed.` with the error and the `neon plugins`, `neon skills`, or `neon mcp` command to retry, and exits 1.
|
|
908
908
|
|
|
909
|
-
Custom asks how to add Neon to coding agents (plugin, skills and MCP separately, or skip), then how to get a project (sign in and link, or a claimable project when you are not signed in), then which services `neon.ts` should declare. Skills and MCP use separate agent pickers, and either can be skipped. Postgres is listed first as always included. The package manager is inferred from the directory; Custom asks only when none is detected. `--skill` selects skills (not the plugin) and skips that picker. MCP flags (`--mcp-config-location`, `--mcp-auth`, `--mcp-project-scoped`) select skills and MCP. `--mcp-config-location` is where the config is written: `global` maps to `neon mcp`, and `project` maps to `neon mcp --project`. With `-y`, the location defaults to `global`; interactive Custom asks. If some selected agents cannot write that location, init warns and skips MCP for those agents while continuing with the supported agents. It fails when none of the selected agents support the location. `--mcp-project-scoped` limits MCP tools to the linked Neon project by passing its ID to `neon mcp --project-id`. Omitted is false, including in Custom; there is no prompt. `--no-agent-setup` skips agent setup.
|
|
909
|
+
Custom asks how to add Neon to coding agents (plugin, skills and MCP separately, or skip), then how to get a project (sign in and link, or a claimable project when you are not signed in), then which services `neon.ts` should declare (skipped when it linked an existing project, whose `neon.ts` is written from the branch). Skills and MCP use separate agent pickers, and either can be skipped. Postgres is listed first as always included. The package manager is inferred from the directory; Custom asks only when none is detected. `--skill` selects skills (not the plugin) and skips that picker. MCP flags (`--mcp-config-location`, `--mcp-auth`, `--mcp-project-scoped`) select skills and MCP. `--mcp-config-location` is where the config is written: `global` maps to `neon mcp`, and `project` maps to `neon mcp --project`. With `-y`, the location defaults to `global`; interactive Custom asks. If some selected agents cannot write that location, init warns and skips MCP for those agents while continuing with the supported agents. It fails when none of the selected agents support the location. `--mcp-project-scoped` limits MCP tools to the linked Neon project by passing its ID to `neon mcp --project-id`. Omitted is false, including in Custom; there is no prompt. `--no-agent-setup` skips agent setup.
|
|
910
910
|
|
|
911
911
|
Empty directories are set up in place. `neon init` does not scaffold starter files.
|
|
912
912
|
|
|
@@ -924,7 +924,7 @@ Without a TTY, pass `-y` or enough flags to answer every question. `-y` alone is
|
|
|
924
924
|
|
|
925
925
|
`--project-id`, `--org-id`, `--project-name`, `--region-id`, and `--branch` are forwarded to `link`. They select linking. A linked directory is not relinked unless you pass one of those flags.
|
|
926
926
|
|
|
927
|
-
Init pulls the branch's env vars once, after the `neon.ts` step, so the pull includes what `neon.ts` declares. The AI Gateway and Functions need no deploy and are pulled immediately. When `neon.ts` declares Auth, the Data API, Object Storage, or Realtime, init pulls Postgres, plus the AI Gateway and the scaffolded function's URL when declared. `neon deploy` provisions the rest and pulls their env vars. An existing `neon.ts` is pulled by `link` as usual.
|
|
927
|
+
Init pulls the branch's env vars once, after the `neon.ts` step, so the pull includes what `neon.ts` declares. A `neon.ts` written from the branch declares only services the branch already runs, so all of them are pulled. The AI Gateway and Functions need no deploy and are pulled immediately. When `neon.ts` declares Auth, the Data API, Object Storage, or Realtime, init pulls Postgres, plus the AI Gateway and the scaffolded function's URL when declared. `neon deploy` provisions the rest and pulls their env vars. An existing `neon.ts` is pulled by `link` as usual.
|
|
928
928
|
|
|
929
929
|
A failed step stops the rest. `--profile` and `--config-dir` are forwarded to each child. `--output json` and `--output yaml` are refused; the commands init runs print their own output.
|
|
930
930
|
|
|
@@ -1175,7 +1175,7 @@ neon credentials rotate nak_live_…
|
|
|
1175
1175
|
neon credentials revoke nak_live_…
|
|
1176
1176
|
```
|
|
1177
1177
|
|
|
1178
|
-
`create` always issues a customer-managed (`user`) credential. `--scope` is repeatable; `--help` lists the values. `reveal` and `rotate` print `api_token` and `s3_secret_access_key`. Rotation keeps the same `token_id` (it is the `AWS_ACCESS_KEY_ID`) and is not idempotent: a retry after a lost response mints another secret.
|
|
1178
|
+
`create` always issues a customer-managed (`user`) credential. `--scope` is repeatable; `--help` lists the values. `reveal` and `rotate` print `api_token` and `s3_secret_access_key`. `reveal` also prints the credential's `name` and `scopes` from `list`, plus its `branch_id` in JSON and YAML output. `branch_id` is the branch the credential was issued on, which can be an ancestor of `--branch`. When `--branch` does not list the credential, `reveal` warns and prints no `branch_id`. Rotation keeps the same `token_id` (it is the `AWS_ACCESS_KEY_ID`) and is not idempotent: a retry after a lost response mints another secret.
|
|
1179
1179
|
|
|
1180
1180
|
All sub-commands honor the [global options](#global-options), including `--output json|yaml|table`.
|
|
1181
1181
|
|
|
@@ -1610,7 +1610,7 @@ Every subcommand except `list` takes `--org-id`. Without it, the CLI uses the or
|
|
|
1610
1610
|
| orgs (`org`) | `list`, `get`, `members`, `invitations`, `spending-limit` | Manage organizations |
|
|
1611
1611
|
| [projects](https://neon.com/docs/reference/cli-projects) | `list`, `create`, `update`, `delete`, `get` | Manage projects |
|
|
1612
1612
|
| [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 current user
|
|
1613
|
+
| [me](https://neon.com/docs/reference/cli-me) | | Show the current user or organization |
|
|
1614
1614
|
| [branches](https://neon.com/docs/reference/cli-branches) | `list`, `create`, `rename`, `add-compute`, `set-default`, `set-expiration`, `delete`, `get` | Manage branches |
|
|
1615
1615
|
| postgres (`pg`, `lakebase`) | `computes`, `databases`, `roles`, `connection-string`, `psql` | Manage Postgres and connect to it |
|
|
1616
1616
|
| [databases](https://neon.com/docs/reference/cli-databases) | `list`, `create`, `delete` | Manage databases |
|
|
@@ -52,7 +52,7 @@ const describe = "Sign in with a browser. See --help for API keys and profiles";
|
|
|
52
52
|
const wrapAuthHelp = (text) => wrapHelpText(text, helpWidth());
|
|
53
53
|
const authHelpEpilogue = () => {
|
|
54
54
|
const cli = getCliName();
|
|
55
|
-
return helpEpilogue(wrapAuthHelp("Non-interactive (CI, scripts, agents):"), wrapAuthHelp("Use an existing API key or an API-key profile."), ` ${cli} projects list --profile agent`, wrapAuthHelp(`${cli} profile create <name> --mint needs a browser during setup, then stores an API key and drops the session. It cannot run in CI. Default key is account-wide; --org-id or --project-id (not both) restricts it.`), wrapAuthHelp(`A profile holds a browser session or an API key. Select it with --profile <name> or NEON_PROFILE. List profiles with ${cli} profile list.`), wrapAuthHelp("On commands that use a credential, --api-key or --profile overrides NEON_API_KEY and NEON_PROFILE. Pass either --api-key or --profile, not both. When neither flag is passed and both NEON_API_KEY and NEON_PROFILE are set, the key wins and stderr names the ignored profile. When no flag or environment variable selects a credential, DEFAULT is used."), wrapAuthHelp(`${cli} profile create <name> replaces an existing profile of that name and tries to revoke the credential it held. An imported key with no recorded id stays live. Pick a new name to keep the old profile.`), wrapAuthHelp(`See ${cli} profile --help and ${cli} profile create --help.`));
|
|
55
|
+
return helpEpilogue(wrapAuthHelp(`Browser sign-in prints its Auth Url to stderr and waits up to 10 minutes for it to finish. A coding agent can run ${cli} login in the background and pass the URL to the person signing in on this machine.`), wrapAuthHelp("Non-interactive (CI, scripts, agents):"), wrapAuthHelp("Use an existing API key or an API-key profile."), ` ${cli} projects list --profile agent`, wrapAuthHelp(`${cli} profile create <name> --mint needs a browser during setup, then stores an API key and drops the session. It cannot run in CI. Default key is account-wide; --org-id or --project-id (not both) restricts it.`), wrapAuthHelp(`A profile holds a browser session or an API key. Select it with --profile <name> or NEON_PROFILE. List profiles with ${cli} profile list.`), wrapAuthHelp("On commands that use a credential, --api-key or --profile overrides NEON_API_KEY and NEON_PROFILE. Pass either --api-key or --profile, not both. When neither flag is passed and both NEON_API_KEY and NEON_PROFILE are set, the key wins and stderr names the ignored profile. When no flag or environment variable selects a credential, DEFAULT is used."), wrapAuthHelp(`${cli} profile create <name> replaces an existing profile of that name and tries to revoke the credential it held. An imported key with no recorded id stays live. Pick a new name to keep the old profile.`), wrapAuthHelp(`See ${cli} profile --help and ${cli} profile create --help.`));
|
|
56
56
|
};
|
|
57
57
|
const builder = (yargs) => yargs.option("context-file", { hidden: true }).option("keyring", {
|
|
58
58
|
describe: "Store the credential in the OS keyring. Per profile; a later login without the flag stays there. See `neon profile list`.",
|
|
@@ -12,8 +12,8 @@ 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
14
|
import { n as autoPullEnvAfterPin } from "./env-DxcO3oJk.js";
|
|
15
|
-
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-
|
|
16
|
-
import { i as handler$1 } from "./link-
|
|
15
|
+
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-DFj1Btk-.js";
|
|
16
|
+
import { i as handler$1 } from "./link-Z2_mLhVn.js";
|
|
17
17
|
import chalk from "chalk";
|
|
18
18
|
import prompts from "prompts";
|
|
19
19
|
// src/commands/checkout.ts
|
|
@@ -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-
|
|
10
|
+
import { l as existingApiClient } from "./auth-DY5Bm7Ym.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";
|
|
@@ -127,10 +127,21 @@ const create = async (props) => {
|
|
|
127
127
|
}));
|
|
128
128
|
reportSecrets(props, data, "Store these secrets now: they are not shown again unless you run neon credentials reveal.");
|
|
129
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* The reveal endpoint returns only the secrets, and it reveals any credential in the
|
|
132
|
+
* project whatever branch the path names. The branch listing supplies `branch_id`,
|
|
133
|
+
* `name`, and `scopes`, so scripts can check which branch the secret belongs to.
|
|
134
|
+
*/
|
|
130
135
|
const reveal = async (props) => {
|
|
131
136
|
const branchId = await branchIdFromProps(props);
|
|
132
|
-
const { data } = await withCredentialNotFound(props.tokenId, branchId, () => props.apiClient.revealCredential(props.projectId, branchId, props.tokenId));
|
|
133
|
-
|
|
137
|
+
const { data: secret } = await withCredentialNotFound(props.tokenId, branchId, () => props.apiClient.revealCredential(props.projectId, branchId, props.tokenId));
|
|
138
|
+
const { data: listing } = await props.apiClient.listCredentials(props.projectId, branchId);
|
|
139
|
+
const meta = listing.credentials.find((c) => c.token_id === secret.token_id);
|
|
140
|
+
reportSecrets(props, meta ? {
|
|
141
|
+
...meta,
|
|
142
|
+
...secret
|
|
143
|
+
} : secret, "These are live secrets. Treat them like a password.");
|
|
144
|
+
if (!meta) log.warning(`Credential ${secret.token_id} is not listed on branch ${branchId}, so the output has no branch_id, name, or scopes. Confirm which branch issued it before you use it on ${branchId}.`);
|
|
134
145
|
};
|
|
135
146
|
const rotate = async (props) => {
|
|
136
147
|
const branchId = await branchIdFromProps(props);
|
|
@@ -101,7 +101,7 @@ const builder = (argv) => argv.usage("$0 data-api <sub-command> [options]").opti
|
|
|
101
101
|
},
|
|
102
102
|
"add-default-grants": {
|
|
103
103
|
type: "boolean",
|
|
104
|
-
describe: "Grant
|
|
104
|
+
describe: "Grant authenticated users read and write access to public-schema tables, including tables the database owner creates later"
|
|
105
105
|
},
|
|
106
106
|
"skip-auth-schema": {
|
|
107
107
|
type: "boolean",
|
|
@@ -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-
|
|
3
|
+
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-DFj1Btk-.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({
|
|
@@ -7,7 +7,7 @@ import { t as NEON_DEV_FUNCTION_PORTS } from "./env-EJU-0InB.js";
|
|
|
7
7
|
import { branchIdResolve } from "../utils/enrichers.js";
|
|
8
8
|
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
9
|
import { a as resolveDevEnv } from "./env-CFBmcKyo.js";
|
|
10
|
-
import { f as envFlag } from "./config-
|
|
10
|
+
import { f as envFlag } from "./config-DFj1Btk-.js";
|
|
11
11
|
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
12
12
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
13
13
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -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-
|
|
9
|
-
import { o as handler$1 } from "./checkout-
|
|
8
|
+
import { o as quoteFlagValue } from "./link-Z2_mLhVn.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-DZa--fO4.js";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import chalk from "chalk";
|
|
@@ -13,7 +13,11 @@ var incidents_exports = /* @__PURE__ */ __exportAll({
|
|
|
13
13
|
});
|
|
14
14
|
const command = "incidents";
|
|
15
15
|
const describe = "Show open Neon incidents and maintenance";
|
|
16
|
-
const builder = (argv) => argv.usage("$0 incidents").strict().check(noPassthrough("incidents")).example("$0 incidents", describe).example("$0 incidents -o json", "Print the full report as JSON").epilogue([
|
|
16
|
+
const builder = (argv) => argv.usage("$0 incidents").strict().check(noPassthrough("incidents")).example("$0 incidents", describe).example("$0 incidents -o json", "Print the full report as JSON").epilogue([
|
|
17
|
+
"",
|
|
18
|
+
"Reads the public status page at https://neonstatus.com. No login or linked project is needed.",
|
|
19
|
+
"Updated At (`updated_at` in JSON) is when the status page last updated the overall status, not when this command fetched it."
|
|
20
|
+
].join("\n"));
|
|
17
21
|
const handler = async (props) => {
|
|
18
22
|
const report = await fetchReport();
|
|
19
23
|
if (props.output === "json" || props.output === "yaml") {
|
|
@@ -24,7 +24,7 @@ const builder = (yargs) => yargs.usage("$0 init [options]").option("context-file
|
|
|
24
24
|
alias: "y",
|
|
25
25
|
type: "boolean",
|
|
26
26
|
default: false,
|
|
27
|
-
describe: "Skip prompts. Alone: Recommended (detected agents, link when authenticated,
|
|
27
|
+
describe: "Skip prompts. Alone: Recommended (detected agents, link when authenticated, neon.ts). With --skill, MCP flags, --no-agent-setup, or --claimable: Custom using those flags"
|
|
28
28
|
}).option("agent-setup", {
|
|
29
29
|
type: "boolean",
|
|
30
30
|
default: true,
|
|
@@ -48,7 +48,7 @@ const builder = (yargs) => yargs.usage("$0 init [options]").option("context-file
|
|
|
48
48
|
describe: "Link a Neon project during setup. Use --no-link to skip without being asked"
|
|
49
49
|
}).option("config", {
|
|
50
50
|
type: "boolean",
|
|
51
|
-
describe: "Create neon.ts after linking. Use --no-config to skip. Omitted in Custom: you will be asked"
|
|
51
|
+
describe: "Create neon.ts after linking: from the branch's services when init links an existing project, otherwise the starter policy. Use --no-config to skip. Omitted in Custom: you will be asked"
|
|
52
52
|
}).option("services", servicesOption({
|
|
53
53
|
key: "services",
|
|
54
54
|
allowed: NEON_SERVICES,
|
|
@@ -87,7 +87,7 @@ const builder = (yargs) => yargs.usage("$0 init [options]").option("context-file
|
|
|
87
87
|
}).option("mcp-auth", {
|
|
88
88
|
type: "string",
|
|
89
89
|
choices: ["oauth", "api-key"],
|
|
90
|
-
describe: "MCP authentication. Selects skills and MCP setup. oauth is neon mcp --oauth"
|
|
90
|
+
describe: "MCP authentication. Selects skills and MCP setup. oauth is neon mcp --oauth. api-key mints a key, which needs neon login or a personal API key: with an organization or project-scoped key and no Neon MCP key already configured, init skips MCP and exits 1. Omit it to fall back to oauth when no key can be minted"
|
|
91
91
|
}).option("mcp-project-scoped", {
|
|
92
92
|
type: "boolean",
|
|
93
93
|
default: false,
|
|
@@ -99,7 +99,7 @@ const builder = (yargs) => yargs.usage("$0 init [options]").option("context-file
|
|
|
99
99
|
alias: "o",
|
|
100
100
|
hidden: true,
|
|
101
101
|
describe: "Not supported; the commands init runs print their own output"
|
|
102
|
-
}).example("$0 init", "Recommended or Custom setup").example("$0 init -y", "Recommended setup without prompts").example("$0 init -y --skill neon --mcp-auth oauth --mcp-config-location project", "Custom: those skills and MCP, Recommended defaults for the rest").example("$0 init --no-agent-setup --claimable", "Skip agent setup and create a claimable project").example("$0 init --agent cursor --agent claude-code", "Skip agent selection; install tooling for those agents").epilogue(helpEpilogue("Recommended setup installs tooling for detected coding agents, links a Neon project when the CLI is authenticated or the session is interactive, and writes
|
|
102
|
+
}).example("$0 init", "Recommended or Custom setup").example("$0 init -y", "Recommended setup without prompts").example("$0 init -y --skill neon --mcp-auth oauth --mcp-config-location project", "Custom: those skills and MCP, Recommended defaults for the rest").example("$0 init --no-agent-setup --claimable", "Skip agent setup and create a claimable project").example("$0 init --agent cursor --agent claude-code", "Skip agent selection; install tooling for those agents").epilogue(helpEpilogue("Recommended setup installs tooling for detected coding agents, links a Neon project when the CLI is authenticated or the session is interactive, and writes neon.ts: from the branch's current services when it links an existing project, otherwise the starter policy.", "init sets up the current directory in place. It does not scaffold starter files.", "-y alone is Recommended. -y with --skill, MCP flags, --no-agent-setup, or --claimable is Custom: those flags, Recommended defaults for unanswered questions. -y never opens a browser.", "--skill selects skills (not the plugin). MCP flags select skills and MCP. --no-agent-setup skips agent setup. --agent without those flags installs the plugin (and skills/MCP for agents the plugin cannot cover).", "Without a TTY, pass -y or enough flags to answer every question.", "--agent / -a is forwarded to plugins, or to skills and mcp. It skips agent selection, including with -y.", helpCsv("Plugin agents", initPluginAgents()), helpCsv("Skills and MCP agents", initSkillsMcpAgents()), helpCsv("Skills", listSkillIds()))).check((argv) => {
|
|
103
103
|
if (argv.data !== void 0) throw new Error(removedProtocol());
|
|
104
104
|
if (argv.help !== true && (argv.output === "json" || argv.output === "yaml")) throw new Error(`\`${getCliName()} init\` does not support --output. The commands it runs print their own output.`);
|
|
105
105
|
return true;
|
|
@@ -14,7 +14,7 @@ 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
16
|
import { n as autoPullEnvAfterPin } from "./env-DxcO3oJk.js";
|
|
17
|
-
import { h as initCmd } from "./config-
|
|
17
|
+
import { h as initCmd } from "./config-DFj1Btk-.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";
|
|
@@ -106,6 +106,7 @@ const builder = (argv) => argv.usage("$0 link [options]").options({
|
|
|
106
106
|
["$0 link --no-checks --org-id org-… --project-id polished-snowflake-12345678 --branch main", "Write the context offline (no API calls, no verification)"],
|
|
107
107
|
["$0 link --clear", "Forget the current org/project/branch context"]
|
|
108
108
|
]).epilogue(helpEpilogue("Non-interactive (CI, scripts, agents):", ...nonInteractiveLinkCommands().map((command) => ` ${command}`), orgScopedKeyHint)).strict();
|
|
109
|
+
/** Resolves to `undefined` when nothing was verified: `--clear`, `--no-checks`, or a declined re-link. */
|
|
109
110
|
const runLink = async (props) => {
|
|
110
111
|
if (props.clear) {
|
|
111
112
|
clearContext(props.contextFile);
|
|
@@ -119,14 +120,10 @@ const runLink = async (props) => {
|
|
|
119
120
|
validateInputs(inputs);
|
|
120
121
|
const existing = readContextFile(props.contextFile);
|
|
121
122
|
if (props.yes && hasIncompleteCreationInputs(inputs)) throw incompleteCreationError(props, inputs);
|
|
122
|
-
if (canResolveNonInteractively(inputs, existing))
|
|
123
|
-
await runNonInteractive(props, inputs, existing);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
123
|
+
if (canResolveNonInteractively(inputs, existing)) return runNonInteractive(props, inputs, existing);
|
|
126
124
|
if (props.yes) {
|
|
127
125
|
const resolved = await resolveYesInputs(props, inputs);
|
|
128
|
-
|
|
129
|
-
return;
|
|
126
|
+
return runNonInteractive(props, resolved, existing);
|
|
130
127
|
}
|
|
131
128
|
if (!canPromptInteractively()) {
|
|
132
129
|
if (missingProjectForOrg(inputs)) throw orgNeedsProjectError(props, inputs);
|
|
@@ -138,7 +135,7 @@ const runLink = async (props) => {
|
|
|
138
135
|
orgScopedKeyHint
|
|
139
136
|
].join("\n"));
|
|
140
137
|
}
|
|
141
|
-
|
|
138
|
+
return runInteractive(props, inputs);
|
|
142
139
|
};
|
|
143
140
|
const handler = runLink;
|
|
144
141
|
const parseInputs = (props) => {
|
|
@@ -452,7 +449,7 @@ const runNonInteractive = async (props, inputs, existing) => {
|
|
|
452
449
|
projectName: created.project.name,
|
|
453
450
|
regionId: created.project.region_id
|
|
454
451
|
});
|
|
455
|
-
return;
|
|
452
|
+
return { created: true };
|
|
456
453
|
}
|
|
457
454
|
if (inputs.projectId) {
|
|
458
455
|
const listBranches = branchListing(props, inputs.projectId);
|
|
@@ -472,7 +469,7 @@ const runNonInteractive = async (props, inputs, existing) => {
|
|
|
472
469
|
branchRef: resolved.ref,
|
|
473
470
|
created: false
|
|
474
471
|
});
|
|
475
|
-
return;
|
|
472
|
+
return { created: false };
|
|
476
473
|
}
|
|
477
474
|
if (inputs.branch && existing.projectId) {
|
|
478
475
|
const projectId = existing.projectId;
|
|
@@ -493,7 +490,7 @@ const runNonInteractive = async (props, inputs, existing) => {
|
|
|
493
490
|
branchRef: resolved.ref,
|
|
494
491
|
created: false
|
|
495
492
|
});
|
|
496
|
-
return;
|
|
493
|
+
return { created: false };
|
|
497
494
|
}
|
|
498
495
|
throw orgNeedsProjectError(props, inputs);
|
|
499
496
|
};
|
|
@@ -533,7 +530,7 @@ const runInteractive = async (props, inputs) => {
|
|
|
533
530
|
projectName: created.project.name,
|
|
534
531
|
regionId: created.project.region_id
|
|
535
532
|
});
|
|
536
|
-
return;
|
|
533
|
+
return { created: true };
|
|
537
534
|
}
|
|
538
535
|
const projects = await listAllProjects(props, orgId);
|
|
539
536
|
const action = await promptProjectChoice(projects, inputs.projectName, { allowCreate: !inputs.branch });
|
|
@@ -555,7 +552,7 @@ const runInteractive = async (props, inputs) => {
|
|
|
555
552
|
projectName: action.name,
|
|
556
553
|
regionId: action.regionId
|
|
557
554
|
});
|
|
558
|
-
return;
|
|
555
|
+
return { created: false };
|
|
559
556
|
}
|
|
560
557
|
if (inputs.branch) throw new Error(`Conflicting inputs: --branch pins a branch of an existing project, but creating a project starts from its default branch. Link an existing project, or omit --branch and create first.`);
|
|
561
558
|
const projectName = inputs.projectName ?? await promptProjectName(action.suggestedName);
|
|
@@ -583,6 +580,7 @@ const runInteractive = async (props, inputs) => {
|
|
|
583
580
|
projectName: created.project.name,
|
|
584
581
|
regionId: created.project.region_id
|
|
585
582
|
});
|
|
583
|
+
return { created: true };
|
|
586
584
|
};
|
|
587
585
|
const confirmRelinkIfNeeded = async (props) => {
|
|
588
586
|
const existing = readContextFile(props.contextFile);
|
|
@@ -10,7 +10,7 @@ import { _ as upsertProfile, a as canDropProfilesFile, c as listProfiles, d as n
|
|
|
10
10
|
import { auth, revokeToken } from "../auth.js";
|
|
11
11
|
import { t as credentialInputs } from "./auth_selection-CwGLN9Qz.js";
|
|
12
12
|
import { readOutgoingCredential, retirePreviousCredential, revokeTokenSet, withdrawKey } from "../retire_credential.js";
|
|
13
|
-
import { m as usableCredential, n as authFlow } from "./auth-
|
|
13
|
+
import { m as usableCredential, n as authFlow } from "./auth-DY5Bm7Ym.js";
|
|
14
14
|
import { identityFromAuthDetails, isApiKeyMethod, mintedKeyName, notAnApiKeyMessage } from "../profile_keys.js";
|
|
15
15
|
import { writer } from "../writer.js";
|
|
16
16
|
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-
|
|
3
|
+
import { y as status } from "./config-DFj1Btk-.js";
|
|
4
4
|
// src/commands/status.ts
|
|
5
5
|
var status_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
builder: () => builder,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
+
import { isNeonApiError } from "../api.js";
|
|
2
3
|
import { getAuthContext } from "../auth_context.js";
|
|
3
4
|
import { writer } from "../writer.js";
|
|
4
5
|
// src/commands/user.ts
|
|
@@ -11,14 +12,22 @@ var user_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
12
|
userDetails: () => userDetails
|
|
12
13
|
});
|
|
13
14
|
const command = "me";
|
|
14
|
-
const describe = "Show current user";
|
|
15
|
+
const describe = "Show the current user or organization";
|
|
15
16
|
const builder = (yargs) => yargs.option("context-file", { hidden: true });
|
|
16
17
|
const handler = async (args) => {
|
|
17
18
|
await me(args);
|
|
18
19
|
};
|
|
19
20
|
const me = async (props) => {
|
|
20
21
|
if (!props.apiClient) return;
|
|
21
|
-
const
|
|
22
|
+
const data = await currentUserOrOrgKey(props.apiClient);
|
|
23
|
+
if ("auth_method" in data) {
|
|
24
|
+
if (props.output === "json" || props.output === "yaml") {
|
|
25
|
+
writer(props).end(data, { fields: ["account_id", "auth_method"] });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
writer(props).end(orgKeyDetails(data, getAuthContext()), { fields: ["organization", "authentication"] });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
22
31
|
if (props.output === "json" || props.output === "yaml") {
|
|
23
32
|
writer(props).end(data, { fields: [
|
|
24
33
|
"login",
|
|
@@ -36,6 +45,29 @@ const me = async (props) => {
|
|
|
36
45
|
"authentication"
|
|
37
46
|
] });
|
|
38
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* The user, or the organization when the credential is an organization API key, which
|
|
50
|
+
* `GET /users/me` refuses with 403 or 404. `GET /auth` is asked only after that refusal,
|
|
51
|
+
* so user keys and OAuth still cost one request. Any other outcome rethrows the original
|
|
52
|
+
* error object, which the top-level handler needs intact to recover from SSO step-up.
|
|
53
|
+
*/
|
|
54
|
+
const currentUserOrOrgKey = async (apiClient) => {
|
|
55
|
+
try {
|
|
56
|
+
return (await apiClient.getCurrentUserInfo()).data;
|
|
57
|
+
} catch (err) {
|
|
58
|
+
if (!isNeonApiError(err) || err.status !== 403 && err.status !== 404) throw err;
|
|
59
|
+
const details = await apiClient.getAuthDetails().then(({ data }) => data, () => void 0);
|
|
60
|
+
if (details?.auth_method !== "api_key_org") throw err;
|
|
61
|
+
return {
|
|
62
|
+
account_id: details.account_id,
|
|
63
|
+
auth_method: details.auth_method
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const orgKeyDetails = (identity, auth) => ({
|
|
68
|
+
organization: identity.account_id,
|
|
69
|
+
authentication: auth ? authenticationLabel(auth) : void 0
|
|
70
|
+
});
|
|
39
71
|
/** Table-only view; the field names become the row labels. */
|
|
40
72
|
const userDetails = (user, auth) => ({
|
|
41
73
|
login: user.login,
|
package/dist/auth.js
CHANGED
|
@@ -28,7 +28,7 @@ const NEONCTL_SCOPES = [
|
|
|
28
28
|
"urn:neoncloud:orgs:delete",
|
|
29
29
|
"urn:neoncloud:orgs:permission"
|
|
30
30
|
];
|
|
31
|
-
const
|
|
31
|
+
const AUTH_TIMEOUT_MINUTES = 10;
|
|
32
32
|
const defaultClientID = "neonctl";
|
|
33
33
|
/** `terminal` is a dead grant. A network failure is not. */
|
|
34
34
|
var AuthRefreshError = class extends Error {
|
|
@@ -169,8 +169,8 @@ const auth = async ({ oauthHost, clientId, allowUnsafeTls }) => {
|
|
|
169
169
|
const codeChallenge = await client.calculatePKCECodeChallenge(codeVerifier);
|
|
170
170
|
return new Promise((resolve, reject) => {
|
|
171
171
|
const timer = setTimeout(() => {
|
|
172
|
-
reject(/* @__PURE__ */ new Error(`Authentication timed out after
|
|
173
|
-
},
|
|
172
|
+
reject(/* @__PURE__ */ new Error(`Authentication timed out after 10 minutes`));
|
|
173
|
+
}, 6e5);
|
|
174
174
|
const onRequest = async (request, response) => {
|
|
175
175
|
if (!request.url?.startsWith("/callback")) {
|
|
176
176
|
response.writeHead(404);
|
|
@@ -210,7 +210,7 @@ const auth = async ({ oauthHost, clientId, allowUnsafeTls }) => {
|
|
|
210
210
|
code_challenge_method: "S256",
|
|
211
211
|
redirect_uri: REDIRECT_URI(listen_port)
|
|
212
212
|
});
|
|
213
|
-
log.info(
|
|
213
|
+
log.info(`Awaiting authentication in web browser (up to 10 minutes).`);
|
|
214
214
|
log.info(`Auth Url: ${authUrl}`);
|
|
215
215
|
open(authUrl.href).catch((err) => {
|
|
216
216
|
const msg = `Failed to open web browser. Please copy & paste auth url to authenticate in browser.`;
|
|
@@ -220,4 +220,4 @@ const auth = async ({ oauthHost, clientId, allowUnsafeTls }) => {
|
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
-
export { AuthRefreshError, NEONCTL_SCOPES, auth, classifyRefreshFailure, defaultClientID, refreshToken, revokeToken };
|
|
223
|
+
export { AUTH_TIMEOUT_MINUTES, AuthRefreshError, NEONCTL_SCOPES, auth, classifyRefreshFailure, defaultClientID, refreshToken, revokeToken };
|
package/dist/auth_recovery.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as storeFor } from "./_chunks/credential_io-DbeSh3Pl.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-
|
|
5
|
+
import { d as isAccessTokenUsable, p as refreshStoredCredentials } from "./_chunks/auth-DY5Bm7Ym.js";
|
|
6
6
|
// src/auth_recovery.ts
|
|
7
7
|
const supersededOnDisk = (rejectedToken) => {
|
|
8
8
|
if (rejectedToken === void 0) return false;
|
package/dist/commands/auth.js
CHANGED
|
@@ -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-
|
|
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-DY5Bm7Ym.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-
|
|
1
|
+
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-DZa--fO4.js";
|
package/dist/commands/config.js
CHANGED
|
@@ -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-
|
|
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-DFj1Btk-.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as command, i as create, o as describe, s as handler, c as list, l as reveal, u as revoke, d as rotate } from "../_chunks/credentials-
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as create, o as describe, s as handler, c as list, l as reveal, u as revoke, d as rotate } from "../_chunks/credentials-KV1jlK-n.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/data_api-
|
|
1
|
+
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/data_api-BpSGbdZf.js";
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-
|
|
1
|
+
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CVJIahZE.js";
|
package/dist/commands/dev.js
CHANGED
|
@@ -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-
|
|
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-CtIzg7vq.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-
|
|
12
|
+
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-DFj1Btk-.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";
|
package/dist/commands/git.js
CHANGED
|
@@ -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-
|
|
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-ax3xtNoz.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as fetchReport, a as handler, s as renderReport } from "../_chunks/incidents-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as fetchReport, a as handler, s as renderReport } from "../_chunks/incidents-BSFkUu1P.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { r as auth_exports } from "../_chunks/auth-
|
|
1
|
+
import { r as auth_exports } from "../_chunks/auth-DY5Bm7Ym.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
5
|
import { o as env_exports } from "../_chunks/env-DxcO3oJk.js";
|
|
6
|
-
import { c as config_exports } from "../_chunks/config-
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-DFj1Btk-.js";
|
|
7
7
|
import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
|
|
8
|
-
import { a as link_exports } from "../_chunks/link-
|
|
8
|
+
import { a as link_exports } from "../_chunks/link-Z2_mLhVn.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-
|
|
15
|
+
import { n as checkout_exports } from "../_chunks/checkout-DZa--fO4.js";
|
|
16
16
|
import { o as claim_exports } from "../_chunks/claim-Dv5wARrN.js";
|
|
17
17
|
import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
18
|
-
import { a as credentials_exports } from "../_chunks/credentials-
|
|
19
|
-
import { r as data_api_exports } from "../_chunks/data_api-
|
|
18
|
+
import { a as credentials_exports } from "../_chunks/credentials-KV1jlK-n.js";
|
|
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-
|
|
22
|
-
import { s as dev_exports } from "../_chunks/dev-
|
|
21
|
+
import { r as deploy_exports } from "../_chunks/deploy-CVJIahZE.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-CtIzg7vq.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-
|
|
28
|
-
import { o as incidents_exports } from "../_chunks/incidents-
|
|
29
|
-
import { a as init_exports } from "../_chunks/init-
|
|
27
|
+
import { o as git_exports } from "../_chunks/git-ax3xtNoz.js";
|
|
28
|
+
import { o as incidents_exports } from "../_chunks/incidents-BSFkUu1P.js";
|
|
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";
|
|
@@ -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-BhR1vUFM.js";
|
|
40
|
-
import { o as profile_exports } from "../_chunks/profile-
|
|
40
|
+
import { o as profile_exports } from "../_chunks/profile-Qoyql0AR.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-
|
|
44
|
+
import { a as status_exports } from "../_chunks/status-DRWS1u6H.js";
|
|
45
45
|
import { d as triggers_exports } from "../_chunks/triggers-m3IBjiph.js";
|
|
46
|
-
import { s as user_exports } from "../_chunks/user-
|
|
46
|
+
import { s as user_exports } from "../_chunks/user-C1pTJS9O.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 = [
|
package/dist/commands/init.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/init-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/init-BSwLzxjX.js";
|
package/dist/commands/link.js
CHANGED
|
@@ -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-
|
|
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-Z2_mLhVn.js";
|
package/dist/commands/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-Qoyql0AR.js";
|
package/dist/commands/status.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-DRWS1u6H.js";
|
package/dist/commands/user.js
CHANGED
|
@@ -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-
|
|
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";
|
package/dist/dev/runtime.js
CHANGED
|
@@ -20,7 +20,7 @@ const resolveFetchHandler = (mod) => {
|
|
|
20
20
|
return (req) => target.fetch(req);
|
|
21
21
|
}
|
|
22
22
|
if (isFunction(defaultExport)) return defaultExport;
|
|
23
|
-
throw new Error("No request handler found in the source module. Export one of:\n
|
|
23
|
+
throw new Error("No request handler found in the source module. Export one of:\n const handler = { fetch(req) { /* ... */ } }; export default handler;\n export default function handler(req) { /* ... */ }");
|
|
24
24
|
};
|
|
25
25
|
const hasUpgradeMethod = (value) => typeof value === "object" && value !== null && "upgrade" in value && typeof value.upgrade === "function";
|
|
26
26
|
/**
|
|
@@ -25,7 +25,7 @@ const routes: Record<
|
|
|
25
25
|
${operations.map((operation, index) => `\t${JSON.stringify(routeOf(operation))}: op${index},`).join("\n")}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const handler = {
|
|
29
29
|
\tfetch(request: Request): Response | Promise<Response> {
|
|
30
30
|
\t\tconst { pathname } = new URL(request.url);
|
|
31
31
|
\t\tconst route = routes[pathname];
|
|
@@ -38,6 +38,8 @@ export default {
|
|
|
38
38
|
\t\treturn route.fetch(request);
|
|
39
39
|
\t},
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
export default handler;
|
|
41
43
|
`;
|
|
42
44
|
};
|
|
43
45
|
const sourceOf = (loaded, path) => {
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { NETWORK_ERROR_MESSAGE, isNetworkError, matchErrorCode } from "./errors.
|
|
|
9
9
|
import { analyticsMiddleware, closeAnalytics, initAnalyticsClientMiddleware, isAnalyticsActive, recordCommandSuccessExtras, sendError, takeCommandSuccessExtras, trackCommandSuccess } from "./analytics.js";
|
|
10
10
|
import { AuthRefreshError, defaultClientID } from "./auth.js";
|
|
11
11
|
import { getCliName } from "./utils/cli_name.js";
|
|
12
|
-
import { c as ensureAuth } from "./_chunks/auth-
|
|
12
|
+
import { c as ensureAuth } from "./_chunks/auth-DY5Bm7Ym.js";
|
|
13
13
|
import { recoverFrom401 } from "./auth_recovery.js";
|
|
14
14
|
import { UsageError, failOnUsageError, isBareParentCommand, showHelp, showUsageErrorHelp } from "./help.js";
|
|
15
15
|
import { lazyCommands, preloadCommand } from "./commands/manifest.js";
|
package/dist/init/auth.js
CHANGED
|
@@ -2,7 +2,7 @@ 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-
|
|
5
|
+
import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-DY5Bm7Ym.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
7
|
import { c as pull } from "../_chunks/env-DxcO3oJk.js";
|
|
8
8
|
import { c as setupNeonMcp } from "../_chunks/mcp-SvqWzHnT.js";
|
package/dist/init/chrome.js
CHANGED
|
@@ -105,6 +105,7 @@ const configSummaryLabel = (summary) => {
|
|
|
105
105
|
};
|
|
106
106
|
const configRowValue = (config, filename) => {
|
|
107
107
|
if (config === "created") return "neon.ts created";
|
|
108
|
+
if (config === "seeded") return "neon.ts created from the linked branch";
|
|
108
109
|
if (config === "existing") return `existing ${filename ?? "Neon config"} preserved`;
|
|
109
110
|
if (config === "skipped" || config === null) return "skipped";
|
|
110
111
|
return config;
|
package/dist/init/copy.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pluginsCommandProblemText } from "../plugins/targets.js";
|
|
|
4
4
|
const INIT_SUBTITLE = "Set up coding agents and this directory for Neon.";
|
|
5
5
|
const MODE_MESSAGE = "How would you like to set up Neon?";
|
|
6
6
|
const MODE_RECOMMENDED_TITLE = "Recommended setup";
|
|
7
|
-
const MODE_RECOMMENDED_DESCRIPTION = "Set up detected agents, link a project, and add
|
|
7
|
+
const MODE_RECOMMENDED_DESCRIPTION = "Set up detected agents, link a project, and add neon.ts in this directory.";
|
|
8
8
|
const MODE_CUSTOM_TITLE = "Custom setup";
|
|
9
9
|
const MODE_CUSTOM_DESCRIPTION = "Choose agent tooling, project setup, and the services declared in neon.ts.";
|
|
10
10
|
const AGENT_SETUP_MESSAGE = "How should Neon be added to your coding agents?";
|
package/dist/init/deploy.js
CHANGED
|
@@ -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-
|
|
3
|
+
import { c as ensureAuth } from "../_chunks/auth-DY5Bm7Ym.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-
|
|
7
|
+
import { r as applyCmd } from "../_chunks/config-DFj1Btk-.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-
|
|
5
|
+
import { c as ensureAuth } from "../_chunks/auth-DY5Bm7Ym.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { s as runLink } from "../_chunks/link-
|
|
7
|
+
import { s as runLink } from "../_chunks/link-Z2_mLhVn.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.");
|
|
@@ -19,15 +19,14 @@ const runAuthenticatedLink = async (props) => {
|
|
|
19
19
|
};
|
|
20
20
|
await ensureAuth(authenticated);
|
|
21
21
|
try {
|
|
22
|
-
await runLink(authenticated);
|
|
23
|
-
return;
|
|
22
|
+
return await runLink(authenticated);
|
|
24
23
|
} catch (error) {
|
|
25
24
|
if (!isUnauthorized(error)) throw error;
|
|
26
25
|
if (!await recoverFrom401(true)) throw authenticationFailed();
|
|
27
26
|
}
|
|
28
27
|
await ensureAuth(authenticated);
|
|
29
28
|
try {
|
|
30
|
-
await runLink(authenticated);
|
|
29
|
+
return await runLink(authenticated);
|
|
31
30
|
} catch (error) {
|
|
32
31
|
if (!isUnauthorized(error)) throw error;
|
|
33
32
|
await recoverFrom401(false);
|
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-
|
|
18
|
-
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-
|
|
17
|
+
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-DFj1Btk-.js";
|
|
18
|
+
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-Z2_mLhVn.js";
|
|
19
19
|
import { runAuthenticatedLink } from "./link.js";
|
|
20
20
|
import { mcpInstallableAgents } from "../mcp/targets.js";
|
|
21
21
|
import { skillsInstallableAgents } from "../skills/targets.js";
|
|
@@ -137,6 +137,7 @@ const defaultInitConfig = async (input) => {
|
|
|
137
137
|
...input.project.auth.clientId !== void 0 ? { clientId: input.project.auth.clientId } : {}
|
|
138
138
|
};
|
|
139
139
|
} catch (error) {
|
|
140
|
+
if (input.fromBranch) throw error;
|
|
140
141
|
log.warning("Couldn't authenticate to read the Data API on the linked branch (%s); declaring it with Neon Auth.", error instanceof Error ? error.message : String(error));
|
|
141
142
|
}
|
|
142
143
|
await initCmd({
|
|
@@ -144,6 +145,7 @@ const defaultInitConfig = async (input) => {
|
|
|
144
145
|
install: input.install,
|
|
145
146
|
silent: true,
|
|
146
147
|
requireInstall: true,
|
|
148
|
+
...input.fromBranch ? { fromBranch: true } : {},
|
|
147
149
|
...input.services !== void 0 ? { services: input.services } : {},
|
|
148
150
|
...input.packageManager !== void 0 ? { packageManager: input.packageManager } : {},
|
|
149
151
|
...project
|
|
@@ -415,6 +417,7 @@ const runInit = async (props) => {
|
|
|
415
417
|
step = "link";
|
|
416
418
|
let projectSetup = "skip";
|
|
417
419
|
let claimExpiresAt;
|
|
420
|
+
let linkedExisting = false;
|
|
418
421
|
const noLink = props.link === false;
|
|
419
422
|
const linkByDefault = detection.authenticated || hasExplicitLinkInputs && !yes;
|
|
420
423
|
if (noLink) {
|
|
@@ -479,7 +482,7 @@ const runInit = async (props) => {
|
|
|
479
482
|
} else if (projectSetup === "link") {
|
|
480
483
|
step = "link";
|
|
481
484
|
printInitProgress(detection.authenticated ? PROGRESS.link : PROGRESS.auth);
|
|
482
|
-
await (props.linkProject ?? runAuthenticatedLink)(linkProps);
|
|
485
|
+
linkedExisting = (await (props.linkProject ?? runAuthenticatedLink)(linkProps))?.created === false;
|
|
483
486
|
funnel.link = "linked";
|
|
484
487
|
}
|
|
485
488
|
const pinnedOffline = funnel.link === "skipped" && !noLink && linkInputs.orgId !== void 0 && linkInputs.projectId !== void 0 && linkInputs.branch !== void 0 && linkInputs.projectName === void 0 && linkInputs.regionId === void 0;
|
|
@@ -538,14 +541,15 @@ const runInit = async (props) => {
|
|
|
538
541
|
});
|
|
539
542
|
const accepted = configResolution.kind === "ask" ? await (props.pickConfig ?? pickInitConfigInteractively)() : void 0;
|
|
540
543
|
let configPlan = configPlanFromResolution(configResolution, accepted);
|
|
541
|
-
|
|
544
|
+
const seedFromBranch = configPlan.kind === "write" && !existingConfig && linkedExisting && servicesFlag === void 0;
|
|
545
|
+
if (configPlan.kind === "write" && !existingConfig && !seedFromBranch && configPlan.services === void 0 && !recommended && servicesFlag === void 0 && (detection.interactive || props.pickServices !== void 0)) {
|
|
542
546
|
const picked = await (props.pickServices ?? pickInitServicesInteractively)();
|
|
543
547
|
configPlan = {
|
|
544
548
|
kind: "write",
|
|
545
549
|
services: picked.length === 0 ? ["postgres"] : picked
|
|
546
550
|
};
|
|
547
551
|
}
|
|
548
|
-
if (recommended && configPlan.kind === "write" && !existingConfig) configPlan = {
|
|
552
|
+
if (recommended && configPlan.kind === "write" && !existingConfig && !seedFromBranch) configPlan = {
|
|
549
553
|
kind: "write",
|
|
550
554
|
services: servicesFlag ?? ["postgres"]
|
|
551
555
|
};
|
|
@@ -555,8 +559,9 @@ const runInit = async (props) => {
|
|
|
555
559
|
let selectedServices = null;
|
|
556
560
|
const linkDeferredPull = deferLinkPull && projectSetup === "link" && funnel.link === "linked";
|
|
557
561
|
if (configPlan.kind === "write") {
|
|
558
|
-
const planned = existingConfig ? void 0 : configPlan.services ?? ["postgres"];
|
|
559
|
-
if (
|
|
562
|
+
const planned = existingConfig || seedFromBranch ? void 0 : configPlan.services ?? ["postgres"];
|
|
563
|
+
if (seedFromBranch) wroteNewFile = true;
|
|
564
|
+
else if (planned !== void 0) {
|
|
560
565
|
declared = parseConfigInitServices(planned);
|
|
561
566
|
extraServices = declared.length > 0;
|
|
562
567
|
selectedServices = expandTelemetryServices(declared);
|
|
@@ -571,7 +576,7 @@ const runInit = async (props) => {
|
|
|
571
576
|
}
|
|
572
577
|
if (!existingConfig) printInitProgress(PROGRESS.config);
|
|
573
578
|
printInitProgress(PROGRESS.install(pm));
|
|
574
|
-
const readableProject = funnel.link !== "skipped" && !pinnedOffline && declared.includes("data-api") ? readContextFile(contextFile) : void 0;
|
|
579
|
+
const readableProject = funnel.link !== "skipped" && !pinnedOffline && (seedFromBranch || declared.includes("data-api")) ? readContextFile(contextFile) : void 0;
|
|
575
580
|
const readableBranch = readableProject !== void 0 ? contextBranch(readableProject) : void 0;
|
|
576
581
|
try {
|
|
577
582
|
await (props.initConfig ?? defaultInitConfig)({
|
|
@@ -579,6 +584,7 @@ const runInit = async (props) => {
|
|
|
579
584
|
install: true,
|
|
580
585
|
packageManager: pm,
|
|
581
586
|
...planned !== void 0 ? { services: planned } : {},
|
|
587
|
+
...seedFromBranch ? { fromBranch: true } : {},
|
|
582
588
|
...typeof readableProject?.projectId === "string" ? { project: {
|
|
583
589
|
projectId: readableProject.projectId,
|
|
584
590
|
...readableBranch !== void 0 ? { branch: readableBranch } : {},
|
|
@@ -600,7 +606,7 @@ const runInit = async (props) => {
|
|
|
600
606
|
}
|
|
601
607
|
throw error;
|
|
602
608
|
}
|
|
603
|
-
funnel.config = existingConfig ? "existing" : "created";
|
|
609
|
+
funnel.config = existingConfig ? "existing" : seedFromBranch ? "seeded" : "created";
|
|
604
610
|
} else funnel.config = "skipped";
|
|
605
611
|
const context = readContextFile(contextFile);
|
|
606
612
|
const branch = contextBranch(context);
|
|
@@ -657,7 +663,7 @@ const runInit = async (props) => {
|
|
|
657
663
|
}
|
|
658
664
|
}
|
|
659
665
|
const pendingUnauthed = funnel.link === "skipped" && !noLink;
|
|
660
|
-
const pendingServices =
|
|
666
|
+
const pendingServices = linked && declared.some((service) => service !== "ai-gateway" || envPullPlan.kind === "skip");
|
|
661
667
|
const pendingClaimable = funnel.link === "claimable" && claimExpiresAt !== void 0;
|
|
662
668
|
const pendingExisting = funnel.config === "existing" && linked && !wroteNewFile;
|
|
663
669
|
const pending = pinnedOffline || pendingUnauthed || pendingServices || pendingClaimable && extraServices || pendingExisting;
|
|
@@ -14,7 +14,9 @@ import which from "which";
|
|
|
14
14
|
* **`detect*` may return undefined, `resolve*` never does**, and `inferPackageManager` is the
|
|
15
15
|
* composed detector for callers that can prompt rather than guess.
|
|
16
16
|
*
|
|
17
|
-
* - {@link detectProjectPackageManager} — lockfile walk from `cwd` up to the repo root
|
|
17
|
+
* - {@link detectProjectPackageManager} — lockfile walk from `cwd` up to the repo root; the
|
|
18
|
+
* project's pin or pnpm layout, then PATH, breaks the tie when one directory has lockfiles
|
|
19
|
+
* from several managers
|
|
18
20
|
* - {@link detectInvokingPackageManager} — the tool that launched us (`npx`, `pnpm dlx`, …)
|
|
19
21
|
* - {@link inferPackageManager} — project, then invocation, or nothing (when there is
|
|
20
22
|
* something to ask the user, an unanswerable guess is worse than a prompt)
|
|
@@ -42,7 +44,8 @@ const PACKAGE_MANAGERS = [
|
|
|
42
44
|
/**
|
|
43
45
|
* Lockfiles, and the package manager each one belongs to. npm is last on
|
|
44
46
|
* purpose: a repo with both a pnpm lockfile and a leftover `package-lock.json`
|
|
45
|
-
* (which
|
|
47
|
+
* (which running npm in a pnpm repo leaves behind) is a pnpm repo, unless pnpm
|
|
48
|
+
* is not installed and nothing binds the repo to it.
|
|
46
49
|
*/
|
|
47
50
|
const LOCKFILES = [
|
|
48
51
|
["pnpm-lock.yaml", "pnpm"],
|
|
@@ -52,8 +55,32 @@ const LOCKFILES = [
|
|
|
52
55
|
["package-lock.json", "npm"],
|
|
53
56
|
["npm-shrinkwrap.json", "npm"]
|
|
54
57
|
];
|
|
58
|
+
/**
|
|
59
|
+
* The package manager `dir` is already bound to: its `packageManager` pin, or pnpm for a
|
|
60
|
+
* pnpm workspace or a `node_modules` in pnpm's layout, which npm must never run against.
|
|
61
|
+
*/
|
|
62
|
+
const boundPackageManager = (dir) => {
|
|
63
|
+
const pinned = readManifest(dir)?.packageManager;
|
|
64
|
+
if (typeof pinned === "string") {
|
|
65
|
+
const name = pinned.split("@")[0];
|
|
66
|
+
const pm = PACKAGE_MANAGERS.find((candidate) => candidate === name);
|
|
67
|
+
if (pm !== void 0) return pm;
|
|
68
|
+
}
|
|
69
|
+
return existsSync(join(dir, "pnpm-workspace.yaml")) || existsSync(join(dir, "node_modules", ".pnpm")) ? "pnpm" : void 0;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* The package manager behind `dir`'s lockfiles. Lockfiles from several managers are common
|
|
73
|
+
* in app-builder exports (`bun.lockb` beside `package-lock.json`), which are then installed
|
|
74
|
+
* with whichever one the machine has, so the first one on PATH wins unless the project is
|
|
75
|
+
* bound to one. With none of them installed, the first stays the answer and the install
|
|
76
|
+
* fails naming it.
|
|
77
|
+
*/
|
|
55
78
|
const lockfileIn = (dir) => {
|
|
56
|
-
|
|
79
|
+
const candidates = [...new Set(LOCKFILES.filter(([file]) => existsSync(join(dir, file))).map(([, pm]) => pm))];
|
|
80
|
+
if (candidates.length <= 1) return candidates[0];
|
|
81
|
+
const bound = boundPackageManager(dir);
|
|
82
|
+
if (bound !== void 0 && candidates.includes(bound)) return bound;
|
|
83
|
+
return candidates.find((pm) => which.sync(pm, { nothrow: true }) !== null) ?? candidates[0];
|
|
57
84
|
};
|
|
58
85
|
/** `.git` is a file rather than a directory in a worktree or a submodule. */
|
|
59
86
|
const isRepoRoot = (dir) => existsSync(join(dir, ".git"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
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/config": "1.
|
|
77
|
-
"@neon/config-runtime": "1.12.7",
|
|
76
|
+
"@neon/config-runtime": "1.12.8",
|
|
78
77
|
"@neon/realtime": "0.2.1",
|
|
79
|
-
"@neon/sdk": "7.14.
|
|
78
|
+
"@neon/sdk": "7.14.3",
|
|
79
|
+
"@neon/config": "1.14.5"
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
82
|
"@napi-rs/keyring": "1.3.0",
|
|
@@ -113,9 +113,9 @@
|
|
|
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.55",
|
|
117
|
-
"@neon/env": "2.1.7",
|
|
118
116
|
"@neon/e2e-harness": "0.0.0",
|
|
117
|
+
"@neon-internals/env-core": "0.0.56",
|
|
118
|
+
"@neon/env": "2.1.8",
|
|
119
119
|
"@neon/functions": "0.11.0"
|
|
120
120
|
},
|
|
121
121
|
"publishConfig": {
|