devflare 1.0.0-next.14 → 1.0.0-next.16

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 (380) hide show
  1. package/LLM.md +9360 -1784
  2. package/README.md +391 -32
  3. package/bin/devflare.js +17 -7
  4. package/dist/account-0w8wdzjv.js +475 -0
  5. package/dist/account-eygq6qx7.js +475 -0
  6. package/dist/account-fw8nafav.js +475 -0
  7. package/dist/account-pzq69nys.js +475 -0
  8. package/dist/account-s66jb15j.js +475 -0
  9. package/dist/api-d6ekexs5.js +25 -0
  10. package/dist/bridge/index.d.ts +1 -1
  11. package/dist/bridge/index.d.ts.map +1 -1
  12. package/dist/bridge/miniflare.d.ts.map +1 -1
  13. package/dist/bridge/protocol.d.ts +1 -1
  14. package/dist/bridge/protocol.d.ts.map +1 -1
  15. package/dist/bridge/proxy.d.ts +0 -4
  16. package/dist/bridge/proxy.d.ts.map +1 -1
  17. package/dist/bridge/serialization.d.ts.map +1 -1
  18. package/dist/bridge/server.d.ts +1 -1
  19. package/dist/bridge/server.d.ts.map +1 -1
  20. package/dist/browser-shim/handler.d.ts +1 -1
  21. package/dist/browser-shim/handler.d.ts.map +1 -1
  22. package/dist/browser.d.ts +1651 -34
  23. package/dist/browser.d.ts.map +1 -1
  24. package/dist/build-1kmkwqgh.js +53 -0
  25. package/dist/build-506kjhcm.js +53 -0
  26. package/dist/build-66866ahs.js +53 -0
  27. package/dist/build-g1adm3ww.js +53 -0
  28. package/dist/build-p3r3117t.js +53 -0
  29. package/dist/bundler/do-bundler.d.ts.map +1 -1
  30. package/dist/bundler/rolldown-shared.d.ts +24 -0
  31. package/dist/bundler/rolldown-shared.d.ts.map +1 -0
  32. package/dist/bundler/worker-bundler.d.ts +0 -1
  33. package/dist/bundler/worker-bundler.d.ts.map +1 -1
  34. package/dist/cli/command-utils.d.ts +18 -0
  35. package/dist/cli/command-utils.d.ts.map +1 -0
  36. package/dist/cli/commands/account.d.ts +1 -1
  37. package/dist/cli/commands/account.d.ts.map +1 -1
  38. package/dist/cli/commands/build-artifacts.d.ts +27 -0
  39. package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
  40. package/dist/cli/commands/build.d.ts.map +1 -1
  41. package/dist/cli/commands/config.d.ts +4 -0
  42. package/dist/cli/commands/config.d.ts.map +1 -0
  43. package/dist/cli/commands/deploy.d.ts.map +1 -1
  44. package/dist/cli/commands/dev.d.ts.map +1 -1
  45. package/dist/cli/commands/doctor.d.ts.map +1 -1
  46. package/dist/cli/commands/init.d.ts.map +1 -1
  47. package/dist/cli/commands/login.d.ts +4 -0
  48. package/dist/cli/commands/login.d.ts.map +1 -0
  49. package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
  50. package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
  51. package/dist/cli/commands/previews-support/family.d.ts +10 -0
  52. package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
  53. package/dist/cli/commands/previews-support/render.d.ts +8 -0
  54. package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
  55. package/dist/cli/commands/previews-support/theme.d.ts +10 -0
  56. package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
  57. package/dist/cli/commands/previews-support/types.d.ts +70 -0
  58. package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
  59. package/dist/cli/commands/previews.d.ts +4 -0
  60. package/dist/cli/commands/previews.d.ts.map +1 -0
  61. package/dist/cli/commands/productions.d.ts +4 -0
  62. package/dist/cli/commands/productions.d.ts.map +1 -0
  63. package/dist/cli/commands/token.d.ts +4 -0
  64. package/dist/cli/commands/token.d.ts.map +1 -0
  65. package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
  66. package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
  67. package/dist/cli/commands/type-generation/generator.d.ts +44 -0
  68. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
  69. package/dist/cli/commands/type-generation/models.d.ts +27 -0
  70. package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
  71. package/dist/cli/commands/types.d.ts.map +1 -1
  72. package/dist/cli/commands/worker.d.ts +4 -0
  73. package/dist/cli/commands/worker.d.ts.map +1 -0
  74. package/dist/cli/config-path.d.ts +2 -1
  75. package/dist/cli/config-path.d.ts.map +1 -1
  76. package/dist/cli/deploy-strategy.d.ts +17 -0
  77. package/dist/cli/deploy-strategy.d.ts.map +1 -0
  78. package/dist/cli/deploy-target.d.ts +17 -0
  79. package/dist/cli/deploy-target.d.ts.map +1 -0
  80. package/dist/cli/generated-artifacts.d.ts +12 -0
  81. package/dist/cli/generated-artifacts.d.ts.map +1 -0
  82. package/dist/cli/help-pages/pages/account.d.ts +3 -0
  83. package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
  84. package/dist/cli/help-pages/pages/core.d.ts +4 -0
  85. package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
  86. package/dist/cli/help-pages/pages/index.d.ts +3 -0
  87. package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
  88. package/dist/cli/help-pages/pages/misc.d.ts +3 -0
  89. package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
  90. package/dist/cli/help-pages/pages/previews.d.ts +3 -0
  91. package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
  92. package/dist/cli/help-pages/pages/productions.d.ts +3 -0
  93. package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
  94. package/dist/cli/help-pages/render.d.ts +12 -0
  95. package/dist/cli/help-pages/render.d.ts.map +1 -0
  96. package/dist/cli/help-pages/shared.d.ts +15 -0
  97. package/dist/cli/help-pages/shared.d.ts.map +1 -0
  98. package/dist/cli/help-pages/types.d.ts +23 -0
  99. package/dist/cli/help-pages/types.d.ts.map +1 -0
  100. package/dist/cli/help.d.ts +6 -0
  101. package/dist/cli/help.d.ts.map +1 -0
  102. package/dist/cli/index.d.ts +1 -0
  103. package/dist/cli/index.d.ts.map +1 -1
  104. package/dist/cli/preview-bindings.d.ts +42 -0
  105. package/dist/cli/preview-bindings.d.ts.map +1 -0
  106. package/dist/cli/preview.d.ts +11 -0
  107. package/dist/cli/preview.d.ts.map +1 -0
  108. package/dist/cli/ui.d.ts +37 -0
  109. package/dist/cli/ui.d.ts.map +1 -0
  110. package/dist/cli/workspace-build-guard.d.ts +14 -0
  111. package/dist/cli/workspace-build-guard.d.ts.map +1 -0
  112. package/dist/cloudflare/account-core.d.ts +6 -0
  113. package/dist/cloudflare/account-core.d.ts.map +1 -0
  114. package/dist/cloudflare/account-resources.d.ts +40 -0
  115. package/dist/cloudflare/account-resources.d.ts.map +1 -0
  116. package/dist/cloudflare/account-status.d.ts +11 -0
  117. package/dist/cloudflare/account-status.d.ts.map +1 -0
  118. package/dist/cloudflare/account-workers.d.ts +14 -0
  119. package/dist/cloudflare/account-workers.d.ts.map +1 -0
  120. package/dist/cloudflare/account.d.ts +7 -64
  121. package/dist/cloudflare/account.d.ts.map +1 -1
  122. package/dist/cloudflare/api.d.ts +4 -0
  123. package/dist/cloudflare/api.d.ts.map +1 -1
  124. package/dist/cloudflare/index.d.ts +57 -2
  125. package/dist/cloudflare/index.d.ts.map +1 -1
  126. package/dist/cloudflare/kv-namespace.d.ts +3 -0
  127. package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
  128. package/dist/cloudflare/preferences.d.ts.map +1 -1
  129. package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
  130. package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
  131. package/dist/cloudflare/preview-registry-records.d.ts +61 -0
  132. package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
  133. package/dist/cloudflare/preview-registry-store.d.ts +14 -0
  134. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
  135. package/dist/cloudflare/preview-registry-types.d.ts +103 -0
  136. package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
  137. package/dist/cloudflare/preview-registry.d.ts +42 -0
  138. package/dist/cloudflare/preview-registry.d.ts.map +1 -0
  139. package/dist/cloudflare/registry-schema.d.ts +253 -0
  140. package/dist/cloudflare/registry-schema.d.ts.map +1 -0
  141. package/dist/cloudflare/tokens.d.ts +18 -0
  142. package/dist/cloudflare/tokens.d.ts.map +1 -0
  143. package/dist/cloudflare/types.d.ts +122 -5
  144. package/dist/cloudflare/types.d.ts.map +1 -1
  145. package/dist/cloudflare/usage.d.ts.map +1 -1
  146. package/dist/config/compiler.d.ts +4 -0
  147. package/dist/config/compiler.d.ts.map +1 -1
  148. package/dist/config/framework-providers.d.ts +9 -0
  149. package/dist/config/framework-providers.d.ts.map +1 -0
  150. package/dist/config/index.d.ts +5 -3
  151. package/dist/config/index.d.ts.map +1 -1
  152. package/dist/config/loader.d.ts +1 -0
  153. package/dist/config/loader.d.ts.map +1 -1
  154. package/dist/config/preview-resources.d.ts +77 -0
  155. package/dist/config/preview-resources.d.ts.map +1 -0
  156. package/dist/config/preview.d.ts +31 -0
  157. package/dist/config/preview.d.ts.map +1 -0
  158. package/dist/config/ref.d.ts +0 -22
  159. package/dist/config/ref.d.ts.map +1 -1
  160. package/dist/config/resolve.d.ts +1 -0
  161. package/dist/config/resolve.d.ts.map +1 -1
  162. package/dist/config/resource-resolution.d.ts +60 -0
  163. package/dist/config/resource-resolution.d.ts.map +1 -0
  164. package/dist/config/schema-bindings.d.ts +693 -0
  165. package/dist/config/schema-bindings.d.ts.map +1 -0
  166. package/dist/config/schema-build.d.ts +67 -0
  167. package/dist/config/schema-build.d.ts.map +1 -0
  168. package/dist/config/schema-env.d.ts +1341 -0
  169. package/dist/config/schema-env.d.ts.map +1 -0
  170. package/dist/config/schema-normalization.d.ts +64 -0
  171. package/dist/config/schema-normalization.d.ts.map +1 -0
  172. package/dist/config/schema-runtime.d.ts +230 -0
  173. package/dist/config/schema-runtime.d.ts.map +1 -0
  174. package/dist/config/schema.d.ts +640 -3669
  175. package/dist/config/schema.d.ts.map +1 -1
  176. package/dist/config-entry.d.ts +5 -0
  177. package/dist/config-entry.d.ts.map +1 -0
  178. package/dist/config-fjwke42y.js +59 -0
  179. package/dist/config-hwdqjse7.js +59 -0
  180. package/dist/config-pxvewrhv.js +59 -0
  181. package/dist/config-q0g5qdga.js +59 -0
  182. package/dist/decorators/durable-object.d.ts.map +1 -1
  183. package/dist/deploy-7nmzc9r8.js +609 -0
  184. package/dist/deploy-csfhdr64.js +691 -0
  185. package/dist/deploy-ex4g5avz.js +621 -0
  186. package/dist/deploy-jnb0bhka.js +609 -0
  187. package/dist/deploy-tp0g6qdp.js +609 -0
  188. package/dist/deploy-ykpcjkc2.js +690 -0
  189. package/dist/{dev-c1xc1gq9.js → dev-2pd33m28.js} +392 -348
  190. package/dist/dev-7ef5e2j1.js +2409 -0
  191. package/dist/dev-8nssqatr.js +2409 -0
  192. package/dist/dev-grznx8fn.js +2409 -0
  193. package/dist/dev-server/d1-migrations.d.ts +14 -0
  194. package/dist/dev-server/d1-migrations.d.ts.map +1 -0
  195. package/dist/dev-server/gateway-script.d.ts +8 -0
  196. package/dist/dev-server/gateway-script.d.ts.map +1 -0
  197. package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
  198. package/dist/dev-server/server.d.ts.map +1 -1
  199. package/dist/dev-server/vite-process.d.ts +14 -0
  200. package/dist/dev-server/vite-process.d.ts.map +1 -0
  201. package/dist/dev-server/vite-utils.d.ts +1 -1
  202. package/dist/dev-server/vite-utils.d.ts.map +1 -1
  203. package/dist/dev-server/worker-source-watcher.d.ts +11 -0
  204. package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
  205. package/dist/dev-server/worker-surface-paths.d.ts +6 -0
  206. package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
  207. package/dist/{doctor-z4ffybce.js → doctor-04ammrrh.js} +67 -31
  208. package/dist/doctor-fmjj65mc.js +245 -0
  209. package/dist/doctor-fzkznce1.js +245 -0
  210. package/dist/doctor-sa5xv1bz.js +245 -0
  211. package/dist/index-091sh1ma.js +1229 -0
  212. package/dist/index-0apbm26n.js +788 -0
  213. package/dist/index-0eqksag4.js +418 -0
  214. package/dist/{index-dr6sbp8d.js → index-0kfzdywd.js} +15 -2
  215. package/dist/index-0w826dsr.js +379 -0
  216. package/dist/{index-rfhx0yd5.js → index-11m5a8wd.js} +110 -32
  217. package/dist/{index-xxwbb2nt.js → index-1sp39f2f.js} +114 -58
  218. package/dist/index-2jnrqbny.js +1301 -0
  219. package/dist/index-2pb7b9mw.js +378 -0
  220. package/dist/{index-0kzg8wed.js → index-2x53aqjm.js} +1071 -890
  221. package/dist/index-3ke5d2vn.js +1229 -0
  222. package/dist/index-43dq8yx8.js +788 -0
  223. package/dist/index-4rrttqj5.js +378 -0
  224. package/dist/index-4v9bc2pc.js +1367 -0
  225. package/dist/index-61jsjnsv.js +280 -0
  226. package/dist/index-6jef5emv.js +176 -0
  227. package/dist/index-6psz1h4c.js +788 -0
  228. package/dist/index-72mve6vh.js +168 -0
  229. package/dist/{index-zbvmtcn2.js → index-74198nxd.js} +179 -77
  230. package/dist/index-7g8zyws4.js +192 -0
  231. package/dist/index-7kcxjhta.js +456 -0
  232. package/dist/index-7v583xan.js +418 -0
  233. package/dist/index-7x0ybbtx.js +133 -0
  234. package/dist/index-816krz9p.js +52 -0
  235. package/dist/index-82f1z98k.js +41 -0
  236. package/dist/index-8t5nb4qx.js +133 -0
  237. package/dist/index-9az6s7ad.js +52 -0
  238. package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
  239. package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
  240. package/dist/index-9n6djthj.js +490 -0
  241. package/dist/index-aabgympv.js +39 -0
  242. package/dist/index-b8m6883k.js +74 -0
  243. package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
  244. package/dist/index-d8etnfef.js +1229 -0
  245. package/dist/index-e9yw4d6y.js +133 -0
  246. package/dist/index-epw1jxz5.js +1204 -0
  247. package/dist/index-f85s8gj3.js +2649 -0
  248. package/dist/index-fe2ngvh7.js +1229 -0
  249. package/dist/index-fvsadj32.js +192 -0
  250. package/dist/index-gs4y9gdf.js +456 -0
  251. package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
  252. package/dist/index-hfj1a2c4.js +2649 -0
  253. package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
  254. package/dist/index-htzf0py1.js +1204 -0
  255. package/dist/index-j185x270.js +897 -0
  256. package/dist/index-jb75kwa4.js +519 -0
  257. package/dist/index-jwd8pcb2.js +897 -0
  258. package/dist/index-k29yjhv0.js +52 -0
  259. package/dist/index-k6vq6kkt.js +456 -0
  260. package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
  261. package/dist/index-maxpsfk8.js +402 -0
  262. package/dist/index-mbdmrner.js +402 -0
  263. package/dist/index-mea5bc45.js +418 -0
  264. package/dist/index-mqekt778.js +185 -0
  265. package/dist/index-na3mnm1k.js +74 -0
  266. package/dist/index-p03n4qet.js +1367 -0
  267. package/dist/index-p296ban8.js +191 -0
  268. package/dist/index-pnbs1b8k.js +280 -0
  269. package/dist/index-q4kaz181.js +1207 -0
  270. package/dist/index-ry131z23.js +378 -0
  271. package/dist/index-sgb7c8nm.js +402 -0
  272. package/dist/index-sqrksgb2.js +133 -0
  273. package/dist/index-stgn34cr.js +148 -0
  274. package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
  275. package/dist/index-thna1tkd.js +280 -0
  276. package/dist/index-v5nmqthy.js +74 -0
  277. package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
  278. package/dist/index-wyq6c6yj.js +402 -0
  279. package/dist/index-wztc9stx.js +418 -0
  280. package/dist/index-x9cwdxw5.js +456 -0
  281. package/dist/index-xk9djfjp.js +519 -0
  282. package/dist/index-yc0gcchc.js +418 -0
  283. package/dist/index-yqbxjysa.js +897 -0
  284. package/dist/index-yzddwp02.js +788 -0
  285. package/dist/index-zfhq6s96.js +74 -0
  286. package/dist/index-zt22fe2j.js +54 -0
  287. package/dist/index-zyt5byt6.js +2649 -0
  288. package/dist/index.d.ts +2 -2
  289. package/dist/index.d.ts.map +1 -1
  290. package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
  291. package/dist/login-2hnz4m4n.js +77 -0
  292. package/dist/login-5bsxxpvc.js +77 -0
  293. package/dist/login-6tzvczw2.js +77 -0
  294. package/dist/login-bhaw72zc.js +77 -0
  295. package/dist/login-x8tgckqm.js +77 -0
  296. package/dist/previews-3rn8mz2c.js +1168 -0
  297. package/dist/previews-d487qde5.js +1200 -0
  298. package/dist/previews-gm3z0syj.js +1168 -0
  299. package/dist/previews-j9ymq4ys.js +1169 -0
  300. package/dist/previews-q031mx34.js +1168 -0
  301. package/dist/productions-120xg0aq.js +505 -0
  302. package/dist/productions-5ev5qweg.js +505 -0
  303. package/dist/productions-me3tdvr9.js +505 -0
  304. package/dist/productions-p5rbgp2f.js +505 -0
  305. package/dist/productions-x9p0pym1.js +505 -0
  306. package/dist/runtime/context-events.d.ts +13 -0
  307. package/dist/runtime/context-events.d.ts.map +1 -0
  308. package/dist/runtime/context-types.d.ts +82 -0
  309. package/dist/runtime/context-types.d.ts.map +1 -0
  310. package/dist/runtime/context.d.ts +6 -267
  311. package/dist/runtime/context.d.ts.map +1 -1
  312. package/dist/runtime/exports.d.ts +3 -3
  313. package/dist/runtime/index.d.ts +1 -1
  314. package/dist/runtime/index.d.ts.map +1 -1
  315. package/dist/runtime/middleware.d.ts +8 -38
  316. package/dist/runtime/middleware.d.ts.map +1 -1
  317. package/dist/src/browser.js +23 -14
  318. package/dist/src/cli/index.js +3 -1
  319. package/dist/src/cloudflare/index.js +49 -2
  320. package/dist/src/config-entry.js +14 -0
  321. package/dist/src/index.js +33 -20
  322. package/dist/src/runtime/index.js +3 -9
  323. package/dist/src/sveltekit/index.js +10 -7
  324. package/dist/src/test/index.js +16 -18
  325. package/dist/src/vite/index.js +7 -4
  326. package/dist/sveltekit/platform.d.ts +1 -1
  327. package/dist/sveltekit/platform.d.ts.map +1 -1
  328. package/dist/test/cf.d.ts +10 -10
  329. package/dist/test/email.d.ts.map +1 -1
  330. package/dist/test/index.d.ts +1 -6
  331. package/dist/test/index.d.ts.map +1 -1
  332. package/dist/test/queue.d.ts.map +1 -1
  333. package/dist/test/remote-ai.d.ts.map +1 -1
  334. package/dist/test/remote-cloudflare.d.ts +13 -0
  335. package/dist/test/remote-cloudflare.d.ts.map +1 -0
  336. package/dist/test/remote-vectorize.d.ts.map +1 -1
  337. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  338. package/dist/test/scheduled.d.ts.map +1 -1
  339. package/dist/test/should-skip.d.ts +0 -18
  340. package/dist/test/should-skip.d.ts.map +1 -1
  341. package/dist/test/simple-context-durable-objects.d.ts +6 -0
  342. package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
  343. package/dist/test/simple-context-gateway-script.d.ts +2 -0
  344. package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
  345. package/dist/test/simple-context-paths.d.ts +40 -0
  346. package/dist/test/simple-context-paths.d.ts.map +1 -0
  347. package/dist/test/simple-context.d.ts +1 -23
  348. package/dist/test/simple-context.d.ts.map +1 -1
  349. package/dist/test/tail.d.ts.map +1 -1
  350. package/dist/test/worker.d.ts.map +1 -1
  351. package/dist/token-kedhcret.js +419 -0
  352. package/dist/token-m8jmnjwk.js +419 -0
  353. package/dist/{types-sffr9681.js → types-0sqwkp7x.js} +244 -139
  354. package/dist/types-1gwr2ex6.js +572 -0
  355. package/dist/types-6e5yx6km.js +572 -0
  356. package/dist/types-p0gckpn6.js +572 -0
  357. package/dist/utils/send-email.d.ts.map +1 -1
  358. package/dist/vite/config-file.d.ts.map +1 -1
  359. package/dist/vite/plugin.d.ts.map +1 -1
  360. package/dist/worker-0srh2jfr.js +513 -0
  361. package/dist/worker-4xrfd10a.js +513 -0
  362. package/dist/worker-entry/composed-worker.d.ts +0 -7
  363. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  364. package/dist/worker-entry/surface-paths.d.ts +15 -0
  365. package/dist/worker-entry/surface-paths.d.ts.map +1 -0
  366. package/dist/worker-qtam8grz.js +513 -0
  367. package/dist/worker-qzm0b7br.js +513 -0
  368. package/dist/worker-y9ha6g44.js +513 -0
  369. package/package.json +17 -10
  370. package/R2.md +0 -200
  371. package/dist/account-8psavtg6.js +0 -420
  372. package/dist/build-n639efmn.js +0 -101
  373. package/dist/deploy-zvnq6xh7.js +0 -117
  374. package/dist/index-2q3pmzrx.js +0 -90
  375. package/dist/index-f4q0jbnj.js +0 -195
  376. package/dist/index-n7rs26ft.js +0 -77
  377. package/dist/index-tfyxa77h.js +0 -850
  378. package/dist/index-wyf3s77s.js +0 -343
  379. package/dist/test/multi-worker-context.d.ts +0 -114
  380. package/dist/test/multi-worker-context.d.ts.map +0 -1
