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
@@ -118,13 +118,11 @@ const oneoffContext = async (args) => {
118
118
  ctx,
119
119
  !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS
120
120
  );
121
- if (!args.skipAuth) {
122
- await (0, import_deploymentSelection.initializeBigBrainAuth)(ctx, {
123
- url: args.url,
124
- adminKey: args.adminKey,
125
- envFile: args.envFile
126
- });
127
- }
121
+ await (0, import_deploymentSelection.initializeBigBrainAuth)(ctx, {
122
+ url: args.url,
123
+ adminKey: args.adminKey,
124
+ envFile: args.envFile
125
+ });
128
126
  return ctx;
129
127
  };
130
128
  //# sourceMappingURL=context.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/bundler/context.ts"],
4
- "sourcesContent": ["import * as Sentry from \"@sentry/node\";\nimport { Ora } from \"ora\";\nimport { Filesystem, nodeFs } from \"./fs.js\";\nimport { initializeBigBrainAuth } from \"../cli/lib/deploymentSelection.js\";\nimport { detectSuspiciousEnvironmentVariables } from \"../cli/lib/envvars.js\";\nimport { logFailure, logVerbose } from \"./log.js\";\n// How the error should be handled when running `npx convex dev`.\nexport type ErrorType =\n // The error was likely caused by the state of the developer's local\n // file system (e.g. `tsc` fails due to a syntax error). The `convex dev`\n // command will then print out the error and wait for the file to change before\n // retrying.\n | \"invalid filesystem data\"\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the db (ie documents not matching the new schema).\n // The `convex dev` command will wait for either file OR table data change\n // to retry (if a table name is specified as the value in this Object).\n | {\n \"invalid filesystem or db data\": {\n tableName: string;\n componentPath?: string;\n } | null;\n }\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the deployment environment variables.\n // The `convex dev` command will wait for either file OR env var change\n // before retrying.\n | \"invalid filesystem or env vars\"\n // The error was some transient issue (e.g. a network\n // error). This will then cause a retry after an exponential backoff.\n | \"transient\"\n // This error was caught, handled, and now all that needs to happen\n // is for the proces to restart. No error is logged or reported.\n | \"already handled\"\n // This error is truly permanent. Exit `npx convex dev` because the\n // developer will need to take a manual commandline action.\n | \"fatal\";\n\nexport type BigBrainAuth = {\n header: string;\n} & (\n | {\n kind: \"projectKey\";\n projectKey: string;\n }\n | {\n kind: \"deploymentKey\";\n deploymentKey: string;\n }\n | {\n kind: \"previewDeployKey\";\n previewDeployKey: string;\n }\n | {\n kind: \"accessToken\";\n accessToken: string;\n profile?: { name: string; source: string } | null;\n }\n);\n\nexport interface Context {\n fs: Filesystem;\n deprecationMessagePrinted: boolean;\n // Reports to Sentry and either throws FatalError or exits the process.\n // Prints the `printedMessage` if provided\n crash(args: {\n exitCode: number;\n errorType: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }): Promise<never>;\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>): string;\n removeCleanup(\n handle: string,\n ): (exitCode: number, err?: any) => Promise<void> | null;\n bigBrainAuth(): BigBrainAuth | null;\n /**\n * Prefer using `updateBigBrainAuthAfterLogin` in `deploymentSelection.ts` instead\n */\n _updateBigBrainAuth(auth: BigBrainAuth | null): void;\n}\n\nasync function flushAndExit(exitCode: number, err?: any) {\n if (err) {\n Sentry.captureException(err);\n }\n await Sentry.close();\n return process.exit(exitCode);\n}\n\nexport type OneoffCtx = Context & {\n // Generally `ctx.crash` is better to use since it handles printing a message\n // for the user, and then calls this.\n //\n // This function reports to Sentry + exits the process, but does not handle\n // printing a message for the user.\n flushAndExit: (exitCode: number, err?: any) => Promise<never>;\n};\n\nclass OneoffContextImpl {\n private _cleanupFns: Record<\n string,\n (exitCode: number, err?: any) => Promise<void>\n > = {};\n public fs: Filesystem = nodeFs;\n public deprecationMessagePrinted: boolean = false;\n public spinner: Ora | undefined = undefined;\n private _bigBrainAuth: BigBrainAuth | null = null;\n\n crash = async (args: {\n exitCode: number;\n errorType?: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }) => {\n if (args.printedMessage !== null) {\n logFailure(args.printedMessage);\n }\n return await this.flushAndExit(args.exitCode, args.errForSentry);\n };\n flushAndExit = async (exitCode: number, err?: any) => {\n logVerbose(\"Flushing and exiting, error:\", err);\n if (err) {\n logVerbose(err.stack);\n }\n const cleanupFns = this._cleanupFns;\n // Clear the cleanup functions so that there's no risk of running them twice\n // if this somehow gets triggered twice.\n this._cleanupFns = {};\n const fns = Object.values(cleanupFns);\n logVerbose(`Running ${fns.length} cleanup functions`);\n for (const fn of fns) {\n await fn(exitCode, err);\n }\n logVerbose(\"All cleanup functions ran\");\n return flushAndExit(exitCode, err);\n };\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>) {\n const handle = Math.random().toString(36).slice(2);\n this._cleanupFns[handle] = fn;\n return handle;\n }\n removeCleanup(handle: string) {\n const value = this._cleanupFns[handle];\n delete this._cleanupFns[handle];\n return value ?? null;\n }\n bigBrainAuth(): BigBrainAuth | null {\n return this._bigBrainAuth;\n }\n _updateBigBrainAuth(auth: BigBrainAuth | null): void {\n logVerbose(`Updating big brain auth to ${auth?.kind ?? \"null\"}`);\n this._bigBrainAuth = auth;\n }\n}\n\n/**\n * Install a SIGINT handler that gracefully exits via ctx.flushAndExit.\n *\n * `bun run` and `npm run` can deliver a duplicate SIGINT to the child\n * process immediately while the first handler is still starting cleanup:\n * bun: https://github.com/oven-sh/bun/issues/14799\n * https://github.com/oven-sh/bun/issues/11400\n * npm: https://github.com/npm/cli/issues/5021\n * https://github.com/npm/cli/issues/8164\n * https://github.com/npm/cli/issues/7693\n * We ignore a second signal within 500ms of the first to avoid\n * double-cleanup, but treat a later Ctrl+C as a force-exit escape hatch.\n */\nexport function installSigintHandler(ctx: OneoffCtx) {\n const DUPLICATE_GRACE_MS = 500;\n let cleanupStartTime: number | null = null;\n process.on(\"SIGINT\", async () => {\n if (cleanupStartTime !== null) {\n if (Date.now() - cleanupStartTime < DUPLICATE_GRACE_MS) {\n logVerbose(\n \"Received SIGINT during cleanup, ignoring duplicate signal...\",\n );\n return;\n }\n logVerbose(\"Received SIGINT during cleanup, exiting immediately...\");\n process.exit(130);\n }\n cleanupStartTime = Date.now();\n logVerbose(\"Received SIGINT, cleaning up...\");\n await ctx.flushAndExit(130);\n });\n}\n\nexport const oneoffContext: (args: {\n url?: string | undefined;\n adminKey?: string | undefined;\n envFile?: string | undefined;\n skipAuth?: boolean;\n}) => Promise<OneoffCtx> = async (args) => {\n const ctx = new OneoffContextImpl();\n await detectSuspiciousEnvironmentVariables(\n ctx,\n !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,\n );\n if (!args.skipAuth) {\n await initializeBigBrainAuth(ctx, {\n url: args.url,\n adminKey: args.adminKey,\n envFile: args.envFile,\n });\n }\n return ctx;\n};\n"],
5
- "mapp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AAAA,EAClB;AAAA,EACA,eAAoC;AAClC,WAAO,KAAK;AAAA,EACd;AAAA,EACA,oBAAoB,MAAiC;AACnD,+BAAW,8BAA8B,MAAM,QAAQ,MAAM,EAAE;AAC/D,SAAK,gBAAgB;AAAA,EACvB;AACF;AAeO,SAAS,qBAAqB,KAAgB;AACnD,QAAM,qBAAqB;AAC3B,MAAI,mBAAkC;AACtC,UAAQ,GAAG,UAAU,YAAY;AAC/B,QAAI,qBAAqB,MAAM;AAC7B,UAAI,KAAK,IAAI,IAAI,mBAAmB,oBAAoB;AACtD;AAAA,UACE;AAAA,QACF;AACA;AAAA,MACF;AACA,iCAAW,wDAAwD;AACnE,cAAQ,KAAK,GAAG;AAAA,IAClB;AACA,uBAAmB,KAAK,IAAI;AAC5B,+BAAW,iCAAiC;AAC5C,UAAM,IAAI,aAAa,GAAG;AAAA,EAC5B,CAAC;AACH;AAEO,MAAM,gBAKc,OAAO,SAAS;AACzC,QAAM,MAAM,IAAI,kBAAkB;AAClC,YAAM;AAAA,IACJ;AAAA,IACA,CAAC,CAAC,QAAQ,IAAI;AAAA,EAChB;AACA,MAAI,CAAC,KAAK,UAAU;AAClB,cAAM,mDAAuB,KAAK;AAAA,MAChC,KAAK,KAAK;AAAA,MACV,UAAU,KAAK;AAAA,MACf,SAAS,KAAK;AAAA,IAChB,CAAC;AAAA,EACH;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import * as Sentry from \"@sentry/node\";\nimport { Ora } from \"ora\";\nimport { Filesystem, nodeFs } from \"./fs.js\";\nimport { initializeBigBrainAuth } from \"../cli/lib/deploymentSelection.js\";\nimport { detectSuspiciousEnvironmentVariables } from \"../cli/lib/envvars.js\";\nimport { logFailure, logVerbose } from \"./log.js\";\n// How the error should be handled when running `npx convex dev`.\nexport type ErrorType =\n // The error was likely caused by the state of the developer's local\n // file system (e.g. `tsc` fails due to a syntax error). The `convex dev`\n // command will then print out the error and wait for the file to change before\n // retrying.\n | \"invalid filesystem data\"\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the db (ie documents not matching the new schema).\n // The `convex dev` command will wait for either file OR table data change\n // to retry (if a table name is specified as the value in this Object).\n | {\n \"invalid filesystem or db data\": {\n tableName: string;\n componentPath?: string;\n } | null;\n }\n // The error was caused by either the local state (ie schema.ts content)\n // or the state of the deployment environment variables.\n // The `convex dev` command will wait for either file OR env var change\n // before retrying.\n | \"invalid filesystem or env vars\"\n // The error was some transient issue (e.g. a network\n // error). This will then cause a retry after an exponential backoff.\n | \"transient\"\n // This error was caught, handled, and now all that needs to happen\n // is for the proces to restart. No error is logged or reported.\n | \"already handled\"\n // This error is truly permanent. Exit `npx convex dev` because the\n // developer will need to take a manual commandline action.\n | \"fatal\";\n\nexport type BigBrainAuth = {\n header: string;\n} & (\n | {\n kind: \"projectKey\";\n projectKey: string;\n }\n | {\n kind: \"deploymentKey\";\n deploymentKey: string;\n }\n | {\n kind: \"previewDeployKey\";\n previewDeployKey: string;\n }\n | {\n kind: \"accessToken\";\n accessToken: string;\n }\n);\n\nexport interface Context {\n fs: Filesystem;\n deprecationMessagePrinted: boolean;\n // Reports to Sentry and either throws FatalError or exits the process.\n // Prints the `printedMessage` if provided\n crash(args: {\n exitCode: number;\n errorType: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }): Promise<never>;\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>): string;\n removeCleanup(\n handle: string,\n ): (exitCode: number, err?: any) => Promise<void> | null;\n bigBrainAuth(): BigBrainAuth | null;\n /**\n * Prefer using `updateBigBrainAuthAfterLogin` in `deploymentSelection.ts` instead\n */\n _updateBigBrainAuth(auth: BigBrainAuth | null): void;\n}\n\nasync function flushAndExit(exitCode: number, err?: any) {\n if (err) {\n Sentry.captureException(err);\n }\n await Sentry.close();\n return process.exit(exitCode);\n}\n\nexport type OneoffCtx = Context & {\n // Generally `ctx.crash` is better to use since it handles printing a message\n // for the user, and then calls this.\n //\n // This function reports to Sentry + exits the process, but does not handle\n // printing a message for the user.\n flushAndExit: (exitCode: number, err?: any) => Promise<never>;\n};\n\nclass OneoffContextImpl {\n private _cleanupFns: Record<\n string,\n (exitCode: number, err?: any) => Promise<void>\n > = {};\n public fs: Filesystem = nodeFs;\n public deprecationMessagePrinted: boolean = false;\n public spinner: Ora | undefined = undefined;\n private _bigBrainAuth: BigBrainAuth | null = null;\n\n crash = async (args: {\n exitCode: number;\n errorType?: ErrorType;\n errForSentry?: any;\n printedMessage: string | null;\n }) => {\n if (args.printedMessage !== null) {\n logFailure(args.printedMessage);\n }\n return await this.flushAndExit(args.exitCode, args.errForSentry);\n };\n flushAndExit = async (exitCode: number, err?: any) => {\n logVerbose(\"Flushing and exiting, error:\", err);\n if (err) {\n logVerbose(err.stack);\n }\n const cleanupFns = this._cleanupFns;\n // Clear the cleanup functions so that there's no risk of running them twice\n // if this somehow gets triggered twice.\n this._cleanupFns = {};\n const fns = Object.values(cleanupFns);\n logVerbose(`Running ${fns.length} cleanup functions`);\n for (const fn of fns) {\n await fn(exitCode, err);\n }\n logVerbose(\"All cleanup functions ran\");\n return flushAndExit(exitCode, err);\n };\n registerCleanup(fn: (exitCode: number, err?: any) => Promise<void>) {\n const handle = Math.random().toString(36).slice(2);\n this._cleanupFns[handle] = fn;\n return handle;\n }\n removeCleanup(handle: string) {\n const value = this._cleanupFns[handle];\n delete this._cleanupFns[handle];\n return value ?? null;\n }\n bigBrainAuth(): BigBrainAuth | null {\n return this._bigBrainAuth;\n }\n _updateBigBrainAuth(auth: BigBrainAuth | null): void {\n logVerbose(`Updating big brain auth to ${auth?.kind ?? \"null\"}`);\n this._bigBrainAuth = auth;\n }\n}\n\n/**\n * Install a SIGINT handler that gracefully exits via ctx.flushAndExit.\n *\n * `bun run` and `npm run` can deliver a duplicate SIGINT to the child\n * process immediately while the first handler is still starting cleanup:\n * bun: https://github.com/oven-sh/bun/issues/14799\n * https://github.com/oven-sh/bun/issues/11400\n * npm: https://github.com/npm/cli/issues/5021\n * https://github.com/npm/cli/issues/8164\n * https://github.com/npm/cli/issues/7693\n * We ignore a second signal within 500ms of the first to avoid\n * double-cleanup, but treat a later Ctrl+C as a force-exit escape hatch.\n */\nexport function installSigintHandler(ctx: OneoffCtx) {\n const DUPLICATE_GRACE_MS = 500;\n let cleanupStartTime: number | null = null;\n process.on(\"SIGINT\", async () => {\n if (cleanupStartTime !== null) {\n if (Date.now() - cleanupStartTime < DUPLICATE_GRACE_MS) {\n logVerbose(\n \"Received SIGINT during cleanup, ignoring duplicate signal...\",\n );\n return;\n }\n logVerbose(\"Received SIGINT during cleanup, exiting immediately...\");\n process.exit(130);\n }\n cleanupStartTime = Date.now();\n logVerbose(\"Received SIGINT, cleaning up...\");\n await ctx.flushAndExit(130);\n });\n}\n\nexport const oneoffContext: (args: {\n url?: string | undefined;\n adminKey?: string | undefined;\n envFile?: string | undefined;\n}) => Promise<OneoffCtx> = async (args) => {\n const ctx = new OneoffContextImpl();\n await detectSuspiciousEnvironmentVariables(\n ctx,\n !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,\n );\n await initializeBigBrainAuth(ctx, {\n url: args.url,\n adminKey: args.adminKey,\n envFile: args.envFile,\n });\n return ctx;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAExB,gBAAmC;AACnC,iCAAuC;AACvC,qBAAqD;AACrD,iBAAuC;AA4EvC,eAAe,aAAa,UAAkB,KAAW;AACvD,MAAI,KAAK;AACP,WAAO,iBAAiB,GAAG;AAAA,EAC7B;AACA,QAAM,OAAO,MAAM;AACnB,SAAO,QAAQ,KAAK,QAAQ;AAC9B;AAWA,MAAM,kBAAkB;AAAA,EAAxB;AACE,wBAAQ,eAGJ,CAAC;AACL,wBAAO,MAAiB;AACxB,wBAAO,6BAAqC;AAC5C,wBAAO;AACP,wBAAQ,iBAAqC;AAE7C,iCAAQ,OAAO,SAKT;AACJ,UAAI,KAAK,mBAAm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iCAAiC;AAC5C,UAAM,IAAI,aAAa,GAAG;AAAA,EAC5B,CAAC;AACH;AAEO,MAAM,gBAIc,OAAO,SAAS;AACzC,QAAM,MAAM,IAAI,kBAAkB;AAClC,YAAM;AAAA,IACJ;AAAA,IACA,CAAC,CAAC,QAAQ,IAAI;AAAA,EAChB;AACA,YAAM,mDAAuB,KAAK;AAAA,IAChC,KAAK,KAAK;AAAA,IACV,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,EAChB,CAAC;AACD,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -117,9 +117,6 @@ class NodeFs {
117
117
  stat(path2) {
118
118
  return import_fs.default.statSync(path2);
119
119
  }
