@builtbyfriends/bwf 0.0.0-stage → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS_TEMPLATE.md +4 -0
- package/LICENSE +22 -0
- package/README.md +48 -2
- package/dist/account-cmd-Ddt8lGeL.mjs +45 -0
- package/dist/agents-BLiMq9E1.mjs +113 -0
- package/dist/application-analysis-C9Ck2Yeg.mjs +1498 -0
- package/dist/application-routing-DbR-W5lG.mjs +25 -0
- package/dist/atomic-write-DA6eD1Kp.mjs +17 -0
- package/dist/auth-BKsUmWbT.d.mts +77 -0
- package/dist/auth-DkvoW5hB.mjs +33 -0
- package/dist/auth-aKyIWkdS.mjs +1 -0
- package/dist/auth-client-6-Ft9i9T.d.mts +5 -0
- package/dist/auth-client-DwCdwKbw.mjs +5 -0
- package/dist/auth-client-react-CJdeErvM.mjs +5 -0
- package/dist/auth-client-react-DvQLe5Zb.d.mts +5 -0
- package/dist/auth-link-CCl-hJol.mjs +26 -0
- package/dist/auth-migrations-DDeifS3v.mjs +206 -0
- package/dist/auth-router-BG74WFUf.mjs +66 -0
- package/dist/auth-xnkmpZUl.mjs +311 -0
- package/dist/base64-ikl9yBy3.mjs +15 -0
- package/dist/better-auth-shared-Br6TNaYJ.mjs +473 -0
- package/dist/better-auth-shared-CsBNvPOU.d.mts +56 -0
- package/dist/build-cmd-BnZezraT.mjs +153 -0
- package/dist/build-output-dir-Clj_unKN.mjs +402 -0
- package/dist/cancel-deploy-DKAj5U1Z.mjs +57 -0
- package/dist/cf-access-Bhz9wX6p.mjs +131 -0
- package/dist/cf-access-CUP5L08W.mjs +67 -0
- package/dist/cf-build-output-DA6uJomQ.mjs +1 -0
- package/dist/cf-build-output-DNQTwMNU.mjs +438 -0
- package/dist/cf-command-values-2kOtxMo1.mjs +26 -0
- package/dist/cf-config-migrate-COOCi4Ge.mjs +330 -0
- package/dist/cf-worker-settings-CIh4t_yG.mjs +41 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +88 -0
- package/dist/cli/cloudflare-operation-process.d.mts +1 -0
- package/dist/cli/cloudflare-operation-process.mjs +1284 -0
- package/dist/cli/env-schema-probe.d.mts +43 -0
- package/dist/cli/env-schema-probe.mjs +165 -0
- package/dist/cli-main-BfYf6fnB.mjs +1846 -0
- package/dist/client-D3D5RM5h.mjs +940 -0
- package/dist/client-VF2Nzc7Z.mjs +1 -0
- package/dist/cloudflare-auth-DzkU9H6r.mjs +152 -0
- package/dist/cloudflare-cmd-Bm6UhzAQ.mjs +59 -0
- package/dist/cloudflare-config-i8yanry0.mjs +186 -0
- package/dist/cloudflare-connect-B4ItSbJi.mjs +55 -0
- package/dist/cloudflare-operations-BcK849ue.mjs +1 -0
- package/dist/cloudflare-operations-DGF7xH7O.mjs +627 -0
- package/dist/cloudflare-process-tThIjEB2.mjs +309 -0
- package/dist/cloudflare-user-output-CqONaAbP.mjs +19 -0
- package/dist/collect-8i0wU63d.mjs +1 -0
- package/dist/collect-C6Blu9yw.mjs +48 -0
- package/dist/config-CN_RFRkS.mjs +86 -0
- package/dist/config-D5G-Tx6o.mjs +1 -0
- package/dist/config-DOaFIK3w.mjs +88 -0
- package/dist/config-entry.d.mts +202 -0
- package/dist/config-entry.mjs +6 -0
- package/dist/config-tNx0HlFv.mjs +516 -0
- package/dist/connect-CSNWKLzB.mjs +84 -0
- package/dist/create-project-B35ux-LA.mjs +126 -0
- package/dist/create-project-tJ1KwNss.mjs +1 -0
- package/dist/database-provider-DkZo4VwN.mjs +5 -0
- package/dist/database-provider.d.mts +25 -0
- package/dist/database-provider.mjs +1 -0
- package/dist/db-SOv4E9wr.mjs +1735 -0
- package/dist/delete-BSKI7V23.mjs +65 -0
- package/dist/deploy-BCSQoKC0.mjs +2 -0
- package/dist/deploy-CWJ3JJs_.mjs +6512 -0
- package/dist/deploy.d.mts +31 -0
- package/dist/deploy.mjs +118 -0
- package/dist/dev-inbox-I0nqTCdf.mjs +216 -0
- package/dist/discover-DJPmQcL5.mjs +36 -0
- package/dist/discover-EVuydEoM.mjs +1 -0
- package/dist/dist-B6eN80gc.mjs +1612 -0
- package/dist/dist-Cp4b1_T9.mjs +1 -0
- package/dist/dist-DMYe8CZJ.mjs +48 -0
- package/dist/dist-STQXl8ck.mjs +1878 -0
- package/dist/domain-BJaAbxuQ.mjs +149 -0
- package/dist/dotenv-4NdUCXbB.mjs +156 -0
- package/dist/drizzle-DqVFXtlc.mjs +306 -0
- package/dist/drizzle-Ds5P0n-S.mjs +1 -0
- package/dist/edge.d.mts +2 -0
- package/dist/edge.mjs +1 -0
- package/dist/email-C_ATvNIG.mjs +2865 -0
- package/dist/email-cloudflare-oXk2G1G3.mjs +854 -0
- package/dist/email-protocol-CZ0bAkI8.mjs +81 -0
- package/dist/email-rIfZgVAB.mjs +742 -0
- package/dist/env-BGTu3KWZ.mjs +73 -0
- package/dist/env-DUyTzroe.mjs +88 -0
- package/dist/env-Dl4Wggec.mjs +71 -0
- package/dist/env-helpers-BX0APszT.mjs +135 -0
- package/dist/env-helpers-U56xuFgL.d.mts +20 -0
- package/dist/env-mask-BsHxq3R8.mjs +46 -0
- package/dist/env-public-Cw_xPi1D.d.mts +119 -0
- package/dist/env-raw-Bo6TtrHU.mjs +41 -0
- package/dist/env-types-Bg-dTh8u.mjs +56 -0
- package/dist/env-validation-BlXzGgLZ.mjs +1 -0
- package/dist/env-validation-DeqFUSKg.mjs +488 -0
- package/dist/fetch-CBgyyhzm.d.mts +87 -0
- package/dist/fetch-error-DmlRM6e4.mjs +264 -0
- package/dist/fetch-stream-2GUN3YN1.mjs +102 -0
- package/dist/fetch-stream-bUXynOyZ.d.mts +32 -0
- package/dist/fetch-tpPiSK10.mjs +25 -0
- package/dist/gen-dc13IRXh.mjs +509 -0
- package/dist/gen-kQqhFyOP.mjs +1 -0
- package/dist/generate-BgtlYpKg.mjs +1 -0
- package/dist/generate-Da9mWKzU.mjs +80 -0
- package/dist/generated-wrangler-config-CoDaaFsA.mjs +17 -0
- package/dist/git-metadata-Cukp5kV5.mjs +82 -0
- package/dist/github-cmd-DT5Onu6E.mjs +690 -0
- package/dist/handler-B_ocHStk.d.mts +279 -0
- package/dist/handler-CNq7aSs1.mjs +161 -0
- package/dist/help-BK35YcRa.mjs +1946 -0
- package/dist/help-DaRezBj7.mjs +1 -0
- package/dist/inbound-CqubE-9T.d.mts +311 -0
- package/dist/inbound-lHugZPuK.mjs +509 -0
- package/dist/index.d.mts +64 -0
- package/dist/index.mjs +4163 -0
- package/dist/info-CLQoCenb.mjs +109 -0
- package/dist/init-CXanf5ck.mjs +2486 -0
- package/dist/limits-CMmYT2l8.d.mts +16 -0
- package/dist/limits-D27Lp6FP.mjs +46 -0
- package/dist/link-DinwJnon.mjs +52 -0
- package/dist/list-B1WAE9Wt.mjs +130 -0
- package/dist/live-KkEeda1Z.d.mts +105 -0
- package/dist/live-saC8barp.mjs +410 -0
- package/dist/load-user-env-g0ahkZcj.mjs +34 -0
- package/dist/local-d1-bUoAtFUe.mjs +103 -0
- package/dist/log-JDnPc0cF.mjs +23 -0
- package/dist/login-BUzyiyHV.mjs +1 -0
- package/dist/login-Dbv_T3Ru.mjs +87 -0
- package/dist/logs-BjMJooJQ.mjs +129 -0
- package/dist/migrate-DjW9_-sS.mjs +1 -0
- package/dist/migrate-DtcfKqPW.mjs +125 -0
- package/dist/migration-handler-22qiuWPq.mjs +469 -0
- package/dist/migration-handler-Bb2BJh6g.d.mts +38 -0
- package/dist/mime-BMUN_QKG.mjs +1004 -0
- package/dist/mysql-migration-sql-CNuBSqdx.mjs +239 -0
- package/dist/neon-CJzQSycr.mjs +52 -0
- package/dist/node-tfv-3v0V.mjs +64 -0
- package/dist/operator-ai-logging-Ay7M4KWw.mjs +121 -0
- package/dist/operator-args-BiGmSlZx.mjs +722 -0
- package/dist/operator-auth-DdYZYEkO.mjs +47 -0
- package/dist/operator-client-DBujdELO.mjs +82 -0
- package/dist/operator-cmd-BsHKYJYt.mjs +1 -0
- package/dist/operator-cmd-DTIkOAnP.mjs +443 -0
- package/dist/output-Bb34lF0w.mjs +173 -0
- package/dist/output-CVolXKC1.mjs +1 -0
- package/dist/package-BX_giUBX.mjs +1444 -0
- package/dist/package-json-DvS6IFRv.mjs +43 -0
- package/dist/pg-DoyPxa_X.mjs +15 -0
- package/dist/picocolors-D1NxSLw-.mjs +71 -0
- package/dist/plan-BHNt1QhK.mjs +1 -0
- package/dist/plan-DX4_-OM5.mjs +58 -0
- package/dist/platform-args-C-DyuCNX.mjs +1 -0
- package/dist/platform-args-CyeQWaZ7.mjs +538 -0
- package/dist/platform-auth-config-BfXqKSyZ.mjs +371 -0
- package/dist/platform-auth-protection-5FR6qoP_.mjs +231 -0
- package/dist/platform-auth-recovery-B5ZlqA8K.mjs +309 -0
- package/dist/platform-cmd-CcFDxtrl.mjs +1 -0
- package/dist/platform-cmd-ChXeBrRH.mjs +193 -0
- package/dist/platform-discovery-Bxg9aZXU.mjs +40 -0
- package/dist/platform-domain-CwatS3cz.mjs +256 -0
- package/dist/platform-lifecycle-0cXTmMsh.mjs +8928 -0
- package/dist/platform-lifecycle-BcoBAMux.mjs +1 -0
- package/dist/platform-management-6Wbdbob5.mjs +1607 -0
- package/dist/platform-management-hhnczOzr.mjs +1 -0
- package/dist/platform-plans-config-CkbUKFpm.mjs +447 -0
- package/dist/platform-recovery-DgIwlqB-.mjs +96 -0
- package/dist/platform-registry-x1m9HBxf.mjs +450 -0
- package/dist/platform-runtime-logs-kkoiYFpF.mjs +72 -0
- package/dist/platform-setup-DX8y_6Kh.mjs +306 -0
- package/dist/prepare-B9mB47T5.mjs +84 -0
- package/dist/prepare-DNIq07so.mjs +13 -0
- package/dist/prepare-LHkyJqxi.mjs +1 -0
- package/dist/project-CC7eN00D.mjs +141 -0
- package/dist/project-DcSd4BeI.mjs +1 -0
- package/dist/project-cmd-BydRwr-x.mjs +109 -0
- package/dist/project-paths-iXHKRTTQ.mjs +159 -0
- package/dist/project-slug-BUy0lmyR.mjs +1 -0
- package/dist/project-slug-CO6ci9XG.mjs +7 -0
- package/dist/project-team-CvdLhDF2.mjs +129 -0
- package/dist/project-token-CwZdUEGu.mjs +70 -0
- package/dist/project-tsconfig-P9X952KG.mjs +98 -0
- package/dist/project-zero-trust-CKDoPdN1.mjs +64 -0
- package/dist/providers-Cd3c7wi0.mjs +64 -0
- package/dist/providers-Df69hb_X.d.mts +5 -0
- package/dist/provision-BA59NCPO.mjs +1 -0
- package/dist/provision-C90fULHJ.mjs +1814 -0
- package/dist/queues-Bc3FsBQT.d.mts +5 -0
- package/dist/r2-conditions-DSLmkiR5.mjs +60 -0
- package/dist/requests-DNhfyF3l.mjs +52 -0
- package/dist/resolve-project-BCsAMDRA.mjs +47 -0
- package/dist/resolve-project-DhU9_lIo.mjs +1 -0
- package/dist/resource-name-DlJ9QXzg.mjs +10 -0
- package/dist/response-HmNjB30w.mjs +29 -0
- package/dist/rollback-wi6WK5T6.mjs +150 -0
- package/dist/rolldown-runtime-uD8oG6U2.mjs +24 -0
- package/dist/route-types-CRWhr93D.mjs +592 -0
- package/dist/route-url-BIDZT78M.mjs +58 -0
- package/dist/route-url-Bla3Upsy.d.mts +42 -0
- package/dist/routes-stub.d.mts +24 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/routing-assets-CSheDWWM.mjs +54 -0
- package/dist/rpc-DcByS_q0.d.mts +39 -0
- package/dist/rpc-DtxIN9Tv.mjs +19 -0
- package/dist/runner-CPerdjIl.mjs +163 -0
- package/dist/runner-CUNtS5x7.mjs +1 -0
- package/dist/runner-mysql-BjSoQ-mW.mjs +1 -0
- package/dist/runner-mysql-BmTI2EiF.mjs +145 -0
- package/dist/runner-pg-2pjltt0t.mjs +1 -0
- package/dist/runner-pg-mYc75KfH.mjs +61 -0
- package/dist/runtime/ai.d.mts +50 -0
- package/dist/runtime/ai.mjs +455 -0
- package/dist/runtime/auth-client-react.d.mts +2 -0
- package/dist/runtime/auth-client-react.mjs +1 -0
- package/dist/runtime/auth-client.d.mts +2 -0
- package/dist/runtime/auth-client.mjs +1 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +1 -0
- package/dist/runtime/better-auth-mysql.d.mts +5 -0
- package/dist/runtime/better-auth-mysql.mjs +21 -0
- package/dist/runtime/better-auth-pg.d.mts +5 -0
- package/dist/runtime/better-auth-pg.mjs +21 -0
- package/dist/runtime/better-auth.d.mts +6 -0
- package/dist/runtime/better-auth.mjs +22 -0
- package/dist/runtime/client-react.d.mts +5 -0
- package/dist/runtime/client-react.mjs +5 -0
- package/dist/runtime/client.d.mts +5 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-mysql.d.mts +2 -0
- package/dist/runtime/db-mysql.mjs +1 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +36 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/durable.d.mts +64 -0
- package/dist/runtime/durable.mjs +165 -0
- package/dist/runtime/email/testing.d.mts +108 -0
- package/dist/runtime/email/testing.mjs +268 -0
- package/dist/runtime/email-protocol.d.mts +25 -0
- package/dist/runtime/email-protocol.mjs +1 -0
- package/dist/runtime/email.d.mts +26 -0
- package/dist/runtime/email.mjs +524 -0
- package/dist/runtime/env-public-client.d.mts +19 -0
- package/dist/runtime/env-public-client.mjs +55 -0
- package/dist/runtime/env-public.d.mts +4 -0
- package/dist/runtime/env-public.mjs +277 -0
- package/dist/runtime/env.d.mts +12 -0
- package/dist/runtime/env.mjs +1 -0
- package/dist/runtime/fetch-server.d.mts +6 -0
- package/dist/runtime/fetch-server.mjs +29 -0
- package/dist/runtime/fetch-stream.d.mts +3 -0
- package/dist/runtime/fetch-stream.mjs +3 -0
- package/dist/runtime/fetch.d.mts +2 -0
- package/dist/runtime/fetch.mjs +3 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +1 -0
- package/dist/runtime/kv.d.mts +45 -0
- package/dist/runtime/kv.mjs +103 -0
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +1 -0
- package/dist/runtime/live-client.d.mts +40 -0
- package/dist/runtime/live-client.mjs +282 -0
- package/dist/runtime/live-server.d.mts +11 -0
- package/dist/runtime/live-server.mjs +419 -0
- package/dist/runtime/live.d.mts +3 -0
- package/dist/runtime/live.mjs +1 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +57 -0
- package/dist/runtime/migration-handler-mysql.d.mts +2 -0
- package/dist/runtime/migration-handler-mysql.mjs +111 -0
- package/dist/runtime/migration-handler-pg.d.mts +2 -0
- package/dist/runtime/migration-handler-pg.mjs +94 -0
- package/dist/runtime/migration-handler.d.mts +2 -0
- package/dist/runtime/migration-handler.mjs +1 -0
- package/dist/runtime/procedure.d.mts +27 -0
- package/dist/runtime/procedure.mjs +36 -0
- package/dist/runtime/procedures.d.mts +24 -0
- package/dist/runtime/procedures.mjs +56 -0
- package/dist/runtime/queues.d.mts +2 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +11 -0
- package/dist/runtime/remote/binding-handler.mjs +227 -0
- package/dist/runtime/remote/index.d.mts +12 -0
- package/dist/runtime/remote/index.mjs +467 -0
- package/dist/runtime/response.d.mts +11 -0
- package/dist/runtime/response.mjs +1 -0
- package/dist/runtime/route-url.d.mts +2 -0
- package/dist/runtime/route-url.mjs +1 -0
- package/dist/runtime/routing.d.mts +53 -0
- package/dist/runtime/routing.mjs +425 -0
- package/dist/runtime/rpc-react.d.mts +16 -0
- package/dist/runtime/rpc-react.mjs +50 -0
- package/dist/runtime/rpc.d.mts +2 -0
- package/dist/runtime/rpc.mjs +1 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +1 -0
- package/dist/runtime/sandbox.d.mts +5 -0
- package/dist/runtime/sandbox.mjs +196 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-mysql.d.mts +1 -0
- package/dist/runtime/schema-mysql.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +34 -0
- package/dist/runtime/seed.mjs +5 -0
- package/dist/runtime/sse-client.d.mts +31 -0
- package/dist/runtime/sse-client.mjs +42 -0
- package/dist/runtime/sse.d.mts +32 -0
- package/dist/runtime/sse.mjs +1 -0
- package/dist/runtime/storage.d.mts +4 -0
- package/dist/runtime/storage.mjs +13 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +1 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +297 -0
- package/dist/runtime/ws.d.mts +2 -0
- package/dist/runtime/ws.mjs +108 -0
- package/dist/sandbox-CWDjoEG2.d.mts +50 -0
- package/dist/sandbox-container-BqamdFCx.d.mts +73 -0
- package/dist/sandbox-container-d1AHLpgn.mjs +291 -0
- package/dist/secret-D5XrWshs.mjs +146 -0
- package/dist/skills-Dr3AjuBF.mjs +63 -0
- package/dist/sqlite-validation-CLJXXN93.mjs +24 -0
- package/dist/sse-CxR30yMF.mjs +174 -0
- package/dist/standard-schema-CuDawHOC.d.mts +40 -0
- package/dist/static-asset-marker-mWMX2dLa.mjs +38 -0
- package/dist/subcommand-prompt-B9yUo--u.mjs +370 -0
- package/dist/terminal-log-text-DNsWJREL.mjs +31 -0
- package/dist/types-D7-4tBu7.d.mts +1 -0
- package/dist/untrusted-env-lL7RkYiC.mjs +50 -0
- package/dist/validate-B-zsjhiz.mjs +162 -0
- package/dist/validate-DbqGdPPY.mjs +1 -0
- package/dist/validator-8-NZs2Xr.mjs +168 -0
- package/dist/version-metadata-DPhqnpaa.mjs +23 -0
- package/dist/wrangler-C3uyPadQ.mjs +1 -0
- package/dist/wrangler-TqTvJFWS.mjs +1452 -0
- package/dist/ws-DZRiIpYw.d.mts +137 -0
- package/dist/yarn-pnp-DgWbE7z5.mjs +91 -0
- package/docs/guide/ai.md +273 -0
- package/docs/guide/app-types.md +101 -0
- package/docs/guide/auth.md +255 -0
- package/docs/guide/database/d1.md +86 -0
- package/docs/guide/database/mysql.md +72 -0
- package/docs/guide/database/postgresql.md +94 -0
- package/docs/guide/database.md +454 -0
- package/docs/guide/deployment.md +124 -0
- package/docs/guide/durable-state.md +192 -0
- package/docs/guide/edge/headers.md +47 -0
- package/docs/guide/edge/redirects.md +85 -0
- package/docs/guide/edge/rewrites.md +119 -0
- package/docs/guide/edge/static-assets.md +94 -0
- package/docs/guide/email/domains.md +119 -0
- package/docs/guide/email/receiving.md +142 -0
- package/docs/guide/email/sending.md +262 -0
- package/docs/guide/email.md +23 -0
- package/docs/guide/env-vars.md +115 -0
- package/docs/guide/index.md +37 -0
- package/docs/guide/jobs.md +80 -0
- package/docs/guide/kv.md +100 -0
- package/docs/guide/live.md +181 -0
- package/docs/guide/platform/administration/access.md +165 -0
- package/docs/guide/platform/administration/connected-apps.md +84 -0
- package/docs/guide/platform/administration/email.md +169 -0
- package/docs/guide/platform/administration/operations.md +100 -0
- package/docs/guide/platform/administration/plans.md +156 -0
- package/docs/guide/platform/administration/projects.md +74 -0
- package/docs/guide/platform/administration/zero-trust.md +205 -0
- package/docs/guide/platform/development/local.md +122 -0
- package/docs/guide/platform/development/runtime.md +115 -0
- package/docs/guide/platform/development/schema-ci.md +44 -0
- package/docs/guide/platform/installation/ci.md +62 -0
- package/docs/guide/platform/installation/credentials.md +140 -0
- package/docs/guide/platform/installation/domains.md +120 -0
- package/docs/guide/platform/installation/first-deployment.md +95 -0
- package/docs/guide/platform/installation/maintenance.md +250 -0
- package/docs/guide/platform/installation/prerequisites.md +176 -0
- package/docs/guide/platform/installation/setup.md +300 -0
- package/docs/guide/platform/installation/uninstall.md +110 -0
- package/docs/guide/platform-administration.md +19 -0
- package/docs/guide/platform-development.md +16 -0
- package/docs/guide/procedures.md +48 -0
- package/docs/guide/project-collaboration.md +99 -0
- package/docs/guide/queues.md +149 -0
- package/docs/guide/quickstart.md +129 -0
- package/docs/guide/remote-dev.md +67 -0
- package/docs/guide/sandboxes.md +134 -0
- package/docs/guide/self-hosted-platform.md +45 -0
- package/docs/guide/server-routing.md +283 -0
- package/docs/guide/sse.md +174 -0
- package/docs/guide/storage.md +82 -0
- package/docs/guide/testing.md +64 -0
- package/docs/guide/type-safety.md +270 -0
- package/docs/guide/typed-fetch.md +98 -0
- package/docs/guide/websockets.md +230 -0
- package/docs/index.md +102 -0
- package/docs/integrations/agents.md +38 -0
- package/docs/integrations/cloudflare.md +241 -0
- package/docs/integrations/hono.md +127 -0
- package/docs/reference/api/auth.md +195 -0
- package/docs/reference/api/client.md +90 -0
- package/docs/reference/api/database.md +118 -0
- package/docs/reference/api/deploy.md +63 -0
- package/docs/reference/api/durable.md +47 -0
- package/docs/reference/api/env.md +51 -0
- package/docs/reference/api/handlers.md +189 -0
- package/docs/reference/api/plugin.md +40 -0
- package/docs/reference/api/resources.md +116 -0
- package/docs/reference/api/rewrites.md +111 -0
- package/docs/reference/api/types.md +126 -0
- package/docs/reference/api.md +71 -0
- package/docs/reference/cli/auth.md +87 -0
- package/docs/reference/cli/database.md +159 -0
- package/docs/reference/cli/deploy.md +117 -0
- package/docs/reference/cli/domains.md +42 -0
- package/docs/reference/cli/email.md +145 -0
- package/docs/reference/cli/generate.md +113 -0
- package/docs/reference/cli/github.md +181 -0
- package/docs/reference/cli/platform-config.md +93 -0
- package/docs/reference/cli/platform-email.md +81 -0
- package/docs/reference/cli/platform-installation.md +166 -0
- package/docs/reference/cli/platform-operations.md +90 -0
- package/docs/reference/cli/platform-users.md +159 -0
- package/docs/reference/cli/platform-zero-trust.md +60 -0
- package/docs/reference/cli/platform.md +78 -0
- package/docs/reference/cli/project.md +208 -0
- package/docs/reference/cli/secrets.md +79 -0
- package/docs/reference/cli/setup.md +88 -0
- package/docs/reference/cli.md +115 -0
- package/docs/reference/config.md +478 -0
- package/docs/reference/resource-inference.md +72 -0
- package/docs/reference/structure.md +138 -0
- package/package.json +389 -3
- package/sandbox.Dockerfile +4 -0
- package/schema.json +353 -0
- package/skills/bwf/SKILL.md +100 -0
- package/skills/migrate-vite-cloudflare-to-bwf/SKILL.md +53 -0
- package/templates/assets/bwf.svg +5 -0
- package/templates/assets/icons.svg +49 -0
- package/templates/assets/react.svg +1 -0
- package/templates/assets/stack.svg +35 -0
|
@@ -0,0 +1,1846 @@
|
|
|
1
|
+
import { L as log } from "./dist-STQXl8ck.mjs";
|
|
2
|
+
import { n as getOwnVersion } from "./agents-BLiMq9E1.mjs";
|
|
3
|
+
import { t as formatCloudflareUserMessage } from "./cloudflare-user-output-CqONaAbP.mjs";
|
|
4
|
+
import { n as isD1Bookmark } from "./cf-command-values-2kOtxMo1.mjs";
|
|
5
|
+
import { i as printHelpPage, n as printBwfHeader, r as printGlobalHelp, t as getHelpPath } from "./help-BK35YcRa.mjs";
|
|
6
|
+
import { n as operatorGroups } from "./operator-args-BiGmSlZx.mjs";
|
|
7
|
+
import { r as OperatorClientError } from "./operator-client-DBujdELO.mjs";
|
|
8
|
+
import { f as import_picocolors, l as formatUrl } from "./output-Bb34lF0w.mjs";
|
|
9
|
+
import { n as platformSubcommands, t as parsePlatformArgs } from "./platform-args-CyeQWaZ7.mjs";
|
|
10
|
+
import { parseArgs } from "node:util";
|
|
11
|
+
// src/cli/account-args.ts
|
|
12
|
+
const accountSubcommands = [
|
|
13
|
+
{
|
|
14
|
+
name: "login",
|
|
15
|
+
description: "Log in with an enabled platform login method"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "link",
|
|
19
|
+
description: "Link another login method to your account"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "logout",
|
|
23
|
+
description: "Log out and remove credentials"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "whoami",
|
|
27
|
+
description: "Show the logged-in username"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "token",
|
|
31
|
+
description: "Copy auth token to clipboard"
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
function parseAccountArgs(args) {
|
|
35
|
+
const [subcommand, extra, trailing] = args;
|
|
36
|
+
if (subcommand === "link") {
|
|
37
|
+
if (trailing || extra !== void 0 && !/^[a-z][a-z0-9_-]{0,63}$/.test(extra)) throw new Error("account: Usage: bwf account link [connection-id].");
|
|
38
|
+
return {
|
|
39
|
+
subcommand,
|
|
40
|
+
...extra ? { connectionId: extra } : {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (!subcommand || ![
|
|
44
|
+
"login",
|
|
45
|
+
"logout",
|
|
46
|
+
"whoami",
|
|
47
|
+
"token"
|
|
48
|
+
].includes(subcommand)) throw new Error("account: Usage: bwf account <login|link|logout|whoami|token>.");
|
|
49
|
+
if (extra) throw new Error(`account: Unexpected argument '${extra}'.`);
|
|
50
|
+
return { subcommand };
|
|
51
|
+
}
|
|
52
|
+
// src/cli/args.ts
|
|
53
|
+
function parseDeployArgs(args) {
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = parseArgs({
|
|
57
|
+
args,
|
|
58
|
+
options: {
|
|
59
|
+
project: { type: "string" },
|
|
60
|
+
dir: { type: "string" },
|
|
61
|
+
spa: { type: "boolean" },
|
|
62
|
+
"skip-build": { type: "boolean" },
|
|
63
|
+
"skip-migrations": { type: "boolean" },
|
|
64
|
+
debug: { type: "boolean" },
|
|
65
|
+
platform: { type: "string" },
|
|
66
|
+
provision: { type: "boolean" },
|
|
67
|
+
"require-email": { type: "boolean" },
|
|
68
|
+
atomic: { type: "boolean" }
|
|
69
|
+
},
|
|
70
|
+
allowPositionals: true,
|
|
71
|
+
strict: true,
|
|
72
|
+
tokens: true
|
|
73
|
+
});
|
|
74
|
+
} catch (error) {
|
|
75
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
76
|
+
if (message.includes("argument missing") || message.includes("argument is ambiguous")) {
|
|
77
|
+
if (message.match(/Option '(--[a-z-]+)/)?.[1] === "--platform") throw new Error("deploy: --platform requires a value ('cloudflare' or 'nosam').");
|
|
78
|
+
throw new Error("deploy: --project requires a slug.");
|
|
79
|
+
}
|
|
80
|
+
const unknownOptionMatch = message.match(/Unknown option '([^']+)'/);
|
|
81
|
+
if (unknownOptionMatch) throw new Error(`deploy: Unknown option '${unknownOptionMatch[1]}'.`);
|
|
82
|
+
throw new Error(`deploy: ${message}.`);
|
|
83
|
+
}
|
|
84
|
+
const tokens = parsed.tokens ?? [];
|
|
85
|
+
if (tokens.filter((token) => token.kind === "option" && token.name === "project").length > 1) throw new Error("deploy: --project can only be specified once.");
|
|
86
|
+
if (tokens.filter((token) => token.kind === "option" && token.name === "platform").length > 1) throw new Error("deploy: --platform can only be specified once.");
|
|
87
|
+
if (parsed.positionals.length > 0) throw new Error(`deploy: Unexpected argument '${parsed.positionals[0]}'.`);
|
|
88
|
+
const projectValue = parsed.values.project;
|
|
89
|
+
const projectSlug = typeof projectValue === "string" ? projectValue : void 0;
|
|
90
|
+
if (typeof projectSlug === "string" && projectSlug.startsWith("-")) throw new Error("deploy: --project requires a slug.");
|
|
91
|
+
const dir = typeof parsed.values.dir === "string" ? parsed.values.dir : void 0;
|
|
92
|
+
const spa = parsed.values.spa === true ? true : void 0;
|
|
93
|
+
const skipBuild = parsed.values["skip-build"] === true ? true : void 0;
|
|
94
|
+
const debug = parsed.values.debug === true ? true : void 0;
|
|
95
|
+
const platformValue = typeof parsed.values.platform === "string" ? parsed.values.platform : void 0;
|
|
96
|
+
if (platformValue !== void 0 && platformValue !== "cloudflare" && platformValue !== "nosam") throw new Error("deploy: --platform must be 'cloudflare' or 'nosam'.");
|
|
97
|
+
const platform = platformValue;
|
|
98
|
+
const provision = parsed.values.provision === true ? true : void 0;
|
|
99
|
+
if (provision && platform !== "cloudflare") throw new Error("deploy: --provision requires --platform cloudflare.");
|
|
100
|
+
const requireEmail = parsed.values["require-email"] === true ? true : void 0;
|
|
101
|
+
const atomic = parsed.values.atomic === true ? true : void 0;
|
|
102
|
+
if (requireEmail && platform !== "cloudflare") throw new Error("deploy: --require-email requires --platform cloudflare.");
|
|
103
|
+
if (platform === "cloudflare") {
|
|
104
|
+
if (projectSlug !== void 0) throw new Error("deploy: --project is not supported with --platform cloudflare — this platform deploys to your own Cloudflare account and no bwf project is involved.");
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
projectSlug,
|
|
108
|
+
dir,
|
|
109
|
+
spa,
|
|
110
|
+
skipBuild,
|
|
111
|
+
skipMigrations: parsed.values["skip-migrations"] === true ? true : void 0,
|
|
112
|
+
debug,
|
|
113
|
+
platform,
|
|
114
|
+
provision,
|
|
115
|
+
requireEmail,
|
|
116
|
+
atomic
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// src/cli/auth-args.ts
|
|
120
|
+
const authSubcommands = [
|
|
121
|
+
{
|
|
122
|
+
name: "login",
|
|
123
|
+
description: "Sign in to the selected deployment destination"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "status",
|
|
127
|
+
description: "Show the selected destination’s signed-in identity"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "logout",
|
|
131
|
+
description: "Sign out of the selected deployment destination"
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
function parseAuthArgs(args) {
|
|
135
|
+
const [subcommand, ...rest] = args;
|
|
136
|
+
if (!subcommand || ![
|
|
137
|
+
"login",
|
|
138
|
+
"logout",
|
|
139
|
+
"status"
|
|
140
|
+
].includes(subcommand)) throw new Error("auth: Usage: bwf auth <login|status|logout> [--platform cloudflare|nosam].");
|
|
141
|
+
let platform;
|
|
142
|
+
for (let index = 0; index < rest.length; index++) {
|
|
143
|
+
const value = rest[index];
|
|
144
|
+
if (value === "--platform") {
|
|
145
|
+
const target = rest[++index];
|
|
146
|
+
if (target !== "cloudflare" && target !== "nosam") throw new Error("auth: --platform must be cloudflare or bwf.");
|
|
147
|
+
if (platform) throw new Error("auth: --platform may be supplied only once.");
|
|
148
|
+
platform = target;
|
|
149
|
+
} else throw new Error(`auth: Unexpected argument '${value}'.`);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
subcommand,
|
|
153
|
+
...platform ? { platform } : {}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// src/cli/build-args.ts
|
|
157
|
+
const buildSubcommands = [{
|
|
158
|
+
name: "logs",
|
|
159
|
+
arg: "[build]",
|
|
160
|
+
description: "Stream, tail, or download logs for a build"
|
|
161
|
+
}];
|
|
162
|
+
function parseBuildArgs(args) {
|
|
163
|
+
const subcommand = args[0];
|
|
164
|
+
const rest = args.slice(1);
|
|
165
|
+
if (subcommand !== "logs") throw new Error("build: Usage: bwf build logs [build] [--follow] [--output <file>] [--project <slug>].");
|
|
166
|
+
let buildId;
|
|
167
|
+
let follow = false;
|
|
168
|
+
let output;
|
|
169
|
+
let projectName;
|
|
170
|
+
for (let i = 0; i < rest.length; i++) {
|
|
171
|
+
const arg = rest[i];
|
|
172
|
+
if (arg === "-f" || arg === "--follow") follow = true;
|
|
173
|
+
else if (arg === "-o" || arg === "--output") {
|
|
174
|
+
if (i + 1 >= rest.length) throw new Error("build: --output requires a value.");
|
|
175
|
+
const value = rest[++i];
|
|
176
|
+
if (value.trim() === "") throw new Error("build: --output requires a value.");
|
|
177
|
+
output = value;
|
|
178
|
+
} else if (arg === "-p" || arg === "--project") {
|
|
179
|
+
if (i + 1 >= rest.length) throw new Error("build: --project requires a value.");
|
|
180
|
+
const value = rest[++i];
|
|
181
|
+
if (value.trim() === "") throw new Error("build: --project requires a value.");
|
|
182
|
+
projectName = value;
|
|
183
|
+
} else if (arg.startsWith("-")) throw new Error(`build: Unexpected argument '${arg}'.`);
|
|
184
|
+
else if (buildId) throw new Error(`build: Unexpected argument '${arg}'.`);
|
|
185
|
+
else buildId = arg;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
subcommand,
|
|
189
|
+
buildId,
|
|
190
|
+
follow,
|
|
191
|
+
output,
|
|
192
|
+
projectName
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
// src/cli/cloudflare-args.ts
|
|
196
|
+
const cloudflareSubcommands = [
|
|
197
|
+
{
|
|
198
|
+
name: "login",
|
|
199
|
+
description: "Sign in or switch Cloudflare users securely"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "status",
|
|
203
|
+
description: "Show Cloudflare identity and the pinned deployment account"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "logout",
|
|
207
|
+
description: "Remove the local Cloudflare browser session"
|
|
208
|
+
}
|
|
209
|
+
];
|
|
210
|
+
function parseCloudflareArgs(args) {
|
|
211
|
+
const [subcommand, extra] = args;
|
|
212
|
+
if (!subcommand || ![
|
|
213
|
+
"login",
|
|
214
|
+
"status",
|
|
215
|
+
"logout"
|
|
216
|
+
].includes(subcommand)) throw new Error("cloudflare: Usage: bwf cloudflare <login|status|logout>.");
|
|
217
|
+
if (extra) throw new Error(`cloudflare: Unexpected argument '${extra}'.`);
|
|
218
|
+
return { subcommand };
|
|
219
|
+
}
|
|
220
|
+
// src/cli/connect-args.ts
|
|
221
|
+
function parseConnectArgs(args) {
|
|
222
|
+
const { values, positionals } = parseArgs({
|
|
223
|
+
args,
|
|
224
|
+
allowPositionals: true,
|
|
225
|
+
strict: true,
|
|
226
|
+
options: {
|
|
227
|
+
platform: { type: "string" },
|
|
228
|
+
"no-login": { type: "boolean" }
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
if (positionals.length > 1) throw new Error("connect: Expected at most one platform URL.");
|
|
232
|
+
const platform = values.platform ?? null;
|
|
233
|
+
if (platform !== null && platform !== "cloudflare" && platform !== "nosam") throw new Error("connect: --platform must be cloudflare or bwf.");
|
|
234
|
+
if (platform === "cloudflare" && (positionals.length > 0 || values["no-login"])) throw new Error("connect: A URL and --no-login are only supported for bwf platforms.");
|
|
235
|
+
return {
|
|
236
|
+
url: positionals[0] ?? "",
|
|
237
|
+
platform,
|
|
238
|
+
noLogin: values["no-login"] ?? false
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
// src/cli/db-args.ts
|
|
242
|
+
const dbSubcommands = [
|
|
243
|
+
{
|
|
244
|
+
name: "push",
|
|
245
|
+
description: "Push schema to the development database (no migration files)"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "generate",
|
|
249
|
+
description: "Generate SQL migrations from schema changes"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "status",
|
|
253
|
+
description: "Show migration status (local + remote)"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "reset",
|
|
257
|
+
description: "Reset local DB and re-run migrations"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "seed",
|
|
261
|
+
description: "Reset local DB, run migrations, and seed",
|
|
262
|
+
flags: [{
|
|
263
|
+
name: "--file",
|
|
264
|
+
arg: "<path>",
|
|
265
|
+
description: "Seed from a specific file"
|
|
266
|
+
}]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "execute",
|
|
270
|
+
arg: "<sql>",
|
|
271
|
+
description: "Run SQL against the database (use --remote for the deployed database)",
|
|
272
|
+
flags: [{
|
|
273
|
+
name: "--remote",
|
|
274
|
+
description: "Run against the deployed database"
|
|
275
|
+
}]
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "migrate",
|
|
279
|
+
description: "Apply pending migrations",
|
|
280
|
+
flags: [{
|
|
281
|
+
name: "--remote",
|
|
282
|
+
description: "Apply to the remote database"
|
|
283
|
+
}]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "studio",
|
|
287
|
+
description: "Open Drizzle Studio against the database (use --remote for the deployed PostgreSQL or MySQL database)",
|
|
288
|
+
flags: [{
|
|
289
|
+
name: "--remote",
|
|
290
|
+
description: "Open Studio against the deployed database"
|
|
291
|
+
}]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "set-url",
|
|
295
|
+
description: "Update the external database URL for deployment"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "connect",
|
|
299
|
+
arg: "[connection-string]",
|
|
300
|
+
description: "Connect or provision an external database",
|
|
301
|
+
flags: [
|
|
302
|
+
{
|
|
303
|
+
name: "--provider",
|
|
304
|
+
arg: "<name-or-module>",
|
|
305
|
+
description: "Provision with an adapter"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "--name",
|
|
309
|
+
arg: "<name>",
|
|
310
|
+
description: "Provider project/database name"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: "--region",
|
|
314
|
+
arg: "<region>",
|
|
315
|
+
description: "Provider region identifier"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "--local-only",
|
|
319
|
+
description: "Do not sync a linked bwf project"
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: "restore",
|
|
325
|
+
description: "Restore the deployed D1 database to an earlier point (direct Cloudflare)",
|
|
326
|
+
flags: [
|
|
327
|
+
{
|
|
328
|
+
name: "--bookmark",
|
|
329
|
+
arg: "<bookmark>",
|
|
330
|
+
description: "Restore point printed by deploy (or use --timestamp)"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "--timestamp",
|
|
334
|
+
arg: "<iso-time>",
|
|
335
|
+
description: "Time to restore to, with Z or an offset (or use --bookmark)"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: "--platform",
|
|
339
|
+
arg: "cloudflare",
|
|
340
|
+
description: "Restore after a one-off deploy with --platform cloudflare"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "--yes",
|
|
344
|
+
description: "Skip the confirmation prompt"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: "rename-migrations",
|
|
350
|
+
description: "Rename migrations to timestamp-based format"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "export",
|
|
354
|
+
description: "Export local database as SQL",
|
|
355
|
+
flags: [
|
|
356
|
+
{
|
|
357
|
+
name: "--output",
|
|
358
|
+
arg: "<path>",
|
|
359
|
+
description: "Export to a specific file path"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "--no-data",
|
|
363
|
+
description: "Schema only (no INSERT statements)"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
name: "--no-schema",
|
|
367
|
+
description: "Data only (no CREATE TABLE)"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: "--table",
|
|
371
|
+
arg: "<name>",
|
|
372
|
+
description: "Export a single table"
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
];
|
|
377
|
+
const MAX_POSITIONALS = {
|
|
378
|
+
push: 0,
|
|
379
|
+
generate: 0,
|
|
380
|
+
status: 0,
|
|
381
|
+
reset: 0,
|
|
382
|
+
seed: 0,
|
|
383
|
+
execute: 1,
|
|
384
|
+
migrate: 0,
|
|
385
|
+
studio: 0,
|
|
386
|
+
"set-url": 0,
|
|
387
|
+
connect: 1,
|
|
388
|
+
restore: 0,
|
|
389
|
+
"rename-migrations": 0,
|
|
390
|
+
export: 0
|
|
391
|
+
};
|
|
392
|
+
const ACTION_FLAGS = {
|
|
393
|
+
push: [],
|
|
394
|
+
generate: [],
|
|
395
|
+
status: [],
|
|
396
|
+
reset: ["yes"],
|
|
397
|
+
seed: ["file", "yes"],
|
|
398
|
+
execute: ["file", "remote"],
|
|
399
|
+
migrate: ["remote"],
|
|
400
|
+
studio: ["remote"],
|
|
401
|
+
"set-url": [],
|
|
402
|
+
connect: [
|
|
403
|
+
"provider",
|
|
404
|
+
"name",
|
|
405
|
+
"region",
|
|
406
|
+
"local-only"
|
|
407
|
+
],
|
|
408
|
+
restore: [
|
|
409
|
+
"bookmark",
|
|
410
|
+
"timestamp",
|
|
411
|
+
"platform",
|
|
412
|
+
"yes"
|
|
413
|
+
],
|
|
414
|
+
"rename-migrations": [],
|
|
415
|
+
export: [
|
|
416
|
+
"output",
|
|
417
|
+
"no-data",
|
|
418
|
+
"no-schema",
|
|
419
|
+
"table"
|
|
420
|
+
]
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Read a restore time as a UTC ISO string. A time without a zone would depend on where the
|
|
424
|
+
* command runs, `new Date` rolls impossible dates over (Feb 30 becomes Mar 2), and it keeps only
|
|
425
|
+
* milliseconds, so all three are rejected instead of restoring to a moment the user did not write.
|
|
426
|
+
*/
|
|
427
|
+
function parseRestoreTime(value) {
|
|
428
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(?:Z|([+-])(\d{2}):(\d{2}))$/i.exec(value);
|
|
429
|
+
const time = new Date(value);
|
|
430
|
+
if (!match || Number.isNaN(time.getTime())) return;
|
|
431
|
+
const offsetMinutes = match[7] ? (match[7] === "-" ? -1 : 1) * (Number(match[8]) * 60 + Number(match[9])) : 0;
|
|
432
|
+
const written = new Date(time.getTime() + offsetMinutes * 6e4);
|
|
433
|
+
return [
|
|
434
|
+
written.getUTCFullYear(),
|
|
435
|
+
written.getUTCMonth() + 1,
|
|
436
|
+
written.getUTCDate(),
|
|
437
|
+
written.getUTCHours(),
|
|
438
|
+
written.getUTCMinutes(),
|
|
439
|
+
written.getUTCSeconds()
|
|
440
|
+
].every((field, index) => field === Number(match[index + 1] ?? 0)) ? time.toISOString() : void 0;
|
|
441
|
+
}
|
|
442
|
+
function isDbAction(value) {
|
|
443
|
+
return value !== void 0 && Object.hasOwn(MAX_POSITIONALS, value);
|
|
444
|
+
}
|
|
445
|
+
function parseDbArgs(args) {
|
|
446
|
+
const { values, positionals } = parseArgs({
|
|
447
|
+
args,
|
|
448
|
+
options: {
|
|
449
|
+
file: { type: "string" },
|
|
450
|
+
output: { type: "string" },
|
|
451
|
+
"no-data": { type: "boolean" },
|
|
452
|
+
"no-schema": { type: "boolean" },
|
|
453
|
+
table: { type: "string" },
|
|
454
|
+
remote: { type: "boolean" },
|
|
455
|
+
provider: { type: "string" },
|
|
456
|
+
name: { type: "string" },
|
|
457
|
+
region: { type: "string" },
|
|
458
|
+
"local-only": { type: "boolean" },
|
|
459
|
+
yes: { type: "boolean" },
|
|
460
|
+
bookmark: { type: "string" },
|
|
461
|
+
timestamp: { type: "string" },
|
|
462
|
+
platform: { type: "string" }
|
|
463
|
+
},
|
|
464
|
+
allowPositionals: true,
|
|
465
|
+
strict: true
|
|
466
|
+
});
|
|
467
|
+
const [action, ...rest] = positionals;
|
|
468
|
+
if (!isDbAction(action)) throw new Error("db: Usage: bwf db <push|generate|status|reset|seed|execute|migrate|studio|export|connect|set-url|restore|rename-migrations>.");
|
|
469
|
+
if (action === "export" && values.remote) throw new Error("db: `bwf db export` reads only the local database; --remote is not supported.");
|
|
470
|
+
const unsupported = Object.keys(values).find((flag) => !ACTION_FLAGS[action].includes(flag));
|
|
471
|
+
if (unsupported) throw new Error(`db: \`bwf db ${action}\` does not support --${unsupported}.`);
|
|
472
|
+
const maxPositionals = MAX_POSITIONALS[action];
|
|
473
|
+
if (rest.length > maxPositionals) throw new Error(`db: Unexpected argument '${rest[maxPositionals]}'.`);
|
|
474
|
+
switch (action) {
|
|
475
|
+
case "reset": return {
|
|
476
|
+
action,
|
|
477
|
+
yes: values.yes
|
|
478
|
+
};
|
|
479
|
+
case "seed": return {
|
|
480
|
+
action,
|
|
481
|
+
file: values.file,
|
|
482
|
+
yes: values.yes
|
|
483
|
+
};
|
|
484
|
+
case "execute": {
|
|
485
|
+
const [command] = rest;
|
|
486
|
+
if (!command && !values.file) throw new Error("db: Usage: bwf db execute <sql> or bwf db execute --file <path>.");
|
|
487
|
+
if (command && values.file) throw new Error("db: Provide either SQL inline or --file, not both.");
|
|
488
|
+
return {
|
|
489
|
+
action,
|
|
490
|
+
command,
|
|
491
|
+
file: values.file,
|
|
492
|
+
remote: values.remote
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
case "migrate":
|
|
496
|
+
case "studio": return {
|
|
497
|
+
action,
|
|
498
|
+
remote: values.remote
|
|
499
|
+
};
|
|
500
|
+
case "connect": {
|
|
501
|
+
const [url] = rest;
|
|
502
|
+
if (url && values.provider) throw new Error("db: Provide either a connection string or --provider, not both.");
|
|
503
|
+
return {
|
|
504
|
+
action,
|
|
505
|
+
url,
|
|
506
|
+
provider: values.provider,
|
|
507
|
+
name: values.name,
|
|
508
|
+
region: values.region,
|
|
509
|
+
localOnly: values["local-only"]
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
case "restore": {
|
|
513
|
+
if (values.platform !== void 0 && values.platform !== "cloudflare") throw new Error("db: `bwf db restore --platform` accepts only 'cloudflare'.");
|
|
514
|
+
const platform = values.platform;
|
|
515
|
+
const bookmark = values.bookmark?.trim();
|
|
516
|
+
const timestamp = values.timestamp?.trim();
|
|
517
|
+
if (bookmark && !timestamp) {
|
|
518
|
+
if (!isD1Bookmark(bookmark)) throw new Error("db: --bookmark must be a D1 restore point printed by `bwf deploy`, for example 00000085-0000024c-00004ef2.");
|
|
519
|
+
return {
|
|
520
|
+
action,
|
|
521
|
+
target: { bookmark },
|
|
522
|
+
platform,
|
|
523
|
+
yes: values.yes
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
if (timestamp && !bookmark) {
|
|
527
|
+
const time = parseRestoreTime(timestamp);
|
|
528
|
+
if (!time) throw new Error("db: --timestamp must be a valid ISO 8601 time with Z or an offset and at most millisecond precision, for example 2026-10-16T09:30:00Z.");
|
|
529
|
+
return {
|
|
530
|
+
action,
|
|
531
|
+
target: { timestamp: time },
|
|
532
|
+
platform,
|
|
533
|
+
yes: values.yes
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
throw new Error("db: Usage: bwf db restore --bookmark <bookmark> or bwf db restore --timestamp <iso-time>.");
|
|
537
|
+
}
|
|
538
|
+
case "export": return {
|
|
539
|
+
action,
|
|
540
|
+
output: values.output,
|
|
541
|
+
noData: values["no-data"],
|
|
542
|
+
noSchema: values["no-schema"],
|
|
543
|
+
table: values.table
|
|
544
|
+
};
|
|
545
|
+
default: return { action };
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// src/cli/domain-args.ts
|
|
549
|
+
const domainSubcommands = [
|
|
550
|
+
{
|
|
551
|
+
name: "add",
|
|
552
|
+
arg: "<hostname>",
|
|
553
|
+
description: "Add a custom domain"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "delete",
|
|
557
|
+
arg: "<hostname>",
|
|
558
|
+
description: "Remove a custom domain"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "list",
|
|
562
|
+
description: "List custom domains + status"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: "status",
|
|
566
|
+
arg: "<hostname>",
|
|
567
|
+
description: "Check domain verification status"
|
|
568
|
+
}
|
|
569
|
+
];
|
|
570
|
+
function parseDomainArgs(args) {
|
|
571
|
+
const subcommand = args[0];
|
|
572
|
+
if (!subcommand || ![
|
|
573
|
+
"add",
|
|
574
|
+
"delete",
|
|
575
|
+
"list",
|
|
576
|
+
"status"
|
|
577
|
+
].includes(subcommand)) throw new Error("domain: Usage: bwf domain <add|delete|list|status> [hostname] [--project <name>].");
|
|
578
|
+
let hostname;
|
|
579
|
+
let projectSlug;
|
|
580
|
+
let verbose = false;
|
|
581
|
+
const rest = args.slice(1);
|
|
582
|
+
for (let i = 0; i < rest.length; i++) if (rest[i] === "--project" && rest[i + 1]) projectSlug = rest[++i];
|
|
583
|
+
else if (rest[i] === "--verbose") verbose = true;
|
|
584
|
+
else if (rest[i].startsWith("-")) throw new Error(`domain: Unknown flag '${rest[i]}'.`);
|
|
585
|
+
else if (!hostname) hostname = rest[i];
|
|
586
|
+
if ((subcommand === "add" || subcommand === "delete" || subcommand === "status") && !hostname) throw new Error(`domain: Usage: bwf domain ${subcommand} <hostname> [--project <name>].`);
|
|
587
|
+
return {
|
|
588
|
+
subcommand,
|
|
589
|
+
hostname,
|
|
590
|
+
projectSlug,
|
|
591
|
+
verbose
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
// src/cli/email-args.ts
|
|
595
|
+
const PLATFORM_FLAG = {
|
|
596
|
+
name: "--platform",
|
|
597
|
+
arg: "<cloudflare|nosam>",
|
|
598
|
+
description: "Your own Cloudflare account (`cloudflare`) instead of the bwf platform"
|
|
599
|
+
};
|
|
600
|
+
const emailSubcommands = [
|
|
601
|
+
{
|
|
602
|
+
name: "usage",
|
|
603
|
+
description: "Show monthly recipient attempts, inbound receipts, and quota"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
name: "logs",
|
|
607
|
+
description: "Show recent email delivery activity"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: "destinations",
|
|
611
|
+
description: "List verified recipient addresses for outbound mail"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: "allow",
|
|
615
|
+
arg: "<address>",
|
|
616
|
+
description: "Add a recipient and trigger CF verification"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: "disallow",
|
|
620
|
+
arg: "<address>",
|
|
621
|
+
description: "Remove a verified recipient"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "alias",
|
|
625
|
+
arg: "[name]",
|
|
626
|
+
description: "Show the shared mail address, or set a shorter permanent name for it"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: "domain",
|
|
630
|
+
arg: "<add|status|list|sync|rotate-secret|remove>",
|
|
631
|
+
description: "Send and receive at your own domain on a Cloudflare zone"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
name: "status",
|
|
635
|
+
description: "Show the email setup state on your own Cloudflare account (--platform cloudflare)",
|
|
636
|
+
flags: [PLATFORM_FLAG]
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: "setup",
|
|
640
|
+
description: "Set email up on your own Cloudflare account (--platform cloudflare)",
|
|
641
|
+
flags: [PLATFORM_FLAG]
|
|
642
|
+
}
|
|
643
|
+
];
|
|
644
|
+
const EMAIL_SUBCOMMANDS = [
|
|
645
|
+
"usage",
|
|
646
|
+
"logs",
|
|
647
|
+
"destinations",
|
|
648
|
+
"allow",
|
|
649
|
+
"disallow",
|
|
650
|
+
"alias",
|
|
651
|
+
"domain",
|
|
652
|
+
"status",
|
|
653
|
+
"setup"
|
|
654
|
+
];
|
|
655
|
+
const EMAIL_DOMAIN_VERBS = [
|
|
656
|
+
"add",
|
|
657
|
+
"status",
|
|
658
|
+
"list",
|
|
659
|
+
"sync",
|
|
660
|
+
"rotate-secret",
|
|
661
|
+
"remove"
|
|
662
|
+
];
|
|
663
|
+
/**
|
|
664
|
+
* Read a value-taking flag in its `--flag value` or `--flag=value` form. Returns the
|
|
665
|
+
* raw value, or `undefined` when the flag is the last token or is followed by another
|
|
666
|
+
* option — the same rule `parseArgs` applies for `bwf deploy`, so `--platform --limit 3`
|
|
667
|
+
* is a missing value, not a value of `--limit`.
|
|
668
|
+
*/
|
|
669
|
+
function readFlagValue(rest, i, flag) {
|
|
670
|
+
const token = rest[i];
|
|
671
|
+
if (token.startsWith(`${flag}=`)) return {
|
|
672
|
+
value: token.slice(flag.length + 1),
|
|
673
|
+
next: i
|
|
674
|
+
};
|
|
675
|
+
const value = rest[i + 1];
|
|
676
|
+
if (value === void 0 || value.startsWith("-")) return {
|
|
677
|
+
value: void 0,
|
|
678
|
+
next: i
|
|
679
|
+
};
|
|
680
|
+
return {
|
|
681
|
+
value,
|
|
682
|
+
next: i + 1
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function parseEmailArgs(args) {
|
|
686
|
+
const subcommand = args[0];
|
|
687
|
+
if (!subcommand || !EMAIL_SUBCOMMANDS.includes(subcommand)) throw new Error("email: Usage: bwf email <usage|logs|destinations|allow|disallow|alias|domain|status|setup> [args] [--project <name>] [--limit <n>] [--platform cloudflare].");
|
|
688
|
+
let limit;
|
|
689
|
+
const projectValues = [];
|
|
690
|
+
const platformValues = [];
|
|
691
|
+
const positional = [];
|
|
692
|
+
let yes = false;
|
|
693
|
+
const rest = args.slice(1);
|
|
694
|
+
for (let i = 0; i < rest.length; i++) if (rest[i] === "--project" || rest[i]?.startsWith("--project=")) {
|
|
695
|
+
const { value, next } = readFlagValue(rest, i, "--project");
|
|
696
|
+
if (value === void 0 || value.trim() === "") throw new Error("email: --project requires a value (a project name).");
|
|
697
|
+
projectValues.push(value);
|
|
698
|
+
i = next;
|
|
699
|
+
} else if (rest[i] === "--limit" || rest[i]?.startsWith("--limit=")) {
|
|
700
|
+
const { value: raw, next } = readFlagValue(rest, i, "--limit");
|
|
701
|
+
if (raw === void 0) throw new Error("email: --limit requires a value (a positive integer).");
|
|
702
|
+
const n = parseInt(raw, 10);
|
|
703
|
+
if (!Number.isFinite(n) || n <= 0) throw new Error(`email: --limit must be a positive integer (got '${raw}').`);
|
|
704
|
+
limit = n;
|
|
705
|
+
i = next;
|
|
706
|
+
} else if (rest[i] === "--platform" || rest[i]?.startsWith("--platform=")) {
|
|
707
|
+
const { value, next } = readFlagValue(rest, i, "--platform");
|
|
708
|
+
if (value === void 0) throw new Error("email: --platform requires a value ('cloudflare' or 'nosam').");
|
|
709
|
+
platformValues.push(value);
|
|
710
|
+
i = next;
|
|
711
|
+
} else if (rest[i] === "--yes" && subcommand === "alias") yes = true;
|
|
712
|
+
else if (rest[i] === "--backend" || rest[i]?.startsWith("--backend=")) throw new Error("email: Unknown option '--backend'.");
|
|
713
|
+
else if (rest[i] === "--subdomain" || rest[i]?.startsWith("--subdomain=")) throw new Error("email: Unknown option '--subdomain'.");
|
|
714
|
+
else positional.push(rest[i]);
|
|
715
|
+
if (projectValues.length > 1) throw new Error("email: --project can only be specified once.");
|
|
716
|
+
const projectSlug = projectValues[0];
|
|
717
|
+
if (platformValues.length > 1) throw new Error("email: --platform can only be specified once.");
|
|
718
|
+
let platform;
|
|
719
|
+
const platformValue = platformValues[0];
|
|
720
|
+
if (platformValue !== void 0) {
|
|
721
|
+
if (platformValue !== "cloudflare" && platformValue !== "nosam") throw new Error("email: --platform must be 'cloudflare' or 'nosam'.");
|
|
722
|
+
platform = platformValue;
|
|
723
|
+
}
|
|
724
|
+
if (subcommand === "domain") {
|
|
725
|
+
if (platform === "cloudflare") throw new Error("email: --platform cloudflare applies to `bwf email status` and `bwf email setup` only (`domain` is a bwf platform command).");
|
|
726
|
+
return parseEmailDomainArgs(positional, {
|
|
727
|
+
projectSlug,
|
|
728
|
+
limit,
|
|
729
|
+
platform
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
if (positional.length > 1) throw new Error(`email: \`bwf email ${subcommand}\` takes exactly one positional argument (got ${positional.length}: ${positional.map((p) => JSON.stringify(p)).join(", ")}).`);
|
|
733
|
+
const address = positional[0];
|
|
734
|
+
if ((subcommand === "allow" || subcommand === "disallow") && !address) throw new Error(`email: Usage: bwf email ${subcommand} <address> [--project <name>].`);
|
|
735
|
+
if (platform === "cloudflare") {
|
|
736
|
+
if (subcommand !== "status" && subcommand !== "setup") throw new Error(`email: --platform cloudflare applies to \`bwf email status\` and \`bwf email setup\` only (\`${subcommand}\` is a bwf platform command).`);
|
|
737
|
+
if (projectSlug !== void 0) throw new Error("email: --project cannot be combined with --platform cloudflare (it reads the local project, not a bwf project).");
|
|
738
|
+
if (address !== void 0) throw new Error(`email: \`bwf email ${subcommand} --platform cloudflare\` takes no argument.`);
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
subcommand,
|
|
742
|
+
projectSlug,
|
|
743
|
+
limit,
|
|
744
|
+
address,
|
|
745
|
+
platform,
|
|
746
|
+
...yes ? { yes } : {}
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* `bwf email domain <verb> [<domain>]`. The parser only counts positionals; the command
|
|
751
|
+
* and the API validate the domain itself.
|
|
752
|
+
*/
|
|
753
|
+
function parseEmailDomainArgs(positional, flags) {
|
|
754
|
+
const verb = positional[0];
|
|
755
|
+
if (!verb || !EMAIL_DOMAIN_VERBS.includes(verb)) throw new Error("email: Usage: bwf email domain <add|status|list|sync|rotate-secret|remove> [<domain>] [--project <name>].");
|
|
756
|
+
const domain = positional[1];
|
|
757
|
+
if (verb === "list") {
|
|
758
|
+
if (domain !== void 0) throw new Error("email: `bwf email domain list` takes no domain argument.");
|
|
759
|
+
} else if (domain === void 0) throw new Error(`email: Usage: bwf email domain ${verb} <domain> [--project <name>].`);
|
|
760
|
+
if (positional.length > 2) throw new Error(`email: \`bwf email domain ${verb}\` takes exactly one domain argument (got ${positional.length - 1}: ${positional.slice(1).map((p) => JSON.stringify(p)).join(", ")}).`);
|
|
761
|
+
return {
|
|
762
|
+
subcommand: "domain",
|
|
763
|
+
domainVerb: verb,
|
|
764
|
+
domain,
|
|
765
|
+
projectSlug: flags.projectSlug,
|
|
766
|
+
limit: flags.limit,
|
|
767
|
+
platform: flags.platform
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
// src/cli/env-args.ts
|
|
771
|
+
const envSubcommands = [{
|
|
772
|
+
name: "check",
|
|
773
|
+
description: "Validate local .env or required remote secret names",
|
|
774
|
+
flags: [{
|
|
775
|
+
name: "--remote",
|
|
776
|
+
description: "Also check that required keys exist as remote secrets"
|
|
777
|
+
}]
|
|
778
|
+
}, {
|
|
779
|
+
name: "types",
|
|
780
|
+
description: "Regenerate .bwf/env.d.ts from env.ts"
|
|
781
|
+
}];
|
|
782
|
+
function parseEnvArgs(args) {
|
|
783
|
+
const [subcommand, ...rest] = args;
|
|
784
|
+
if (subcommand === "check") {
|
|
785
|
+
const parsed = parseArgs({
|
|
786
|
+
args: rest,
|
|
787
|
+
options: { remote: { type: "boolean" } },
|
|
788
|
+
allowPositionals: true,
|
|
789
|
+
strict: true
|
|
790
|
+
});
|
|
791
|
+
if (parsed.positionals.length > 0) throw new Error(`env: Unexpected argument '${parsed.positionals[0]}'.`);
|
|
792
|
+
return {
|
|
793
|
+
subcommand: "check",
|
|
794
|
+
useRemoteSecrets: !!parsed.values.remote
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
if (subcommand === "types") {
|
|
798
|
+
if (rest.length > 0) throw new Error(`env: Unexpected argument '${rest[0]}'.`);
|
|
799
|
+
return { subcommand: "types" };
|
|
800
|
+
}
|
|
801
|
+
throw new Error("env: Usage: bwf env <check|types>.");
|
|
802
|
+
}
|
|
803
|
+
// src/cli/gen-args.ts
|
|
804
|
+
const genSubcommands = [
|
|
805
|
+
{
|
|
806
|
+
name: "model",
|
|
807
|
+
arg: "<name>",
|
|
808
|
+
description: "Scaffold a Drizzle table, API routes, and DB types",
|
|
809
|
+
followUp: {
|
|
810
|
+
type: "repeat-input",
|
|
811
|
+
placeholder: "name:type or name:type?"
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "migration",
|
|
816
|
+
arg: "<name>",
|
|
817
|
+
description: "Generate an empty migration file"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: "route",
|
|
821
|
+
arg: "<path>",
|
|
822
|
+
description: "Generate a route with handler exports",
|
|
823
|
+
followUp: {
|
|
824
|
+
type: "multi-select",
|
|
825
|
+
flag: "--methods",
|
|
826
|
+
options: [
|
|
827
|
+
{
|
|
828
|
+
value: "get",
|
|
829
|
+
label: "GET",
|
|
830
|
+
selected: true
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
value: "post",
|
|
834
|
+
label: "POST"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
value: "put",
|
|
838
|
+
label: "PUT"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
value: "patch",
|
|
842
|
+
label: "PATCH"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
value: "delete",
|
|
846
|
+
label: "DELETE"
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
name: "middleware",
|
|
853
|
+
arg: "<name>",
|
|
854
|
+
description: "Generate a numbered middleware file"
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
name: "cron",
|
|
858
|
+
arg: "<name>",
|
|
859
|
+
description: "Generate a cron job file"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
name: "queue",
|
|
863
|
+
arg: "<name>",
|
|
864
|
+
description: "Generate a queue consumer file"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: "procedure",
|
|
868
|
+
arg: "<file.name>",
|
|
869
|
+
description: "Generate a procedure, such as contacts.get"
|
|
870
|
+
}
|
|
871
|
+
];
|
|
872
|
+
const COLUMN_TYPES = /* @__PURE__ */ new Set([
|
|
873
|
+
"string",
|
|
874
|
+
"text",
|
|
875
|
+
"datetime",
|
|
876
|
+
"integer",
|
|
877
|
+
"boolean",
|
|
878
|
+
"real",
|
|
879
|
+
"blob"
|
|
880
|
+
]);
|
|
881
|
+
const VALID_METHODS = /* @__PURE__ */ new Set([
|
|
882
|
+
"get",
|
|
883
|
+
"post",
|
|
884
|
+
"put",
|
|
885
|
+
"patch",
|
|
886
|
+
"delete"
|
|
887
|
+
]);
|
|
888
|
+
const NAME_RE = /^[a-z_][a-z0-9_]*$/;
|
|
889
|
+
const NAME_WITH_HYPHENS_RE = /^[a-z_][a-z0-9_-]*$/;
|
|
890
|
+
function parseModelArgs(args) {
|
|
891
|
+
const [name, ...rest] = args;
|
|
892
|
+
if (!name) throw new Error("gen: Usage: bwf gen model <name> [columns...].");
|
|
893
|
+
if (!NAME_RE.test(name)) throw new Error("gen: Model name must be lowercase alphanumeric with underscores and no leading digits.");
|
|
894
|
+
const columns = [];
|
|
895
|
+
for (const col of rest) {
|
|
896
|
+
const match = col.match(/^([a-z_][a-z0-9_]*):([a-z]+)(\?)?$/);
|
|
897
|
+
if (!match) throw new Error(`gen: Invalid column format '${col}'. Use name:type or name:type?.`);
|
|
898
|
+
const [, colName, colType, nullable] = match;
|
|
899
|
+
if (!COLUMN_TYPES.has(colType)) throw new Error(`gen: Unknown column type '${colType}'. Use one of: ${[...COLUMN_TYPES].join(", ")}.`);
|
|
900
|
+
columns.push({
|
|
901
|
+
name: colName,
|
|
902
|
+
type: colType,
|
|
903
|
+
nullable: !!nullable
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return {
|
|
907
|
+
subcommand: "model",
|
|
908
|
+
name,
|
|
909
|
+
columns
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function parseMigrationArgs(args) {
|
|
913
|
+
const [name, extra] = args;
|
|
914
|
+
if (!name) throw new Error("gen: Usage: bwf gen migration <name>.");
|
|
915
|
+
if (extra) throw new Error(`gen: Unexpected argument '${extra}'.`);
|
|
916
|
+
if (!NAME_RE.test(name)) throw new Error("gen: Migration name must be lowercase alphanumeric with underscores and no leading digits.");
|
|
917
|
+
return {
|
|
918
|
+
subcommand: "migration",
|
|
919
|
+
name
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
function parseRouteArgs(args) {
|
|
923
|
+
const parsed = parseArgs({
|
|
924
|
+
args,
|
|
925
|
+
options: { methods: { type: "string" } },
|
|
926
|
+
allowPositionals: true,
|
|
927
|
+
strict: true
|
|
928
|
+
});
|
|
929
|
+
const [routePath, extra] = parsed.positionals;
|
|
930
|
+
if (!routePath) throw new Error("gen: Usage: bwf gen route <path> [--methods get,post,...].");
|
|
931
|
+
if (extra) throw new Error(`gen: Unexpected argument '${extra}'.`);
|
|
932
|
+
let methods = ["get"];
|
|
933
|
+
if (typeof parsed.values.methods === "string") {
|
|
934
|
+
methods = parsed.values.methods.split(",").map((m) => m.trim().toLowerCase());
|
|
935
|
+
for (const m of methods) if (!VALID_METHODS.has(m)) throw new Error(`gen: Unknown HTTP method '${m}'. Use one of: ${[...VALID_METHODS].join(", ")}.`);
|
|
936
|
+
}
|
|
937
|
+
return {
|
|
938
|
+
subcommand: "route",
|
|
939
|
+
path: routePath.replace(/^\/+/, ""),
|
|
940
|
+
methods
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
/** Shared parser for the single-name generators whose names may contain hyphens. */
|
|
944
|
+
function parseHyphenatedNameArgs(args, subcommand, label) {
|
|
945
|
+
const [name, extra] = args;
|
|
946
|
+
if (!name) throw new Error(`gen: Usage: bwf gen ${subcommand} <name>.`);
|
|
947
|
+
if (extra) throw new Error(`gen: Unexpected argument '${extra}'.`);
|
|
948
|
+
if (!NAME_WITH_HYPHENS_RE.test(name)) throw new Error(`gen: ${label} name must be lowercase alphanumeric with underscores or hyphens and no leading digits.`);
|
|
949
|
+
return {
|
|
950
|
+
subcommand,
|
|
951
|
+
name
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
/** `contacts.get` is the `get` export of `procedures/contacts.ts`; `billing.invoices.list` nests. */
|
|
955
|
+
function parseProcedureArgs(args) {
|
|
956
|
+
const [name, extra] = args;
|
|
957
|
+
if (!name) throw new Error("gen: Usage: bwf gen procedure <file.name>, such as contacts.get.");
|
|
958
|
+
if (extra) throw new Error(`gen: Unexpected argument '${extra}'.`);
|
|
959
|
+
const segments = name.split(".");
|
|
960
|
+
if (segments.length < 2 || !segments.every((segment) => NAME_RE.test(segment))) throw new Error("gen: Procedure names are lowercase dot-separated words, such as contacts.get: the last word is the export, the rest is the file.");
|
|
961
|
+
return {
|
|
962
|
+
subcommand: "procedure",
|
|
963
|
+
name
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
function parseGenArgs(args) {
|
|
967
|
+
const [subcommand, ...rest] = args;
|
|
968
|
+
if (subcommand === "model") return parseModelArgs(rest);
|
|
969
|
+
if (subcommand === "migration") return parseMigrationArgs(rest);
|
|
970
|
+
if (subcommand === "route") return parseRouteArgs(rest);
|
|
971
|
+
if (subcommand === "middleware") return parseHyphenatedNameArgs(rest, "middleware", "Middleware");
|
|
972
|
+
if (subcommand === "cron") return parseHyphenatedNameArgs(rest, "cron", "Cron");
|
|
973
|
+
if (subcommand === "queue") return parseHyphenatedNameArgs(rest, "queue", "Queue");
|
|
974
|
+
if (subcommand === "procedure") return parseProcedureArgs(rest);
|
|
975
|
+
throw new Error("gen: Usage: bwf gen <model|migration|route|middleware|cron|queue|procedure>.");
|
|
976
|
+
}
|
|
977
|
+
// src/cli/github-args.ts
|
|
978
|
+
const githubSubcommands = [
|
|
979
|
+
{
|
|
980
|
+
name: "install",
|
|
981
|
+
description: "Open the GitHub App install page in your browser"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
name: "installations",
|
|
985
|
+
description: "List your GitHub App installations"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: "connect",
|
|
989
|
+
arg: "[project]",
|
|
990
|
+
description: "Connect a repository to a project for auto-deploy"
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
name: "update",
|
|
994
|
+
arg: "[project]",
|
|
995
|
+
description: "Update an existing connection's branch, build executor, or deploy workflow"
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "status",
|
|
999
|
+
arg: "[project]",
|
|
1000
|
+
description: "Show a project's GitHub connection (repo, branch, executor, workflow)"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
name: "disconnect",
|
|
1004
|
+
arg: "[project]",
|
|
1005
|
+
description: "Disconnect a project from its GitHub repository"
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
name: "link",
|
|
1009
|
+
description: "Link your GitHub account to bwf"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "join",
|
|
1013
|
+
description: "Join your organization's shared GitHub App installations"
|
|
1014
|
+
}
|
|
1015
|
+
];
|
|
1016
|
+
function parseExecutor(value) {
|
|
1017
|
+
if (value !== "container" && value !== "github_actions") throw new Error("github: invalid --executor (expected container|github_actions).");
|
|
1018
|
+
return value;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Parses `[project] [flags]`, where `--project <name>` is an alias for the
|
|
1022
|
+
* positional. Value flags require a non-blank value and receive it untrimmed.
|
|
1023
|
+
*/
|
|
1024
|
+
function parseProjectArgs$1(rest, valueFlags, booleanFlags = {}) {
|
|
1025
|
+
let projectName = "";
|
|
1026
|
+
for (let i = 0; i < rest.length; i++) {
|
|
1027
|
+
const arg = rest[i];
|
|
1028
|
+
if (Object.hasOwn(booleanFlags, arg)) {
|
|
1029
|
+
booleanFlags[arg]();
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
if (arg !== "--project" && !Object.hasOwn(valueFlags, arg)) {
|
|
1033
|
+
if (arg.startsWith("-") || projectName) throw new Error(`github: Unexpected argument '${arg}'.`);
|
|
1034
|
+
projectName = arg;
|
|
1035
|
+
continue;
|
|
1036
|
+
}
|
|
1037
|
+
const value = rest[++i];
|
|
1038
|
+
if (value === void 0 || value.trim() === "") throw new Error(`github: ${arg} requires a value.`);
|
|
1039
|
+
if (arg !== "--project") valueFlags[arg](value);
|
|
1040
|
+
else if (projectName) throw new Error(`github: Unexpected argument '${value}'.`);
|
|
1041
|
+
else projectName = value;
|
|
1042
|
+
}
|
|
1043
|
+
return projectName;
|
|
1044
|
+
}
|
|
1045
|
+
function parseGithubArgs(args) {
|
|
1046
|
+
const [subcommand, ...rest] = args;
|
|
1047
|
+
if (subcommand === "install" || subcommand === "installations" || subcommand === "link" || subcommand === "join") {
|
|
1048
|
+
if (rest.length > 0) throw new Error(`github: Unexpected argument '${rest[0]}'.`);
|
|
1049
|
+
return { subcommand };
|
|
1050
|
+
}
|
|
1051
|
+
if (subcommand === "connect") {
|
|
1052
|
+
const parsed = {
|
|
1053
|
+
subcommand,
|
|
1054
|
+
projectName: ""
|
|
1055
|
+
};
|
|
1056
|
+
parsed.projectName = parseProjectArgs$1(rest, {
|
|
1057
|
+
"--installation": (value) => {
|
|
1058
|
+
parsed.installationId = value;
|
|
1059
|
+
},
|
|
1060
|
+
"--repo": (value) => {
|
|
1061
|
+
parsed.repo = value;
|
|
1062
|
+
},
|
|
1063
|
+
"--branch": (value) => {
|
|
1064
|
+
parsed.branch = value;
|
|
1065
|
+
},
|
|
1066
|
+
"--executor": (value) => {
|
|
1067
|
+
parsed.executor = parseExecutor(value);
|
|
1068
|
+
},
|
|
1069
|
+
"--workflow": (value) => {
|
|
1070
|
+
parsed.workflowPath = value.trim();
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
return parsed;
|
|
1074
|
+
}
|
|
1075
|
+
if (subcommand === "update") {
|
|
1076
|
+
const parsed = {
|
|
1077
|
+
subcommand,
|
|
1078
|
+
projectName: ""
|
|
1079
|
+
};
|
|
1080
|
+
parsed.projectName = parseProjectArgs$1(rest, {
|
|
1081
|
+
"--branch": (value) => {
|
|
1082
|
+
parsed.branch = value.trim();
|
|
1083
|
+
},
|
|
1084
|
+
"--executor": (value) => {
|
|
1085
|
+
parsed.executor = parseExecutor(value);
|
|
1086
|
+
},
|
|
1087
|
+
"--workflow": (value) => {
|
|
1088
|
+
parsed.workflowPath = value.trim();
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
return parsed;
|
|
1092
|
+
}
|
|
1093
|
+
if (subcommand === "status") return {
|
|
1094
|
+
subcommand,
|
|
1095
|
+
projectName: parseProjectArgs$1(rest, {})
|
|
1096
|
+
};
|
|
1097
|
+
if (subcommand === "disconnect") {
|
|
1098
|
+
let yes = false;
|
|
1099
|
+
const confirm = () => {
|
|
1100
|
+
yes = true;
|
|
1101
|
+
};
|
|
1102
|
+
return {
|
|
1103
|
+
subcommand,
|
|
1104
|
+
projectName: parseProjectArgs$1(rest, {}, {
|
|
1105
|
+
"--yes": confirm,
|
|
1106
|
+
"-y": confirm
|
|
1107
|
+
}),
|
|
1108
|
+
yes
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
throw new Error("github: Usage: bwf github <install|installations|connect|update|status|disconnect|link|join>.");
|
|
1112
|
+
}
|
|
1113
|
+
// src/cli/info-args.ts
|
|
1114
|
+
function parseInfoArgs(args) {
|
|
1115
|
+
const parsed = parseArgs({
|
|
1116
|
+
args,
|
|
1117
|
+
options: { json: { type: "boolean" } },
|
|
1118
|
+
allowPositionals: true,
|
|
1119
|
+
strict: true
|
|
1120
|
+
});
|
|
1121
|
+
if (parsed.positionals.length > 0) throw new Error(`info: Unexpected argument '${parsed.positionals[0]}'.`);
|
|
1122
|
+
return { json: parsed.values.json ?? false };
|
|
1123
|
+
}
|
|
1124
|
+
// src/cli/prepare-args.ts
|
|
1125
|
+
function parsePrepareArgs(args) {
|
|
1126
|
+
const parsed = parseArgs({
|
|
1127
|
+
args,
|
|
1128
|
+
options: {},
|
|
1129
|
+
allowPositionals: true,
|
|
1130
|
+
strict: true
|
|
1131
|
+
});
|
|
1132
|
+
if (parsed.positionals.length > 0) throw new Error(`prepare: Unexpected argument '${parsed.positionals[0]}'.`);
|
|
1133
|
+
}
|
|
1134
|
+
// src/cli/project-args.ts
|
|
1135
|
+
const LOG_LEVELS = /* @__PURE__ */ new Set([
|
|
1136
|
+
"error",
|
|
1137
|
+
"warn",
|
|
1138
|
+
"info",
|
|
1139
|
+
"log",
|
|
1140
|
+
"debug",
|
|
1141
|
+
"all"
|
|
1142
|
+
]);
|
|
1143
|
+
const STATUS_FILTER = /^([1-5]xx|[1-5]\d{2}|all)$/;
|
|
1144
|
+
const TEAM_ROLES = /* @__PURE__ */ new Set([
|
|
1145
|
+
"reader",
|
|
1146
|
+
"collaborator",
|
|
1147
|
+
"admin"
|
|
1148
|
+
]);
|
|
1149
|
+
const projectSubcommands = [
|
|
1150
|
+
{
|
|
1151
|
+
name: "status",
|
|
1152
|
+
arg: "[name]",
|
|
1153
|
+
description: "Show deployments (omit name for linked project)"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
name: "link",
|
|
1157
|
+
arg: "[name]",
|
|
1158
|
+
description: "Link directory to a project"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
name: "list",
|
|
1162
|
+
description: "List your projects"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
name: "token",
|
|
1166
|
+
arg: "<create|list|renew|revoke>",
|
|
1167
|
+
description: "Manage project-scoped CI deploy credentials"
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
name: "team",
|
|
1171
|
+
hint: "list | invite | invitations | role | remove | revoke | leave | pending | accept | decline",
|
|
1172
|
+
description: "Manage project members and invitations"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
name: "zero-trust",
|
|
1176
|
+
hint: "status | protect | public | reconcile",
|
|
1177
|
+
description: "Inspect or override Cloudflare Zero Trust protection"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
name: "logs",
|
|
1181
|
+
description: "Show runtime logs from the deployed project"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
name: "requests",
|
|
1185
|
+
description: "Show request-level traffic (status, method, timing)"
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
name: "rollback",
|
|
1189
|
+
arg: "[deployId]",
|
|
1190
|
+
description: "Roll back to a previous deployment",
|
|
1191
|
+
flags: [{
|
|
1192
|
+
name: "--platform",
|
|
1193
|
+
arg: "cloudflare",
|
|
1194
|
+
description: "Roll back after a one-off deploy with --platform cloudflare"
|
|
1195
|
+
}]
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
name: "cancel",
|
|
1199
|
+
arg: "[deployId]",
|
|
1200
|
+
description: "Cancel an active deployment"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
name: "delete",
|
|
1204
|
+
arg: "[name]",
|
|
1205
|
+
description: "Delete a project (omit name to delete linked project)"
|
|
1206
|
+
}
|
|
1207
|
+
];
|
|
1208
|
+
function parseProjectArgs(args) {
|
|
1209
|
+
const [subcommand, ...rest] = args;
|
|
1210
|
+
if (subcommand === "status" || subcommand === "link") return {
|
|
1211
|
+
subcommand,
|
|
1212
|
+
name: parseOptionalPositional(rest)
|
|
1213
|
+
};
|
|
1214
|
+
if (subcommand === "list") {
|
|
1215
|
+
if (rest.length > 0) throw new Error(`project: Unexpected argument '${rest[0]}'.`);
|
|
1216
|
+
return { subcommand };
|
|
1217
|
+
}
|
|
1218
|
+
if (subcommand === "token") {
|
|
1219
|
+
const action = rest.shift();
|
|
1220
|
+
if (!action || ![
|
|
1221
|
+
"create",
|
|
1222
|
+
"list",
|
|
1223
|
+
"renew",
|
|
1224
|
+
"revoke"
|
|
1225
|
+
].includes(action)) throw new Error("project: Usage: bwf project token <create|list|renew|revoke>.");
|
|
1226
|
+
let credentialId = "";
|
|
1227
|
+
let projectSlug = "";
|
|
1228
|
+
let name = "";
|
|
1229
|
+
let expiresInDays;
|
|
1230
|
+
let json = false;
|
|
1231
|
+
for (let index = 0; index < rest.length; index++) {
|
|
1232
|
+
const value = rest[index];
|
|
1233
|
+
if (value === "--project" && rest[index + 1]) projectSlug = rest[++index];
|
|
1234
|
+
else if (value === "--name" && rest[index + 1]) name = rest[++index];
|
|
1235
|
+
else if (value === "--expires-in" && rest[index + 1]) {
|
|
1236
|
+
const parsed = Number(rest[++index]);
|
|
1237
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 90) throw new Error("project: --expires-in must be an integer from 1 to 90 days.");
|
|
1238
|
+
expiresInDays = parsed;
|
|
1239
|
+
} else if (value === "--json") json = true;
|
|
1240
|
+
else if (value.startsWith("-")) throw new Error(`project: Unknown flag '${value}'.`);
|
|
1241
|
+
else if ((action === "renew" || action === "revoke") && !credentialId) credentialId = value;
|
|
1242
|
+
else throw new Error(`project: Unexpected argument '${value}'.`);
|
|
1243
|
+
}
|
|
1244
|
+
if ((action === "renew" || action === "revoke") && !credentialId) throw new Error(`project: ${action} requires a credential ID.`);
|
|
1245
|
+
if (action !== "create" && name) throw new Error("project: --name is only valid with token create.");
|
|
1246
|
+
if (action !== "create" && action !== "renew" && expiresInDays !== void 0) throw new Error("project: --expires-in is only valid with token create or token renew.");
|
|
1247
|
+
return {
|
|
1248
|
+
subcommand,
|
|
1249
|
+
action,
|
|
1250
|
+
credentialId,
|
|
1251
|
+
projectSlug,
|
|
1252
|
+
name,
|
|
1253
|
+
expiresInDays,
|
|
1254
|
+
json
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
if (subcommand === "team") return parseTeamArgs(rest);
|
|
1258
|
+
if (subcommand === "zero-trust") {
|
|
1259
|
+
const [action = "", ...args] = rest;
|
|
1260
|
+
if (action && ![
|
|
1261
|
+
"status",
|
|
1262
|
+
"protect",
|
|
1263
|
+
"public",
|
|
1264
|
+
"reconcile"
|
|
1265
|
+
].includes(action)) throw new Error("project: Usage: bwf project zero-trust <status|protect|public|reconcile> [--project <slug>].");
|
|
1266
|
+
let projectSlug = "";
|
|
1267
|
+
for (let index = 0; index < args.length; index++) {
|
|
1268
|
+
const arg = args[index];
|
|
1269
|
+
if (arg === "--project") {
|
|
1270
|
+
const value = args[++index];
|
|
1271
|
+
if (!value || value.startsWith("-")) throw new Error("project: --project requires a value.");
|
|
1272
|
+
if (projectSlug) throw new Error("project: Duplicate flag '--project'.");
|
|
1273
|
+
projectSlug = value;
|
|
1274
|
+
} else throw new Error(`project: Unexpected argument '${arg}'.`);
|
|
1275
|
+
}
|
|
1276
|
+
return {
|
|
1277
|
+
subcommand,
|
|
1278
|
+
action,
|
|
1279
|
+
projectSlug
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
if (subcommand === "logs") {
|
|
1283
|
+
let filter = "";
|
|
1284
|
+
let range = "1h";
|
|
1285
|
+
let deployment = "";
|
|
1286
|
+
let level = "";
|
|
1287
|
+
for (let i = 0; i < rest.length; i++) if (rest[i] === "--filter" && rest[i + 1]) filter = rest[++i];
|
|
1288
|
+
else if (rest[i] === "--range" && rest[i + 1]) range = rest[++i];
|
|
1289
|
+
else if (rest[i] === "--deployment" && rest[i + 1]) deployment = rest[++i];
|
|
1290
|
+
else if (rest[i] === "--level" && rest[i + 1]) {
|
|
1291
|
+
const value = rest[++i];
|
|
1292
|
+
if (!LOG_LEVELS.has(value)) throw new Error(`project: Invalid --level '${value}'. Use one of error|warn|info|log|debug|all.`);
|
|
1293
|
+
level = value;
|
|
1294
|
+
} else throw new Error(`project: Unexpected argument '${rest[i]}'.`);
|
|
1295
|
+
return {
|
|
1296
|
+
subcommand,
|
|
1297
|
+
filter,
|
|
1298
|
+
range,
|
|
1299
|
+
deployment,
|
|
1300
|
+
level
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
if (subcommand === "requests") {
|
|
1304
|
+
let status = "";
|
|
1305
|
+
let range = "1h";
|
|
1306
|
+
for (let i = 0; i < rest.length; i++) if (rest[i] === "--status" && rest[i + 1]) {
|
|
1307
|
+
const value = rest[++i];
|
|
1308
|
+
if (!STATUS_FILTER.test(value)) throw new Error(`project: Invalid --status '${value}'. Use a class like 5xx or an exact code like 500.`);
|
|
1309
|
+
status = value;
|
|
1310
|
+
} else if (rest[i] === "--range" && rest[i + 1]) range = rest[++i];
|
|
1311
|
+
else throw new Error(`project: Unexpected argument '${rest[i]}'.`);
|
|
1312
|
+
return {
|
|
1313
|
+
subcommand,
|
|
1314
|
+
status,
|
|
1315
|
+
range
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
if (subcommand === "rollback") {
|
|
1319
|
+
let platform;
|
|
1320
|
+
const positional = [];
|
|
1321
|
+
for (let i = 0; i < rest.length; i++) {
|
|
1322
|
+
const arg = rest[i];
|
|
1323
|
+
if (arg === "--platform" || arg.startsWith("--platform=")) {
|
|
1324
|
+
const value = arg === "--platform" ? rest[++i] : arg.slice(11);
|
|
1325
|
+
if (value !== "cloudflare") throw new Error(`project: \`rollback --platform\` accepts only 'cloudflare', got '${value ?? ""}'.`);
|
|
1326
|
+
platform = "cloudflare";
|
|
1327
|
+
} else positional.push(arg);
|
|
1328
|
+
}
|
|
1329
|
+
return {
|
|
1330
|
+
subcommand,
|
|
1331
|
+
deployId: parseOptionalPositional(positional),
|
|
1332
|
+
...platform ? { platform } : {}
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
if (subcommand === "cancel") return {
|
|
1336
|
+
subcommand,
|
|
1337
|
+
deployId: parseOptionalPositional(rest)
|
|
1338
|
+
};
|
|
1339
|
+
if (subcommand === "delete") {
|
|
1340
|
+
let name = "";
|
|
1341
|
+
let force = false;
|
|
1342
|
+
for (const arg of rest) if (arg === "--force" || arg === "-f") force = true;
|
|
1343
|
+
else if (arg.startsWith("-")) throw new Error(`project: Unknown flag '${arg}'.`);
|
|
1344
|
+
else if (name) throw new Error(`project: Unexpected argument '${arg}'.`);
|
|
1345
|
+
else name = arg;
|
|
1346
|
+
return {
|
|
1347
|
+
subcommand,
|
|
1348
|
+
name,
|
|
1349
|
+
force
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
throw new Error("project: Usage: bwf project <status|link|list|team|token|zero-trust|logs|requests|rollback|cancel|delete>.");
|
|
1353
|
+
}
|
|
1354
|
+
function parseOptionalPositional(rest) {
|
|
1355
|
+
const [value, extra] = rest;
|
|
1356
|
+
if (value?.startsWith("-")) throw new Error(`project: Unknown flag '${value}'.`);
|
|
1357
|
+
if (extra) throw new Error(`project: Unexpected argument '${extra}'.`);
|
|
1358
|
+
return value ?? "";
|
|
1359
|
+
}
|
|
1360
|
+
function parseTeamArgs(rest) {
|
|
1361
|
+
const [action, ...args] = rest;
|
|
1362
|
+
const usage = "project: Usage: bwf project team <list|invite|invitations|role|remove|revoke|leave|pending|accept|decline>.";
|
|
1363
|
+
if (!action) return {
|
|
1364
|
+
subcommand: "team",
|
|
1365
|
+
action: ""
|
|
1366
|
+
};
|
|
1367
|
+
const positionals = [];
|
|
1368
|
+
let projectSlug = "";
|
|
1369
|
+
let role = "";
|
|
1370
|
+
for (let index = 0; index < args.length; index++) {
|
|
1371
|
+
const arg = args[index];
|
|
1372
|
+
if (arg === "--project" || arg === "--role") {
|
|
1373
|
+
const value = args[++index];
|
|
1374
|
+
if (!value || value.startsWith("-")) throw new Error(`project: ${arg} requires a value.`);
|
|
1375
|
+
if (arg === "--project") {
|
|
1376
|
+
if (projectSlug) throw new Error("project: Duplicate flag '--project'.");
|
|
1377
|
+
projectSlug = value;
|
|
1378
|
+
} else {
|
|
1379
|
+
if (role) throw new Error("project: Duplicate flag '--role'.");
|
|
1380
|
+
role = value;
|
|
1381
|
+
}
|
|
1382
|
+
} else if (arg.startsWith("-")) throw new Error(`project: Unknown flag '${arg}'.`);
|
|
1383
|
+
else positionals.push(arg);
|
|
1384
|
+
}
|
|
1385
|
+
if (role && !TEAM_ROLES.has(role)) throw new Error(`project: Invalid role '${role}'. Use one of reader|collaborator|admin.`);
|
|
1386
|
+
if ([
|
|
1387
|
+
"pending",
|
|
1388
|
+
"accept",
|
|
1389
|
+
"decline"
|
|
1390
|
+
].includes(action) && projectSlug) throw new Error(`project: --project is not used with team ${action}.`);
|
|
1391
|
+
if (action === "list" || action === "invitations" || action === "leave") {
|
|
1392
|
+
if (positionals.length || role) throw new Error(`project: Usage: bwf project team ${action} [--project <slug>].`);
|
|
1393
|
+
return {
|
|
1394
|
+
subcommand: "team",
|
|
1395
|
+
action,
|
|
1396
|
+
projectSlug
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
if (action === "invite") {
|
|
1400
|
+
if (positionals.length !== 1 || !role) throw new Error("project: Usage: bwf project team invite <registered-email> --role <reader|collaborator|admin> [--project <slug>].");
|
|
1401
|
+
const email = positionals[0];
|
|
1402
|
+
if (email.length > 320 || !/^[^\s@]+@[^\s@]+$/.test(email)) throw new Error("project: Invitee must be a registered email address.");
|
|
1403
|
+
return {
|
|
1404
|
+
subcommand: "team",
|
|
1405
|
+
action,
|
|
1406
|
+
email,
|
|
1407
|
+
role,
|
|
1408
|
+
projectSlug
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
if (action === "role") {
|
|
1412
|
+
if (positionals.length !== 2 || role) throw new Error("project: Usage: bwf project team role <user-id> <reader|collaborator|admin> [--project <slug>].");
|
|
1413
|
+
const nextRole = positionals[1];
|
|
1414
|
+
if (!TEAM_ROLES.has(nextRole)) throw new Error(`project: Invalid role '${nextRole}'. Use one of reader|collaborator|admin.`);
|
|
1415
|
+
return {
|
|
1416
|
+
subcommand: "team",
|
|
1417
|
+
action,
|
|
1418
|
+
userId: positionals[0],
|
|
1419
|
+
role: nextRole,
|
|
1420
|
+
projectSlug
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
if (action === "remove") {
|
|
1424
|
+
if (positionals.length !== 1 || role) throw new Error("project: Usage: bwf project team remove <user-id> [--project <slug>].");
|
|
1425
|
+
return {
|
|
1426
|
+
subcommand: "team",
|
|
1427
|
+
action,
|
|
1428
|
+
userId: positionals[0],
|
|
1429
|
+
projectSlug
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
if (action === "revoke") {
|
|
1433
|
+
if (positionals.length !== 1 || role) throw new Error("project: Usage: bwf project team revoke <invitation-id> [--project <slug>].");
|
|
1434
|
+
return {
|
|
1435
|
+
subcommand: "team",
|
|
1436
|
+
action,
|
|
1437
|
+
invitationId: positionals[0],
|
|
1438
|
+
projectSlug
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
if (action === "pending") {
|
|
1442
|
+
if (positionals.length || role) throw new Error("project: Usage: bwf project team pending.");
|
|
1443
|
+
return {
|
|
1444
|
+
subcommand: "team",
|
|
1445
|
+
action
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
if (action === "accept" || action === "decline") {
|
|
1449
|
+
if (positionals.length !== 1 || role) throw new Error(`project: Usage: bwf project team ${action} <invitation-id>.`);
|
|
1450
|
+
return {
|
|
1451
|
+
subcommand: "team",
|
|
1452
|
+
action,
|
|
1453
|
+
invitationId: positionals[0]
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
throw new Error(usage);
|
|
1457
|
+
}
|
|
1458
|
+
// src/cli/secret-args.ts
|
|
1459
|
+
const secretSubcommands = [
|
|
1460
|
+
{
|
|
1461
|
+
name: "list",
|
|
1462
|
+
description: "List project secrets"
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
name: "put",
|
|
1466
|
+
arg: "<name>",
|
|
1467
|
+
description: "Set a project secret"
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
name: "delete",
|
|
1471
|
+
arg: "<name>",
|
|
1472
|
+
description: "Delete a project secret"
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
name: "sync",
|
|
1476
|
+
arg: "<file>",
|
|
1477
|
+
description: "Sync secrets from a dotenv file"
|
|
1478
|
+
}
|
|
1479
|
+
];
|
|
1480
|
+
function parseSecretArgs(args) {
|
|
1481
|
+
const parsed = parseArgs({
|
|
1482
|
+
args,
|
|
1483
|
+
options: {
|
|
1484
|
+
project: { type: "string" },
|
|
1485
|
+
yes: { type: "boolean" }
|
|
1486
|
+
},
|
|
1487
|
+
allowPositionals: true,
|
|
1488
|
+
strict: true,
|
|
1489
|
+
tokens: true
|
|
1490
|
+
});
|
|
1491
|
+
const tokens = parsed.tokens ?? [];
|
|
1492
|
+
if (tokens.filter((t) => t.kind === "option" && t.name === "project").length > 1) throw new Error("secret: --project can only be specified once.");
|
|
1493
|
+
if (tokens.filter((t) => t.kind === "option" && t.name === "yes").length > 1) throw new Error("secret: --yes can only be specified once.");
|
|
1494
|
+
const projectValue = parsed.values.project;
|
|
1495
|
+
const projectName = typeof projectValue === "string" ? projectValue : void 0;
|
|
1496
|
+
if (projectName?.startsWith("-")) throw new Error("secret: --project requires a name.");
|
|
1497
|
+
const [action, name, value, extra] = parsed.positionals;
|
|
1498
|
+
if (parsed.values.yes && action !== "sync") throw new Error(`secret: \`bwf secret ${action}\` does not support --yes.`);
|
|
1499
|
+
if (extra) throw new Error(`secret: Unexpected argument '${extra}'.`);
|
|
1500
|
+
if (action === "list") {
|
|
1501
|
+
if (name) throw new Error("secret: Usage: bwf secret list [--project <name>].");
|
|
1502
|
+
return {
|
|
1503
|
+
action,
|
|
1504
|
+
projectName
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
if (action === "put") {
|
|
1508
|
+
if (!name) throw new Error("secret: Usage: bwf secret put <name> [--project <name>].");
|
|
1509
|
+
if (value) throw new Error("secret: Usage: bwf secret put <name> [--project <name>].");
|
|
1510
|
+
const eqIndex = name.indexOf("=");
|
|
1511
|
+
if (eqIndex === -1) return {
|
|
1512
|
+
action,
|
|
1513
|
+
name,
|
|
1514
|
+
projectName
|
|
1515
|
+
};
|
|
1516
|
+
const key = name.slice(0, eqIndex);
|
|
1517
|
+
const inlineValue = name.slice(eqIndex + 1);
|
|
1518
|
+
if (!key || !inlineValue) throw new Error("secret: Usage: bwf secret put <name> [--project <name>].");
|
|
1519
|
+
return {
|
|
1520
|
+
action,
|
|
1521
|
+
name: key,
|
|
1522
|
+
value: inlineValue,
|
|
1523
|
+
projectName
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
if (action === "delete") {
|
|
1527
|
+
if (!name) throw new Error("secret: Usage: bwf secret delete <name> [--project <name>].");
|
|
1528
|
+
if (value) throw new Error("secret: Usage: bwf secret delete <name> [--project <name>].");
|
|
1529
|
+
return {
|
|
1530
|
+
action,
|
|
1531
|
+
name,
|
|
1532
|
+
projectName
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
if (action === "sync") {
|
|
1536
|
+
if (!name) throw new Error("secret: Usage: bwf secret sync <file> [--project <name>] [--yes].");
|
|
1537
|
+
if (value) throw new Error("secret: Usage: bwf secret sync <file> [--project <name>] [--yes].");
|
|
1538
|
+
return {
|
|
1539
|
+
action,
|
|
1540
|
+
file: name,
|
|
1541
|
+
projectName,
|
|
1542
|
+
yes: parsed.values.yes
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
throw new Error("secret: Usage: bwf secret <list|put|delete|sync> ...");
|
|
1546
|
+
}
|
|
1547
|
+
// src/cli/cli-main.ts
|
|
1548
|
+
function buildArgs(result, trailingArgs) {
|
|
1549
|
+
const out = [result.subcommand];
|
|
1550
|
+
if (result.arg) out.push(result.arg);
|
|
1551
|
+
if (result.extraArgs) out.push(...result.extraArgs);
|
|
1552
|
+
if (result.flags) for (const [flag, value] of Object.entries(result.flags)) {
|
|
1553
|
+
out.push(flag);
|
|
1554
|
+
if (typeof value === "string") out.push(value);
|
|
1555
|
+
}
|
|
1556
|
+
for (const a of trailingArgs) if (a.startsWith("-")) out.push(a);
|
|
1557
|
+
return out;
|
|
1558
|
+
}
|
|
1559
|
+
async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
1560
|
+
const root = process.cwd();
|
|
1561
|
+
const sub = args[1];
|
|
1562
|
+
const hasNamedSubcommand = args.slice(1).some((arg) => subcommands.some(({ name }) => name === arg));
|
|
1563
|
+
try {
|
|
1564
|
+
if ((!sub || sub.startsWith("-") && !hasNamedSubcommand) && process.stdin.isTTY) {
|
|
1565
|
+
const { promptSubcommand } = await import("./subcommand-prompt-B9yUo--u.mjs");
|
|
1566
|
+
if (command === "platform" && !sub) log.info(`A bwf platform lets a team deploy bwf apps to a shared Cloudflare account.
|
|
1567
|
+
This command sets up and manages platforms. Join with \`bwf connect <url>\`.
|
|
1568
|
+
Docs: ${formatUrl("https://github.com/builtbyfriends/platform/blob/main/docs/guide/self-hosted-platform.md")}`);
|
|
1569
|
+
const result = await promptSubcommand(command, subcommands);
|
|
1570
|
+
if (!result) process.exit(0);
|
|
1571
|
+
await run(root, parse(buildArgs(result, args.slice(1))));
|
|
1572
|
+
} else await run(root, parse(args.slice(1)));
|
|
1573
|
+
} catch (err) {
|
|
1574
|
+
if (command === "platform" && args.includes("--json")) {
|
|
1575
|
+
console.error(JSON.stringify(err instanceof OperatorClientError ? err.toJSON() : {
|
|
1576
|
+
error: "invalid_command",
|
|
1577
|
+
message: err instanceof Error ? err.message : String(err)
|
|
1578
|
+
}));
|
|
1579
|
+
process.exit(1);
|
|
1580
|
+
}
|
|
1581
|
+
const message = formatCloudflareUserMessage(err instanceof Error ? err.message : String(err));
|
|
1582
|
+
if (command === "platform") {
|
|
1583
|
+
const platformMessage = message.replace(/^platform:/, import_picocolors.default.bold(import_picocolors.default.red("platform:")));
|
|
1584
|
+
console.error(err instanceof OperatorClientError && err.details !== void 0 ? `${platformMessage}\nPartial result:\n${JSON.stringify(err.details, null, 2)}` : platformMessage);
|
|
1585
|
+
} else log.error(message);
|
|
1586
|
+
process.exit(1);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
const args = process.argv.slice(2);
|
|
1590
|
+
const command = args[0];
|
|
1591
|
+
const helpPath = getHelpPath(args);
|
|
1592
|
+
const subcommandGroups = {
|
|
1593
|
+
auth: () => runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("./auth-router-BG74WFUf.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed))),
|
|
1594
|
+
account: () => runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("./account-cmd-Ddt8lGeL.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed))),
|
|
1595
|
+
platform: () => runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("./platform-cmd-CcFDxtrl.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed))),
|
|
1596
|
+
cloudflare: () => runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("./cloudflare-cmd-Bm6UhzAQ.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed))),
|
|
1597
|
+
project: () => runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("./project-cmd-BydRwr-x.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed))),
|
|
1598
|
+
secret: () => runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("./secret-D5XrWshs.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed))),
|
|
1599
|
+
domain: () => runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("./domain-BJaAbxuQ.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed))),
|
|
1600
|
+
email: () => runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("./email-rIfZgVAB.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed))),
|
|
1601
|
+
db: () => runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("./db-SOv4E9wr.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed))),
|
|
1602
|
+
env: () => runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("./env-BGTu3KWZ.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed))),
|
|
1603
|
+
gen: () => runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("./gen-kQqhFyOP.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed))),
|
|
1604
|
+
github: () => runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("./github-cmd-DT5Onu6E.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed))),
|
|
1605
|
+
build: () => runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("./build-cmd-BnZezraT.mjs").then(({ runBuildCommand }) => runBuildCommand(root, parsed)))
|
|
1606
|
+
};
|
|
1607
|
+
if (helpPath) {
|
|
1608
|
+
if (helpPath.length === 0) printGlobalHelp();
|
|
1609
|
+
else try {
|
|
1610
|
+
printHelpPage(helpPath);
|
|
1611
|
+
} catch (err) {
|
|
1612
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1613
|
+
process.exit(1);
|
|
1614
|
+
}
|
|
1615
|
+
} else if (command === "deploy") {
|
|
1616
|
+
const root = process.cwd();
|
|
1617
|
+
let deployArgs;
|
|
1618
|
+
try {
|
|
1619
|
+
deployArgs = parseDeployArgs(args.slice(1));
|
|
1620
|
+
} catch (err) {
|
|
1621
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1622
|
+
process.exit(1);
|
|
1623
|
+
}
|
|
1624
|
+
import("./deploy-BCSQoKC0.mjs").then(({ runDeploy }) => {
|
|
1625
|
+
runDeploy(root, deployArgs).catch((err) => {
|
|
1626
|
+
log.error(formatCloudflareUserMessage(err.message ?? String(err)));
|
|
1627
|
+
process.exit(1);
|
|
1628
|
+
});
|
|
1629
|
+
});
|
|
1630
|
+
} else if (command === "connect") (async () => {
|
|
1631
|
+
const parsed = parseConnectArgs(args.slice(1));
|
|
1632
|
+
const { runConnectCommand } = await import("./connect-CSNWKLzB.mjs");
|
|
1633
|
+
await runConnectCommand(process.cwd(), parsed);
|
|
1634
|
+
})().catch((err) => {
|
|
1635
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1636
|
+
process.exit(1);
|
|
1637
|
+
});
|
|
1638
|
+
else if (command && Object.hasOwn(subcommandGroups, command)) subcommandGroups[command]();
|
|
1639
|
+
else if (command === "info") import("./info-CLQoCenb.mjs").then(async ({ runInfoCommand }) => {
|
|
1640
|
+
try {
|
|
1641
|
+
await runInfoCommand(process.cwd(), parseInfoArgs(args.slice(1)));
|
|
1642
|
+
} catch (err) {
|
|
1643
|
+
const message = formatCloudflareUserMessage(err instanceof Error ? err.message : String(err));
|
|
1644
|
+
if (args.includes("--json")) console.error(JSON.stringify({
|
|
1645
|
+
error: "invalid_command",
|
|
1646
|
+
message
|
|
1647
|
+
}));
|
|
1648
|
+
else log.error(message);
|
|
1649
|
+
process.exit(1);
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
else if (command === "prepare") {
|
|
1653
|
+
const root = process.cwd();
|
|
1654
|
+
try {
|
|
1655
|
+
parsePrepareArgs(args.slice(1));
|
|
1656
|
+
} catch (err) {
|
|
1657
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1658
|
+
process.exit(1);
|
|
1659
|
+
}
|
|
1660
|
+
import("./prepare-DNIq07so.mjs").then(({ runPrepareCommand }) => {
|
|
1661
|
+
runPrepareCommand(root).catch((err) => {
|
|
1662
|
+
log.error(formatCloudflareUserMessage(err.message ?? String(err)));
|
|
1663
|
+
process.exit(1);
|
|
1664
|
+
});
|
|
1665
|
+
});
|
|
1666
|
+
} else if (command === "init") {
|
|
1667
|
+
const root = process.cwd();
|
|
1668
|
+
import("./init-CXanf5ck.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
1669
|
+
let initArgs;
|
|
1670
|
+
try {
|
|
1671
|
+
initArgs = parseInitArgs(args.slice(1));
|
|
1672
|
+
} catch (err) {
|
|
1673
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1674
|
+
process.exit(1);
|
|
1675
|
+
}
|
|
1676
|
+
runInitCommand(root, initArgs).catch((err) => {
|
|
1677
|
+
log.error(formatCloudflareUserMessage(err.message ?? String(err)));
|
|
1678
|
+
process.exit(1);
|
|
1679
|
+
});
|
|
1680
|
+
});
|
|
1681
|
+
} else if (command === "migrate") {
|
|
1682
|
+
if (args.length > 1) {
|
|
1683
|
+
log.error("migrate: This command takes no arguments.");
|
|
1684
|
+
process.exit(1);
|
|
1685
|
+
}
|
|
1686
|
+
import("./migrate-DjW9_-sS.mjs").then(({ runMigrateCommand }) => {
|
|
1687
|
+
runMigrateCommand(process.cwd()).catch((err) => {
|
|
1688
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1689
|
+
process.exit(1);
|
|
1690
|
+
});
|
|
1691
|
+
});
|
|
1692
|
+
} else if (command === "-v" || command === "--version") console.log(getOwnVersion());
|
|
1693
|
+
else if (command) {
|
|
1694
|
+
log.error(`cli: Unknown command '${command}'. Run \`bwf --help\` for usage.`);
|
|
1695
|
+
process.exit(1);
|
|
1696
|
+
} else if (!command && process.stdin.isTTY) {
|
|
1697
|
+
const topLevelCommands = [
|
|
1698
|
+
{
|
|
1699
|
+
name: "init",
|
|
1700
|
+
hint: "--tsconfig | --github | --git | --no-git",
|
|
1701
|
+
description: "Set up void in a new or existing project"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
name: "migrate",
|
|
1705
|
+
description: "Update project configuration"
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
name: "info",
|
|
1709
|
+
hint: "--json",
|
|
1710
|
+
description: "Inspect persistent resource names in this project"
|
|
1711
|
+
},
|
|
1712
|
+
{
|
|
1713
|
+
name: "connect",
|
|
1714
|
+
description: "Connect to Cloudflare or a bwf platform"
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
name: "deploy",
|
|
1718
|
+
description: "Build and deploy, or link an existing Cloudflare Worker"
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
name: "auth",
|
|
1722
|
+
hint: "login | status | logout",
|
|
1723
|
+
description: "Sign in to this project’s Cloudflare or bwf destination"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
name: "account",
|
|
1727
|
+
hint: "login | link | logout | whoami | token",
|
|
1728
|
+
description: "Manage your bwf platform account"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
name: "platform",
|
|
1732
|
+
hint: [
|
|
1733
|
+
"config",
|
|
1734
|
+
...operatorGroups,
|
|
1735
|
+
"install"
|
|
1736
|
+
].join(" | "),
|
|
1737
|
+
description: "Install platforms and administer plans, users, projects, access, and operations"
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
name: "cloudflare",
|
|
1741
|
+
hint: "login | status | logout",
|
|
1742
|
+
description: "Manage Cloudflare sign-in and inspect the deployment account"
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: "project",
|
|
1746
|
+
hint: "status | link | list | team | token | zero-trust | logs | requests | rollback | cancel | delete",
|
|
1747
|
+
description: "Manage projects, teams, deployments, and scoped CI credentials"
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
name: "secret",
|
|
1751
|
+
hint: "list | put | delete | sync",
|
|
1752
|
+
description: "Manage project secrets"
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
name: "domain",
|
|
1756
|
+
hint: "add | delete | list | status",
|
|
1757
|
+
description: "Configure custom domains"
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
name: "email",
|
|
1761
|
+
hint: "usage | logs | destinations | allow | disallow | alias | domain | status | setup",
|
|
1762
|
+
description: "Inspect email activity and manage verified recipients"
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
name: "github",
|
|
1766
|
+
hint: "install | installations | connect | update | status | disconnect | link | join",
|
|
1767
|
+
description: "Connect a GitHub repository for automatic deploys"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
name: "build",
|
|
1771
|
+
hint: "logs",
|
|
1772
|
+
description: "Inspect remote builds"
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
name: "db",
|
|
1776
|
+
hint: dbSubcommands.map(({ name }) => name).join(" | "),
|
|
1777
|
+
description: "Database migrations and management"
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
name: "env",
|
|
1781
|
+
hint: "check | types",
|
|
1782
|
+
description: "Validate env.ts or generate types"
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
name: "gen",
|
|
1786
|
+
hint: "model | migration | route | middleware | ssr | cron | queue",
|
|
1787
|
+
description: "Scaffold routes, models, and more"
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
name: "prepare",
|
|
1791
|
+
description: "Generate .bwf artifacts without starting Vite"
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
name: "help",
|
|
1795
|
+
description: "Show help message"
|
|
1796
|
+
}
|
|
1797
|
+
];
|
|
1798
|
+
(async () => {
|
|
1799
|
+
printBwfHeader();
|
|
1800
|
+
const { promptSubcommand } = await import("./subcommand-prompt-B9yUo--u.mjs");
|
|
1801
|
+
const result = await promptSubcommand("", topLevelCommands);
|
|
1802
|
+
if (!result) process.exit(0);
|
|
1803
|
+
const cmd = result.subcommand;
|
|
1804
|
+
const root = process.cwd();
|
|
1805
|
+
if (Object.hasOwn(subcommandGroups, cmd)) return subcommandGroups[cmd]();
|
|
1806
|
+
switch (cmd) {
|
|
1807
|
+
case "connect": {
|
|
1808
|
+
const { runConnectCommand } = await import("./connect-CSNWKLzB.mjs");
|
|
1809
|
+
await runConnectCommand(root, parseConnectArgs([]));
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
case "init": {
|
|
1813
|
+
const { runInitCommand, parseInitArgs } = await import("./init-CXanf5ck.mjs");
|
|
1814
|
+
await runInitCommand(root, parseInitArgs([]));
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
case "migrate": {
|
|
1818
|
+
const { runMigrateCommand } = await import("./migrate-DjW9_-sS.mjs");
|
|
1819
|
+
await runMigrateCommand(root);
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
case "deploy": {
|
|
1823
|
+
const { runDeploy } = await import("./deploy-BCSQoKC0.mjs");
|
|
1824
|
+
await runDeploy(root);
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
case "info": {
|
|
1828
|
+
const { runInfoCommand } = await import("./info-CLQoCenb.mjs");
|
|
1829
|
+
await runInfoCommand(root, parseInfoArgs([]));
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
case "prepare": {
|
|
1833
|
+
const { runPrepareCommand } = await import("./prepare-DNIq07so.mjs");
|
|
1834
|
+
await runPrepareCommand(root);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
case "help":
|
|
1838
|
+
printGlobalHelp();
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
})().catch((err) => {
|
|
1842
|
+
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
1843
|
+
process.exit(1);
|
|
1844
|
+
});
|
|
1845
|
+
} else printGlobalHelp();
|
|
1846
|
+
export {};
|