neon 8.12.0 → 8.12.1

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 CHANGED
@@ -1578,7 +1578,7 @@ Global options are supported with any Neon CLI command.
1578
1578
 
1579
1579
  - <a id="analytics"></a>`--analytics`
1580
1580
 
1581
- Analytics are enabled by default to gather information about the CLI commands and options that are used by our customers. This data collection assists in offering support, and allows for a better understanding of typical usage patterns so that we can improve user experience. Neon does not collect user-defined data, such as project IDs or command payloads, except the question passed to `neon ask --prompt` and the query passed to `neon docs search`. The Neon search service records each `neon docs search` query with the CLI version and the detected coding agent; with `--no-analytics` it records nothing. When the CLI fails on an internal bug (a JavaScript `TypeError`, `ReferenceError`, `RangeError`, or `SyntaxError`), it also sends that error to Neon's Sentry: the error type, the message only when it is a standard JavaScript message that names nothing but code (any other message is replaced), the stack trace with file paths cut to the package (`neon/dist/...`), the CLI and Node.js versions, and whether it ran in CI or a coding agent. To opt-out of analytics data collection and error reports, specify `--no-analytics` or `--analytics false`.
1581
+ Analytics are enabled by default to gather information about the CLI commands and options that are used by our customers. This data collection assists in offering support, and allows for a better understanding of typical usage patterns so that we can improve user experience. Neon does not collect user-defined data, such as project IDs or command payloads, except the question passed to `neon ask --prompt` and the query passed to `neon docs search`. Each successful command also reports the Neon agent skills recorded in the user-level skills lock and in the current directory's `skills-lock.json`: the skill names, their lock hashes, and whether each is behind its source, read from local files without a network request. The Neon search service records each `neon docs search` query with the CLI version and the detected coding agent; with `--no-analytics` it records nothing. When the CLI fails on an internal bug (a JavaScript `TypeError`, `ReferenceError`, `RangeError`, or `SyntaxError`), it also sends that error to Neon's Sentry: the error type, the message only when it is a standard JavaScript message that names nothing but code (any other message is replaced), the stack trace with file paths cut to the package (`neon/dist/...`), the CLI and Node.js versions, and whether it ran in CI or a coding agent. To opt-out of analytics data collection and error reports, specify `--no-analytics` or `--analytics false`.
1582
1582
 
1583
1583
  - <a id="version"></a>`-v, --version`
1584
1584
 
@@ -11,9 +11,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
11
11
  import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
12
12
  import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
13
13
  import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
14
- import { n as autoPullEnvAfterPin } from "./env-uVRY4xah.js";
15
- import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-BnwcGpbq.js";
16
- import { i as handler$1 } from "./link-DOM84hYj.js";
14
+ import { n as autoPullEnvAfterPin } from "./env-5HS5qQGd.js";
15
+ import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-BH_qRHiG.js";
16
+ import { i as handler$1 } from "./link-BgtkOBws.js";
17
17
  import chalk from "chalk";
18
18
  import prompts from "prompts";
19
19
  //#region src/commands/checkout.ts
@@ -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-uVRY4xah.js";
15
+ import { c as pull } from "./env-5HS5qQGd.js";
16
16
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
17
17
  import open from "open";
18
18
  import prompts from "prompts";
@@ -23,7 +23,7 @@ import { readGitContext } from "../utils/git.js";
23
23
  import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
24
24
  import { pickServicesInteractively } from "../utils/service_picker.js";
25
25
  import { zipBundle } from "../utils/zip.js";
26
- import { n as autoPullEnvAfterPin } from "./env-uVRY4xah.js";
26
+ import { n as autoPullEnvAfterPin } from "./env-5HS5qQGd.js";
27
27
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
28
28
  import { dirname, join, relative, resolve } from "node:path";
29
29
  import chalk from "chalk";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.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-BnwcGpbq.js";
3
+ import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-BH_qRHiG.js";
4
4
  import { DEPLOY_COMMANDS_EPILOGUE } from "../commands/deploy_help.js";
