convex 1.48.0-alpha.0 → 1.48.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 (353) hide show
  1. package/CHANGELOG.md +28 -4
  2. package/README.md +1 -1
  3. package/dist/browser.bundle.js +1 -1
  4. package/dist/browser.bundle.js.map +1 -1
  5. package/dist/cjs/bundler/context.js +5 -7
  6. package/dist/cjs/bundler/context.js.map +2 -2
  7. package/dist/cjs/bundler/fs.js +6 -47
  8. package/dist/cjs/bundler/fs.js.map +2 -2
  9. package/dist/cjs/cli/aiFiles.js +26 -4
  10. package/dist/cjs/cli/aiFiles.js.map +2 -2
  11. package/dist/cjs/cli/configure.js +2 -15
  12. package/dist/cjs/cli/configure.js.map +2 -2
  13. package/dist/cjs/cli/env.js +6 -3
  14. package/dist/cjs/cli/env.js.map +2 -2
  15. package/dist/cjs/cli/envDefault.js +5 -2
  16. package/dist/cjs/cli/envDefault.js.map +2 -2
  17. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js +2 -1
  18. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  19. package/dist/cjs/cli/lib/aiFiles/index.js +13 -2
  20. package/dist/cjs/cli/lib/aiFiles/index.js.map +2 -2
  21. package/dist/cjs/cli/lib/aiFiles/skills.js +6 -5
  22. package/dist/cjs/cli/lib/aiFiles/skills.js.map +2 -2
  23. package/dist/cjs/cli/lib/aiFiles/state.js +1 -1
  24. package/dist/cjs/cli/lib/aiFiles/state.js.map +1 -1
  25. package/dist/cjs/cli/lib/components.js +12 -2
  26. package/dist/cjs/cli/lib/components.js.map +2 -2
  27. package/dist/cjs/cli/lib/deployApi/startPush.js +42 -1
  28. package/dist/cjs/cli/lib/deployApi/startPush.js.map +2 -2
  29. package/dist/cjs/cli/lib/deployment.js +0 -2
  30. package/dist/cjs/cli/lib/deployment.js.map +2 -2
  31. package/dist/cjs/cli/lib/deploymentSelection.js +18 -27
  32. package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
  33. package/dist/cjs/cli/lib/env.js +9 -1
  34. package/dist/cjs/cli/lib/env.js.map +2 -2
  35. package/dist/cjs/cli/lib/envvars.js +0 -32
  36. package/dist/cjs/cli/lib/envvars.js.map +2 -2
  37. package/dist/cjs/cli/lib/fsUtils.js +1 -1
  38. package/dist/cjs/cli/lib/fsUtils.js.map +2 -2
  39. package/dist/cjs/cli/lib/generateDocs.js +1 -1
  40. package/dist/cjs/cli/lib/generateDocs.js.map +1 -1
  41. package/dist/cjs/cli/lib/localDeployment/dashboard.js +11 -1
  42. package/dist/cjs/cli/lib/localDeployment/dashboard.js.map +2 -2
  43. package/dist/cjs/cli/lib/localDeployment/download.js +16 -1
  44. package/dist/cjs/cli/lib/localDeployment/download.js.map +2 -2
  45. package/dist/cjs/cli/lib/localDeployment/utils.js +4 -0
  46. package/dist/cjs/cli/lib/localDeployment/utils.js.map +2 -2
  47. package/dist/cjs/cli/lib/login.js +4 -28
  48. package/dist/cjs/cli/lib/login.js.map +2 -2
  49. package/dist/cjs/cli/lib/mcp/requestContext.js +1 -5
  50. package/dist/cjs/cli/lib/mcp/requestContext.js.map +2 -2
  51. package/dist/cjs/cli/lib/utils/aiAgent.js +32 -0
  52. package/dist/cjs/cli/lib/utils/aiAgent.js.map +7 -0
  53. package/dist/cjs/cli/lib/utils/utils.js +9 -18
  54. package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
  55. package/dist/cjs/cli/login.js +114 -213
  56. package/dist/cjs/cli/login.js.map +3 -3
  57. package/dist/cjs/cli/logout.js +12 -113
  58. package/dist/cjs/cli/logout.js.map +3 -3
  59. package/dist/cjs/cli/mcp.js +10 -43
  60. package/dist/cjs/cli/mcp.js.map +3 -3
  61. package/dist/cjs/cli/program.js +1 -2
  62. package/dist/cjs/cli/program.js.map +2 -2
  63. package/dist/cjs/index.js +1 -1
  64. package/dist/cjs/index.js.map +1 -1
  65. package/dist/cjs/server/authentication.js.map +1 -1
  66. package/dist/cjs/server/components/index.js.map +2 -2
  67. package/dist/cjs/server/impl/authentication_impl.js +15 -1
  68. package/dist/cjs/server/impl/authentication_impl.js.map +2 -2
  69. package/dist/cjs/server/impl/registration_impl.js +1 -1
  70. package/dist/cjs/server/impl/registration_impl.js.map +2 -2
  71. package/dist/cjs/server/index.js.map +2 -2
  72. package/dist/cjs/server/meta.js.map +1 -1
  73. package/dist/cjs/server/registration.js.map +1 -1
  74. package/dist/cjs/server/schema.js +0 -2
  75. package/dist/cjs/server/schema.js.map +2 -2
  76. package/dist/cjs/server/storage.js.map +1 -1
  77. package/dist/cjs-types/bundler/context.d.ts +0 -5
  78. package/dist/cjs-types/bundler/context.d.ts.map +1 -1
  79. package/dist/cjs-types/bundler/fs.d.ts +2 -7
  80. package/dist/cjs-types/bundler/fs.d.ts.map +1 -1
  81. package/dist/cjs-types/cli/aiFiles.d.ts.map +1 -1
  82. package/dist/cjs-types/cli/configure.d.ts.map +1 -1
  83. package/dist/cjs-types/cli/env.d.ts.map +1 -1
  84. package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
  85. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -1
  86. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  87. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts +11 -1
  88. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  89. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts +4 -1
  90. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  91. package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
  92. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts +13 -0
  93. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  94. package/dist/cjs-types/cli/lib/deployment.d.ts +0 -2
  95. package/dist/cjs-types/cli/lib/deployment.d.ts.map +1 -1
  96. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts +1 -2
  97. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  98. package/dist/cjs-types/cli/lib/env.d.ts +1 -0
  99. package/dist/cjs-types/cli/lib/env.d.ts.map +1 -1
  100. package/dist/cjs-types/cli/lib/envvars.d.ts +0 -6
  101. package/dist/cjs-types/cli/lib/envvars.d.ts.map +1 -1
  102. package/dist/cjs-types/cli/lib/fsUtils.d.ts +0 -1
  103. package/dist/cjs-types/cli/lib/fsUtils.d.ts.map +1 -1
  104. package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts +6 -0
  105. package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
  106. package/dist/cjs-types/cli/lib/localDeployment/download.d.ts.map +1 -1
  107. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +1 -0
  108. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  109. package/dist/cjs-types/cli/lib/login.d.ts +1 -3
  110. package/dist/cjs-types/cli/lib/login.d.ts.map +1 -1
  111. package/dist/cjs-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
  112. package/dist/cjs-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  113. package/dist/cjs-types/cli/lib/utils/aiAgent.d.ts +8 -0
  114. package/dist/cjs-types/cli/lib/utils/aiAgent.d.ts.map +1 -0
  115. package/dist/cjs-types/cli/lib/utils/utils.d.ts +0 -5
  116. package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
  117. package/dist/cjs-types/cli/login.d.ts +0 -21
  118. package/dist/cjs-types/cli/login.d.ts.map +1 -1
  119. package/dist/cjs-types/cli/logout.d.ts +1 -8
  120. package/dist/cjs-types/cli/logout.d.ts.map +1 -1
  121. package/dist/cjs-types/cli/mcp.d.ts.map +1 -1
  122. package/dist/cjs-types/cli/program.d.ts.map +1 -1
  123. package/dist/cjs-types/index.d.ts +1 -1
  124. package/dist/cjs-types/index.d.ts.map +1 -1
  125. package/dist/cjs-types/server/authentication.d.ts +65 -0
  126. package/dist/cjs-types/server/authentication.d.ts.map +1 -1
  127. package/dist/cjs-types/server/components/index.d.ts +6 -0
  128. package/dist/cjs-types/server/components/index.d.ts.map +1 -1
  129. package/dist/cjs-types/server/impl/authentication_impl.d.ts +2 -1
  130. package/dist/cjs-types/server/impl/authentication_impl.d.ts.map +1 -1
  131. package/dist/cjs-types/server/index.d.ts +2 -2
  132. package/dist/cjs-types/server/index.d.ts.map +1 -1
  133. package/dist/cjs-types/server/meta.d.ts +8 -0
  134. package/dist/cjs-types/server/meta.d.ts.map +1 -1
  135. package/dist/cjs-types/server/registration.d.ts +5 -3
  136. package/dist/cjs-types/server/registration.d.ts.map +1 -1
  137. package/dist/cjs-types/server/schema.d.ts +0 -2
  138. package/dist/cjs-types/server/schema.d.ts.map +1 -1
  139. package/dist/cjs-types/server/storage.d.ts +28 -25
  140. package/dist/cjs-types/server/storage.d.ts.map +1 -1
  141. package/dist/cli.bundle.cjs +1379 -2142
  142. package/dist/cli.bundle.cjs.map +4 -4
  143. package/dist/esm/bundler/context.js +5 -7
  144. package/dist/esm/bundler/context.js.map +2 -2
  145. package/dist/esm/bundler/fs.js +6 -47
  146. package/dist/esm/bundler/fs.js.map +2 -2
  147. package/dist/esm/cli/aiFiles.js +26 -4
  148. package/dist/esm/cli/aiFiles.js.map +2 -2
  149. package/dist/esm/cli/configure.js +2 -15
  150. package/dist/esm/cli/configure.js.map +2 -2
  151. package/dist/esm/cli/env.js +6 -3
  152. package/dist/esm/cli/env.js.map +2 -2
  153. package/dist/esm/cli/envDefault.js +5 -2
  154. package/dist/esm/cli/envDefault.js.map +2 -2
  155. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js +2 -1
  156. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  157. package/dist/esm/cli/lib/aiFiles/index.js +13 -2
  158. package/dist/esm/cli/lib/aiFiles/index.js.map +2 -2
  159. package/dist/esm/cli/lib/aiFiles/skills.js +6 -5
  160. package/dist/esm/cli/lib/aiFiles/skills.js.map +2 -2
  161. package/dist/esm/cli/lib/aiFiles/state.js +1 -1
  162. package/dist/esm/cli/lib/aiFiles/state.js.map +1 -1
  163. package/dist/esm/cli/lib/components.js +15 -2
  164. package/dist/esm/cli/lib/components.js.map +2 -2
  165. package/dist/esm/cli/lib/deployApi/startPush.js +39 -0
  166. package/dist/esm/cli/lib/deployApi/startPush.js.map +2 -2
  167. package/dist/esm/cli/lib/deployment.js +2 -2
  168. package/dist/esm/cli/lib/deployment.js.map +2 -2
  169. package/dist/esm/cli/lib/deploymentSelection.js +20 -35
  170. package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
  171. package/dist/esm/cli/lib/env.js +9 -1
  172. package/dist/esm/cli/lib/env.js.map +2 -2
  173. package/dist/esm/cli/lib/envvars.js +1 -35
  174. package/dist/esm/cli/lib/envvars.js.map +2 -2
  175. package/dist/esm/cli/lib/fsUtils.js +1 -1
  176. package/dist/esm/cli/lib/fsUtils.js.map +2 -2
  177. package/dist/esm/cli/lib/generateDocs.js +1 -1
  178. package/dist/esm/cli/lib/generateDocs.js.map +1 -1
  179. package/dist/esm/cli/lib/localDeployment/dashboard.js +9 -0
  180. package/dist/esm/cli/lib/localDeployment/dashboard.js.map +2 -2
  181. package/dist/esm/cli/lib/localDeployment/download.js +16 -1
  182. package/dist/esm/cli/lib/localDeployment/download.js.map +2 -2
  183. package/dist/esm/cli/lib/localDeployment/utils.js +3 -0
  184. package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
  185. package/dist/esm/cli/lib/login.js +4 -36
  186. package/dist/esm/cli/lib/login.js.map +2 -2
  187. package/dist/esm/cli/lib/mcp/requestContext.js +1 -5
  188. package/dist/esm/cli/lib/mcp/requestContext.js.map +2 -2
  189. package/dist/esm/cli/lib/utils/aiAgent.js +10 -0
  190. package/dist/esm/cli/lib/utils/aiAgent.js.map +7 -0
  191. package/dist/esm/cli/lib/utils/utils.js +9 -16
  192. package/dist/esm/cli/lib/utils/utils.js.map +2 -2
  193. package/dist/esm/cli/login.js +112 -225
  194. package/dist/esm/cli/login.js.map +3 -3
  195. package/dist/esm/cli/logout.js +13 -110
  196. package/dist/esm/cli/logout.js.map +2 -2
  197. package/dist/esm/cli/mcp.js +10 -34
  198. package/dist/esm/cli/mcp.js.map +2 -2
  199. package/dist/esm/cli/program.js +1 -2
  200. package/dist/esm/cli/program.js.map +2 -2
  201. package/dist/esm/index.js +1 -1
  202. package/dist/esm/index.js.map +1 -1
  203. package/dist/esm/server/components/index.js.map +2 -2
  204. package/dist/esm/server/impl/authentication_impl.js +13 -0
  205. package/dist/esm/server/impl/authentication_impl.js.map +2 -2
  206. package/dist/esm/server/impl/registration_impl.js +2 -2
  207. package/dist/esm/server/impl/registration_impl.js.map +2 -2
  208. package/dist/esm/server/index.js.map +2 -2
  209. package/dist/esm/server/schema.js +0 -2
  210. package/dist/esm/server/schema.js.map +2 -2
  211. package/dist/esm-types/bundler/context.d.ts +0 -5
  212. package/dist/esm-types/bundler/context.d.ts.map +1 -1
  213. package/dist/esm-types/bundler/fs.d.ts +2 -7
  214. package/dist/esm-types/bundler/fs.d.ts.map +1 -1
  215. package/dist/esm-types/cli/aiFiles.d.ts.map +1 -1
  216. package/dist/esm-types/cli/configure.d.ts.map +1 -1
  217. package/dist/esm-types/cli/env.d.ts.map +1 -1
  218. package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
  219. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -1
  220. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  221. package/dist/esm-types/cli/lib/aiFiles/index.d.ts +11 -1
  222. package/dist/esm-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  223. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts +4 -1
  224. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  225. package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
  226. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts +13 -0
  227. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  228. package/dist/esm-types/cli/lib/deployment.d.ts +0 -2
  229. package/dist/esm-types/cli/lib/deployment.d.ts.map +1 -1
  230. package/dist/esm-types/cli/lib/deploymentSelection.d.ts +1 -2
  231. package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  232. package/dist/esm-types/cli/lib/env.d.ts +1 -0
  233. package/dist/esm-types/cli/lib/env.d.ts.map +1 -1
  234. package/dist/esm-types/cli/lib/envvars.d.ts +0 -6
  235. package/dist/esm-types/cli/lib/envvars.d.ts.map +1 -1
  236. package/dist/esm-types/cli/lib/fsUtils.d.ts +0 -1
  237. package/dist/esm-types/cli/lib/fsUtils.d.ts.map +1 -1
  238. package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts +6 -0
  239. package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
  240. package/dist/esm-types/cli/lib/localDeployment/download.d.ts.map +1 -1
  241. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +1 -0
  242. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  243. package/dist/esm-types/cli/lib/login.d.ts +1 -3
  244. package/dist/esm-types/cli/lib/login.d.ts.map +1 -1
  245. package/dist/esm-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
  246. package/dist/esm-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  247. package/dist/esm-types/cli/lib/utils/aiAgent.d.ts +8 -0
  248. package/dist/esm-types/cli/lib/utils/aiAgent.d.ts.map +1 -0
  249. package/dist/esm-types/cli/lib/utils/utils.d.ts +0 -5
  250. package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
  251. package/dist/esm-types/cli/login.d.ts +0 -21
  252. package/dist/esm-types/cli/login.d.ts.map +1 -1
  253. package/dist/esm-types/cli/logout.d.ts +1 -8
  254. package/dist/esm-types/cli/logout.d.ts.map +1 -1
  255. package/dist/esm-types/cli/mcp.d.ts.map +1 -1
  256. package/dist/esm-types/cli/program.d.ts.map +1 -1
  257. package/dist/esm-types/index.d.ts +1 -1
  258. package/dist/esm-types/index.d.ts.map +1 -1
  259. package/dist/esm-types/server/authentication.d.ts +65 -0
  260. package/dist/esm-types/server/authentication.d.ts.map +1 -1
  261. package/dist/esm-types/server/components/index.d.ts +6 -0
  262. package/dist/esm-types/server/components/index.d.ts.map +1 -1
  263. package/dist/esm-types/server/impl/authentication_impl.d.ts +2 -1
  264. package/dist/esm-types/server/impl/authentication_impl.d.ts.map +1 -1
  265. package/dist/esm-types/server/index.d.ts +2 -2
  266. package/dist/esm-types/server/index.d.ts.map +1 -1
  267. package/dist/esm-types/server/meta.d.ts +8 -0
  268. package/dist/esm-types/server/meta.d.ts.map +1 -1
  269. package/dist/esm-types/server/registration.d.ts +5 -3
  270. package/dist/esm-types/server/registration.d.ts.map +1 -1
  271. package/dist/esm-types/server/schema.d.ts +0 -2
  272. package/dist/esm-types/server/schema.d.ts.map +1 -1
  273. package/dist/esm-types/server/storage.d.ts +28 -25
  274. package/dist/esm-types/server/storage.d.ts.map +1 -1
  275. package/dist/react.bundle.js +1 -1
  276. package/dist/react.bundle.js.map +1 -1
  277. package/package.json +3 -2
  278. package/schemas/convex.schema.json +1 -2
  279. package/src/bundler/context.ts +5 -9
  280. package/src/bundler/fs.ts +5 -54
  281. package/src/cli/aiFiles.ts +30 -4
  282. package/src/cli/configure.ts +2 -18
  283. package/src/cli/env.ts +4 -1
  284. package/src/cli/envDefault.ts +4 -1
  285. package/src/cli/lib/aiFiles/guidelinesmd.ts +7 -2
  286. package/src/cli/lib/aiFiles/index.ts +23 -3
  287. package/src/cli/lib/aiFiles/skills.ts +11 -7
  288. package/src/cli/lib/aiFiles/state.ts +1 -1
  289. package/src/cli/lib/components.ts +18 -3
  290. package/src/cli/lib/deployApi/startPush.ts +64 -0
  291. package/src/cli/lib/deployment.ts +2 -2
  292. package/src/cli/lib/deploymentSelection.ts +18 -37
  293. package/src/cli/lib/env.ts +13 -2
  294. package/src/cli/lib/envvars.ts +1 -43
  295. package/src/cli/lib/fsUtils.ts +2 -5
  296. package/src/cli/lib/generateDocs.ts +1 -1
  297. package/src/cli/lib/localDeployment/dashboard.ts +19 -0
  298. package/src/cli/lib/localDeployment/download.ts +17 -1
  299. package/src/cli/lib/localDeployment/utils.ts +4 -0
  300. package/src/cli/lib/login.ts +3 -47
  301. package/src/cli/lib/mcp/requestContext.ts +1 -7
  302. package/src/cli/lib/utils/aiAgent.ts +15 -0
  303. package/src/cli/lib/utils/utils.ts +15 -19
  304. package/src/cli/login.ts +168 -293
  305. package/src/cli/logout.ts +17 -142
  306. package/src/cli/mcp.ts +11 -48
  307. package/src/cli/program.ts +0 -2
  308. package/src/index.ts +1 -1
  309. package/src/server/authentication.ts +79 -0
  310. package/src/server/components/index.ts +11 -0
  311. package/src/server/impl/authentication_impl.ts +15 -1
  312. package/src/server/impl/registration_impl.ts +2 -2
  313. package/src/server/index.ts +6 -0
  314. package/src/server/meta.ts +0 -8
  315. package/src/server/registration.ts +5 -2
  316. package/src/server/schema.ts +0 -2
  317. package/src/server/storage.ts +29 -42
  318. package/dist/cjs/cli/account.js +0 -237
  319. package/dist/cjs/cli/account.js.map +0 -7
  320. package/dist/cjs/cli/lib/deployKeyWarning.js +0 -43
  321. package/dist/cjs/cli/lib/deployKeyWarning.js.map +0 -7
  322. package/dist/cjs/cli/lib/profileManagement.js +0 -196
  323. package/dist/cjs/cli/lib/profileManagement.js.map +0 -7
  324. package/dist/cjs/cli/lib/profiles.js +0 -333
  325. package/dist/cjs/cli/lib/profiles.js.map +0 -7
  326. package/dist/cjs-types/cli/account.d.ts +0 -6
  327. package/dist/cjs-types/cli/account.d.ts.map +0 -1
  328. package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts +0 -3
  329. package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts.map +0 -1
  330. package/dist/cjs-types/cli/lib/profileManagement.d.ts +0 -10
  331. package/dist/cjs-types/cli/lib/profileManagement.d.ts.map +0 -1
  332. package/dist/cjs-types/cli/lib/profiles.d.ts +0 -59
  333. package/dist/cjs-types/cli/lib/profiles.d.ts.map +0 -1
  334. package/dist/esm/cli/account.js +0 -221
  335. package/dist/esm/cli/account.js.map +0 -7
  336. package/dist/esm/cli/lib/deployKeyWarning.js +0 -27
  337. package/dist/esm/cli/lib/deployKeyWarning.js.map +0 -7
  338. package/dist/esm/cli/lib/profileManagement.js +0 -179
  339. package/dist/esm/cli/lib/profileManagement.js.map +0 -7
  340. package/dist/esm/cli/lib/profiles.js +0 -288
  341. package/dist/esm/cli/lib/profiles.js.map +0 -7
  342. package/dist/esm-types/cli/account.d.ts +0 -6
  343. package/dist/esm-types/cli/account.d.ts.map +0 -1
  344. package/dist/esm-types/cli/lib/deployKeyWarning.d.ts +0 -3
  345. package/dist/esm-types/cli/lib/deployKeyWarning.d.ts.map +0 -1
  346. package/dist/esm-types/cli/lib/profileManagement.d.ts +0 -10
  347. package/dist/esm-types/cli/lib/profileManagement.d.ts.map +0 -1
  348. package/dist/esm-types/cli/lib/profiles.d.ts +0 -59
  349. package/dist/esm-types/cli/lib/profiles.d.ts.map +0 -1
  350. package/src/cli/account.ts +0 -320
  351. package/src/cli/lib/deployKeyWarning.ts +0 -43
  352. package/src/cli/lib/profileManagement.ts +0 -262
  353. package/src/cli/lib/profiles.ts +0 -398
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "convex",
3
3
  "description": "Client for the Convex Cloud",
