diff --git a/AGENTS.md b/AGENTS.md index 7f26e1e..2693e87 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,7 @@ The frontend builds to `frontend/public/dist/`, then `make frontend` copies the make all # Build frontend + backend make frontend # Build frontend, copy to backend/web/static/ make backend # Build Go binary (requires frontend assets) -make dev # Run both with hot-reload +make dev # Run frontend watcher + backend hot reload via air make tests # Run Go tests make docker # Build Docker image ``` diff --git a/Makefile b/Makefile index 369e4ed..5571ce7 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ clean: dev: rm -rf frontend/public/dist cd frontend && bun run build - cd backend && AETHERA_STATIC_DIR=../frontend/public go run ./cmd --listen 0.0.0.0 & \ + cd backend && AETHERA_STATIC_DIR=../frontend/public air & \ backend_pid=$$!; \ trap 'kill $$backend_pid' INT TERM EXIT; \ cd frontend && bun run dev diff --git a/backend/.air.toml b/backend/.air.toml new file mode 100644 index 0000000..f1487c2 --- /dev/null +++ b/backend/.air.toml @@ -0,0 +1,30 @@ +root = "." +tmp_dir = "tmp" + +[build] +cmd = "go build -o ./tmp/aethera ./cmd" +bin = "./tmp/aethera" +full_bin = "./tmp/aethera --listen 0.0.0.0" +delay = 1000 +exclude_dir = ["data", "dist", "tmp", "web/static"] +exclude_file = [] +exclude_regex = ["_test.go"] +include_dir = [] +include_ext = ["go", "mod", "sum"] +kill_delay = "500ms" +log = "build-errors.log" +send_interrupt = true +stop_on_error = true + +[color] +app = "" +build = "yellow" +main = "magenta" +runner = "green" +watcher = "cyan" + +[log] +time = false + +[misc] +clean_on_exit = true diff --git a/backend/AGENTS.md b/backend/AGENTS.md index 326a437..7fe5bbd 100644 --- a/backend/AGENTS.md +++ b/backend/AGENTS.md @@ -3,6 +3,7 @@ ## Stack - **Go 1.25.5** (`reichard.io/aethera`) +- **air** (backend hot reload for `make dev`) - **cobra** (CLI framework) - **logrus** (structured logging) - **openai-go/v3** (OpenAI API client) diff --git a/flake.nix b/flake.nix index e848594..2fb639c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,7 @@ devShells.default = pkgs.mkShell { packages = with pkgs; [ # Backend + air go gopls golangci-lint