5
5
  //#region src/commands/deploy.ts
6
6
  var deploy_exports = /* @__PURE__ */ __exportAll({
@@ -4,12 +4,12 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
4
4
  import { getCliName } from "../utils/cli_name.js";
5
5
  import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
6
6
  import { l as functionBaseUrlKey } from "./env-BpP3Dqpe.js";
7
+ import { branchIdResolve } from "../utils/enrichers.js";
8
+ import { bundleEntry } from "../utils/esbuild.js";
7
9
  import { a as resolveDevEnv } from "./env-BNm69Qh8.js";
10
+ import { f as envFlag } from "./config-BH_qRHiG.js";
8
11
  import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
9
12
  import { resolveWatchInputs } from "../dev/inputs.js";
10
- import { branchIdResolve } from "../utils/enrichers.js";
11
- import { bundleEntry } from "../utils/esbuild.js";
12
- import { f as envFlag } from "./config-BnwcGpbq.js";
13
13
  import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
14
14
  import { basename, dirname, join, relative, resolve } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
5
5
  import { writer } from "../writer.js";
6
6
  import { neonSafeBranchName } from "../utils/branch_name.js";
7
7
  import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
8
- import { o as quoteFlagValue } from "./link-DOM84hYj.js";
9
- import { o as handler$1 } from "./checkout-BGvlLc43.js";
8
+ import { o as quoteFlagValue } from "./link-BgtkOBws.js";
9
+ import { o as handler$1 } from "./checkout-CXIOydqZ.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-uVRY4xah.js";
17
- import { h as initCmd } from "./config-BnwcGpbq.js";
16
+ import { n as autoPullEnvAfterPin } from "./env-5HS5qQGd.js";
17
+ import { h as initCmd } from "./config-BH_qRHiG.js";
18
18
  import { formatLinkSummary } from "../commands/link_output.js";
19
19
  import { r as REGIONS } from "./projects-BwI2Uo0z.js";
20
20
  import prompts from "prompts";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { fillSingleProject } from "../utils/enrichers.js";
3
- import { y as status } from "./config-BnwcGpbq.js";
3
+ import { y as status } from "./config-BH_qRHiG.js";
4
4
  //#region src/commands/status.ts
5
5
  var status_exports = /* @__PURE__ */ __exportAll({
6
6
  builder: () => builder,
package/dist/analytics.js CHANGED
@@ -296,6 +296,8 @@ const trackEvent = (event, properties) => {
296
296
  });
297
297
  log.debug("Sent CLI event: %s", event);
298
298
  };
299
+ /** Whether this process sends telemetry: analytics is on and the client was created. */
300
+ const isAnalyticsActive = () => client !== void 0;
299
301
  /**
300
302
  * Tracks cli_command_success. The account fields come from the lookup, which may still be in
301
303
  * flight when the command finishes, so they are read when the event is sent.
@@ -354,4 +356,4 @@ const getAnalyticsEventProperties = (args) => ({
354
356
  githubEnvVars: getGithubEnvVars(process.env)
355
357
  });
356
358
  //#endregion
357
- export { analyticsIdentity, analyticsMiddleware, closeAnalytics, commandSuccessProperties, getAnalyticsEventProperties, getErrorAnalyticsEventProperties, initAnalyticsClientMiddleware, recordCommandSuccessExtras, recordScaffoldedTemplate, sendError, storedCredentialAttribution, takeCommandSuccessExtras, telemetryCredential, trackCommandSuccess, trackEvent, useAnalyticsClientForTests };
359
+ export { analyticsIdentity, analyticsMiddleware, closeAnalytics, commandSuccessProperties, getAnalyticsEventProperties, getErrorAnalyticsEventProperties, initAnalyticsClientMiddleware, isAnalyticsActive, recordCommandSuccessExtras, recordScaffoldedTemplate, sendError, storedCredentialAttribution, takeCommandSuccessExtras, telemetryCredential, trackCommandSuccess, trackEvent, useAnalyticsClientForTests };
@@ -1 +1 @@
1
- export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-BGvlLc43.js";
1
+ export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CXIOydqZ.js";
@@ -1 +1 @@
1
- export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-DqzLXZMN.js";
1
+ export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-DqAvAvDm.js";
@@ -1 +1 @@
1
- export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-BnwcGpbq.js";
1
+ export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-BH_qRHiG.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-BCVcDR1O.js";
1
+ export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-D7B0Xfjg.js";
@@ -1 +1 @@
1
- export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-mrJKMt2R.js";
1
+ export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-CSvxAecE.js";
@@ -1 +1 @@
1
- export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-uVRY4xah.js";
1
+ export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-5HS5qQGd.js";
@@ -8,7 +8,7 @@ import { writer } from "../writer.js";
8
8
  import { formatInitDone, printInitDone } from "../init/chrome.js";
9
9
  import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
10
10
  import { displayPath } from "./env_output.js";
11
- import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-BnwcGpbq.js";
11
+ import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-BH_qRHiG.js";
12
12
  import { recommendedOperations } from "../functions/registry.js";
13
13
  import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
14
14
  import { describeRegistrySource, openRegistry } from "../functions/source.js";
@@ -1 +1 @@
1
- export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-pN4kMH0d.js";
1
+ export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-H32TNt6M.js";
@@ -2,29 +2,29 @@ import { r as auth_exports } from "../_chunks/auth-CIUtXByB.js";
2
2
  import { t as api_exports } from "../_chunks/api-GbEaBZJ5.js";
3
3
  import { n as api_keys_exports } from "../_chunks/api_keys-CNnnugbQ.js";
4
4
  import { n as ask_exports } from "../_chunks/ask-DVwy0eUL.js";
5
- import { o as env_exports } from "../_chunks/env-uVRY4xah.js";
6
- import { c as config_exports } from "../_chunks/config-BnwcGpbq.js";
5
+ import { o as env_exports } from "../_chunks/env-5HS5qQGd.js";
6
+ import { c as config_exports } from "../_chunks/config-BH_qRHiG.js";
7
7
  import { u as projects_exports } from "../_chunks/projects-BwI2Uo0z.js";
8
- import { a as link_exports } from "../_chunks/link-DOM84hYj.js";
8
+ import { a as link_exports } from "../_chunks/link-BgtkOBws.js";
9
9
  import { o as mcp_exports } from "../_chunks/mcp-Bo-7TKc7.js";
10
10
  import { c as plugins_exports } from "../_chunks/plugins-DqD7BDO1.js";
11
11
  import { l as skills_exports } from "../_chunks/skills-BP6pIm7O.js";
12
12
  import { t as bootstrap_exports } from "../_chunks/bootstrap-wPZWa1sT.js";
13
13
  import { r as branches_exports } from "../_chunks/branches-BNa1xX1L.js";
14
14
  import { n as bucket_exports } from "../_chunks/bucket-BCdryTkD.js";
15
- import { n as checkout_exports } from "../_chunks/checkout-BGvlLc43.js";
16
- import { o as claim_exports } from "../_chunks/claim-DqzLXZMN.js";
15
+ import { n as checkout_exports } from "../_chunks/checkout-CXIOydqZ.js";
16
+ import { o as claim_exports } from "../_chunks/claim-DqAvAvDm.js";
17
17
  import { a as connection_string_exports } from "../_chunks/connection_string-DB4awPzZ.js";
18
18
  import { a as credentials_exports } from "../_chunks/credentials-BSjE9fRR.js";
19
19
  import { r as data_api_exports } from "../_chunks/data_api-Djxj5ZQD.js";
20
20
  import { o as databases_exports } from "../_chunks/databases-Dok4wru7.js";
21
- import { r as deploy_exports } from "../_chunks/deploy-BCVcDR1O.js";
22
- import { s as dev_exports } from "../_chunks/dev-mrJKMt2R.js";
21
+ import { r as deploy_exports } from "../_chunks/deploy-D7B0Xfjg.js";
22
+ import { s as dev_exports } from "../_chunks/dev-CSvxAecE.js";
23
23
  import { i as diff_exports } from "../_chunks/diff-DhxxbdQE.js";
24
24
  import { c as docs_exports } from "../_chunks/docs-CrVybkTP.js";
25
25
  import { o as feedback_exports } from "../_chunks/feedback-CMayyTa8.js";
26
26
  import { o as functions_exports } from "../_chunks/functions-Q0zuvtnk.js";
27
- import { o as git_exports } from "../_chunks/git-pN4kMH0d.js";
27
+ import { o as git_exports } from "../_chunks/git-H32TNt6M.js";
28
28
  import { a as init_exports } from "../_chunks/init-BkA6RilG.js";
29
29
  import { o as inspect_exports } from "../_chunks/inspect-g0wekylj.js";
30
30
  import { a as ip_allow_exports } from "../_chunks/ip_allow-5lLFvIuE.js";
@@ -39,7 +39,7 @@ import { s as realtime_exports } from "../_chunks/realtime-BRqIyGR-.js";
39
39
  import { l as roles_exports } from "../_chunks/roles-B4w3YT_7.js";
40
40
  import { a as set_context_exports } from "../_chunks/set_context-DbrwoImy.js";
41
41
  import { s as snapshots_exports } from "../_chunks/snapshots-RJBzW8GM.js";
42
- import { a as status_exports } from "../_chunks/status-DoNjIbKf.js";
42
+ import { a as status_exports } from "../_chunks/status-DV8Z2kw3.js";
43
43
  import { d as triggers_exports } from "../_chunks/triggers-BrRo1z4b.js";
44
44
  import { s as user_exports } from "../_chunks/user-dlOGXbX9.js";
45
45
  import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-CNb0YfMo.js";
@@ -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-DOM84hYj.js";
1
+ export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-BgtkOBws.js";
@@ -1 +1 @@
1
- export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-DoNjIbKf.js";
1
+ export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-DV8Z2kw3.js";
@@ -1,6 +1,6 @@
1
1
  import { writer } from "../writer.js";
2
- import { o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
3
2
  import { branchIdFromProps } from "../utils/enrichers.js";
3
+ import { o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
4
4
  import YAML from "yaml";
5
5
  //#region src/commands/subscribe.ts
6
6
  const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { r as defaultDir } from "./_chunks/paths-DMq0Lt7a.js";
6
6
  import { ensureConfigDir } from "./config.js";
7
7
  import { currentContextFile, enrichFromContext } from "./context.js";
8
8
  import { NETWORK_ERROR_MESSAGE, isNetworkError, matchErrorCode } from "./errors.js";
9
- import { analyticsMiddleware, closeAnalytics, initAnalyticsClientMiddleware, sendError, takeCommandSuccessExtras, trackCommandSuccess } from "./analytics.js";
9
+ import { analyticsMiddleware, closeAnalytics, initAnalyticsClientMiddleware, isAnalyticsActive, recordCommandSuccessExtras, sendError, takeCommandSuccessExtras, trackCommandSuccess } from "./analytics.js";
10
10
  import { AuthRefreshError, defaultClientID } from "./auth.js";
11
11
  import { getCliName } from "./utils/cli_name.js";
12
12
  import { c as ensureAuth } from "./_chunks/auth-CIUtXByB.js";
@@ -208,6 +208,15 @@ async function handleError(msg, err, canRetry) {
208
208
  await preloadCommand(builder, hideBin(process.argv));
209
209
  while (attempts < MAX_ATTEMPTS) try {
210
210
  const args = await builder.argv;
211
+ const configDir = typeof args.configDir === "string" ? args.configDir : defaultDir;
212
+ if (isAnalyticsActive()) {
213
+ const { readSkillsTelemetry } = await import("./skills/freshness.js");
214
+ const skills = readSkillsTelemetry({
215
+ configDir,
216
+ cwd: process.cwd()
217
+ });
218
+ if (skills !== void 0) recordCommandSuccessExtras({ skills });
219
+ }
211
220
  trackCommandSuccess(args);
212
221
  if (args._.length === 0 || args.help) {
213
222
  await showHelp(builder);
@@ -216,7 +225,7 @@ async function handleError(msg, err, canRetry) {
216
225
  await closeAnalytics();
217
226
  const notifier = {
218
227
  commandPath: args._.map(String),
219
- configDir: typeof args.configDir === "string" ? args.configDir : defaultDir,
228
+ configDir,
220
229
  currentBranch: Boolean(args.currentBranch),
221
230
  output: typeof args.output === "string" ? args.output : "table"
222
231
  };
package/dist/init/auth.js CHANGED
@@ -4,7 +4,7 @@ import "../config.js";
4
4
  import "../auth.js";
5
5
  import { c as ensureAuth } from "../_chunks/auth-CIUtXByB.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { c as pull } from "../_chunks/env-uVRY4xah.js";
7
+ import { c as pull } from "../_chunks/env-5HS5qQGd.js";
8
8
  import { c as setupNeonMcp } from "../_chunks/mcp-Bo-7TKc7.js";
9
9
  //#region src/init/auth.ts
10
10
  const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
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-CIUtXByB.js";
6
6
  import { recoverFrom401 } from "../auth_recovery.js";
7
- import { s as runLink } from "../_chunks/link-DOM84hYj.js";
7
+ import { s as runLink } from "../_chunks/link-BgtkOBws.js";
8
8
  //#region 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
@@ -17,15 +17,15 @@ import { FALLBACK_SKILLS_AGENTS, assertNamedAgentTooling, funnelAgentSetup, plan
17
17
  import { inferPackageManager, resolvePackageManager } from "../utils/package_manager.js";
18
18
  import { 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, unattendedUnauthedNext } from "./copy.js";
19
19
  import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
20
- import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-BnwcGpbq.js";
21
- import { o as quoteFlagValue, s as runLink } from "../_chunks/link-DOM84hYj.js";
20
+ import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-BH_qRHiG.js";
21
+ import { o as quoteFlagValue, s as runLink } from "../_chunks/link-BgtkOBws.js";
22
22
  import { runAuthenticatedLink } from "./link.js";
23
23
  import { CannotMintApiKeyError } from "../mcp/mint.js";
24
24
  import { pullInitEnv } from "./auth.js";
25
25
  import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
26
26
  import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
27
27
  import { runToolingSteps } from "./tooling.js";
28
- import { l as create } from "../_chunks/claim-DqzLXZMN.js";
28
+ import { l as create } from "../_chunks/claim-DqAvAvDm.js";
29
29
  import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
30
30
  import { detectInitEnvironment } from "./detect.js";
31
31
  import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties } from "./funnel.js";
@@ -24,9 +24,6 @@ const isRecord = (value) => typeof value === "object" && value !== null && !Arra
24
24
  const SKILL_NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
25
25
  const skillFolder = (skillPath) => skillPath.replace(/\\/g, "/").replace(/\/?SKILL\.md$/i, "");
26
26
  /**
27
- * Entries pinned to a `ref` are left out: `neon skills` never pins one, and a pinned skill
28
- * tracks that ref rather than the repository's default branch.
29
- *
30
27
  * The global lock's `skillFolderHash` is usually a tree SHA, but the skills CLI stores a
31
28
  * content SHA-256 there when it installed from a Git clone; it tells them apart by length.
32
29
  */
@@ -39,7 +36,7 @@ const parseSkillsLock = (raw, scope) => {
39
36
  if (!isRecord(entry)) continue;
40
37
  const { source, skillPath, ref } = entry;
41
38
  const hash = entry[field];
42
- if (!SKILL_NAME.test(skill) || typeof source !== "string" || !NEON_SOURCES.has(source) || ref !== void 0 || typeof skillPath !== "string" || typeof hash !== "string" || hash === "") continue;
39
+ if (!SKILL_NAME.test(skill) || typeof source !== "string" || !NEON_SOURCES.has(source) || typeof skillPath !== "string" || typeof hash !== "string" || hash === "") continue;
43
40
  const folder = skillFolder(skillPath);
44
41
  if (folder === "") continue;
45
42
  const hashKind = scope === "global" && /^[0-9a-f]{40}$/i.test(hash) ? "tree" : "content";
@@ -49,12 +46,13 @@ const parseSkillsLock = (raw, scope) => {
49
46
  source,
50
47
  folder,
51
48
  hash,
52
- hashKind
49
+ hashKind,
50
+ pinned: ref !== void 0
53
51
  });
54
52
  }
55
53
  return skills;
56
54
  };
