Files
nerd-monitor/AGENTS.md
Ducky SSH User 50dcfcdc83
All checks were successful
Build and Release / build (push) Successful in 35s
Add logging and fix /agents/ route error
2025-12-20 07:34:02 +00:00

21 lines
1.0 KiB
Markdown

# Nerd Monitor - Agent Guidelines
## Build & Test Commands
- **Generate templates**: `make templ`
- **Build**: `make build` (server + agent) or `make build-server`/`make build-agent`
- **Cross-platform**: `make build-all`
- **Clean**: `make clean`
- **Test all**: `go test ./...`
- **Test single**: `go test -run TestName ./package`
- **Format**: `gofmt -w ./cmd ./internal ./views`
Note: Go 1.23+ project using Templ templating. Run `make templ` before building.
## Code Style Guidelines
- **Imports**: stdlib → third-party → internal (alphabetical within groups)
- **Formatting**: `gofmt` standards, explicit exported struct comments
- **Naming**: CamelCase exports, lowercase unexported, single-letter receivers (e.g., `(h *Handler)`)
- **Error Handling**: Explicit checks, `http.Error()` for HTTP, contextual wrapping
- **Concurrency**: `sync.RWMutex` for shared state, defer lock releases, small critical sections
- **HTTP**: Chi router, `func (h *Handler) Method(w http.ResponseWriter, r *http.Request)`, set Content-Type, validate early