kitcn 0.12.27 → 0.13.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.
Files changed (72) hide show
  1. package/dist/aggregate/index.d.ts +1 -1
  2. package/dist/aggregate/index.js +1 -1
  3. package/dist/auth/client/index.d.ts +312 -4
  4. package/dist/auth/client/index.js +17 -5
  5. package/dist/auth/config/index.d.ts +1 -1
  6. package/dist/auth/generated/index.d.ts +1 -1
  7. package/dist/auth/generated/index.js +1 -1
  8. package/dist/auth/http/index.d.ts +12 -9
  9. package/dist/auth/http/index.js +35 -6
  10. package/dist/auth/index.d.ts +292 -8
  11. package/dist/auth/index.js +29 -23
  12. package/dist/auth/nextjs/index.d.ts +4 -3
  13. package/dist/auth/nextjs/index.js +9 -4
  14. package/dist/auth/start/index.d.ts +13 -3
  15. package/dist/auth/start/index.js +97 -8
  16. package/dist/{backend-core-DqCCa0nr.mjs → backend-core-CXmrWqdi.mjs} +122 -48
  17. package/dist/{builder-Cb6gloDB.js → builder-DBgto1yn.js} +4 -3
  18. package/dist/{caller-factory-cTXNvYdz.js → caller-factory-NEfgD5E0.js} +3 -3
  19. package/dist/cli.mjs +26 -26
  20. package/dist/convex-plugin-C3N9BB-J.js +275 -0
  21. package/dist/convex-plugin-tWTDqoKJ.mjs +276 -0
  22. package/dist/{create-schema-orm-DOyiNDCx.js → create-schema-orm-B3f2Kc8O.js} +1 -1
  23. package/dist/crpc/index.d.ts +2 -2
  24. package/dist/crpc/index.js +3 -3
  25. package/dist/{customFunctions-C0voKmtx.js → customFunctions-DxEEO4Dq.js} +2 -1
  26. package/dist/{generated-contract-disabled-21YxPk5W.d.ts → generated-contract-disabled-C_-KWRfT.d.ts} +4 -2
  27. package/dist/{http-types-BLFA9zS7.d.ts → http-types-zsMHb_QN.d.ts} +2 -2
  28. package/dist/{middleware-DkIhQXwg.js → middleware-Bg-PdtrI.js} +1 -1
  29. package/dist/{middleware-nS_qXecO.d.ts → middleware-DrtexzF3.d.ts} +1 -1
  30. package/dist/orm/index.d.ts +3 -3
  31. package/dist/orm/index.js +3 -3
  32. package/dist/plugins/index.d.ts +1 -1
  33. package/dist/plugins/index.js +1 -1
  34. package/dist/{procedure-caller-AjLfkHyF.js → procedure-caller-DplSC7Us.js} +2 -2
  35. package/dist/{procedure-name-D-fDCBlo.d.ts → procedure-name-BCRBr6Po.d.ts} +3 -3
  36. package/dist/ratelimit/index.d.ts +2 -2
  37. package/dist/ratelimit/index.js +3 -3
  38. package/dist/react/index.d.ts +18 -14
  39. package/dist/react/index.js +14 -27
  40. package/dist/rsc/index.d.ts +4 -4
  41. package/dist/rsc/index.js +4 -4
  42. package/dist/{runtime-CtvJPkur.js → runtime-i6t-HoZn.js} +1 -1
  43. package/dist/server/index.d.ts +4 -4
  44. package/dist/server/index.js +4 -4
  45. package/dist/solid/index.d.ts +300 -4
  46. package/dist/token-B9Bjcqug.d.ts +13 -0
  47. package/dist/token-tpipF-7y.js +47 -0
  48. package/dist/{types-C6pQrnzD.d.ts → types-YHpe0rsb.d.ts} +1 -1
  49. package/dist/upstream-BR6sBLg3.js +84 -0
  50. package/dist/upstream-BUCdbLok.mjs +26 -0
  51. package/dist/{validators-B7oIJCAp.js → validators-C7LelqTN.js} +2 -84
  52. package/dist/watcher.mjs +1 -1
  53. package/dist/{where-clause-compiler-DdjN63Io.d.ts → where-clause-compiler-TMppDl9g.d.ts} +51 -51
  54. package/package.json +5 -4
  55. package/skills/convex/references/features/auth.md +20 -0
  56. package/skills/convex/references/setup/auth.md +2 -0
  57. package/skills/convex/references/setup/index.md +5 -5
  58. package/skills/convex/references/setup/server.md +1 -1
  59. /package/dist/{api-entry-BUAh_K4k.js → api-entry-N3nBOlI2.js} +0 -0
  60. /package/dist/{context-utils-BvWW0Ilq.d.ts → context-utils-OMkMGhBk.d.ts} +0 -0
  61. /package/dist/{create-schema-odyF4kCy.js → create-schema-BXrKE2YY.js} +0 -0
  62. /package/dist/{error-BZEnI7Sq.js → error-Bvo7YEhk.js} +0 -0
  63. /package/dist/{generated-contract-disabled-Cih4eITO.js → generated-contract-disabled-BXaz7JCE.js} +0 -0
  64. /package/dist/{meta-utils-0Pu0Nrap.js → meta-utils-D9K4fICl.js} +0 -0
  65. /package/dist/{query-context-CFZqIvD7.d.ts → query-context-CNo9ffvI.d.ts} +0 -0
  66. /package/dist/{query-context-B8o6-8kC.js → query-context-ydn9kb6P.js} +0 -0
  67. /package/dist/{query-options-Dw7cOyXl.js → query-options-C96zLANM.js} +0 -0
  68. /package/dist/{transformer-DtDhR3Lc.js → transformer-C6pGVHqx.js} +0 -0
  69. /package/dist/{types-BiJE7qxR.d.ts → types-BCl8gfGy.d.ts} +0 -0
  70. /package/dist/{types-a-RHmrDZ.d.ts → types-CnTpHR1F.d.ts} +0 -0
  71. /package/dist/{types-BTb_4BaU.d.ts → types-DF2cg_w0.d.ts} +0 -0
  72. /package/dist/{validators-vzRKjBJC.d.ts → validators-BhsByJeg.d.ts} +0 -0
@@ -1,8 +1,31 @@
1
- import { convexBetterAuthReactStart as convexBetterAuthReactStart$1 } from "@convex-dev/better-auth/react-start";
2
-
3
- export * from "@convex-dev/better-auth/react-start"
1
+ import { t as getToken } from "../../token-tpipF-7y.js";
2
+ import { stripIndent } from "common-tags";
3
+ import { ConvexHttpClient } from "convex/browser";
4
+ import React from "react";
4
5
 
5
6
  //#region src/auth-start/index.ts