120
- lstat(path2) {
121
- return import_fs.default.lstatSync(path2);
122
- }
123
120
  readUtf8File(path2) {
124
121
  return import_fs.default.readFileSync(path2, { encoding: "utf-8" });
125
122
  }
@@ -200,8 +197,6 @@ class RecordingFs {
200
197
  __publicField(this, "observedDirectories", /* @__PURE__ */ new Map());
201
198
  // Absolute path -> observed stat (or null if observed nonexistent)
202
199
  __publicField(this, "observedFiles", /* @__PURE__ */ new Map());
203
- // lstat observes the link itself, while stat observes its target.
204
- __publicField(this, "observedLstats", /* @__PURE__ */ new Map());
205
200
  // Have we noticed that files have changed while recording?
206
201
  __publicField(this, "invalidated", false);
207
202
  __publicField(this, "traceEvents");
@@ -234,19 +229,6 @@ class RecordingFs {
234
229
  this.observedDirectories.set(absDirPath, observedNames);
235
230
  return entries;
236
231
  }
237
- lstat(filePath) {
238
- const absPath = import_path.default.resolve(filePath);
239
- try {
240
- const st = nodeFs.lstat(filePath);
241
- this.registerNormalized(absPath, st, this.observedLstats);
242
- return st;
243
- } catch (err) {
244
- if (err.code === "ENOENT") {
245
- this.registerNormalized(absPath, null, this.observedLstats);
246
- }
247
- throw err;
248
- }
249
- }
250
232
  exists(path2) {
251
233
  try {
252
234
  const st = nodeFs.stat(path2);
@@ -345,8 +327,6 @@ class RecordingFs {
345
327
  updateOnWrite(absPath) {
346
328
  const newSt = nodeFs.stat(absPath);
347
329
  this.observedFiles.set(absPath, newSt);
348
- if (this.observedLstats.has(absPath))
349
- this.observedLstats.set(absPath, nodeFs.lstat(absPath));
350
330
  const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
351
331
  const observedParent = this.observedDirectories.get(parentPath);
352
332
  if (observedParent !== void 0) {
@@ -355,8 +335,6 @@ class RecordingFs {
355
335
  }
356
336
  updateOnDelete(absPath) {
357
337
  this.observedFiles.set(absPath, null);
358
- if (this.observedLstats.has(absPath))
359
- this.observedLstats.set(absPath, null);
360
338
  const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
361
339
  const observedParent = this.observedDirectories.get(parentPath);
362
340
  if (observedParent !== void 0) {
@@ -370,8 +348,8 @@ class RecordingFs {
370
348
  invalidate() {
371
349
  this.invalidated = true;
372
350
  }
373
- registerNormalized(absPath, observed, observations = this.observedFiles) {
374
- const existing = observations.get(absPath);
351
+ registerNormalized(absPath, observed) {
352
+ const existing = this.observedFiles.get(absPath);
375
353
  if (existing !== void 0) {
376
354
  const stMatch = stMatches(observed, existing);
377
355
  if (!stMatch.matches) {
@@ -387,22 +365,17 @@ class RecordingFs {
387
365
  this.invalidated = true;
388
366
  }
389
367
  }
390
- observations.set(absPath, observed);
368
+ this.observedFiles.set(absPath, observed);
391
369
  }
392
370
  finalize() {
393
371
  if (this.invalidated) {
394
372
  return "invalidated";
395
373
  }
396
- return new Observations(
397
- this.observedDirectories,
398
- this.observedFiles,
399
- this.observedLstats
400
- );
374
+ return new Observations(this.observedDirectories, this.observedFiles);
401
375
  }
402
376
  }
403
377
  class Observations {
404
- constructor(directories, files, lstats = /* @__PURE__ */ new Map()) {
405
- this.lstats = lstats;
378
+ constructor(directories, files) {
406
379
  __publicField(this, "directories");
407
380
  __publicField(this, "files");
408
381
  this.directories = directories;
@@ -416,8 +389,7 @@ class Observations {
416
389
  for (const path2 of this.files.keys()) {
417
390
  out.push(path2);
418
391
  }
419
- for (const path2 of this.lstats.keys()) out.push(path2);
420
- return [...new Set(out)];
392
+ return out;
421
393
  }
422
394
  overlaps({
423
395
  absPath
@@ -440,19 +412,6 @@ class Observations {
440
412
  return { overlaps: true, reason };
441
413
  }
442
414
  }
443
- const observedLstat = this.lstats.get(absPath);
444
- if (observedLstat !== void 0) {
445
- let currentLstat;
446
- try {
447
- currentLstat = nodeFs.lstat(absPath);
448
- } catch (err) {
449
- if (err.code !== "ENOENT") throw err;
450
- currentLstat = null;
451
- }
452
- const match = stMatches(observedLstat, currentLstat);
453
- if (!match.matches)
454
- return { overlaps: true, reason: `modified (${match.reason})` };
455
- }
456
415
  const parentPath = import_path.default.resolve(import_path.default.dirname(absPath));
457
416
  const observedParent = this.directories.get(parentPath);
458
417
  if (observedParent !== void 0) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/bundler/fs.ts"],
4
- "sourcesContent": ["// Disable our restriction on `throw` because these aren't developer-facing\n// error messages.\n/* eslint-disable no-restricted-imports */\n/* eslint-disable no-restricted-syntax */\nimport { chalkStderr } from \"chalk\";\nimport stdFs, { Dirent, Mode, ReadStream, Stats } from \"fs\";\nimport * as fsPromises from \"fs/promises\";\nimport os from \"os\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { Readable } from \"stream\";\n\nexport type NormalizedPath = string;\n\nconst tmpDirOverrideVar = \"CONVEX_TMPDIR\";\nfunction tmpDirPath() {\n // Allow users to override the temporary directory path with an environment variable.\n // This override needs to (1) be project-specific, since the user may have projects\n // on different filesystems, but also (2) be device-specific and not checked in, since\n // it's dependent on where the user has checked out their project. So, we don't want\n // this state in the project-specific `convex.json`, which is shared across all\n // devices, or in the top-level `~/.convex` directory, which is shared across all\n // projects on the local machine.\n //\n // Therefore, just let advanced users configure this behavior with an environment\n // variable that they're responsible for managing themselves for now.\n const envTmpDir = process.env[tmpDirOverrideVar];\n return envTmpDir ?? os.tmpdir();\n}\nconst tmpDirRoot = tmpDirPath();\n\nlet warned = false;\nfunction warnCrossFilesystem(dstPath: string) {\n const dstDir = path.dirname(dstPath);\n if (!warned) {\n // It's hard for these to use `logMessage` without creating a circular dependency, so just log directly.\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.yellow(\n `Temporary directory '${tmpDirRoot}' and project directory '${dstDir}' are on different filesystems.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` If you're running into errors with other tools watching the project directory, override the temporary directory location with the ${chalkStderr.bold(\n tmpDirOverrideVar,\n )} environment variable.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` Be sure to pick a temporary directory that's on the same filesystem as your project.`,\n ),\n );\n warned = true;\n }\n}\n\nexport interface Filesystem {\n listDir(dirPath: string): Dirent[];\n\n exists(path: string): boolean;\n stat(path: string): Stats;\n lstat(path: string): Stats;\n readUtf8File(path: string): string;\n // createReadStream returns a stream for which [Symbol.asyncIterator]\n // yields chunks of size highWaterMark (until the last one), or 64KB if\n // highWaterMark isn't specified.\n // https://nodejs.org/api/stream.html#readablesymbolasynciterator\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream;\n access(path: string): void;\n\n writeUtf8File(path: string, contents: string, mode?: Mode): void;\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void;\n rmdir(path: string): void;\n unlink(path: string): void;\n swapTmpFile(fromPath: TempPath, toPath: string): void;\n\n registerPath(path: string, st: Stats | null): void;\n invalidate(): void;\n}\n\nexport type TempPath = string & { __tempPath: \"tempPath\" };\n\nexport interface TempDir {\n writeUtf8File(contents: string): TempPath;\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void>;\n registerTempPath(st: Stats | null): TempPath;\n path: TempPath;\n}\n\nexport async function withTmpDir(\n callback: (tmpDir: TempDir) => Promise<void>,\n): Promise<void> {\n // Create temporary directories inside `tmpDirRoot` of the form `convex-<random>`.\n const tmpPath = stdFs.mkdtempSync(path.join(tmpDirRoot, \"convex\"));\n const tmpDir = {\n writeUtf8File(contents: string): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.writeUtf8File(filePath, contents);\n return filePath as TempPath;\n },\n registerTempPath(st: Stats | null): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.registerPath(filePath, st);\n return filePath as TempPath;\n },\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n return nodeFs.writeFileStream(path, stream, onData);\n },\n path: tmpPath as TempPath,\n };\n try {\n await callback(tmpDir);\n } finally {\n stdFs.rmSync(tmpPath, { force: true, recursive: true });\n }\n}\n\n// Use `nodeFs` when you just want to read and write to the local filesystem\n// and don't care about collecting the paths touched. One-off commands\n// should use the singleton `nodeFs`.\nexport class NodeFs implements Filesystem {\n listDir(dirPath: string) {\n return stdFs.readdirSync(dirPath, { withFileTypes: true });\n }\n exists(path: string) {\n try {\n stdFs.statSync(path);\n return true;\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return false;\n }\n throw e;\n }\n }\n stat(path: string) {\n return stdFs.statSync(path);\n }\n lstat(path: string) {\n return stdFs.lstatSync(path);\n }\n readUtf8File(path: string) {\n return stdFs.readFileSync(path, { encoding: \"utf-8\" });\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n return stdFs.createReadStream(path, options);\n }\n // To avoid issues with filesystem events triggering for our own streamed file\n // writes, writeFileStream is intentionally not on the Filesystem interface\n // and not implemented by RecordingFs.\n async writeFileStream(\n path: string,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n // 'wx' means O_CREAT | O_EXCL | O_WRONLY\n // 0o644 means owner has readwrite access, everyone else has read access.\n const fileHandle = await fsPromises.open(path, \"wx\", 0o644);\n try {\n for await (const chunk of stream) {\n // For some reason, adding `stream.on(\"data\", onData)` causes issues with\n // the stream, but calling a callback here works.\n if (onData) {\n onData(chunk);\n }\n await fileHandle.write(chunk);\n }\n } finally {\n await fileHandle.close();\n }\n }\n access(path: string) {\n return stdFs.accessSync(path);\n }\n writeUtf8File(path: string, contents: string, mode?: Mode) {\n const fd = stdFs.openSync(path, \"w\", mode);\n try {\n stdFs.writeFileSync(fd, contents, { encoding: \"utf-8\" });\n try {\n stdFs.fsyncSync(fd);\n } catch (e: any) {\n // fsync(2) returns EINVAL on file descriptors that don't support\n // synchronization, e.g. FIFOs/pipes. Some integrations (such as\n // 1Password's Local Environment File) expose `.env.local` as a\n // FIFO so secrets can be streamed on demand; the write itself\n // succeeded, so treat the missing sync as best-effort.\n if (e?.code !== \"EINVAL\") {\n throw e;\n }\n }\n } finally {\n stdFs.closeSync(fd);\n }\n }\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n try {\n stdFs.mkdirSync(dirPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n return;\n }\n throw e;\n }\n }\n rmdir(path: string) {\n stdFs.rmdirSync(path);\n }\n unlink(path: string) {\n return stdFs.unlinkSync(path);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n try {\n return stdFs.renameSync(fromPath, toPath);\n } catch (e: any) {\n // Fallback to copying the file if we're on different volumes.\n if (e.code === \"EXDEV\") {\n warnCrossFilesystem(toPath);\n stdFs.copyFileSync(fromPath, toPath);\n return;\n }\n throw e;\n }\n }\n registerPath(_path: string, _st: Stats | null) {\n // The node filesystem doesn't track reads, so we don't need to do anything here.\n }\n invalidate() {\n // We don't track invalidations for the node filesystem either.\n }\n}\nexport const nodeFs = new NodeFs();\n\n// Filesystem implementation that records all paths observed. This is useful\n// for implementing continuous watch commands that need to manage a filesystem\n// watcher and know when a command's inputs were invalidated.\nexport class RecordingFs implements Filesystem {\n // Absolute path -> Set of observed child names\n private observedDirectories: Map<string, Set<string>> = new Map();\n\n // Absolute path -> observed stat (or null if observed nonexistent)\n private observedFiles: Map<string, Stats | null> = new Map();\n\n // lstat observes the link itself, while stat observes its target.\n private observedLstats: Map<string, Stats | null> = new Map();\n\n // Have we noticed that files have changed while recording?\n private invalidated = false;\n\n private traceEvents: boolean;\n\n constructor(traceEvents: boolean) {\n this.traceEvents = traceEvents;\n }\n\n listDir(dirPath: string): Dirent[] {\n const absDirPath = path.resolve(dirPath);\n\n // Register observing the directory itself.\n const dirSt = nodeFs.stat(absDirPath);\n this.registerNormalized(absDirPath, dirSt);\n\n // List the directory and register observing all of its children.\n const entries = nodeFs.listDir(dirPath);\n for (const entry of entries) {\n const childPath = path.join(absDirPath, entry.name);\n const childSt = nodeFs.stat(childPath);\n this.registerPath(childPath, childSt);\n }\n\n // Register observing the directory's children.\n const observedNames = new Set(entries.map((e) => e.name));\n const existingNames = this.observedDirectories.get(absDirPath);\n if (existingNames) {\n if (!setsEqual(observedNames, existingNames)) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to directory children mismatch\",\n observedNames,\n existingNames,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedDirectories.set(absDirPath, observedNames);\n\n return entries;\n }\n\n lstat(filePath: string): Stats {\n const absPath = path.resolve(filePath);\n try {\n const st = nodeFs.lstat(filePath);\n this.registerNormalized(absPath, st, this.observedLstats);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerNormalized(absPath, null, this.observedLstats);\n }\n throw err;\n }\n }\n\n exists(path: string): boolean {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return true;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n return false;\n }\n throw err;\n }\n }\n stat(path: string): Stats {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n readUtf8File(path: string): string {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.readUtf8File(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.createReadStream(path, options);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n access(path: string) {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.access(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n\n writeUtf8File(filePath: string, contents: string, mode?: Mode) {\n const absPath = path.resolve(filePath);\n\n nodeFs.writeUtf8File(filePath, contents, mode);\n\n this.updateOnWrite(absPath);\n }\n\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n const absPath = path.resolve(dirPath);\n try {\n stdFs.mkdirSync(absPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n const st = nodeFs.stat(absPath);\n this.registerNormalized(absPath, st);\n return;\n }\n throw e;\n }\n this.updateOnWrite(absPath);\n }\n\n rmdir(dirPath: string) {\n const absPath = path.resolve(dirPath);\n stdFs.rmdirSync(absPath);\n this.updateOnDelete(absPath);\n }\n unlink(filePath: string) {\n const absPath = path.resolve(filePath);\n stdFs.unlinkSync(absPath);\n this.updateOnDelete(absPath);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n const absToPath = path.resolve(toPath);\n nodeFs.swapTmpFile(fromPath, absToPath);\n this.updateOnWrite(absToPath);\n }\n\n private updateOnWrite(absPath: string) {\n // Stat the file or dir after writing and make it our expected observation. If we read the file after\n // writing it and it doesn't match this stat (implying a subsequent write), we'll invalidate\n // the current reader.\n const newSt = nodeFs.stat(absPath);\n // Skip invalidation checking since we don't want to conflict if we previously read this file.\n this.observedFiles.set(absPath, newSt);\n if (this.observedLstats.has(absPath))\n this.observedLstats.set(absPath, nodeFs.lstat(absPath));\n\n // If we observed the parent, add our newly created file.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.add(path.basename(absPath));\n }\n }\n private updateOnDelete(absPath: string) {\n // Expect this file to be gone.\n this.observedFiles.set(absPath, null);\n if (this.observedLstats.has(absPath))\n this.observedLstats.set(absPath, null);\n\n // Unlink it from our parent if observed.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.delete(path.basename(absPath));\n }\n }\n\n registerPath(p: string, st: Stats | null) {\n const absPath = path.resolve(p);\n this.registerNormalized(absPath, st);\n }\n\n invalidate() {\n this.invalidated = true;\n }\n\n registerNormalized(\n absPath: string,\n observed: Stats | null,\n observations = this.observedFiles,\n ): void {\n const existing = observations.get(absPath);\n if (existing !== undefined) {\n const stMatch = stMatches(observed, existing);\n if (!stMatch.matches) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to st mismatch\",\n absPath,\n observed,\n existing,\n stMatch.reason,\n );\n }\n this.invalidated = true;\n }\n }\n observations.set(absPath, observed);\n }\n\n finalize(): Observations | \"invalidated\" {\n if (this.invalidated) {\n return \"invalidated\";\n }\n return new Observations(\n this.observedDirectories,\n this.observedFiles,\n this.observedLstats,\n );\n }\n}\n\nexport type WatchEvent = {\n name: \"add\" | \"addDir\" | \"change\" | \"unlink\" | \"unlinkDir\";\n absPath: string;\n};\n\nexport class Observations {\n directories: Map<string, Set<string>>;\n files: Map<string, Stats | null>;\n\n constructor(\n directories: Map<string, Set<string>>,\n files: Map<string, Stats | null>,\n private lstats: Map<string, Stats | null> = new Map(),\n ) {\n this.directories = directories;\n this.files = files;\n }\n\n paths(): string[] {\n const out = [];\n for (const path of this.directories.keys()) {\n out.push(path);\n }\n for (const path of this.files.keys()) {\n out.push(path);\n }\n for (const path of this.lstats.keys()) out.push(path);\n return [...new Set(out)];\n }\n\n overlaps({\n absPath,\n }: WatchEvent): { overlaps: false } | { overlaps: true; reason: string } {\n let currentSt: null | Stats;\n try {\n currentSt = nodeFs.stat(absPath);\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n currentSt = null;\n } else {\n throw e;\n }\n }\n\n // First, check to see if we observed `absPath` as a file.\n const observedSt = this.files.get(absPath);\n if (observedSt !== undefined) {\n const stMatch = stMatches(observedSt, currentSt);\n if (!stMatch.matches) {\n const reason = `modified (${stMatch.reason})`;\n return { overlaps: true, reason };\n }\n }\n\n const observedLstat = this.lstats.get(absPath);\n if (observedLstat !== undefined) {\n let currentLstat: Stats | null;\n try {\n currentLstat = nodeFs.lstat(absPath);\n } catch (err: any) {\n if (err.code !== \"ENOENT\") throw err;\n currentLstat = null;\n }\n const match = stMatches(observedLstat, currentLstat);\n if (!match.matches)\n return { overlaps: true, reason: `modified (${match.reason})` };\n }\n\n // Second, check if we listed the directory this file is in.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.directories.get(parentPath);\n if (observedParent !== undefined) {\n const filename = path.basename(absPath);\n\n // If the file is gone now, but we observed it in its directory, then\n // it was deleted.\n if (currentSt === null && observedParent.has(filename)) {\n return { overlaps: true, reason: \"deleted\" };\n }\n\n // If the file exists now, but we didn't see it when listing its directory,\n // then it was added.\n if (currentSt !== null && !observedParent.has(filename)) {\n return { overlaps: true, reason: \"added\" };\n }\n }\n\n return { overlaps: false };\n }\n}\n\nfunction setsEqual<T>(a: Set<T>, b: Set<T>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const elem of a.keys()) {\n if (!b.has(elem)) {\n return false;\n }\n }\n return true;\n}\n\nexport function stMatches(\n a: Stats | null,\n b: Stats | null,\n): { matches: true } | { matches: false; reason: string } {\n if (a === null && b === null) {\n return { matches: true };\n }\n if (a !== null && b !== null) {\n if (a.dev !== b.dev) {\n return { matches: false, reason: \"device boundary\" };\n }\n if (a.isFile() || b.isFile()) {\n if (!a.isFile() || !b.isFile()) {\n return { matches: false, reason: \"file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `file inode (${a.ino} vs. ${b.ino})`,\n };\n }\n if (a.size !== b.size) {\n return {\n matches: false,\n reason: `file size (${a.size} vs. ${b.size})`,\n };\n }\n if (a.mtimeMs !== b.mtimeMs) {\n return {\n matches: false,\n reason: `file mtime (${a.mtimeMs} vs. ${b.mtimeMs})`,\n };\n }\n return { matches: true };\n }\n if (a.isDirectory() || b.isDirectory()) {\n if (!b.isDirectory() || !b.isDirectory()) {\n return { matches: false, reason: \"dir file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `dir inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n // If we have something other than a file or directory, just compare inodes.\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `special inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n return { matches: false, reason: \"deleted mismatch\" };\n}\n\n// Sort consistent with unix directory listings.\nexport function consistentPathSort(a: Dirent, b: Dirent) {\n for (let i = 0; i < Math.min(a.name.length, b.name.length); i++) {\n if (a.name.charCodeAt(i) !== b.name.charCodeAt(i)) {\n return a.name.charCodeAt(i) - b.name.charCodeAt(i);\n }\n }\n return a.name.length - b.name.length;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA4B;AAC5B,gBAAuD;AACvD,iBAA4B;AAC5B,gBAAe;AACf,kBAAiB;AACjB,oBAAmB;AAKnB,MAAM,oBAAoB;AAC1B,SAAS,aAAa;AAWpB,QAAM,YAAY,QAAQ,IAAI,iBAAiB;AAC/C,SAAO,aAAa,UAAAA,QAAG,OAAO;AAChC;AACA,MAAM,aAAa,WAAW;AAE9B,IAAI,SAAS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ACtC,UAAI,CAAC,EAAE,YAAY,KAAK,CAAC,EAAE,YAAY,GAAG;AACxC,eAAO,EAAE,SAAS,OAAO,QAAQ,gBAAgB;AAAA,MACnD;AACA,UAAI,EAAE,QAAQ,EAAE,KAAK;AACnB,eAAO;AAAA,UACL,SAAS;AAAA,UACT,QAAQ,cAAc,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,QAC1C;AAAA,MACF;AACA,aAAO,EAAE,SAAS,KAAK;AAAA,IACzB;AAEA,QAAI,EAAE,QAAQ,EAAE,KAAK;AACnB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ,kBAAkB,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,MAC9C;AAAA,IACF;AACA,WAAO,EAAE,SAAS,KAAK;AAAA,EACzB;AACA,SAAO,EAAE,SAAS,OAAO,QAAQ,mBAAmB;AACtD;AAGO,SAAS,mBAAmB,GAAW,GAAW;AACvD,WAAS,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,GAAG,KAAK;AAC/D,QAAI,EAAE,KAAK,WAAW,CAAC,MAAM,EAAE,KAAK,WAAW,CAAC,GAAG;AACjD,aAAO,EAAE,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA,IACnD;AAAA,EACF;AACA,SAAO,EAAE,KAAK,SAAS,EAAE,KAAK;AAChC;",
4
+ "sourcesContent": ["// Disable our restriction on `throw` because these aren't developer-facing\n// error messages.\n/* eslint-disable no-restricted-imports */\n/* eslint-disable no-restricted-syntax */\nimport { chalkStderr } from \"chalk\";\nimport stdFs, { Dirent, Mode, ReadStream, Stats } from \"fs\";\nimport * as fsPromises from \"fs/promises\";\nimport os from \"os\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { Readable } from \"stream\";\n\nexport type NormalizedPath = string;\n\nconst tmpDirOverrideVar = \"CONVEX_TMPDIR\";\nfunction tmpDirPath() {\n // Allow users to override the temporary directory path with an environment variable.\n // This override needs to (1) be project-specific, since the user may have projects\n // on different filesystems, but also (2) be device-specific and not checked in, since\n // it's dependent on where the user has checked out their project. So, we don't want\n // this state in the project-specific `convex.json`, which is shared across all\n // devices, or in the top-level `~/.convex` directory, which is shared across all\n // projects on the local machine.\n //\n // Therefore, just let advanced users configure this behavior with an environment\n // variable that they're responsible for managing themselves for now.\n const envTmpDir = process.env[tmpDirOverrideVar];\n return envTmpDir ?? os.tmpdir();\n}\nconst tmpDirRoot = tmpDirPath();\n\nlet warned = false;\nfunction warnCrossFilesystem(dstPath: string) {\n const dstDir = path.dirname(dstPath);\n if (!warned) {\n // It's hard for these to use `logMessage` without creating a circular dependency, so just log directly.\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.yellow(\n `Temporary directory '${tmpDirRoot}' and project directory '${dstDir}' are on different filesystems.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` If you're running into errors with other tools watching the project directory, override the temporary directory location with the ${chalkStderr.bold(\n tmpDirOverrideVar,\n )} environment variable.`,\n ),\n );\n // eslint-disable-next-line no-console\n console.warn(\n chalkStderr.gray(\n ` Be sure to pick a temporary directory that's on the same filesystem as your project.`,\n ),\n );\n warned = true;\n }\n}\n\nexport interface Filesystem {\n listDir(dirPath: string): Dirent[];\n\n exists(path: string): boolean;\n stat(path: string): Stats;\n readUtf8File(path: string): string;\n // createReadStream returns a stream for which [Symbol.asyncIterator]\n // yields chunks of size highWaterMark (until the last one), or 64KB if\n // highWaterMark isn't specified.\n // https://nodejs.org/api/stream.html#readablesymbolasynciterator\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream;\n access(path: string): void;\n\n writeUtf8File(path: string, contents: string, mode?: Mode): void;\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void;\n rmdir(path: string): void;\n unlink(path: string): void;\n swapTmpFile(fromPath: TempPath, toPath: string): void;\n\n registerPath(path: string, st: Stats | null): void;\n invalidate(): void;\n}\n\nexport type TempPath = string & { __tempPath: \"tempPath\" };\n\nexport interface TempDir {\n writeUtf8File(contents: string): TempPath;\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void>;\n registerTempPath(st: Stats | null): TempPath;\n path: TempPath;\n}\n\nexport async function withTmpDir(\n callback: (tmpDir: TempDir) => Promise<void>,\n): Promise<void> {\n // Create temporary directories inside `tmpDirRoot` of the form `convex-<random>`.\n const tmpPath = stdFs.mkdtempSync(path.join(tmpDirRoot, \"convex\"));\n const tmpDir = {\n writeUtf8File(contents: string): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.writeUtf8File(filePath, contents);\n return filePath as TempPath;\n },\n registerTempPath(st: Stats | null): TempPath {\n const filePath = path.join(tmpPath, crypto.randomUUID());\n nodeFs.registerPath(filePath, st);\n return filePath as TempPath;\n },\n writeFileStream(\n path: TempPath,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n return nodeFs.writeFileStream(path, stream, onData);\n },\n path: tmpPath as TempPath,\n };\n try {\n await callback(tmpDir);\n } finally {\n stdFs.rmSync(tmpPath, { force: true, recursive: true });\n }\n}\n\n// Use `nodeFs` when you just want to read and write to the local filesystem\n// and don't care about collecting the paths touched. One-off commands\n// should use the singleton `nodeFs`.\nexport class NodeFs implements Filesystem {\n listDir(dirPath: string) {\n return stdFs.readdirSync(dirPath, { withFileTypes: true });\n }\n exists(path: string) {\n try {\n stdFs.statSync(path);\n return true;\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return false;\n }\n throw e;\n }\n }\n stat(path: string) {\n return stdFs.statSync(path);\n }\n readUtf8File(path: string) {\n return stdFs.readFileSync(path, { encoding: \"utf-8\" });\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n return stdFs.createReadStream(path, options);\n }\n // To avoid issues with filesystem events triggering for our own streamed file\n // writes, writeFileStream is intentionally not on the Filesystem interface\n // and not implemented by RecordingFs.\n async writeFileStream(\n path: string,\n stream: Readable,\n onData?: (chunk: any) => void,\n ): Promise<void> {\n // 'wx' means O_CREAT | O_EXCL | O_WRONLY\n // 0o644 means owner has readwrite access, everyone else has read access.\n const fileHandle = await fsPromises.open(path, \"wx\", 0o644);\n try {\n for await (const chunk of stream) {\n // For some reason, adding `stream.on(\"data\", onData)` causes issues with\n // the stream, but calling a callback here works.\n if (onData) {\n onData(chunk);\n }\n await fileHandle.write(chunk);\n }\n } finally {\n await fileHandle.close();\n }\n }\n access(path: string) {\n return stdFs.accessSync(path);\n }\n writeUtf8File(path: string, contents: string, mode?: Mode) {\n const fd = stdFs.openSync(path, \"w\", mode);\n try {\n stdFs.writeFileSync(fd, contents, { encoding: \"utf-8\" });\n try {\n stdFs.fsyncSync(fd);\n } catch (e: any) {\n // fsync(2) returns EINVAL on file descriptors that don't support\n // synchronization, e.g. FIFOs/pipes. Some integrations (such as\n // 1Password's Local Environment File) expose `.env.local` as a\n // FIFO so secrets can be streamed on demand; the write itself\n // succeeded, so treat the missing sync as best-effort.\n if (e?.code !== \"EINVAL\") {\n throw e;\n }\n }\n } finally {\n stdFs.closeSync(fd);\n }\n }\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n try {\n stdFs.mkdirSync(dirPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n return;\n }\n throw e;\n }\n }\n rmdir(path: string) {\n stdFs.rmdirSync(path);\n }\n unlink(path: string) {\n return stdFs.unlinkSync(path);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n try {\n return stdFs.renameSync(fromPath, toPath);\n } catch (e: any) {\n // Fallback to copying the file if we're on different volumes.\n if (e.code === \"EXDEV\") {\n warnCrossFilesystem(toPath);\n stdFs.copyFileSync(fromPath, toPath);\n return;\n }\n throw e;\n }\n }\n registerPath(_path: string, _st: Stats | null) {\n // The node filesystem doesn't track reads, so we don't need to do anything here.\n }\n invalidate() {\n // We don't track invalidations for the node filesystem either.\n }\n}\nexport const nodeFs = new NodeFs();\n\n// Filesystem implementation that records all paths observed. This is useful\n// for implementing continuous watch commands that need to manage a filesystem\n// watcher and know when a command's inputs were invalidated.\nexport class RecordingFs implements Filesystem {\n // Absolute path -> Set of observed child names\n private observedDirectories: Map<string, Set<string>> = new Map();\n\n // Absolute path -> observed stat (or null if observed nonexistent)\n private observedFiles: Map<string, Stats | null> = new Map();\n\n // Have we noticed that files have changed while recording?\n private invalidated = false;\n\n private traceEvents: boolean;\n\n constructor(traceEvents: boolean) {\n this.traceEvents = traceEvents;\n }\n\n listDir(dirPath: string): Dirent[] {\n const absDirPath = path.resolve(dirPath);\n\n // Register observing the directory itself.\n const dirSt = nodeFs.stat(absDirPath);\n this.registerNormalized(absDirPath, dirSt);\n\n // List the directory and register observing all of its children.\n const entries = nodeFs.listDir(dirPath);\n for (const entry of entries) {\n const childPath = path.join(absDirPath, entry.name);\n const childSt = nodeFs.stat(childPath);\n this.registerPath(childPath, childSt);\n }\n\n // Register observing the directory's children.\n const observedNames = new Set(entries.map((e) => e.name));\n const existingNames = this.observedDirectories.get(absDirPath);\n if (existingNames) {\n if (!setsEqual(observedNames, existingNames)) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to directory children mismatch\",\n observedNames,\n existingNames,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedDirectories.set(absDirPath, observedNames);\n\n return entries;\n }\n\n exists(path: string): boolean {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return true;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n return false;\n }\n throw err;\n }\n }\n stat(path: string): Stats {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return st;\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n readUtf8File(path: string): string {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.readUtf8File(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n createReadStream(\n path: string,\n options: { highWaterMark?: number },\n ): ReadStream {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.createReadStream(path, options);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n access(path: string) {\n try {\n const st = nodeFs.stat(path);\n this.registerPath(path, st);\n return nodeFs.access(path);\n } catch (err: any) {\n if (err.code === \"ENOENT\") {\n this.registerPath(path, null);\n }\n throw err;\n }\n }\n\n writeUtf8File(filePath: string, contents: string, mode?: Mode) {\n const absPath = path.resolve(filePath);\n\n nodeFs.writeUtf8File(filePath, contents, mode);\n\n this.updateOnWrite(absPath);\n }\n\n mkdir(\n dirPath: string,\n options?: { allowExisting?: boolean; recursive?: boolean },\n ): void {\n const absPath = path.resolve(dirPath);\n try {\n stdFs.mkdirSync(absPath, { recursive: options?.recursive });\n } catch (e: any) {\n if (options?.allowExisting && e.code === \"EEXIST\") {\n const st = nodeFs.stat(absPath);\n this.registerNormalized(absPath, st);\n return;\n }\n throw e;\n }\n this.updateOnWrite(absPath);\n }\n\n rmdir(dirPath: string) {\n const absPath = path.resolve(dirPath);\n stdFs.rmdirSync(absPath);\n this.updateOnDelete(absPath);\n }\n unlink(filePath: string) {\n const absPath = path.resolve(filePath);\n stdFs.unlinkSync(absPath);\n this.updateOnDelete(absPath);\n }\n swapTmpFile(fromPath: TempPath, toPath: string) {\n const absToPath = path.resolve(toPath);\n nodeFs.swapTmpFile(fromPath, absToPath);\n this.updateOnWrite(absToPath);\n }\n\n private updateOnWrite(absPath: string) {\n // Stat the file or dir after writing and make it our expected observation. If we read the file after\n // writing it and it doesn't match this stat (implying a subsequent write), we'll invalidate\n // the current reader.\n const newSt = nodeFs.stat(absPath);\n // Skip invalidation checking since we don't want to conflict if we previously read this file.\n this.observedFiles.set(absPath, newSt);\n\n // If we observed the parent, add our newly created file.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.add(path.basename(absPath));\n }\n }\n private updateOnDelete(absPath: string) {\n // Expect this file to be gone.\n this.observedFiles.set(absPath, null);\n\n // Unlink it from our parent if observed.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.observedDirectories.get(parentPath);\n if (observedParent !== undefined) {\n observedParent.delete(path.basename(absPath));\n }\n }\n\n registerPath(p: string, st: Stats | null) {\n const absPath = path.resolve(p);\n this.registerNormalized(absPath, st);\n }\n\n invalidate() {\n this.invalidated = true;\n }\n\n registerNormalized(absPath: string, observed: Stats | null): void {\n const existing = this.observedFiles.get(absPath);\n if (existing !== undefined) {\n const stMatch = stMatches(observed, existing);\n if (!stMatch.matches) {\n if (this.traceEvents) {\n // eslint-disable-next-line no-console\n console.log(\n \"Invalidating due to st mismatch\",\n absPath,\n observed,\n existing,\n stMatch.reason,\n );\n }\n this.invalidated = true;\n }\n }\n this.observedFiles.set(absPath, observed);\n }\n\n finalize(): Observations | \"invalidated\" {\n if (this.invalidated) {\n return \"invalidated\";\n }\n return new Observations(this.observedDirectories, this.observedFiles);\n }\n}\n\nexport type WatchEvent = {\n name: \"add\" | \"addDir\" | \"change\" | \"unlink\" | \"unlinkDir\";\n absPath: string;\n};\n\nexport class Observations {\n directories: Map<string, Set<string>>;\n files: Map<string, Stats | null>;\n\n constructor(\n directories: Map<string, Set<string>>,\n files: Map<string, Stats | null>,\n ) {\n this.directories = directories;\n this.files = files;\n }\n\n paths(): string[] {\n const out = [];\n for (const path of this.directories.keys()) {\n out.push(path);\n }\n for (const path of this.files.keys()) {\n out.push(path);\n }\n return out;\n }\n\n overlaps({\n absPath,\n }: WatchEvent): { overlaps: false } | { overlaps: true; reason: string } {\n let currentSt: null | Stats;\n try {\n currentSt = nodeFs.stat(absPath);\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n currentSt = null;\n } else {\n throw e;\n }\n }\n\n // First, check to see if we observed `absPath` as a file.\n const observedSt = this.files.get(absPath);\n if (observedSt !== undefined) {\n const stMatch = stMatches(observedSt, currentSt);\n if (!stMatch.matches) {\n const reason = `modified (${stMatch.reason})`;\n return { overlaps: true, reason };\n }\n }\n\n // Second, check if we listed the directory this file is in.\n const parentPath = path.resolve(path.dirname(absPath));\n const observedParent = this.directories.get(parentPath);\n if (observedParent !== undefined) {\n const filename = path.basename(absPath);\n\n // If the file is gone now, but we observed it in its directory, then\n // it was deleted.\n if (currentSt === null && observedParent.has(filename)) {\n return { overlaps: true, reason: \"deleted\" };\n }\n\n // If the file exists now, but we didn't see it when listing its directory,\n // then it was added.\n if (currentSt !== null && !observedParent.has(filename)) {\n return { overlaps: true, reason: \"added\" };\n }\n }\n\n return { overlaps: false };\n }\n}\n\nfunction setsEqual<T>(a: Set<T>, b: Set<T>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const elem of a.keys()) {\n if (!b.has(elem)) {\n return false;\n }\n }\n return true;\n}\n\nexport function stMatches(\n a: Stats | null,\n b: Stats | null,\n): { matches: true } | { matches: false; reason: string } {\n if (a === null && b === null) {\n return { matches: true };\n }\n if (a !== null && b !== null) {\n if (a.dev !== b.dev) {\n return { matches: false, reason: \"device boundary\" };\n }\n if (a.isFile() || b.isFile()) {\n if (!a.isFile() || !b.isFile()) {\n return { matches: false, reason: \"file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `file inode (${a.ino} vs. ${b.ino})`,\n };\n }\n if (a.size !== b.size) {\n return {\n matches: false,\n reason: `file size (${a.size} vs. ${b.size})`,\n };\n }\n if (a.mtimeMs !== b.mtimeMs) {\n return {\n matches: false,\n reason: `file mtime (${a.mtimeMs} vs. ${b.mtimeMs})`,\n };\n }\n return { matches: true };\n }\n if (a.isDirectory() || b.isDirectory()) {\n if (!b.isDirectory() || !b.isDirectory()) {\n return { matches: false, reason: \"dir file type\" };\n }\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `dir inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n // If we have something other than a file or directory, just compare inodes.\n if (a.ino !== b.ino) {\n return {\n matches: false,\n reason: `special inode (${a.ino} vs. ${b.ino})`,\n };\n }\n return { matches: true };\n }\n return { matches: false, reason: \"deleted mismatch\" };\n}\n\n// Sort consistent with unix directory listings.\nexport function consistentPathSort(a: Dirent, b: Dirent) {\n for (let i = 0; i < Math.min(a.name.length, b.name.length); i++) {\n if (a.name.charCodeAt(i) !== b.name.charCodeAt(i)) {\n return a.name.charCodeAt(i) - b.name.charCodeAt(i);\n }\n }\n return a.name.length - b.name.length;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA4B;AAC5B,gBAAuD;AACvD,iBAA4B;AAC5B,gBAAe;AACf,kBAAiB;AACjB,oBAAmB;AAKnB,MAAM,oBAAoB;AAC1B,SAAS,aAAa;AAWpB,QAAM,YAAY,QAAQ,IAAI,iBAAiB;AAC/C,SAAO,aAAa,UAAAA,QAAG,OAAO;AAChC;AACA,MAAM,aAAa,WAAW;AAE9B,IAAI,SAAS;AACb,SAAS,oBAAoB,SAAiB;AAC5C,QAAM,SAAS,YAAAC,QAAK,QAAQ,OAAO;AACnC,MAAI,CAAC,QAAQ;AAGX,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV,wBAAwB,UAAU,4BAA4B,MAAM;AAAA,MACtE;AAAA,IACF;AAEA,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV,uIAAuI,yBAAY;AAAA,UACjJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,YAAQ;AAAA,MACN,yBAAY;AAAA,QACV;AAAA,MACF;AAAA,IACF;AACA,aAAS;AAAA,EACX;AACF;AA4CA,eAAsB,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AAS,KAAK;AAAA,IACzB;AAEA,QAAI,EAAE,QAAQ,EAAE,KAAK;AACnB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ,kBAAkB,EAAE,GAAG,QAAQ,EAAE,GAAG;AAAA,MAC9C;AAAA,IACF;AACA,WAAO,EAAE,SAAS,KAAK;AAAA,EACzB;AACA,SAAO,EAAE,SAAS,OAAO,QAAQ,mBAAmB;AACtD;AAGO,SAAS,mBAAmB,GAAW,GAAW;AACvD,WAAS,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,GAAG,KAAK;AAC/D,QAAI,EAAE,KAAK,WAAW,CAAC,MAAM,EAAE,KAAK,WAAW,CAAC,GAAG;AACjD,aAAO,EAAE,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA,IACnD;AAAA,EACF;AACA,SAAO,EAAE,KAAK,SAAS,EAAE,KAAK;AAChC;",
6
6
  "names": ["os", "path", "stdFs", "crypto"]
7
7
  }
@@ -52,8 +52,19 @@ async function resolveProjectPaths() {
52
52
  const aiInstall = new import_extra_typings.Command("install").summary("Install or refresh Convex AI files").description(
53
53
  "Installs the following (or refreshes them if already present):\n - convex/_generated/ai/guidelines.md\n - AGENTS.md (Convex section only)\n - CLAUDE.md (Convex section only)\n - Agent skills (installed to each coding agent's native path, configured via convex.json)"
54
54
  ).allowExcessArguments(false).action(async () => {
55
- const { projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
56
- await (0, import_aiFiles.installAiFiles)({ projectDir, convexDir, aiFilesConfig });
55
+ const { ctx, projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
56
+ const result = await (0, import_aiFiles.installAiFiles)({
57
+ projectDir,
58
+ convexDir,
59
+ aiFilesConfig
60
+ });
61
+ if (result.kind === "error") {
62
+ return await ctx.crash({
63
+ exitCode: 1,
64
+ errorType: "fatal",
65
+ printedMessage: result.message
66
+ });
67
+ }
57
68
  (0, import_log.logMessage)(`${import_chalk.chalkStderr.green("\u2714")} Convex AI files installed.`);
58
69
  });
59
70
  const aiEnable = new import_extra_typings.Command("enable").summary("Enable Convex AI files").description(
@@ -70,8 +81,19 @@ const aiEnable = new import_extra_typings.Command("enable").summary("Enable Conv
70
81
  const aiUpdate = new import_extra_typings.Command("update").summary("Update Convex AI files to the latest version").description(
71
82
  "Updates the following to their latest versions:\n - convex/_generated/ai/guidelines.md\n - AGENTS.md (Convex section only)\n - CLAUDE.md (Convex section only)\n - Agent skills (installed to each coding agent's native path, configured via convex.json)"
72
83
  ).allowExcessArguments(false).action(async () => {
73
- const { projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
74
- await (0, import_aiFiles.installAiFiles)({ projectDir, convexDir, aiFilesConfig });
84
+ const { ctx, projectDir, convexDir, aiFilesConfig } = await resolveProjectPaths();
85
+ const result = await (0, import_aiFiles.installAiFiles)({
86
+ projectDir,
87
+ convexDir,
88
+ aiFilesConfig
89
+ });
90
+ if (result.kind === "error") {
91
+ return await ctx.crash({
92
+ exitCode: 1,
93
+ errorType: "fatal",
94
+ printedMessage: result.message
95
+ });
96
+ }
75
97
  (0, import_log.logMessage)(`${import_chalk.chalkStderr.green("\u2714")} Convex AI files updated.`);
76
98
  });
77
99
  const aiDisable = new import_extra_typings.Command("disable").summary("Disable Convex AI files without removing them").description(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/aiFiles.ts"],
4
- "sourcesContent": ["import path from \"path\";\nimport { Command } from \"@commander-js/extra-typings\";\nimport { chalkStderr } from \"chalk\";\nimport { logMessage } from \"../bundler/log.js\";\nimport { oneoffContext } from \"../bundler/context.js\";\nimport { readProjectConfig } from \"./lib/config.js\";\nimport { functionsDir } from \"./lib/utils/utils.js\";\nimport {\n installAiFiles,\n enableAiFiles,\n disableAiFiles,\n removeAiFiles,\n} from \"./lib/aiFiles/index.js\";\nimport { statusAiFiles } from \"./lib/aiFiles/status.js\";\nimport { writeAiFilesConfig } from \"./lib/config.js\";\n\nasync function resolveProjectPaths() {\n const ctx = await oneoffContext({});\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n const convexDir = path.resolve(functionsDir(configPath, projectConfig));\n const projectDir = path.resolve(path.dirname(configPath));\n const aiFilesConfig = projectConfig.aiFiles;\n return { ctx, projectDir, convexDir, aiFilesConfig, projectConfig };\n}\n\nconst aiInstall = new Command(\"install\")\n .summary(\"Install or refresh Convex AI files\")\n .description(\n \"Installs the following (or refreshes them if already present):\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section only)\\n\" +\n \" - CLAUDE.md (Convex section only)\\n\" +\n \" - Agent skills (installed to each coding agent's native path, configured via convex.json)\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n await installAiFiles({ projectDir, convexDir, aiFilesConfig });\n\n logMessage(`${chalkStderr.green(\"\u2714\")} Convex AI files installed.`);\n });\n\nconst aiEnable = new Command(\"enable\")\n .summary(\"Enable Convex AI files\")\n .description(\n \"Re-enables Convex AI files by writing `aiFiles.enabled: true` to\\n\" +\n \"`convex.json`, then installs or refreshes the managed AI files.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n const newAiFilesConfig = await enableAiFiles({\n projectDir,\n convexDir,\n aiFilesConfig,\n });\n\n await writeAiFilesConfig({ projectDir, aiFiles: newAiFilesConfig });\n });\n\nconst aiUpdate = new Command(\"update\")\n .summary(\"Update Convex AI files to the latest version\")\n .description(\n \"Updates the following to their latest versions:\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section only)\\n\" +\n \" - CLAUDE.md (Convex section only)\\n\" +\n \" - Agent skills (installed to each coding agent's native path, configured via convex.json)\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n await installAiFiles({ projectDir, convexDir, aiFilesConfig });\n\n logMessage(`${chalkStderr.green(\"\u2714\")} Convex AI files updated.`);\n });\n\nconst aiDisable = new Command(\"disable\")\n .summary(\"Disable Convex AI files without removing them\")\n .description(\n \"Writes `aiFiles.enabled: false` to `convex.json` so `npx convex dev`\\n\" +\n \"stops prompting to install AI files and suppresses staleness messages.\\n\\n\" +\n \"Files already installed are left untouched - use `npx convex ai-files remove`\\n\" +\n \"if you also want to delete them.\\n\\n\" +\n \"Run `npx convex ai-files enable` to re-enable at any time.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, aiFilesConfig } = await resolveProjectPaths();\n\n const newAiFilesConfig = disableAiFiles(aiFilesConfig);\n\n await writeAiFilesConfig({\n projectDir,\n aiFiles: newAiFilesConfig,\n });\n\n logMessage(\n `${chalkStderr.green(`\u2714`)} Convex AI files disabled. Run ${chalkStderr.bold(`npx convex ai-files enable`)} to re-enable.`,\n );\n });\n\nconst aiStatus = new Command(\"status\")\n .summary(\"Show the current status of Convex AI files\")\n .description(\n \"Prints whether Convex AI files are enabled, and for each component:\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section)\\n\" +\n \" - CLAUDE.md (if installed by Convex)\\n\" +\n \" - Agent skills\\n\\n\" +\n \"Fetches the latest hashes from version.convex.dev to report whether\\n\" +\n \"each file is up to date. If the network is unavailable the staleness\\n\" +\n \"check is skipped silently.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n await statusAiFiles({ projectDir, convexDir, aiFilesConfig });\n });\n\nconst aiRemove = new Command(\"remove\")\n .summary(\"Remove all Convex AI files from the project\")\n .description(\n \"Removes the following:\\n\" +\n \" - convex/_generated/ai/ directory (guidelines.md, ai-files.state.json)\\n\" +\n \" - Convex sections from AGENTS.md and CLAUDE.md\\n\" +\n \" - Agent skills installed by `npx convex ai-files install`\\n\\n\" +\n \"If removing the managed section leaves AGENTS.md or CLAUDE.md empty, the\\n\" +\n \"empty file is deleted. Otherwise the rest of the file is kept.\\n\\n\" +\n \"Skills installed from other sources are not affected.\\n\\n\" +\n \"Note: after `remove`, `npx convex dev` will suggest reinstalling AI files.\\n\" +\n \"Use `npx convex ai-files disable` to opt out entirely without deleting files.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { ctx, projectDir, convexDir } = await resolveProjectPaths();\n const result = await removeAiFiles({ projectDir, convexDir });\n if (result.kind === \"error\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: result.message,\n });\n }\n });\n\nexport const aiFiles = new Command(\"ai-files\")\n .summary(\"Manage Convex AI files\")\n .description(\n \"Convex AI files help AI coding assistants (Cursor, Claude Code, etc.) understand\\n\" +\n \"Convex patterns and APIs. They are set up during your first `npx convex dev`\\n\" +\n \"and can be managed at any time with the commands below.\",\n )\n .addCommand(aiStatus)\n .addCommand(aiInstall)\n .addCommand(aiEnable)\n .addCommand(aiUpdate)\n .addCommand(aiDisable)\n .addCommand(aiRemove)\n .addHelpCommand(false);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,2BAAwB;AACxB,mBAA4B;AAC5B,iBAA2B;AAC3B,qBAA8B;AAC9B,oBAAkC;AAClC,mBAA6B;AAC7B,qBAKO;AACP,oBAA8B;AAC9B,IAAAA,iBAAmC;AAEnC,eAAe,sBAAsB;AACnC,QAAM,MAAM,UAAM,8BAAc,CAAC,CAAC;AAClC,QAAM,EAAE,YAAY,cAAc,IAAI,UAAM,iCAAkB,GAAG;AACjE,QAAM,YAAY,YAAAC,QAAK,YAAQ,2BAAa,YAAY,aAAa,CAAC;AACtE,QAAM,aAAa,YAAAA,QAAK,QAAQ,YAAAA,QAAK,QAAQ,UAAU,CAAC;AACxD,QAAM,gBAAgB,cAAc;AACpC,SAAO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ACX,CAAC;AAED;AAAA,IACE,GAAG,yBAAY,MAAM,QAAG,CAAC,kCAAkC,yBAAY,KAAK,4BAA4B,CAAC;AAAA,EAC3G;AACF,CAAC;AAEH,MAAM,WAAW,IAAI,6BAAQ,QAAQ,EAClC,QAAQ,4CAA4C,EACpD;AAAA,EACC;AAQF,EACC,qBAAqB,KAAK,EAC1B,OAAO,YAAY;AAClB,QAAM,EAAE,YAAY,WAAW,cAAc,IAC3C,MAAM,oBAAoB;AAE5B,YAAM,6BAAc,EAAE,YAAY,WAAW,cAAc,CAAC;AAC9D,CAAC;AAEH,MAAM,WAAW,IAAI,6BAAQ,QAAQ,EAClC,QAAQ,6CAA6C,EACrD;AAAA,EACC;AASF,EACC,qBAAqB,KAAK,EAC1B,OAAO,YAAY;AAClB,QAAM,EAAE,KAAK,YAAY,UAAU,IAAI,MAAM,oBAAoB;AACjE,QAAM,SAAS,UAAM,8BAAc,EAAE,YAAY,UAAU,CAAC;AAC5D,MAAI,OAAO,SAAS,SAAS;AAC3B,WAAO,MAAM,IAAI,MAAM;AAAA,MACrB,UAAU;AAAA,MACV,WAAW;AAAA,MACX,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,EACH;AACF,CAAC;AAEI,MAAM,UAAU,IAAI,6BAAQ,UAAU,EAC1C,QAAQ,wBAAwB,EAChC;AAAA,EACC;AAGF,EACC,WAAW,QAAQ,EACnB,WAAW,SAAS,EACpB,WAAW,QAAQ,EACnB,WAAW,QAAQ,EACnB,WAAW,SAAS,EACpB,WAAW,QAAQ,EACnB,eAAe,KAAK;",
4
+ "sourcesContent": ["import path from \"path\";\nimport { Command } from \"@commander-js/extra-typings\";\nimport { chalkStderr } from \"chalk\";\nimport { logMessage } from \"../bundler/log.js\";\nimport { oneoffContext } from \"../bundler/context.js\";\nimport { readProjectConfig } from \"./lib/config.js\";\nimport { functionsDir } from \"./lib/utils/utils.js\";\nimport {\n installAiFiles,\n enableAiFiles,\n disableAiFiles,\n removeAiFiles,\n} from \"./lib/aiFiles/index.js\";\nimport { statusAiFiles } from \"./lib/aiFiles/status.js\";\nimport { writeAiFilesConfig } from \"./lib/config.js\";\n\nasync function resolveProjectPaths() {\n const ctx = await oneoffContext({});\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n const convexDir = path.resolve(functionsDir(configPath, projectConfig));\n const projectDir = path.resolve(path.dirname(configPath));\n const aiFilesConfig = projectConfig.aiFiles;\n return { ctx, projectDir, convexDir, aiFilesConfig, projectConfig };\n}\n\nconst aiInstall = new Command(\"install\")\n .summary(\"Install or refresh Convex AI files\")\n .description(\n \"Installs the following (or refreshes them if already present):\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section only)\\n\" +\n \" - CLAUDE.md (Convex section only)\\n\" +\n \" - Agent skills (installed to each coding agent's native path, configured via convex.json)\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { ctx, projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n const result = await installAiFiles({\n projectDir,\n convexDir,\n aiFilesConfig,\n });\n\n if (result.kind === \"error\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: result.message,\n });\n }\n\n logMessage(`${chalkStderr.green(\"\u2714\")} Convex AI files installed.`);\n });\n\nconst aiEnable = new Command(\"enable\")\n .summary(\"Enable Convex AI files\")\n .description(\n \"Re-enables Convex AI files by writing `aiFiles.enabled: true` to\\n\" +\n \"`convex.json`, then installs or refreshes the managed AI files.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n const newAiFilesConfig = await enableAiFiles({\n projectDir,\n convexDir,\n aiFilesConfig,\n });\n\n await writeAiFilesConfig({ projectDir, aiFiles: newAiFilesConfig });\n });\n\nconst aiUpdate = new Command(\"update\")\n .summary(\"Update Convex AI files to the latest version\")\n .description(\n \"Updates the following to their latest versions:\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section only)\\n\" +\n \" - CLAUDE.md (Convex section only)\\n\" +\n \" - Agent skills (installed to each coding agent's native path, configured via convex.json)\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { ctx, projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n const result = await installAiFiles({\n projectDir,\n convexDir,\n aiFilesConfig,\n });\n\n if (result.kind === \"error\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: result.message,\n });\n }\n\n logMessage(`${chalkStderr.green(\"\u2714\")} Convex AI files updated.`);\n });\n\nconst aiDisable = new Command(\"disable\")\n .summary(\"Disable Convex AI files without removing them\")\n .description(\n \"Writes `aiFiles.enabled: false` to `convex.json` so `npx convex dev`\\n\" +\n \"stops prompting to install AI files and suppresses staleness messages.\\n\\n\" +\n \"Files already installed are left untouched - use `npx convex ai-files remove`\\n\" +\n \"if you also want to delete them.\\n\\n\" +\n \"Run `npx convex ai-files enable` to re-enable at any time.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, aiFilesConfig } = await resolveProjectPaths();\n\n const newAiFilesConfig = disableAiFiles(aiFilesConfig);\n\n await writeAiFilesConfig({\n projectDir,\n aiFiles: newAiFilesConfig,\n });\n\n logMessage(\n `${chalkStderr.green(`\u2714`)} Convex AI files disabled. Run ${chalkStderr.bold(`npx convex ai-files enable`)} to re-enable.`,\n );\n });\n\nconst aiStatus = new Command(\"status\")\n .summary(\"Show the current status of Convex AI files\")\n .description(\n \"Prints whether Convex AI files are enabled, and for each component:\\n\" +\n \" - convex/_generated/ai/guidelines.md\\n\" +\n \" - AGENTS.md (Convex section)\\n\" +\n \" - CLAUDE.md (if installed by Convex)\\n\" +\n \" - Agent skills\\n\\n\" +\n \"Fetches the latest hashes from version.convex.dev to report whether\\n\" +\n \"each file is up to date. If the network is unavailable the staleness\\n\" +\n \"check is skipped silently.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { projectDir, convexDir, aiFilesConfig } =\n await resolveProjectPaths();\n\n await statusAiFiles({ projectDir, convexDir, aiFilesConfig });\n });\n\nconst aiRemove = new Command(\"remove\")\n .summary(\"Remove all Convex AI files from the project\")\n .description(\n \"Removes the following:\\n\" +\n \" - convex/_generated/ai/ directory (guidelines.md, ai-files.state.json)\\n\" +\n \" - Convex sections from AGENTS.md and CLAUDE.md\\n\" +\n \" - Agent skills installed by `npx convex ai-files install`\\n\\n\" +\n \"If removing the managed section leaves AGENTS.md or CLAUDE.md empty, the\\n\" +\n \"empty file is deleted. Otherwise the rest of the file is kept.\\n\\n\" +\n \"Skills installed from other sources are not affected.\\n\\n\" +\n \"Note: after `remove`, `npx convex dev` will suggest reinstalling AI files.\\n\" +\n \"Use `npx convex ai-files disable` to opt out entirely without deleting files.\",\n )\n .allowExcessArguments(false)\n .action(async () => {\n const { ctx, projectDir, convexDir } = await resolveProjectPaths();\n const result = await removeAiFiles({ projectDir, convexDir });\n if (result.kind === \"error\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: result.message,\n });\n }\n });\n\nexport const aiFiles = new Command(\"ai-files\")\n .summary(\"Manage Convex AI files\")\n .description(\n \"Convex AI files help AI coding assistants (Cursor, Claude Code, etc.) understand\\n\" +\n \"Convex patterns and APIs. They are set up during your first `npx convex dev`\\n\" +\n \"and can be managed at any time with the commands below.\",\n )\n .addCommand(aiStatus)\n .addCommand(aiInstall)\n .addCommand(aiEnable)\n .addCommand(aiUpdate)\n .addCommand(aiDisable)\n .addCommand(aiRemove)\n .addHelpCommand(false);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,2BAAwB;AACxB,mBAA4B;AAC5B,iBAA2B;AAC3B,qBAA8B;AAC9B,oBAAkC;AAClC,mBAA6B;AAC7B,qBAKO;AACP,oBAA8B;AAC9B,IAAAA,iBAAmC;AAEnC,eAAe,sBAAsB;AAC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C;AAC5D,MAAI,OAAO,SAAS,SAAS;AAC3B,WAAO,MAAM,IAAI,MAAM;AAAA,MACrB,UAAU;AAAA,MACV,WAAW;AAAA,MACX,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,EACH;AACF,CAAC;AAEI,MAAM,UAAU,IAAI,6BAAQ,UAAU,EAC1C,QAAQ,wBAAwB,EAChC;AAAA,EACC;AAGF,EACC,WAAW,QAAQ,EACnB,WAAW,SAAS,EACpB,WAAW,QAAQ,EACnB,WAAW,QAAQ,EACnB,WAAW,SAAS,EACpB,WAAW,QAAQ,EACnB,eAAe,KAAK;",
6
6
  "names": ["import_config", "path"]
7
7
  }
@@ -36,7 +36,6 @@ __export(configure_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(configure_exports);
38
38
  var import_chalk = require("chalk");
39
- var import_account = require("./account.js");
40
39
  var import_log = require("../bundler/log.js");
41
40
  var import_api = require("./lib/api.js");
42
41
  var import_config = require("./lib/config.js");
@@ -221,23 +220,11 @@ async function handleDeploymentWithinProject(ctx, {
221
220
  );
222
221
  return result;
223
222
  }
224
- let accessResult = await (0, import_api.checkAccessToSelectedProject)(
223
+ const accessResult = await (0, import_api.checkAccessToSelectedProject)(
225
224
  ctx,
226
225
  deploymentSelection.targetProject
227
226
  );
228
- while (accessResult.kind === "noAccess") {
229
- const next = cmdOptions.team !== void 0 && cmdOptions.project !== void 0 ? "chooseProject" : await (0, import_account.handleNoAccessToConfiguredProject)(
230
- ctx,
231
- deploymentSelection.targetProject,
232
- cmdOptions.envFile
233
- );
234
- if (next === "retry") {
235
- accessResult = await (0, import_api.checkAccessToSelectedProject)(
236
- ctx,
237
- deploymentSelection.targetProject
238
- );
239
- continue;
240
- }
227
+ if (accessResult.kind === "noAccess") {
241
228
  (0, import_log.logMessage)("You don't have access to the selected project.");
242
229
  const result = await handleChooseProject(
243
230
  ctx,