Skip to content

feat(ai-autopilot): cloudflareTarget — first real DeployTarget adapter#159

Merged
suleimansh merged 1 commit into
mainfrom
feat/cloudflare-deploy-adapter
Jul 2, 2026
Merged

feat(ai-autopilot): cloudflareTarget — first real DeployTarget adapter#159
suleimansh merged 1 commit into
mainfrom
feat/cloudflare-deploy-adapter

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #157.

The bootstrap deploy step (#123) exposed the DeployTarget seam but only shipped planOnlyTarget/FakeDeployTarget. This adds the first real adapter.

cloudflareTarget({ session, ... }):

  • Runs inside the build's runner session (mirrors the runner-adapter pattern: deps injected at construction, no seam-type change). A full RunnerSession satisfies the minimal DeployExecutor surface it needs.
  • install → build → deploy: Workers for SSR (wrangler deploy), Pages for SSG/SPA (wrangler pages deploy <outputDir> --project-name). product can override the mapping.
  • Credentials from apiToken/accountId or CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID, passed to wrangler via ExecOptions.env (works local or containerized).
  • Never throws: missing token, failed build, failed deploy → { 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() confirms cloudflareTarget is 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.

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
@suleimansh suleimansh added enhancement New feature or request priority: high Should be addressed soon labels Jul 2, 2026
@suleimansh suleimansh self-assigned this Jul 2, 2026
@suleimansh suleimansh merged commit 87e6804 into main Jul 2, 2026
2 checks passed
@suleimansh suleimansh deleted the feat/cloudflare-deploy-adapter branch July 2, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high Should be addressed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI framework: Cloudflare deploy adapter (real DeployTarget on the bootstrap seam)

1 participant