7
+ const fallbackCache = (fn) => fn;
8
+ const cache = React.cache ?? fallbackCache;
9
+ const TANSTACK_REACT_START_SERVER = "@tanstack/react-start/server";
10
+ const TRAILING_COLON_RE = /:$/;
11
+ function setupClient(options) {
12
+ const client = new ConvexHttpClient(options.convexUrl);
13
+ if (options.token !== void 0) client.setAuth(options.token);
14
+ client.setFetchOptions?.({ cache: "no-store" });
15
+ return client;
16
+ }
17
+ const parseConvexSiteUrl = (url) => {
18
+ if (!url) throw new Error(stripIndent`
19
+ CONVEX_SITE_URL is not set.
20
+ This is automatically set in the Convex backend, but must be set in the TanStack Start environment.
21
+ For local development, this can be set in the .env.local file.
22
+ `);
23
+ if (url.endsWith(".convex.cloud")) throw new Error(stripIndent`
24
+ CONVEX_SITE_URL should be set to your Convex Site URL, which ends in .convex.site.
25
+ Currently set to ${url}.
26
+ `);
27
+ return url;
28
+ };
6
29
  const appendSetCookieHeaders = (target, source) => {
7
30
  const getSetCookie = source.getSetCookie;
8
31
  if (typeof getSetCookie === "function") {
@@ -26,13 +49,79 @@ const cloneAuthHandlerResponse = (response) => {
26
49
  statusText: response.statusText
27
50
  });
28
51
  };
29
- const convexBetterAuthReactStart = ((...args) => {
30
- const auth = convexBetterAuthReactStart$1(...args);
52
+ const handler = (request, opts) => {
53
+ const requestUrl = new URL(request.url);
54
+ const nextUrl = `${opts.convexSiteUrl}${requestUrl.pathname}${requestUrl.search}`;
55
+ const headers = new Headers(request.headers);
56
+ const proto = requestUrl.protocol.replace(TRAILING_COLON_RE, "");
57
+ headers.set("accept-encoding", "application/json");
58
+ headers.set("host", new URL(opts.convexSiteUrl).host);
59
+ headers.set("x-forwarded-host", requestUrl.host);
60
+ headers.set("x-forwarded-proto", proto);
61
+ headers.set("x-better-auth-forwarded-host", requestUrl.host);
62
+ headers.set("x-better-auth-forwarded-proto", proto);
63
+ return fetch(nextUrl, {
64
+ body: request.method !== "GET" && request.method !== "HEAD" ? request.body : void 0,
65
+ duplex: "half",
66
+ headers,
67
+ method: request.method,
68
+ redirect: "manual"
69
+ });
70
+ };
71
+ const convexBetterAuthReactStart = (opts) => {
72
+ const siteUrl = parseConvexSiteUrl(opts.convexSiteUrl);
73
+ const cachedGetToken = cache(async (opts) => {
74
+ const { getRequestHeaders } = await import(TANSTACK_REACT_START_SERVER);
75
+ const headers = getRequestHeaders();
76
+ const mutableHeaders = new Headers(headers);
77
+ mutableHeaders.delete("content-length");
78
+ mutableHeaders.delete("transfer-encoding");
79
+ mutableHeaders.set("accept-encoding", "identity");
80
+ return getToken(siteUrl, mutableHeaders, opts);
81
+ });
82
+ const callWithToken = async (fn) => {
83
+ const token = await cachedGetToken(opts) ?? {};
84
+ try {
85
+ return await fn(token?.token);
86
+ } catch (error) {
87
+ if (!opts?.jwtCache?.enabled || token.isFresh || !opts.jwtCache?.isAuthError(error)) throw error;
88
+ return await fn((await cachedGetToken({
89
+ ...opts,
90
+ forceRefresh: true
91
+ })).token);
92
+ }
93
+ };
31
94
  return {
32
- ...auth,
33
- handler: async (request) => cloneAuthHandlerResponse(await auth.handler(request))
95
+ getToken: async () => {
96
+ return (await cachedGetToken(opts)).token;
97
+ },
98
+ handler: async (request) => cloneAuthHandlerResponse(await handler(request, opts)),
99
+ fetchAuthQuery: async (query, ...args) => {
100
+ return callWithToken((token) => {
101
+ return setupClient({
102
+ ...opts,
103
+ token
104
+ }).query(query, ...args);
105
+ });
106
+ },
107
+ fetchAuthMutation: async (mutation, ...args) => {
108
+ return callWithToken((token) => {
109
+ return setupClient({
110
+ ...opts,
111
+ token
112
+ }).mutation(mutation, ...args);
113
+ });
114
+ },
115
+ fetchAuthAction: async (action, ...args) => {
116
+ return callWithToken((token) => {
117
+ return setupClient({
118
+ ...opts,
119
+ token
120
+ }).action(action, ...args);
121
+ });
122
+ }
34
123
  };
35
- });
124
+ };
36
125
 
37
126
  //#endregion
38
127
  export { convexBetterAuthReactStart };