4
- "version": "1.48.0-alpha.0",
4
+ "version": "1.48.0",
5
5
  "author": "Convex, Inc. <no-reply@convex.dev>",
6
6
  "homepage": "https://convex.dev",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/get-convex/convex-backend.git",
9
+ "url": "git+https://github.com/convex/convex-backend.git",
10
10
  "directory": "npm-packages/convex"
11
11
  },
12
12
  "main": "./dist/cjs/index.js",
@@ -227,6 +227,7 @@
227
227
  "@types/semver": "^7.3.13",
228
228
  "@types/serve-handler": "~6.1.4",
229
229
  "@types/ws": "^8.5.13",
230
+ "@vercel/detect-agent": "^1.2.5",
230
231
  "@vitest/eslint-plugin": "~1.6.0",
231
232
  "adm-zip": "^0.6.1",
232
233
  "bufferutil": "^4.0.7",
@@ -123,8 +123,7 @@
123
123
  },
124
124
  "nodeVersion": {
125
125
  "type": "string",
126
- "description": "The Node.js version to use for Node.js actions. The currently supported values are '20', '22', and '24'.\n\nDocumentation: https://docs.convex.dev/config/convex.json#configuring-the-nodejs-version",
127
- "default": "20"
126
+ "description": "The Node.js version to use for Node.js actions. The currently supported values are '22' and '24'.\n\nAfter you push a new Node.js version, your functions may keep running on the previous version for a few minutes.\n\nDocumentation: https://docs.convex.dev/config/convex.json#configuring-the-nodejs-version"
128
127
  }
