neon 5.0.0 → 6.0.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 +29 -26
- package/dist/commands/auth.js +9 -2
- package/dist/commands/config.js +39 -18
- package/dist/commands/init.js +44 -299
- package/dist/commands/mcp.js +1 -16
- package/dist/commands/plugins.js +2 -12
- package/dist/commands/skills.js +2 -12
- package/dist/index.js +9 -1
- package/dist/init/cancelled.js +16 -0
- package/dist/init/child.js +16 -4
- package/dist/init/choices.js +10 -21
- package/dist/init/chrome.js +71 -19
- package/dist/init/copy.js +133 -0
- package/dist/init/detect.js +58 -0
- package/dist/init/funnel.js +115 -0
- package/dist/init/mode.js +30 -0
- package/dist/init/plan.js +84 -3
- package/dist/init/run.js +641 -0
- package/dist/init/tooling.js +1 -1
- package/dist/init/wizard.js +207 -48
- package/dist/mcp/wizard.js +1 -27
- package/dist/skills/wizard.js +1 -25
- package/dist/test_utils/npm_env.js +26 -0
- package/dist/update_check_worker.js +47 -0
- package/dist/update_notifier.js +145 -0
- package/dist/utils/package_manager.js +8 -1
- package/dist/utils/service_picker.js +34 -8
- package/package.json +7 -5
- package/dist/plugins/wizard.js +0 -36
package/README.md
CHANGED
|
@@ -46,6 +46,11 @@ brew upgrade neonctl
|
|
|
46
46
|
|
|
47
47
|
To upgrade a binary version, download the latest binary file, as described above, and replace your old binary with the new one.
|
|
48
48
|
|
|
49
|
+
Global npm, pnpm, Bun, and Homebrew installs check for updates once per day.
|
|
50
|
+
When an update is available, terminal commands periodically print the matching
|
|
51
|
+
upgrade command. Set `NO_UPDATE_NOTIFIER=1` to disable these checks. The notifier
|
|
52
|
+
does not run in CI, for machine-readable output, or from standalone binaries.
|
|
53
|
+
|
|
49
54
|
## Connect
|
|
50
55
|
|
|
51
56
|
Run the following command to authenticate a connection to Neon:
|
|
@@ -613,6 +618,8 @@ export default defineConfig({
|
|
|
613
618
|
|
|
614
619
|
```
|
|
615
620
|
? Which Neon services should neon.ts declare? (space to toggle, enter to confirm) ›
|
|
621
|
+
◉ Postgres (always included)
|
|
622
|
+
Every Neon project includes a Postgres database.
|
|
616
623
|
◯ Managed Better Auth
|
|
617
624
|
Authentication with users and sessions stored in Postgres.
|
|
618
625
|
◯ Data API
|
|
@@ -625,7 +632,7 @@ export default defineConfig({
|
|
|
625
632
|
All models, one API, one bill. Powered by Databricks. Not available on the Neon free plan.
|
|
626
633
|
```
|
|
627
634
|
|
|
628
|
-
Selecting nothing is a valid answer: you get the starter policy, which is also what a non-interactive run (CI, no TTY) writes. Pass `--services` to skip the prompt anywhere:
|
|
635
|
+
Postgres cannot be unselected. Selecting nothing else is a valid answer: you get the starter policy, which is also what a non-interactive run (CI, no TTY) writes. Pass `--services` to skip the prompt anywhere:
|
|
629
636
|
|
|
630
637
|
```bash
|
|
631
638
|
# Pick interactively (TTY) or take the starter policy (CI)
|
|
@@ -779,46 +786,42 @@ The target directory must be empty unless you pass `--force` (a lone `.git` is i
|
|
|
779
786
|
|
|
780
787
|
## Set up a project (`init`)
|
|
781
788
|
|
|
782
|
-
`neon init` sets up this directory for Neon
|
|
789
|
+
`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.
|
|
783
790
|
|
|
784
|
-
|
|
791
|
+
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 a default `neon.ts` (Postgres only) using the package manager already in the directory.
|
|
785
792
|
|
|
786
|
-
`-y`
|
|
793
|
+
Unauthenticated `-y` skips linking and prints the next step: sign up at https://neon.com/signup, then `neon auth`, `neon link`, or `neon claim create` (no account, expires in 72 hours unless claimed). `-y` never opens a browser. `-y` with `--project-id` or other account flags links when the CLI is already signed in; otherwise it errors and names `neon auth` or `--claimable`.
|
|
787
794
|
|
|
788
|
-
|
|
795
|
+
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. 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.
|
|
789
796
|
|
|
790
|
-
|
|
797
|
+
Empty directories are set up in place. `neon init` does not scaffold starter files.
|
|
791
798
|
|
|
792
799
|
```bash
|
|
793
800
|
$ neon init
|
|
794
|
-
$ neon init --skip-template
|
|
795
|
-
$ neon init --skip-template --no-link
|
|
796
801
|
$ neon init -y
|
|
797
|
-
$ neon init --agent cursor --agent claude-code
|
|
802
|
+
$ neon init --agent cursor --agent claude-code --no-link
|
|
803
|
+
$ neon init --no-agent-setup --claimable
|
|
804
|
+
$ neon init -y --skill neon --mcp-auth oauth --mcp-config-location project
|
|
805
|
+
$ neon init -y --agent cursor --project-id <project-id> \
|
|
806
|
+
--mcp-auth oauth --mcp-config-location project --mcp-project-scoped
|
|
798
807
|
```
|
|
799
808
|
|
|
800
|
-
Without a TTY, pass `-y
|
|
801
|
-
|
|
802
|
-
`-y` skips the template picker and the agent-setup offer. Empty dir: `bootstrap --default`. `--skip-template` or an existing app: plugin when Cursor, Claude Code, or Codex is in project folders, else the host CLI agent; otherwise skills and MCP. If none are found, it exits: pass `--agent <name>`, run from a supported agent, or omit `-y` in a terminal to pick. VS Code, GitHub Copilot CLI, and Grok only take the plugin user-level (`neon plugins --global`), so `-y` uses skills and MCP for those.
|
|
803
|
-
|
|
804
|
-
`--agent` / `-a` (repeatable) names coding agents and skips agent selection, interactive or with `-y`. Init forwards those names to `plugins`, or to `skills` and `mcp`, not both.
|
|
805
|
-
|
|
806
|
-
`--project-id`, `--org-id`, `--project-name`, `--region-id`, and `--branch` are forwarded to `link`, including the link step inside nested bootstrap when a template is scaffolded. They are not filled from `.neon`; a linked directory is not relinked unless you pass one of those flags.
|
|
809
|
+
Without a TTY, pass `-y` or enough flags to answer every question. `-y` alone is Recommended. `-y` with `--skill`, MCP flags, `--no-agent-setup`, or `--claimable` is Custom: those flags, Recommended defaults for the rest. `--skill` selects skills (not the plugin). MCP flags select skills and MCP. `--agent` skips agent selection and, without `-y`, selects Custom. `--no-link` skips project linking without asking. `--no-config` skips `neon.ts`. `--services` implies creating `neon.ts`. `--org-id`, `--project-id`, `--project-name`, `--region-id`, and `--branch` select linking.
|
|
807
810
|
|
|
808
|
-
`--
|
|
811
|
+
`--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.
|
|
809
812
|
|
|
810
|
-
|
|
813
|
+
After a new default `neon.ts` on a pinned branch, init runs `env pull` unless link already pulled env or the file declares extra services (those still need `neon config plan` / `neon deploy`).
|
|
811
814
|
|
|
812
815
|
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.
|
|
813
816
|
|
|
814
|
-
`skills` needs Node.js 22.20 or newer. See [`
|
|
817
|
+
`skills` needs Node.js 22.20 or newer. See [`plugins`](#install-the-neon-plugin-plugins), [`skills`](#install-neon-agent-skills-skills), [`link`](#linking-a-project), and [`mcp`](#install-the-neon-mcp-server-mcp) for what those commands write.
|
|
815
818
|
|
|
816
819
|
## Install the Neon MCP server (`mcp`)
|
|
817
820
|
|
|
818
821
|
`neon mcp` writes the hosted Neon MCP server (`https://mcp.neon.tech/mcp`) into coding-agent config files.
|
|
819
822
|
|
|
820
823
|
```bash
|
|
821
|
-
# Interactive: global or project, then agents, then API key or OAuth
|
|
824
|
+
# Interactive: global or project, then agents, then API key or OAuth.
|
|
822
825
|
$ neon mcp
|
|
823
826
|
|
|
824
827
|
# Skip prompts. Global config, installed apps else the host CLI agent, reuse or mint an API key.
|
|
@@ -843,7 +846,7 @@ $ neon mcp --project-id <project-id>
|
|
|
843
846
|
$ neon mcp --category querying --category schema
|
|
844
847
|
```
|
|
845
848
|
|
|
846
|
-
On a TTY the command asks for config location (global is the default), then agents, then API key vs OAuth, then
|
|
849
|
+
On a TTY the command asks for config location (global is the default), then agents, then API key vs OAuth, then writes. Detected agents start selected: globally installed agents or project-folder markers such as `.cursor` when the install is project.
|
|
847
850
|
|
|
848
851
|
`-y` skips those questions. `neon mcp -y` writes `https://mcp.neon.tech/mcp` into global config for globally installed apps, else the host CLI agent, reuses an existing Neon MCP API key or mints an account-wide key, leaves write tools enabled, exposes every tool category, and does not pin a project (including from `.neon`). `--agent`, `--project`, `--oauth`, `--read-only`, `--project-id` and `--category` still apply with `-y`. `--read-only` and `--category` are flags only and are never prompted. A linked project-folder install asks whether to pin MCP tools to that `.neon` project (`?projectId=`). If you pin and selected API-key auth, the minted key is limited to that project too. An unlinked project folder does not ask. Global installs never add that param unless you pass `--project-id`. Without a TTY, pass `-y` to mint into every detected agent, `--agent <name>` to name them, or `--oauth` to write the URL only. If `-y` finds no agent, it exits: pass `--agent <name>`, run from a supported agent, or omit `-y` in a terminal to pick. `neon mcp --help` lists the server URL, those `-y` defaults, the supported agent names, and the `--category` values.
|
|
849
852
|
|
|
@@ -856,7 +859,7 @@ The default mints an account-wide API key (or reuses the Bearer already configur
|
|
|
856
859
|
`neon skills` installs Neon agent skills by running `npx skills add`. It does not call the Neon API. This command needs Node.js 22.20 or newer. The rest of the CLI supports Node.js 20.19 or newer.
|
|
857
860
|
|
|
858
861
|
```bash
|
|
859
|
-
# Interactive: this directory, then agents, then skills
|
|
862
|
+
# Interactive: this directory, then agents, then skills.
|
|
860
863
|
$ neon skills
|
|
861
864
|
|
|
862
865
|
# Skip prompts. This directory, detected agents (project folders, else the host CLI agent), the default skills.
|
|
@@ -880,7 +883,7 @@ $ neon skills update -y
|
|
|
880
883
|
$ neon skills update --global -y
|
|
881
884
|
```
|
|
882
885
|
|
|
883
|
-
On a TTY the command asks which agents and which skills, then
|
|
886
|
+
On a TTY the command asks which agents and which skills, then installs. Detected agents start selected from project-folder markers such as `.cursor`. Default skills start selected. `neon-postgres-agent-platforms` is offered and starts unselected.
|
|
884
887
|
|
|
885
888
|
`-y` skips those questions and installs the default skills into detected agents: project-folder markers such as `.cursor`, else the agent driving the CLI. `--agent` / `-a` names coding agents and skips the agent picker. `--skill` / `-s` names specific skills and skips the skill picker; it does not select agents. `--global -y` uses installed apps, else the host CLI agent. Without a TTY, pass `-y`, or `--skill <name>` (add `--agent <name>` to name agents). If `-y` finds no agent, it exits: pass `--agent <name>`, run from a supported agent, or omit `-y` in a terminal to pick.
|
|
886
889
|
|
|
@@ -904,7 +907,7 @@ Default table output is the assistant's text. On a TTY that is a spinner, then t
|
|
|
904
907
|
`neon plugins` installs the Neon agent plugin (`neon-postgres`) by running `npx plugins add`. It does not call the Neon API.
|
|
905
908
|
|
|
906
909
|
```bash
|
|
907
|
-
# Interactive: agents, then
|
|
910
|
+
# Interactive: pick agents, then install.
|
|
908
911
|
$ neon plugins
|
|
909
912
|
|
|
910
913
|
# Skip prompts. Detected agents (project folders, else the host CLI agent).
|
|
@@ -917,7 +920,7 @@ $ neon plugins --agent cursor --agent claude-code
|
|
|
917
920
|
$ neon plugins --global
|
|
918
921
|
```
|
|
919
922
|
|
|
920
|
-
On a TTY the command asks which agents, then
|
|
923
|
+
On a TTY the command asks which agents, then installs. Detected agents start selected from project-folder markers such as `.cursor`. There is one plugin (`neon-postgres`); there is no plugin picker and no `update` subcommand.
|
|
921
924
|
|
|
922
925
|
`-y` skips those questions and installs into detected agents: project-folder markers such as `.cursor`, else the agent driving the CLI. `--agent` / `-a` names coding agents and skips the agent picker. `--global -y` uses installed apps, else the host CLI agent. Without a TTY, pass `-y` or `--agent <name>`. If `-y` finds no agent, it exits: pass `--agent <name>`, run from a supported agent, or omit `-y` in a terminal to pick.
|
|
923
926
|
|
|
@@ -1361,7 +1364,7 @@ Id Name Project Created At Last Used At Last
|
|
|
1361
1364
|
| config | `init`, `status`, `plan`, `apply` | Drive a branch from `neon.ts` |
|
|
1362
1365
|
| deploy | | Alias for `config apply` |
|
|
1363
1366
|
| bootstrap | | Scaffold a template, then agent tooling and link |
|
|
1364
|
-
| init | |
|
|
1367
|
+
| init | | In place: agents, link, neon.ts |
|
|
1365
1368
|
| mcp | | Install the Neon MCP server |
|
|
1366
1369
|
| plugins | | Install the Neon plugin |
|
|
1367
1370
|
| skills | `update` | Install Neon agent skills |
|
package/dist/commands/auth.js
CHANGED
|
@@ -14,6 +14,8 @@ import { ClaimableClient, ClaimableServiceError } from "../claimable/api.js";
|
|
|
14
14
|
import { assertionHasExpired, claimableCredentialsExist, claimableCredentialsPath, readLinkedClaimableCredentials, shouldUseClaimableCredentials } from "../claimable/state.js";
|
|
15
15
|
import { withExclusiveLock } from "../refresh_lock.js";
|
|
16
16
|
import { readOutgoingCredential, retirePreviousCredential } from "../retire_credential.js";
|
|
17
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
18
|
+
import { helpEpilogue, helpWidth, wrapHelpText } from "../utils/help_text.js";
|
|
17
19
|
import { existsSync } from "node:fs";
|
|
18
20
|
import { join } from "node:path";
|
|
19
21
|
import { createHash } from "node:crypto";
|
|
@@ -45,11 +47,16 @@ const locationForAuth = (configDir, name, keyring, options = {}) => {
|
|
|
45
47
|
};
|
|
46
48
|
const command = "auth";
|
|
47
49
|
const aliases = ["login"];
|
|
48
|
-
const describe = "
|
|
50
|
+
const describe = "Sign in with a browser. See --help for API keys and profiles";
|
|
51
|
+
const wrapAuthHelp = (text) => wrapHelpText(text, helpWidth());
|
|
52
|
+
const authHelpEpilogue = () => {
|
|
53
|
+
const cli = getCliName();
|
|
54
|
+
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
|
+
};
|
|
49
56
|
const builder = (yargs) => yargs.option("context-file", { hidden: true }).option("keyring", {
|
|
50
57
|
describe: "Store the credential in the OS keyring. Per profile; later auth without the flag stays there. See `neon profile list`.",
|
|
51
58
|
type: "boolean"
|
|
52
|
-
});
|
|
59
|
+
}).example("$0 auth", "Sign in with a browser").example("$0 auth --profile work", "Save a browser session in profile work").example("$0 projects list --api-key \"$KEY\"", "Use an existing API key for this command").example("NEON_API_KEY=\"$KEY\" $0 projects list", "Use an existing API key from the environment").example("$0 profile create agent --api-key \"$KEY\"", "Store an existing API key").example("echo \"$KEY\" | $0 profile create agent --api-key -", "Store a key read from stdin").example("$0 profile create ci --mint", "Sign in once in a browser and store a new API key").epilogue(authHelpEpilogue());
|
|
53
60
|
const handler = async (args) => {
|
|
54
61
|
await authFlow(args);
|
|
55
62
|
};
|
package/dist/commands/config.js
CHANGED
|
@@ -21,11 +21,12 @@ import { zipBundle } from "../utils/zip.js";
|
|
|
21
21
|
import { autoPullEnvAfterPin } from "./env.js";
|
|
22
22
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
23
23
|
import { dirname, join } from "node:path";
|
|
24
|
-
import { packagesToStage, previewGaWarningForConfig, resolveConfig } from "@neon/config";
|
|
25
24
|
import chalk from "chalk";
|
|
25
|
+
import { packagesToStage, previewGaWarningForConfig, resolveConfig } from "@neon/config";
|
|
26
26
|
import { PushConflictError, apply, assertZipWithinLimits, bundleAsIs, createBranch, describeNativeFinding, enforceLimits, findUndeclaredNativePackages, inspect, isPartialBranchCreateError, loadConfigFromFile as loadConfigFromFile$1, plan, resolveEsbuildEntry, traceNativePackages, zipFunctionBundle } from "@neon/config-runtime";
|
|
27
27
|
//#region src/commands/config.ts
|
|
28
28
|
var config_exports = /* @__PURE__ */ __exportAll({
|
|
29
|
+
ConfigInstallFailed: () => ConfigInstallFailed,
|
|
29
30
|
applyCmd: () => applyCmd,
|
|
30
31
|
applyFlags: () => applyFlags,
|
|
31
32
|
applyPolicyOnCreate: () => applyPolicyOnCreate,
|
|
@@ -38,6 +39,7 @@ var config_exports = /* @__PURE__ */ __exportAll({
|
|
|
38
39
|
handler: () => handler,
|
|
39
40
|
hasNeonConfigFile: () => hasNeonConfigFile,
|
|
40
41
|
initCmd: () => initCmd,
|
|
42
|
+
neonConfigFilename: () => neonConfigFilename,
|
|
41
43
|
planCmd: () => planCmd,
|
|
42
44
|
status: () => status
|
|
43
45
|
});
|
|
@@ -117,8 +119,16 @@ const NEON_CONFIG_FILENAMES = [
|
|
|
117
119
|
"neon.js",
|
|
118
120
|
"neon.mjs"
|
|
119
121
|
];
|
|
122
|
+
const neonConfigFilename = (dir) => NEON_CONFIG_FILENAMES.find((name) => existsSync(join(dir, name)));
|
|
120
123
|
/** Whether `dir` already has a Neon config file the runtime would load. */
|
|
121
|
-
const hasNeonConfigFile = (dir) =>
|
|
124
|
+
const hasNeonConfigFile = (dir) => neonConfigFilename(dir) !== void 0;
|
|
125
|
+
var ConfigInstallFailed = class extends Error {
|
|
126
|
+
constructor(command) {
|
|
127
|
+
super("Could not install the Neon dependencies.");
|
|
128
|
+
this.name = "ConfigInstallFailed";
|
|
129
|
+
this.command = command;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
122
132
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
123
133
|
/**
|
|
124
134
|
* The {@link REQUIRED_PACKAGES} not already declared in the project's package.json
|
|
@@ -209,33 +219,44 @@ const seedFromBranch = async (props) => {
|
|
|
209
219
|
const initCmd = async (props) => {
|
|
210
220
|
const cwd = props.cwd ?? process.cwd();
|
|
211
221
|
const run = props.run ?? runCommand;
|
|
212
|
-
const existing =
|
|
213
|
-
if (existing)
|
|
214
|
-
|
|
222
|
+
const existing = neonConfigFilename(cwd);
|
|
223
|
+
if (existing) {
|
|
224
|
+
if (!props.silent) log.info("Found an existing %s — leaving it untouched.", existing);
|
|
225
|
+
} else if (props.fromBranch) {
|
|
215
226
|
const { source, seeded, branchName } = await seedFromBranch(props);
|
|
216
227
|
writeFileSync(join(cwd, "neon.ts"), source);
|
|
217
|
-
if (
|
|
218
|
-
|
|
228
|
+
if (!props.silent) {
|
|
229
|
+
if (seeded) log.info("Created neon.ts from the live state of %s.", branchName);
|
|
230
|
+
else log.info("%s declares no services and no branch settings — created neon.ts with the starter policy instead.", branchName);
|
|
231
|
+
}
|
|
219
232
|
} else {
|
|
220
233
|
const services = await resolveServices(props);
|
|
221
234
|
writeFileSync(join(cwd, "neon.ts"), renderNeonConfig(services));
|
|
222
|
-
if (
|
|
223
|
-
|
|
235
|
+
if (!props.silent) {
|
|
236
|
+
if (services.length === 0) log.info("Created neon.ts with a starter policy.");
|
|
237
|
+
else log.info("Created neon.ts declaring %s.", services.join(", "));
|
|
238
|
+
}
|
|
224
239
|
if (services.includes("functions")) scaffoldFunction(cwd);
|
|
225
240
|
}
|
|
226
241
|
const missing = missingDependencies(cwd);
|
|
227
|
-
if (missing.length === 0)
|
|
228
|
-
|
|
229
|
-
|
|
242
|
+
if (missing.length === 0) {
|
|
243
|
+
if (!props.silent) log.info("%s are already installed.", REQUIRED_PACKAGES.join(" and "));
|
|
244
|
+
} else {
|
|
245
|
+
const pm = props.packageManager ?? resolvePackageManager(cwd);
|
|
230
246
|
const args = installArgs(pm, missing);
|
|
231
|
-
if (props.install === false)
|
|
232
|
-
|
|
247
|
+
if (props.install === false) {
|
|
248
|
+
if (!props.silent) log.info("Install the Neon config packages to use neon.ts: %s", formatInstallCommand(pm, missing));
|
|
249
|
+
} else {
|
|
233
250
|
ensureDirectoryGitignored(join(cwd, "node_modules"));
|
|
234
|
-
log.info("Installing %s with %s…", missing.join(", "), pm);
|
|
235
|
-
if (!await run(pm, args, cwd))
|
|
251
|
+
if (!props.silent) log.info("Installing %s with %s…", missing.join(", "), pm);
|
|
252
|
+
if (!await run(pm, args, cwd)) {
|
|
253
|
+
const command = formatInstallCommand(pm, missing);
|
|
254
|
+
if (props.requireInstall) throw new ConfigInstallFailed(command);
|
|
255
|
+
log.warning("Could not install the config packages automatically. Run by hand: %s", command);
|
|
256
|
+
}
|
|
236
257
|
}
|
|
237
258
|
}
|
|
238
|
-
log.info("Next: edit neon.ts, then run `neon config plan` to preview and `neon config apply`.");
|
|
259
|
+
if (!props.silent) log.info("Next: edit neon.ts, then run `neon config plan` to preview and `neon config apply`.");
|
|
239
260
|
};
|
|
240
261
|
const command = "config";
|
|
241
262
|
const describe = "Manage a branch with a neon.ts policy";
|
|
@@ -741,4 +762,4 @@ const createBranchFromPolicyOnCheckout = async (props) => {
|
|
|
741
762
|
}
|
|
742
763
|
};
|
|
743
764
|
//#endregion
|
|
744
|
-
export { applyCmd, applyFlags, applyPolicyOnCreate, builder, command, createBranchFromPolicyOnCheckout, describe, envFlag, envPullFlag, handler, hasNeonConfigFile, initCmd, planCmd, status, config_exports as t };
|
|
765
|
+
export { ConfigInstallFailed, applyCmd, applyFlags, applyPolicyOnCreate, builder, command, createBranchFromPolicyOnCheckout, describe, envFlag, envPullFlag, handler, hasNeonConfigFile, initCmd, neonConfigFilename, planCmd, status, config_exports as t };
|