@@ -6159,14 +6159,18 @@ function resolveProjectScaffoldContext(params = {}) {
6159
6159
  //#endregion
6160
6160
  //#region src/cli/supported-dependencies.ts
6161
6161
  const EXACT_VERSION_RE = /^(\d+)\.(\d+)\.\d+$/;
6162
- const SUPPORTED_CONVEX_VERSION = "1.33.0";
6163
- const SUPPORTED_BETTER_AUTH_VERSION = "1.5.3";
6162
+ const VERSION_IN_SPEC_RE = /(\d+)\.(\d+)(?:\.\d+)?/;
6163
+ const PLAIN_VERSION_SPEC_RE = /^[\^~]?v?\d+\.\d+(?:\.\d+)?$/;
6164
+ const UPPER_BOUND_RE = /(?:^|\s)<={0,1}\s*v?(\d+)\.(\d+)(?:\.\d+)?/g;
6165
+ const SUPPORTED_CONVEX_VERSION = "1.35.1";
6166
+ const SUPPORTED_BETTER_AUTH_VERSION = "1.6.5";
6164
6167
  const SUPPORTED_HONO_VERSION = "4.12.9";
6165
6168
  const SUPPORTED_OPENTELEMETRY_API_VERSION = "1.9.0";
6166
6169
  const SUPPORTED_TANSTACK_REACT_QUERY_VERSION = "5.95.2";
6167
6170
  const SUPPORTED_ZOD_VERSION = "4.3.6";
6168
6171
  const KITCN_INSTALL_SPEC_ENV = "KITCN_INSTALL_SPEC";
6169
6172
  const KITCN_RESEND_INSTALL_SPEC_ENV = "KITCN_RESEND_INSTALL_SPEC";
6173
+ let ownVersion;
6170
6174
  function getMinimumVersionRange(version) {
6171
6175
  const match = EXACT_VERSION_RE.exec(version);
6172
6176
  if (!match) throw new Error(`Unsupported exact version "${version}". Expected x.y.z format.`);
@@ -6189,10 +6193,37 @@ const LOCAL_INSTALL_SPEC_ENV_BY_PACKAGE_NAME = {
6189
6193
  "@kitcn/resend": KITCN_RESEND_INSTALL_SPEC_ENV
6190
6194
  };
6191
6195
  function resolveSupportedDependencyInstallSpec(spec, env = process.env) {
6196
+ if (getPackageNameFromInstallSpec(spec) === "kitcn") return resolveScaffoldInstallSpec(env);
6192
6197
  const envKey = LOCAL_INSTALL_SPEC_ENV_BY_PACKAGE_NAME[getPackageNameFromInstallSpec(spec)];
6193
6198
  const override = envKey ? env[envKey]?.trim() : void 0;
6194
6199
  return override && override.length > 0 ? override : spec;
6195
6200
  }
6201
+ function readOwnVersion() {
6202
+ if (ownVersion !== void 0) return ownVersion ?? void 0;
6203
+ let currentDir = dirname(fileURLToPath(import.meta.url));
6204
+ while (true) {
6205
+ const packageJsonPath = join(currentDir, "package.json");
6206
+ if (fs.existsSync(packageJsonPath)) {
6207
+ const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
6208
+ if (parsed.name === "kitcn") {
6209
+ ownVersion = parsed.version ?? null;
6210
+ return ownVersion ?? void 0;
6211
+ }
6212
+ }
6213
+ const parentDir = dirname(currentDir);
6214
+ if (parentDir === currentDir) {
6215
+ ownVersion = null;
6216
+ return;
6217
+ }
6218
+ currentDir = parentDir;
6219
+ }
6220
+ }
6221
+ function resolveScaffoldInstallSpec(env = process.env) {
6222
+ const override = env[KITCN_INSTALL_SPEC_ENV]?.trim();
6223
+ if (override) return override;
6224
+ const version = readOwnVersion();
6225
+ return version ? `kitcn@${version}` : "kitcn";
6226
+ }
6196
6227
  const SUPPORTED_DEPENDENCY_VERSIONS = {
6197
6228
  convex: {
6198
6229
  exact: SUPPORTED_CONVEX_VERSION,
@@ -6221,6 +6252,73 @@ const BASELINE_DEPENDENCY_INSTALL_SPECS = [
6221
6252
  PINNED_HONO_INSTALL_SPEC
6222
6253
  ];
6223
6254
  const INIT_TEMPLATE_DEPENDENCY_INSTALL_SPECS = ["superjson"];
6255
+ const DEPENDENCY_SECTIONS = [
6256
+ "dependencies",
6257
+ "devDependencies",
6258
+ "peerDependencies",
6259
+ "optionalDependencies"
6260
+ ];
6261
+ function findNearestPackageJsonPath$2(cwd) {
6262
+ let currentDir = cwd;
6263
+ while (true) {
6264
+ const packageJsonPath = join(currentDir, "package.json");
6265
+ if (fs.existsSync(packageJsonPath)) return packageJsonPath;
6266
+ const parentDir = dirname(currentDir);
6267
+ if (parentDir === currentDir) return;
6268
+ currentDir = parentDir;
6269
+ }
6270
+ }
6271
+ function readDependencyVersion(packageJson, packageName) {
6272
+ for (const section of DEPENDENCY_SECTIONS) {
6273
+ const version = packageJson[section]?.[packageName];
6274
+ if (version) return version;
6275
+ }
6276
+ }
6277
+ function readInstalledDependencyVersion(packageJsonPath, packageName) {
6278
+ const installedPackageJsonPath = join(dirname(packageJsonPath), "node_modules", ...packageName.split("/"), "package.json");
6279
+ if (!fs.existsSync(installedPackageJsonPath)) return;
6280
+ return JSON.parse(fs.readFileSync(installedPackageJsonPath, "utf8")).version;
6281
+ }
6282
+ function compareMajorMinor(aMajor, aMinor, bMajor, bMinor) {
6283
+ if (aMajor !== bMajor) return aMajor - bMajor;
6284
+ return aMinor - bMinor;
6285
+ }
6286
+ function isConcreteVersionSpecBelowMinimum(spec, minimum) {
6287
+ const specMatch = VERSION_IN_SPEC_RE.exec(spec);
6288
+ const minimumMatch = VERSION_IN_SPEC_RE.exec(minimum);
6289
+ if (!specMatch || !minimumMatch) return false;
6290
+ return compareMajorMinor(Number(specMatch[1]), Number(specMatch[2]), Number(minimumMatch[1]), Number(minimumMatch[2])) < 0;
6291
+ }
6292
+ function isDeclaredVersionSpecBelowMinimum(spec, minimum) {
6293
+ const normalized = spec.trim();
6294
+ if (PLAIN_VERSION_SPEC_RE.test(normalized)) return isConcreteVersionSpecBelowMinimum(normalized, minimum);
6295
+ const minimumMatch = VERSION_IN_SPEC_RE.exec(minimum);
6296
+ if (!minimumMatch) return false;
6297
+ const minimumMajor = Number(minimumMatch[1]);
6298
+ const minimumMinor = Number(minimumMatch[2]);
6299
+ for (const match of normalized.matchAll(UPPER_BOUND_RE)) if (compareMajorMinor(Number(match[1]), Number(match[2]), minimumMajor, minimumMinor) <= 0) return true;
6300
+ return false;
6301
+ }
6302
+ function resolveSupportedDependencyWarnings(cwd = process.cwd()) {
6303
+ const packageJsonPath = findNearestPackageJsonPath$2(cwd);
6304
+ if (!packageJsonPath) return [];
6305
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
6306
+ const installedConvexVersion = readInstalledDependencyVersion(packageJsonPath, "convex");
6307
+ if (installedConvexVersion && isConcreteVersionSpecBelowMinimum(installedConvexVersion, SUPPORTED_DEPENDENCY_VERSIONS.convex.minimum)) return [{
6308
+ packageName: "convex",
6309
+ current: installedConvexVersion,
6310
+ minimum: SUPPORTED_DEPENDENCY_VERSIONS.convex.minimum,
6311
+ installSpec: PINNED_CONVEX_INSTALL_SPEC
6312
+ }];
6313
+ const convexVersion = readDependencyVersion(packageJson, "convex");
6314
+ if (!convexVersion || !isDeclaredVersionSpecBelowMinimum(convexVersion, SUPPORTED_DEPENDENCY_VERSIONS.convex.minimum)) return [];
6315
+ return [{
6316
+ packageName: "convex",
6317
+ current: convexVersion,
6318
+ minimum: SUPPORTED_DEPENDENCY_VERSIONS.convex.minimum,
6319
+ installSpec: PINNED_CONVEX_INSTALL_SPEC
6320
+ }];
6321
+ }
6224
6322
 
6225
6323
  //#endregion
6226
6324
  //#region src/cli/registry/dependencies.ts
@@ -6257,7 +6355,7 @@ const resolvePackageJsonInstallTarget = () => {
6257
6355
  const resolveBunPeerWarningPreinstallSpecs = () => {
6258
6356
  const { packageJsonPath, packageJson } = resolvePackageJsonInstallTarget();
6259
6357
  if (!packageJsonPath || !packageJson) return [];
6260
- if (!(hasDependency(packageJson, "kitcn") || hasDependency(packageJson, "better-auth") || hasDependency(packageJson, "@convex-dev/better-auth"))) return [];
6358
+ if (!(hasDependency(packageJson, "kitcn") || hasDependency(packageJson, "better-auth"))) return [];
6261
6359
  if (hasDependency(packageJson, getPackageNameFromInstallSpec(OPENTELEMETRY_API_INSTALL_SPEC))) return [];
6262
6360
  const bunLockPath = join(dirname(packageJsonPath), BUN_LOCK_PATH);
6263
6361
  if (!fs.existsSync(bunLockPath)) return [];
@@ -6308,25 +6406,25 @@ const resolveMissingDependencyHints = (dependencyHints) => {
6308
6406
  };
6309
6407
  const applyDependencyHintsInstall = async (dependencyHints, execaFn) => {
6310
6408
  const preinstalledSpecs = await applyBunPeerWarningPreinstall(execaFn);
6311
- const missingDependencyHints = resolveMissingDependencyHints(dependencyHints).filter((dependencyHint) => !preinstalledSpecs.includes(dependencyHint));
6312
- if (missingDependencyHints.length === 0) return preinstalledSpecs;
6409
+ const installSpecs = resolveMissingDependencyHints(dependencyHints).filter((dependencyHint) => !preinstalledSpecs.includes(dependencyHint)).map((dependencyHint) => resolveSupportedDependencyInstallSpec(dependencyHint));
6410
+ if (installSpecs.length === 0) return preinstalledSpecs;
6313
6411
  const { packageJsonPath } = resolvePackageJsonInstallTarget();
6314
- await execaFn("bun", ["add", ...missingDependencyHints], {
6412
+ await execaFn("bun", ["add", ...installSpecs], {
6315
6413
  cwd: dirname(packageJsonPath),
6316
6414
  stdio: "inherit"
6317
6415
  });
6318
- return [...preinstalledSpecs, ...missingDependencyHints];
6416
+ return [...preinstalledSpecs, ...installSpecs];
6319
6417
  };
6320
6418
  const applyPlanningDependencyInstall = async (dependencySpecs, execaFn) => {
6321
6419
  const preinstalledSpecs = await applyBunPeerWarningPreinstall(execaFn);
6322
- const missingDependencySpecs = resolveMissingDependencyHints(dependencySpecs).filter((dependencySpec) => !preinstalledSpecs.includes(dependencySpec));
6323
- if (missingDependencySpecs.length === 0) return preinstalledSpecs;
6420
+ const installSpecs = resolveMissingDependencyHints(dependencySpecs).filter((dependencySpec) => !preinstalledSpecs.includes(dependencySpec)).map((dependencySpec) => resolveSupportedDependencyInstallSpec(dependencySpec));
6421
+ if (installSpecs.length === 0) return preinstalledSpecs;
6324
6422
  const { packageJsonPath } = resolvePackageJsonInstallTarget();
6325
- await execaFn("bun", ["add", ...missingDependencySpecs], {
6423
+ await execaFn("bun", ["add", ...installSpecs], {
6326
6424
  cwd: dirname(packageJsonPath),
6327
6425
  stdio: "inherit"
6328
6426
  });
6329
- return [...preinstalledSpecs, ...missingDependencySpecs];
6427
+ return [...preinstalledSpecs, ...installSpecs];
6330
6428
  };
6331
6429
  const applyPluginDependencyInstall = async (install, execaFn) => {
6332
6430
  if (install.skipped || !install.packageName || !install.packageJsonPath) return install;
@@ -8633,7 +8731,8 @@ import {
8633
8731
  useSignUpMutationOptions,
8634
8732
  } from '@/lib/convex/auth-client';
8635
8733
 
8636
- export const Route = createFileRoute('/auth' as never)({
8734
+ // @ts-ignore routeTree.gen.ts is refreshed by TanStack Router during dev/build.
8735
+ export const Route = createFileRoute('/auth')({
8637
8736
  component: AuthPage,
8638
8737
  });
8639
8738
 
@@ -8790,7 +8889,8 @@ const AUTH_START_ROUTE_TEMPLATE = `import { createFileRoute } from '@tanstack/re
8790
8889
 
8791
8890
  import { handler } from '@/lib/convex/auth-server';
8792
8891
 
8793
- export const Route = createFileRoute('/api/auth/$' as never)({
8892
+ // @ts-ignore routeTree.gen.ts is refreshed by TanStack Router during dev/build.
8893
+ export const Route = createFileRoute('/api/auth/$')({
8794
8894
  server: {
8795
8895
  handlers: {
8796
8896
  GET: ({ request }) => handler(request),
@@ -9297,7 +9397,7 @@ const DEFAULT_AUTH_SCHEMA_ENV = {
9297
9397
  SITE_URL: "http://localhost:3000"
9298
9398
  };
9299
9399
  const loadGetAuthTables = async () => (await import("better-auth/db")).getAuthTables;
9300
- const loadConvexAuthPlugin = async () => (await import("@convex-dev/better-auth/plugins")).convex;
9400
+ const loadConvexAuthPlugin = async () => (await import("./convex-plugin-tWTDqoKJ.mjs")).convex;
9301
9401
  const ts$1 = createTypeScriptProxy();
9302
9402
  const withAuthSchemaEnv = async (run) => {
9303
9403
  const globalScope = globalThis;
@@ -9537,8 +9637,8 @@ const AUTH_CONVEX_FILES = [
9537
9637
  target: "functions",
9538
9638
  content: AUTH_CONVEX_TEMPLATE,
9539
9639
  requires: ["auth-config-convex"],
9540
- dependencyHintMessage: "Auth runtime depends on OpenTelemetry API.",
9541
- dependencyHints: [OPENTELEMETRY_API_INSTALL_SPEC]
9640
+ dependencyHintMessage: "Auth runtime depends on OpenTelemetry API and kitcn runtime helpers.",
9641
+ dependencyHints: [OPENTELEMETRY_API_INSTALL_SPEC, "kitcn"]
9542
9642
  }),
9543
9643
  createRegistryFile({
9544
9644
  id: "auth-client-convex",
@@ -12453,7 +12553,6 @@ const createSpinner = (text, options = {}) => {
12453
12553
  //#region src/cli/backend-core.ts
12454
12554
  const __filename = fileURLToPath(import.meta.url);
12455
12555
  const __dirname = dirname(__filename);
12456
- let ownVersion;
12457
12556
  const ts = createTypeScriptProxy();
12458
12557
  const require = createRequire(import.meta.url);
12459
12558
  const realConvex = join(dirname(require.resolve("convex/package.json")), "bin/main.js");
@@ -12671,30 +12770,6 @@ function createCommandEnv(overrides) {
12671
12770
  ...overrides
12672
12771
  };
12673
12772
  }
12674
- function resolveOwnPackageJsonPath(filePath) {
12675
- let current = dirname(filePath);
12676
- while (true) {
12677
- const candidate = join(current, "package.json");
12678
- if (fs.existsSync(candidate)) {
12679
- if (JSON.parse(fs.readFileSync(candidate, "utf8")).name === "kitcn") return candidate;
12680
- }
12681
- const parent = dirname(current);
12682
- if (parent === current) throw new Error(`Could not find kitcn package.json from ${filePath}.`);
12683
- current = parent;
12684
- }
12685
- }
12686
- function readOwnVersion() {
12687
- if (ownVersion !== void 0) return ownVersion ?? void 0;
12688
- const packageJsonPath = resolveOwnPackageJsonPath(__filename);
12689
- ownVersion = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")).version ?? null;
12690
- return ownVersion ?? void 0;
12691
- }
12692
- function resolveScaffoldInstallSpec(env = process.env) {
12693
- const override = env[KITCN_INSTALL_SPEC_ENV]?.trim();
12694
- if (override) return override;
12695
- const version = readOwnVersion();
12696
- return version ? `kitcn@${version}` : "kitcn";
12697
- }
12698
12773
  const CONVEX_DEPLOYMENT_ENV_KEYS = [
12699
12774
  "CONVEX_DEPLOYMENT",
12700
12775
  "CONVEX_DEPLOY_KEY",
@@ -12715,6 +12790,9 @@ function createBackendCommandEnv(overrides) {
12715
12790
  ...overrides
12716
12791
  };
12717
12792
  }
12793
+ function getConvexDeploymentCommandEnv(env = process.env) {
12794
+ return Object.fromEntries(CONVEX_DEPLOYMENT_ENV_KEYS.map((key) => [key, env[key]]));
12795
+ }
12718
12796
  function hasRemoteConvexDeploymentEnv(env) {
12719
12797
  const deployment = env.CONVEX_DEPLOYMENT?.trim();
12720
12798
  if (deployment && !isLocalConvexDeploymentValue(deployment)) return true;
@@ -14395,13 +14473,9 @@ async function runConvexInitIfNeeded(params) {
14395
14473
  stderr: ""
14396
14474
  };
14397
14475
  const shouldUseLocalDevPreflight = getAggregateBackfillDeploymentKey(params.targetArgs ?? [], process.cwd(), params.env) === "local";
14398
- const agentModeOverride = params.yes && shouldUseLocalDevPreflight ? "anonymous" : params.env?.CONVEX_AGENT_MODE;
14399
14476
  const runCommand = async (commandArgs) => normalizeConvexCommandResult(await params.execaFn(params.backendAdapter.command, commandArgs, {
14400
14477
  cwd: process.cwd(),
14401
- env: createBackendCommandEnv({
14402
- ...params.env,
14403
- ...agentModeOverride ? { CONVEX_AGENT_MODE: agentModeOverride } : {}
14404
- }),
14478
+ env: createBackendCommandEnv(params.env),
14405
14479
  reject: false,
14406
14480
  stdio: "pipe"
14407
14481
  }));
@@ -14525,7 +14599,6 @@ async function runInitializationCodegen(params) {
14525
14599
  const initResult = await runConvexInitIfNeeded({
14526
14600
  execaFn: params.execaFn,
14527
14601
  backendAdapter: runtimeAdapter,
14528
- yes: params.yes,
14529
14602
  targetArgs: params.targetArgs
14530
14603
  });
14531
14604
  if (initResult.exitCode !== 0) throw new Error(`Failed to configure Convex project via \`convex init\`.\n${`${initResult.stdout}\n${initResult.stderr}`.trim()}`);
@@ -14671,6 +14744,7 @@ const VALID_BACKFILL_ENABLED = new Set([
14671
14744
  ]);
14672
14745
  const CONVEX_DEV_PRE_RUN_CONFLICT_FLAGS = [
14673
14746
  "--run",
14747
+ "--start",
14674
14748
  "--run-sh",
14675
14749
  "--run-component"
14676
14750
  ];
@@ -15337,4 +15411,4 @@ function isEntryPoint(entry, filename) {
15337
15411
  }
15338
15412
 
15339
15413
  //#endregion
15340
- export { resolveAddTemplateDefaults as $, resolveConfiguredBackend as A, runConvexInitIfNeeded as B, isInitialized as C, generateMeta as Ct, readPackageVersions as D, parseInitCommandArgs as E, highlighter as Et, runAfterScaffoldScript as F, trackProcess as G, runInitCommandFlow as H, runAggregateBackfillFlow as I, createSpinner as J, withLocalCodegenEnv as K, runAggregatePruneFlow as L, resolveInitProjectDir as M, resolveMigrationConfig as N, resolveBackfillConfig as O, resolveRunDeps as P, promptForScaffoldTemplateSelection as Q, runBackendFunction as R, isEntryPoint as S, stripConvexCommandNoise as St, parseBackendRunJson as T, logger as Tt, runMigrationCreate as U, runDevSchemaBackfillIfNeeded as V, runMigrationFlow as W, filterScaffoldTemplatePathMap as X, collectPluginScaffoldTemplates as Y, promptForPluginSelection as Z, formatInfoOutput as _, applyPluginDependencyInstall as _t, cleanup as a, getSupportedPluginKeys as at, hasRemoteConvexDeploymentEnv as b, resolveAuthEnvState as bt, createCommandEnv as c, resolvePluginScaffoldRoots as ct, extractBackfillCliOptions as d, getPluginLockfilePath as dt, resolvePluginPreset as et, extractConcaveRunTargetArgs as f, getSchemaFilePath as ft, formatDocsOutput as g, applyPlanningDependencyInstall as gt, extractResetCliOptions as h, applyDependencyHintsInstall as ht, buildInitializationPlan as i, getPluginCatalogEntry as it, resolveDocTopic as j, resolveCodegenTrimSegments as k, ensureConvexGitignoreEntry as l, assertSchemaFileExists as lt, extractMigrationDownOptions as m, resolveSchemaInstalledPlugins as mt, applyPluginInstallPlanFiles as n, resolveTemplateSelectionSource as nt, createBackendAdapter as o, isSupportedPluginKey as ot, extractMigrationCliOptions as p, readPluginLockfile as pt, withWorkingDirectory as q, assertNoRemovedDevPreRunFlag as r, resolveTemplatesByIdOrThrow as rt, createBackendCommandEnv as s, buildPluginInstallPlan as st, applyDependencyInstallPlan as t, resolvePresetScaffoldTemplates as tt, extractBackendRunTargetArgs as u, collectInstalledPluginKeys as ut, getAggregateBackfillDeploymentKey as v, inspectPluginDependencyInstall as vt, parseArgs as w, getConvexConfig as wt, isConvexDevPreRunConflictFlag as x, serializeEnvValue as xt, getDevAggregateBackfillStatePath as y, resolveProjectScaffoldContext as yt, runConfiguredCodegen as z };
15414
+ export { promptForScaffoldTemplateSelection as $, resolveCodegenTrimSegments as A, runConfiguredCodegen as B, isEntryPoint as C, serializeEnvValue as Ct, parseInitCommandArgs as D, logger as Dt, parseBackendRunJson as E, getConvexConfig as Et, resolveRunDeps as F, runMigrationFlow as G, runDevSchemaBackfillIfNeeded as H, runAfterScaffoldScript as I, withWorkingDirectory as J, trackProcess as K, runAggregateBackfillFlow as L, resolveDocTopic as M, resolveInitProjectDir as N, readPackageVersions as O, highlighter as Ot, resolveMigrationConfig as P, promptForPluginSelection as Q, runAggregatePruneFlow as R, isConvexDevPreRunConflictFlag as S, resolveAuthEnvState as St, parseArgs as T, generateMeta as Tt, runInitCommandFlow as U, runConvexInitIfNeeded as V, runMigrationCreate as W, collectPluginScaffoldTemplates as X, createSpinner as Y, filterScaffoldTemplatePathMap as Z, formatInfoOutput as _, applyPlanningDependencyInstall as _t, cleanup as a, getPluginCatalogEntry as at, getDevAggregateBackfillStatePath as b, resolveSupportedDependencyWarnings as bt, createCommandEnv as c, buildPluginInstallPlan as ct, extractBackfillCliOptions as d, collectInstalledPluginKeys as dt, resolveAddTemplateDefaults as et, extractConcaveRunTargetArgs as f, getPluginLockfilePath as ft, formatDocsOutput as g, applyDependencyHintsInstall as gt, extractResetCliOptions as h, resolveSchemaInstalledPlugins as ht, buildInitializationPlan as i, resolveTemplatesByIdOrThrow as it, resolveConfiguredBackend as j, resolveBackfillConfig as k, ensureConvexGitignoreEntry as l, resolvePluginScaffoldRoots as lt, extractMigrationDownOptions as m, readPluginLockfile as mt, applyPluginInstallPlanFiles as n, resolvePresetScaffoldTemplates as nt, createBackendAdapter as o, getSupportedPluginKeys as ot, extractMigrationCliOptions as p, getSchemaFilePath as pt, withLocalCodegenEnv as q, assertNoRemovedDevPreRunFlag as r, resolveTemplateSelectionSource as rt, createBackendCommandEnv as s, isSupportedPluginKey as st, applyDependencyInstallPlan as t, resolvePluginPreset as tt, extractBackendRunTargetArgs as u, assertSchemaFileExists as ut, getAggregateBackfillDeploymentKey as v, applyPluginDependencyInstall as vt, isInitialized as w, stripConvexCommandNoise as wt, hasRemoteConvexDeploymentEnv as x, resolveProjectScaffoldContext as xt, getConvexDeploymentCommandEnv as y, inspectPluginDependencyInstall as yt, runBackendFunction as z };
@@ -1,6 +1,7 @@
1
- import { l as pick, o as vRequired, t as addFieldsToValidator } from "./validators-B7oIJCAp.js";
2
- import { n as customCtx, t as NoOp } from "./customFunctions-C0voKmtx.js";
3
- import { s as getTransformer } from "./transformer-DtDhR3Lc.js";
1
+ import { i as pick } from "./upstream-BR6sBLg3.js";
2
+ import { o as vRequired, t as addFieldsToValidator } from "./validators-C7LelqTN.js";
3
+ import { n as customCtx, t as NoOp } from "./customFunctions-DxEEO4Dq.js";
4
+ import { s as getTransformer } from "./transformer-C6pGVHqx.js";
4
5
  import { ConvexError, v } from "convex/values";
5
6
  import { HttpRouter, actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric } from "convex/server";
6
7
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
- import { i as getFunctionType, n as getFuncRef, t as buildMetaIndex } from "./meta-utils-0Pu0Nrap.js";
2
- import { s as getTransformer } from "./transformer-DtDhR3Lc.js";
1
+ import { i as getFunctionType, n as getFuncRef, t as buildMetaIndex } from "./meta-utils-D9K4fICl.js";
2
+ import { s as getTransformer } from "./transformer-C6pGVHqx.js";
3
3
  import { fetchAction, fetchMutation, fetchQuery } from "convex/nextjs";
4
4
 
5
5
  //#region src/server/caller.ts
@@ -114,7 +114,7 @@ function createLazyCaller(api, createContext) {
114
114
  /** biome-ignore-all lint/suspicious/noExplicitAny: lib */
115
115
  /**
116
116
  * Framework-agnostic caller factory.
117
- * getToken is passed as a parameter - decoupled from @convex-dev/better-auth.
117
+ * getToken is passed as a parameter so framework auth helpers stay decoupled.
118
118
  */
119
119
  const CONVEX_SITE_URL_RE = /\.convex\.site(?=\/|$)/;
120
120
  const getArgsAndOptions = (args, token, url) => [args[0], {
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as resolveAddTemplateDefaults, A as resolveConfiguredBackend, B as runConvexInitIfNeeded, C as isInitialized, D as readPackageVersions, E as parseInitCommandArgs, Et as highlighter, F as runAfterScaffoldScript, G as trackProcess, H as runInitCommandFlow, I as runAggregateBackfillFlow, J as createSpinner, K as withLocalCodegenEnv, L as runAggregatePruneFlow, M as resolveInitProjectDir, N as resolveMigrationConfig, O as resolveBackfillConfig, P as resolveRunDeps, Q as promptForScaffoldTemplateSelection, R as runBackendFunction, S as isEntryPoint, St as stripConvexCommandNoise, T as parseBackendRunJson, Tt as logger, U as runMigrationCreate, V as runDevSchemaBackfillIfNeeded, W as runMigrationFlow, X as filterScaffoldTemplatePathMap, Y as collectPluginScaffoldTemplates, Z as promptForPluginSelection, _ as formatInfoOutput, _t as applyPluginDependencyInstall, a as cleanup, at as getSupportedPluginKeys, b as hasRemoteConvexDeploymentEnv, bt as resolveAuthEnvState, c as createCommandEnv, ct as resolvePluginScaffoldRoots, d as extractBackfillCliOptions, dt as getPluginLockfilePath, et as resolvePluginPreset, f as extractConcaveRunTargetArgs, ft as getSchemaFilePath, g as formatDocsOutput, gt as applyPlanningDependencyInstall, h as extractResetCliOptions, ht as applyDependencyHintsInstall, i as buildInitializationPlan, it as getPluginCatalogEntry, j as resolveDocTopic, k as resolveCodegenTrimSegments, l as ensureConvexGitignoreEntry, lt as assertSchemaFileExists, m as extractMigrationDownOptions, mt as resolveSchemaInstalledPlugins, n as applyPluginInstallPlanFiles, nt as resolveTemplateSelectionSource, o as createBackendAdapter, ot as isSupportedPluginKey, p as extractMigrationCliOptions, pt as readPluginLockfile, q as withWorkingDirectory, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplatesByIdOrThrow, s as createBackendCommandEnv, st as buildPluginInstallPlan, t as applyDependencyInstallPlan, tt as resolvePresetScaffoldTemplates, u as extractBackendRunTargetArgs, ut as collectInstalledPluginKeys, v as getAggregateBackfillDeploymentKey, vt as inspectPluginDependencyInstall, w as parseArgs, x as isConvexDevPreRunConflictFlag, xt as serializeEnvValue, y as getDevAggregateBackfillStatePath, yt as resolveProjectScaffoldContext, z as runConfiguredCodegen } from "./backend-core-DqCCa0nr.mjs";
2
+ import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, B as runConfiguredCodegen, C as isEntryPoint, Ct as serializeEnvValue, D as parseInitCommandArgs, Dt as logger, E as parseBackendRunJson, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, Ot as highlighter, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as resolveAuthEnvState, T as parseArgs, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as stripConvexCommandNoise, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-CXmrWqdi.mjs";
3
3
  import fs, { existsSync, readFileSync } from "node:fs";
4
4
  import path, { delimiter, dirname, join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -381,7 +381,7 @@ function filterDevStartupLine(rawLine) {
381
381
  const line = stripConvexCommandNoise(rawLine).trim();
382
382
  if (!line) return { kind: "skip" };
383
383
  if (DEV_SUPPRESSED_LINE_PATTERNS.some((pattern) => pattern.test(line))) return { kind: "skip" };
384
- if (line.includes("Finished running function \"init\"") || line.includes("CONVEX_AGENT_MODE=anonymous mode is in beta") || line.includes("Convex AI files are not installed.") || line.includes("Preparing Convex functions...") || line.includes("Bundling component schemas and implementations") || line.includes("Uploading functions to Convex")) return { kind: "skip" };
384
+ if (line.includes("Finished running function \"init\"") || line.includes("Convex AI files are not installed.") || line.includes("Preparing Convex functions...") || line.includes("Bundling component schemas and implementations") || line.includes("Uploading functions to Convex")) return { kind: "skip" };
385
385
  if (DEV_READY_LINE_RE.test(line)) return {
386
386
  kind: "ready",
387
387
  message: line.toLowerCase().includes("concave") ? "Concave ready" : "Convex ready"
@@ -652,12 +652,6 @@ function resolveImplicitConvexRemoteDeploymentEnv(cwd = process.cwd()) {
652
652
  CONVEX_SELF_HOSTED_ADMIN_KEY: parsed.CONVEX_SELF_HOSTED_ADMIN_KEY
653
653
  };
654
654
  }
655
- function resolveImplicitConvexAnonymousAgentMode(cwd = process.cwd()) {
656
- const envLocalPath = join(cwd, ".env.local");
657
- if (!fs.existsSync(envLocalPath)) return;
658
- const deployment = parseEnv(fs.readFileSync(envLocalPath, "utf8")).CONVEX_DEPLOYMENT?.trim();
659
- if (deployment === "anonymous-agent" || deployment?.startsWith("anonymous:")) return "anonymous";
660
- }
661
655
  function resolveConvexEnvFileCommandEnv(args, cwd = process.cwd()) {
662
656
  let envFilePath = null;
663
657
  for (let i = 0; i < args.length; i += 1) {
@@ -880,12 +874,11 @@ const handleDevCommand = async (argv, deps) => {
880
874
  const explicitConvexTargetArgs = extractBackendRunTargetArgs("convex", convexDevArgs);
881
875
  const explicitConvexCommandEnv = resolveConvexEnvFileCommandEnv(convexDevArgs);
882
876
  const implicitConvexCommandEnv = backend === "convex" && explicitConvexTargetArgs.length === 0 && explicitConvexCommandEnv === null ? resolveImplicitConvexRemoteDeploymentEnv() : null;
883
- const implicitConvexAgentMode = backend === "convex" && explicitConvexTargetArgs.length === 0 && !explicitConvexCommandEnv?.CONVEX_AGENT_MODE && !implicitConvexCommandEnv?.CONVEX_AGENT_MODE ? resolveImplicitConvexAnonymousAgentMode() : void 0;
884
877
  const effectiveConvexCommandEnv = explicitConvexCommandEnv ?? implicitConvexCommandEnv;
885
878
  const preRunFunction = config.dev.preRun;
886
879
  if (bootstrap && backend !== "convex") throw new Error("`kitcn dev --bootstrap` is only supported for backend convex.");
887
880
  if (preRunFunction && backend === "concave") throw new Error("`dev.preRun` is only supported for backend convex. Concave dev has no equivalent `--run` flow.");
888
- if (preRunFunction && convexDevArgs.some((arg) => isConvexDevPreRunConflictFlag(arg))) throw new Error("`dev.preRun` cannot be combined with Convex dev run flags (`--run`, `--run-sh`, `--run-component`).");
881
+ if (preRunFunction && convexDevArgs.some((arg) => isConvexDevPreRunConflictFlag(arg))) throw new Error("`dev.preRun` cannot be combined with Convex dev run flags (`--run`, `--start`, `--run-sh`, `--run-component`).");
889
882
  const backendAdapter = createBackendAdapter({
890
883
  backend,
891
884
  realConvexPath,
@@ -926,8 +919,7 @@ const handleDevCommand = async (argv, deps) => {
926
919
  echoOutput: false,
927
920
  env: {
928
921
  ...localNodeEnvOverrides,
929
- ...effectiveConvexCommandEnv,
930
- ...implicitConvexAgentMode ? { CONVEX_AGENT_MODE: implicitConvexAgentMode } : {}
922
+ ...effectiveConvexCommandEnv
931
923
  },
932
924
  targetArgs
933
925
  });
@@ -980,7 +972,6 @@ const handleDevCommand = async (argv, deps) => {
980
972
  env: createBackendCommandEnv({
981
973
  ...localNodeEnvOverrides,
982
974
  ...effectiveConvexCommandEnv,
983
- ...implicitConvexAgentMode ? { CONVEX_AGENT_MODE: implicitConvexAgentMode } : {},
984
975
  ...concaveLocalDevContract?.backendEnv
985
976
  }),
986
977
  reject: false
@@ -1781,6 +1772,7 @@ const handleDeployCommand = async (argv, deps = {}) => {
1781
1772
  const { remainingArgs: deployArgsWithoutMigrationFlags, overrides: deployMigrationOverrides } = extractMigrationCliOptions(parsed.convexArgs);
1782
1773
  const { remainingArgs: deployCommandArgs, overrides: deployBackfillOverrides } = extractBackfillCliOptions(deployArgsWithoutMigrationFlags);
1783
1774
  const deployArgs = [...config.deploy.args, ...deployCommandArgs];
1775
+ const deployCommandEnv = backend === "convex" ? getConvexDeploymentCommandEnv() : void 0;
1784
1776
  const deployResult = await execaFn(backendAdapter.command, [
1785
1777
  ...backendAdapter.argsPrefix,
1786
1778
  "deploy",
@@ -1788,7 +1780,7 @@ const handleDeployCommand = async (argv, deps = {}) => {
1788
1780
  ], {
1789
1781
  stdio: "inherit",
1790
1782
  cwd: process.cwd(),
1791
- env: createBackendCommandEnv(),
1783
+ env: createBackendCommandEnv(deployCommandEnv),
1792
1784
  reject: false
1793
1785
  });
1794
1786
  if ((deployResult.exitCode ?? 1) !== 0) return deployResult.exitCode ?? 1;
@@ -1800,6 +1792,7 @@ const handleDeployCommand = async (argv, deps = {}) => {
1800
1792
  backendAdapter,
1801
1793
  migrationConfig,
1802
1794
  targetArgs,
1795
+ env: deployCommandEnv,
1803
1796
  context: "deploy",
1804
1797
  direction: "up"
1805
1798
  });
@@ -1810,6 +1803,7 @@ const handleDeployCommand = async (argv, deps = {}) => {
1810
1803
  backfillConfig,
1811
1804
  mode: "resume",
1812
1805
  targetArgs,
1806
+ env: deployCommandEnv,
1813
1807
  context: "deploy"
1814
1808
  });
1815
1809
  };
@@ -2470,16 +2464,6 @@ Options:
2470
2464
  function assertNoVerifyLifecycleFlags(args) {
2471
2465
  if (args.includes("--once") || args.includes("--bootstrap")) throw new Error("`kitcn verify` already runs one-shot runtime proof. Do not pass `--once` or `--bootstrap`.");
2472
2466
  }
2473
- async function withAnonymousVerifyAgentMode(run) {
2474
- const previous = process.env.CONVEX_AGENT_MODE;
2475
- if (!previous) process.env.CONVEX_AGENT_MODE = "anonymous";
2476
- try {
2477
- return await run();
2478
- } finally {
2479
- if (previous === void 0) delete process.env.CONVEX_AGENT_MODE;
2480
- else process.env.CONVEX_AGENT_MODE = previous;
2481
- }
2482
- }
2483
2467
  function hasConfiguredLocalConvexDeployment(cwd = process.cwd()) {
2484
2468
  return fs.existsSync(path.join(cwd, ".convex", "local", "default", "config.json"));
2485
2469
  }
@@ -2524,7 +2508,7 @@ const handleVerifyCommand = async (argv, deps) => {
2524
2508
  if (getAggregateBackfillDeploymentKey(extractBackendRunTargetArgs(backend, parsed.convexArgs)) !== "local") throw new Error("`kitcn verify` is local-only. Remove remote deployment flags like `--prod`, `--preview-name`, and `--deployment-name`.");
2525
2509
  const devArgv = buildVerifyDevArgv(argv);
2526
2510
  if (hasConfiguredLocalConvexDeployment()) return handleDevCommand(devArgv, deps);
2527
- return withIsolatedLocalConvexState(() => withAnonymousVerifyAgentMode(() => handleDevCommand(devArgv, deps)));
2511
+ return withIsolatedLocalConvexState(() => handleDevCommand(devArgv, deps));
2528
2512
  };
2529
2513
 
2530
2514
  //#endregion
@@ -2654,6 +2638,15 @@ const LOCAL_NODE_REEXEC_COMMANDS = new Set([
2654
2638
  "init",
2655
2639
  "verify"
2656
2640
  ]);
2641
+ const DEPENDENCY_WARNING_COMMANDS = new Set([
2642
+ "add",
2643
+ "codegen",
2644
+ "deploy",
2645
+ "dev",
2646
+ "env",
2647
+ "init",
2648
+ "verify"
2649
+ ]);
2657
2650
  const COMMAND_HELP = {
2658
2651
  init: INIT_HELP_TEXT,
2659
2652
  add: ADD_HELP_TEXT,
@@ -2759,6 +2752,10 @@ const printCommandHelp = (command, backend = "convex") => {
2759
2752
  }
2760
2753
  printRootHelp(backend);
2761
2754
  };
2755
+ function warnSupportedDependencyIssues(command) {
2756
+ if (!DEPENDENCY_WARNING_COMMANDS.has(command)) return;
2757
+ for (const warning of resolveSupportedDependencyWarnings()) logger.warn(`⚠️ kitcn expects ${warning.packageName} ${warning.minimum}; found ${warning.current}. Run \`bun add ${warning.installSpec}\` when you can.`);
2758
+ }
2762
2759
  const handlePassthroughCommand = async (argv, deps) => {
2763
2760
  const parsed = parseArgs(argv);
2764
2761
  const { execa: execaFn, loadCliConfig, realConvex, realConcave } = resolveRunDeps(deps);
@@ -2811,6 +2808,7 @@ async function run(argv, deps) {
2811
2808
  deps
2812
2809
  });
2813
2810
  if (reexecExitCode !== null) return reexecExitCode;
2811
+ warnSupportedDependencyIssues("dev");
2814
2812
  return handleDevCommand(argv, deps);
2815
2813
  }
2816
2814
  if (VERSION_FLAGS.has(argv[0])) {
@@ -2846,7 +2844,9 @@ async function run(argv, deps) {
2846
2844
  printCommandHelp(parsed.command, getBackend());
2847
2845
  return 0;
2848
2846
  }
2849
- return (COMMAND_HANDLERS[parsed.command] ?? handlePassthroughCommand)(argv, deps);
2847
+ const handler = COMMAND_HANDLERS[parsed.command] ?? handlePassthroughCommand;
2848
+ warnSupportedDependencyIssues(parsed.command);
2849
+ return handler(argv, deps);
2850
2850
  }
2851
2851
  if (isEntryPoint(process.argv[1], __filename)) {
2852
2852
  process.on("SIGINT", () => process.exit(0));