From c86ac1e389a66e31d509a489627f772955d52c10 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 7 Jan 2026 20:24:49 -0500 Subject: [PATCH] docs(AGENTS): add Nebula project guidelines document --- AGENTS.md | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..aaf4503 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,227 @@ +# AGENTS.md - Nebula Project Guidelines + +## Project Overview + +Nebula is a Go/Templ wallet application with HTMX 4 for server-driven UI and WebAwesome (wa-*) web components. + +**Stack**: Go 1.25+ | templ v0.3.977 | htmx 4.0.0-alpha5 | WebAwesome | SQLite WASM + +## Build & Run Commands + +```bash +# Generate Go code from .templ files (REQUIRED after any .templ changes) +templ generate + +# Build the project +go build ./... + +# Run development server (serves on :8080) +go run main.go + +# Watch mode for templ files +templ generate --watch + +# Full build + run + open browser +make all +``` + +## Directory Structure + +``` +nebula/ +├── models/ # Data types (MVC models) +├── views/ # Page templates (.templ) +├── layouts/ # Base layouts (DashboardLayout, CenteredLayout) +├── components/ # Reusable UI components +├── handlers/ # HTTP route handlers +├── _migrate/ # HTML prototypes to convert +├── HTMX.md # htmx 4 patterns documentation +└── SQLC.md # Database schema documentation +``` + +## Code Style + +### Go Files + +- Standard `gofmt` formatting +- Package-level types in `models/` directory +- Handlers in `handlers/routes.go` with pattern: `handleX(w http.ResponseWriter, r *http.Request)` +- Use `r.Header.Get("HX-Request") == "true"` to detect HTMX requests +- Return partials for HTMX, full pages for direct navigation + +### Templ Files (.templ) + +- One main page template per file: `PageName(data ModelType) templ.Component` +- Helper functions lowercase: `helperName()` +- CSS-in-templ using `templ css` blocks or `