Guide / 02
Configuration
The .stew.yaml file is the control center for your project. It defines commands, environment variables, dependencies, and cleanup rules.
.stew.yaml Structure
commands:
dev:
parallel: true # Execute in parallel
scripts:
- name: compile
run: stew compile --watch
- name: generate
run: stew generate --watch
- name: app
run: air # Hot-reload the Go server
build:
parallel: false # Execute sequentially
scripts:
- name: compile
run: stew compile
- name: generate
run: stew generate
- name: go
run: go build -o ./bin/app .
env_files:
- .env
- .env.local # Loaded automatically into the environment
colors: # Colors for log prefixes
- '\033[32m' # Green (first script)
- '\033[34m' # Blue (second script)
- '\033[35m' # Magenta (third script)
requires: # Dependencies installed via `stew install`
- name: air
package: github.com/air-verse/air@latest
clean: # Patterns cleaned by `stew clean`
- bin/
- tmp/
The commands Section
Each key in commands defines an alias reachable via stew run <name>.
| Field | Type | Description |
|---|---|---|
| parallel | bool | If true, all scripts are launched simultaneously. If false, they run sequentially. |
| scripts[].name | string | Prefix displayed in colored logs (e.g., [compile]). |
| scripts[].run | string | Shell command to execute. Variables from env_files are available. |
Environment Variables
Files listed in env_files are loaded automatically when running any stew command. View loaded variables:
stew env
Run a one-off command with the environment:
stew exec -- go run .
Reserved Variable:
STEW_DEV=true is automatically injected during stew run dev. It enables Hot Morphing in the layout and the live-reload middleware.
The clean Section
The patterns here complement (but do not replace) Stew's automatic tracking system. The stew clean command performs two phases:
- Phase 1 (Automatic): Reads
.stew/compiled.jsonand deletes all tracked files (generated Go files + Wasm binaries). - Phase 2 (Manual): Applies the patterns defined in the
clean:section of.stew.yaml.
The **/*suffix pattern is recursive. Example: **/*.tmp deletes all .tmp files throughout the project tree.