129
128
  }
130
129
  },
@@ -54,7 +54,6 @@ export type BigBrainAuth = {
54
54
  | {
55
55
  kind: "accessToken";
56
56
  accessToken: string;
57
- profile?: { name: string; source: string } | null;
58
57
  }
59
58
  );
60
59
 
@@ -191,19 +190,16 @@ export const oneoffContext: (args: {
191
190
  url?: string | undefined;
192
191
  adminKey?: string | undefined;
193
192
  envFile?: string | undefined;
194
- skipAuth?: boolean;
195
193
  }) => Promise<OneoffCtx> = async (args) => {
196
194
  const ctx = new OneoffContextImpl();
197
195
  await detectSuspiciousEnvironmentVariables(
198
196
  ctx,
199
197
  !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,
200
198
  );
201
- if (!args.skipAuth) {
202
- await initializeBigBrainAuth(ctx, {
203
- url: args.url,
204
- adminKey: args.adminKey,
205
- envFile: args.envFile,
206
- });
207
- }
199
+ await initializeBigBrainAuth(ctx, {
200
+ url: args.url,
201
+ adminKey: args.adminKey,
202
+ envFile: args.envFile,
203
+ });
208
204
  return ctx;
209
205
  };
package/src/bundler/fs.ts CHANGED
@@ -63,7 +63,6 @@ export interface Filesystem {
63
63
 
64
64
  exists(path: string): boolean;
65
65
  stat(path: string): Stats;
66
- lstat(path: string): Stats;
67
66
  readUtf8File(path: string): string;
68
67
  // createReadStream returns a stream for which [Symbol.asyncIterator]
69
68
  // yields chunks of size highWaterMark (until the last one), or 64KB if
@@ -154,9 +153,6 @@ export class NodeFs implements Filesystem {
154
153
  stat(path: string) {
155
154
  return stdFs.statSync(path);
156
155
  }
157
- lstat(path: string) {
158
- return stdFs.lstatSync(path);
159
- }
160
156
  readUtf8File(path: string) {
161
157
  return stdFs.readFileSync(path, { encoding: "utf-8" });
162
158
  }
@@ -264,9 +260,6 @@ export class RecordingFs implements Filesystem {
264
260
  // Absolute path -> observed stat (or null if observed nonexistent)
265
261
  private observedFiles: Map<string, Stats | null> = new Map();
266
262
 
267
- // lstat observes the link itself, while stat observes its target.
268
- private observedLstats: Map<string, Stats | null> = new Map();
269
-
270
263
  // Have we noticed that files have changed while recording?
271
264
  private invalidated = false;
272
265
 
@@ -312,20 +305,6 @@ export class RecordingFs implements Filesystem {
312
305
  return entries;
313
306
  }
314
307
 
315
- lstat(filePath: string): Stats {
316
- const absPath = path.resolve(filePath);
317
- try {
318
- const st = nodeFs.lstat(filePath);
319
- this.registerNormalized(absPath, st, this.observedLstats);
320
- return st;
321
- } catch (err: any) {
322
- if (err.code === "ENOENT") {
323
- this.registerNormalized(absPath, null, this.observedLstats);
324
- }
325
- throw err;
326
- }
327
- }
328
-
329
308
  exists(path: string): boolean {
330
309
  try {
331
310
  const st = nodeFs.stat(path);
@@ -440,8 +419,6 @@ export class RecordingFs implements Filesystem {
440
419
  const newSt = nodeFs.stat(absPath);
441
420
  // Skip invalidation checking since we don't want to conflict if we previously read this file.
442
421
  this.observedFiles.set(absPath, newSt);
443
- if (this.observedLstats.has(absPath))
444
- this.observedLstats.set(absPath, nodeFs.lstat(absPath));
445
422
 
446
423
  // If we observed the parent, add our newly created file.
447
424
  const parentPath = path.resolve(path.dirname(absPath));
@@ -453,8 +430,6 @@ export class RecordingFs implements Filesystem {
453
430
  private updateOnDelete(absPath: string) {
454
431
  // Expect this file to be gone.
455
432
  this.observedFiles.set(absPath, null);
456
- if (this.observedLstats.has(absPath))
457
- this.observedLstats.set(absPath, null);
458
433
 
459
434
  // Unlink it from our parent if observed.
460
435
  const parentPath = path.resolve(path.dirname(absPath));
@@ -473,12 +448,8 @@ export class RecordingFs implements Filesystem {
473
448
  this.invalidated = true;
474
449
  }
475
450
 
476
- registerNormalized(
477
- absPath: string,
478
- observed: Stats | null,
479
- observations = this.observedFiles,
480
- ): void {
481
- const existing = observations.get(absPath);
451
+ registerNormalized(absPath: string, observed: Stats | null): void {
452
+ const existing = this.observedFiles.get(absPath);
482
453
  if (existing !== undefined) {
483
454
  const stMatch = stMatches(observed, existing);
484
455
  if (!stMatch.matches) {
@@ -495,18 +466,14 @@ export class RecordingFs implements Filesystem {
495
466
  this.invalidated = true;
496
467
  }
497
468
  }
498
- observations.set(absPath, observed);
469
+ this.observedFiles.set(absPath, observed);
499
470
  }
500
471
 
501
472
  finalize(): Observations | "invalidated" {
502
473
  if (this.invalidated) {
503
474
  return "invalidated";
504
475
  }
505
- return new Observations(
506
- this.observedDirectories,
507
- this.observedFiles,
508
- this.observedLstats,
509
- );
476
+ return new Observations(this.observedDirectories, this.observedFiles);
510
477
  }
511
478
  }
512
479
 
@@ -522,7 +489,6 @@ export class Observations {
522
489
  constructor(
523
490
  directories: Map<string, Set<string>>,
524
491
  files: Map<string, Stats | null>,
525
- private lstats: Map<string, Stats | null> = new Map(),
526
492
  ) {
527
493
  this.directories = directories;
528
494
  this.files = files;
@@ -536,8 +502,7 @@ export class Observations {
536
502
  for (const path of this.files.keys()) {
537
503
  out.push(path);
538
504
  }
539
- for (const path of this.lstats.keys()) out.push(path);
540
- return [...new Set(out)];
505
+ return out;
541
506
  }
542
507
 
543
508
  overlaps({
@@ -564,20 +529,6 @@ export class Observations {
564
529
  }
565
530
  }
566
531
 
567
- const observedLstat = this.lstats.get(absPath);
568
- if (observedLstat !== undefined) {
569
- let currentLstat: Stats | null;
570
- try {
571
- currentLstat = nodeFs.lstat(absPath);
572
- } catch (err: any) {
573
- if (err.code !== "ENOENT") throw err;
574
- currentLstat = null;
575
- }
576
- const match = stMatches(observedLstat, currentLstat);
577
- if (!match.matches)
578
- return { overlaps: true, reason: `modified (${match.reason})` };
579
- }
580
-
581
532
  // Second, check if we listed the directory this file is in.
582
533
  const parentPath = path.resolve(path.dirname(absPath));
583
534
  const observedParent = this.directories.get(parentPath);
@@ -34,9 +34,22 @@ const aiInstall = new Command("install")
34
34
  )
35
35
  .allowExcessArguments(false)
36
36
  .action(async () => {
37
- const { projectDir, convexDir, aiFilesConfig } =
37
+ const { ctx, projectDir, convexDir, aiFilesConfig } =
38
38
  await resolveProjectPaths();
39
- await installAiFiles({ projectDir, convexDir, aiFilesConfig });
39
+
40
+ const result = await installAiFiles({
41
+ projectDir,
42
+ convexDir,
43
+ aiFilesConfig,
44
+ });
45
+
46
+ if (result.kind === "error") {
47
+ return await ctx.crash({
48
+ exitCode: 1,
49
+ errorType: "fatal",
50
+ printedMessage: result.message,
51
+ });
52
+ }
40
53
 
41
54
  logMessage(`${chalkStderr.green("✔")} Convex AI files installed.`);
42
55
  });
@@ -72,9 +85,22 @@ const aiUpdate = new Command("update")
72
85
  )
73
86
  .allowExcessArguments(false)
74
87
  .action(async () => {
75
- const { projectDir, convexDir, aiFilesConfig } =
88
+ const { ctx, projectDir, convexDir, aiFilesConfig } =
76
89
  await resolveProjectPaths();
77
- await installAiFiles({ projectDir, convexDir, aiFilesConfig });
90
+
91
+ const result = await installAiFiles({
92
+ projectDir,
93
+ convexDir,
94
+ aiFilesConfig,
95
+ });
96
+
97
+ if (result.kind === "error") {
98
+ return await ctx.crash({
99
+ exitCode: 1,
100
+ errorType: "fatal",
101
+ printedMessage: result.message,
102
+ });
103
+ }
78
104
 
79
105
  logMessage(`${chalkStderr.green("✔")} Convex AI files updated.`);
80
106
  });
@@ -1,5 +1,4 @@
1
1
  import { chalkStderr } from "chalk";
2
- import { handleNoAccessToConfiguredProject } from "./account.js";
3
2
  import { Context } from "../bundler/context.js";
4
3
  import {
5
4
  logFailure,
@@ -351,26 +350,11 @@ async function handleDeploymentWithinProject(
351
350
  return result;
352
351
  }
353
352
 
354
- let accessResult = await checkAccessToSelectedProject(
353
+ const accessResult = await checkAccessToSelectedProject(
355
354
  ctx,
356
355
  deploymentSelection.targetProject,
357
356
  );
358
- while (accessResult.kind === "noAccess") {
359
- const next =
360
- cmdOptions.team !== undefined && cmdOptions.project !== undefined
361
- ? "chooseProject"
362
- : await handleNoAccessToConfiguredProject(
363
- ctx,
364
- deploymentSelection.targetProject,
365
- cmdOptions.envFile,
366
- );
367
- if (next === "retry") {
368
- accessResult = await checkAccessToSelectedProject(
369
- ctx,
370
- deploymentSelection.targetProject,
371
- );
372
- continue;
373
- }
357
+ if (accessResult.kind === "noAccess") {
374
358
  logMessage("You don't have access to the selected project.");
375
359
  const result = await handleChooseProject(
376
360
  ctx,
package/src/cli/env.ts CHANGED
@@ -171,6 +171,8 @@ const envListCmd = new Command("list")
171
171
  "• List all variables and their values: `npx convex env list --include-values`",
172
172
  "• Save all variables to a file: `npx convex env list --include-values > .env.convex`",
173
173
  "• Append to a file: `npx convex env list --include-values >> .env.convex`",
174
+ "",
175
+ "When an AI agent runs this command (detected from environment variables like AI_AGENT or CLAUDECODE), only names are listed unless --include-values is passed.",
174
176
  ].join("\n"),
175
177
  )
176
178
  .option(
@@ -180,7 +182,7 @@ const envListCmd = new Command("list")
180
182
  .addOption(
181
183
  new Option(
182
184
  "--include-values",
183
- "Print each variable's value alongside its name, in .env format (the default). Pass it explicitly in scripts that rely on the values.",
185
+ "Print each variable's value alongside its name, in .env format. This is the default unless an AI agent is detected, so pass it explicitly in scripts that rely on the values.",
184
186
  ).conflicts("namesOnly"),
185
187
  )
186
188
  .configureHelp({ showGlobalOptions: true })
@@ -198,6 +200,7 @@ const envListCmd = new Command("list")
198
200
  const backend = deploymentEnvBackend(ctx, deployment);
199
201
  await envList(ctx, backend, {
200
202
  namesOnly: cmdOptions.namesOnly ?? false,
203
+ includeValues: cmdOptions.includeValues ?? false,
201
204
  });
202
205
  },
203
206
  });
@@ -147,6 +147,8 @@ const envDefaultList = addEnvDefaultOptions(
147
147
  "• List only default variable names (no values): `npx convex env default list --names-only`",
148
148
  "• List all default variables and their values: `npx convex env default list --include-values`",
149
149
  "",
150
+ "When an AI agent runs this command (detected from environment variables like AI_AGENT or CLAUDECODE), only names are listed unless --include-values is passed.",
151
+ "",
150
152
  "The deployment type is determined by the current deployment (local maps to dev), or by --type if provided.",
151
153
  ].join("\n"),
152
154
  )
@@ -157,7 +159,7 @@ const envDefaultList = addEnvDefaultOptions(
157
159
  .addOption(
158
160
  new Option(
159
161
  "--include-values",
160
- "Print each variable's value alongside its name, in .env format (the default). Pass it explicitly in scripts that rely on the values.",
162
+ "Print each variable's value alongside its name, in .env format. This is the default unless an AI agent is detected, so pass it explicitly in scripts that rely on the values.",
161
163
  ).conflicts("namesOnly"),
162
164
  )
163
165
  .configureHelp({ showGlobalOptions: true })
@@ -169,6 +171,7 @@ const envDefaultList = addEnvDefaultOptions(
169
171
  await ensureHasConvexDependency(ctx, "env default list");
170
172
  await envList(ctx, backend, {
171
173
  namesOnly: cmdOptions.namesOnly ?? false,
174
+ includeValues: cmdOptions.includeValues ?? false,
172
175
  });
173
176
  });
174
177
 
@@ -21,6 +21,8 @@ export async function hasGuidelinesInstalled(
21
21
  * Download and write the guidelines file.
22
22
  * Guidelines live in `_generated/` so local edits are not expected and are
23
23
  * not preserved.
24
+ *
25
+ * Returns false if the guidelines could not be downloaded.
24
26
  */
25
27
  export async function installGuidelinesFile({
26
28
  convexDir,
@@ -28,15 +30,16 @@ export async function installGuidelinesFile({
28
30
  }: {
29
31
  convexDir: string;
30
32
  state: AiFilesState;
31
- }): Promise<void> {
33
+ }): Promise<boolean> {
32
34
  const guidelines = await downloadGuidelines();
35
+
33
36
  if (guidelines === null) {
34
37
  logMessage(
35
38
  chalkStderr.yellow(
36
39
  "Could not download Convex AI guidelines right now. You can retry with: npx convex ai-files install",
37
40
  ),
38
41
  );
39
- return;
42
+ return false;
40
43
  }
41
44
 
42
45
  await fs.mkdir(aiDirForConvexDir(convexDir), { recursive: true });
@@ -46,4 +49,6 @@ export async function installGuidelinesFile({
46
49
  logMessage(
47
50
  `${chalkStderr.green("✔")} ${guidelinesPathForConvexDir(convexDir)} written`,
48
51
  );
52
+
53
+ return true;
49
54
  }
@@ -44,11 +44,18 @@ async function hasExistingAiFilesArtifacts({
44
44
  );
45
45
  }
46
46
 
47
+ type InstallAiFilesResult =
48
+ | { kind: "success" }
49
+ | { kind: "error"; message: string };
50
+
47
51
  /**
48
52
  * Install or refresh all Convex AI files.
49
53
  *
50
54
  * Reads the existing state if present, or starts from a blank one for a
51
55
  * fresh install.
56
+ *
57
+ * Writes everything it can even when the guidelines download or the skills
58
+ * install fails, and returns an error if either of them failed.
52
59
  */
53
60
  export async function installAiFiles({
54
61
  projectDir,
@@ -56,16 +63,29 @@ export async function installAiFiles({
56
63
  aiFilesConfig,
57
64
  }: AiFilesPaths & {
58
65
  aiFilesConfig?: AiFilesProjectConfig | undefined;
59
- }): Promise<void> {
66
+ }): Promise<InstallAiFilesResult> {
60
67
  const convexDirName = path.relative(projectDir, convexDir);
61
68
  const state = await readAiStateOrDefault(convexDir);
62
69
 
63
- await installGuidelinesFile({ convexDir, state });
70
+ const guidelinesInstalled = await installGuidelinesFile({ convexDir, state });
64
71
  await applyAgentsMdSection({ projectDir, state, convexDirName });
65
72
  await applyClaudeMdSection({ projectDir, state, convexDirName });
66
- await installSkills({ projectDir, state, aiFilesConfig });
73
+ const skillsInstalled = await installSkills({
74
+ projectDir,
75
+ state,
76
+ aiFilesConfig,
77
+ });
67
78
  await removeLegacyCursorRules(projectDir);
68
79
  await writeAiState({ state, convexDir });
80
+
81
+ if (!guidelinesInstalled || !skillsInstalled) {
82
+ return {
83
+ kind: "error",
84
+ message:
85
+ "Some Convex AI files could not be installed. See the messages above.",
86
+ };
87
+ }
88
+ return { kind: "success" };
69
89
  }
70
90
 
71
91
  async function attemptToInstallAiFiles(
@@ -23,11 +23,11 @@ function configuredSkillAgents(
23
23
  }
24
24
 
25
25
  /**
26
- * Runs `npx skills add get-convex/agent-skills --yes --copy` in the given directory.
26
+ * Runs `npx skills add convex/agent-skills --yes --copy` in the given directory.
27
27
  * Returns true on success, false if the process fails or cannot be started.
28
28
  */
29
29
  function runSkillsAdd(cwd: string, agents: string[]): Promise<boolean> {
30
- const args = ["add", "get-convex/agent-skills", "--yes", "--copy"];
30
+ const args = ["add", "convex/agent-skills", "--yes", "--copy"];
31
31
  for (const agent of agents) {
32
32
  args.push("--agent", agent);
33
33
  }
@@ -116,6 +116,9 @@ async function removeSkillsLockIfEmpty({
116
116
  /**
117
117
  * Install Convex agent skills and record the SHA into the state.
118
118
  * Handles the kill-switch check and all logging internally.
119
+ *
120
+ * Returns false if the skills CLI failed. Skipping skills because no agents
121
+ * are configured or the kill switch is on counts as success.
119
122
  */
120
123
  export async function installSkills({
121
124
  projectDir,
@@ -125,26 +128,27 @@ export async function installSkills({
125
128
  projectDir: string;
126
129
  state: AiFilesState;
127
130
  aiFilesConfig?: AiFilesProjectConfig | undefined;
128
- }): Promise<void> {
131
+ }): Promise<boolean> {
129
132
  const agents = configuredSkillAgents(aiFilesConfig);
130
- if (agents.length === 0) return;
131
- if (!(await shouldRunSkillsCli())) return;
133
+ if (agents.length === 0) return true;
134
+ if (!(await shouldRunSkillsCli())) return true;
132
135
 
133
136
  logMessage("Installing Convex agent skills...");
134
137
  const skillsOk = await runSkillsAdd(projectDir, agents);
135
138
  if (!skillsOk) {
136
139
  logMessage(
137
140
  chalkStderr.yellow(
138
- "Could not install agent skills. You can retry manually with: npx skills add get-convex/agent-skills --copy",
141
+ "Could not install agent skills. You can retry manually with: npx skills add convex/agent-skills --copy",
139
142
  ),
140
143
  );
141
- return;
144
+ return false;
142
145
  }
143
146
 
144
147
  const sha = await fetchAgentSkillsSha();
145
148
  if (sha) state.agentSkillsSha = sha;
146
149
 
147
150
  logMessage(`${chalkStderr.green("✔")} Skills installed`);
151
+ return true;
148
152
  }
149
153
 
150
154
  export type RemoveInstalledSkillsStatus = "unchanged" | "removed" | "failed";
@@ -11,7 +11,7 @@ export const aiFilesStateSchema = z.object({
11
11
  guidelinesHash: z.string().nullable(),
12
12
  agentsMdSectionHash: z.string().nullable(),
13
13
  claudeMdHash: z.string().nullable(),
14
- // Commit SHA from get-convex/agent-skills that was current when skills were
14
+ // Commit SHA from convex/agent-skills that was current when skills were
15
15
  // last installed. Used to detect when newer skills are available.
16
16
  agentSkillsSha: z.string().nullable(),
17
17
  });
@@ -43,7 +43,12 @@ import { typeCheckFunctionsInMode, TypeCheckMode } from "./typecheck.js";
43
43
  import { withTmpDir } from "../../bundler/fs.js";
44
44
  import { handleDebugBundlePath } from "./debugBundlePath.js";
45
45
  import { chalkStderr } from "chalk";
46
- import { StartPushRequest, StartPushResponse } from "./deployApi/startPush.js";
46
+ import {
47
+ startPushResponseForLogging,
48
+ redactEnvironmentVariableValues,
49
+ StartPushRequest,
50
+ StartPushResponse,
51
+ } from "./deployApi/startPush.js";
47
52
  import { DetailedDeploymentCredentials } from "./api.js";
48
53
  import { FinishPushDiff } from "./deployApi/finishPush.js";
49
54
  import { Reporter, Span } from "./tracing.js";
@@ -548,7 +553,10 @@ async function startComponentsPushAndCodegen(
548
553
  );
549
554
 
550
555
  if (options.verbose) {
551
- logMessage("startPush: " + JSON.stringify(startPushResponse, null, 2));
556
+ logMessage(
557
+ "startPush: " +
558
+ JSON.stringify(startPushResponseForLogging(startPushResponse), null, 2),
559
+ );
552
560
  }
553
561
 
554
562
  if (options.codegen) {
@@ -734,7 +742,14 @@ function printDiff(
734
742
  opts: { verbose: boolean; dryRun: boolean; deploymentName: string | null },
735
743
  ) {
736
744
  if (opts.verbose) {
737
- const diffString = JSON.stringify(finishPushResponse, null, 2);
745
+ const diffString = JSON.stringify(
746
+ redactEnvironmentVariableValues(
747
+ finishPushResponse,
748
+ startPushResponse.environmentVariables,
749
+ ),
750
+ null,
751
+ 2,
752
+ );
738
753
  logMessage(diffString);
739
754
  return;
740
755
  }
@@ -48,6 +48,70 @@ export const startPushResponse = looseObject({
48
48
  });
49
49
  export type StartPushResponse = z.infer<typeof startPushResponse>;
50
50
 
51
+ // Values this short are rarely secrets, and replacing them everywhere would
52
+ // garble unrelated strings in the output.
53
+ const MIN_SCRUBBED_VALUE_LENGTH = 8;
54
+
55
+ /**
56
+ * Replaces every occurrence of an environment variable's value in `node`'s
57
+ * strings with `<redacted>`. Values reappear in push responses wherever the
58
+ * code read them, such as auth providers built from `process.env` in
59
+ * `auth.config.ts`.
60
+ */
61
+ export function redactEnvironmentVariableValues<T>(
62
+ node: T,
63
+ environmentVariables: Record<string, string>,
64
+ ): T {
65
+ const values = Object.values(environmentVariables)
66
+ .filter((value) => value.length >= MIN_SCRUBBED_VALUE_LENGTH)
67
+ // Strings that hold JSON, like `authDiff` entries, contain the escaped form.
68
+ .flatMap((value) => {
69
+ const escaped = JSON.stringify(value).slice(1, -1);
70
+ return escaped === value ? [value] : [value, escaped];
71
+ })
72
+ .sort((a, b) => b.length - a.length);
73
+ const scrub = (child: unknown): unknown => {
74
+ if (typeof child === "string") {
75
+ return values.reduce(
76
+ (scrubbed, value) => scrubbed.split(value).join("<redacted>"),
77
+ child,
78
+ );
79
+ }
80
+ if (Array.isArray(child)) {
81
+ return child.map(scrub);
82
+ }
83
+ if (child !== null && typeof child === "object") {
84
+ return Object.fromEntries(
85
+ Object.entries(child).map(([key, grandchild]) => [
86
+ key,
87
+ scrub(grandchild),
88
+ ]),
89
+ );
90
+ }
91
+ return child;
92
+ };
93
+ return scrub(node) as T;
94
+ }
95
+
96
+ /**
97
+ * A copy of the response that is safe to print. `environmentVariables` holds
98
+ * every value on the deployment so `finish_push` can detect concurrent changes,
99
+ * and those values are often secrets.
100
+ */
101
+ export function startPushResponseForLogging(
102
+ response: StartPushResponse,
103
+ ): StartPushResponse {
104
+ return {
105
+ ...redactEnvironmentVariableValues(response, response.environmentVariables),
106
+ environmentVariables: Object.fromEntries(
107
+ Object.keys(response.environmentVariables).map((name) => [
108
+ name,
109
+ "<redacted>",
110
+ ]),
111
+ ),
112
+ };
113
+ }
114
+
51
115
  export const evaluatePushResponse = looseObject({
52
116
  schemaChange,
53
117
  });
@@ -102,7 +102,7 @@ export async function eraseDeploymentEnvVar(ctx: Context): Promise<boolean> {
102
102
  return true;
103
103
  }
104
104
 
105
- export async function gitIgnoreEnvVarFile(ctx: Context): Promise<boolean> {
105
+ async function gitIgnoreEnvVarFile(ctx: Context): Promise<boolean> {
106
106
  const gitIgnorePath = ".gitignore";
107
107
  const gitIgnoreContents = ctx.fs.exists(gitIgnorePath)
108
108
  ? ctx.fs.readUtf8File(gitIgnorePath)
@@ -186,7 +186,7 @@ export async function deploymentNameFromAdminKeyOrCrash(
186
186
  return deploymentName;
187
187
  }
188
188
 
189
- export function deploymentNameFromAdminKey(adminKey: string) {
189
+ function deploymentNameFromAdminKey(adminKey: string) {
190
190
  const parts = adminKey.split("|");
191
191
  if (parts.length === 1) {
192
192
  return null;