neon 9.9.4 → 9.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/_chunks/{checkout-D9CSqjde.js → checkout-CczPpuT9.js} +5 -4
- package/dist/_chunks/{claim-Dzsw8sdd.js → claim-BoN9NPTy.js} +1 -1
- package/dist/_chunks/{config-CtP-1YSw.js → config-C8BQIoM2.js} +1 -1
- package/dist/_chunks/{deploy-DQNsheXC.js → deploy-BdipMGJE.js} +1 -1
- package/dist/_chunks/{dev-EmQkh84H.js → dev-DVB7fGiG.js} +2 -2
- package/dist/_chunks/{env-CFBmcKyo.js → env-BWvi2_2f.js} +75 -31
- package/dist/_chunks/{env-aWCqnWaF.js → env-C3HQJO8Z.js} +34 -8
- package/dist/_chunks/{git-DJ-QP4YF.js → git-BZY1WeAw.js} +2 -2
- package/dist/_chunks/{link-Caoa3_y8.js → link-BVa6Nfji.js} +2 -2
- package/dist/_chunks/{plugins-BwUZQ6Ic.js → plugins-CEylQlgK.js} +6 -2
- package/dist/_chunks/{status-DLH8CtHh.js → status-BBnw48qR.js} +1 -1
- package/dist/commands/checkout.js +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env_output.js +3 -1
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +10 -10
- package/dist/commands/link.js +1 -1
- package/dist/commands/plugins.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/dev/env.js +1 -1
- package/dist/errors.js +1 -0
- package/dist/init/auth.js +1 -1
- package/dist/init/choices.js +6 -8
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +5 -4
- package/dist/init/tooling.js +1 -1
- package/dist/plugins/plan.js +7 -1
- package/dist/plugins/targets.js +48 -25
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -507,7 +507,7 @@ The branch argument is **optional**: run `neon checkout` with no branch in an in
|
|
|
507
507
|
Branch **id vs name** is detected automatically (a `br-…` value is treated as an id):
|
|
508
508
|
|
|
509
509
|
- **id** — matched strictly by id. A non-existent id is a hard "not found" error (ids are server-assigned, so checkout never creates one, including with `--create`).
|
|
510
|
-
- **name** — matched by name. If the name doesn't exist, pass `--create` to create it (equivalent to `neon branch create --name <name>`: branched from the project's default branch with a read-write compute, or from `neon.ts` when that file is present), then check it out. `--create`
|
|
510
|
+
- **name** — matched by name. If the name doesn't exist, pass `--create` to create it (equivalent to `neon branch create --name <name>`: branched from the project's default branch with a read-write compute, or from `neon.ts` when that file is present), then check it out. When the name already exists, `--create` checks out that branch unchanged and prints a `WARNING:` line saying nothing was created; the exit code stays 0. Without `--create`, an interactive terminal offers to create the branch; in CI or with no TTY the error names `--create`.
|
|
511
511
|
|
|
512
512
|
The project is resolved through the standard neon chain, each entry winning over the next:
|
|
513
513
|
|
|
@@ -527,6 +527,10 @@ $ neon checkout dev --create --project-id polished-snowflake-12345678
|
|
|
527
527
|
Created branch dev (br-dev-branch-12345678).
|
|
528
528
|
Checked out branch br-dev-branch-12345678 on project polished-snowflake-12345678. Updated /path/to/cwd/.neon.
|
|
529
529
|
|
|
530
|
+
$ neon checkout dev --create --project-id polished-snowflake-12345678
|
|
531
|
+
WARNING: Branch dev (br-dev-branch-12345678) already exists, so --create did not create a new one; checking out the existing branch unchanged. Pass a new name for a fresh branch.
|
|
532
|
+
Checked out branch br-dev-branch-12345678 on project polished-snowflake-12345678. Updated /path/to/cwd/.neon.
|
|
533
|
+
|
|
530
534
|
$ cat .neon
|
|
531
535
|
{
|
|
532
536
|
"orgId": "org-abc123",
|
|
@@ -638,7 +642,14 @@ auth env vars to pull. Provision it first (`neon deploy`, `neon config apply`, o
|
|
|
638
642
|
Console), or drop auth from --service.
|
|
639
643
|
```
|
|
640
644
|
|
|
641
|
-
`link`, `checkout`, and `config apply` invoke `env pull` automatically (see above). Those bundled pulls follow rules 2 and 3 above
|
|
645
|
+
`link`, `checkout`, and `config apply` invoke `env pull` automatically (see above). Those bundled pulls follow rules 2 and 3 above, with two differences:
|
|
646
|
+
|
|
647
|
+
- **The AI Gateway only when the file already has `NEON_AI_GATEWAY_*`.** Minting a credential for a service you never named isn't something a side effect of another command should do; once you run `neon env pull`, later bundled pulls keep the gateway current, so `checkout` moves it to the new branch.
|
|
648
|
+
- **No Object Storage when the file holds a value for `AWS_ACCESS_KEY_ID` or `AWS_SECRET_ACCESS_KEY` without a Neon `AWS_ENDPOINT_URL_S3`.** Those keys are your own (AWS, R2, MinIO), and writing would overwrite them. The summary says so:
|
|
649
|
+
|
|
650
|
+
```text
|
|
651
|
+
Not pulled Object Storage, to keep the AWS_* keys already in .env. Use `neon env pull -s object-storage` to replace them.
|
|
652
|
+
```
|
|
642
653
|
|
|
643
654
|
If you'd rather not keep env vars on disk, inject them at runtime instead with `neon-env run -- <your dev command>` (from `@neon/env`) or `neon dev`, and pass `--no-env-pull` to `link` / `checkout`.
|
|
644
655
|
|
|
@@ -925,7 +936,7 @@ Without a TTY, pass `-y` or enough flags to answer every question. `-y` alone is
|
|
|
925
936
|
|
|
926
937
|
`--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.
|
|
927
938
|
|
|
928
|
-
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.
|
|
939
|
+
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. Auth, the Data API, Object Storage, and Realtime need a deploy unless the branch already has them: init pulls each one the branch has and skips the others. `neon deploy` provisions the rest and pulls their env vars. An existing `neon.ts` is pulled by `link` as usual.
|
|
929
940
|
|
|
930
941
|
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.
|
|
931
942
|
|
|
@@ -12,9 +12,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
|
|
|
12
12
|
import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
|
|
13
13
|
import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
|
|
14
14
|
import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
|
|
15
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
16
|
-
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-
|
|
17
|
-
import { i as handler$1 } from "./link-
|
|
15
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.js";
|
|
16
|
+
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-C8BQIoM2.js";
|
|
17
|
+
import { i as handler$1 } from "./link-BVa6Nfji.js";
|
|
18
18
|
import chalk from "chalk";
|
|
19
19
|
import prompts from "prompts";
|
|
20
20
|
// src/commands/checkout.ts
|
|
@@ -50,7 +50,7 @@ const builder = (argv) => argv.usage("$0 checkout [id|name] [options]").position
|
|
|
50
50
|
default: true
|
|
51
51
|
},
|
|
52
52
|
create: {
|
|
53
|
-
describe: "Create the named branch if it does not exist, then check it out",
|
|
53
|
+
describe: "Create the named branch if it does not exist, then check it out. New branches start from the parent set in neon.ts, else the project's default branch. An existing branch is checked out unchanged.",
|
|
54
54
|
type: "boolean",
|
|
55
55
|
default: false
|
|
56
56
|
},
|
|
@@ -106,6 +106,7 @@ const handler = async (props) => {
|
|
|
106
106
|
cwd
|
|
107
107
|
});
|
|
108
108
|
const orgId = await (orgRead ?? resolveOrgId(props, projectId));
|
|
109
|
+
if (props.create && !created) log.warning("Branch %s (%s) already exists, so --create did not create a new one; checking out the existing branch unchanged. Pass a new name for a fresh branch.", branchName, branchId);
|
|
109
110
|
applyContext(props.contextFile, {
|
|
110
111
|
projectId,
|
|
111
112
|
...orgId ? { orgId } : {},
|
|
@@ -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-
|
|
15
|
+
import { c as pull } from "./env-C3HQJO8Z.js";
|
|
16
16
|
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
17
17
|
import open from "open";
|
|
18
18
|
import prompts from "prompts";
|
|
@@ -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-
|
|
29
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.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-
|
|
3
|
+
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-C8BQIoM2.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({
|
|
@@ -6,8 +6,8 @@ import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file
|
|
|
6
6
|
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
|
-
import { a as resolveDevEnv } from "./env-
|
|
10
|
-
import { f as envFlag } from "./config-
|
|
9
|
+
import { a as resolveDevEnv } from "./env-BWvi2_2f.js";
|
|
10
|
+
import { f as envFlag } from "./config-C8BQIoM2.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";
|
|
@@ -382,7 +382,8 @@ const resolveClaimableNeonEnvVars = async (ctx) => {
|
|
|
382
382
|
* buckets) into a config, then `fetchEnv` resolves what is actually enabled —
|
|
383
383
|
* so a branch with a bucket gets its `AWS_*` storage vars pulled with no policy. With
|
|
384
384
|
* {@link DevEnvContext.implyAiGateway}, the AI Gateway is added on top, since
|
|
385
|
-
* `pullConfig` cannot read it back.
|
|
385
|
+
* `pullConfig` cannot read it back. {@link DevEnvContext.secretServices} narrows the
|
|
386
|
+
* credential-backed services.
|
|
386
387
|
* 3. otherwise -> throw {@link MissingBranchContextError}.
|
|
387
388
|
*
|
|
388
389
|
* {@link DevEnvContext.claimable} keeps the same precedence. Credentials are not
|
|
@@ -415,15 +416,35 @@ const resolveNeonEnvVars = async (ctx) => {
|
|
|
415
416
|
protected: pulled.branch.protected,
|
|
416
417
|
...pulled.branch.expiresAt ? { expiresAt: pulled.branch.expiresAt } : {}
|
|
417
418
|
};
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
const { config, withheld } = withholdSecretServices(pulled.config, ctx.secretServices);
|
|
420
|
+
const resolved = ctx.implyAiGateway || (ctx.secretServices?.includes("ai-gateway") ?? false) ? await resolveWithImpliedGateway(config, ctx, {
|
|
420
421
|
projectId: ctx.projectId,
|
|
421
422
|
branchId: ctx.branchId,
|
|
422
|
-
resolvedBranch
|
|
423
|
-
|
|
423
|
+
resolvedBranch,
|
|
424
|
+
revokeSuperseded: ctx.secretServices === void 0 || config.preview?.buckets !== void 0
|
|
425
|
+
}) : await fetchAndProject(config, ctx, { resolvedBranch });
|
|
426
|
+
return withheld.length > 0 ? {
|
|
427
|
+
...resolved,
|
|
428
|
+
withheld
|
|
429
|
+
} : resolved;
|
|
424
430
|
}
|
|
425
431
|
throw new MissingBranchContextError(`No project/branch context found. Link a branch (\`${getCliName()} link\` / \`${getCliName()} checkout\`) or pass --project-id and --branch.`);
|
|
426
432
|
};
|
|
433
|
+
/** Drop the read-back object storage when `keep` does not name it. */
|
|
434
|
+
const withholdSecretServices = (config, keep) => {
|
|
435
|
+
if (keep === void 0 || keep.includes("object-storage") || config.preview?.buckets === void 0) return {
|
|
436
|
+
config,
|
|
437
|
+
withheld: []
|
|
438
|
+
};
|
|
439
|
+
const { buckets: _, ...preview } = config.preview;
|
|
440
|
+
return {
|
|
441
|
+
config: {
|
|
442
|
+
...config,
|
|
443
|
+
preview
|
|
444
|
+
},
|
|
445
|
+
withheld: ["object-storage"]
|
|
446
|
+
};
|
|
447
|
+
};
|
|
427
448
|
/** The same config with the AI Gateway enabled, leaving any other `preview` entries intact. */
|
|
428
449
|
const withAiGateway = (config) => ({
|
|
429
450
|
...config,
|
|
@@ -456,7 +477,10 @@ const withAiGateway = (config) => ({
|
|
|
456
477
|
*/
|
|
457
478
|
const resolveWithImpliedGateway = async (config, ctx, branch) => {
|
|
458
479
|
const unreachable = await credentialsUnreachable(ctx, branch);
|
|
459
|
-
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, {
|
|
480
|
+
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, {
|
|
481
|
+
resolvedBranch: branch.resolvedBranch,
|
|
482
|
+
...branch.revokeSuperseded === false ? { revokeSuperseded: false } : {}
|
|
483
|
+
});
|
|
460
484
|
log.warning(`Could not reach the AI Gateway's credentials, so %s were not resolved. Everything else was. Either this project does not have the AI Gateway, or the call failed — \`${getCliName()} env pull -s ai-gateway\` will say which.\nDetails: %s`, [NEON_ENV_VAR_KEYS.aiGateway.apiKey, NEON_ENV_VAR_KEYS.aiGateway.baseUrl].join(" and "), unreachable);
|
|
461
485
|
const pulled = await fetchAndProject(config, ctx, { resolvedBranch: branch.resolvedBranch });
|
|
462
486
|
return {
|
|
@@ -497,15 +521,20 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
497
521
|
const selectedKeys = envKeysForSelection(directServices, envKeys);
|
|
498
522
|
const api = apiFor(ctx);
|
|
499
523
|
const has = (service) => services.includes(service);
|
|
524
|
+
const optional = ctx.optionalServices ?? [];
|
|
525
|
+
const read = (service, load, absent) => optional.includes(service) ? absentWhenUnavailable(load, absent) : load();
|
|
500
526
|
const checkAiGateway = has("ai-gateway") && !selectedKeys.includes(NEON_ENV_VAR_KEYS.aiGateway.apiKey);
|
|
501
527
|
const [auth, dataApiEnabled, realtime, buckets, aiGatewayAvailable] = await Promise.all([
|
|
502
|
-
has("auth") ? api.getNeonAuth(projectId, branchId) : null,
|
|
503
|
-
has("data-api") ? readDataApiEnabled(api, projectId, branchId) : null,
|
|
504
|
-
has("realtime") ? readRealtime(api, projectId, branchId)
|
|
505
|
-
|
|
528
|
+
has("auth") ? read("auth", () => api.getNeonAuth(projectId, branchId), null) : null,
|
|
529
|
+
has("data-api") ? read("data-api", () => readDataApiEnabled(api, projectId, branchId), false) : null,
|
|
530
|
+
has("realtime") ? read("realtime", () => readRealtime(api, projectId, branchId), {
|
|
531
|
+
enabled: false,
|
|
532
|
+
pending: false
|
|
533
|
+
}) : null,
|
|
534
|
+
has("object-storage") ? read("object-storage", () => api.listBranchBuckets(projectId, branchId), []) : null,
|
|
506
535
|
checkAiGateway ? readAiGatewayAvailable(api, projectId, branchId) : null
|
|
507
536
|
]);
|
|
508
|
-
const config = configForServices(services, branchId, {
|
|
537
|
+
const { config, skipped } = configForServices(services, branchId, {
|
|
509
538
|
authEnabled: auth !== null,
|
|
510
539
|
dataApiEnabled,
|
|
511
540
|
realtimeEnabled: realtime === null ? false : realtime.enabled || realtime.pending,
|
|
@@ -513,12 +542,29 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
513
542
|
aiGatewayAvailable: aiGatewayAvailable ?? true
|
|
514
543
|
}, {
|
|
515
544
|
directServices,
|
|
516
|
-
envKeys
|
|
545
|
+
envKeys,
|
|
546
|
+
optional
|
|
517
547
|
});
|
|
518
|
-
|
|
548
|
+
const resolved = await fetchAndProject(config, ctx, {
|
|
519
549
|
keys: selectedKeys,
|
|
520
550
|
revokeSuperseded: false
|
|
521
551
|
});
|
|
552
|
+
return skipped.length > 0 ? {
|
|
553
|
+
...resolved,
|
|
554
|
+
skipped
|
|
555
|
+
} : resolved;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Read an optional service's live state, treating a feature the project or region lacks
|
|
559
|
+
* (`FeatureUnavailable`, or a route-level 404) as absent, as `pullConfig` does.
|
|
560
|
+
*/
|
|
561
|
+
const absentWhenUnavailable = async (load, absent) => {
|
|
562
|
+
try {
|
|
563
|
+
return await load();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
if (isPlatformError(error) && (error.code === ErrorCode.FeatureUnavailable || error.code === ErrorCode.NotFound && error.details.status === 404)) return absent;
|
|
566
|
+
throw error;
|
|
567
|
+
}
|
|
522
568
|
};
|
|
523
569
|
/**
|
|
524
570
|
* Whether the branch has a Data API integration — or `null` when that cannot be determined.
|
|
@@ -557,7 +603,7 @@ const NEON_DEFAULT_DATABASE = "neondb";
|
|
|
557
603
|
* {@link ServiceNotOnBranchError} for anything the branch does not have. Naming a service
|
|
558
604
|
* that isn't there has to fail rather than contribute no vars, or a scoped pull would report
|
|
559
605
|
* "no Neon env variables to pull" — which reads as a statement about the branch rather than
|
|
560
|
-
* about the selection.
|
|
606
|
+
* about the selection. An optional service the branch lacks is returned in `skipped` instead.
|
|
561
607
|
*/
|
|
562
608
|
const configForServices = (services, branchId, branch, selection) => {
|
|
563
609
|
const provisionWith = {
|
|
@@ -579,28 +625,26 @@ const configForServices = (services, branchId, branch, selection) => {
|
|
|
579
625
|
const names = selection.envKeys.filter((key) => serviceForEnvKey(key) === "ai-gateway").join(", ");
|
|
580
626
|
throw new ServiceNotOnBranchError(`--env ${names}: ${reason}, so ${names} cannot be pulled. Use another project, or drop ${names} from --env.`);
|
|
581
627
|
};
|
|
628
|
+
const skipped = [];
|
|
629
|
+
const onBranch = (service, present, what) => {
|
|
630
|
+
if (present) return true;
|
|
631
|
+
if (!selection.optional.includes(service)) notOnBranch(service, what);
|
|
632
|
+
skipped.push(service);
|
|
633
|
+
return false;
|
|
634
|
+
};
|
|
582
635
|
const config = {};
|
|
583
|
-
if (services.includes("auth"))
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
if (services.includes("data-api")) {
|
|
588
|
-
if (branch.dataApiEnabled === false) notOnBranch("data-api", "Data API integration");
|
|
589
|
-
config.dataApi = true;
|
|
590
|
-
}
|
|
591
|
-
if (services.includes("realtime")) {
|
|
592
|
-
if (!branch.realtimeEnabled) notOnBranch("realtime", "Realtime integration");
|
|
593
|
-
config.preview = { realtime: true };
|
|
594
|
-
}
|
|
595
|
-
if (services.includes("object-storage")) {
|
|
596
|
-
if (branch.buckets.length === 0) notOnBranch("object-storage", "object-storage buckets");
|
|
597
|
-
config.buckets = Object.fromEntries(branch.buckets.map((bucket) => [bucket.name, { access: bucket.accessLevel }]));
|
|
598
|
-
}
|
|
636
|
+
if (services.includes("auth") && onBranch("auth", branch.authEnabled, "Neon Auth integration")) config.auth = true;
|
|
637
|
+
if (services.includes("data-api") && onBranch("data-api", branch.dataApiEnabled !== false, "Data API integration")) config.dataApi = true;
|
|
638
|
+
if (services.includes("realtime") && onBranch("realtime", branch.realtimeEnabled, "Realtime integration")) config.preview = { realtime: true };
|
|
639
|
+
if (services.includes("object-storage") && onBranch("object-storage", branch.buckets.length > 0, "object-storage buckets")) config.buckets = Object.fromEntries(branch.buckets.map((bucket) => [bucket.name, { access: bucket.accessLevel }]));
|
|
599
640
|
if (services.includes("ai-gateway")) {
|
|
600
641
|
if (!branch.aiGatewayAvailable) aiGatewayUnavailable();
|
|
601
642
|
config.aiGateway = true;
|
|
602
643
|
}
|
|
603
|
-
return
|
|
644
|
+
return {
|
|
645
|
+
config,
|
|
646
|
+
skipped
|
|
647
|
+
};
|
|
604
648
|
};
|
|
605
649
|
/**
|
|
606
650
|
* `neon dev`'s env resolver: {@link resolveNeonEnvVars} with graceful degradation.
|
|
@@ -8,7 +8,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
10
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
11
|
-
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-
|
|
11
|
+
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-BWvi2_2f.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";
|
|
@@ -78,9 +78,10 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
78
78
|
"API. Naming unsupported services with --service / --env warns",
|
|
79
79
|
"and writes nothing for them.",
|
|
80
80
|
"",
|
|
81
|
-
"The pull bundled into link / checkout / config apply follows 2 and 3",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
81
|
+
"The pull bundled into link / checkout / config apply follows 2 and 3,",
|
|
82
|
+
"with the AI Gateway only when the file already has its variables. It",
|
|
83
|
+
"leaves Object Storage out when the file holds AWS_* keys that are not",
|
|
84
|
+
"Neon's, so it never overwrites them."
|
|
84
85
|
].join("\n")).example("$0 env pull", "Write the linked branch's Neon vars into .env.local (or .env if present)").example("$0 env pull --branch preview --file .env.preview", "Pull a specific branch into a specific file").example("$0 env pull -s ai-gateway -s postgres", "Pull only the AI Gateway and Postgres variables").example("$0 env pull -e DATABASE_URL", "Pull only the pooled Postgres connection string").example("$0 env pull -s auth -e DATABASE_URL", "Pull all Auth variables plus DATABASE_URL").example("$0 env pull -s functions", "Pull NEON_BRANCH_ID and NEON_FUNCTION_HOST_SUFFIX, which functionBaseUrl(\"<slug>\") from @neon/env reads").strict(), async (args) => {
|
|
85
86
|
const rawServices = servicesFlagValue(args.service);
|
|
86
87
|
const rawEnvKeys = envPullFlagValue(args.env);
|
|
@@ -145,7 +146,7 @@ const pull = async (props, opts = {}) => {
|
|
|
145
146
|
const targetPath = resolveEnvFilePath(location, props.file);
|
|
146
147
|
const fileExisted = existsSync(targetPath);
|
|
147
148
|
const existingEnv = fileExisted ? readEnvFile(targetPath) : {};
|
|
148
|
-
const { vars, credential, skipped } = await resolveNeonEnvVars({
|
|
149
|
+
const { vars, credential, skipped, withheld } = await resolveNeonEnvVars({
|
|
149
150
|
...location,
|
|
150
151
|
projectId: props.projectId,
|
|
151
152
|
branchId,
|
|
@@ -154,6 +155,8 @@ const pull = async (props, opts = {}) => {
|
|
|
154
155
|
...existingEnv
|
|
155
156
|
},
|
|
156
157
|
...props.services !== void 0 ? { services: props.services } : {},
|
|
158
|
+
...props.optionalServices !== void 0 ? { optionalServices: props.optionalServices } : {},
|
|
159
|
+
...opts.bundled ? { secretServices: bundledSecretServices(existingEnv) } : {},
|
|
157
160
|
...props.envKeys !== void 0 ? { envKeys: props.envKeys } : {},
|
|
158
161
|
...opts.implyAiGateway ? { implyAiGateway: true } : {},
|
|
159
162
|
omitUnsetFunctionEnv: true,
|
|
@@ -174,7 +177,8 @@ const pull = async (props, opts = {}) => {
|
|
|
174
177
|
written,
|
|
175
178
|
removed,
|
|
176
179
|
file: targetPath,
|
|
177
|
-
...credential && credential.keys.length > 0 ? { credential } : {}
|
|
180
|
+
...credential && credential.keys.length > 0 ? { credential } : {},
|
|
181
|
+
...withheld && withheld.length > 0 ? { withheld } : {}
|
|
178
182
|
}, cwd, namedBranch));
|
|
179
183
|
if (!fileExisted) ensureGitignored(targetPath);
|
|
180
184
|
const gatewayBaseUrl = neonVars.NEON_AI_GATEWAY_BASE_URL;
|
|
@@ -193,10 +197,29 @@ const pull = async (props, opts = {}) => {
|
|
|
193
197
|
removed,
|
|
194
198
|
file: targetPath,
|
|
195
199
|
...credential && credential.keys.length > 0 ? { credential } : {},
|
|
196
|
-
...skipped && skipped.length > 0 ? { skipped } : {}
|
|
200
|
+
...skipped && skipped.length > 0 ? { skipped } : {},
|
|
201
|
+
...withheld && withheld.length > 0 ? { withheld } : {}
|
|
197
202
|
};
|
|
198
203
|
};
|
|
199
204
|
/**
|
|
205
|
+
* The credential-backed services a bundled pull may resolve for this file. Object storage
|
|
206
|
+
* is left out when the file holds `AWS_*` keys not paired with a Neon branch storage
|
|
207
|
+
* endpoint: those are the user's own (AWS, R2, MinIO), and `AWS_*` is never pruned, so
|
|
208
|
+
* writing would overwrite them. The AI Gateway is included only when the file already has
|
|
209
|
+
* its variables, since nobody named it.
|
|
210
|
+
*/
|
|
211
|
+
const bundledSecretServices = (env) => {
|
|
212
|
+
const has = (key) => (env[key] ?? "") !== "";
|
|
213
|
+
const endpoint = env[NEON_ENV_VAR_KEYS.storage.endpoint];
|
|
214
|
+
return [...(has(NEON_ENV_VAR_KEYS.storage.accessKeyId) || has(NEON_ENV_VAR_KEYS.storage.secretAccessKey)) && !(endpoint !== void 0 && isNeonStorageEndpoint(endpoint)) ? [] : ["object-storage"], ...Object.values(NEON_ENV_VAR_KEYS.aiGateway).some(has) ? ["ai-gateway"] : []];
|
|
215
|
+
};
|
|
216
|
+
/** `https://<branch id>.storage.<region host>`, the shape Neon's branch storage API returns. */
|
|
217
|
+
const isNeonStorageEndpoint = (endpoint) => {
|
|
218
|
+
if (!URL.canParse(endpoint)) return false;
|
|
219
|
+
const [branch, service] = new URL(endpoint).hostname.split(".");
|
|
220
|
+
return branch?.startsWith("br-") === true && service === "storage";
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
200
223
|
* Prevents scoped or unavailable services from pruning values they did not resolve. A pull
|
|
201
224
|
* that covers functions also prunes the `NEON_FUNCTION_<SLUG>_BASE_URL` lines earlier
|
|
202
225
|
* releases wrote, since nothing reads or refreshes them anymore.
|
|
@@ -256,7 +279,10 @@ const autoPullEnvAfterPin = async (props, branch) => {
|
|
|
256
279
|
return { status: "skipped" };
|
|
257
280
|
}
|
|
258
281
|
try {
|
|
259
|
-
return await pull(props,
|
|
282
|
+
return await pull(props, {
|
|
283
|
+
bundled: true,
|
|
284
|
+
...branch ? { branch } : {}
|
|
285
|
+
});
|
|
260
286
|
} catch (err) {
|
|
261
287
|
const message = err instanceof Error ? err.message : String(err);
|
|
262
288
|
log.warning(`Branch pinned, but pulling its Neon env vars failed: %s
|
|
@@ -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-BVa6Nfji.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-CczPpuT9.js";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import chalk from "chalk";
|
|
@@ -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-
|
|
17
|
-
import { h as initCmd } from "./config-
|
|
16
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.js";
|
|
17
|
+
import { h as initCmd } from "./config-C8BQIoM2.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";
|
|
@@ -6,11 +6,11 @@ import { writer } from "../writer.js";
|
|
|
6
6
|
import { noPassthrough } from "../utils/flags.js";
|
|
7
7
|
import { getAgentDisplayName } from "../mcp/agents.js";
|
|
8
8
|
import "../init/agents.js";
|
|
9
|
-
import { pluginsCommandProblemText, pluginsInstallableAgents } from "../plugins/targets.js";
|
|
9
|
+
import { pluginsCommandProblemText, pluginsGitProblem, pluginsInstallableAgents } from "../plugins/targets.js";
|
|
10
10
|
import { AGENT_PLUGIN_SKIP_MESSAGE } from "../init/copy.js";
|
|
11
11
|
import { NEON_MCP_URL } from "../mcp/install.js";
|
|
12
12
|
import { canPickAgentsInteractively, skippableAgentPicker } from "../utils/agent_picker.js";
|
|
13
|
-
import { resolvePluginsPlan } from "../plugins/plan.js";
|
|
13
|
+
import { pluginsGitError, resolvePluginsPlan } from "../plugins/plan.js";
|
|
14
14
|
import { NEON_PLUGIN_NAME, PLUGIN_SKILLS, PLUGIN_SOURCE, neonPluginsRetryCommand, pluginsAddArgs, runPluginsCli } from "../plugins/run.js";
|
|
15
15
|
// src/commands/plugins.ts
|
|
16
16
|
var plugins_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -73,6 +73,10 @@ const installPlugins = async (options) => {
|
|
|
73
73
|
});
|
|
74
74
|
for (const agent of plan.skipped) log.warning("Skipping %s: no plugins mapping.", getAgentDisplayName(agent));
|
|
75
75
|
for (const row of plan.unusableCommands) log.warning("Skipping %s: the plugin installs through \"%s\", which %s.", getAgentDisplayName(row.agent), row.command.name, pluginsCommandProblemText(row));
|
|
76
|
+
if (plan.targets.length > 0) {
|
|
77
|
+
const git = pluginsGitProblem({ cwd });
|
|
78
|
+
if (git !== void 0) throw pluginsGitError(git);
|
|
79
|
+
}
|
|
76
80
|
const rows = [];
|
|
77
81
|
const failed = [];
|
|
78
82
|
for (const [index, mapped] of plan.targets.entries()) {
|
|
@@ -1,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-C8BQIoM2.js";
|
|
4
4
|
// src/commands/status.ts
|
|
5
5
|
var status_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
builder: () => builder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-
|
|
1
|
+
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CczPpuT9.js";
|
package/dist/commands/claim.js
CHANGED
|
@@ -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-
|
|
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-BoN9NPTy.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-C8BQIoM2.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-BdipMGJE.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-DVB7fGiG.js";
|
package/dist/commands/env.js
CHANGED
|
@@ -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-
|
|
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-C3HQJO8Z.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
1
2
|
import { NEON_SERVICES, NEON_SERVICE_LABELS } from "../neon_services.js";
|
|
2
3
|
import { BRANCH_ENV_KEYS, ENV_PULL_KEYS, isLegacyFunctionBaseUrlKey, serviceForEnvKey } from "../env_services.js";
|
|
3
4
|
import { isAbsolute, relative } from "node:path";
|
|
@@ -57,10 +58,11 @@ const formatPulledEnv = (outcome, cwd, branch) => {
|
|
|
57
58
|
}
|
|
58
59
|
if (outcome.removed.length > 0) lines.push(row("Removed", `${outcome.removed.join(", ")} (not produced by this pull)`));
|
|
59
60
|
if (outcome.removed.some(isLegacyFunctionBaseUrlKey)) lines.push(row("", "Use functionBaseUrl(\"<slug>\") from @neon/env instead."));
|
|
61
|
+
if (outcome.withheld?.includes("object-storage")) lines.push(row("Not pulled", `Object Storage, to keep the AWS_* keys already in ${displayPath(outcome.file, cwd)}. Use \`${getCliName()} env pull -s object-storage\` to replace them.`));
|
|
60
62
|
if (fresh.size > 0) lines.push(" * new credential value");
|
|
61
63
|
const credential = outcome.credential;
|
|
62
64
|
if (credential?.issued && credential.revoked.length > 0) lines.push(`Revoked the credential it replaced (${credential.revoked.join(", ")}).`);
|
|
63
|
-
else if (credential?.issued && credential.superseded.length > 0) lines.push(`Left the credential it replaced live (${credential.superseded.join(", ")}):
|
|
65
|
+
else if (credential?.issued && credential.superseded.length > 0) lines.push(`Left the credential it replaced live (${credential.superseded.join(", ")}): this pull can't tell which other variables still use it. Revoke it in the Neon Console if nothing does.`);
|
|
64
66
|
return `${lines.join("\n")}\n`;
|
|
65
67
|
};
|
|
66
68
|
export { displayPath, formatPulledEnv, pulledBranch, row };
|
|
@@ -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-C8BQIoM2.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-BZY1WeAw.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -2,29 +2,29 @@ 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-
|
|
6
|
-
import { c as config_exports } from "../_chunks/config-
|
|
5
|
+
import { o as env_exports } from "../_chunks/env-C3HQJO8Z.js";
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-C8BQIoM2.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-BVa6Nfji.js";
|
|
9
9
|
import { o as mcp_exports } from "../_chunks/mcp-g8C-BZIb.js";
|
|
10
|
-
import { c as plugins_exports } from "../_chunks/plugins-
|
|
10
|
+
import { c as plugins_exports } from "../_chunks/plugins-CEylQlgK.js";
|
|
11
11
|
import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
|
|
13
13
|
import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
|
|
14
14
|
import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
|
|
15
|
-
import { n as checkout_exports } from "../_chunks/checkout-
|
|
16
|
-
import { o as claim_exports } from "../_chunks/claim-
|
|
15
|
+
import { n as checkout_exports } from "../_chunks/checkout-CczPpuT9.js";
|
|
16
|
+
import { o as claim_exports } from "../_chunks/claim-BoN9NPTy.js";
|
|
17
17
|
import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
18
18
|
import { a as credentials_exports } from "../_chunks/credentials-KV1jlK-n.js";
|
|
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-
|
|
22
|
-
import { s as dev_exports } from "../_chunks/dev-
|
|
21
|
+
import { r as deploy_exports } from "../_chunks/deploy-BdipMGJE.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-DVB7fGiG.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
24
24
|
import { c as docs_exports } from "../_chunks/docs-DjYRHjGY.js";
|
|
25
25
|
import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
|
|
26
26
|
import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
|
|
27
|
-
import { o as git_exports } from "../_chunks/git-
|
|
27
|
+
import { o as git_exports } from "../_chunks/git-BZY1WeAw.js";
|
|
28
28
|
import { o as incidents_exports } from "../_chunks/incidents-BSFkUu1P.js";
|
|
29
29
|
import { a as init_exports } from "../_chunks/init-BSwLzxjX.js";
|
|
30
30
|
import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
|
|
@@ -41,7 +41,7 @@ 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-
|
|
44
|
+
import { a as status_exports } from "../_chunks/status-BBnw48qR.js";
|
|
45
45
|
import { d as triggers_exports } from "../_chunks/triggers-m3IBjiph.js";
|
|
46
46
|
import { s as user_exports } from "../_chunks/user-iNYSe0KI.js";
|
|
47
47
|
import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.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-BVa6Nfji.js";
|
package/dist/commands/plugins.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as command, i as describe, a as handler, o as installPlugins, s as pluginsInstallError, l as reportPluginsInstall } from "../_chunks/plugins-
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as describe, a as handler, o as installPlugins, s as pluginsInstallError, l as reportPluginsInstall } from "../_chunks/plugins-CEylQlgK.js";
|
package/dist/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-BBnw48qR.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
2
|
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
|
-
import { o as resolveNeonEnvVars } from "../_chunks/env-
|
|
3
|
+
import { o as resolveNeonEnvVars } from "../_chunks/env-BWvi2_2f.js";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
// src/commands/subscribe.ts
|
|
6
6
|
const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
|
package/dist/dev/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-
|
|
1
|
+
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-BWvi2_2f.js";
|
package/dist/errors.js
CHANGED
|
@@ -19,6 +19,7 @@ const ERROR_MATCHERS = [
|
|
|
19
19
|
[/^neon skills needs Node\.js /, "NODE_VERSION_UNSUPPORTED"],
|
|
20
20
|
[/needs npx \(Node\.js\)/, "NPX_NOT_FOUND"],
|
|
21
21
|
[/spawn git ENOENT/, "GIT_NOT_FOUND"],
|
|
22
|
+
[/^Installing the Neon plugin needs Git, /, "GIT_NOT_FOUND"],
|
|
22
23
|
[/^(Failed to install Neon agent skills|skills CLI failed)/, "SKILLS_CLI_FAILED"],
|
|
23
24
|
[/^Cannot install the Neon plugin for /, "AGENT_COMMAND_UNAVAILABLE"],
|
|
24
25
|
[/^(Failed to install the Neon plugin for: |plugins CLI (failed|timed out))/, "PLUGINS_CLI_FAILED"],
|
package/dist/init/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-CFa969Ck.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { c as pull } from "../_chunks/env-
|
|
7
|
+
import { c as pull } from "../_chunks/env-C3HQJO8Z.js";
|
|
8
8
|
import { c as setupNeonMcp } from "../_chunks/mcp-g8C-BZIb.js";
|
|
9
9
|
// src/init/auth.ts
|
|
10
10
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
package/dist/init/choices.js
CHANGED
|
@@ -27,20 +27,18 @@ const configPlanFromResolution = (resolution, accepted) => {
|
|
|
27
27
|
* from the branch's compute host.
|
|
28
28
|
*/
|
|
29
29
|
const DEPLOY_FREE_SERVICES = /* @__PURE__ */ new Set(["ai-gateway", "functions"]);
|
|
30
|
-
const needsDeploy = (
|
|
30
|
+
const needsDeploy = (service) => !DEPLOY_FREE_SERVICES.has(service);
|
|
31
31
|
const initEnvPullAfterConfig = (input) => {
|
|
32
32
|
if (!input.projectId || !input.branch) return { kind: "skip" };
|
|
33
33
|
if (!input.linkDeferredPull && !input.wroteNewFile) return { kind: "skip" };
|
|
34
34
|
if (input.claimable && input.declared.length > 0) return { kind: "skip" };
|
|
35
|
-
|
|
35
|
+
const pending = input.declared.filter(needsDeploy);
|
|
36
|
+
if (pending.length === 0) return { kind: "policy" };
|
|
36
37
|
return {
|
|
37
38
|
kind: "services",
|
|
38
|
-
services: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...input.declared.includes("functions") ? ["functions"] : []
|
|
42
|
-
],
|
|
43
|
-
envKeys: []
|
|
39
|
+
services: ["postgres", ...input.declared],
|
|
40
|
+
envKeys: [],
|
|
41
|
+
optionalServices: pending
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
44
|
export { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice };
|
package/dist/init/deploy.js
CHANGED
|
@@ -4,7 +4,7 @@ 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-
|
|
7
|
+
import { r as applyCmd } from "../_chunks/config-C8BQIoM2.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
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
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-
|
|
7
|
+
import { s as runLink } from "../_chunks/link-BVa6Nfji.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-
|
|
19
|
-
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-
|
|
18
|
+
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-C8BQIoM2.js";
|
|
19
|
+
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-BVa6Nfji.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-
|
|
29
|
+
import { l as create } from "../_chunks/claim-BoN9NPTy.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";
|
|
@@ -634,7 +634,8 @@ const runInit = async (props) => {
|
|
|
634
634
|
branch,
|
|
635
635
|
...envPullPlan.kind === "services" ? {
|
|
636
636
|
services: envPullPlan.services,
|
|
637
|
-
envKeys: envPullPlan.envKeys
|
|
637
|
+
envKeys: envPullPlan.envKeys,
|
|
638
|
+
optionalServices: envPullPlan.optionalServices
|
|
638
639
|
} : {}
|
|
639
640
|
}));
|
|
640
641
|
} catch (error) {
|
package/dist/init/tooling.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CannotMintApiKeyError } from "../mcp/mint.js";
|
|
|
7
7
|
import { detectAgent } from "./detect_host.js";
|
|
8
8
|
import { AgentSelectionSkipped, canPickAgentsInteractively } from "../utils/agent_picker.js";
|
|
9
9
|
import { a as mcpInstallError, s as reportMcpInstall } from "../_chunks/mcp-g8C-BZIb.js";
|
|
10
|
-
import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-
|
|
10
|
+
import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-CEylQlgK.js";
|
|
11
11
|
import { c as skillsInstallError, o as installSkills, s as reportSkillsInstall } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { runAuthenticatedMcp } from "./auth.js";
|
|
13
13
|
import { raceSigint } from "./cancelled.js";
|
package/dist/plugins/plan.js
CHANGED
|
@@ -6,6 +6,12 @@ import { detectAgent } from "../init/detect_host.js";
|
|
|
6
6
|
import { agentChoicesFrom, pickAgentsInteractively, resolveAgentSelection } from "../utils/agent_picker.js";
|
|
7
7
|
// src/plugins/plan.ts
|
|
8
8
|
const unusablePluginsCommandsError = (unusable) => new Error(unusable.map((row) => `Cannot install the Neon plugin for ${getAgentDisplayName(row.agent)}: "${row.command.name}" ${pluginsCommandProblemText(row)}. ${pluginsCommandFix(row)}, then retry.`).join("\n"));
|
|
9
|
+
const gitErrorPrefix = "Installing the Neon plugin needs Git, and \"git\"";
|
|
10
|
+
const gitFix = (problem) => {
|
|
11
|
+
if (problem.kind === "missing") return "Install Git (https://git-scm.com/downloads) or add it to PATH";
|
|
12
|
+
return /^(xcrun|xcode-select):/.test(problem.detail) ? "Install the Command Line Tools (xcode-select --install) or install Git" : "Repair or reinstall Git";
|
|
13
|
+
};
|
|
14
|
+
const pluginsGitError = (problem) => /* @__PURE__ */ new Error(`${gitErrorPrefix} ${problem.kind === "missing" ? "was not found on PATH" : `did not run ("git --version" failed: ${problem.detail})`}. ${gitFix(problem)}, then retry.`);
|
|
9
15
|
const assertPluginsCanRun = (options) => {
|
|
10
16
|
if (options.yes || options.interactive || options.hasAgents) return;
|
|
11
17
|
throw new Error("No interactive terminal. Pass -y to install into detected agents, or --agent <name> to name them.");
|
|
@@ -92,4 +98,4 @@ async function resolvePluginsPlan(options) {
|
|
|
92
98
|
targets: mappedPluginsTargets(agents)
|
|
93
99
|
};
|
|
94
100
|
}
|
|
95
|
-
export { assertPluginsCanRun, resolvePluginsPlan, unusablePluginsCommandsError };
|
|
101
|
+
export { assertPluginsCanRun, pluginsGitError, resolvePluginsPlan, unusablePluginsCommandsError };
|
package/dist/plugins/targets.js
CHANGED
|
@@ -87,28 +87,19 @@ const withPath = (env, path) => {
|
|
|
87
87
|
[key ?? "PATH"]: path
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
encoding: "utf8",
|
|
104
|
-
stdio: [
|
|
105
|
-
"ignore",
|
|
106
|
-
"pipe",
|
|
107
|
-
"pipe"
|
|
108
|
-
],
|
|
109
|
-
timeout: VERSION_TIMEOUT_MS,
|
|
110
|
-
windowsHide: true
|
|
111
|
-
});
|
|
90
|
+
const versionRunOptions = (options) => ({
|
|
91
|
+
cwd: options.cwd,
|
|
92
|
+
env: withPath(pluginsChildEnv(), options.searchPath),
|
|
93
|
+
encoding: "utf8",
|
|
94
|
+
stdio: [
|
|
95
|
+
"ignore",
|
|
96
|
+
"pipe",
|
|
97
|
+
"pipe"
|
|
98
|
+
],
|
|
99
|
+
timeout: VERSION_TIMEOUT_MS,
|
|
100
|
+
windowsHide: true
|
|
101
|
+
});
|
|
102
|
+
const versionRunProblem = (result) => {
|
|
112
103
|
if (result.error !== void 0) {
|
|
113
104
|
const code = "code" in result.error && typeof result.error.code === "string" ? result.error.code : void 0;
|
|
114
105
|
return {
|
|
@@ -116,7 +107,6 @@ const probePluginsCommand = (command, options) => {
|
|
|
116
107
|
detail: code === "ETIMEDOUT" ? `timed out after ${VERSION_TIMEOUT_MS / 1e3} seconds` : code ?? result.error.message
|
|
117
108
|
};
|
|
118
109
|
}
|
|
119
|
-
const output = `${result.stdout}\n${result.stderr}`;
|
|
120
110
|
if (result.status !== 0) {
|
|
121
111
|
const line = firstLine(result.stderr) || firstLine(result.stdout);
|
|
122
112
|
return {
|
|
@@ -124,7 +114,40 @@ const probePluginsCommand = (command, options) => {
|
|
|
124
114
|
detail: line.length > 0 ? line.slice(0, 160).replace(/\.$/, "") : result.signal !== null ? `killed by ${result.signal}` : `exit code ${result.status}`
|
|
125
115
|
};
|
|
126
116
|
}
|
|
127
|
-
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Runs `<command> --version` the way the plugins CLI spawns the command (no shell, the npx
|
|
120
|
+
* search PATH, its child env), so a command it could not run is caught before it runs.
|
|
121
|
+
*/
|
|
122
|
+
const probePluginsCommand = (command, options) => {
|
|
123
|
+
const resolved = which.sync(command.name, {
|
|
124
|
+
nothrow: true,
|
|
125
|
+
path: options.searchPath
|
|
126
|
+
});
|
|
127
|
+
if (resolved === null) return { kind: "missing" };
|
|
128
|
+
const result = spawnSync(resolved, ["--version"], versionRunOptions(options));
|
|
129
|
+
return versionRunProblem(result) ?? pluginsCommandVersionProblem(command, `${result.stdout}\n${result.stderr}`);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* The plugins CLI runs `git clone` through a shell, so this probe runs `git --version`
|
|
133
|
+
* through one too: without a shell, Node cannot run a Windows `git.cmd`. A slow git is
|
|
134
|
+
* left to the plugins CLI rather than blocking the install.
|
|
135
|
+
*/
|
|
136
|
+
const pluginsGitProblem = (options) => {
|
|
137
|
+
const searchPath = pluginsCommandSearchPath(options.cwd, options.path ?? process.env.PATH ?? "");
|
|
138
|
+
if (which.sync("git", {
|
|
139
|
+
nothrow: true,
|
|
140
|
+
path: searchPath
|
|
141
|
+
}) === null) return { kind: "missing" };
|
|
142
|
+
const result = spawnSync("git --version", {
|
|
143
|
+
...versionRunOptions({
|
|
144
|
+
cwd: options.cwd,
|
|
145
|
+
searchPath
|
|
146
|
+
}),
|
|
147
|
+
shell: true
|
|
148
|
+
});
|
|
149
|
+
if (result.error !== void 0 && "code" in result.error && result.error.code === "ETIMEDOUT") return;
|
|
150
|
+
return versionRunProblem(result);
|
|
128
151
|
};
|
|
129
152
|
const commandRows = (agents, options, check) => {
|
|
130
153
|
const searchPath = pluginsCommandSearchPath(options.cwd, options.path ?? process.env.PATH ?? "");
|
|
@@ -216,4 +239,4 @@ const mappedPluginsTargets = (agents) => {
|
|
|
216
239
|
if (mapped.length === 0) throw new Error(`None of the selected agents can install plugins. Supported agents: ${pluginsInstallableAgents().join(", ")}`);
|
|
217
240
|
return mapped;
|
|
218
241
|
};
|
|
219
|
-
export { bootstrapPluginAgents, detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsInstallableAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
|
|
242
|
+
export { bootstrapPluginAgents, detectInstalledPluginsAgents, detectProjectPluginsAgents, getPluginsTargetName, mappedPluginsTargets, missingPluginsCommands, pluginsCommandFix, pluginsCommandProblemText, pluginsCommandVersionProblem, pluginsGitProblem, pluginsInstallableAgents, pluginsTargets, supportsPlugins, unusablePluginsCommands, versionAtLeast };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "9.9.
|
|
3
|
+
"version": "9.9.6",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"tsx": "4.22.3",
|
|
113
113
|
"typescript": "^5.9.0",
|
|
114
114
|
"vitest": "^3.0.9",
|
|
115
|
-
"@neon-internals/cli-core": "0.0.0",
|
|
116
115
|
"@neon-internals/env-core": "0.0.57",
|
|
116
|
+
"@neon-internals/cli-core": "0.0.0",
|
|
117
117
|
"@neon/e2e-harness": "0.0.0",
|
|
118
118
|
"@neon/env": "2.1.9",
|
|
119
119
|
"@neon/functions": "0.11.0"
|