chore: Add Air hot-reload configuration

Adds .air.toml for air-verse/air hot-reload during development:
- Watches Go files in cmd/, internal/, pkg/
- Excludes tests, vendor, node_modules, frontend
- Automatically rebuilds on file changes
- Supports Pro build detection via HOT_DEV_USE_PRO env var
- Kill delay and graceful shutdown configured
This commit is contained in:
rcourtman
2026-01-19 19:26:50 +00:00
parent a6a8efaa65
commit 6e22dad57f

47
.air.toml Normal file
View File

@@ -0,0 +1,47 @@
# Air configuration for Pulse hot-reload
# https://github.com/air-verse/air
root = "."
tmp_dir = "tmp"
[build]
# Build command - uses Pro build if available
cmd = """
if [ -d /opt/pulse-enterprise ] && [ "${HOT_DEV_USE_PRO:-true}" = "true" ]; then
cd /opt/pulse-enterprise && go build -buildvcs=false -o /opt/pulse/pulse ./cmd/pulse-enterprise
else
go build -o pulse ./cmd/pulse
fi
"""
# Binary to run
bin = "./pulse"
# Watch these directories
include_dir = ["cmd", "internal", "pkg"]
# Exclude these patterns
exclude_dir = ["vendor", "node_modules", "tmp", "frontend-modern", ".git"]
exclude_file = []
exclude_regex = ["_test\\.go$", "\\.tmp$", "~$"]
exclude_unchanged = true
# File extensions to watch
include_ext = ["go", "tpl", "tmpl", "html"]
# Kill old process before starting new one
kill_delay = "1s"
# Send interrupt signal first, then kill after delay
stop_on_error = false
# Log output
log = "build-errors.log"
# Colorize output
color_main = "yellow"
color_watcher = "cyan"
color_build = "green"
color_runner = "magenta"
[log]
# Show log time
time = false
# Only show main logs
main_only = false
[misc]
# Delete tmp directory on exit
clean_on_exit = true