57
- const readLockedSkills = (path, scope) => {
55
+ const readAllLockedSkills = (path, scope) => {
58
56
  if (!existsSync(path)) return [];
59
57
  const raw = readLockFile(path);
60
58
  try {
@@ -63,6 +61,8 @@ const readLockedSkills = (path, scope) => {
63
61
  throw new Error(`${path} is not valid JSON.`);
64
62
  }
65
63
  };
64
+ /** The skills the update check covers: every Neon skill in the lock except pinned ones. */
65
+ const readLockedSkills = (path, scope) => readAllLockedSkills(path, scope).filter((skill) => !skill.pinned);
66
66
  const MAX_LOCK_BYTES = 1048576;
67
67
  /**
68
68
  * A project lock is repository content: a FIFO would block the open and `/dev/zero` the read,
@@ -303,26 +303,74 @@ const spawnSkillsCheckWorker = (cachePath, cwd) => {
303
303
  log.debug("Could not start the skills check: %s", error instanceof Error ? error.message : String(error));
304
304
  }
305
305
  };
306
+ /** Every Neon skill in the lock, pinned ones included. */
307
+ const readLock = (path, scope) => ({
308
+ skills: readAllLockedSkills(path, scope),
309
+ modifiedAt: statSync(path, { throwIfNoEntry: false })?.mtimeMs ?? 0
310
+ });
311
+ const readLocks = (cwd) => ({
312
+ global: readLock(globalLockPath(), "global"),
313
+ project: readLock(projectLockPath(cwd), "project")
314
+ });
315
+ /**
316
+ * `outdated` is `null` when the cache cannot answer: no successful check yet, a check still
317
+ * pending for the folder, a lock written after the last check, a folder gone upstream, or a
318
+ * pinned skill.
319
+ */
320
+ const skillsTelemetry = (locks, cache) => {
321
+ const scope = ({ skills, modifiedAt }) => {
322
+ if (skills.length === 0) return { installed: false };
323
+ const known = cache !== void 0 && cache.checkedAt > 0 && modifiedAt <= cache.checkedAt;
324
+ return {
325
+ installed: true,
326
+ skills: Object.fromEntries(skills.map((skill) => {
327
+ const remote = cache?.folders[folderKey(skill)];
328
+ const status = known && !skill.pinned && remote?.pending !== true ? skillStatus(skill, remote) : void 0;
329
+ return [skill.skill, {
330
+ hash: skill.hash,
331
+ outdated: status === "outdated" ? true : status === "up to date" ? false : null
332
+ }];
333
+ }))
334
+ };
335
+ };
336
+ return {
337
+ checkedAt: cache !== void 0 && cache.checkedAt > 0 ? cache.checkedAt : null,
338
+ global: scope(locks.global),
339
+ project: scope(locks.project)
340
+ };
341
+ };
342
+ /**
343
+ * Reads only local files. `undefined` when a lock can't be read, which leaves the property
344
+ * off the event rather than reporting skills as not installed.
345
+ */
346
+ const readSkillsTelemetry = ({ configDir, cwd }) => {
347
+ try {
348
+ return skillsTelemetry(readLocks(cwd), readSkillsCheckCache(skillsCheckCachePath(configDir)));
349
+ } catch (error) {
350
+ log.debug("Leaving skills out of telemetry: %s", error instanceof Error ? error.message : String(error));
351
+ return;
352
+ }
353
+ };
306
354
  /**
307
355
  * Warns at most once a day when a Neon skill in the user-level lock or this directory's
308
356
  * `skills-lock.json` is behind its source, from a cache a background worker refreshes daily.
309
357
  */
310
358
  const notifyIfSkillsOutdated = ({ configDir, cwd, now = Date.now() }) => {
311
- const lockPaths = [globalLockPath(), projectLockPath(cwd)];
312
- let skills;
359
+ let locks;
313
360
  try {
314
- skills = [...readLockedSkills(lockPaths[0], "global"), ...readLockedSkills(lockPaths[1], "project")];
361
+ locks = readLocks(cwd);
315
362
  } catch (error) {
316
363
  log.debug("Skipping the skills check: %s", error instanceof Error ? error.message : String(error));
317
364
  return;
318
365
  }
366
+ const skills = [...locks.global.skills, ...locks.project.skills].filter((skill) => !skill.pinned);
319
367
  if (skills.length === 0) return;
320
368
  const cachePath = skillsCheckCachePath(configDir);
321
369
  const cache = readSkillsCheckCache(cachePath);
322
370
  const plan = planSkillsCheck({
323
371
  skills,
324
372
  cache,
325
- lockModifiedAt: Math.max(...lockPaths.map((path) => statSync(path, { throwIfNoEntry: false })?.mtimeMs ?? 0)),
373
+ lockModifiedAt: Math.max(locks.global.modifiedAt, locks.project.modifiedAt),
326
374
  now
327
375
  });
328
376
  const notice = formatSkillsNotice(plan.outdated);
@@ -346,4 +394,4 @@ const notifyIfSkillsOutdated = ({ configDir, cwd, now = Date.now() }) => {
346
394
  }, "skills check cache")) spawnSkillsCheckWorker(cachePath, cwd);
347
395
  };
