chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)

Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Fable 5 authored and GitHub committed 2026-09-17 23:21:25 -07:00
1 parent d547e3b12a
commit e3c85ead63
3824 files changed
+265557 -74892

No files matched your search

-1
View File
@@ -1 +0,0 @@
alchemy/test/**
+1 -2
View File
@@ -1,4 +1,3 @@
* text=auto eol=lf
.vendor/** linguist-vendored
distilled/** linguist-vendored
submodules/** linguist-vendored
Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 KiB

@@ -1,49 +0,0 @@
#!/usr/bin/env bash
# Regenerate the PR screenshots from the built site and commit them if changed.
# Usage: .github/pr-assets/update-screenshots.sh [pr-number]
# Assumes website/dist is freshly built (DOCS_FAST=1 bun astro build).
set -euo pipefail
PR="${1:-721}"
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
OUT="$ROOT/.github/pr-assets/$PR"
DIST="$ROOT/website/dist"
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
PORT=4899
[ -d "$DIST" ] || { echo "website/dist missing — build first"; exit 1; }
mkdir -p "$OUT"
python3 -m http.server "$PORT" --directory "$DIST" >/dev/null 2>&1 &
SERVER_PID=$!
trap 'kill $SERVER_PID 2>/dev/null || true' EXIT
sleep 1
shot() { # shot <file> <path> [extra chrome flags...]
local file="$1" path="$2"; shift 2
"$CHROME" --headless=new --disable-gpu --hide-scrollbars \
--window-size=1600,1000 --virtual-time-budget=6000 \
"$@" --screenshot="$OUT/$file" "http://localhost:$PORT$path" 2>/dev/null
echo "$file: $(wc -c <"$OUT/$file" | tr -d ' ') bytes"
}
shot landing.png /
shot docs-tab.png /getting-started/
shot cloudflare-hub.png /cloudflare/
shot aws-hub.png /aws/
shot planetscale-hub.png /planetscale/
shot axiom-hub.png /axiom/
shot reference.png /providers/cloudflare/workers/durableobject/
shot cloudflare-hub-dark.png /cloudflare/ --force-dark-mode --blink-settings=preferredColorScheme=2
cd "$ROOT"
if git status --porcelain -- ".github/pr-assets/$PR" | grep -q .; then
git add ".github/pr-assets/$PR"
git commit -q -m "chore(website): refresh PR screenshots
Co-Authored-By: Claude Fable 5 <[email protected]>"
git push
echo "screenshots refreshed and pushed"
else
echo "screenshots unchanged"
fi
+10 -7
View File
@@ -6,7 +6,7 @@ on:
push:
branches: [main]
paths:
- "distilled"
- "submodules/distilled"
- "benchmark/**"
- "examples/**"
- "packages/**"
@@ -22,7 +22,7 @@ on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- "distilled"
- "submodules/distilled"
- "benchmark/**"
- "examples/**"
- "packages/**"
@@ -53,17 +53,17 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Restore Astro build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: website/node_modules/.astro
key: website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
key: website-astro-check-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
restore-keys: |
website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-
website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-
website-astro-${{ runner.os }}-main-
website-astro-check-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-
website-astro-check-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-
website-astro-check-${{ runner.os }}-main-
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -84,6 +84,9 @@ jobs:
- name: Run Node Utils tests
run: pnpm -C packages/node-utils test
- name: Run pkg tests
run: pnpm -C packages/pkg test
- name: Run Typecheck
run: pnpm tsc -b
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
fetch-depth: 1
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -4,8 +4,7 @@ on:
push:
branches: [main]
paths:
- "distilled"
- "fixtures/**"
- "submodules/distilled"
- "packages/cloudflare-runtime/**"
- "packages/cloudflare-test-tools/**"
- "packages/frontend-frameworks/**"
@@ -21,8 +20,7 @@ on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- "distilled"
- "fixtures/**"
- "submodules/distilled"
- "packages/cloudflare-runtime/**"
- "packages/cloudflare-test-tools/**"
- "packages/frontend-frameworks/**"
@@ -66,7 +64,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+94
View File
@@ -0,0 +1,94 @@
name: Package Preview
# Builds, packs, and publishes preview packages from the job that built them.
# The job proves it is the run it claims to be by uploading the manifest as
# an artifact of its own run, which only the job's runtime token can do; the
# registry reads the artifact list back through the GitHub API. That works
# the same for pushes, same-repo pull requests, and fork pull requests, and
# needs no permissions or secrets. The upload has to be an action step: the
# runtime token is never exposed to `run:` steps.
on:
push:
branches: [main]
paths:
- "submodules/distilled"
- "packages/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "tsconfig.json"
- ".github/workflows/pkg.yml"
pull_request:
paths:
- "submodules/distilled"
- "packages/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "tsconfig.json"
- ".github/workflows/pkg.yml"
permissions:
contents: read
env:
PKG_REGISTRY: https://pkg.alchemy.run
concurrency:
group: pkg-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
publish:
name: Publish preview packages
runs-on: blacksmith-8vcpu-ubuntu-2404
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Pack the pull request head rather than the synthetic merge commit,
# so every tarball is addressed by a commit that exists on the PR.
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
# No turbo cache here on purpose: the restore keys fall back to any
# earlier run, and replayed outputs for the distilled packages, whose
# sources live in a submodule, have compiled alchemy against stale
# declarations. A clean build is a few minutes and always correct.
- name: Setup pnpm, Node.js, Bun and install dependencies
uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
with:
cache: true
install: true
require-lockfile: true
- name: Build packages
run: pnpm build:pkg
# Keep the directory lists in sync with the `build:pkg` script.
- name: Pack packages
id: pack
run: >-
pnpm exec pkg pack
--group 'alchemy=./packages/alchemy'
--group '@alchemy.run[Collapsed]=./packages/{better-auth,cloudflare-runtime,frontend-frameworks,node-utils,floci,pkg}'
--group '@distilled.cloud[Collapsed]=./submodules/distilled/packages/{core,aws,axiom,cloudflare,fly-io,github,hetzner,neon,planetscale,railway,stripe}'
- name: Vouch for the manifest
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ steps.pack.outputs.artifact-name }}
path: .pkg/pkg-manifest.json
include-hidden-files: true
if-no-files-found: error
retention-days: 1
- name: Publish packages
run: pnpm exec pkg publish
-123
View File
@@ -1,123 +0,0 @@
name: PR Package
on:
push:
branches: [main]
paths:
- "distilled"
- "packages/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "tsconfig.json"
- ".github/workflows/pr-package.yml"
pull_request:
# `labeled` so adding the `force-ci` label re-triggers the run. We
# intentionally do NOT listen to `closed` — pr-package tags persist
# past PR close so existing install URLs keep resolving.
types: [opened, synchronize, reopened, labeled]
paths:
- "distilled"
- "packages/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- "tsconfig.json"
- ".github/workflows/pr-package.yml"
# The action can't widen permissions, so the job must grant write access for
# the sticky install-instructions comment.
permissions:
contents: read
pull-requests: write
concurrency:
group: pr-package-${{ github.ref }}
# A newer PR commit supersedes its preview packages. Never interrupt a main
# publish, where cancellation could leave only part of the package set live.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
pr-package:
name: Publish PR preview packages
if: >-
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.action != 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: blacksmith-8vcpu-ubuntu-2404
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.repository_id }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
restore-keys: |
turbo-${{ runner.os }}-${{ github.repository_id }}-${{ github.sha }}-
turbo-${{ runner.os }}-${{ github.repository_id }}-
# The root install runs Turbo-backed prepare builds, so restore its
# cache before the setup action installs dependencies.
- name: Setup pnpm, Node.js, Bun and install dependencies
uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
with:
cache: true
install: true
require-lockfile: true
- name: Build packages
run: pnpm build:pr-packages
- name: Publish packages
id: publish
uses: alchemy-run/actions/actions/pr-package@098beeda4d3c2ce8850638c4466783893b8f0c23 # actions#11
with:
rebuild-all-paths: distilled
packages: >-
[
{ "dir": "packages/alchemy", "name": "alchemy", "group": "Alchemy" },
{ "dir": "packages/better-auth", "name": "@alchemy.run/better-auth", "group": "Alchemy" },
{ "dir": "packages/cloudflare-runtime", "name": "@alchemy.run/cloudflare-runtime", "group": "Alchemy" },
{ "dir": "packages/frontend-frameworks", "name": "@alchemy.run/frontend-frameworks", "group": "Alchemy" },
{ "dir": "packages/node-utils", "name": "@alchemy.run/node-utils", "group": "Alchemy" },
{ "dir": "packages/pr-package", "name": "@alchemy.run/pr-package", "group": "Alchemy" },
{ "dir": "packages/floci", "name": "@alchemy.run/floci", "group": "Alchemy" },
{ "dir": "distilled/packages/core", "name": "@distilled.cloud/core", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/aws", "name": "@distilled.cloud/aws", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/axiom", "name": "@distilled.cloud/axiom", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/cloudflare", "name": "@distilled.cloud/cloudflare", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/hetzner", "name": "@distilled.cloud/hetzner", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/neon", "name": "@distilled.cloud/neon", "group": "Distilled", "submodule": true },
{ "dir": "distilled/packages/planetscale", "name": "@distilled.cloud/planetscale", "group": "Distilled", "submodule": true }
]
pr-package-token: ${{ secrets.PR_PACKAGE_TOKEN }}
- name: Generate bot token
if: >-
github.event_name == 'pull_request' &&
fromJson(steps.publish.outputs.plan).packages[0] != null
id: bot-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.ALCHEMY_VERSION_BOT_ID }}
private-key: ${{ secrets.ALCHEMY_VERSION_BOT_PRIVATE_KEY }}
- name: Comment on PR
if: >-
github.event_name == 'pull_request' &&
fromJson(steps.publish.outputs.plan).packages[0] != null
uses: alchemy-run/actions/actions/pr-package-comment@098beeda4d3c2ce8850638c4466783893b8f0c23 # actions#11
with:
plan: ${{ steps.publish.outputs.plan }}
token: ${{ steps.bot-token.outputs.token }}
+2 -2
View File
@@ -54,7 +54,7 @@ jobs:
token: ${{ steps.bot-token.outputs.token }}
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -120,7 +120,7 @@ jobs:
fetch-depth: 0
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Setup pnpm, Node.js, Bun
uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
+75 -27
View File
@@ -2,14 +2,20 @@ name: Website
on:
# Manual override — deploys unconditionally on whatever branch it's run
# from (use this to force a prod deploy from main without a release).
# from. Toggle `prod` to force a production deploy without a release.
workflow_dispatch:
inputs:
prod:
description: "Deploy to production (alchemy.run) instead of the branch stage"
type: boolean
default: false
# Release commits update package manifests, so packages/** keeps production
# deploys automatic without redeploying the site for unrelated main commits.
push:
branches:
- main
paths:
- "submodules/distilled"
- "website/**"
- "packages/**"
- "scripts/generate-api-reference.ts"
@@ -18,17 +24,19 @@ on:
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "tsconfig.json"
- "turbo.json"
- ".github/workflows/website.yml"
pull_request:
# `labeled` so adding `deploy-website` on an open PR triggers a
# deploy without needing another push.
# Label changes create and remove previews without needing another push.
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
- closed
paths:
- "submodules/distilled"
- "website/**"
- "packages/**"
- "scripts/generate-api-reference.ts"
@@ -37,15 +45,23 @@ on:
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "tsconfig.json"
- "turbo.json"
- ".github/workflows/website.yml"
concurrency:
group: deploy-website-${{ github.ref }}
group: deploy-website-${{ github.event_name == 'pull_request' &&
format('pr-{0}', github.event.number) || (inputs.prod ||
startsWith(github.event.head_commit.message, 'chore(release):')) &&
'prod' || (github.ref == 'refs/heads/main' && 'main' || github.ref_name)
}}
# Deploy and destroy mutate the same stack and must finish atomically. Each
# run checks the PR's current state before mutation, so queued label events
# converge to the latest desired state even when GitHub reorders them.
cancel-in-progress: false
env:
STAGE: ${{ github.event_name == 'pull_request' && format('pr-{0}',
github.event.number) || (github.event_name == 'workflow_dispatch' ||
github.event.number) || (inputs.prod ||
startsWith(github.event.head_commit.message, 'chore(release):')) && 'prod' ||
(github.ref == 'refs/heads/main' && 'main' || github.ref_name) }}
@@ -53,17 +69,20 @@ jobs:
deploy:
name: Deploy
# Deploy every push to main. Release commits (`chore(release): x.y.z`)
# and manual dispatches deploy production; other main commits deploy to
# main.alchemy.run. On PRs, require BOTH:
# and dispatches with `prod` toggled deploy production; other main
# commits deploy to main.alchemy.run. On PRs, require BOTH:
# - the PR is internal (forks can't access bot/Cloudflare secrets
# so `create-github-app-token` would error immediately), AND
# - the PR carries the `deploy-website` label (opt-in — most PRs
# don't need a website preview, so default to skipping).
if: >-
github.event.action != 'closed' &&
(github.event_name != 'pull_request' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
contains(github.event.pull_request.labels.*.name, 'deploy-website')))
contains(github.event.pull_request.labels.*.name, 'deploy-website') &&
github.event.action != 'closed' &&
github.event.action != 'unlabeled' &&
(github.event.action != 'labeled' ||
github.event.label.name == 'deploy-website')))
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
@@ -73,7 +92,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
# Mint a token for the alchemy-version-bot GitHub App so the PR
# preview comment (created via GitHub.Comment in alchemy.run.ts)
@@ -91,11 +110,11 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: website/node_modules/.astro
key: website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
key: website-astro-full-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
restore-keys: |
website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-
website-astro-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-
website-astro-${{ runner.os }}-main-
website-astro-full-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.sha }}-
website-astro-full-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-
website-astro-full-${{ runner.os }}-main-
- name: Restore Turbo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -113,8 +132,21 @@ jobs:
install: true
require-lockfile: true
- name: Check current preview state
if: github.event_name == 'pull_request'
id: preview-state
env:
GH_TOKEN: ${{ github.token }}
run: |
active="$(gh api "repos/$GITHUB_REPOSITORY/pulls/${{ github.event.number }}" \
--jq '[.state == "open", any(.labels[]; .name == "deploy-website")] | all')"
echo "active=$active" >> "$GITHUB_OUTPUT"
# Main/prod use the production account; PR stages use the test account.
- name: Deploy
if: >-
github.event_name != 'pull_request' ||
steps.preview-state.outputs.active == 'true'
working-directory: website
run: bun alchemy deploy --stage "$STAGE" --yes
env:
@@ -139,8 +171,11 @@ jobs:
name: Cleanup
runs-on: blacksmith-4vcpu-ubuntu-2404
if: >-
github.event_name == 'pull_request' && github.event.action == 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
github.event.pull_request.head.repo.full_name == github.repository &&
((github.event.action == 'closed' &&
contains(github.event.pull_request.labels.*.name, 'deploy-website')) ||
(github.event.action == 'unlabeled' &&
github.event.label.name == 'deploy-website'))
permissions:
contents: read
pull-requests: write
@@ -149,7 +184,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Checkout distilled
run: git submodule update --init --depth=1 --checkout -- distilled
run: git submodule update --init --depth=1 --checkout -- submodules/distilled
- name: Generate bot token
id: bot-token
@@ -169,22 +204,35 @@ jobs:
# bundle anything. Skip native postinstalls and the root prepare build.
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Install Doppler CLI
uses: dopplerhq/cli-action@4819d808ab99e5cde19a0637a16536a4038fad73 # v4
- name: Check current preview state
id: preview-state
env:
GH_TOKEN: ${{ github.token }}
run: |
active="$(gh api "repos/$GITHUB_REPOSITORY/pulls/${{ github.event.number }}" \
--jq '[.state == "open", any(.labels[]; .name == "deploy-website")] | all')"
echo "active=$active" >> "$GITHUB_OUTPUT"
# Allowlist, not denylist: cleanup must only ever destroy pr-N stages,
# so refuse anything else outright (prod/main/preview-base) even if a
# future STAGE refactor changes what a pull_request event resolves to.
- name: Safety Check
if: steps.preview-state.outputs.active != 'true'
run: |-
if [ "${{ env.STAGE }}" = "prod" ]; then
echo "ERROR: Cannot destroy prod environment in cleanup job"
exit 1
fi
case "${{ env.STAGE }}" in
pr-[0-9]*) ;;
*)
echo "ERROR: cleanup only destroys pr-* stages, got '${{ env.STAGE }}'"
exit 1
;;
esac
- name: Destroy Preview Environment
if: steps.preview-state.outputs.active != 'true'
working-directory: website
run: >-
doppler run --project "$DOPPLER_PROJECT" --config "$DOPPLER_CONFIG"
-- bun alchemy destroy --stage "$STAGE" --yes
run: bun alchemy destroy --stage "$STAGE" --yes
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
PULL_REQUEST: ${{ github.event.number }}
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
GITHUB_TOKEN: ${{ steps.bot-token.outputs.token }}
+8 -5
View File
@@ -46,8 +46,8 @@ packages/cloudflare-runtime/src/rolldown/out/
!packages/cloudflare-runtime/src/rolldown/test/fixtures/**/*.js
!packages/cloudflare-frameworks/src/nextjs/wrangler-stub/*.js
!packages/cloudflare-*/src/**/*.d.ts
!fixtures/**/*.d.ts
!fixtures/**/*.js
!packages/frontend-frameworks/fixtures/**/*.d.ts
!packages/frontend-frameworks/fixtures/**/*.js
.attest
.cache
@@ -67,13 +67,16 @@ examples/cloudflare-worker/src/scratch.ts
/packages/alchemy/README.md
!/packages/alchemy/bin/cli.js
.vendor/*
!/packages/alchemy/bin/register-dev-mode.js
!/packages/alchemy/bin/register-oxc.js
.tmp
# the lockfile-pinning test fixture is a checked-in lockfile, not a generated one
!packages/alchemy/test/AWS/Lambda/fixtures/lockfile-pinning/pnpm/pnpm-lock.yaml
!.vendor/distilled
!.vendor/floci
.ai-workspace/
/processes/
.probe
!packages/alchemy/src/Cloudflare/Workers/worker-module.d.ts
# pkg pack output (CI artifact hand-off)
.pkg
+9 -66
View File
@@ -1,71 +1,14 @@
# reference-only checkout of the repos — skipped by
# `git submodule update --init` (CI included). Fetch explicitly with
# `git submodule update --init --checkout -- .vendor/<repo>`.
[submodule "vendor/alchemy"]
path = .vendor/alchemy
url = https://github.com/alchemy-run/alchemy-async.git
shallow = true
update = none
ignore = all
[submodule "vendor/workers-sdk"]
path = .vendor/workers-sdk
url = https://github.com/cloudflare/workers-sdk.git
shallow = true
update = none
ignore = all
[submodule "vendor/next.js"]
path = .vendor/next.js
url = https://github.com/vercel/next.js.git
shallow = true
update = none
ignore = all
[submodule "vendor/opennextjs-cloudflare"]
path = .vendor/opennextjs-cloudflare
url = https://github.com/opennextjs/opennextjs-cloudflare.git
shallow = true
update = none
ignore = all
[submodule "vendor/astro"]
path = .vendor/astro
url = https://github.com/withastro/astro.git
shallow = true
update = none
ignore = all
[submodule "vendor/sveltekit"]
path = .vendor/sveltekit
url = https://github.com/sveltejs/kit.git
shallow = true
update = none
ignore = all
[submodule "vendor/waku"]
path = .vendor/waku
url = https://github.com/wakujs/waku.git
shallow = true
update = none
ignore = all
[submodule "vendor/nuxt"]
path = .vendor/nuxt
url = https://github.com/nuxt/nuxt.git
shallow = true
update = none
ignore = all
[submodule "vendor/nitro"]
path = .vendor/nitro
url = https://github.com/nitrojs/nitro.git
shallow = true
update = none
ignore = all
[submodule "vendor/nitro-cloudflare-dev"]
path = .vendor/nitro-cloudflare-dev
url = https://github.com/nitrojs/nitro-cloudflare-dev.git
shallow = true
update = none
ignore = all
# First-class sibling repositories we maintain.
#
# Distilled is part of the TypeScript workspace and is initialized by
# `git submodule update --init`. Floci is a large Java tree used only to
# build the local AWS emulator, so it is skipped unless requested:
# `git submodule update --init --checkout -- submodules/floci`.
[submodule "distilled"]
path = distilled
path = submodules/distilled
url = https://github.com/alchemy-run/distilled.git
[submodule "vendor/floci"]
path = .vendor/floci
[submodule "floci"]
path = submodules/floci
url = https://github.com/alchemy-run/floci.git
shallow = true
update = none
+1 -12
View File
@@ -1,13 +1,2 @@
#!/usr/bin/env sh
set -eu
git_dir="$(git rev-parse --path-format=absolute --git-dir)"
common_dir="$(git rev-parse --path-format=absolute --git-common-dir)"
# `post-checkout` also runs for ordinary checkouts and clones. Distilled only
# needs bootstrapping when Git has just created (or switched) a linked worktree.
[ "$git_dir" != "$common_dir" ] || exit 0
bun scripts/bootstrap-distilled-worktree.ts >/dev/null 2>&1 || true
exit 0
node scripts/bootstrap-distilled.mjs "$@"
+1 -1
View File
@@ -1,2 +1,2 @@
bun format
pnpm run format
git update-index --again
-1
View File
@@ -1 +0,0 @@
# see: https://opencode.ai/docs/tools/#ignore-patterns
-8
View File
@@ -1,8 +0,0 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"rules": {
"no-misused-new": "off",
"require-yield": "off",
"no-non-null-asserted-optional-chain": "off"
}
}
+14
View File
@@ -0,0 +1,14 @@
import { existsSync } from "node:fs";
import { resolve } from "node:path";
import { bootstrap } from "./scripts/bootstrap-distilled.mjs";
export const hooks = {
updateConfig(config) {
// pnpm also runs this hook for parallel Turbo tasks. Only bootstrap a
// missing checkout; leave existing worktrees and their Git config alone.
if (!existsSync(resolve(import.meta.dirname, "submodules/distilled/.git"))) {
bootstrap(import.meta.dirname);
}
return config;
},
};
Submodule .repos/alchemy-effect/.vendor/alchemy deleted from c9f5e549cf.
Submodule .repos/alchemy-effect/.vendor/astro deleted from a2240c4383.
Submodule .repos/alchemy-effect/.vendor/floci deleted from 3772bad5e9.
Submodule .repos/alchemy-effect/.vendor/next.js deleted from 55d30fb91d.
Submodule .repos/alchemy-effect/.vendor/nitro deleted from 52abde8aa9.
Submodule .repos/alchemy-effect/.vendor/nitro-cloudflare-dev deleted from a22a83b715.
Submodule .repos/alchemy-effect/.vendor/nuxt deleted from 17119f8ee6.
Submodule .repos/alchemy-effect/.vendor/opennextjs-cloudflare deleted from da4b7fc8c8.
Submodule .repos/alchemy-effect/.vendor/sveltekit deleted from f36b3a4cd3.
Submodule .repos/alchemy-effect/.vendor/waku deleted from 39e868f263.
Submodule .repos/alchemy-effect/.vendor/workers-sdk deleted from 99eb50ce1d.
+5 -7
View File
@@ -47,8 +47,8 @@
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
"packages/alchemy/bin/**/*.js*": true,
"packages/alchemy/bin/**/*.d*": true
"packages/alchemy/bin/**/*.d*": true,
"packages/alchemy/bin/**/*.map": true,
},
// The client watcher feeds the tsgo LSP (workspace/didChangeWatchedFiles);
// every unexcluded change storm forces a session-snapshot clone + program
@@ -56,21 +56,19 @@
// program input: agent worktrees (.claude is ~69GB incl. nested
// node_modules), vendored submodules, test logs/tmp bundles, and installs.
"files.watcherExclude": {
"**/distilled/**": true,
"**/submodules/**": true,
"**/.claude/**": true,
"**/.vendor/**": true,
"**/.alchemy/**": true,
"**/node_modules/**": true,
"**/.git/**": true
},
"search.exclude": {
"**/distilled/**": true,
"**/submodules/**": true,
"**/.claude/**": true,
"**/.vendor/**": true,
"**/.alchemy/**": true
},
// Keep the 200MB generated distilled surface out of the auto-import index.
"typescript.preferences.autoImportFileExcludePatterns": ["**/distilled/**"],
"typescript.preferences.autoImportFileExcludePatterns": [ "**/submodules/**" ],
"[typescript]": {
"editor.indentSize": 2,
"editor.defaultFormatter": "oxc.oxc-vscode"
+14 -9
View File
@@ -48,6 +48,11 @@ A Resource Provider implements the following Lifecycle Operations:
# File System Conventions
First-class sibling repositories we maintain live in `submodules/`:
- `submodules/distilled` — generated Effect SDKs (workspace packages). Initialized by `git submodule update --init`.
- `submodules/floci` — our fork of the local AWS emulator. Skipped by default; fetch with `git submodule update --init --checkout -- submodules/floci`.
Each Service's Resources follow the same pattern. Resource contract and provider are co-located in the same file. Each Capability lives in its own file(s) named after the capability and access level (`Binding.Service` contract + the `*Binding` / `*Http` implementations).
```sh
@@ -108,9 +113,9 @@ Alchemy resource coverage is produced as a **software factory**: fleets of agent
update statuses <── regenerate service <── patch distilled
```
1. **Catalog** — fan out research agents over the provider's distilled service modules (one batch per thematic group). Each agent reads the generated SDK (`distilled/packages/{cloud}/src/services/{service}.ts`), cross-references the vendor API docs, and writes a self-contained design spec to `processes/{Cloud}/catalog/{service}.md`: resources, namespaces, props/attrs with replacement rules, lifecycle-to-operation mapping, scope (account/zone), testability, priority. The coordinator aggregates a machine-readable `summary.json` + human `INDEX.md` that tracks `implemented | partial | missing` per resource — this is the factory's order book.
1. **Catalog** — fan out research agents over the provider's distilled service modules (one batch per thematic group). Each agent reads the generated SDK (`submodules/distilled/packages/{cloud}/src/services/{service}.ts`), cross-references the vendor API docs, and writes a self-contained design spec to `processes/{Cloud}/catalog/{service}.md`: resources, namespaces, props/attrs with replacement rules, lifecycle-to-operation mapping, scope (account/zone), testability, priority. The coordinator aggregates a machine-readable `summary.json` + human `INDEX.md` that tracks `implemented | partial | missing` per resource — this is the factory's order book.
2. **Implement + test** in waves (below). Tests run against the real cloud (`pnpm test --profile testing`); zone-scoped tests use the standing test zone (`alchemy-test-2.us` via `findZoneByName`).
3. **Patch the SDK, never the consumer** — every `UnknownCloudflareError`, out-of-union status error, or wrong request/response schema found by a test becomes an RFC 6902 JSON Patch against the service's Smithy model, under `distilled/packages/{cloud}/patches/{service}/{op}.json` (see the Typed Error Doctrine section). Regenerate only that service. The typed union improves for every future consumer of the SDK — that is the flywheel's output.
3. **Patch the SDK, never the consumer** — every `UnknownCloudflareError`, out-of-union status error, or wrong request/response schema found by a test becomes an RFC 6902 JSON Patch against the service's Smithy model, under `submodules/distilled/packages/{cloud}/patches/{service}/{op}.json` (see the Typed Error Doctrine section). Regenerate only that service. The typed union improves for every future consumer of the SDK — that is the flywheel's output.
4. **Update the catalog** statuses after each wave and pick the next batch from the order book. Repeat until everything left is documented as out of scope (deprecated APIs, billing/data-only endpoints, closed-beta, needs-external-systems).
## Orchestration rules (the coordinator)
@@ -183,7 +188,7 @@ pnpm docs:gen # -> website/src/content/docs/providers/{Cloud}/{Resource}.md
This is the only doc generator that produces user-facing output. ([scripts/generate-api-reference.ts](./scripts/generate-api-reference.ts)) does the following:
1. Discovers documented files across its configured source roots — `packages/alchemy/src/{Cloud}/{Service}/` plus flat single-provider packages like `packages/better-auth/src/` (mapped onto a synthetic provider directory, e.g. `BetterAuth/`)
2. Parses TypeScript with `ts-morph`
2. Parses TypeScript with the native TypeScript API (`typescript-api` tooling alias)
3. Extracts the page-level summary plus Markdown section/example blocks from JSDoc on the export tagged `@resource`, `@binding`, or `@layer`
4. Writes one markdown file per page at `website/src/content/docs/providers/{Provider}/{Name}.md`
@@ -712,7 +717,7 @@ See the [VPC Smoke Test](./test/AWS/EC2/Vpc.smoke.test.ts) for an example.
## How distilled is built (Smithy + JSON Patch)
Distilled is a Smithy-based SDK factory. Every provider package (`distilled/packages/{cloud}`) runs the same pipeline:
Distilled is a Smithy-based SDK factory. Every provider package (`submodules/distilled/packages/{cloud}`) runs the same pipeline:
1. **Convert** — the provider's spec source is converted into Smithy 2.0 JSON models, one per service, in `.generated-specs/{service}.json`. Cloudflare mines them from the downloaded API docs (`scripts/spec-to-smithy.ts` over `specs/api/resources/**`); AWS consumes the official `api-models-aws` Smithy models submodule directly. Hand-authored models for APIs the spec source doesn't cover live in `manual-specs/`.
2. **Patch** — an **RFC 6902 JSON Patch chain** (files shaped `{ "description": ..., "patches": [ops] }`) is applied to the provider's intermediary spec before codegen. For Cloudflare, patches in `patches/{service}/*.json` target the **Smithy model**, applied in filename order with `*.manual.json` files last; `_metadata.json` carries service-level `/metadata/keyDictionary` and `/metadata/opAliases`. OpenAPI-sourced providers (Neon, PlanetScale, Stripe, …) patch the **OpenAPI document** upstream of the smithy conversion instead. A patch whose target path is stale (no longer in the model) warns and is skipped; a malformed patch **fails the generator run**.
@@ -730,7 +735,7 @@ Every error a distilled operation can produce in practice MUST be a tagged error
**When you hit an unmatched error** (an `UnknownCloudflareError`, or you find yourself wanting to check `CloudflareHttpError.status` or an out-of-union `NotFound`), the fix is ALWAYS a distilled patch, never a catch in alchemy:
1. Note the error's code / status / message from the failure output.
2. Add or extend `distilled/packages/cloudflare/patches/{service}/{operation}.json` with a JSON Patch that (a) adds an error structure carrying the `smithy.api#error` trait and `com.cloudflare.protocols#errorMatchers` matchers, and (b) attaches it to the operation's `errors` list. Use a **meaningful, resource-specific tag** (e.g. `WidgetNotFound`, not a bare `NotFound`):
2. Add or extend `submodules/distilled/packages/cloudflare/patches/{service}/{operation}.json` with a JSON Patch that (a) adds an error structure carrying the `smithy.api#error` trait and `com.cloudflare.protocols#errorMatchers` matchers, and (b) attaches it to the operation's `errors` list. Use a **meaningful, resource-specific tag** (e.g. `WidgetNotFound`, not a bare `NotFound`):
```json
{
@@ -762,10 +767,10 @@ Every error a distilled operation can produce in practice MUST be a tagged error
If the operation already has an `errors` array (from an earlier patch), append with `"path": ".../errors/-"` instead of adding the whole array. Matchers may combine `code`, `status`, and `message` (a string, or `{ "includes": "..." }` / `{ "matches": "..." }`) — e.g. `[{ "status": 400, "message": { "includes": "snippet not found" } }]` when Cloudflare misuses 400 for a missing resource. Prefer matching the Cloudflare error `code` when one exists; fall back to `status` + `message` otherwise. The most specific matcher wins; ties break by declaration order.
3. Regenerate ONLY that service: `cd distilled/packages/cloudflare && bun scripts/generate.ts --resource {service}` (then format: `pnpm exec oxfmt src/services/{service}.ts`). A warned-stale or failed patch is a bug in your patch — fix it; never leave a red generate.
3. Regenerate ONLY that service: `cd submodules/distilled/packages/cloudflare && bun scripts/generate.ts --resource {service}` (then format: `pnpm exec oxfmt src/services/{service}.ts`). A warned-stale or failed patch is a bug in your patch — fix it; never leave a red generate.
4. Handle the now-typed tag in alchemy code and re-run the tests.
**AWS is the one exception to the JSON Patch format**: it layers typed-error metadata over the official Smithy models with a per-service schema file `distilled/packages/aws/patches/{service}.json` (error categories, aliases, synthetic errors with message matchers — see `distilled/packages/aws/scripts/spec-schema.ts`), regenerated with `cd distilled/packages/aws && bun scripts/generate.ts --sdk {service}`. The doctrine is identical; only the patch dialect differs.
**AWS is the one exception to the JSON Patch format**: it layers typed-error metadata over the official Smithy models with a per-service schema file `submodules/distilled/packages/aws/patches/{service}.json` (error categories, aliases, synthetic errors with message matchers — see `submodules/distilled/packages/aws/scripts/spec-schema.ts`), regenerated with `cd submodules/distilled/packages/aws && bun scripts/generate.ts --sdk {service}`. The doctrine is identical; only the patch dialect differs.
**Forbidden patterns** — these defeat the type system and must never appear in alchemy code or tests:
@@ -808,7 +813,7 @@ Engine semantics (never re-implement these per provider):
## `LocalProvider.make` — long-running local providers
A local provider whose physical resource is a **running process** (dev server, workerd instance) MUST be built with `LocalProvider.make(cls, serverEntryUrl, spec)` — do not hand-roll FiberMap/instance-registry/hash machinery in the provider:
A local provider whose physical resource is a **running process** (dev server, workerd instance) MUST be built with `LocalProvider.make(cls, providersUrl, spec)` — do not hand-roll FiberMap/instance-registry/hash machinery in the provider:
- **`resolveConfig(ctx)`** — the restart surface. Plain, canonically-hashable data only (no closures or runtime objects: derive plain *descriptors* here and materialize `BindingHook`s etc. inside `start` — see the descriptor/hook split in [LocalWorkerProvider.ts](./packages/alchemy/src/Cloudflare/Workers/LocalWorkerProvider.ts)). Must be cheap and side-effect-free — it runs inside `diff` on every plan. Its canonical hash decides noop-vs-restart AND the same value is handed to `start`, so "what changed?" and "what starts?" can never drift. Deliberately EXCLUDE runtime wiring observed at start time (e.g. queue consumers read from `LocalRuntimeState`) — sibling reconciles drive those via restart hooks, not config.
- **`start(ctx)`** — boot ONE instance in the ambient `Scope` and return Attributes at *readiness*; the process keeps running until the runner closes the scope on restart/delete. For processes that can die on their own, fork `ctx.invalidate` after the exit so the next plan reports `update`.
@@ -1067,7 +1072,7 @@ Ironing out the AWS suite is an iterative loop, driven by a coordinator, that te
Each iteration:
0. **Clean slate** — first run `aws sso login` (the alchemy `testing` profile and the raw `aws` CLI ride the same SSO session; an expired token mid-round breaks the pipeline with auth errors — only escalate to a human if the login doesn't complete automatically). Then `pnpm nuke --yes` (deletes every alchemy-tagged cloud resource; `scripts/nuke.sh` already spares state buckets, SSO roles, and AWS-managed singletons) then `pnpm alchemy state clear ./stacks/nuke.ts --profile testing --yes`. Never overlap nuke with a running suite. Plain `pnpm clear:state` lacks the profile and dies on expired Cloudflare OAuth; nuke without `--yes` hangs on an interactive confirm in non-interactive shells.
0. **Clean slate** — first run `aws sso login` (the alchemy `testing` profile and the raw `aws` CLI ride the same SSO session; an expired token mid-round breaks the pipeline with auth errors — only escalate to a human if the login doesn't complete automatically). Then `pnpm nuke --yes` (deletes every alchemy-tagged cloud resource; `scripts/nuke.sh` already spares state buckets, SSO roles, and AWS-managed singletons) then `pnpm alchemy state delete Nuke --config ./stacks/nuke.ts --profile testing --recursive`. Never overlap nuke with a running suite. Plain `pnpm clear:state` lacks the profile and dies on expired Cloudflare OAuth; nuke without `--yes` hangs on an interactive confirm in non-interactive shells.
1. **Full suite, bounded** — `pnpm test test/AWS --profile testing`. The runner defaults to `--concurrency 32`; NEVER override it to `unbounded` on a full-suite run: all ~775 files' `beforeAll` deploys start at once, the event loop saturates, and hundreds of fake 0ms `beforeAll TimeoutError` failures drown the real signal (heap is ~8.5 GB regardless of N — the constraint is CPU, not memory). Target ≤10 min wall-clock, hard cap 128; measured 32 → ~21 min clean. The saturation tell is `beforeAll` failures at 0ms; real failures fail slow. If the cap can't reach 10 min, the residual is individual slow files — skipIf-gate them per the speed doctrine.
2. **Leak census** — `pnpm nuke --dry-run` after the suite; diff against the pre-suite baseline. Worklist = **failed services ∪ leaking services** (a service can pass green and still leak). Leave the leaked resources LIVE as forensic evidence for the fix agents; carry-over holdouts that survive repeated nuke passes (stuck deletes) go on the worklist too — their delete path is the bug.
3. **Fix-fleet workflow** — one agent per service on the worklist (account-singleton services — CloudTrail, Config, SecurityHub, GuardDuty, ControlTower, IdentityCenter — run as a sequential chain; everything else fans out). Each agent gets its exact failures, its leak inventory, and this root-cause priority: **provider bug > distilled patch > test fix** — never paper over a provider leak in the test. Each agent runs ONLY its own suite (`timeout 240 pnpm test test/AWS/{Service} --profile testing`), audits its tests for non-deterministic names (rely on PhysicalName auto-naming; random data in message payloads/idempotency tokens is fine), verifies zero orphans from its service via out-of-band distilled list/describe calls, and reports a structured result. Agents never run tsc/build and never run the account-wide nuke.
+204
View File
@@ -1,3 +1,207 @@
## v2.0.0-beta.78
### &nbsp;&nbsp;&nbsp;🚨 Breaking Changes
- **aws**: Preserve explicit security group egress intent &nbsp;-&nbsp; by **Henning Pokriefke** in https://github.com/alchemy-run/alchemy/issues/1623 [<samp>(d438b)</samp>](https://github.com/alchemy-run/alchemy/commit/d438b9d8b)
- **git**: Expose Git operations for native Effect APIs &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1621 [<samp>(bd021)</samp>](https://github.com/alchemy-run/alchemy/commit/bd0211912)
### &nbsp;&nbsp;&nbsp;🚀 Features
- **aws**:
- **s3**: Manage blocked encryption types &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1588 [<samp>(3f97d)</samp>](https://github.com/alchemy-run/alchemy/commit/3f97df5f2)
- **cloudflare**:
- **workers**: Worker Previews &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1563 [<samp>(eae69)</samp>](https://github.com/alchemy-run/alchemy/commit/eae693613)
- **cloudflare-runtime**:
- Replace the workerd proxy with a layer-4 relay &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1612 [<samp>(9a9b6)</samp>](https://github.com/alchemy-run/alchemy/commit/9a9b60179)
- **core**:
- Keep engine/AWS/distilled out of dev processes &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1614 [<samp>(bad83)</samp>](https://github.com/alchemy-run/alchemy/commit/bad831409)
- **dev**:
- Serve every local provider group from one sidecar &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1613 [<samp>(38f27)</samp>](https://github.com/alchemy-run/alchemy/commit/38f2714f7)
- **git**:
- Git hosting on Workers, Durable Objects, and R2 &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1187 [<samp>(9e2f8)</samp>](https://github.com/alchemy-run/alchemy/commit/9e2f88577)
- **github**:
- Add Label resource &nbsp;-&nbsp; by **Agusti F.** in https://github.com/alchemy-run/alchemy/issues/1565 [<samp>(d49c2)</samp>](https://github.com/alchemy-run/alchemy/commit/d49c25853)
- Add Milestone resource &nbsp;-&nbsp; by **Agusti F.** in https://github.com/alchemy-run/alchemy/issues/1566 [<samp>(4c911)</samp>](https://github.com/alchemy-run/alchemy/commit/4c911a504)
- Add Issue resource &nbsp;-&nbsp; by **Agusti F.** in https://github.com/alchemy-run/alchemy/issues/1568 [<samp>(6911c)</samp>](https://github.com/alchemy-run/alchemy/commit/6911c4090)
- Add PullRequest resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1569 [<samp>(19c1b)</samp>](https://github.com/alchemy-run/alchemy/commit/19c1bf400)
- Add Release resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1577 [<samp>(87801)</samp>](https://github.com/alchemy-run/alchemy/commit/87801a9c4)
- Add TeamAccess resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1572 [<samp>(9585e)</samp>](https://github.com/alchemy-run/alchemy/commit/9585ed6ff)
- Add BranchProtection resource &nbsp;-&nbsp; by **99andytang** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1514 [<samp>(527e7)</samp>](https://github.com/alchemy-run/alchemy/commit/527e7c4bb)
- Add Ruleset resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1570 [<samp>(113f5)</samp>](https://github.com/alchemy-run/alchemy/commit/113f5c194)
- Add Collaborator resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1571 [<samp>(16847)</samp>](https://github.com/alchemy-run/alchemy/commit/168470bcd)
- Add WikiPage resource &nbsp;-&nbsp; by **Agusti F.** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1578 [<samp>(8d617)</samp>](https://github.com/alchemy-run/alchemy/commit/8d617fca2)
- **node-utils**:
- Cache oxc transforms and run the CLI launcher in place &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1615 [<samp>(6087e)</samp>](https://github.com/alchemy-run/alchemy/commit/6087e5289)
- **pkg**:
- Preview package registry verified against GitHub Actions runs &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1516 [<samp>(b7fc7)</samp>](https://github.com/alchemy-run/alchemy/commit/b7fc701fe)
- **prisma**:
- Consume @distilled.cloud/prisma-postgres instead of the hand-rolled client &nbsp;-&nbsp; by **Will Madden** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1290 [<samp>(f7340)</samp>](https://github.com/alchemy-run/alchemy/commit/f73403bc0)
- Deploy static apps with Compute &nbsp;-&nbsp; by **Aman Varshney** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1208 [<samp>(35193)</samp>](https://github.com/alchemy-run/alchemy/commit/351932777)
- **railway**:
- Migrate reconcilers to selective GraphQL &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1604 [<samp>(d0b83)</samp>](https://github.com/alchemy-run/alchemy/commit/d0b83b2e0)
- Add sandbox domains, sizing, forks, and checkpoints &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1661 [<samp>(41cdf)</samp>](https://github.com/alchemy-run/alchemy/commit/41cdf897d)
- **stripe**:
- Add Stripe resources, auth, and nuke wiring &nbsp;-&nbsp; by **Michael K** in https://github.com/alchemy-run/alchemy/issues/1298 [<samp>(0d9a5)</samp>](https://github.com/alchemy-run/alchemy/commit/0d9a58c85)
- **test**:
- Default Test.make stage to test_$USER &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1579 [<samp>(d2185)</samp>](https://github.com/alchemy-run/alchemy/commit/d218541b2)
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
- Effect rc.113 proxyChain/BunHttpServer regressions; AWS destroy after drifted state &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1576 [<samp>(9ee79)</samp>](https://github.com/alchemy-run/alchemy/commit/9ee794539)
- DSQL SNI (sql-pg rc.113), ECS Service delete on a draining service, Nextjs preview proxy secret &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1580 [<samp>(92d04)</samp>](https://github.com/alchemy-run/alchemy/commit/92d0480ad)
- Sql-pg rc.113 sslmode=prefer, Prisma.Database branch attachment &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1582 [<samp>(42c3f)</samp>](https://github.com/alchemy-run/alchemy/commit/42c3ffc47)
- Resolve provider modes and repair integration test failures &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1646 [<samp>(c6c58)</samp>](https://github.com/alchemy-run/alchemy/commit/c6c58baa5)
- Outdated tests and regressions &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1659 [<samp>(d05b2)</samp>](https://github.com/alchemy-run/alchemy/commit/d05b217cb)
- Resolve dev sidecar through package exports &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1678 [<samp>(6d803)</samp>](https://github.com/alchemy-run/alchemy/commit/6d8030273)
- Resolve release validation failures &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1671 [<samp>(5bd89)</samp>](https://github.com/alchemy-run/alchemy/commit/5bd8968b7)
- Align distilled pnpm version for CI builds &nbsp;-&nbsp; by **BlankParticle** [<samp>(edb81)</samp>](https://github.com/alchemy-run/alchemy/commit/edb8192a6)
- **aws**:
- Restore missing ownership tags in AWS Organizations &nbsp;-&nbsp; by **Henning Pokriefke** in https://github.com/alchemy-run/alchemy/issues/1637 [<samp>(b66be)</samp>](https://github.com/alchemy-run/alchemy/commit/b66bef23b)
- Preserve standalone security group rules &nbsp;-&nbsp; by **Henning Pokriefke** in https://github.com/alchemy-run/alchemy/issues/1624 [<samp>(3cbc9)</samp>](https://github.com/alchemy-run/alchemy/commit/3cbc9b3dc)
- Enforce S3 and security group desired state &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1664 [<samp>(66c94)</samp>](https://github.com/alchemy-run/alchemy/commit/66c944949)
- Replace fixed-IP EC2 instances delete-first &nbsp;-&nbsp; by **Sam Goodwin** and **dawson** in https://github.com/alchemy-run/alchemy/issues/1667 [<samp>(2a615)</samp>](https://github.com/alchemy-run/alchemy/commit/2a61544e2)
- **ec2**:
- Reconcile security-group rule deltas &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1592 [<samp>(fae76)</samp>](https://github.com/alchemy-run/alchemy/commit/fae766993)
- **ecr**:
- Skip updates for relocated image contexts &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1591 [<samp>(bb4be)</samp>](https://github.com/alchemy-run/alchemy/commit/bb4be0f11)
- **logs**:
- Normalize log group ARN from state before tagging calls &nbsp;-&nbsp; by **Evan Spaeder** in https://github.com/alchemy-run/alchemy/issues/1575 [<samp>(c17cb)</samp>](https://github.com/alchemy-run/alchemy/commit/c17cb45c7)
- **rds**:
- Enforce desired parameter group values &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1589 [<samp>(461a5)</samp>](https://github.com/alchemy-run/alchemy/commit/461a5c574)
- Repair parameter group drift with desired defaults &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1590 [<samp>(7c8fc)</samp>](https://github.com/alchemy-run/alchemy/commit/7c8fc7bf0)
- Reconcile storage autoscaling defaults &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1593 [<samp>(076ef)</samp>](https://github.com/alchemy-run/alchemy/commit/076eff8b4)
- Include coupled storage modification fields &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1594 [<samp>(d2c06)</samp>](https://github.com/alchemy-run/alchemy/commit/d2c0699ca)
- Compare the observed endpoint port &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1595 [<samp>(7c3eb)</samp>](https://github.com/alchemy-run/alchemy/commit/7c3ebed5c)
- Skip unchanged instance associations &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1596 [<samp>(82e82)</samp>](https://github.com/alchemy-run/alchemy/commit/82e829ffa)
- **s3**:
- Check bucket ownership with GetBucketLocation &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1585 [<samp>(8ac81)</samp>](https://github.com/alchemy-run/alchemy/commit/8ac81b2c1)
- Propagate configuration read failures &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1586 [<samp>(640c6)</samp>](https://github.com/alchemy-run/alchemy/commit/640c65b7c)
- Compare decoded encryption key values &nbsp;-&nbsp; by **Bjorn Pagen** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1587 [<samp>(899bc)</samp>](https://github.com/alchemy-run/alchemy/commit/899bc357e)
- **cli**:
- Preserve js extension for exec bundle &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1625 [<samp>(88339)</samp>](https://github.com/alchemy-run/alchemy/commit/883398af5)
- Isolate the React renderer from consumer dependencies &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1636 [<samp>(c83b4)</samp>](https://github.com/alchemy-run/alchemy/commit/c83b45421)
- Respect detected terminal color support &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1679 [<samp>(75f93)</samp>](https://github.com/alchemy-run/alchemy/commit/75f93a4ee)
- **cloudflare**:
- Forward crons to Vite dev workers &nbsp;-&nbsp; by **zawaki** in https://github.com/alchemy-run/alchemy/issues/1641 [<samp>(0aab5)</samp>](https://github.com/alchemy-run/alchemy/commit/0aab5723d)
- Forward container memoryMib &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1521 [<samp>(b96d4)</samp>](https://github.com/alchemy-run/alchemy/commit/b96d494e2)
- Plan replacements for cached container identity mismatches &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1523 [<samp>(0f26a)</samp>](https://github.com/alchemy-run/alchemy/commit/0f26aa54b)
- Export container builds directly to registries &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1524 [<samp>(c74a3)</samp>](https://github.com/alchemy-run/alchemy/commit/c74a3833a)
- Deduplicate container image publication &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1525 [<samp>(27536)</samp>](https://github.com/alchemy-run/alchemy/commit/275361dfe)
- Preserve unresolved container attachments &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1150 [<samp>(d9d7f)</samp>](https://github.com/alchemy-run/alchemy/commit/d9d7fa234)
- Expose the Worker bridge from a runtime-only entry &nbsp;-&nbsp; by **Alex** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1643 [<samp>(fc0a2)</samp>](https://github.com/alchemy-run/alchemy/commit/fc0a24130)
- Recover interrupted creates by generated identity &nbsp;-&nbsp; by **Dan van der Merwe** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1526 [<samp>(bd83d)</samp>](https://github.com/alchemy-run/alchemy/commit/bd83dd948)
- **r2**: Forward put options on the stream path &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1602 [<samp>(34917)</samp>](https://github.com/alchemy-run/alchemy/commit/34917080f)
- **worker**: Restore request URL through trusted proxy &nbsp;-&nbsp; by **BlankParticle** in https://github.com/alchemy-run/alchemy/issues/1573 [<samp>(da987)</samp>](https://github.com/alchemy-run/alchemy/commit/da987815e)
- **workers**: Type named entrypoint bindings with their RPC surface &nbsp;-&nbsp; by **Michael K** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1415 [<samp>(8d3f9)</samp>](https://github.com/alchemy-run/alchemy/commit/8d3f92ea2)
- **cloudflare-runtime**:
- Read registry mtime with node:fs.stat &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1564 [<samp>(ca421)</samp>](https://github.com/alchemy-run/alchemy/commit/ca4216f00)
- Pull the egress interceptor host-native &nbsp;-&nbsp; by **Erik Müller** in https://github.com/alchemy-run/alchemy/issues/1459 [<samp>(b7505)</samp>](https://github.com/alchemy-run/alchemy/commit/b7505d5e6)
- **deps**:
- Update to effect 4.0.0-rc.113 &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1562 [<samp>(4340a)</samp>](https://github.com/alchemy-run/alchemy/commit/4340adad4)
- Effect 4.0.0-rc.115; drop the sql-pg SNI shim &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1601 [<samp>(ba30b)</samp>](https://github.com/alchemy-run/alchemy/commit/ba30b9efc)
- Upgrade Foldkit for Effect RC 115 &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1618 [<samp>(4343f)</samp>](https://github.com/alchemy-run/alchemy/commit/4343fc985)
- **docker**:
- Fall back to build + push on Buildx < 0.26 registry exports &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1685 [<samp>(c37b0)</samp>](https://github.com/alchemy-run/alchemy/commit/c37b0414f)
- **hetzner**:
- Recover cleanup after interrupted server creation &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1662 [<samp>(fca23)</samp>](https://github.com/alchemy-run/alchemy/commit/fca232564)
- **node-utils**:
- Exclude the root's own node_modules from the Bun dev probe &nbsp;-&nbsp; by **Austin** in https://github.com/alchemy-run/alchemy/issues/1617 [<samp>(80c71)</samp>](https://github.com/alchemy-run/alchemy/commit/80c71fe8d)
- **railway**:
- Mount volumes and wait for the uploaded Service deploy &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1584 [<samp>(361f5)</samp>](https://github.com/alchemy-run/alchemy/commit/361f53df7)
- Import the native SDK from the package root &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1620 [<samp>(18156)</samp>](https://github.com/alchemy-run/alchemy/commit/18156acbc)
- Use environment-managed private networking &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1682 [<samp>(c197c)</samp>](https://github.com/alchemy-run/alchemy/commit/c197cd0a5)
- **state**:
- Keep HTTP state payloads out of errors &nbsp;-&nbsp; by **Dan van der Merwe** in https://github.com/alchemy-run/alchemy/issues/1522 [<samp>(f8954)</samp>](https://github.com/alchemy-run/alchemy/commit/f8954086d)
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/alchemy-run/alchemy/compare/v2.0.0-beta.77...HEAD)
---
## v2.0.0-beta.77
### &nbsp;&nbsp;&nbsp;🚨 Breaking Changes
- Profiles overhaul &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1234 [<samp>(af2b9)</samp>](https://github.com/alchemy-run/alchemy/commit/af2b9f338)
- Overhaul the Alchemy CLI &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1235 [<samp>(04b83)</samp>](https://github.com/alchemy-run/alchemy/commit/04b8366ac)
- **cli**:
- Breaking change, default deploy stage is live_$USER &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1421 [<samp>(df6be)</samp>](https://github.com/alchemy-run/alchemy/commit/df6be201e)
- Honor ALCHEMY_STAGE instead of STAGE &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1433 [<samp>(0f8b2)</samp>](https://github.com/alchemy-run/alchemy/commit/0f8b2bd62)
### &nbsp;&nbsp;&nbsp;🚀 Features
- CliKit — a terminal UI layer for the CLI on @alchemy.run/sigil &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1233 [<samp>(bf4d2)</samp>](https://github.com/alchemy-run/alchemy/commit/bf4d23590)
- Refactor interaction/auth flows, run ts/tsx files directly under node &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1430 [<samp>(416de)</samp>](https://github.com/alchemy-run/alchemy/commit/416de9dd0)
- Bump distilled to 78a9304 (verbNoun operation names, Railway selection fixes) &nbsp;-&nbsp; by **Michael K** in https://github.com/alchemy-run/alchemy/issues/1517 [<samp>(047db)</samp>](https://github.com/alchemy-run/alchemy/commit/047dbb7f1)
- **aws**:
- Add provisioned ElastiCache resources &nbsp;-&nbsp; by **Henning Pokriefke** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1422 [<samp>(dc983)</samp>](https://github.com/alchemy-run/alchemy/commit/dc9831caa)
- **cli**:
- Profile tab scrolling, --profile flag, v0 store migration &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1429 [<samp>(c2e8f)</samp>](https://github.com/alchemy-run/alchemy/commit/c2e8ff0cc)
- Unify plan and dev output presentation &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1458 [<samp>(fe7d1)</samp>](https://github.com/alchemy-run/alchemy/commit/fe7d1e3db)
- Use oxc for typescript, better reloading of stacks &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1461 [<samp>(37322)</samp>](https://github.com/alchemy-run/alchemy/commit/37322bb96)
- Refactor auth profiles into provider files &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1475 [<samp>(486bb)</samp>](https://github.com/alchemy-run/alchemy/commit/486bbe9c0)
- Standardize auth provider methods, env precedence, drop AWS local &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1480 [<samp>(22b41)</samp>](https://github.com/alchemy-run/alchemy/commit/22b41856d)
- Pointer-focus TUI, tcut demo, and the beta.77 release blog &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1547 [<samp>(8aecc)</samp>](https://github.com/alchemy-run/alchemy/commit/8aecc3e91)
- **cloudflare**:
- Add Cloudflare.Telemetry native tracing layer &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1444 [<samp>(e05c7)</samp>](https://github.com/alchemy-run/alchemy/commit/e05c734ea)
- Add abort retryAlarm on DurableObjectState &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1374 [<samp>(b357f)</samp>](https://github.com/alchemy-run/alchemy/commit/b357f7119)
- Add webSocketError to the Durable Object shape and bridge &nbsp;-&nbsp; by **Alex** in https://github.com/alchemy-run/alchemy/issues/1497 [<samp>(84bb1)</samp>](https://github.com/alchemy-run/alchemy/commit/84bb1ad76)
- **workflows**: Support native cron schedules &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1491 [<samp>(533df)</samp>](https://github.com/alchemy-run/alchemy/commit/533dfb5bb)
- **cloudflare-runtime**:
- Update workerd and vendored Workers runtime sources &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1442 [<samp>(59ede)</samp>](https://github.com/alchemy-run/alchemy/commit/59ede0883)
- **fly**:
- Support health checks &nbsp;-&nbsp; by **Adam Svystun** in https://github.com/alchemy-run/alchemy/issues/1463 [<samp>(0f814)</samp>](https://github.com/alchemy-run/alchemy/commit/0f814dfca)
- **railway**:
- Support service pre-deploy commands &nbsp;-&nbsp; by **Dallen Pyrah** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1438 [<samp>(d76d7)</samp>](https://github.com/alchemy-run/alchemy/commit/d76d7be7b)
- Support private services &nbsp;-&nbsp; by **Dallen Pyrah** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1439 [<samp>(2ceae)</samp>](https://github.com/alchemy-run/alchemy/commit/2ceae5476)
- Support local Docker contexts &nbsp;-&nbsp; by **Dallen Pyrah** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1440 [<samp>(59573)</samp>](https://github.com/alchemy-run/alchemy/commit/59573d7c8)
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
- Expose the Worker resource's ref method in its type &nbsp;-&nbsp; by **pollux** in https://github.com/alchemy-run/alchemy/issues/1434 [<samp>(74e5f)</samp>](https://github.com/alchemy-run/alchemy/commit/74e5f36b2)
- Resolve example test failures &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1527 [<samp>(63236)</samp>](https://github.com/alchemy-run/alchemy/commit/632360a5e)
- **apply**:
- Persist downstream edges on noop resources &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1552 [<samp>(5463c)</samp>](https://github.com/alchemy-run/alchemy/commit/5463ca826)
- **auth**:
- Deduplicate environment credential notices &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1520 [<samp>(233a5)</samp>](https://github.com/alchemy-run/alchemy/commit/233a5aff8)
- **aws**:
- **organizations**: Unwrap Redacted account name and email &nbsp;-&nbsp; by **Michael K** in https://github.com/alchemy-run/alchemy/issues/1556 [<samp>(f2957)</samp>](https://github.com/alchemy-run/alchemy/commit/f2957a194)
- **cli**:
- Stream apply notes in plain mode and stop wrapping log lines &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1423 [<samp>(e0d72)</samp>](https://github.com/alchemy-run/alchemy/commit/e0d72263a)
- Prompt for approval in plain interactive mode &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1426 [<samp>(bd74f)</samp>](https://github.com/alchemy-run/alchemy/commit/bd74f6880)
- Show feedback during slow shutdowns &nbsp;-&nbsp; by **Rahul Mishra** and **Claude Fable 5** in https://github.com/alchemy-run/alchemy/issues/1427 [<samp>(695ba)</samp>](https://github.com/alchemy-run/alchemy/commit/695ba55ce)
- Bindings state, persist plan collapse state &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1492 [<samp>(743e6)</samp>](https://github.com/alchemy-run/alchemy/commit/743e64013)
- Restore nuke progress and bulk state cleanup &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1532 [<samp>(55f7c)</samp>](https://github.com/alchemy-run/alchemy/commit/55f7c0999)
- Virtualize the profile dashboard's provider list &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1533 [<samp>(ab83e)</samp>](https://github.com/alchemy-run/alchemy/commit/ab83e7872)
- Honor --profile on cloudflare bootstrap &nbsp;-&nbsp; by **Michael K** in https://github.com/alchemy-run/alchemy/issues/1538 [<samp>(93b3a)</samp>](https://github.com/alchemy-run/alchemy/commit/93b3a7ef9)
- Update Sigil to fix terminal input corruption &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1545 [<samp>(b979f)</samp>](https://github.com/alchemy-run/alchemy/commit/b979ffc6a)
- **cloudflare**:
- Local dev crashes when assets contain a _headers or _redirects file &nbsp;-&nbsp; by **Michael** and **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1418 [<samp>(35a3b)</samp>](https://github.com/alchemy-run/alchemy/commit/35a3b9bcb)
- Preserve RpcWorker logical ID &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1487 [<samp>(5ab17)</samp>](https://github.com/alchemy-run/alchemy/commit/5ab171d92)
- Wrap WorkerLoader.get() as a WorkerStub &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1488 [<samp>(39258)</samp>](https://github.com/alchemy-run/alchemy/commit/39258554d)
- Run Durable Object callbacks with the caller's context &nbsp;-&nbsp; by **Alex** in https://github.com/alchemy-run/alchemy/issues/1498 [<samp>(cf8e0)</samp>](https://github.com/alchemy-run/alchemy/commit/cf8e00845)
- Fix broken framework dev/builds/tests &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1534 [<samp>(7e375)</samp>](https://github.com/alchemy-run/alchemy/commit/7e3757771)
- **cloudflare-runtime**:
- Bump internal isolate compatibility dates &nbsp;-&nbsp; by **Sam Goodwin** in https://github.com/alchemy-run/alchemy/issues/1380 [<samp>(18880)</samp>](https://github.com/alchemy-run/alchemy/commit/18880d16d)
- **frontend**:
- Don't cache in NodeServe &nbsp;-&nbsp; by **Sam Goodwin** [<samp>(11c95)</samp>](https://github.com/alchemy-run/alchemy/commit/11c95dc04)
- **pr-package**:
- Keep PR previews until the pull request closes &nbsp;-&nbsp; by **Michael K** in https://github.com/alchemy-run/alchemy/issues/1511 [<samp>(b12d8)</samp>](https://github.com/alchemy-run/alchemy/commit/b12d8167b)
- **railway**:
- Bump distilled to drop admin-only platformFeatureFlags &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1479 [<samp>(eadf6)</samp>](https://github.com/alchemy-run/alchemy/commit/eadf6d9f7)
- **website**:
- SEO, noindex, canonical, nosnippet & more &nbsp;-&nbsp; by **Sam Goodwin** and **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1269 [<samp>(09f2a)</samp>](https://github.com/alchemy-run/alchemy/commit/09f2a23f1)
- **workflows**:
- Omit undefined step config keys from bridge &nbsp;-&nbsp; by **Lord Coughmann** in https://github.com/alchemy-run/alchemy/issues/1416 [<samp>(034c0)</samp>](https://github.com/alchemy-run/alchemy/commit/034c02885)
### &nbsp;&nbsp;&nbsp;🏎 Performance
- **cloudflare**:
- **workers**: Upload asset buckets concurrently &nbsp;-&nbsp; by **Rahul Mishra** in https://github.com/alchemy-run/alchemy/issues/1445 [<samp>(90b5d)</samp>](https://github.com/alchemy-run/alchemy/commit/90b5df7a6)
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/alchemy-run/alchemy/compare/v2.0.0-beta.76...HEAD)
---
## v2.0.0-beta.76
### &nbsp;&nbsp;&nbsp;🚀 Features
+1 -1
View File
@@ -1,7 +1,7 @@
<div align="center">
<a href="https://alchemy.run">
<img src="./images/readme-hero.png" alt="Alchemy — Infrastructure as Effects" width="360" />
<img src="https://raw.githubusercontent.com/alchemy-run/alchemy/main/images/readme-hero.webp" alt="Alchemy — Infrastructure as Effects" width="360" />
</a>
<br />
+11 -11
View File
@@ -6,7 +6,7 @@ respective license notices.
## Astro
Portions of `packages/cloudflare-frameworks/src/astro` are derived from
Portions of `packages/frontend-frameworks/src/astro` are derived from
`@astrojs/cloudflare`.
Copyright (c) 2021 Fred K. Schott
@@ -33,7 +33,7 @@ SOFTWARE.
## SvelteKit
Portions of `packages/cloudflare-frameworks/src/sveltekit` are derived from
Portions of `packages/frontend-frameworks/src/sveltekit` are derived from
`@sveltejs/adapter-cloudflare`.
Copyright (c) 2020 SvelteKit contributors
@@ -43,7 +43,7 @@ Astro section above.
## Waku
Portions of `packages/cloudflare-frameworks/src/waku` are derived from Waku.
Portions of `packages/frontend-frameworks/src/waku` are derived from Waku.
Copyright (c) 2023 Daishi Kato
@@ -65,7 +65,7 @@ License reproduced in the Astro section above.
## OpenNext for Cloudflare
Portions of `packages/cloudflare-frameworks/src/nextjs`, including the build
Portions of `packages/frontend-frameworks/src/nextjs`, including the build
runner and development-context integration, are derived from OpenNext for
Cloudflare.
@@ -122,17 +122,17 @@ been dedicated to the public domain. See <https://www.sqlite.org/copyright.html>
## Upstream source references
- Astro: <https://github.com/withastro/astro>
- SvelteKit: <https://github.com/sveltejs/kit>
- Waku: <https://github.com/wakujs/waku>
- Cloudflare Workers SDK: <https://github.com/cloudflare/workers-sdk>
- OpenNext for Cloudflare: <https://github.com/opennextjs/opennextjs-cloudflare>
- Astro: [`a2240c43830e29c1d85667f4c610655d6b10253f`](https://github.com/withastro/astro/tree/a2240c43830e29c1d85667f4c610655d6b10253f)
- SvelteKit: [`f36b3a4cd307bd8c89e03fa191becc175e7b3077`](https://github.com/sveltejs/kit/tree/f36b3a4cd307bd8c89e03fa191becc175e7b3077)
- Waku: [`39e868f2638c27de9635c68ebf965e14a4112e9b`](https://github.com/wakujs/waku/tree/39e868f2638c27de9635c68ebf965e14a4112e9b)
- Cloudflare Workers SDK: [`b7b4ff84477982e7c770bb93928287893fcf2e03`](https://github.com/cloudflare/workers-sdk/tree/b7b4ff84477982e7c770bb93928287893fcf2e03)
- OpenNext for Cloudflare: [`da4b7fc8c89441a6f96205635fa70e329d1f0df7`](https://github.com/opennextjs/opennextjs-cloudflare/tree/da4b7fc8c89441a6f96205635fa70e329d1f0df7)
- SST: <https://github.com/sst/sst>
- node-sanitize-filename: <https://github.com/parshap/node-sanitize-filename>
- node-ignore: <https://github.com/kaelzhang/node-ignore>
- SQLite: <https://github.com/sqlite/sqlite>
The external `.vendor` Git submodules are separate works governed by the
license files in their respective repositories. This notice covers code copied
The first-class `submodules/` checkouts (distilled, floci) are separate works
governed by the license files in their respective repositories. This notice covers code copied
or adapted into the Alchemy repository; it does not replace the license
documentation within those submodules.
@@ -13,19 +13,19 @@
"deploy": "alchemy deploy",
"destroy": "alchemy destroy",
"logs": "alchemy logs",
"tail": "alchemy tail",
"tail": "alchemy logs --tail",
"bench": "bun test test/bench.test.ts"
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-bun": "catalog:effect",
"@effect/platform-node": "catalog:effect",
"@effect/platform-bun": "catalog:",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
},
"devDependencies": {
"@cloudflare/containers": "catalog:cloudflare",
"@cloudflare/workers-types": "catalog:cloudflare-runtime",
"@types/bun": "catalog:tooling"
"@cloudflare/containers": "catalog:",
"@cloudflare/workers-types": "catalog:",
"@types/bun": "catalog:"
}
}
-162
View File
@@ -1,162 +0,0 @@
[install]
minimumReleaseAge = 259200
minimumReleaseAgeExcludes = [
"astro",
"@astrojs/check",
"@astrojs/mdx",
"@astrojs/react",
"@astrojs/starlight",
"@opentui/core",
"@opentui/core-darwin-arm64",
"@opentui/core-darwin-x64",
"@opentui/core-linux-x64",
"@opentui/core-linux-arm64",
"@opentui/core-linux-x64-musl",
"@opentui/core-linux-arm64-musl",
"@opentui/core-win32-x64",
"@opentui/core-win32-arm64",
"@distilled.cloud/aws",
"@distilled.cloud/axiom",
"@alchemy.run/cloudflare-runtime",
"@alchemy.run/cloudflare-frameworks",
"@distilled.cloud/cloudflare",
"@distilled.cloud/core",
"@distilled.cloud/neon",
"@distilled.cloud/planetscale",
# TODO: remove once we pin a drizzle 1.0.0-rc.5 stable that is >3 days old —
# excluded because we track fresh rc5-branch builds for Effect 4 RC support.
"drizzle-kit",
"drizzle-orm",
"effect",
"fast-check",
"foldkit",
"@foldkit/vite-plugin",
"@effect/platform-browser",
"@effect/atom-react",
"@effect/language-service",
"@effect/platform-bun",
"@effect/platform-node-shared",
"@effect/platform-node",
"@effect/sql-d1",
"@effect/sql-mysql2",
"@effect/sql-pg",
"@effect/sql-sqlite-do",
"@effect/vitest",
"miniflare",
"typescript",
"@typescript/typescript-win32-x64",
"@typescript/typescript-win32-arm64",
"@typescript/typescript-linux-x64",
"@typescript/typescript-linux-arm",
"@typescript/typescript-linux-arm64",
"@typescript/typescript-darwin-x64",
"@typescript/typescript-darwin-arm64",
"@typescript/typescript-aix-ppc64",
"@typescript/typescript-freebsd-arm64",
"@typescript/typescript-freebsd-x64",
"@typescript/typescript-linux-loong64",
"@typescript/typescript-linux-mips64el",
"@typescript/typescript-linux-ppc64",
"@typescript/typescript-linux-riscv64",
"@typescript/typescript-linux-s390x",
"@typescript/typescript-netbsd-arm64",
"@typescript/typescript-netbsd-x64",
"@typescript/typescript-openbsd-arm64",
"@typescript/typescript-openbsd-x64",
"@typescript/typescript-sunos-x64",
# AWS SDK (credentials chain only — distilled implements the API calls
# itself; `@aws-sdk/credential-providers` is our sole direct dependency).
# AWS publishes the whole SDK monorepo near-daily, so caret ranges in
# published alchemy tarballs (installed fresh by e.g. the
# StaticSiteBeta67Migration test, with no lockfile) routinely have range
# minimums younger than the gate and hard-fail with "blocked by
# minimum-release-age". Exact names because this bun ignores wildcard
# patterns in this list (verified empirically); the set is every
# @aws-sdk/@smithy/@aws-crypto name in bun.lock — extend it if an AWS
# refactor introduces a new subpackage.
"@aws-sdk/checksums",
"@aws-sdk/client-cloudfront",
"@aws-sdk/client-dynamodb",
"@aws-sdk/client-lambda",
"@aws-sdk/client-s3",
"@aws-sdk/client-sqs",
"@aws-sdk/core",
"@aws-sdk/credential-provider-cognito-identity",
"@aws-sdk/credential-provider-env",
"@aws-sdk/credential-provider-http",
"@aws-sdk/credential-provider-ini",
"@aws-sdk/credential-provider-login",
"@aws-sdk/credential-provider-node",
"@aws-sdk/credential-provider-process",
"@aws-sdk/credential-provider-sso",
"@aws-sdk/credential-provider-web-identity",
"@aws-sdk/credential-providers",
"@aws-sdk/dynamodb-codec",
"@aws-sdk/endpoint-cache",
"@aws-sdk/middleware-bucket-endpoint",
"@aws-sdk/middleware-endpoint-discovery",
"@aws-sdk/middleware-expect-continue",
"@aws-sdk/middleware-flexible-checksums",
"@aws-sdk/middleware-host-header",
"@aws-sdk/middleware-location-constraint",
"@aws-sdk/middleware-logger",
"@aws-sdk/middleware-recursion-detection",
"@aws-sdk/middleware-sdk-s3",
"@aws-sdk/middleware-sdk-sqs",
"@aws-sdk/middleware-ssec",
"@aws-sdk/middleware-user-agent",
"@aws-sdk/nested-clients",
"@aws-sdk/region-config-resolver",
"@aws-sdk/signature-v4-multi-region",
"@aws-sdk/token-providers",
"@aws-sdk/types",
"@aws-sdk/util-endpoints",
"@aws-sdk/util-locate-window",
"@aws-sdk/util-user-agent-browser",
"@aws-sdk/util-user-agent-node",
"@aws-sdk/xml-builder",
"@aws-crypto/crc32",
"@aws-crypto/sha1-browser",
"@aws-crypto/sha256-browser",
"@aws-crypto/sha256-js",
"@aws-crypto/supports-web-crypto",
"@aws-crypto/util",
"@smithy/config-resolver",
"@smithy/core",
"@smithy/credential-provider-imds",
"@smithy/eventstream-serde-browser",
"@smithy/eventstream-serde-config-resolver",
"@smithy/eventstream-serde-node",
"@smithy/fetch-http-handler",
"@smithy/hash-blob-browser",
"@smithy/hash-node",
"@smithy/hash-stream-node",
"@smithy/invalid-dependency",
"@smithy/is-array-buffer",
"@smithy/md5-js",
"@smithy/middleware-content-length",
"@smithy/middleware-endpoint",
"@smithy/middleware-retry",
"@smithy/middleware-serde",
"@smithy/middleware-stack",
"@smithy/node-config-provider",
"@smithy/node-http-handler",
"@smithy/protocol-http",
"@smithy/shared-ini-file-loader",
"@smithy/signature-v4",
"@smithy/smithy-client",
"@smithy/types",
"@smithy/url-parser",
"@smithy/util-base64",
"@smithy/util-body-length-browser",
"@smithy/util-body-length-node",
"@smithy/util-buffer-from",
"@smithy/util-defaults-mode-browser",
"@smithy/util-defaults-mode-node",
"@smithy/util-endpoints",
"@smithy/util-middleware",
"@smithy/util-retry",
"@smithy/util-stream",
"@smithy/util-utf8",
"@smithy/util-waiter",
]
@@ -0,0 +1,5 @@
# tcut recordings + renders (the .cast is the source of truth for re-renders,
# but it is large and machine-specific — regenerate with `tcut demo.video.ts`)
out/
# credential file the recording writes for the on-camera `--env-file demo.env`
demo.env
@@ -0,0 +1,21 @@
import * as Alchemy from "alchemy";
import * as Cloudflare from "alchemy/Cloudflare";
import * as Effect from "effect/Effect";
import Api from "./src/Api.ts";
import { Uploads } from "./src/Uploads.ts";
export default Alchemy.Stack(
"Demo",
{
providers: Cloudflare.providers(),
state: Alchemy.localState(),
},
Effect.gen(function* () {
const api = yield* Api;
const uploads = yield* Uploads;
return {
url: api.url.as<string>(),
bucket: uploads.bucketName,
};
}),
);
@@ -0,0 +1,745 @@
/**
* Scripted terminal demo of the Alchemy CLI, recorded with tcut
* (https://github.com/AmanVarshney01/tcut).
*
* tcut demo.video.ts # record + render out/alchemy-cli.mp4
* tcut test demo.video.ts # replay fast, assertions only (no video)
* tcut render out/alchemy-cli.cast … # re-render the last recording, no shell
*
* The run never touches your real `~/.alchemy`: it starts from an EMPTY
* throwaway `ALCHEMY_HOME` and follows a brand-new user in order, one title
* card (`t.slide`, tcut ≥ 1.3) and mp4 chapter per step: connect Cloudflare
* through the `alchemy profile` TUI (OAuth,
* granted in tcut's browser pane), `alchemy dev`, `alchemy deploy`, an
* out-of-band edit caught and fixed by `alchemy drift`, and `alchemy destroy`.
* Stack state stays in this directory's `.alchemy/`; everything the demo
* deploys is destroyed at the end.
*
* Inputs (environment):
* CLOUDFLARE_ACCOUNT_NAME (env or ./.env, optional)
* The account to arrow down to in the picker when the login sees
* several accounts; defaults to the account id.
* CLOUDFLARE_LOGIN_EMAIL / CLOUDFLARE_LOGIN_PASSWORD (env or ./.env)
* Dashboard login for the Cloudflare account used on camera. If unset,
* the script waits (up to 4 min) for you to sign in by hand in the
* browser window; either way it clicks through the consent page.
* CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID
* API token for the OFF-camera pre-flight that destroys anything a
* previous take left behind. Falls back to the token stored in the
* real `testing` profile. Written to a gitignored `demo.env` that only
* `--env-file demo.env` reads, so the value never lands in the `.cast`.
*
* The CLI opens the OAuth URL with `open`; a shim on the recorded shell's
* PATH captures that URL for tcut's browser instead of your real browser.
*
* `alchemy dev` never returns on its own — the script drives it like a user
* would (edit a file, watch the reload) and then sends Ctrl+C.
*/
import { defineVideo } from "tcut";
import {
chmodSync,
existsSync,
mkdirSync,
readdirSync,
readFileSync,
rmSync,
writeFileSync,
} from "node:fs";
import os from "node:os";
import path from "node:path";
const here = path.dirname(new URL(import.meta.url).pathname);
const realHome = path.join(os.homedir(), ".alchemy");
const demoHome = path.join(os.tmpdir(), "alchemy-cli-demo-home");
const shimDir = path.join(os.tmpdir(), "alchemy-cli-demo-bin");
const oauthUrlFile = path.join(shimDir, "oauth-url");
const apiFile = path.join(here, "src", "Api.ts");
const envFile = path.join(here, "demo.env");
/**
* `KEY=value` lines from this directory's gitignored `.env`, if present.
*
* Bun auto-loads the same file into `process.env`, but with shell semantics:
* `$WORD` gets expanded and `#` starts a comment, which silently mangles a
* password containing either. Values are read verbatim here and take
* precedence over `process.env` for exactly the keys the file defines.
*/
const dotenv: Record<string, string> = Object.fromEntries(
(existsSync(path.join(here, ".env"))
? readFileSync(path.join(here, ".env"), "utf8").split("\n")
: []
)
.map((line) => line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/))
.filter((m): m is RegExpMatchArray => m !== null)
.map(([, key, value]) => [key, value!.replace(/^(["'])(.*)\1$/, "$2")]),
);
const env = (key: string) => dotenv[key] ?? process.env[key];
const login = {
email: env("CLOUDFLARE_LOGIN_EMAIL"),
password: env("CLOUDFLARE_LOGIN_PASSWORD"),
};
/** Matches the local provider's ready line; group 1 is the served URL. */
const STARTED = /Started in \d+ms → (http:\/\/localhost:\d+\/)/;
/**
* Resolves once `url` (our worker's favicon route) answers with the worker's
* own empty 404 three times in a row. Cloudflare's "not provisioned yet" page
* is also a 404, but carries an `error code: 1042` body.
*/
const waitForWorker = async (url: string, attempts = 90) => {
let streak = 0;
for (let i = 0; i < attempts; i++) {
const ok = await fetch(url, { signal: AbortSignal.timeout(5_000) })
.then(async (r) => r.status === 404 && (await r.text()) === "")
.catch(() => false);
streak = ok ? streak + 1 : 0;
if (streak === 3) return;
await new Promise((resolve) => setTimeout(resolve, 1000));
}
throw new Error(`${url} did not come up after ${attempts}s`);
};
/**
* Write `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` to `demo.env`
* (gitignored, removed after the take). The on-camera setup command reads
* them through `--env-file demo.env`, so the value is never typed and never
* lands in the `.cast`; no other command loads the file, so deploy/dev
* authenticate through the profile rather than the environment.
*
* Returns the credentials for the script's own out-of-band API call (the
* drift step).
*/
const writeCredentialEnvFile = () => {
let token = env("CLOUDFLARE_API_TOKEN");
let accountId = env("CLOUDFLARE_ACCOUNT_ID");
if (!token || !accountId) {
const stored = JSON.parse(
readFileSync(
path.join(realHome, "profiles", "testing", "cloudflare.json"),
"utf8",
),
).values as Record<string, string>;
if (stored.credentialType !== "apiToken") {
throw new Error(
"set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (the 'testing' profile has no stored API token to fall back on)",
);
}
token = stored.apiToken!;
accountId = stored.accountId!;
}
// The account id is also how the script picks the account if the OAuth
// login can see more than one; it is public enough (the dashboard prints it).
process.env.CLOUDFLARE_ACCOUNT_ID = accountId;
writeFileSync(
envFile,
`CLOUDFLARE_API_TOKEN=${token}\nCLOUDFLARE_ACCOUNT_ID=${accountId}\n`,
{ mode: 0o600 },
);
return { token, accountId };
};
const connectCloudflare = (profile: string) =>
`alchemy profile edit --profile ${profile} --add Cloudflare --method stored --set apiToken=env:CLOUDFLARE_API_TOKEN --set accountId=env:CLOUDFLARE_ACCOUNT_ID --env-file demo.env`;
/**
* The deployed `Visits` KV namespace, read from the stack's local state
* (`alchemy deploy` targets the `live_<user>` stage).
*/
const deployedVisitsNamespace = () => {
const stackDir = path.join(here, ".alchemy", "state", "Demo");
const stage = readdirSync(stackDir).find((name) => name.startsWith("live_"));
if (stage === undefined) {
throw new Error(`no live stage under ${stackDir}`);
}
const state = JSON.parse(
readFileSync(path.join(stackDir, stage, "Visits.json"), "utf8"),
) as { attr: { title: string; namespaceId: string; accountId: string } };
return state.attr;
};
/** Direct Cloudflare API access to one KV namespace, bypassing alchemy. */
const kvNamespaceApi = (
credentials: { token: string; accountId: string },
namespaceId: string,
) => {
const call = async (init: RequestInit) => {
const response = await fetch(
`https://api.cloudflare.com/client/v4/accounts/${credentials.accountId}/storage/kv/namespaces/${namespaceId}`,
{
...init,
headers: {
Authorization: `Bearer ${credentials.token}`,
"Content-Type": "application/json",
},
},
);
const body = (await response.json()) as { result: { title: string } };
if (!response.ok) {
throw new Error(
`KV namespace ${namespaceId}: ${init.method} failed with ${response.status} ${JSON.stringify(body)}`,
);
}
return body.result;
};
return {
title: async () => (await call({ method: "GET" })).title,
/**
* Rename the namespace behind alchemy's back — what a teammate clicking
* around the dashboard would do. This is the drift the demo detects and
* repairs.
*/
rename: (title: string) =>
call({ method: "PUT", body: JSON.stringify({ title }) }),
};
};
/** Fresh, empty `ALCHEMY_HOME`. */
const seedDemoHome = () => {
rmSync(demoHome, { recursive: true, force: true });
mkdirSync(demoHome, { recursive: true });
};
/**
* `open` shim: instead of launching the system browser, record the URL so the
* script can hand it to tcut's browser pane.
*/
const seedOpenShim = () => {
rmSync(shimDir, { recursive: true, force: true });
mkdirSync(shimDir, { recursive: true });
const shim = path.join(shimDir, "open");
writeFileSync(shim, `#!/bin/sh\nprintf '%s' "$1" > ${oauthUrlFile}\n`);
chmodSync(shim, 0o755);
};
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
/** The authorization URL the CLI asked `open` to launch. */
const waitForOAuthUrl = async (attempts = 240) => {
for (let i = 0; i < attempts; i++) {
if (existsSync(oauthUrlFile)) return readFileSync(oauthUrlFile, "utf8");
await sleep(250);
}
throw new Error("the CLI never opened the OAuth URL");
};
/**
* Cloudflare's login page is a React form; set the controlled inputs through
* the native value setter (so React sees the change) and submit.
*/
const signInScript = (email: string, password: string) => `(() => {
const set = (selector, value) => {
const el = document.querySelector(selector);
if (!el) return false;
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(el, value);
el.dispatchEvent(new Event("input", { bubbles: true }));
el.dispatchEvent(new Event("change", { bubbles: true }));
return true;
};
return set("#email", ${JSON.stringify(email)}) && set("#password", ${JSON.stringify(password)});
})()`;
/** True once both controlled inputs actually hold the values we set. */
const signInFilledScript = (email: string, password: string) =>
`document.querySelector("#email")?.value === ${JSON.stringify(email)} &&
document.querySelector("#password")?.value === ${JSON.stringify(password)}`;
/**
* True once the login page's Turnstile widget has produced its token. Without
* it Cloudflare answers a perfectly good password with "Incorrect email or
* password", so the submit has to wait for it. (`login_challenge` is a
* different, always-populated field — don't match on `*challenge*`.)
*/
const turnstileReadyScript = `[...document.querySelectorAll(
'input[name="cf_challenge_response"], input[name="cf-turnstile-response"]'
)].some((el) => el.value.length > 0)`;
/**
* The account row to pick on the consent screen's "Select account(s)" step:
* the configured account name, or whichever row comes first.
*/
const accountButtonPattern = (() => {
const name = env("CLOUDFLARE_ACCOUNT_NAME");
return name
? new RegExp(`^${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`, "i")
: /^(?!Review permissions$|Cancel$).+/;
})();
/** Click the first button whose text matches (consent pages vary in markup). */
const clickButtonScript = (pattern: RegExp) => `(() => {
const el = [...document.querySelectorAll("button, input[type=submit], a[role=button]")]
.find((b) => ${pattern}.test((b.innerText || b.value || "").trim()));
if (!el) return false;
el.click();
return true;
})()`;
/** Logical frame size (rendered at 2x); the 110x32 grid is centred inside. */
const VIDEO = { width: 1368, height: 816 };
export default defineVideo(
{
output: ["out/alchemy-cli.mp4"],
shell: "zsh",
cols: 110,
rows: 32,
width: VIDEO.width,
height: VIDEO.height,
theme: "catppuccin-mocha",
typingSpeed: "15ms",
typingJitter: 0.3,
waitTimeout: "180s",
endPause: "2s",
requires: ["curl"],
// A real browser window, composited over the terminal only while
// focused — used for the OAuth grant and to show the local dev server.
// Sized to the video so it takes the whole frame when it is in front.
browser: { position: "overlay", ...VIDEO, offset: { x: 0, y: 0 } },
},
async (t) => {
seedDemoHome();
seedOpenShim();
const credentials = writeCredentialEnvFile();
const originalApi = readFileSync(apiFile, "utf8");
/**
* A full-screen transition card between steps (`t.slide`, tcut ≥ 1.3),
* drawn at render time in real typography and faded in and out. It also
* records an mp4 chapter of the same name (`--chapters`,
* `--split-chapters`), and the screen is cleared behind the card so the
* next step starts fresh.
*/
let step = 0;
const slide = async (heading: string, subtitle: string) => {
step += 1;
await t.caption(null);
await t.slide(heading, {
eyebrow: String(step),
subtitle,
duration: "2.2s",
fade: "400ms",
during: async () => {
// `run` waits for a fresh prompt, which never comes when the screen
// is already just a prompt (clear redraws nothing new).
const lines = t
.screen()
.split("\n")
.filter((l) => l.trim());
if (lines.length > 1) await t.run("clear");
},
});
};
/**
* A subtitle over the bottom of the terminal (`t.caption`, tcut ≥ 1.4) for
* the moments where the screen alone doesn't say what is happening. Drawn
* at render time, never typed into the PTY; stays up until the next
* caption, `caption(null)`, or the next slide.
*/
const caption = (text: string, duration?: string) =>
t.caption(text, { style: "classic", fontSize: 26, duration });
try {
// Off-camera: point the CLI at the empty home, put the `open` shim and
// the workspace `alchemy` bin on PATH, and make sure nothing is left
// from a previous take.
await t.hide(async () => {
await t.run(
`export ALCHEMY_HOME=${JSON.stringify(demoHome)} PATH="${shimDir}:$PWD/node_modules/.bin:$PATH"`,
);
// The CLI falls back to plain output when it detects a coding agent
// (CURSOR_AGENT, CLAUDECODE, …) or CI in the environment, and drops
// colors under NO_COLOR; the demo is about the TUI, so force both on
// regardless of who launched tcut.
await t.run(
"unset CI CURSOR_AGENT CLAUDECODE CLAUDE_CODE NO_COLOR FORCE_COLOR; export ALCHEMY_TUI=1",
);
// tcut's pty has no TERM_PROGRAM, so terminal-capability detection
// assumes OSC 8 hyperlinks are unsupported and the CLI falls back to
// printing every URL in full after its label (the OAuth URL is ~1KB).
// Real terminals (Ghostty, iTerm2, kitty, …) render the link inline.
await t.run("export FORCE_HYPERLINK=1");
// A previous take may have left a live stack behind: tear it down with
// a temporary profile before the home is wiped for the on-camera setup.
await t.run(`${connectCloudflare("default")} --no-input`);
await t.run("alchemy destroy --yes --no-input >/dev/null 2>&1 || true");
// Local state (including the dev stage's emulated resources) and the
// demo home start from scratch so every take plays out the same way.
const home = JSON.stringify(demoHome);
await t.run(`rm -rf .alchemy ${home} && mkdir -p ${home}`);
await t.run("clear");
});
// ── 1. Connect to Cloudflare ─────────────────────────────────────────
await slide("Connect Cloudflare", "alchemy profile · sign in with OAuth");
await t.type("alchemy profile");
await t.enter();
await t.wait(/e edit/, { scope: "screen" });
await caption(
"A fresh machine: one empty profile, no providers connected yet",
);
await t.sleep("2.5s");
// Nothing is connected yet — add Cloudflare from the edit screen.
await caption("e edits the profile — space marks a provider to add");
await t.type("e");
await t.wait(/esc back/, { scope: "screen" });
await t.sleep("2s");
await t.down(2);
await t.sleep("600ms");
await t.type(" ");
await t.wait(/Cloudflare\s+add/, { scope: "screen" });
await t.sleep("1.2s");
await t.enter();
// OAuth (the recommended method), basic scopes.
await t.wait(/Cloudflare authentication method/, { scope: "screen" });
await caption("OAuth is the recommended method — no API token to paste");
await t.sleep("2s");
await t.enter();
await t.wait(/Cloudflare OAuth scopes/, { scope: "screen" });
await caption("Pick the scopes the token should have");
await t.sleep("1.5s");
await t.down();
await t.sleep("600ms");
await t.enter();
// The CLI hands the grant URL to `open` — our shim catches it and the
// grant happens in the browser pane, exactly as it would in a real tab.
await t.wait(/waiting for browser authorization/, { scope: "screen" });
await caption("The CLI opens Cloudflare's consent page in the browser");
const oauthUrl = await waitForOAuthUrl().catch((error) => {
throw new Error(`${error.message}\n--- screen ---\n${t.screen()}`);
});
await t.sleep("2s");
await caption(
"Sign in and authorize — the grant is handed back to the CLI",
);
await t.browser.goto(oauthUrl);
await t.focus("browser");
const consentPage = /Select account\(s\)|Authorize/i;
await t.browser.waitFor(
new RegExp(`Sign in to Cloudflare|${consentPage.source}`, "i"),
{ timeout: "60s" },
);
const pageText = async () =>
String(
await t.browser.evaluate("document.body.innerText").catch(() => ""),
);
if (/Sign in to Cloudflare/i.test(await pageText())) {
if (login.email && login.password) {
// The form is React-controlled and re-renders while it hydrates and
// while Turnstile runs, so a fill can be dropped: verify the inputs
// hold our values and the challenge token exists before submitting,
// and retry if Cloudflare rejects a half-filled submission.
for (let attempt = 1; attempt <= 3; attempt++) {
await t.sleep("1.5s");
for (let i = 0; i < 10; i++) {
await t.browser.evaluate(
signInScript(login.email, login.password),
);
await t.sleep("400ms");
if (
(await t.browser.evaluate(
signInFilledScript(login.email, login.password),
)) === true
)
break;
}
let turnstile = false;
for (let i = 0; i < 60 && !turnstile; i++) {
turnstile =
(await t.browser.evaluate(turnstileReadyScript)) === true;
if (!turnstile) await t.sleep("500ms");
}
if (!turnstile)
console.error(
"turnstile token never appeared; submitting anyway",
);
await t.sleep("500ms");
await t.browser.click('[data-testid="login-submit-button"]');
let rejected = false;
for (let i = 0; i < 40; i++) {
await t.sleep("500ms");
const text = await pageText();
if (/Incorrect email or password/i.test(text)) {
rejected = true;
break;
}
if (text.trim() !== "" && !/Sign in to Cloudflare/i.test(text))
break;
}
if (!rejected) break;
console.error(
`cloudflare rejected the sign-in (attempt ${attempt}); retrying`,
`\n url: ${t.browser.url}`,
`\n hidden inputs: ${await t.browser.evaluate(
`JSON.stringify([...document.querySelectorAll("input[type=hidden]")].map((i) => [i.name, i.value.length]))`,
)}`,
`\n page: ${(await pageText()).replace(/\s+/g, " ").slice(0, 400)}`,
);
}
}
// Either the credentials just submitted, or a human signs in now.
await t.browser.waitFor(consentPage, { timeout: "240s" });
}
// Cloudflare's consent has two steps when the login can see several
// accounts: pick the account the grant covers, review the permissions,
// then authorize. With a single account it opens on the review step.
if (/Select account\(s\)/i.test(await pageText())) {
await t.sleep("2s");
await t.browser.evaluate(clickButtonScript(accountButtonPattern));
await t.sleep("1.2s");
await t.browser.evaluate(clickButtonScript(/^Review permissions$/i));
await t.browser.waitFor(/^Authorize$/im, { timeout: "60s" });
}
await t.sleep("2.5s");
await t.browser.evaluate(clickButtonScript(/^Authorize$/i));
// Cloudflare redirects to alchemy.run/auth/callback, which relays the
// code to the CLI's localhost listener and lands on the success page.
// The relay pings localhost with a cross-scheme fetch first; when the
// embedded browser refuses that, the page offers a plain link to the
// local callback instead — take it.
await t.browser.waitFor(
/Authentication Complete|Authentication Error|Couldn't connect to your local|Cloudflare did not authorize/i,
{ timeout: "60s" },
);
if (/Couldn't connect to your local/i.test(await pageText())) {
await t.browser.click("#relay-local");
await t.browser.waitFor(
/Authentication Complete|Authentication Error/i,
{
timeout: "60s",
},
);
}
await t.sleep("2s");
await t.focus("terminal");
// Back in the terminal the callback has landed and the account is bound.
await t.wait(/Cloudflare added|Select a Cloudflare account/, {
scope: "screen",
});
if (/Select a Cloudflare account/.test(t.screen())) {
await caption(
"The login can see several accounts — pick the one this profile is for",
);
await t.sleep("1.5s");
// Arrow down to the configured account (the focused row starts with
// ❯) instead of typing into the filter; the first row is the default.
const wanted =
env("CLOUDFLARE_ACCOUNT_NAME") ?? process.env.CLOUDFLARE_ACCOUNT_ID;
const focused = () =>
t
.screen()
.split("\n")
.find((line) => /^\s*❯/.test(line)) ?? "";
for (let i = 0; i < 8 && wanted && !focused().includes(wanted); i++) {
await t.down();
await t.sleep("400ms");
}
await t.sleep("600ms");
await t.enter();
await t.wait(/Cloudflare added/, { scope: "screen" });
}
// Hold on the dashboard: one profile, one connected provider.
await caption(
"Connected — auth method, token expiry and account id, stored under ~/.alchemy/profiles",
);
await t.sleep("3.5s");
await t.type("q");
await t.wait();
await t.sleep("1s");
// ── 2. Launch alchemy dev ────────────────────────────────────────────
await slide(
"Launch alchemy dev",
"local emulation · plan view · live reload",
);
await t.type("alchemy dev");
await t.enter();
await t.wait(STARTED, { scope: "screen" });
await caption(
"The Worker, KV and R2 all run locally — the widget shows the stack's outputs",
);
await t.sleep("2s");
// The widget opens on the stack's output; ←/→ flips it to the plan
// that was just applied. Show the plan — three local resources, all
// created — then come back to the output.
const showDevPlan = async (pattern: RegExp, text: string) => {
await caption("→ flips the widget to the plan that was just applied");
await t.sleep("1s");
await t.right();
await t.wait(/show output/, { scope: "screen" });
await t.expect(pattern, { scope: "screen" });
await caption(text);
await t.sleep("4s");
await caption("← back to the outputs");
await t.sleep("800ms");
await t.left();
await t.wait(/show plan/, { scope: "screen" });
await t.sleep("1.5s");
};
await showDevPlan(
/Cloudflare\.KV\.Namespace\).*created/,
"Three resources created, all emulated locally",
);
// Hit the local worker in a browser — at the URL the CLI actually
// printed, never a guess (another dev server may own the default port).
const devUrl = t.screen().match(STARTED)?.[1];
if (devUrl === undefined) {
throw new Error("local dev URL not found in the terminal output");
}
await caption("Open the local URL");
await t.sleep("800ms");
await t.browser.goto(devUrl);
await t.focus("browser");
await t.sleep("3s");
await t.focus("terminal");
await t.sleep("1s");
// Change the greeting while dev is running — the stack reloads and the
// worker restarts.
await caption(
"Editing src/Api.ts while dev runs — the stack reloads and the Worker restarts",
);
await t.sleep("1.2s");
writeFileSync(
apiFile,
originalApi.replace(
'const GREETING = "Hello from Alchemy";',
'const GREETING = "Hello from alchemy dev";',
),
);
await t.wait(/restarting instance/, { scope: "screen" });
await t.wait(/Started in \d+ms[^]*Started in \d+ms/, {
scope: "screen",
});
if (!t.screen().split("Started in").pop()!.includes(devUrl)) {
throw new Error("worker restarted on a different URL");
}
await t.sleep("1.5s");
// The reload's plan: only the Worker changed, KV and R2 untouched.
await showDevPlan(
/Cloudflare\.Worker\)/,
"Only the Worker was updated — KV and R2 untouched",
);
await caption("Reload the page: the new greeting");
await t.sleep("800ms");
await t.browser.reload();
await t.focus("browser");
await t.sleep("3s");
await t.focus("terminal");
await t.sleep("1.5s");
// alchemy dev parks forever — Ctrl+C shuts it down.
await caption("Ctrl+C stops dev and tears the local resources down");
await t.sleep("800ms");
await t.ctrl("c");
await t.wait();
// Put the source back so the deploy ships the original greeting.
writeFileSync(apiFile, originalApi);
await t.sleep("1s");
// ── 3. Deploy to the cloud ───────────────────────────────────────────
await slide(
"Deploy to the cloud",
"alchemy deploy · review the plan · confirm",
);
await t.type("alchemy deploy");
await t.enter();
await t.wait(/Deploy\?/, { scope: "screen" });
await caption(
"The same stack, now against the real Cloudflare account — review the plan, Enter to confirm",
);
await t.sleep("3.5s");
await t.enter();
await caption(
"Creating the Worker, the KV namespace and the R2 bucket for real",
);
await t.wait();
await t.expect(/Stack deployed/, { scope: "scrollback" });
await caption(
"Deployed — the outputs are the live workers.dev URL and the bucket name",
);
await t.sleep("2.5s");
const url = t
.scrollback()
.match(/https:\/\/[a-z0-9.-]+\.workers\.dev/)?.[0];
if (url === undefined) {
throw new Error("deployed URL not found in the terminal output");
}
// A fresh workers.dev subdomain takes a few seconds to start serving
// (Cloudflare error 1042 until then). Poll from the script — not the
// recorded shell — on a route that leaves the visit counter alone, so
// the visible curls read 1 and 2.
await waitForWorker(`${url}/favicon.ico`);
await caption("Hit the live Worker — the visit counter is backed by KV");
await t.run(`curl -s ${url}`);
await t.expect(/"visits":1/);
await t.sleep("1s");
await t.run(`curl -s ${url}`);
await t.expect(/"visits":2/);
await t.sleep("2s");
// ── 4. Detect and repair drift ───────────────────────────────────────
// Off camera, "someone" renames the KV namespace in the dashboard.
const visits = deployedVisitsNamespace();
const visitsApi = kvNamespaceApi(credentials, visits.namespaceId);
await visitsApi.rename("renamed-in-the-dashboard");
await slide(
"Detect and repair drift",
"alchemy drift · a namespace renamed in the dashboard",
);
await caption(
"Meanwhile, someone renamed the KV namespace in the Cloudflare dashboard…",
);
await t.sleep("2.5s");
await t.type("alchemy drift");
await t.enter();
await t.wait(/Drift detected/, { scope: "screen" });
await t.expect(/renamed-in-the-dashboard/, { scope: "screen" });
await caption(
"drift re-reads the cloud and diffs it against the stack: the title changed",
);
await t.sleep("4s");
// Cancel is preselected; ← moves to Repair.
await caption(
"Repair puts the resource back the way the code declares it",
);
await t.left();
await t.sleep("1s");
await t.enter();
await caption("Applying the repair");
await t.wait();
await t.expect(/Stack deployed/, { scope: "screen" });
await caption("Repaired — one update, nothing else touched");
await t.sleep("2.5s");
if ((await visitsApi.title()) !== visits.title) {
throw new Error("drift repair did not restore the namespace title");
}
// ── 5. Tear down ─────────────────────────────────────────────────────
await slide("Tear it down", "alchemy destroy");
await t.type("alchemy destroy");
await t.enter();
await t.wait(/Destroy\?/, { scope: "screen" });
await caption(
"destroy shows everything it is about to delete before asking",
);
await t.sleep("2.5s");
await t.type("y");
await caption("Deleting the Worker, the KV namespace and the R2 bucket");
await t.wait();
await t.expect(/Stack destroyed/, { scope: "scrollback" });
await caption("All gone — the account is back to where it started");
await t.sleep("2s");
} finally {
writeFileSync(apiFile, originalApi);
rmSync(envFile, { force: true });
rmSync(shimDir, { recursive: true, force: true });
}
},
);
@@ -0,0 +1,19 @@
{
"name": "alchemy-cli-demo",
"version": "0.0.0",
"private": true,
"license": "Apache-2.0",
"type": "module",
"scripts": {
"deploy": "alchemy deploy",
"dev": "alchemy dev",
"destroy": "alchemy destroy",
"demo": "tcut demo.video.ts"
},
"dependencies": {
"@effect/platform-bun": "catalog:",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:"
}
}
@@ -0,0 +1,74 @@
import * as Cloudflare from "alchemy/Cloudflare";
import * as Effect from "effect/Effect";
import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
import * as HttpServerResponse from "effect/unstable/http/HttpServerResponse";
import { Uploads } from "./Uploads.ts";
import { Visits } from "./Visits.ts";
const GREETING = "Hello from Alchemy";
const page = (message: string) => `<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>${message}</title>
<style>
body { margin: 0; min-height: 100vh; display: grid; place-items: center;
background: #1e1e2e; color: #cdd6f4;
font: 18px/1.5 ui-sans-serif, system-ui, sans-serif; }
main { text-align: center; }
h1 { font-size: 2.75rem; margin: 0 0 .5rem; }
p { margin: 0; color: #a6adc8; }
</style>
</head>
<body><main><h1>${message}</h1><p>Cloudflare Worker · KV · R2</p></main></body>
</html>`;
export default class Api extends Cloudflare.Worker<Api>()(
"Api",
{
main: import.meta.url,
// Fixed, uncommon port so the demo never silently lands on another
// process's dev server (1337 is the default and is often taken).
dev: { port: 3111, strictPort: true },
},
Effect.gen(function* () {
const visits = yield* Cloudflare.KV.ReadWriteNamespace(Visits);
const uploads = yield* Cloudflare.R2.ReadWriteBucket(Uploads);
return {
fetch: Effect.gen(function* () {
const request = yield* HttpServerRequest.HttpServerRequest;
const url = new URL(request.url, "http://internal");
if (url.pathname === "/favicon.ico") {
return HttpServerResponse.empty({ status: 404 });
}
if (url.pathname === "/upload") {
const body = yield* request.text;
yield* uploads.put("latest.txt", body).pipe(Effect.orDie);
return yield* HttpServerResponse.json({ stored: body.length });
}
const previous = yield* visits.get("count").pipe(Effect.orDie);
const count = Number(previous ?? "0") + 1;
yield* visits.put("count", String(count)).pipe(Effect.orDie);
// Browsers get a page, curl gets JSON.
if (request.headers.accept?.includes("text/html")) {
return HttpServerResponse.html(page(GREETING));
}
return yield* HttpServerResponse.json({
message: GREETING,
visits: count,
});
}),
};
}).pipe(
Effect.provide([
Cloudflare.KV.ReadWriteNamespaceBinding,
Cloudflare.R2.ReadWriteBucketBinding,
]),
),
) {}
@@ -0,0 +1,5 @@
import * as Cloudflare from "alchemy/Cloudflare";
export const Uploads = Cloudflare.R2.Bucket("Uploads", {
forceDestroy: true,
});
@@ -0,0 +1,3 @@
import * as Cloudflare from "alchemy/Cloudflare";
export const Visits = Cloudflare.KV.Namespace("Visits");
@@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.base.json",
// demo.video.ts imports "tcut", which only resolves inside the tcut binary,
// so it is deliberately left out of the program.
"include": ["alchemy.run.ts", "src/**/*.ts"],
"compilerOptions": {
"noEmit": true,
"rootDir": ".",
"module": "Preserve",
"moduleResolution": "Bundler",
"target": "ESNext"
},
"references": [
{
"path": "../../packages/alchemy/tsconfig.json"
}
]
}
Submodule .repos/alchemy-effect/distilled deleted from cb11c5bf19.
@@ -17,8 +17,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -16,8 +16,11 @@
"test": "bun test"
},
"dependencies": {
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
},
"devDependencies": {
"alchemy-test": "workspace:*"
}
}
@@ -144,7 +144,7 @@ export default class ApiFunction extends Lambda.Function<ApiFunction>()(
const url = new URL(request.originalUrl);
if (url.pathname === "/") {
const variable = yield* Config.string("MY_VARIABLE");
const variable = yield* Config.String("MY_VARIABLE");
return yield* HttpServerResponse.json({ marker: MARKER, variable });
}
@@ -35,23 +35,30 @@
* the new marker; restoring it must swap back
*/
import { afterAll, expect, test } from "bun:test";
import { spawn, spawnSync } from "node:child_process";
import { DevCli, fetchOk } from "alchemy-test/DevCli";
import { spawnSync } from "node:child_process";
import * as fs from "node:fs";
import * as path from "node:path";
const root = path.resolve(import.meta.dirname, "..");
// Spawn the CLI entry directly (not through `bun run` / the cli.js
// launcher) so signals hit the actual CLI process, whose scope teardown
// kills the exec child and the provider sidecars.
const alchemyBin = path.join(
root,
"node_modules",
"alchemy",
"bin",
"alchemy.ts",
);
// Isolated stage so this suite never fights other local runs over state.
const STAGE = "dev-cli-test";
// Credential-free dev, deterministically: an isolated (unconfigured)
// alchemy profile plus stripped AWS env credentials keep this suite
// hermetic — it must pass on a machine with zero AWS configuration, and
// must never touch a developer's real profile. (Action data-plane calls
// are routed to the emulator per bound resource by the engine regardless
// of ambient credentials — see Binding.Service's data-plane routing.)
const cli = new DevCli({
root,
stage: STAGE,
env: {
ALCHEMY_PROFILE: "aws-dev-cli-test",
AWS_ACCESS_KEY_ID: undefined,
AWS_SECRET_ACCESS_KEY: undefined,
AWS_SESSION_TOKEN: undefined,
AWS_PROFILE: undefined,
},
});
const markerPath = path.join(root, "src", "marker.ts");
const markerSource = fs.readFileSync(markerPath, "utf8");
@@ -59,140 +66,26 @@ const markerSource = fs.readFileSync(markerPath, "utf8");
// The whole suite needs docker (floci runs as a container).
const dockerAvailable =
spawnSync("docker", ["info"], { stdio: "ignore" }).status === 0;
// Credential-free dev, deterministically: an isolated (unconfigured)
// alchemy profile plus stripped AWS env credentials keep this suite
// hermetic — it must pass on a machine with zero AWS configuration, and
// must never touch a developer's real profile. (Action data-plane calls
// are routed to the emulator per bound resource by the engine regardless
// of ambient credentials — see Binding.Service's data-plane routing.)
const devEnv: NodeJS.ProcessEnv = {
...process.env,
ALCHEMY_PROFILE: "aws-dev-cli-test",
};
delete devEnv.AWS_ACCESS_KEY_ID;
delete devEnv.AWS_SECRET_ACCESS_KEY;
delete devEnv.AWS_SESSION_TOKEN;
delete devEnv.AWS_PROFILE;
let proc: ReturnType<typeof spawn> | undefined;
let output = "";
const pump = (stream: NodeJS.ReadableStream) => {
stream.on("data", (chunk: Buffer) => {
const text = chunk.toString();
output += text;
if (process.env.DEBUG) process.stderr.write(text);
});
};
/** Bounded poll for a (possibly async) producer to yield a value. */
const pollUntil = async <T>(
what: string,
f: () => T | undefined | Promise<T | undefined>,
{ tries = 30, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
): Promise<T> => {
for (let i = 0; i < tries; i++) {
const value = await f();
if (value !== undefined) return value;
await Bun.sleep(delayMs);
}
throw new Error(
`Timed out waiting for ${what}.\n--- alchemy dev output (tail) ---\n${output.slice(-4000)}`,
);
};
/** Fetch with retries — the emulator's URL proxy takes a moment to serve. */
const fetchOk = async (
url: string | URL,
init?: RequestInit,
{ tries = 20, delayMs = 500 }: { tries?: number; delayMs?: number } = {},
) => {
let last: Response | undefined;
for (let i = 0; i < tries; i++) {
try {
last = await fetch(url, init);
if (last.ok) return last;
} catch {
// proxy not listening yet
}
await Bun.sleep(delayMs);
}
throw new Error(
`${init?.method ?? "GET"} ${url} never returned 2xx (last status: ${last?.status})`,
);
};
/** Extract the api URL from the stack outputs the CLI prints on stdout. */
const outputUrl = (key: string) =>
output.match(new RegExp(`${key}:\\s*['"]?(http[^\\s'",]+)`))?.[1];
/** Extract a plain (single-token) stack output value from stdout. */
const outputValue = (key: string) =>
output.match(new RegExp(`${key}:\\s*['"]?([^\\s'",]+)`))?.[1];
afterAll(async () => {
// Always leave the repo tree clean, even on a mid-reload failure.
fs.writeFileSync(markerPath, markerSource);
if (proc?.pid) {
// Ctrl-C semantics: signal the whole PROCESS GROUP (the CLI, its
// `--watch` exec child, and the provider sidecars). Signaling only the
// CLI process orphans the exec child, which then keeps the stack's
// state locked and blocks the destroy below.
const killGroup = (signal: NodeJS.Signals) => {
try {
process.kill(-proc!.pid!, signal);
} catch {
// group already gone
}
};
const exited = new Promise((resolve) => proc!.once("exit", resolve));
killGroup("SIGINT");
await Promise.race([exited, Bun.sleep(15_000)]);
if (proc.exitCode === null && proc.signalCode === null) {
killGroup("SIGKILL");
await Promise.race([exited, Bun.sleep(5_000)]);
}
}
await cli.stop();
if (!process.env.NO_DESTROY && dockerAvailable) {
const destroyed = spawnSync(
"bun",
[alchemyBin, "destroy", "--stage", STAGE, "--yes"],
{
cwd: root,
stdio: "inherit",
timeout: 120_000,
env: devEnv,
},
);
if (destroyed.status !== 0) {
throw new Error(
`alchemy destroy exited ${destroyed.status} — local teardown must succeed`,
);
}
cli.destroy();
}
}, 180_000);
test.skipIf(!dockerAvailable)(
"alchemy dev serves every local AWS binding end-to-end with hot reload",
async () => {
proc = spawn("bun", [alchemyBin, "dev", "--stage", STAGE], {
cwd: root,
// Own process group, so teardown can deliver Ctrl-C to the whole tree
// the way a terminal would.
detached: true,
stdio: ["ignore", "pipe", "pipe"],
env: devEnv,
});
pump(proc.stdout!);
pump(proc.stderr!);
cli.start();
// The first dev deploy may pull the floci image, provision the local
// data plane, and package the function before printing stack outputs.
const api = await pollUntil(
const api = await cli.pollUntil(
"api url in stack outputs",
() => outputUrl("api"),
() => cli.outputUrl("api"),
{ tries: 300, delayMs: 1000 },
);
@@ -207,12 +100,13 @@ test.skipIf(!dockerAvailable)(
// CLI's exec process and put/get an object through the S3 bindings.
// The dummy account id proves the calls hit the emulator, not real
// AWS; the roundtripped body proves the put actually landed.
const seedAccount = await pollUntil("seedAccount in stack outputs", () =>
outputValue("seedAccount"),
const seedAccount = await cli.pollUntil(
"seedAccount in stack outputs",
() => cli.outputValue("seedAccount"),
);
expect(seedAccount).toBe("000000000000");
const seedText = await pollUntil("seedText in stack outputs", () =>
outputValue("seedText"),
const seedText = await cli.pollUntil("seedText in stack outputs", () =>
cli.outputValue("seedText"),
);
expect(seedText).toBe("seed-object-body-v1");
@@ -244,7 +138,7 @@ test.skipIf(!dockerAvailable)(
headers: { "content-type": "application/json" },
body: JSON.stringify(message),
});
const received = await pollUntil(
const received = await cli.pollUntil(
"queue message to be consumed",
async () => {
const res = await fetch(
@@ -269,7 +163,7 @@ test.skipIf(!dockerAvailable)(
headers: { "content-type": "application/json" },
body: JSON.stringify(notification),
});
const delivered = await pollUntil(
const delivered = await cli.pollUntil(
"topic notification to be consumed",
async () => {
const res = await fetch(
@@ -292,7 +186,7 @@ test.skipIf(!dockerAvailable)(
headers: { "content-type": "application/json" },
body: JSON.stringify({ id: itemId }),
});
const change = await pollUntil(
const change = await cli.pollUntil(
"table change record to be consumed",
async () => {
const res = await fetch(new URL(`/changes?id=${itemId}`, api));
@@ -311,7 +205,7 @@ test.skipIf(!dockerAvailable)(
markerPath,
markerSource.replace("aws-dev-marker-v1", "aws-dev-marker-v2"),
);
await pollUntil(
await cli.pollUntil(
"hot-swapped marker v2",
async () => {
try {
@@ -340,7 +234,7 @@ test.skipIf(!dockerAvailable)(
// Restore the marker — the swap back is itself a second hot reload,
// and leaves the checked-in tree clean.
fs.writeFileSync(markerPath, markerSource);
await pollUntil(
await cli.pollUntil(
"restored marker v1",
async () => {
try {
@@ -16,8 +16,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -17,8 +17,11 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
},
"devDependencies": {
"alchemy-test": "workspace:*"
}
}
@@ -15,24 +15,14 @@
* image without a redeploy
*/
import { afterAll, expect, test } from "bun:test";
import { spawn, spawnSync } from "node:child_process";
import { DevCli, fetchOk } from "alchemy-test/DevCli";
import { spawnSync } from "node:child_process";
import * as fs from "node:fs";
import * as path from "node:path";
const root = path.resolve(import.meta.dirname, "..");
// Spawn the CLI entry directly (not through `bun run` / the cli.js
// launcher) so signals hit the actual CLI process, whose scope teardown
// kills the exec child and the provider sidecars.
const alchemyBin = path.join(
root,
"node_modules",
"alchemy",
"bin",
"alchemy.ts",
);
// Isolated stage so this suite never fights integ.test.ts (same stack
// name) over state rows.
const STAGE = "dev-cli-test";
const cli = new DevCli({ root, stage: STAGE });
// Hot-reload surface: the Api service source. The test rewrites it in
// place with the CLI running, then restores it.
@@ -45,124 +35,43 @@ const MARKER_V2 = 'service: "orders-api-v2"';
const dockerAvailable =
spawnSync("docker", ["info"], { stdio: "ignore" }).status === 0;
let proc: ReturnType<typeof spawn> | undefined;
let output = "";
const pump = (stream: NodeJS.ReadableStream) => {
stream.on("data", (chunk: Buffer) => {
const text = chunk.toString();
output += text;
if (process.env.DEBUG) process.stderr.write(text);
});
};
/** Bounded poll for a (possibly async) producer to yield a value. */
const pollUntil = async <T>(
what: string,
f: () => T | undefined | Promise<T | undefined>,
{ tries = 30, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
): Promise<T> => {
for (let i = 0; i < tries; i++) {
const value = await f();
if (value !== undefined) return value;
await Bun.sleep(delayMs);
}
throw new Error(
`Timed out waiting for ${what}.\n--- alchemy dev output (tail) ---\n${output.slice(-4000)}`,
);
};
/** Fetch with retries — containers take a moment to come up. */
const fetchOk = async (
url: string | URL,
init?: RequestInit,
{ tries = 60, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
) => {
let last: Response | undefined;
for (let i = 0; i < tries; i++) {
try {
last = await fetch(url, init);
if (last.ok) return last;
} catch {
// ALB route not serving yet
}
await Bun.sleep(delayMs);
}
throw new Error(
`${init?.method ?? "GET"} ${url} never returned 2xx (last status: ${last?.status})`,
);
};
/** Extract a stack-output URL the CLI prints on stdout. */
const outputUrl = (key: string) =>
output.match(new RegExp(`\\b${key}:\\s*['"]?(http[^\\s'",]+)`))?.[1];
afterAll(async () => {
// Always leave the repo tree clean, even on a mid-reload failure.
fs.writeFileSync(apiPath, apiSource);
if (proc?.pid) {
// Ctrl-C semantics: signal the whole PROCESS GROUP (the CLI, its
// `--watch` exec child, and the provider sidecars).
const killGroup = (signal: NodeJS.Signals) => {
try {
process.kill(-proc!.pid!, signal);
} catch {
// group already gone
}
};
const exited = new Promise((resolve) => proc!.once("exit", resolve));
killGroup("SIGINT");
await Promise.race([exited, Bun.sleep(15_000)]);
if (proc.exitCode === null && proc.signalCode === null) {
killGroup("SIGKILL");
await Promise.race([exited, Bun.sleep(5_000)]);
}
}
await cli.stop();
if (!process.env.NO_DESTROY && dockerAvailable) {
spawnSync("bun", [alchemyBin, "destroy", "--stage", STAGE, "--yes"], {
cwd: root,
stdio: "inherit",
timeout: 300_000,
});
cli.destroy({ timeout: 300_000 });
}
}, 400_000);
test.skipIf(!dockerAvailable)(
"alchemy dev runs the orders app fully locally with hot reload",
async () => {
proc = spawn("bun", [alchemyBin, "dev", "--stage", STAGE], {
cwd: root,
// Own process group, so teardown can deliver Ctrl-C to the whole
// tree the way a terminal would.
detached: true,
stdio: ["ignore", "pipe", "pipe"],
});
pump(proc.stdout!);
pump(proc.stderr!);
cli.start();
// The first dev deploy builds the Api/SeedTask/Report images and pulls
// the Web image before printing stack outputs.
const url = await pollUntil(
const url = await cli.pollUntil(
"url in stack outputs",
() => outputUrl("url"),
() => cli.outputUrl("url"),
{
tries: 600,
delayMs: 1000,
},
);
const apiUrl = await pollUntil("apiUrl in stack outputs", () =>
outputUrl("apiUrl"),
const apiUrl = await cli.pollUntil("apiUrl in stack outputs", () =>
cli.outputUrl("apiUrl"),
);
const seedUrl = await pollUntil("seedUrl in stack outputs", () =>
outputUrl("seedUrl"),
const seedUrl = await cli.pollUntil("seedUrl in stack outputs", () =>
cli.outputUrl("seedUrl"),
);
// Dev identity: the emulated ALB's DNS resolves to 127.0.0.1 — no real
// AWS. The port is whatever the emulator gateway bound; only the URLs
// captured from the CLI's stdout are authoritative.
expect(url).not.toContain("amazonaws.com");
expect(output).not.toContain("apply failed");
expect(cli.output).not.toContain("apply failed");
// Api service behind the shared ALB's `/api/*` rule.
const orders = (await (await fetchOk(apiUrl)).json()) as {
@@ -178,7 +87,7 @@ test.skipIf(!dockerAvailable)(
// POST /api/seed launches the one-shot SeedTask on the local cluster
// via the RunTask binding; it seeds three orders into the local table.
await fetchOk(seedUrl, { method: "POST" });
const seeded = await pollUntil(
const seeded = await cli.pollUntil(
"seeded orders to appear",
async () => {
const res = await fetch(apiUrl);
@@ -195,7 +104,7 @@ test.skipIf(!dockerAvailable)(
fs.writeFileSync(apiPath, apiSource.replace(MARKER, MARKER_V2));
const fallbackUrl = new URL(apiUrl);
fallbackUrl.pathname = "/api/ping"; // unmatched /api/* → fallback JSON
await pollUntil(
await cli.pollUntil(
"hot-swapped api (v2 marker)",
async () => {
try {
@@ -213,7 +122,7 @@ test.skipIf(!dockerAvailable)(
// Restore — the swap back is itself a second hot reload and leaves
// the checked-in tree clean. The seeded data survives the roll.
fs.writeFileSync(apiPath, apiSource);
await pollUntil(
await cli.pollUntil(
"restored api (v1 marker)",
async () => {
try {
@@ -20,7 +20,6 @@ import Stack from "../alchemy.run.ts";
const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
providers: AWS.providers(),
state: Alchemy.localState(),
stage: "test",
});
// The first deploy builds + pushes container images and waits for two
@@ -16,8 +16,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -92,8 +92,8 @@ sbatch --nodes=1 train.sbatch
like any other Kubernetes Job or Deployment on EKS.
```sh
bun alchemy deploy ./eks.run.ts # EKS ~10-15 min + HyperPod ~10-20 min
bun alchemy destroy ./eks.run.ts
bun alchemy deploy --config ./eks.run.ts # EKS ~10-15 min + HyperPod ~10-20 min
bun alchemy destroy --config ./eks.run.ts
```
## Inspection
@@ -12,7 +12,7 @@
* TypeScript and pinned + governed through HyperPod resource attributes
* (`quota.namespace`, `quota.queueName`, the group's `nodeSelector`).
*
* Deploy with `bun alchemy deploy ./eks.run.ts`. The EKS control plane
* Deploy with `bun alchemy deploy --config ./eks.run.ts`. The EKS control plane
* takes ~10-15 minutes and the HyperPod cluster another ~10-20.
*/
import * as Alchemy from "alchemy";
@@ -16,8 +16,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -16,8 +16,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -16,8 +16,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -17,8 +17,11 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
},
"devDependencies": {
"alchemy-test": "workspace:*"
}
}
@@ -18,135 +18,35 @@
* the notification publish ride the local Subscription.
*/
import { afterAll, expect, test } from "bun:test";
import { spawn, spawnSync } from "node:child_process";
import { DevCli, fetchOk } from "alchemy-test/DevCli";
import { spawnSync } from "node:child_process";
import * as path from "node:path";
const root = path.resolve(import.meta.dirname, "..");
// Spawn the CLI entry directly (not through `bun run` / the cli.js
// launcher) so signals hit the actual CLI process, whose scope teardown
// kills the exec child and the provider sidecars.
const alchemyBin = path.join(
root,
"node_modules",
"alchemy",
"bin",
"alchemy.ts",
);
// Isolated stage so this suite never fights integ.test.ts (same stack
// name) over state rows.
const STAGE = "dev-cli-test";
const cli = new DevCli({ root, stage: STAGE });
// The whole suite needs docker (floci runs as a container).
const dockerAvailable =
spawnSync("docker", ["info"], { stdio: "ignore" }).status === 0;
let proc: ReturnType<typeof spawn> | undefined;
let output = "";
const pump = (stream: NodeJS.ReadableStream) => {
stream.on("data", (chunk: Buffer) => {
const text = chunk.toString();
output += text;
if (process.env.DEBUG) process.stderr.write(text);
});
};
/** Bounded poll for a (possibly async) producer to yield a value. */
const pollUntil = async <T>(
what: string,
f: () => T | undefined | Promise<T | undefined>,
{ tries = 30, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
): Promise<T> => {
for (let i = 0; i < tries; i++) {
const value = await f();
if (value !== undefined) return value;
await Bun.sleep(delayMs);
}
throw new Error(
`Timed out waiting for ${what}.\n--- alchemy dev output (tail) ---\n${output.slice(-4000)}`,
);
};
/** Fetch with retries — the emulator's URL proxy takes a moment to serve. */
const fetchOk = async (
url: string | URL,
init?: RequestInit,
{ tries = 20, delayMs = 500 }: { tries?: number; delayMs?: number } = {},
) => {
let last: Response | undefined;
for (let i = 0; i < tries; i++) {
try {
last = await fetch(url, init);
if (last.ok) return last;
} catch {
// proxy not listening yet
}
await Bun.sleep(delayMs);
}
throw new Error(
`${init?.method ?? "GET"} ${url} never returned 2xx (last status: ${last?.status})`,
);
};
/** Extract a stack-output URL the CLI prints on stdout. */
const outputUrl = (key: string) =>
output.match(new RegExp(`\\b${key}:\\s*['"]?(http[^\\s'",]+)`))?.[1];
afterAll(async () => {
if (proc?.pid) {
// Ctrl-C semantics: signal the whole PROCESS GROUP (the CLI, its
// `--watch` exec child, and the provider sidecars).
const killGroup = (signal: NodeJS.Signals) => {
try {
process.kill(-proc!.pid!, signal);
} catch {
// group already gone
}
};
const exited = new Promise((resolve) => proc!.once("exit", resolve));
killGroup("SIGINT");
await Promise.race([exited, Bun.sleep(15_000)]);
if (proc.exitCode === null && proc.signalCode === null) {
killGroup("SIGKILL");
await Promise.race([exited, Bun.sleep(5_000)]);
}
}
await cli.stop();
if (!process.env.NO_DESTROY && dockerAvailable) {
const destroyed = spawnSync(
"bun",
[alchemyBin, "destroy", "--stage", STAGE, "--yes"],
{
cwd: root,
stdio: "inherit",
timeout: 120_000,
},
);
if (destroyed.status !== 0) {
throw new Error(
`alchemy destroy exited ${destroyed.status} — local teardown must succeed`,
);
}
cli.destroy();
}
}, 180_000);
test.skipIf(!dockerAvailable)(
"alchemy dev applies the mixed local/live Job stack and serves jobs",
async () => {
proc = spawn("bun", [alchemyBin, "dev", "--stage", STAGE], {
cwd: root,
// Own process group, so teardown can deliver Ctrl-C to the whole
// tree the way a terminal would.
detached: true,
stdio: ["ignore", "pipe", "pipe"],
});
pump(proc.stdout!);
pump(proc.stderr!);
cli.start();
// The first dev deploy may pull the floci image and provision the
// local data plane before printing stack outputs.
const url = await pollUntil(
const url = await cli.pollUntil(
"url in stack outputs",
() => outputUrl("url"),
() => cli.outputUrl("url"),
{ tries: 300, delayMs: 1000 },
);
@@ -161,7 +61,7 @@ test.skipIf(!dockerAvailable)(
// against real AWS with floci ARNs. Outputs printing means apply
// succeeded, but pin the failure banner too so a partial apply that
// still prints outputs can never sneak past.
expect(output).not.toContain("apply failed");
expect(cli.output).not.toContain("apply failed");
const api = new URL(url);
api.search = "";
@@ -16,10 +16,10 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@types/pg": "catalog:database",
"@effect/platform-node": "catalog:",
"@types/pg": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect",
"pg": "catalog:database"
"effect": "catalog:",
"pg": "catalog:"
}
}
@@ -17,6 +17,6 @@
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -17,19 +17,19 @@
"dependencies": {
"@alchemy.run/frontend-frameworks": "workspace:*",
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect",
"react": "catalog:frontend",
"react-dom": "catalog:frontend"
"effect": "catalog:",
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"@tailwindcss/vite": "catalog:frontend",
"@types/react": "catalog:frontend",
"@types/react-dom": "catalog:frontend",
"@vitejs/plugin-react": "catalog:frontend",
"tailwindcss": "catalog:frontend",
"typescript": "catalog:build",
"vite": "catalog:build"
"@tailwindcss/vite": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@vitejs/plugin-react": "catalog:",
"tailwindcss": "catalog:",
"typescript": "catalog:",
"vite": "catalog:"
}
}
@@ -17,8 +17,8 @@
},
"dependencies": {
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@effect/platform-node": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect"
"effect": "catalog:"
}
}
@@ -10,17 +10,18 @@
"test": "bun test"
},
"dependencies": {
"astro": "catalog:frontend"
"astro": "catalog:"
},
"devDependencies": {
"@alchemy.run/frontend-frameworks": "workspace:*",
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@tailwindcss/vite": "catalog:frontend",
"@effect/platform-node": "catalog:",
"@tailwindcss/vite": "catalog:",
"alchemy": "workspace:*",
"effect": "catalog:effect",
"tailwindcss": "catalog:frontend",
"typescript": "catalog:build"
"alchemy-test": "workspace:*",
"effect": "catalog:",
"tailwindcss": "catalog:",
"typescript": "catalog:"
},
"engines": {
"node": ">=22"
@@ -14,24 +14,15 @@
* framework's HMR without a redeploy
*/
import { afterAll, expect, test } from "bun:test";
import { spawn, spawnSync } from "node:child_process";
import { DevCli, fetchOk } from "alchemy-test/DevCli";
import * as fs from "node:fs";
import * as path from "node:path";
const root = path.resolve(import.meta.dirname, "..");
// Spawn the CLI entry directly (not through `bun run` / the cli.js
// launcher) so signals hit the actual CLI process, whose scope teardown
// kills the dev server and the provider sidecars.
const alchemyBin = path.join(
root,
"node_modules",
"alchemy",
"bin",
"alchemy.ts",
);
// Isolated stage so this suite never fights integ.test.ts (same stack
// name) over state rows.
const STAGE = "dev-cli-test";
const cli = new DevCli({ root, stage: STAGE });
// Hot-reload surface: the SSR index page. The test rewrites it in place
// with the CLI running, then restores it.
@@ -40,110 +31,20 @@ const pageSource = fs.readFileSync(pagePath, "utf8");
const MARKER = "server-rendered in an AWS Lambda";
const MARKER_V2 = "server-rendered in an AWS Lambda [dev-v2]";
let proc: ReturnType<typeof spawn> | undefined;
let output = "";
const pump = (stream: NodeJS.ReadableStream) => {
stream.on("data", (chunk: Buffer) => {
const text = chunk.toString();
output += text;
if (process.env.DEBUG) process.stderr.write(text);
});
};
/** Bounded poll for a (possibly async) producer to yield a value. */
const pollUntil = async <T>(
what: string,
f: () => T | undefined | Promise<T | undefined>,
{ tries = 30, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
): Promise<T> => {
for (let i = 0; i < tries; i++) {
const value = await f();
if (value !== undefined) return value;
await Bun.sleep(delayMs);
}
throw new Error(
`Timed out waiting for ${what}.\n--- alchemy dev output (tail) ---\n${output.slice(-4000)}`,
);
};
/** Fetch with retries — the dev server takes a moment to start serving. */
const fetchOk = async (
url: string | URL,
{ tries = 30, delayMs = 1000 }: { tries?: number; delayMs?: number } = {},
) => {
let last: Response | undefined;
for (let i = 0; i < tries; i++) {
try {
last = await fetch(url);
if (last.ok) return last;
} catch {
// dev server not listening yet
}
await Bun.sleep(delayMs);
}
throw new Error(
`GET ${url} never returned 2xx (last status: ${last?.status})`,
);
};
/** Extract the stack-output URL the CLI prints on stdout. */
const outputUrl = () => output.match(/\burl:\s*['"]?(http[^\s'",]+)/)?.[1];
afterAll(async () => {
// Always leave the repo tree clean, even on a mid-reload failure.
fs.writeFileSync(pagePath, pageSource);
if (proc?.pid) {
// Ctrl-C semantics: signal the whole PROCESS GROUP (the CLI, its
// `--watch` exec child, and the provider sidecars).
const killGroup = (signal: NodeJS.Signals) => {
try {
process.kill(-proc!.pid!, signal);
} catch {
// group already gone
}
};
const exited = new Promise((resolve) => proc!.once("exit", resolve));
killGroup("SIGINT");
await Promise.race([exited, Bun.sleep(15_000)]);
if (proc.exitCode === null && proc.signalCode === null) {
killGroup("SIGKILL");
await Promise.race([exited, Bun.sleep(5_000)]);
}
}
if (!process.env.NO_DESTROY) {
const destroyed = spawnSync(
"bun",
[alchemyBin, "destroy", "--stage", STAGE, "--yes"],
{
cwd: root,
stdio: "inherit",
timeout: 120_000,
},
);
if (destroyed.status !== 0) {
throw new Error(
`alchemy destroy exited ${destroyed.status} — local teardown must succeed`,
);
}
}
await cli.stop();
if (!process.env.NO_DESTROY) cli.destroy();
}, 180_000);
test(
"alchemy dev serves the Astro site locally with hot reload",
async () => {
proc = spawn("bun", [alchemyBin, "dev", "--stage", STAGE], {
cwd: root,
// Own process group, so teardown can deliver Ctrl-C to the whole
// tree the way a terminal would.
detached: true,
stdio: ["ignore", "pipe", "pipe"],
});
pump(proc.stdout!);
pump(proc.stderr!);
cli.start();
const url = await pollUntil("url in stack outputs", outputUrl, {
const url = await cli.outputUrlWhenReady("url", {
tries: 180,
delayMs: 1000,
});
@@ -170,7 +71,7 @@ test(
// ── HOT RELOAD: rewrite the index page with the CLI still running —
// the framework dev server serves the new markup without a deploy ──
fs.writeFileSync(pagePath, pageSource.replace(MARKER, MARKER_V2));
await pollUntil(
await cli.pollUntil(
"hot-reloaded page (v2 marker)",
async () => {
try {
@@ -188,7 +89,7 @@ test(
// Restore — the swap back is itself a second hot reload and leaves
// the checked-in tree clean.
fs.writeFileSync(pagePath, pageSource);
await pollUntil(
await cli.pollUntil(
"restored page (v2 marker gone)",
async () => {
try {
@@ -45,7 +45,6 @@ const getBodyWhenReady = (url: string, expected: string) =>
const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
providers: AWS.providers(),
state: AWS.state(),
stage: "test",
});
// The first deploy runs the full Astro build AND creates a CloudFront
@@ -10,19 +10,19 @@
"test": "bun test"
},
"dependencies": {
"effect": "catalog:effect",
"foldkit": "catalog:frontend"
"effect": "catalog:",
"foldkit": "catalog:"
},
"devDependencies": {
"@alchemy.run/frontend-frameworks": "workspace:*",
"@distilled.cloud/aws": "workspace:*",
"@effect/platform-node": "catalog:effect",
"@foldkit/vite-plugin": "catalog:frontend",
"@tailwindcss/vite": "catalog:frontend",
"@effect/platform-node": "catalog:",
"@foldkit/vite-plugin": "catalog:",
"@tailwindcss/vite": "catalog:",
"alchemy": "workspace:*",
"tailwindcss": "catalog:frontend",
"typescript": "catalog:build",
"vite": "catalog:build"
"tailwindcss": "catalog:",
"typescript": "catalog:",
"vite": "catalog:"
},
"engines": {
"node": ">=22"
Loaded 100 of 3824 files, more files were not shown because too many files have changed in this diff. Show more