neon 4.6.0 → 4.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 +48 -113
- package/dist/_chunks/{auth_selection-ktL6uoEe.js → auth_selection-pitMFzDe.js} +1 -1
- package/dist/_chunks/{credential_io-B1JxWELN.js → credential_io-YeAxg9Xn.js} +2 -2
- package/dist/_chunks/{paths-g3DRqJiD.js → paths-DMq0Lt7a.js} +1 -1
- package/dist/_chunks/{profiles-D95AeZ5v.js → profiles-CvnFEQyd.js} +1 -1
- package/dist/analytics.js +2 -2
- package/dist/auth_context.js +1 -1
- package/dist/commands/auth.js +12 -9
- package/dist/commands/bootstrap.js +72 -43
- package/dist/commands/claim.js +1 -1
- package/dist/commands/env.js +3 -20
- package/dist/commands/init.js +80 -79
- package/dist/commands/link.js +110 -292
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/plugins.js +3 -3
- package/dist/commands/profile.js +4 -4
- package/dist/config.js +1 -1
- package/dist/credential_io.js +1 -1
- package/dist/index.js +1 -1
- package/dist/init/child.js +36 -0
- package/dist/init/plan.js +47 -0
- package/dist/init/tooling.js +43 -0
- package/dist/init/wizard.js +42 -0
- package/dist/mcp/targets.js +1 -1
- package/dist/plugins/plan.js +1 -1
- package/dist/plugins/targets.js +5 -1
- package/dist/retire_credential.js +1 -1
- package/dist/utils/cli_name.js +1 -12
- package/dist/utils/middlewares.js +1 -1
- package/dist/utils/package_manager.js +10 -5
- package/package.json +13 -14
- package/dist/init/auth.js +0 -53
- package/dist/init/build_config.js +0 -4
- package/dist/init/detect_agent.js +0 -63
- package/dist/init/editors.js +0 -19
- package/dist/init/enrich_output.js +0 -61
- package/dist/init/extension.js +0 -154
- package/dist/init/inspect.js +0 -249
- package/dist/init/interactive.js +0 -529
- package/dist/init/neonctl.js +0 -139
- package/dist/init/orchestrate.js +0 -189
- package/dist/init/phases/auth.js +0 -195
- package/dist/init/phases/cleanup.js +0 -27
- package/dist/init/phases/db.js +0 -257
- package/dist/init/phases/getting_started.js +0 -218
- package/dist/init/phases/mcp.js +0 -219
- package/dist/init/phases/migrations.js +0 -250
- package/dist/init/phases/neon_auth.js +0 -116
- package/dist/init/phases/setup.js +0 -582
- package/dist/init/phases/skills.js +0 -86
- package/dist/init/phases/status.js +0 -82
- package/dist/init/profile_cli.js +0 -56
- package/dist/init/resolve_context.js +0 -105
- package/dist/init/route_command.js +0 -93
- package/dist/init/skills.js +0 -206
- package/dist/init/types.js +0 -1
- package/dist/init/vsix.js +0 -89
package/dist/commands/init.js
CHANGED
|
@@ -1,94 +1,95 @@
|
|
|
1
1
|
import { t as __exportAll } from "../_chunks/rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { log } from "../log.js";
|
|
3
|
+
import { readContextFile } from "../context.js";
|
|
4
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
5
|
+
import { t as credentialInputs } from "../_chunks/auth_selection-pitMFzDe.js";
|
|
6
|
+
import { initChildEnv, spawnCliChild } from "../init/child.js";
|
|
7
|
+
import { bootstrapInitStep, directoryIsEmpty, planExistingInit } from "../init/plan.js";
|
|
8
|
+
import { runAgentTooling, runInitSteps } from "../init/tooling.js";
|
|
9
|
+
import { helpEpilogue } from "../utils/help_text.js";
|
|
10
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
11
|
+
import { resolve } from "node:path";
|
|
9
12
|
//#region src/commands/init.ts
|
|
10
13
|
var init_exports = /* @__PURE__ */ __exportAll({
|
|
11
14
|
builder: () => builder,
|
|
12
15
|
command: () => command,
|
|
13
16
|
describe: () => describe,
|
|
14
|
-
handler: () => handler
|
|
17
|
+
handler: () => handler,
|
|
18
|
+
initChildEnv: () => initChildEnv
|
|
15
19
|
});
|
|
16
20
|
const command = "init";
|
|
17
|
-
const describe = "
|
|
18
|
-
const
|
|
19
|
-
|
|
21
|
+
const describe = "Set up this directory for Neon: agent tooling, a linked project, and neon.ts. In an empty directory, scaffolds a template first. Skills needs Node.js 22.20 or newer.";
|
|
22
|
+
const removedProtocol = () => `\`${getCliName()} init --agent\` and \`--data\` were removed. Run \`${getCliName()} init\` or \`${getCliName()} init -y\`.`;
|
|
23
|
+
const builder = (yargs) => yargs.usage("$0 init [options]").option("context-file", { hidden: true }).option("yes", {
|
|
24
|
+
alias: "y",
|
|
20
25
|
type: "boolean",
|
|
21
26
|
default: false,
|
|
22
|
-
describe: "
|
|
27
|
+
describe: "Empty dir: bootstrap --default. Otherwise plugin when a project plugin agent is detected, else skills and MCP, then link --yes and config init --services none. link --yes still asks for a project unless one is already linked"
|
|
28
|
+
}).option("agent", {
|
|
29
|
+
hidden: true,
|
|
30
|
+
type: "boolean"
|
|
23
31
|
}).option("data", {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}).option("
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
describe: "
|
|
30
|
-
}).
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}).strict(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* `INFO: ` and send it to stderr, which is right for a diagnostic and wrong for the
|
|
39
|
-
* payload an agent is expected to parse.
|
|
40
|
-
*/
|
|
41
|
-
const writeAgentResponse = (result) => {
|
|
42
|
-
writeAllSync(1, `${JSON.stringify(enrichResponse(result), null, 2)}\n`);
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* A failure has to arrive in the shape the caller asked for. An agent parses stdout and
|
|
46
|
-
* has no branch for "empty stdout, exit 1" — it cannot tell a broken credentials file
|
|
47
|
-
* from a phase that legitimately produced nothing — so the error goes out as JSON too.
|
|
48
|
-
*/
|
|
49
|
-
const writeAgentFailure = (error) => {
|
|
50
|
-
writeAllSync(1, `${JSON.stringify({
|
|
51
|
-
success: false,
|
|
52
|
-
error: error.message
|
|
53
|
-
}, null, 2)}\n`);
|
|
54
|
-
};
|
|
55
|
-
/** ` at position 12`, or nothing when the parser did not report one. */
|
|
56
|
-
const parsePosition = (parseError) => {
|
|
57
|
-
const at = (parseError instanceof Error ? parseError.message : "").match(/at position (\d+)/);
|
|
58
|
-
return at === null ? "" : ` at position ${at[1]}`;
|
|
32
|
+
hidden: true,
|
|
33
|
+
type: "string"
|
|
34
|
+
}).option("output", {
|
|
35
|
+
alias: "o",
|
|
36
|
+
hidden: true,
|
|
37
|
+
describe: "Not supported; the commands init runs print their own output"
|
|
38
|
+
}).example("$0 init", "Empty dir: bootstrap (scaffold, agent tooling, link). Existing app: agent tooling, link, config init").example("$0 init -y", "Same steps, using each child's defaults").epilogue(helpEpilogue("Interactive agent setup: plugin (recommended), skills and MCP separately, or skip agent setup. Never both plugin and skills+MCP.", "-y installs the plugin when Cursor, Claude Code, or Codex is detected in the project. Otherwise skills and MCP. Then link unless already linked. link --yes may still ask for a project.")).check((argv) => {
|
|
39
|
+
if (argv.agent === true || argv.data !== void 0) throw new Error(removedProtocol());
|
|
40
|
+
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.`);
|
|
41
|
+
return true;
|
|
42
|
+
}).strict();
|
|
43
|
+
const isLinked = (contextFile) => {
|
|
44
|
+
const projectId = readContextFile(contextFile).projectId;
|
|
45
|
+
return typeof projectId === "string" && projectId.length > 0;
|
|
59
46
|
};
|
|
60
|
-
const handler = async (
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
sendError(cause, "NEON_INIT_FAILED");
|
|
86
|
-
writeAgentFailure(cause);
|
|
87
|
-
await closeAnalytics();
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
90
|
-
throw cause;
|
|
47
|
+
const handler = async (props) => {
|
|
48
|
+
if (props.output === "json" || props.output === "yaml") throw new Error(`\`${getCliName()} init\` does not support --output. The commands it runs print their own output.`);
|
|
49
|
+
const cwd = props.cwd ?? process.cwd();
|
|
50
|
+
const names = existsSync(cwd) ? readdirSync(cwd) : [];
|
|
51
|
+
const contextFile = resolve(cwd, props.contextFile);
|
|
52
|
+
const yes = props.yes === true;
|
|
53
|
+
const run = props.run ?? spawnCliChild;
|
|
54
|
+
const explicitKey = props.profile ? "" : credentialInputs().apiKeyFlag;
|
|
55
|
+
const authEnv = explicitKey ? { NEON_API_KEY: explicitKey } : void 0;
|
|
56
|
+
const forward = {
|
|
57
|
+
...props.configDir ? { configDir: props.configDir } : {},
|
|
58
|
+
...props.profile ? { profile: props.profile } : {},
|
|
59
|
+
apiHost: props.apiHost,
|
|
60
|
+
contextFile,
|
|
61
|
+
...props.analytics === false ? { analytics: false } : {}
|
|
62
|
+
};
|
|
63
|
+
if (directoryIsEmpty(names)) {
|
|
64
|
+
await runInitSteps([bootstrapInitStep(yes)], {
|
|
65
|
+
cwd,
|
|
66
|
+
run,
|
|
67
|
+
forward,
|
|
68
|
+
authEnv
|
|
69
|
+
});
|
|
70
|
+
log.info("Done.");
|
|
71
|
+
return;
|
|
91
72
|
}
|
|
73
|
+
await runAgentTooling({
|
|
74
|
+
cwd,
|
|
75
|
+
yes,
|
|
76
|
+
run,
|
|
77
|
+
forward,
|
|
78
|
+
authEnv,
|
|
79
|
+
...props.pickAgentSetup ? { pickAgentSetup: props.pickAgentSetup } : {},
|
|
80
|
+
...props.hasProjectPlugins ? { hasProjectPlugins: props.hasProjectPlugins } : {}
|
|
81
|
+
});
|
|
82
|
+
await runInitSteps(planExistingInit({
|
|
83
|
+
linked: isLinked(contextFile),
|
|
84
|
+
yes,
|
|
85
|
+
agentSetup: "skip"
|
|
86
|
+
}), {
|
|
87
|
+
cwd,
|
|
88
|
+
run,
|
|
89
|
+
forward,
|
|
90
|
+
authEnv
|
|
91
|
+
});
|
|
92
|
+
log.info("Done.");
|
|
92
93
|
};
|
|
93
94
|
//#endregion
|
|
94
|
-
export { builder, command, describe, handler, init_exports as t };
|
|
95
|
+
export { builder, command, describe, handler, initChildEnv, init_exports as t };
|