package/README.md CHANGED
@@ -22,20 +22,30 @@ For the deeper public contract, caveats, and current feature boundaries, see [`L
22
22
 
23
23
  ---
24
24
 
25
- ## Install
25
+ ## Monorepo contributor workflow
26
26
 
27
- For a worker-only project, Devflare works fine with just the Worker toolchain:
27
+ When you are working on `packages/devflare` inside this monorepo, use the repo-root Turbo scripts instead of assembling ad-hoc commands by hand:
28
28
 
29
- ```bash
30
- bun add -d devflare wrangler @cloudflare/workers-types
31
- ```
29
+ - `bun run devflare:dev`
30
+ - `bun run devflare:test:watch`
31
+ - `bun run devflare:build`
32
+ - `bun run devflare:typecheck`
33
+ - `bun run devflare:test`
34
+ - `bun run devflare:types`
35
+ - `bun run devflare:check`
36
+ - `bun run devflare:ci`
32
37
 
33
- If the current package also uses Vite, add Vite and the Cloudflare Vite plugin too:
38
+ These scripts intentionally keep the default shared lane focused on the parts of the workspace that are currently stable in local development and CI. In particular, the shared test lane excludes `@devflare/case5-multi-worker`, and the shared check lane stays centered on `apps/documentation` because `cases/case18` still expects Cloudflare-backed resource resolution outside the default contributor workflow.
39
+
40
+ ---
41
+
42
+ ## Install
43
+
44
+ For a worker-only project, the smallest install is just Devflare:
34
45
 
35
46
  ```bash
36
- bun add -d devflare wrangler @cloudflare/workers-types vite @cloudflare/vite-plugin
47
+ bun add -d devflare vite @cloudflare/vite-plugin
37
48
  ```
38
-
39
49
  A local `vite.config.*` opts that package into Vite-backed flows. Without one, Devflare stays in worker-only mode.
40
50
 
41
51
  ---
@@ -46,7 +56,7 @@ A local `vite.config.*` opts that package into Vite-backed flows. Without one, D
46
56
 
47
57
  ```ts
48
58
  // devflare.config.ts
49
- import { defineConfig } from 'devflare'
59
+ import { defineConfig } from 'devflare/config'
50
60
 
51
61
  export default defineConfig({
52
62
  name: 'hello-worker',
@@ -57,30 +67,22 @@ export default defineConfig({
57
67
  })
58
68
  ```
59
69
 
70
+ Use `devflare/config` for config files so Bun only loads the lightweight config helpers instead of the full Node-side Devflare barrel.
71
+
60
72
  ### 2. Add a fetch handler
61
73
 
62
74
  ```ts
63
75
  // src/fetch.ts
64
76
  import type { FetchEvent } from 'devflare/runtime'
65
77
 
66
- export async function fetch({ request }: FetchEvent): Promise<Response> {
67
- const url = new URL(request.url)
78
+ export async function fetch({ url }: FetchEvent): Promise<Response> {
68
79
  return new Response(
69
- url.pathname === '/'
70
- ? 'Hello from Devflare'
71
80
  : `Hello from Devflare: ${url.pathname}`
72
81
  )
73
82
  }
74
83
  ```
75
84
 
76
85
  ### 3. Generate types
77
-
78
- ```bash
79
- bunx --bun devflare types
80
- ```
81
-
82
- This generates `env.d.ts` so bindings, secrets, and discovered entrypoints stay typed.
83
-
84
86
  ### 4. Start development
85
87
 
86
88
  ```bash
@@ -193,8 +195,8 @@ async function corsHandle(event: FetchEvent, resolve: ResolveFetch): Promise<Res
193
195
  return next
194
196
  }
195
197
 
196
- async function appFetch({ request }: FetchEvent): Promise<Response> {
197
- return Response.json({ path: new URL(request.url).pathname })
198
+ async function appFetch({ url }: FetchEvent): Promise<Response> {
199
+ return Response.json({ path: url.pathname })
198
200
  }
199
201
 
200
202
  export const handle = sequence(corsHandle, appFetch)
@@ -299,6 +301,7 @@ The most important top-level keys are:
299
301
  - `accountId`
300
302
  - `compatibilityDate`
301
303
  - `compatibilityFlags`
304
+ - `previews`
302
305
  - `files`
303
306
  - `bindings`
304
307
  - `triggers`
@@ -322,13 +325,14 @@ Keep these separate:
322
325
  - `vars` are **string-valued config bindings** that compile into generated Wrangler config
323
326
  - `secrets` are **declarations of expected runtime secret bindings**
324
327
 
325
- `loadConfig()` does **not** do dotenv loading by itself.
328
+ `loadConfig()` loads the nearest workspace-root `.env` before evaluating `devflare.config.*`.
326
329
 
327
- When you run the CLI under Bun, Bun may already have loaded `.env` values into `process.env` before your config executes.
330
+ When Devflare finds an ancestor `package.json` with `workspaces`, it uses that directory's `.env` file as the shared config-time source for nested packages. If no workspace root is found, it falls back to the nearest ancestor `.env`. Explicit process env values still win over `.env` entries.
328
331
 
329
332
  Important boundary:
330
333
 
331
- - `.env*` files are config/build-time inputs only insofar as the surrounding host tool has already populated `process.env`
334
+ - `.env` is treated as a config/build-time input for `devflare.config.*` evaluation
335
+ - Devflare does **not** currently provide first-class semantics for `.env.dev` or `.env.<name>`
332
336
  - Devflare does **not** currently provide a first-class `.dev.vars*` loader for worker-only dev mode or `createTestContext()`
333
337
  - example files like `.env.example` and `.dev.vars.example` are a team convention, not a Devflare feature
334
338
 
@@ -336,6 +340,7 @@ Practical convention:
336
340
 
337
341
  - use `.env.example` for config-time/build-time variables read from `process.env`
338
342
  - use `.dev.vars.example` only if your project intentionally relies on upstream `.dev.vars` local-runtime workflows
343
+ - keep non-secret infrastructure names such as R2 bucket names and D1 database names in `devflare.config.*`, not in `secrets` or ad-hoc CI env vars
339
344
 
340
345
  ### `config.env`
341
346
 
@@ -343,6 +348,72 @@ Practical convention:
343
348
 
344
349
  When you select `--env name`, Devflare merges `config.env[name]` into the base config before compiling.
345
350
 
351
+ ### D1 by name and resolved config reuse
352
+
353
+ `bindings.d1` accepts three shapes:
354
+
355
+ - `'database-name'`
356
+ - `{ id: 'database-id' }`
357
+ - `{ name: 'database-name' }`
358
+
359
+ String shorthand is the stable-name form, so `'database-name'` is equivalent to `{ name: 'database-name' }`.
360
+
361
+ Use string shorthand or `{ name }` when you want `devflare.config.*` to stay the source of truth for stable D1 naming.
362
+
363
+ - local dev and tests normalize string and `{ name }` bindings into a stable local identifier, so you do **not** need Cloudflare auth just to run locally
364
+ - `build`, `deploy`, `devflare/vite`, and `devflare config print` resolve string and `{ name }` bindings into a real Cloudflare D1 database id before they emit Wrangler-facing config
365
+ - `compileConfig()` can only emit Wrangler `d1_databases` from concrete ids, so Node-side automation should call `loadResolvedConfig()` or `resolveConfigResources()` first
366
+
367
+ That means stable names stay in config, while opaque Cloudflare ids are resolved only for the flows that actually need them.
368
+
369
+ If you want to inspect or reuse those resolved values in automation, use either:
370
+
371
+ - `bunx --bun devflare config print --json`
372
+ - `bunx --bun devflare config print --json --format wrangler`
373
+ - `loadResolvedConfig()` from Node-side tooling
374
+
375
+ ```ts
376
+ import { loadResolvedConfig } from 'devflare'
377
+
378
+ const config = await loadResolvedConfig({
379
+ cwd: process.cwd(),
380
+ environment: 'production'
381
+ })
382
+
383
+ console.log(config.bindings?.r2?.ASSETS)
384
+ console.log(config.bindings?.d1?.DB)
385
+ ```
386
+
387
+ If you need Cloudflare account/resource data while computing config, use an async config with `devflare/cloudflare` helpers:
388
+
389
+ ```ts
390
+ import { defineConfig } from 'devflare/config'
391
+ import { account } from 'devflare/cloudflare'
392
+
393
+ export default defineConfig(async () => {
394
+ const primary = await account.getPrimaryAccount()
395
+ const buckets = await account.r2(primary.id)
396
+
397
+ if (!buckets.some((bucket) => bucket.name === 'app-assets')) {
398
+ throw new Error('Missing R2 bucket "app-assets" in the selected Cloudflare account')
399
+ }
400
+
401
+ return {
402
+ accountId: primary.id,
403
+ name: 'app-worker',
404
+ compatibilityDate: '2026-03-17',
405
+ bindings: {
406
+ d1: {
407
+ DB: { name: 'app-db' }
408
+ },
409
+ r2: {
410
+ ASSETS: 'app-assets'
411
+ }
412
+ }
413
+ }
414
+ })
415
+ ```
416
+
346
417
  ### Native config vs Wrangler coverage
347
418
 
348
419
  Devflare natively models the Worker config it actively composes around:
@@ -404,10 +475,33 @@ Devflare natively models:
404
475
  - KV, D1, R2, Durable Objects, queues, and the core test/runtime flow are the strongest surfaces
405
476
  - AI and Vectorize are remote-oriented bindings
406
477
  - named service entrypoints are modeled at the Devflare layer, but validate generated deployment output if they are critical to your app
478
+ - browser bindings use a named-map authoring shape such as `browser: { BROWSER: 'browser' }`, but current compile/deploy flows allow exactly one browser binding because Wrangler only supports one
407
479
  - `sendEmail` is modeled through config compilation, generated env types, and local runtime/test flows
408
480
  - R2 bindings are real in local dev/test/runtime flows, but Devflare does **not** publish a stable browser-facing local bucket URL contract; browser-visible local asset flows should go through your Worker routes
409
481
 
410
- For R2 delivery strategy guidance, see [`R2.md`](./R2.md).
482
+ For R2 delivery strategy guidance, use the `R2 uploads & delivery` page in the documentation site.
483
+
484
+ For D1 and Hyperdrive, prefer stable config names when you can:
485
+
486
+ ```ts
487
+ export default {
488
+ bindings: {
489
+ d1: {
490
+ DB: { name: 'app-db' },
491
+ AUDIT: { id: 'existing-d1-id' }
492
+ },
493
+ hyperdrive: {
494
+ DB: 'app-postgres',
495
+ ANALYTICS_DB: { id: 'existing-hyperdrive-id' }
496
+ },
497
+ r2: {
498
+ ASSETS: 'app-assets'
499
+ }
500
+ }
501
+ }
502
+ ```
503
+
504
+ Use `.env*` and `secrets` for values that are actually secret or genuinely process-specific. Do **not** move stable bucket/database/Hyperdrive names into env vars just to make other tooling happy.
411
505
 
412
506
  ---
413
507
 
@@ -444,7 +538,226 @@ Short version:
444
538
  - in worker-only mode, Devflare now bundles the composed main worker to `.devflare/worker-entrypoints/main.js` via Rolldown before handing it to Miniflare or Wrangler
445
539
  - Rolldown still rebuilds Durable Object worker code in unified Vite dev flows where Vite hosts the outer app
446
540
 
447
- For the full contract-level explanation and a concrete Rolldown + Svelte example, see [`LLM.md`](./LLM.md).
541
+ For the full contract-level explanation and a concrete Rolldown + Svelte example, see the generated [`LLM.md`](./LLM.md) handbook entries for workflow modes and Svelte in workers.
542
+
543
+ ---
544
+
545
+ ## Deploys, previews, tokens, and GitHub Actions
546
+
547
+ ### Production deploys vs same-Worker previews
548
+
549
+ `devflare deploy` publishes production the usual Wrangler way.
550
+
551
+ `devflare deploy --preview` is different: it uploads a **new version of the same Worker** with `wrangler versions upload` instead of creating a separate Worker environment.
552
+
553
+ Named preview deploys are now the primary preview model:
554
+
555
+ - each preview scope deploys its own dedicated Worker (or Worker family)
556
+ - preview-scoped bindings and resources can be assigned only to that scope
557
+ - feature branches and PRs get stable preview URLs from the scope name itself
558
+
559
+ Preview scope names should still be lowercase and dash-friendly so they map cleanly into Worker names and `workers.dev` URLs.
560
+
561
+ Useful preview examples:
562
+
563
+ ```bash
564
+ bunx --bun devflare deploy --preview next
565
+ bunx --bun devflare deploy --preview pr-42
566
+ ```
567
+
568
+ When available, Devflare prints the Worker version id and preview URL outputs after the deploy finishes.
569
+
570
+ ### Login and preview scope helpers
571
+
572
+ `devflare login` is the thin authentication wrapper for Cloudflare.
573
+
574
+ - by default it reuses existing auth when Devflare can already resolve a Cloudflare API token
575
+ - `devflare login --force` opens `wrangler login` again even when auth is already present
576
+ - after login, Devflare prints the primary account when Cloudflare account discovery succeeds
577
+
578
+ `devflare previews` is the config-aware preview-scope surface for dedicated preview Workers.
579
+
580
+ Useful commands:
581
+
582
+ ```bash
583
+ bunx --bun devflare previews
584
+ bunx --bun devflare previews bindings --scope next
585
+ bunx --bun devflare previews cleanup --scope next --apply
586
+ bunx --bun devflare previews cleanup --all --apply
587
+ ```
588
+
589
+ Current behavior:
590
+
591
+ - `devflare previews` lists stable workers plus discovered dedicated preview scopes for the current worker family using live Cloudflare Worker names
592
+ - `devflare previews bindings` resolves preview-scoped resources for one scope and shows how many deployed workers reference them
593
+ - `devflare previews cleanup` deletes dedicated preview Workers plus preview-scoped KV, D1, R2, Queue, Vectorize, and reusable Hyperdrive resources for one scope or every discovered scope; it is a dry run unless `--apply` is present
594
+ - `devflare deploy` still performs best-effort internal preview metadata synchronization after successful deploys so cleanup flows can remove deleted preview workers cleanly without extra CI glue
595
+
596
+ ### Manage Devflare tokens
597
+
598
+ `devflare tokens <bootstrap-token>` manages Devflare-owned account API tokens using a bootstrap token that already has Cloudflare API-token-management permission.
599
+
600
+ The command:
601
+
602
+ - resolves the effective account id from `--account`, workspace preference, or the bootstrap token's primary account
603
+ - normalizes managed token names to the `devflare-` prefix, so `preview` becomes `devflare-preview` while `devflare-preview` stays unchanged
604
+ - `--new [token-name]` prompts for a token name when it is omitted, then creates a new Devflare-managed account-owned token from the curated Devflare permission set
605
+ - `--new [token-name] --all-flags` uses every reusable account-scoped permission group visible to the bootstrap token except `Account API Tokens*`, because Cloudflare does not allow sub-tokens to inherit token-management permission and account-owned tokens skip incompatible zone/user-scoped groups automatically
606
+ - `--list` lists only the Devflare-managed tokens in the selected account
607
+ - `--delete [token-name]` deletes the matching Devflare-managed token after normalizing the name to the `devflare-` prefix
608
+ - `--delete-all` deletes every Devflare-managed token in the selected account while leaving non-Devflare account tokens untouched
609
+ - prints a new token value once, because Cloudflare only returns the secret a single time
610
+
611
+ Examples:
612
+
613
+ ```bash
614
+ bunx --bun devflare tokens <bootstrap-token> --new preview
615
+ bunx --bun devflare tokens <bootstrap-token> --new preview --all-flags
616
+ bunx --bun devflare tokens <bootstrap-token> --list
617
+ bunx --bun devflare tokens <bootstrap-token> --delete preview
618
+ bunx --bun devflare tokens <bootstrap-token> --delete-all
619
+ ```
620
+
621
+ ### Thin GitHub Action and caller workflows
622
+
623
+ The repo ships a reusable composite action at [`.github/actions/devflare-deploy`](../../.github/actions/devflare-deploy).
624
+
625
+ The repo also ships a shared workspace setup action at [`.github/actions/devflare-setup-workspace`](../../.github/actions/devflare-setup-workspace) so one workflow job can install dependencies once and then deploy multiple preview targets from the same checkout.
626
+
627
+ The repo also ships a GitHub-feedback action at [`.github/actions/devflare-github-feedback`](../../.github/actions/devflare-github-feedback) for publishing deployment results back into GitHub.
628
+
629
+ The action stays intentionally thin:
630
+
631
+ - the caller workflow owns the runner, triggers, permissions, and environments
632
+ - Cloudflare credentials must be passed in explicitly
633
+ - by default, the action asks `devflare deploy` to verify Cloudflare control-plane state before the step is considered successful
634
+ - the caller workflow should pass a deterministic `preview-scope`, such as the branch name or `pr-<number>`, for stable dedicated preview Worker naming across PR, push, and manual workflows
635
+
636
+ The reporting split is also intentional:
637
+
638
+ - GitHub PR feedback should use a stable PR comment because PRs are issue-backed conversations
639
+ - GitHub branch feedback should use Deployments + deployment statuses because GitHub does not provide first-class branch comments
640
+ - one preview workflow can publish both branch deployment feedback and the shared PR comment in the same run when a pushed branch already belongs to an open pull request
641
+
642
+ Current action inputs that matter most:
643
+
644
+ - `working-directory`
645
+ - `environment`
646
+ - `production`
647
+ - `preview-scope`
648
+ - `skip-setup`
649
+ - `skip-install`
650
+ - `verify-deployment` (defaults to `true`)
651
+ - `cloudflare-api-token`
652
+ - `cloudflare-account-id`
653
+
654
+ When `verify-deployment` is enabled, the action fails if Devflare cannot confirm the uploaded version in Cloudflare, or for non-preview deploys, cannot confirm that a live deployment now references that version.
655
+
656
+ Action outputs:
657
+
658
+ - `preview-url`
659
+ - `version-id`
660
+ - `status`
661
+ - `exit-code`
662
+ - `log-excerpt`
663
+
664
+ Those extra outputs are especially useful when the caller workflow uses `continue-on-error: true` on the deploy step so it can still post a failure comment or deployment status before failing the job.
665
+
666
+ Minimal preview step:
667
+
668
+ ```yaml
669
+ - id: deploy
670
+ uses: ./.github/actions/devflare-deploy
671
+ with:
672
+ working-directory: apps/documentation
673
+ preview-scope: ${{ github.head_ref || github.ref_name }}
674
+ cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
675
+ cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
676
+ ```
677
+
678
+ This repository now keeps preview delivery in one shared workflow plus one production workflow:
679
+
680
+ - [`.github/workflows/preview.yml`](../../.github/workflows/preview.yml) handles documentation + testing previews, push + PR lifecycle triggers, branch + PR targets, and cleanup flows from one place
681
+ - [`.github/workflows/documentation-production.yml`](../../.github/workflows/documentation-production.yml) handles production deploys from the repository default branch plus GitHub deployment statuses
682
+ - [`.github/workflow-examples/branch-preview-cleanup.example.yml`](../../.github/workflow-examples/branch-preview-cleanup.example.yml) remains as a copyable delete-triggered preview-scope cleanup template for downstream repos that want a smaller starting point
683
+
684
+ The live workflows now rely on the deploy action's control-plane verification for deploy success.
685
+
686
+ If you want other feedback modes in your own repo, the supported patterns are:
687
+
688
+ - PR-only preview feedback: `mode: comment`
689
+ - branch-only preview feedback: `mode: deployment`
690
+ - combined branch deployment + PR comment feedback: either `mode: both` with `resolve-pr-from-ref: 'true'`, or separate deployment/comment steps inside one shared preview workflow when you want finer control over grouped PR comments
691
+
692
+ Repository-specific runtime checks still exist where they are testing app
693
+ behavior rather than deploy success. For example,
694
+ [`preview.yml`](../../.github/workflows/preview.yml)
695
+ deploys testing previews for both branch and PR scopes from one prepared job
696
+ when a pushed branch already belongs to an open pull request, while still
697
+ keeping its deployed-binding verification because it is validating runtime
698
+ bindings and deployment-channel wiring rather than merely asking whether
699
+ Cloudflare accepted the upload.
700
+
701
+ For branch-scoped real preview deploys such as `apps/testing`, Devflare now
702
+ automatically omits shared queue consumers from the deployed Wrangler config,
703
+ and it omits cron triggers by default, when it detects the branch-preview
704
+ strategy (`--env preview` plus branch scope, without `--preview`). That keeps
705
+ previews from colliding on singleton Cloudflare resources while leaving the
706
+ authoring config itself fully exhaustive for local dev, tests, and production
707
+ deploys.
708
+
709
+ If a branch-scoped preview really should keep its cron schedule, opt in with:
710
+
711
+ ```ts
712
+ export default defineConfig({
713
+ previews: {
714
+ includeCrons: true
715
+ }
716
+ })
717
+ ```
718
+
719
+ If those previews also need preview-owned Cloudflare resources, use
720
+ `preview.scope()` in the config authoring layer:
721
+
722
+ ```ts
723
+ import { defineConfig, preview } from 'devflare/config'
724
+
725
+ const pv = preview.scope()
726
+
727
+ export default defineConfig({
728
+ bindings: {
729
+ kv: {
730
+ CACHE: pv('my-cache-kv')
731
+ },
732
+ r2: {
733
+ ASSETS: pv('my-assets-bucket')
734
+ }
735
+ }
736
+ })
737
+ ```
738
+
739
+ Devflare resolves those opaque markers to base names outside preview
740
+ environments, and to preview-scoped names such as `my-cache-kv-preview` (or a
741
+ branch-derived suffix when `DEVFLARE_PREVIEW_BRANCH`, `DEVFLARE_PREVIEW_PR`, or
742
+ `DEVFLARE_PREVIEW_IDENTIFIER` is present) for preview resolution and deploys.
743
+ During `devflare deploy --env preview`, Devflare also provisions missing
744
+ preview-scoped KV, D1, R2, Queue, and Vectorize resources automatically before
745
+ the Wrangler deploy runs. Preview-scoped Hyperdrive names are reused when the
746
+ matching preview config already exists, and otherwise Devflare falls back to the
747
+ base Hyperdrive config because Cloudflare does not expose stored Hyperdrive
748
+ credentials for cloning preview configs automatically. Use
749
+ `devflare previews cleanup --env preview --apply` during PR-close or
750
+ branch-delete cleanup to delete the preview-owned resources again.
751
+ Service bindings created through `ref()` still follow the referenced worker
752
+ names, so branch-scoped worker naming remains the way to isolate preview
753
+ service bindings.
754
+
755
+ ---
756
+
757
+ ## Repo examples
758
+
759
+ - [`apps/documentation/`](../../apps/documentation/) is the executable SvelteKit example for dev, build, preview deploys, production deploys, workflow automation, and browser validation
760
+ - [`apps/testing/`](../../apps/testing/) is the exhaustive binding-matrix example for the config contract itself, including `preview.scope()`-driven preview resource names, production overrides where bindings differ by deployment channel, and a tiny `src/fetch.ts` smoke Worker exercised by repository integration tests through `devflare/test`
448
761
 
449
762
  ---
450
763
 
@@ -484,26 +797,66 @@ It also auto-detects conventional `src/fetch.ts`, `src/queue.ts`, `src/scheduled
484
797
 
485
798
  ## CLI
486
799
 
800
+ Every top-level command supports `--help`, and nested command groups support both:
801
+
802
+ - `bunx --bun devflare <command> --help`
803
+ - `bunx --bun devflare <command> <subcommand> --help`
804
+ - `bunx --bun devflare help <command> [subcommand]`
805
+
487
806
  | Command | What it does |
488
807
  |---|---|
489
808
  | `devflare init` | scaffold a project using `src/fetch.ts` and explicit `files.fetch` |
490
809
  | `devflare dev` | start the worker-only dev server, enabling Vite only when the current package has a local `vite.config.*` |
491
- | `devflare build` | resolve config, generate `wrangler.jsonc`, and run `vite build` only for Vite-backed packages |
492
- | `devflare deploy` | build and deploy with Wrangler |
810
+ | `devflare build` | resolve config, generate Devflare/Wrangler build artifacts, and run `vite build` only for Vite-backed packages |
811
+ | `devflare deploy` | build and deploy with Wrangler, including same-Worker preview uploads via `--preview` |
493
812
  | `devflare types` | generate `env.d.ts` |
494
- | `devflare doctor` | check project configuration and generated artifacts |
813
+ | `devflare doctor` | check project configuration plus generated artifact locations such as `.devflare/wrangler.jsonc`, `.devflare/build/wrangler.jsonc`, and `.wrangler/deploy/config.json` |
814
+ | `devflare config` | print resolved Devflare config or resolved Wrangler JSON |
495
815
  | `devflare account` | inspect accounts, resources, usage, and limits |
816
+ | `devflare login` | authenticate with Cloudflare via Wrangler, reusing existing auth unless `--force` is passed |
817
+ | `devflare previews` | inspect and clean dedicated preview Workers plus preview-owned scope resources |
818
+ | `devflare productions` | inspect live production Workers, list recent versions, roll back, or delete a live Worker script |
819
+ | `devflare worker` | run Worker control-plane actions such as remote renaming and local config sync |
820
+ | `devflare tokens` | create, list, and delete Devflare-managed account-owned tokens from a bootstrap token with API-token-management permission |
821
+ | `devflare help` | print the command overview or the detailed help page for a command path |
822
+ | `devflare version` | print the installed Devflare version |
496
823
  | `devflare ai` | show Workers AI model pricing info |
497
824
  | `devflare remote` | manage remote test mode |
498
825
 
826
+ Command defaults:
827
+
828
+ - `devflare config` defaults to `devflare config print`
829
+ - `devflare previews` defaults to `devflare previews list`
830
+ - `devflare productions` defaults to `devflare productions list`
831
+
832
+ ### Command groups
833
+
834
+ | Group | Subcommands / operations |
835
+ |---|---|
836
+ | `account` | `info`, `workers`, `kv`, `d1`, `r2`, `vectorize`, `usage`, `limits`, `limits set`, `limits enable`, `limits disable`, `global`, `workspace` |
837
+ | `config` | `print` |
838
+ | `previews` | `list`, `bindings`, `cleanup` |
839
+ | `productions` | `list`, `versions`, `rollback`, `delete` |
840
+ | `remote` | `status`, `enable`, `disable` |
841
+ | `worker` | `rename` |
842
+ | `tokens` | `--list`, `--new`, `--roll`, `--delete`, `--delete-all` (flag-driven operations rather than subcommands) |
843
+
499
844
  Useful flags:
500
845
 
501
846
  - `build --env <name>`
502
847
  - `deploy --env <name>`
503
848
  - `deploy --dry-run`
849
+ - `deploy --preview <name>`
850
+ - `login --force`
851
+ - `previews`
852
+ - `previews cleanup --scope <name> --apply`
853
+ - `config print --json`
854
+ - `config print --format wrangler`
504
855
  - `types --output <path>`
505
856
  - `doctor --config <path>`
506
857
  - `account --account <id>`
858
+ - `tokens <bootstrap-token> --new [name]`
859
+ - `tokens <bootstrap-token> --list`
507
860
 
508
861
  Recommended invocation style:
509
862
 
@@ -511,6 +864,8 @@ Recommended invocation style:
511
864
  bunx --bun devflare dev
512
865
  bunx --bun devflare types
513
866
  bunx --bun devflare build
867
+ bunx --bun devflare help account limits set
868
+ bunx --bun devflare previews cleanup --help
514
869
  ```
515
870
 
516
871
  ---
@@ -519,9 +874,13 @@ bunx --bun devflare build
519
874
 
520
875
  Treat these as generated output, not source of truth:
521
876
 
522
- - `.devflare/`
877
+ - `.devflare/wrangler.jsonc`
878
+ - `.devflare/build/wrangler.jsonc`
879
+ - `.devflare/worker-entrypoints/main.ts`
880
+ - `.devflare/worker-entrypoints/main.js`
881
+ - `.devflare/vite.config.mjs`
882
+ - `.wrangler/deploy/config.json`
523
883
  - `env.d.ts`
524
- - generated `wrangler.jsonc`
525
884
 
526
885
  The source of truth is still:
527
886
 
package/bin/devflare.js CHANGED
@@ -1,14 +1,24 @@
1
1
  #!/usr/bin/env bun
2
- import { runCli } from "../dist/src/cli/index.js";
2
+ import { existsSync } from 'node:fs'
3
+ import { dirname, resolve } from 'node:path'
4
+ import { fileURLToPath, pathToFileURL } from 'node:url'
3
5
 
4
- // Pass CLI arguments (skip node and script path)
5
- const args = process.argv.slice(2);
6
+ const currentDir = dirname(fileURLToPath(import.meta.url))
7
+ const sourceCliEntryPath = resolve(currentDir, '../src/cli/index.ts')
8
+ const distCliEntryPath = resolve(currentDir, '../dist/src/cli/index.js')
9
+ const cliEntryPath = existsSync(sourceCliEntryPath)
10
+ ? sourceCliEntryPath
11
+ : distCliEntryPath
12
+
13
+ const { runCli } = await import(pathToFileURL(cliEntryPath).href)
14
+
15
+ const args = process.argv.slice(2)
6
16
 
7
17
  runCli(args)
8
18
  .then((result) => {
9
- process.exit(result.exitCode);
19
+ process.exit(result.exitCode)
10
20
  })
11
21
  .catch((error) => {
12
- console.error("CLI error:", error);
13
- process.exit(1);
14
- });
22
+ console.error('CLI error:', error)
23
+ process.exit(1)
24
+ })