Exec
Source:
src/Command/Exec.ts
An Exec runs a shell command purely for its side effects — it has no
output contract. Unlike Build, it does not produce or track an output
asset; reconcile runs the command and the resource succeeds as long as the
command exits with code 0 (a non-zero exit fails with a CommandError).
Use it for one-off setup steps — running migrations, seeding data, code
generation, or any command whose result lives outside Alchemy’s state. By
default the input files are content-hashed so the command only re-runs when
its inputs (or command/cwd/env) change; set memo: false to re-run on
every deploy.
Running a Command
Section titled “Running a Command”yield* Exec("codegen", { command: "npm run codegen", cwd: "./packages/api",});Running with Custom Environment
Section titled “Running with Custom Environment”yield* Exec("migrate", { command: "npm run db:migrate", env: { DATABASE_URL: Redacted.make("postgres://..."), },});Memoizing Re-Runs
Section titled “Memoizing Re-Runs”yield* Exec("codegen", { command: "npm run codegen", memo: { include: ["schema/**"] },});