feat(ai-autopilot): cloudflareTarget — first real DeployTarget adapter#159
Merged
Conversation
cloudflareTarget ships the built app to Cloudflare via wrangler, run inside the
build's runner session: install, build, then deploy to Workers (SSR) or Pages
(SSG/SPA), reporting the live URL. Credentials come from apiToken/accountId or
CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID, passed to wrangler via the command
env so they work local or containerized. Never throws: failures come back as
{ deployed: false, detail }.
Closes #157
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #157.
The bootstrap deploy step (#123) exposed the
DeployTargetseam but only shippedplanOnlyTarget/FakeDeployTarget. This adds the first real adapter.cloudflareTarget({ session, ... }):RunnerSessionsatisfies the minimalDeployExecutorsurface it needs.wrangler deploy), Pages for SSG/SPA (wrangler pages deploy <outputDir> --project-name).productcan override the mapping.apiToken/accountIdorCLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID, passed to wrangler viaExecOptions.env(works local or containerized).{ deployed: false, detail }so the final phase narrates instead of crashing the built app. Parses the workers.dev/pages.dev URL from wrangler output.Wire it:
agentDeploy(deployer, { target: cloudflareTarget({ session, projectName }) }).Verification: 10 unit tests with a fake executor (Workers/Pages routing, credential env-passing, missing-token/no-project short-circuits, build+wrangler failure surfacing, skip install/build, product override, URL parsing) — 249 tests green, typecheck+build clean, and a built
import()confirmscloudflareTargetis reachable from the entry. Live deploy against a real Cloudflare account is infra-gated (needs a token +wrangler); that end-to-end proof rides with the demo (#158). Minor changeset.