348
396
  //#endregion
349
- export { formatSkillsNotice, globalLockPath, lockPath, neonSkillsUpdateCommand, notifyIfSkillsOutdated, parseSkillsCheckCache, parseSkillsLock, planSkillsCheck, projectLockPath, readLockedSkills, refreshSkillsCheckCache, scopeLabel, skillContentHash, skillStatus, skillsCheckCachePath, skillsStatusRows };
397
+ export { formatSkillsNotice, globalLockPath, lockPath, neonSkillsUpdateCommand, notifyIfSkillsOutdated, parseSkillsCheckCache, parseSkillsLock, planSkillsCheck, projectLockPath, readLockedSkills, readSkillsTelemetry, refreshSkillsCheckCache, scopeLabel, skillContentHash, skillStatus, skillsCheckCachePath, skillsStatusRows, skillsTelemetry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "8.12.0",
3
+ "version": "8.12.1",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -111,10 +111,10 @@
111
111
  "tsx": "4.22.3",
112
112
  "typescript": "^5.9.0",
113
113
  "vitest": "^3.0.9",
114
+ "@neon-internals/cli-core": "0.0.0",
114
115
  "@neon-internals/env-core": "0.0.35",
115
116
  "@neon/e2e-harness": "0.0.0",
116
117
  "@neon/env": "1.6.5",
117
- "@neon-internals/cli-core": "0.0.0",
118
118
  "@neon/functions": "0.11.0"
119
119
  },
120
120
  "publishConfig": {
@@ -7,9 +7,9 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
7
7
  import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
8
8
  import { t as NEON_ENV_VAR_KEYS, u as isFunctionBaseUrlKey } from "./env-BpP3Dqpe.js";
9
9
  import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
10
- import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-BNm69Qh8.js";
11
10
  import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
12
11
  import { warnAiGateway } from "../utils/ai_gateway_notice.js";
12
+ import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-BNm69Qh8.js";
13
13
  import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
14
14
  import { existsSync } from "node:fs";
15
15
  import chalk from "chalk";