Skip to content

feat!: command provider - #673

Merged
john-royal merged 19 commits into
mainfrom
john/command-provider
Jun 23, 2026
Merged

john-royal merged 19 commits into
mainfrom
john/command-provider

Conversation

@john-royal

@john-royal john-royal commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #538, #599, and #612.

Summary

Replaces the Build module with a unified Command module that models running shell commands as first-class resources. The old Build.Command / Build.DevServer pair is split into three focused resources sharing a common executor, and a dedicated Command.Exec resource is added for effectful commands that produce no artifact (the gap tracked in #599).

What changed

New Command module (src/Command/)

  • Command.Build — runs a shell command that produces an output asset (outdir) and tracks it in state. Inputs/outputs are content-hashed (opt-in via memo) so unchanged projects skip the rebuild. Output shape is now { outdir, hash: { input, output } }.
  • Command.Exec — runs a command purely for its side effects (migrations, codegen, seeding). No output contract: it succeeds as long as the command exits 0. Memoization is supported so it only re-runs when inputs change. (closes Build.Command's required outdir forces an artifact contract on effectful commands (no v2 Exec equivalent) #599)
  • Command.Dev — long-lived dev-server process (formerly Build.DevServer), scoped to the stack instance, runs in the dev sidecar so it survives user-code HMR, mirrors stdout/stderr, and extracts the first http(s):// URL as its url output. No-op during alchemy deploy.
  • CommandExecutor — a shared service (Command.ts) exposing spawn (returns a child-process handle) and run (collects exit code + stdout/stderr). Command output is piped live via session.note.
  • CommandError — a typed error extending Effect's PlatformError reasons (SystemError, BadArgument) with UnexpectedExit and OutputNotFound, plus an isCommandError guard.

Wiring

  • Command.providers() provides all three providers with CommandExecutorLive (src/Command/Providers.ts); src/Command/Local.ts launches the local Dev provider in the RPC sidecar.
  • Registered in both AWS/Providers.ts and Cloudflare/Providers.ts.

Consumers updated

  • AWS.Website.StaticSite, Cloudflare.Website.StaticSite, and Cloudflare.Workers.Worker now consume Command.Build / Command.Dev.
  • Docs/JSDoc ported over and the API reference + llms.txt regenerated.

Breaking changes

  • Resource type IDs renamed: Build.Command → Command.Build, Build.DevServer → Command.Dev. Existing state referencing the old IDs will not match.
  • The Build module (src/Build/*) is removed; import from alchemy's Command module instead.
  • Command.Build output shape changed from { outdir, hash: string } to { outdir, hash: { input, output } }; memo now also accepts a boolean.

Test plan

  • Command/Build.test.ts, Command/Command.test.ts, Command/Dev.test.ts pass
  • AWS + Cloudflare StaticSite smoke tests pass
  • bun tsc -b clean
  • alchemy dev correctly starts/reuses the Command.Dev server and surfaces its URL

@alchemy-version-bot

alchemy-version-bot Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

alchemy

bun add alchemy@https://pkg.ing/alchemy/9e4dfb7

@alchemy.run/better-auth

bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/9e4dfb7

@alchemy.run/pr-package

bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/9e4dfb7

@john-royal
john-royal marked this pull request as ready for review June 23, 2026 16:40
@john-royal john-royal linked an issue Jun 23, 2026 that may be closed by this pull request
@john-royal
john-royal merged commit e7127f2 into main Jun 23, 2026
8 checks passed
@john-royal
john-royal deleted the john/command-provider branch June 23, 2026 20:00
AmanVarshney01 added a commit to AmanVarshney01/alchemy-effect that referenced this pull request Jul 8, 2026
…PI surface

- rework ConnectionBinding to the single binding convention (alchemy-run#690): combined
  tag/callable + Binding.Host dispatch inside ConnectionBindingLive, drop
  Binding.Policy machinery and its Providers registrations
- replace the removed Build/Command helper (alchemy-run#673) with a local spawner-based
  runBuildCommand in ComputeBuild
- update shape-typed class forms to the id-only + .make(props, impl) Platform API
- add the /v1/apps, /v1/deployments, and build-logs surface to the client,
  operation helpers, and route-parity tests (96-route coverage)
- add ScmInstallation.connected/connectedAt, the connected list filter, and
  connectScmInstallation for the new SCM connect endpoint; unreleased routes
  are allowlisted until they ship to the production OpenAPI doc
DavidJFelix pushed a commit to DavidJFelix/alchemy-effect that referenced this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant